SoDaRadio-5.0.3-master:8901fb5
main_setup_settings.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2017 Matthew H. Reilly (kb1vc)
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8 
9  Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in
13  the documentation and/or other materials provided with the
14  distribution.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #include "mainwindow.hpp"
30 #include "ui_mainwindow.h"
31 #include <iostream>
32 #include <boost/format.hpp>
33 #include "soda_comboboxes.hpp"
34 #include "soda_listener.hpp"
35 
37 {
38  connect(ui->CWSpeed_sli, SIGNAL(valueChanged(int)),
39  listener, SLOT(setCWSpeed(int)));
40  connect(ui->CWSpeed_sli, &QSlider::valueChanged,
41  [=](int s) {
42  ui->CWSpeed_lbl->setText(QString("%1").arg(s, 2));
43  });
44  connect(ui->Sidetone_sli, SIGNAL(valueChanged(int)),
45  listener, SLOT(setSidetoneVolume(int)));
46  connect(ui->TXPower_sli, SIGNAL(valueChanged(int)),
47  listener, SLOT(setTXPower(int)));
48 
49  connect(ui->FromGrid_le, SIGNAL(textChanged(const QString &)),
50  ui->FromGrid_lab, SLOT(setText(const QString &)));
51 
52 
53  connect(ui->openLog_btn, SIGNAL(clicked()),
54  ui->LogView, SLOT(readLogReportDlg()));
55  connect(ui->writeLogReport_btn, SIGNAL(clicked()),
56  ui->LogView, SLOT(writeLogReportDlg()));
57 
58  connect(ui->saveConfig_btn, SIGNAL(clicked()),
59  this, SLOT(saveConfig()));
60 
61  connect(ui->saveConfigAs_btn, SIGNAL(clicked()),
62  this, SLOT(saveConfigAs_dlg()));
63  connect(ui->openConfig_btn, SIGNAL(clicked()),
64  this, SLOT(restoreConfig_dlg()));
65 }
66 
67 
69 {
70  settings_p->beginGroup("Radio");
72  widgetSaveRestore(this, "SoDaRadioQT.", true);
73  settings_p->endGroup();
74 }
75 
77 {
78  QString fname = QFileDialog::getSaveFileName(this,
79  tr("Save Configuration to File"),
80  "",
81  tr("*.conf (*.conf);;All Files(*)"));
82  if(!fname.isEmpty()) {
83  settings_p = new QSettings(fname, QSettings::NativeFormat, this);
84  saveConfig();
85  }
86 }
87 
89 {
90  QString fname = QFileDialog::getOpenFileName(this,
91  tr("Read Configuration from File"),
92  "",
93  tr("*.conf (*.conf);;All Files(*)"));
94  if(!fname.isEmpty()) {
95  settings_p = new QSettings(fname, QSettings::NativeFormat, this);
97  }
98 
99 }
void restoreSettings()
Definition: mainwindow.cpp:349
GUISoDa::Listener * listener
Definition: mainwindow.hpp:151
Ui::MainWindow * ui
Definition: mainwindow.hpp:149
QSettings * settings_p
Definition: mainwindow.hpp:137
void widgetSaveRestore(QObject *op, const QString &par, bool save)
Definition: mainwindow.cpp:147
GUISoDa::BandMap band_map
Definition: mainwindow.hpp:141
void bandMapSaveRestore(GUISoDa::BandMap &bmap, bool save)