CatRadio/dialogsetup.cpp

77 wiersze
2.7 KiB
C++
Czysty Zwykły widok Historia

2024-11-21 17:34:42 +00:00
/**
** This file is part of the CatRadio project.
** Copyright 2022-2024 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
2022-03-12 19:30:51 +00:00
#include "dialogsetup.h"
#include "ui_dialogsetup.h"
#include "guidata.h"
#include <QSettings>
#include <QFile>
2022-11-19 20:13:20 +00:00
#include <QMessageBox>
2022-03-12 19:30:51 +00:00
extern guiConfig guiConf;
DialogSetup::DialogSetup(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogSetup)
{
ui->setupUi(this);
2024-11-21 17:34:42 +00:00
if (guiConf.vfoDisplayMode == 1) ui->radioButton_vfoDispMode_UD->setChecked(true);
2022-11-19 20:13:20 +00:00
if (guiConf.darkTheme) ui->radioButton_themeDark->setChecked(true);
2024-11-21 17:34:42 +00:00
if (guiConf.voiceKeyerMode == 1) ui->radioButton_voiceKeyerMode_CatRadio->setChecked(true);
2022-12-07 19:50:23 +00:00
if (guiConf.peakHold) ui->checkBox_peakHold->setChecked(true);
2023-01-15 19:03:36 +00:00
if (guiConf.debugMode) ui->checkBox_debug->setChecked(true);
2022-03-12 19:30:51 +00:00
}
DialogSetup::~DialogSetup()
{
delete ui;
}
void DialogSetup::on_buttonBox_accepted()
{
2022-11-19 20:13:20 +00:00
if ((guiConf.darkTheme != ui->radioButton_themeDark->isChecked()))
{
QMessageBox msgBox;
msgBox.setWindowTitle("Theme");
msgBox.setText("Please, restart CatRadio to make effective the theme.");
msgBox.setIcon(QMessageBox::Information);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
}
guiConf.vfoDisplayMode = ui->radioButton_vfoDispMode_UD->isChecked();
guiConf.darkTheme = ui->radioButton_themeDark->isChecked();
2024-11-21 17:34:42 +00:00
guiConf.voiceKeyerMode = ui->radioButton_voiceKeyerMode_CatRadio->isChecked();
2023-03-22 18:43:42 +00:00
guiConf.peakHold = ui->checkBox_peakHold->isChecked();
2023-01-15 19:03:36 +00:00
guiConf.debugMode = ui->checkBox_debug->isChecked();
2022-11-19 20:13:20 +00:00
2022-03-27 11:16:53 +00:00
//* Save settings in catradio.ini
QSettings configFile(QString("catradio.ini"), QSettings::IniFormat);
2022-03-12 19:30:51 +00:00
configFile.setValue("vfoDisplayMode", guiConf.vfoDisplayMode);
2022-11-19 20:13:20 +00:00
configFile.setValue("darkTheme", guiConf.darkTheme);
2024-11-21 17:34:42 +00:00
configFile.setValue("voiceKeyerMode", guiConf.voiceKeyerMode);
2022-12-07 19:50:23 +00:00
configFile.setValue("peakHold", guiConf.peakHold);
2023-01-15 19:03:36 +00:00
configFile.setValue("debugMode", guiConf.debugMode);
2022-03-12 19:30:51 +00:00
}