TelescopeConfigurationDialog.cpp   TelescopeConfigurationDialog.cpp 
/* /*
* Stellarium TelescopeControl Plug-in * Stellarium TelescopeControl Plug-in
* *
* Copyright (C) 2009-2010 Bogdan Marinov (this file) * Copyright (C) 2009-2011 Bogdan Marinov (this file)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Dialog.hpp" #include "Dialog.hpp"
#include "ui_telescopeConfigurationDialog.h" #include "ui_telescopeConfigurationDialog.h"
#include "TelescopeConfigurationDialog.hpp" #include "TelescopeConfigurationDialog.hpp"
#include "TelescopeControl.hpp" #include "TelescopeControl.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelStyle.hpp" #include "StelStyle.hpp"
#include "StelTranslator.hpp"
#include <QDebug> #include <QDebug>
#include <QCompleter> #include <QCompleter>
#include <QFrame> #include <QFrame>
#include <QTimer> #include <QTimer>
TelescopeConfigurationDialog::TelescopeConfigurationDialog() TelescopeConfigurationDialog::TelescopeConfigurationDialog()
{ {
ui = new Ui_telescopeConfigurationDialog; ui = new Ui_telescopeConfigurationDialog;
skipping to change at line 63 skipping to change at line 64
TelescopeConfigurationDialog::~TelescopeConfigurationDialog() TelescopeConfigurationDialog::~TelescopeConfigurationDialog()
{ {
delete ui; delete ui;
delete telescopeNameValidator; delete telescopeNameValidator;
delete hostNameValidator; delete hostNameValidator;
delete circleListValidator; delete circleListValidator;
delete serialPortValidator; delete serialPortValidator;
} }
void TelescopeConfigurationDialog::languageChanged() void TelescopeConfigurationDialog::retranslate()
{ {
if (dialog) if (dialog)
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
} }
// Initialize the dialog widgets and connect the signals/slots // Initialize the dialog widgets and connect the signals/slots
void TelescopeConfigurationDialog::createDialogContent() void TelescopeConfigurationDialog::createDialogContent()
{ {
ui->setupUi(dialog); ui->setupUi(dialog);
//Inherited connect //Inherited connect
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(languageChanged())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate()));
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(buttonDis cardPressed())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(buttonDis cardPressed()));
connect(dialog, SIGNAL(rejected()), this, SLOT(buttonDiscardPressed( ))); connect(dialog, SIGNAL(rejected()), this, SLOT(buttonDiscardPressed( )));
//Connect: sender, signal, receiver, member //Connect: sender, signal, receiver, member
connect(ui->radioButtonTelescopeLocal, SIGNAL(toggled(bool)), this, SLOT(toggleTypeLocal(bool))); connect(ui->radioButtonTelescopeLocal, SIGNAL(toggled(bool)), this, SLOT(toggleTypeLocal(bool)));
connect(ui->radioButtonTelescopeConnection, SIGNAL(toggled(bool)), t his, SLOT(toggleTypeConnection(bool))); connect(ui->radioButtonTelescopeConnection, SIGNAL(toggled(bool)), t his, SLOT(toggleTypeConnection(bool)));
connect(ui->radioButtonTelescopeVirtual, SIGNAL(toggled(bool)), this , SLOT(toggleTypeVirtual(bool))); connect(ui->radioButtonTelescopeVirtual, SIGNAL(toggled(bool)), this , SLOT(toggleTypeVirtual(bool)));
connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(buttonSave Pressed())); connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(buttonSave Pressed()));
connect(ui->pushButtonDiscard, SIGNAL(clicked()), this, SLOT(buttonD iscardPressed())); connect(ui->pushButtonDiscard, SIGNAL(clicked()), this, SLOT(buttonD iscardPressed()));
skipping to change at line 102 skipping to change at line 103
ui->lineEditCircleList->setValidator(circleListValidator); ui->lineEditCircleList->setValidator(circleListValidator);
ui->lineEditSerialPort->setValidator(serialPortValidator); ui->lineEditSerialPort->setValidator(serialPortValidator);
} }
//Set the configuration panel in a predictable state //Set the configuration panel in a predictable state
void TelescopeConfigurationDialog::initConfigurationDialog() void TelescopeConfigurationDialog::initConfigurationDialog()
{ {
//Reusing code used in both methods that call this one //Reusing code used in both methods that call this one
deviceModelNames = telescopeManager->getDeviceModels().keys(); deviceModelNames = telescopeManager->getDeviceModels().keys();
//Type
ui->radioButtonTelescopeLocal->setEnabled(true);
//Name //Name
ui->lineEditTelescopeName->clear(); ui->lineEditTelescopeName->clear();
//Equinox //Equinox
ui->radioButtonJ2000->setChecked(true); ui->radioButtonJ2000->setChecked(true);
//Connect at startup //Connect at startup
ui->checkBoxConnectAtStartup->setChecked(false); ui->checkBoxConnectAtStartup->setChecked(false);
//Serial port //Serial port
skipping to change at line 131 skipping to change at line 129
if (!deviceModelNames.isEmpty()) if (!deviceModelNames.isEmpty())
{ {
deviceModelNames.sort(); deviceModelNames.sort();
ui->comboBoxDeviceModel->addItems(deviceModelNames); ui->comboBoxDeviceModel->addItems(deviceModelNames);
} }
ui->comboBoxDeviceModel->setCurrentIndex(0); ui->comboBoxDeviceModel->setCurrentIndex(0);
//FOV circles //FOV circles
ui->checkBoxCircles->setChecked(false); ui->checkBoxCircles->setChecked(false);
ui->lineEditCircleList->clear(); ui->lineEditCircleList->clear();
}
void TelescopeConfigurationDialog::initNewTelescopeConfiguration(int slot)
{
configuredSlot = slot;
initConfigurationDialog();
ui->stelWindowTitle->setText("Add New Telescope");
ui->lineEditTelescopeName->setText(QString("New Telescope %1").arg(Q
String::number(configuredSlot)));
//It is very unlikely that this situation will happen any more due t
o the
//embedded telescope servers.
if(deviceModelNames.isEmpty()) if(deviceModelNames.isEmpty())
{ {
ui->radioButtonTelescopeLocal->setEnabled(false); ui->radioButtonTelescopeLocal->setEnabled(false);
ui->radioButtonTelescopeConnection->setChecked(true); ui->radioButtonTelescopeConnection->setChecked(true);
toggleTypeConnection(true);//Not called if the button is alr eady checked toggleTypeConnection(true);//Not called if the button is alr eady checked
} }
else else
{ {
ui->radioButtonTelescopeLocal->setEnabled(true); ui->radioButtonTelescopeLocal->setEnabled(true);
ui->radioButtonTelescopeLocal->setChecked(true); ui->radioButtonTelescopeLocal->setChecked(true);
toggleTypeLocal(true);//Not called if the button is already checked toggleTypeLocal(true);//Not called if the button is already checked
} }
}
void TelescopeConfigurationDialog::initNewTelescopeConfiguration(int slot)
{
configuredSlot = slot;
initConfigurationDialog();
ui->stelWindowTitle->setText(q_("Add New Telescope"));
ui->lineEditTelescopeName->setText(QString("New Telescope %1").arg(Q
String::number(configuredSlot)));
ui->doubleSpinBoxTelescopeDelay->setValue(SECONDS_FROM_MICROSECONDS( DEFAULT_DELAY)); ui->doubleSpinBoxTelescopeDelay->setValue(SECONDS_FROM_MICROSECONDS( DEFAULT_DELAY));
} }
void TelescopeConfigurationDialog::initExistingTelescopeConfiguration(int s lot) void TelescopeConfigurationDialog::initExistingTelescopeConfiguration(int s lot)
{ {
configuredSlot = slot; configuredSlot = slot;
initConfigurationDialog(); initConfigurationDialog();
ui->stelWindowTitle->setText("Configure Telescope"); ui->stelWindowTitle->setText(q_("Configure Telescope"));
//Read the telescope properties //Read the telescope properties
QString name; QString name;
ConnectionType connectionType; ConnectionType connectionType;
QString equinox; QString equinox;
QString host; QString host;
int portTCP; int portTCP;
int delay; int delay;
bool connectAtStartup; bool connectAtStartup;
QList<double> circles; QList<double> circles;
skipping to change at line 207 skipping to change at line 207
ui->comboBoxDeviceModel->setCurrentIndex(index); ui->comboBoxDeviceModel->setCurrentIndex(index);
} }
//Initialize the serial port value //Initialize the serial port value
ui->lineEditSerialPort->setText(serialPortName); ui->lineEditSerialPort->setText(serialPortName);
} }
else if (connectionType == ConnectionRemote) else if (connectionType == ConnectionRemote)
{ {
ui->radioButtonTelescopeConnection->setChecked(true);//Calls toggleTypeConnection(true) ui->radioButtonTelescopeConnection->setChecked(true);//Calls toggleTypeConnection(true)
ui->lineEditHostName->setText(host); ui->lineEditHostName->setText(host);
} }
else if (connectionType == ConnectionLocal)
{
ui->radioButtonTelescopeConnection->setChecked(true);
ui->lineEditHostName->setText("localhost");
}
else else
{ {
ui->radioButtonTelescopeVirtual->setChecked(true); ui->radioButtonTelescopeVirtual->setChecked(true);
} }
//Equinox //Equinox
if (equinox == "JNow") if (equinox == "JNow")
ui->radioButtonJNow->setChecked(true); ui->radioButtonJNow->setChecked(true);
else else
ui->radioButtonJ2000->setChecked(true); ui->radioButtonJ2000->setChecked(true);
 End of changes. 11 change blocks. 
17 lines changed or deleted 23 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/