toBrowserAccessWidget::toBrowserAccessWidget(QWidget * parent) : toBrowserBaseWidget(parent) { setObjectName("toBrowserAccessWidget"); #ifdef TOEXTENDED_MYSQL // This is propably never compiled... // I'm leaving this code as is UserPanel = new toMySQLUser(curr, TAB_ACCESS_USER); curr->addTab(UserPanel, tr("&User")); SecondMap[TAB_ACCESS] = UserPanel; SecondMap[TAB_ACCESS_USER] = UserPanel; AccessPanel = new toMySQLUserAccess(curr, TAB_ACCESS_OBJECTS); curr->addTab(AccessPanel, tr("&Objects")); SecondMap[TAB_ACCESS_OBJECTS] = UserPanel; // Yes, it should be // this one, it will // signal the // TAB_ACCESS_OBJECTS // to update. connect(AccessPanel, SIGNAL(hasChanged()), UserPanel, SLOT(hasChanged())); connect(UserPanel, SIGNAL(saveChanges(const QString &, const QString &)), AccessPanel, SLOT(saveChanges(const QString &, const QString &))); connect(UserPanel, SIGNAL(changeUser(const QString &)), AccessPanel, SLOT(changeUser(const QString &))); accessContent = new toResultData(curr, TAB_ACCESS_CONTENT); accessContent->setObjectName("accessContent"); #else accessContent = new toResultData(this); accessContent->setObjectName("accessContent"); connect(accessContent, SIGNAL(changesSaved()), this, SLOT(flushPrivs())); #endif changeConnection(); }
void TelescopeConfigurationDialog::buttonSavePressed() { //Main telescope properties QString name = ui->lineEditTelescopeName->text().trimmed(); if(name.isEmpty()) return; QString host = ui->lineEditHostName->text(); if(host.isEmpty())//TODO: Validate host return; int delay = MICROSECONDS_FROM_SECONDS(ui->doubleSpinBoxTelescopeDelay->value()); int portTCP = ui->spinBoxTCPPort->value(); bool connectAtStartup = ui->checkBoxConnectAtStartup->isChecked(); //Circles //TODO: This will change if there is a validator for that field QList<double> circles; QString rawCircles = ui->lineEditCircleList->text().trimmed(); QStringList circleStrings; if(ui->checkBoxCircles->isChecked() && !(rawCircles.isEmpty())) { circleStrings = rawCircles.simplified().remove(' ').split(',', QString::SkipEmptyParts); circleStrings.removeDuplicates(); circleStrings.sort(); for(int i = 0; i < circleStrings.size(); i++) { if(i >= MAX_CIRCLE_COUNT) break; double circle = circleStrings.at(i).toDouble(); if(circle > 0.0) circles.append(circle); } } QString equinox("J2000"); if (ui->radioButtonJNow->isChecked()) equinox = "JNow"; //Type and server properties //TODO: When adding, check for success! ConnectionType type = ConnectionNA; if(ui->radioButtonTelescopeLocal->isChecked()) { //Read the serial port QString serialPortName = ui->lineEditSerialPort->text(); if(!serialPortName.startsWith(SERIAL_PORT_PREFIX)) return;//TODO: Add more validation! type = ConnectionInternal; telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, host, portTCP, delay, connectAtStartup, circles, ui->comboBoxDeviceModel->currentText(), serialPortName); } else if (ui->radioButtonTelescopeConnection->isChecked()) { if(host == "localhost") type = ConnectionLocal; else type = ConnectionRemote; telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, host, portTCP, delay, connectAtStartup, circles); } else if (ui->radioButtonTelescopeVirtual->isChecked()) { type = ConnectionVirtual; telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, QString(), portTCP, delay, connectAtStartup, circles); } emit changesSaved(name, type); }