void FirstWindow::on_settingsButton_clicked() { SettingsDialog dialog; connect( &dialog, SIGNAL( signalSetSettings( Settings ) ), this, SLOT( slotSetSettings( Settings ) ) ); dialog.exec(); }
void MainWindow::on_actionSettings_triggered() { SettingsDialog dialog; dialog.setModal( true ); connect( &dialog, SIGNAL( signalSetSettings( QString, QString) ), this, SLOT( slotSetSettings(QString, QString ) ) ); dialog.exec(); }
void SettingsManager::addSettings(const QString &pSetingsProviderId, const QString &pSettingsGroupName, Settings *pSettings) { if (pSetingsProviderId.isEmpty()) { qDebug("SettingsManager::addSettings: plugin id is empty!"); return; } if (pSettingsGroupName.isEmpty()) { qDebug("SettingsManager::addSettings: settings page name is empty!"); return; } if (!pSettings) { qDebug("SettingsManager::addSettings: settings object is nullptr!"); return; } mPluginIdBySettings.insert(pSettings, pSetingsProviderId); mPageNameBySettings.insert(pSettings, pSettingsGroupName); QString lFullSettingsPath = QString("%1/%2/%3").arg(pSetingsProviderId).arg(pSettingsGroupName).arg(pSettings->settingsPath()); mPathBySettings.insert(pSettings, lFullSettingsPath); connect(pSettings, SIGNAL(settingsChanged(QMap<QString,QVariant>)), this, SLOT(slotWriteSettings(QMap<QString,QVariant>)), Qt::UniqueConnection); connect(mStorage, SIGNAL(signalSetSettings(QMap<QString,QVariant>)), pSettings, SLOT(slotSetSettings(QMap<QString,QVariant>)), Qt::UniqueConnection); if (mStorage) { mStorage->slotLoadSettings(pathBySettings(pSettings)); } }
void MainWindow::startFunctions() { headersLst.append("ОУ"); headersLst.append("Адрес"); headersLst.append("Класс"); treeMdl = new TreeModel(headersLst); ui->progressBarTree->hide(); lblSN = new QLabel; lblPOVer = new QLabel(); lblNetNum = new QLabel(); lblNumLiter = new QLabel(); lblStatus = new QLabel(); lblPort = new QLabel(); lblSysAddress = new QLabel(); lblCoverStat = new QLabel(); lblBindStat = new QLabel(); lblIn1 = new QLabel(); lblIn2 = new QLabel(); lblNoize = new QLabel(); lblInterView = new QLabel(); statusBar()->addWidget(lblArrow, 0); statusBar()->addWidget(lblStatus, 0); statusBar()->addWidget(lblPort, 0); statusBar()->addWidget(lblCoverStat, 0); statusBar()->addWidget(lblBindStat, 0); statusBar()->addWidget(lblIn1, 0); statusBar()->addWidget(lblIn2, 0); statusBar()->addWidget(lblNoize, 0); statusBar()->addWidget(lblPOVer, 0); statusBar()->addWidget(lblSN, 0); statusBar()->addWidget(lblNetNum, 0); statusBar()->addWidget(lblNumLiter, 0); statusBar()->addWidget(lblSysAddress, 0); statusBar()->addWidget(chckBxInterView, 0); statusBar()->addWidget(lblInterView, 0); lblBindStat->setFixedSize(61, 26); lblNoize->setFixedSize(40, 26); lblCoverStat->setFixedSize(77, 26); lblBindStat->setStyleSheet("QLabel { background-color : white; }"); lblNetNum->setText("Сеть:\n"); lblNetNum->setToolTip("Номер сети"); lblNumLiter->setText("Литера:\n"); lblNumLiter->setToolTip("Номер литеры"); lblSN->setText("S/N:\n"); lblSN->setToolTip("Серийный номер контроллера"); lblSysAddress->setText("Системный\nадрес: "); lblSysAddress->setToolTip("Системный адрес контроллера"); lblPOVer->setText("Версия прошивки:\n"); lblPOVer->setToolTip("Версия прошивки контроллера:"); lblInterView->setText("Опрос"); connect(ui->actUpdate, SIGNAL(triggered()), this, SLOT(slotActUpdate())); connect(ui->actExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actHelp, SIGNAL(triggered()), this, SLOT(help())); connect(ui->actSetNetParams, SIGNAL(triggered()), this, SLOT(slotSetParams())); connect(ui->actExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actAbout, SIGNAL(triggered()), this, SLOT(slotAboutApp())); connect(ui->actRestart, SIGNAL(triggered()), this, SLOT(slotReboot())); connect(ui->actConnectPort, SIGNAL(triggered()), this, SLOT(slotConnectTo())); connect(ui->pbBind, SIGNAL(clicked()), this, SLOT(slotBind())); connect(ui->actTree, SIGNAL(triggered()), this, SLOT(slotAskTree())); connect(chckBxInterView, SIGNAL(clicked(bool)), this, SLOT(slotInterview(bool))); connect(ui->pbSet, SIGNAL(clicked()), this, SLOT(slotSetSettings())); connect(ui->pbCancel, SIGNAL(clicked()), this, SLOT(slotCancelSettings())); connect(ui->act_showHideLog, SIGNAL(triggered(bool)), this, SLOT(slotShowHideLogAct(bool))); connect(ui->pbClear, SIGNAL(clicked(bool)), this, SLOT(clearTxtEdit(bool))); connect(ui->cmbBxCls, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangeCls(int))); connect(ui->cmbBxCmnd, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotChangeCmnd(QString))); connect(ui->pbSend, SIGNAL(clicked()), this, SLOT(slotPBSend())); connect(ui->pages, SIGNAL(currentChanged(int)), this, SLOT(slotTabChanged(int))); connect(ui->pbLoad, SIGNAL(clicked()), this, SLOT(slotAskTree())); connect(treeMdl, SIGNAL(signalDropTreeNode(int, int, int, int, unsigned char)), this, SLOT(slotDropTreeNode(int, int, int, int, unsigned char))); answerFlag = true; writeInLogFlag = false; customCommFlag = false; lblCoverStat->setText("Крышка\nзакрыта"); lblBindStat->setText("Связывания\nнет"); lblIn1->setText("Вход 1"); lblIn2->setText("Вход 2"); /*this->setMouseTracking(true); ui->tabs->setMouseTracking(true);*/ createDev(); loadCommLst(); loadDevSpecMap(); ui->treeView->setModel(treeMdl); ui->treeView->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->treeView->setDragEnabled(true); ui->treeView->setAcceptDrops(true); ui->treeView->setDropIndicatorShown(true); ui->treeView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->treeView->expandAll(); updateActions(); QVBoxLayout *vbl = new QVBoxLayout(); vbl->addWidget(lgWgt); ui->logTab->setLayout(vbl); //connect(this, SIGNAL(signal_log_click()), logWgt, SLOT(slot_log_clicked())); qDebug() << "start"; if(pb->pairObjArr.isEmpty()) //closeApp("<u><b>Приложение будет закрыто.</b></u><i> Нет доступных подключений.</i>"); qDebug() << "No connection"; else { connect(m_sde, SIGNAL(hasChanged(QStringList)), this, SLOT(printDevices(QStringList))); if(pb->pairObjArr.size() > 1) { dsc = new DialogSelectConnection(pb); connect(dsc, SIGNAL(tryConnSignal(QString, QString)), this, SLOT(sendTryConn(QString, QString))); if(dsc->exec() != dsc->Accepted) closeApp("<u><b>Приложение будет закрыто.</b></u><i> Подключение не выбрано.</i>"); delete dsc; } else { currPair.port = pb->pairObjArr.first().port; currPair.baud = pb->pairObjArr.first().baud; pserial = new AbstractSerial(this); if(!tryConnect(pserial, currPair.port, currPair.baud)) qDebug() << "serial port is not open"; } disconnect(this, SIGNAL(signPackReceive(QByteArray)), this, SLOT(parceAnswerPack(QByteArray))); connect(this, SIGNAL(signPackReceive(QByteArray)), this, SLOT(onPackReceiver(QByteArray))); connect(pserial, SIGNAL(readyRead()), this, SLOT(onProcSerialReceive())); pserial->enableEmitStatus(true); lblPort->setText(currPair.port + "\n" + currPair.baud); lblStatus->setText("Connected"); //lblStatus->setBackgroundRole(QColor(Qt::green)); MainWindow::setWindowTitle(currPair.port + " Конфигуратор Ладога-РК"); commLst.clear(); QTimer::singleShot(50, this, SLOT(createStartCommands())); } }