diff --git a/settingswidget.cpp b/settingswidget.cpp index dca1d08..c152864 100644 --- a/settingswidget.cpp +++ b/settingswidget.cpp @@ -2738,3 +2738,15 @@ void settingswidget::on_connectBtn_clicked() emit connectButtonPressed(); } + +void settingswidget::on_saveSettingsBtn_clicked() +{ + emit saveSettingsButtonPressed(); +} + + +void settingswidget::on_revertSettingsBtn_clicked() +{ + emit revertSettingsButtonPressed(); +} + diff --git a/settingswidget.h b/settingswidget.h index 38c61e6..c256794 100644 --- a/settingswidget.h +++ b/settingswidget.h @@ -97,6 +97,8 @@ signals: void changedUdpPref(prefUDPItem i); void changedServerPref(prefServerItem i); void connectButtonPressed(); + void saveSettingsButtonPressed(); + void revertSettingsButtonPressed(); private slots: void on_settingsList_currentRowChanged(int currentRow); @@ -243,6 +245,10 @@ private slots: void on_connectBtn_clicked(); + void on_saveSettingsBtn_clicked(); + + void on_revertSettingsBtn_clicked(); + private: Ui::settingswidget *ui; void createSettingsListItems(); diff --git a/settingswidget.ui b/settingswidget.ui index e02ab10..7abb81d 100644 --- a/settingswidget.ui +++ b/settingswidget.ui @@ -1296,8 +1296,8 @@ ONLY use Manual CI-V when Transceive mode is not supported 0 0 - 916 - 309 + 582 + 254 @@ -3278,6 +3278,43 @@ ONLY use Manual CI-V when Transceive mode is not supported + + + + 0 + + + 0 + + + + + Save Settings + + + + + + + Revert to Default + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/spectrumscope.cpp b/spectrumscope.cpp index 9e62f89..f684bfd 100644 --- a/spectrumscope.cpp +++ b/spectrumscope.cpp @@ -19,6 +19,7 @@ spectrumScope::spectrumScope(uchar receiver, uchar vfo, QWidget *parent) splitter = new QSplitter(this); layout->addWidget(splitter); splitter->setOrientation(Qt::Vertical); + originalParent = parent; displayLayout = new QHBoxLayout(); @@ -1787,13 +1788,29 @@ void spectrumScope::detachScope(bool state) detachButton->setText("Attach"); qInfo(logGui()) << "Detaching scope" << (receiver?"Sub":"Main"); this->parentWidget()->layout()->replaceWidget(this,windowLabel); + + QTimer::singleShot(1, [&](){ + if(originalParent) { + this->originalParent->resize(1,1); + } + }); + + this->parentWidget()->resize(1,1); this->setParent(NULL); + this-> setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint); this->move(screen()->geometry().center() - frameGeometry().center()); } else { detachButton->setText("Detach"); qInfo(logGui()) << "Attaching scope" << (receiver?"Sub":"Main"); windowLabel->parentWidget()->layout()->replaceWidget(windowLabel,this); + + QTimer::singleShot(1, [&](){ + if(originalParent) { + this->originalParent->resize(1,1); + } + }); + windowLabel->setParent(NULL); delete windowLabel; } diff --git a/wfmain.cpp b/wfmain.cpp index f23a8ff..cd9f021 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -871,6 +871,8 @@ void wfmain::connectSettingsWidget() connect(this, SIGNAL(connectionStatus(bool)), setupui, SLOT(connectionStatus(bool))); connect(setupui, SIGNAL(connectButtonPressed()), this, SLOT(handleExtConnectBtn())); + connect(setupui, SIGNAL(saveSettingsButtonPressed()), this, SLOT(on_saveSettingsBtn_clicked())); + connect(setupui, SIGNAL(revertSettingsButtonPressed()), this, SLOT(handleRevertSettingsBtn())); } // NOT Migrated, EHL TODO, carefully remove this function @@ -1026,7 +1028,7 @@ void wfmain::configureVFOs() connect(receiver,SIGNAL(showStatusBarText(QString)),this,SLOT(showStatusBarText(QString))); receivers.append(receiver); - ui->scopeSpacer->changeSize(0,0,QSizePolicy::Minimum); + //ui->scopeSpacer->changeSize(0,0,QSizePolicy::Minimum); } } @@ -1509,6 +1511,7 @@ void wfmain::setDefPrefs() defPrefs.forceRTSasPTT = false; defPrefs.serialPortRadio = QString("auto"); defPrefs.serialPortBaud = 115200; + defPrefs.enableLAN = false; defPrefs.polling_ms = 0; // 0 = Automatic defPrefs.enablePTT = true; defPrefs.niceTS = true; @@ -1534,6 +1537,8 @@ void wfmain::setDefPrefs() defPrefs.tcpPort = 0; defPrefs.tciPort = 50001; + defPrefs.clusterUdpEnable = false; + defPrefs.clusterTcpEnable = false; defPrefs.waterfallFormat = 0; defPrefs.audioSystem = qtAudio; defPrefs.enableUSBControllers = false; @@ -1780,8 +1785,6 @@ void wfmain::loadSettings() udpPrefs.clientName = settings->value("ClientName", udpDefPrefs.clientName).toString(); udpPrefs.halfDuplex = settings->value("HalfDuplex", udpDefPrefs.halfDuplex).toBool(); - //ui->audioDuplexCombo->setVisible(false); - //ui->label_51->setVisible(false); settings->endGroup(); @@ -4164,6 +4167,25 @@ void wfmain::handleExtConnectBtn() { on_connectBtn_clicked(); } +void wfmain::handleRevertSettingsBtn() { + // from settings widget + int ret = QMessageBox::warning(this, tr("Revert settings"), + tr("Are you sure you wish to reset all wfview settings?\nIf so, wfview will exit and you will need to start the program again."), + QMessageBox::Ok | QMessageBox::Cancel, + QMessageBox::Cancel); + if (ret == QMessageBox::Ok) { + qInfo(logSystem()) << "Per user request, resetting preferences."; + prefs = defPrefs; + udpPrefs = udpDefPrefs; + serverConfig.enabled = false; + serverConfig.users.clear(); + + saveSettings(); + qInfo(logSystem()) << "Closing wfview for full preference-reset."; + QApplication::exit(); + } +} + void wfmain::on_connectBtn_clicked() { this->rigStatus->setText(""); // Clear status diff --git a/wfmain.h b/wfmain.h index 716be9b..2d52fa5 100644 --- a/wfmain.h +++ b/wfmain.h @@ -330,6 +330,7 @@ private slots: void extChangedServerPref(prefServerItem i); void handleExtConnectBtn(); + void handleRevertSettingsBtn(); void receiveScopeSettings(uchar receiver, int theme, quint16 len, int floor, int ceiling); void receiveValue(cacheItem val); diff --git a/wfmain.ui b/wfmain.ui index d4240fb..9da3d0e 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,8 +6,8 @@ 0 0 - 942 - 327 + 946 + 361 @@ -18,8 +18,66 @@ + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + 0 + 0 + + QFrame::Box @@ -48,26 +106,6 @@ 3 - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 0 - - - @@ -992,7 +1030,7 @@ - + 0 @@ -1012,6 +1050,9 @@ 1 + + 1 + @@ -1105,6 +1146,7 @@ + 50 false