TelescopeConfigurationDialog.cpp   TelescopeConfigurationDialog.cpp 
skipping to change at line 136 skipping to change at line 136
//Inherited connect //Inherited connect
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate())); 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(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMove dTo(QPoint))); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMove dTo(QPoint)));
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->radioButtonTelescopeRTS2, SIGNAL(toggled(bool)), this, S LOT(toggleTypeRTS2(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()));
connect(ui->comboBoxDeviceModel, SIGNAL(currentIndexChanged(const QS tring&)), this, SLOT(deviceModelSelected(const QString&))); connect(ui->comboBoxDeviceModel, SIGNAL(currentIndexChanged(const QS tring&)), this, SLOT(deviceModelSelected(const QString&)));
//Setting validators //Setting validators
ui->lineEditTelescopeName->setValidator(telescopeNameValidator); ui->lineEditTelescopeName->setValidator(telescopeNameValidator);
ui->lineEditHostName->setValidator(hostNameValidator); ui->lineEditHostName->setValidator(hostNameValidator);
ui->lineEditCircleList->setValidator(circleListValidator); ui->lineEditCircleList->setValidator(circleListValidator);
ui->comboSerialPort->setValidator(serialPortValidator); ui->comboSerialPort->setValidator(serialPortValidator);
} }
//Set the configuration panel in a predictable state //Set the configuration panel in a predictable state
void TelescopeConfigurationDialog::initConfigurationDialog() void TelescopeConfigurationDialog::initConfigurationDialog()
{ {
ui->groupBoxConnectionSettings->hide();
ui->groupBoxDeviceSettings->hide();
ui->groupBoxRTS2Settings->hide();
//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();
//Name //Name
ui->lineEditTelescopeName->clear(); ui->lineEditTelescopeName->clear();
//Equinox //Equinox
ui->radioButtonJ2000->setChecked(true); ui->radioButtonJ2000->setChecked(true);
//Connect at startup //Connect at startup
skipping to change at line 228 skipping to change at line 233
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;
QString deviceModelName; QString deviceModelName;
QString serialPortName; QString serialPortName;
if(!telescopeManager->getTelescopeAtSlot(slot, connectionType, name, QString rts2Url;
equinox, host, portTCP, delay, connectAtStartup, circles, deviceModelName, QString rts2Username;
serialPortName)) QString rts2Password;
if(!telescopeManager->getTelescopeAtSlot(slot, connectionType, name,
equinox, host, portTCP, delay, connectAtStartup, circles, deviceModelName,
serialPortName, rts2Url, rts2Username, rts2Password))
{ {
//TODO: Add debug //TODO: Add debug
return; return;
} }
ui->lineEditTelescopeName->setText(name); ui->lineEditTelescopeName->setText(name);
if(!deviceModelName.isEmpty()) if(!deviceModelName.isEmpty())
{ {
ui->radioButtonTelescopeLocal->setChecked(true); ui->radioButtonTelescopeLocal->setChecked(true);
skipping to change at line 268 skipping to change at line 276
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) else if (connectionType == ConnectionLocal)
{ {
ui->radioButtonTelescopeConnection->setChecked(true); ui->radioButtonTelescopeConnection->setChecked(true);
ui->lineEditHostName->setText("localhost"); ui->lineEditHostName->setText("localhost");
} }
else else if (connectionType == ConnectionVirtual)
{ {
ui->radioButtonTelescopeVirtual->setChecked(true); ui->radioButtonTelescopeVirtual->setChecked(true);
} }
else if (connectionType == ConnectionRTS2)
{
ui->radioButtonTelescopeRTS2->setChecked(true);
ui->lineEditRTS2Url->setText(rts2Url);
ui->lineEditRTS2Username->setText(rts2Username);
ui->lineEditRTS2Password->setText(rts2Password);
}
//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);
//Circles //Circles
if(!circles.isEmpty()) if(!circles.isEmpty())
{ {
skipping to change at line 313 skipping to change at line 328
{ {
//Re-initialize values that may have been changed //Re-initialize values that may have been changed
ui->comboBoxDeviceModel->setCurrentIndex(0); ui->comboBoxDeviceModel->setCurrentIndex(0);
QStringList *plist = listSerialPorts(); QStringList *plist = listSerialPorts();
ui->comboSerialPort->activated(plist->value(0)); ui->comboSerialPort->activated(plist->value(0));
ui->comboSerialPort->setEditText(plist->value(0)); ui->comboSerialPort->setEditText(plist->value(0));
delete(plist); delete(plist);
ui->lineEditHostName->setText("localhost"); ui->lineEditHostName->setText("localhost");
ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(confi guredSlot)); ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(confi guredSlot));
//Enable/disable controls ui->groupBoxDeviceSettings->show();
ui->labelHost->setEnabled(false);
ui->lineEditHostName->setEnabled(false);
ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopePro perties); ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopePro perties);
} }
else else
{ {
ui->labelHost->setEnabled(true); ui->groupBoxDeviceSettings->hide();
ui->lineEditHostName->setEnabled(true);
} }
} }
void TelescopeConfigurationDialog::toggleTypeConnection(bool isChecked) void TelescopeConfigurationDialog::toggleTypeConnection(bool isChecked)
{ {
if(isChecked) if(isChecked)
{ {
//Re-initialize values that may have been changed //Re-initialize values that may have been changed
ui->lineEditHostName->setText("localhost"); ui->lineEditHostName->setText("localhost");
ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(confi guredSlot)); ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(confi guredSlot));
ui->groupBoxDeviceSettings->setEnabled(false); ui->groupBoxConnectionSettings->show();
ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopePro perties); ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopePro perties);
} }
else else
{ {
ui->groupBoxDeviceSettings->setEnabled(true); ui->groupBoxConnectionSettings->hide();
} }
} }
void TelescopeConfigurationDialog::toggleTypeVirtual(bool isChecked) void TelescopeConfigurationDialog::toggleTypeVirtual(bool isChecked)
{ {
//TODO: This really should be done in the GUI Q_UNUSED(isChecked);
ui->groupBoxDeviceSettings->setEnabled(!isChecked);
ui->groupBoxConnectionSettings->setEnabled(!isChecked);
ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties) ; ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties) ;
} }
void TelescopeConfigurationDialog::toggleTypeRTS2(bool isChecked)
{
if(isChecked)
{
//Re-initialize values that may have been changed
ui->lineEditRTS2Url->setText("localhost:8889");
ui->groupBoxRTS2Settings->show();
ui->scrollArea->ensureWidgetVisible(ui->groupBoxRTS2Settings
);
}
else
{
ui->groupBoxRTS2Settings->hide();
}
}
void TelescopeConfigurationDialog::buttonSavePressed() void TelescopeConfigurationDialog::buttonSavePressed()
{ {
//Main telescope properties //Main telescope properties
QString name = ui->lineEditTelescopeName->text().trimmed(); QString name = ui->lineEditTelescopeName->text().trimmed();
if(name.isEmpty()) if(name.isEmpty())
return; return;
QString host = ui->lineEditHostName->text(); QString host = ui->lineEditHostName->text();
skipping to change at line 418 skipping to change at line 444
type = ConnectionLocal; type = ConnectionLocal;
else else
type = ConnectionRemote; type = ConnectionRemote;
telescopeManager->addTelescopeAtSlot(configuredSlot, type, n ame, equinox, host, portTCP, delay, connectAtStartup, circles); telescopeManager->addTelescopeAtSlot(configuredSlot, type, n ame, equinox, host, portTCP, delay, connectAtStartup, circles);
} }
else if (ui->radioButtonTelescopeVirtual->isChecked()) else if (ui->radioButtonTelescopeVirtual->isChecked())
{ {
type = ConnectionVirtual; type = ConnectionVirtual;
telescopeManager->addTelescopeAtSlot(configuredSlot, type, n ame, equinox, QString(), portTCP, delay, connectAtStartup, circles); telescopeManager->addTelescopeAtSlot(configuredSlot, type, n ame, equinox, QString(), portTCP, delay, connectAtStartup, circles);
} }
else if (ui->radioButtonTelescopeRTS2->isChecked())
{
type = ConnectionRTS2;
telescopeManager->addTelescopeAtSlot(configuredSlot, type, n
ame, equinox, host, portTCP, delay, connectAtStartup, circles, QString(), Q
String(), ui->lineEditRTS2Url->text(), ui->lineEditRTS2Username->text(), ui
->lineEditRTS2Password->text());
}
emit changesSaved(name, type); emit changesSaved(name, type);
} }
void TelescopeConfigurationDialog::buttonDiscardPressed() void TelescopeConfigurationDialog::buttonDiscardPressed()
{ {
emit changesDiscarded(); emit changesDiscarded();
} }
void TelescopeConfigurationDialog::deviceModelSelected(const QString& devic eModelName) void TelescopeConfigurationDialog::deviceModelSelected(const QString& devic eModelName)
{ {
ui->labelDeviceModelDescription->setText(telescopeManager->getDevice Models().value(deviceModelName).description); ui->labelDeviceModelDescription->setText(q_(telescopeManager->getDev iceModels().value(deviceModelName).description));
ui->doubleSpinBoxTelescopeDelay->setValue(SECONDS_FROM_MICROSECONDS( telescopeManager->getDeviceModels().value(deviceModelName).defaultDelay)); ui->doubleSpinBoxTelescopeDelay->setValue(SECONDS_FROM_MICROSECONDS( telescopeManager->getDeviceModels().value(deviceModelName).defaultDelay));
} }
bool TelescopeConfigurationDialog::validateHost(QString hostName) bool TelescopeConfigurationDialog::validateHost(QString hostName)
{ {
// Simple validation by ping // Simple validation by ping
int exitCode; int exitCode;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// WTF? It's not working anymore! // WTF? It's not working anymore!
//exitCode = QProcess::execute("ping", QStringList() << "-n 1" << hostN ame); //exitCode = QProcess::execute("ping", QStringList() << "-n 1" << hostN ame);
 End of changes. 13 change blocks. 
16 lines changed or deleted 51 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/