TelescopeConfigurationDialog.cpp   TelescopeConfigurationDialog.cpp 
skipping to change at line 299 skipping to change at line 299
ui->groupBoxDeviceSettings->setEnabled(!isChecked); ui->groupBoxDeviceSettings->setEnabled(!isChecked);
ui->groupBoxConnectionSettings->setEnabled(!isChecked); ui->groupBoxConnectionSettings->setEnabled(!isChecked);
ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties) ; ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties) ;
} }
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();
if(host.isEmpty())//TODO: Validate host
if(host.isEmpty() || !validateHost(host))
return; return;
int delay = MICROSECONDS_FROM_SECONDS(ui->doubleSpinBoxTelescopeDela y->value()); int delay = MICROSECONDS_FROM_SECONDS(ui->doubleSpinBoxTelescopeDela y->value());
int portTCP = ui->spinBoxTCPPort->value(); int portTCP = ui->spinBoxTCPPort->value();
bool connectAtStartup = ui->checkBoxConnectAtStartup->isChecked(); bool connectAtStartup = ui->checkBoxConnectAtStartup->isChecked();
//Circles //Circles
//TODO: This will change if there is a validator for that field //TODO: This will change if there is a validator for that field
QList<double> circles; QList<double> circles;
QString rawCircles = ui->lineEditCircleList->text().trimmed(); QString rawCircles = ui->lineEditCircleList->text().trimmed();
skipping to change at line 374 skipping to change at line 377
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(telescopeManager->getDevice Models().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)
{
// Simple validation by ping
int exitCode;
#ifdef Q_OS_WIN32
// WTF? It's not working anymore!
//exitCode = QProcess::execute("ping", QStringList() << "-n 1" << hostN
ame);
exitCode = 0;
#else
exitCode = QProcess::execute("ping", QStringList() << "-c1" << hostName
);
#endif
return (0 == exitCode);
//TODO: Add debug if host not alive?
}
 End of changes. 4 change blocks. 
1 lines changed or deleted 4 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/