TelescopeConfigurationDialog.cpp   TelescopeConfigurationDialog.cpp 
skipping to change at line 51 skipping to change at line 51
TelescopeConfigurationDialog::TelescopeConfigurationDialog() TelescopeConfigurationDialog::TelescopeConfigurationDialog()
: configuredSlot(0) : configuredSlot(0)
{ {
ui = new Ui_telescopeConfigurationDialog; ui = new Ui_telescopeConfigurationDialog;
telescopeManager = GETSTELMODULE(TelescopeControl); telescopeManager = GETSTELMODULE(TelescopeControl);
telescopeNameValidator = new QRegExpValidator (QRegExp("[^:\"]+"), t his);//Test the update for JSON telescopeNameValidator = new QRegExpValidator (QRegExp("[^:\"]+"), t his);//Test the update for JSON
hostNameValidator = new QRegExpValidator (QRegExp("[a-zA-Z0-9\\-\\.] +"), this);//TODO: Write a proper host/IP regexp? hostNameValidator = new QRegExpValidator (QRegExp("[a-zA-Z0-9\\-\\.] +"), this);//TODO: Write a proper host/IP regexp?
circleListValidator = new QRegExpValidator (QRegExp("[0-9,\\.\\s]+") , this); circleListValidator = new QRegExpValidator (QRegExp("[0-9,\\.\\s]+") , this);
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
serialPortValidator = new QRegExpValidator (QRegExp("COM[0-9]+"), th is); serialPortValidator = new QRegExpValidator (QRegExp("COM[0-9]+"), th is);
#else #else
serialPortValidator = new QRegExpValidator (QRegExp("/.*"), this); serialPortValidator = new QRegExpValidator (QRegExp("/.*"), this);
#endif #endif
} }
TelescopeConfigurationDialog::~TelescopeConfigurationDialog() TelescopeConfigurationDialog::~TelescopeConfigurationDialog()
{ {
delete ui; delete ui;
skipping to change at line 392 skipping to change at line 392
if (ui->radioButtonJNow->isChecked()) if (ui->radioButtonJNow->isChecked())
equinox = "JNow"; equinox = "JNow";
//Type and server properties //Type and server properties
//TODO: When adding, check for success! //TODO: When adding, check for success!
ConnectionType type = ConnectionNA; ConnectionType type = ConnectionNA;
if(ui->radioButtonTelescopeLocal->isChecked()) if(ui->radioButtonTelescopeLocal->isChecked())
{ {
//Read the serial port //Read the serial port
QString serialPortName = ui->comboSerialPort->currentText(); QString serialPortName = ui->comboSerialPort->currentText();
if(!serialPortName.startsWith(SERIAL_PORT_PREFIX))
return;//TODO: Add more validation!
type = ConnectionInternal; type = ConnectionInternal;
telescopeManager->addTelescopeAtSlot(configuredSlot, type, n ame, equinox, host, portTCP, delay, connectAtStartup, circles, ui->comboBox DeviceModel->currentText(), serialPortName); telescopeManager->addTelescopeAtSlot(configuredSlot, type, n ame, equinox, host, portTCP, delay, connectAtStartup, circles, ui->comboBox DeviceModel->currentText(), serialPortName);
} }
else if (ui->radioButtonTelescopeConnection->isChecked()) else if (ui->radioButtonTelescopeConnection->isChecked())
{ {
if(host == "localhost") if(host == "localhost")
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);
skipping to change at line 430 skipping to change at line 427
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) bool TelescopeConfigurationDialog::validateHost(QString hostName)
{ {
// Simple validation by ping // Simple validation by ping
int exitCode; int exitCode;
#ifdef Q_OS_WIN32 #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);
exitCode = 0; exitCode = 0;
#else #else
exitCode = QProcess::execute("ping", QStringList() << "-c1" << hostName ); exitCode = QProcess::execute("ping", QStringList() << "-c1" << hostName );
#endif #endif
return (0 == exitCode); return (0 == exitCode);
//TODO: Add debug if host not alive? //TODO: Add debug if host not alive?
} }
 End of changes. 3 change blocks. 
5 lines changed or deleted 2 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/