-
Notifications
You must be signed in to change notification settings - Fork 1
/
settingsDialog.cpp
85 lines (76 loc) · 2.52 KB
/
settingsDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#endif
#include "settingsDialog.h"
#include "Settings.hpp"
settingsDialog::settingsDialog(const Settings &theSettings, QWidget *parent)
:QDialog(parent)
{
setupUi(this);
// Set up Geographic Settings
QString theDefaultCSName = theSettings.getDefaultCSName();
CSComboBox->clear();
CSComboBox->addItems(theSettings.getSupportedCoordSys());
int theDefaultIndex=CSComboBox->findText(theDefaultCSName);
CSComboBox->setCurrentIndex(theDefaultIndex);
DeclinationLineEdit->setText(QString::number(theSettings.getDefaultDeclination()));
UTMZoneSpinBox->setValue(theSettings.getDefaultUTMZone());
if (theSettings.getDefaultNSHemisphere()<0)
{
latSRadioButton->setChecked(true);
latNRadioButton->setChecked(false);
}
else
{
latSRadioButton->setChecked(false);
latNRadioButton->setChecked(true);
}
if (theSettings.getDefaultEWHemisphere()<0)
{
lonWRadioButton->setChecked(true);
lonERadioButton->setChecked(false);
}
else
{
lonWRadioButton->setChecked(false);
lonERadioButton->setChecked(true);
}
// set up DF Settings
MinFCASpinBox->setValue(theSettings.getDefaultFCAMinAngle());
// set up APRS settings
APRSServerLineEdit->setText(theSettings.getAPRSServer());
APRSServerPortLineEdit->setText(QString::number(theSettings.getAPRSPort()));
portValidator=QRegExp("[0-9]{1,4}");
APRSServerPortLineEdit->setValidator(new QRegExpValidator(portValidator,this));
CallSignLineEdit->setText(theSettings.getAPRSCallsign());
CallPassLineEdit->setText(theSettings.getAPRSCallpass());
APRSPublishCheckBox->setChecked(theSettings.publishAPRS());
}
void settingsDialog::retrieveSettings(Settings &theSettings)
{
// get Geo settings:
theSettings.setDefaultCS(CSComboBox->currentText());
theSettings.setDefaultDeclination(DeclinationLineEdit->text().toDouble());
theSettings.setDefaultUTMZone(UTMZoneSpinBox->value());
int NS=1;
if (latSRadioButton->isChecked())
{
NS=-1;
}
int EW=1;
if (lonWRadioButton->isChecked())
{
EW=-1;
}
theSettings.setDefaultNSHemisphere(NS);
theSettings.setDefaultEWHemisphere(EW);
// DF settings:
theSettings.setDefaultFCAMinAngle(MinFCASpinBox->value());
// APRS
theSettings.setAPRSServer(APRSServerLineEdit->text());
theSettings.setAPRSPort(APRSServerPortLineEdit->text().toInt());
theSettings.setAPRSCallsign(CallSignLineEdit->text());
theSettings.setAPRSCallpass(CallPassLineEdit->text());
theSettings.setPublishAPRS(APRSPublishCheckBox->isChecked());
}