Preliminary revert settings button

creator-widgets
Elliott Liggett 2024-04-13 20:04:35 -07:00
rodzic 4e491ae441
commit da3cf1cfee
5 zmienionych plików z 82 dodań i 4 usunięć

Wyświetl plik

@ -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();
}

Wyświetl plik

@ -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();

Wyświetl plik

@ -1296,8 +1296,8 @@ ONLY use Manual CI-V when Transceive mode is not supported</string>
<rect>
<x>0</x>
<y>0</y>
<width>916</width>
<height>309</height>
<width>582</width>
<height>254</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@ -3278,6 +3278,43 @@ ONLY use Manual CI-V when Transceive mode is not supported</string>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="bottomButtonsLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="saveSettingsBtn">
<property name="text">
<string>Save Settings</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="revertSettingsBtn">
<property name="text">
<string>Revert to Default</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>

Wyświetl plik

@ -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
@ -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

Wyświetl plik

@ -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);