1 | // Part of BNC, a utility for retrieving decoding and
|
---|
2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2007
|
---|
5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
6 | // http://www.bkg.bund.de
|
---|
7 | // Czech Technical University Prague, Department of Geodesy
|
---|
8 | // http://www.fsv.cvut.cz
|
---|
9 | //
|
---|
10 | // Email: euref-ip@bkg.bund.de
|
---|
11 | //
|
---|
12 | // This program is free software; you can redistribute it and/or
|
---|
13 | // modify it under the terms of the GNU General Public License
|
---|
14 | // as published by the Free Software Foundation, version 2.
|
---|
15 | //
|
---|
16 | // This program is distributed in the hope that it will be useful,
|
---|
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | // GNU General Public License for more details.
|
---|
20 | //
|
---|
21 | // You should have received a copy of the GNU General Public License
|
---|
22 | // along with this program; if not, write to the Free Software
|
---|
23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
24 |
|
---|
25 | /* -------------------------------------------------------------------------
|
---|
26 | * BKG NTRIP Client
|
---|
27 | * -------------------------------------------------------------------------
|
---|
28 | *
|
---|
29 | * Class: reqcDlg
|
---|
30 | *
|
---|
31 | * Purpose: Displays the teqc-like editing options
|
---|
32 | *
|
---|
33 | * Author: L. Mervart
|
---|
34 | *
|
---|
35 | * Created: 28-Mar-2012
|
---|
36 | *
|
---|
37 | * Changes:
|
---|
38 | *
|
---|
39 | * -----------------------------------------------------------------------*/
|
---|
40 |
|
---|
41 | #include <iostream>
|
---|
42 |
|
---|
43 | #include "reqcdlg.h"
|
---|
44 | #include "bncsettings.h"
|
---|
45 |
|
---|
46 | using namespace std;
|
---|
47 |
|
---|
48 |
|
---|
49 | // Constructor
|
---|
50 | ////////////////////////////////////////////////////////////////////////////
|
---|
51 | reqcDlg::reqcDlg(QWidget* parent) : QDialog(parent) {
|
---|
52 |
|
---|
53 | setWindowTitle(tr("RINEX Editing Options"));
|
---|
54 |
|
---|
55 | int ww = QFontMetrics(font()).width('w');
|
---|
56 |
|
---|
57 | const QString timeFmtString = "yyyy-MM-dd hh:mm:ss";
|
---|
58 |
|
---|
59 | _reqcRnxVersion = new QComboBox(this);
|
---|
60 | _reqcSampling = new QSpinBox(this);
|
---|
61 | _reqcStartDateTime = new QDateTimeEdit(this);
|
---|
62 | _reqcStartDateTime->setDisplayFormat(timeFmtString);
|
---|
63 | _reqcEndDateTime = new QDateTimeEdit(this);
|
---|
64 | _reqcEndDateTime->setDisplayFormat(timeFmtString);
|
---|
65 | _reqcOldMarkerName = new QLineEdit(this);
|
---|
66 | _reqcNewMarkerName = new QLineEdit(this);
|
---|
67 | _reqcOldAntennaName = new QLineEdit(this);
|
---|
68 | _reqcNewAntennaName = new QLineEdit(this);
|
---|
69 | _reqcOldReceiverName = new QLineEdit(this);
|
---|
70 | _reqcNewReceiverName = new QLineEdit(this);
|
---|
71 |
|
---|
72 | _reqcRnxVersion->setEditable(false);
|
---|
73 | _reqcRnxVersion->addItems(QString("2,3").split(","));
|
---|
74 | _reqcRnxVersion->setMaximumWidth(7*ww);
|
---|
75 |
|
---|
76 | _reqcSampling->setMinimum(0);
|
---|
77 | _reqcSampling->setMaximum(60);
|
---|
78 | _reqcSampling->setSingleStep(5);
|
---|
79 | _reqcSampling->setSuffix(" sec");
|
---|
80 | _reqcSampling->setMaximumWidth(7*ww);
|
---|
81 |
|
---|
82 | // Read Options
|
---|
83 | // ------------
|
---|
84 | bncSettings settings;
|
---|
85 |
|
---|
86 | int kk = _reqcRnxVersion->findText(settings.value("reqcRnxVersion").toString());
|
---|
87 | if (kk != -1) {
|
---|
88 | _reqcRnxVersion->setCurrentIndex(kk);
|
---|
89 | }
|
---|
90 | _reqcSampling->setValue(settings.value("reqcSampling").toInt());
|
---|
91 | if (settings.value("reqcStartDateTime").toString().isEmpty()) {
|
---|
92 | _reqcStartDateTime->setDateTime(QDateTime::fromString("1967-11-02T00:00:00", Qt::ISODate));
|
---|
93 | }
|
---|
94 | else {
|
---|
95 | _reqcStartDateTime->setDateTime(settings.value("reqcStartDateTime").toDateTime());
|
---|
96 | }
|
---|
97 | if (settings.value("reqcEndDateTime").toString().isEmpty()) {
|
---|
98 | _reqcEndDateTime->setDateTime(QDateTime::fromString("2099-01-01T00:00:00", Qt::ISODate));
|
---|
99 | }
|
---|
100 | else {
|
---|
101 | _reqcEndDateTime->setDateTime(settings.value("reqcEndDateTime").toDateTime());
|
---|
102 | }
|
---|
103 | _reqcOldMarkerName->setText(settings.value("reqcOldMarkerName").toString());
|
---|
104 | _reqcNewMarkerName->setText(settings.value("reqcNewMarkerName").toString());
|
---|
105 | _reqcOldAntennaName->setText(settings.value("reqcOldAntennaName").toString());
|
---|
106 | _reqcNewAntennaName->setText(settings.value("reqcNewAntennaName").toString());
|
---|
107 | _reqcOldReceiverName->setText(settings.value("reqcOldReceiverName").toString());
|
---|
108 | _reqcNewReceiverName->setText(settings.value("reqcNewReceiverName").toString());
|
---|
109 |
|
---|
110 | // Dialog Layout
|
---|
111 | // -------------
|
---|
112 | QGridLayout* grid = new QGridLayout;
|
---|
113 |
|
---|
114 | int ir = 0;
|
---|
115 | grid->addWidget(new QLabel("RNX Version"), ir, 1);
|
---|
116 | grid->addWidget(_reqcRnxVersion, ir, 2);
|
---|
117 | grid->addWidget(new QLabel(" Sampling"), ir, 3);
|
---|
118 | grid->addWidget(_reqcSampling, ir, 4);
|
---|
119 | ++ir;
|
---|
120 | grid->addWidget(new QLabel("Start"), ir, 1);
|
---|
121 | grid->addWidget(_reqcStartDateTime, ir, 2);
|
---|
122 | grid->addWidget(new QLabel(" End"), ir, 3);
|
---|
123 | grid->addWidget(_reqcEndDateTime, ir, 4);
|
---|
124 | ++ir;
|
---|
125 | grid->addWidget(new QLabel("Old"), ir, 1, 1, 2, Qt::AlignCenter);
|
---|
126 | grid->addWidget(new QLabel("New"), ir, 3, 1, 2, Qt::AlignCenter);
|
---|
127 | ++ir;
|
---|
128 | grid->addWidget(new QLabel("Marker Name"), ir, 0);
|
---|
129 | grid->addWidget(_reqcOldMarkerName, ir, 1, 1, 2);
|
---|
130 | grid->addWidget(_reqcNewMarkerName, ir, 3, 1, 2);
|
---|
131 | ++ir;
|
---|
132 | grid->addWidget(new QLabel("Antenna Name"), ir, 0);
|
---|
133 | grid->addWidget(_reqcOldAntennaName, ir, 1, 1, 2);
|
---|
134 | grid->addWidget(_reqcNewAntennaName, ir, 3, 1, 2);
|
---|
135 | ++ir;
|
---|
136 | grid->addWidget(new QLabel("Receiver Name"), ir, 0);
|
---|
137 | grid->addWidget(_reqcOldReceiverName, ir, 1, 1, 2);
|
---|
138 | grid->addWidget(_reqcNewReceiverName, ir, 3, 1, 2);
|
---|
139 |
|
---|
140 | _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
|
---|
141 | connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
|
---|
142 |
|
---|
143 | _buttonOK = new QPushButton(tr("OK / Save"), this);
|
---|
144 | connect(_buttonOK, SIGNAL(clicked()), this, SLOT(slotOK()));
|
---|
145 |
|
---|
146 | _buttonCancel = new QPushButton(tr("Cancel"), this);
|
---|
147 | connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
|
---|
148 |
|
---|
149 | QHBoxLayout* buttonLayout = new QHBoxLayout;
|
---|
150 | buttonLayout->addWidget(_buttonWhatsThis);
|
---|
151 | buttonLayout->addStretch(1);
|
---|
152 | buttonLayout->addWidget(_buttonOK);
|
---|
153 | buttonLayout->addWidget(_buttonCancel);
|
---|
154 |
|
---|
155 | QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
---|
156 | mainLayout->addLayout(grid);
|
---|
157 | mainLayout->addLayout(buttonLayout);
|
---|
158 |
|
---|
159 | _reqcRnxVersion->setWhatsThis(tr("<p>Select version number of emerging new RINEX file.</p><p>When converting RINEX Version 2 to RINEX Version 3, the tracking mode or channel information in the (last character out of the three characters) observation code is left blank if unknown. When converting RINEX Version 3 to RINEX Version 2<ul><li>C1P in RINEX Version 3 is mapped to P1 in RINEX Version 2</li><li>C2P in RINEX Version 3 is mapped to P2 in RINEX Version 2</li><li>If several observations in RINEX Version 3 come with the same observation type, same band/frequency but different tracking modes, BNC uses only the one provided first for creating RINEX Version 2 while ignoring others.</li></ul></p>"));
|
---|
160 | _reqcSampling->setWhatsThis(tr("<p>Select sampling rate of emerging new RINEX file.</p>"));
|
---|
161 | _reqcStartDateTime->setWhatsThis(tr("<p>Specify begin of emerging new RINEX file.</p>"));
|
---|
162 | _reqcEndDateTime->setWhatsThis(tr("<p>Specify end of emerging new RINEX file.</p>"));
|
---|
163 | _reqcOldMarkerName->setWhatsThis(tr("<p>Enter old marker name.</p>"));
|
---|
164 | _reqcNewMarkerName->setWhatsThis(tr("<p>Enter new marker name.</p>"));
|
---|
165 | _reqcOldAntennaName->setWhatsThis(tr("<p>Enter old antenna name.</p>"));
|
---|
166 | _reqcNewAntennaName->setWhatsThis(tr("<p>Enter new antenna name.</p>"));
|
---|
167 | _reqcOldReceiverName->setWhatsThis(tr("<p>Enter old receiver name.</p>"));
|
---|
168 | _reqcNewReceiverName->setWhatsThis(tr("<p>Enter new receiver name.</p>"));
|
---|
169 |
|
---|
170 | }
|
---|
171 |
|
---|
172 | // Destructor
|
---|
173 | ////////////////////////////////////////////////////////////////////////////
|
---|
174 | reqcDlg::~reqcDlg() {
|
---|
175 | delete _buttonOK;
|
---|
176 | delete _buttonCancel;
|
---|
177 | delete _buttonWhatsThis;
|
---|
178 | }
|
---|
179 |
|
---|
180 | // Accept the Options
|
---|
181 | ////////////////////////////////////////////////////////////////////////////
|
---|
182 | void reqcDlg::slotOK() {
|
---|
183 | saveOptions();
|
---|
184 | done(0);
|
---|
185 | }
|
---|
186 |
|
---|
187 | // Whats This Help
|
---|
188 | ////////////////////////////////////////////////////////////////////////////
|
---|
189 | void reqcDlg::slotWhatsThis() {
|
---|
190 | QWhatsThis::enterWhatsThisMode();
|
---|
191 | }
|
---|
192 |
|
---|
193 | // Close Dialog gracefully
|
---|
194 | ////////////////////////////////////////////////////////////////////////////
|
---|
195 | void reqcDlg::closeEvent(QCloseEvent* event) {
|
---|
196 |
|
---|
197 | int iRet = QMessageBox::question(this, "Close", "Save Options?",
|
---|
198 | QMessageBox::Yes, QMessageBox::No,
|
---|
199 | QMessageBox::Cancel);
|
---|
200 |
|
---|
201 | if (iRet == QMessageBox::Cancel) {
|
---|
202 | event->ignore();
|
---|
203 | return;
|
---|
204 | }
|
---|
205 | else if (iRet == QMessageBox::Yes) {
|
---|
206 | saveOptions();
|
---|
207 | }
|
---|
208 |
|
---|
209 | QDialog::closeEvent(event);
|
---|
210 | }
|
---|
211 |
|
---|
212 | // Save Selected Options
|
---|
213 | ////////////////////////////////////////////////////////////////////////////
|
---|
214 | void reqcDlg::saveOptions() {
|
---|
215 |
|
---|
216 | bncSettings settings;
|
---|
217 |
|
---|
218 | settings.setValue("reqcRnxVersion" , _reqcRnxVersion->currentText());
|
---|
219 | settings.setValue("reqcSampling" , _reqcSampling->value());
|
---|
220 | settings.setValue("reqcStartDateTime" , _reqcStartDateTime->dateTime().toString(Qt::ISODate));
|
---|
221 | settings.setValue("reqcEndDateTime" , _reqcEndDateTime->dateTime().toString(Qt::ISODate));
|
---|
222 | settings.setValue("reqcOldMarkerName" , _reqcOldMarkerName->text());
|
---|
223 | settings.setValue("reqcNewMarkerName" , _reqcNewMarkerName->text());
|
---|
224 | settings.setValue("reqcOldAntennaName" , _reqcOldAntennaName->text());
|
---|
225 | settings.setValue("reqcNewAntennaName" , _reqcNewAntennaName->text());
|
---|
226 | settings.setValue("reqcOldReceiverName", _reqcOldReceiverName->text());
|
---|
227 | settings.setValue("reqcNewReceiverName", _reqcNewReceiverName->text());
|
---|
228 | }
|
---|