source: ntrip/trunk/BNC/src/reqcdlg.cpp@ 6726

Last change on this file since 6726 was 6712, checked in by weber, 10 years ago

Documentation completed

File size: 14.1 KB
Line 
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
46using namespace std;
47
48
49// Constructor
50////////////////////////////////////////////////////////////////////////////
51reqcDlg::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 _reqcRunBy = new QLineEdit(this);
66 _reqcUseObsTypes = new QLineEdit(this);
67 _reqcComment = new QLineEdit(this);
68 _reqcOldMarkerName = new QLineEdit(this);
69 _reqcNewMarkerName = new QLineEdit(this);
70 _reqcOldAntennaName = new QLineEdit(this);
71 _reqcNewAntennaName = new QLineEdit(this);
72 _reqcOldReceiverName = new QLineEdit(this);
73 _reqcNewReceiverName = new QLineEdit(this);
74
75 _reqcRnxVersion->setEditable(false);
76 _reqcRnxVersion->addItems(QString("2,3").split(","));
77 _reqcRnxVersion->setMaximumWidth(7*ww);
78
79 _reqcSampling->setMinimum(0);
80 _reqcSampling->setMaximum(60);
81 _reqcSampling->setSingleStep(5);
82 _reqcSampling->setSuffix(" sec");
83 _reqcSampling->setMaximumWidth(7*ww);
84
85 // Read Options
86 // ------------
87 bncSettings settings;
88
89 int kk = _reqcRnxVersion->findText(settings.value("reqcRnxVersion").toString());
90 if (kk != -1) {
91 _reqcRnxVersion->setCurrentIndex(kk);
92 }
93 _reqcSampling->setValue(settings.value("reqcSampling").toInt());
94 if (settings.value("reqcStartDateTime").toString().isEmpty()) {
95 _reqcStartDateTime->setDateTime(QDateTime::fromString("1967-11-02T00:00:00", Qt::ISODate));
96 }
97 else {
98 _reqcStartDateTime->setDateTime(settings.value("reqcStartDateTime").toDateTime());
99 }
100 if (settings.value("reqcEndDateTime").toString().isEmpty()) {
101 _reqcEndDateTime->setDateTime(QDateTime::fromString("2099-01-01T00:00:00", Qt::ISODate));
102 }
103 else {
104 _reqcEndDateTime->setDateTime(settings.value("reqcEndDateTime").toDateTime());
105 }
106 _reqcRunBy->setText(settings.value("reqcRunBy").toString());
107 _reqcUseObsTypes->setText(settings.value("reqcUseObsTypes").toString());
108 _reqcComment->setText(settings.value("reqcComment").toString());
109 _reqcOldMarkerName->setText(settings.value("reqcOldMarkerName").toString());
110 _reqcNewMarkerName->setText(settings.value("reqcNewMarkerName").toString());
111 _reqcOldAntennaName->setText(settings.value("reqcOldAntennaName").toString());
112 _reqcNewAntennaName->setText(settings.value("reqcNewAntennaName").toString());
113 _reqcOldReceiverName->setText(settings.value("reqcOldReceiverName").toString());
114 _reqcNewReceiverName->setText(settings.value("reqcNewReceiverName").toString());
115
116 QString hlp = settings.value("reqcV2Priority").toString();
117 if (hlp.isEmpty()) {
118 hlp = "CWPX_?";
119 }
120 _reqcV2Priority = new QLineEdit(hlp);
121
122 // Dialog Layout
123 // -------------
124 QGridLayout* grid = new QGridLayout;
125
126 int ir = 0;
127 grid->addWidget(new QLabel("RINEX Version"), ir, 1);
128 grid->addWidget(_reqcRnxVersion, ir, 2);
129 grid->addWidget(new QLabel("Sampling"), ir, 3, Qt::AlignRight);
130 grid->addWidget(_reqcSampling, ir, 4);
131 ++ir;
132 grid->addWidget(new QLabel("Version 2 Signal Priority"), ir, 1);
133 grid->addWidget(_reqcV2Priority, ir, 2);
134 ++ir;
135 grid->addWidget(new QLabel("Start"), ir, 1);
136 grid->addWidget(_reqcStartDateTime, ir, 2);
137 grid->addWidget(new QLabel("End"), ir, 3, Qt::AlignRight);
138 grid->addWidget(_reqcEndDateTime, ir, 4);
139 ++ir;
140 grid->addWidget(new QLabel("Run By"), ir, 0);
141 grid->addWidget(_reqcRunBy, ir, 1);
142 ++ir;
143 grid->addWidget(new QLabel("Use Obs. Types"), ir, 0);
144 grid->addWidget(_reqcUseObsTypes, ir, 1, 1, 4);
145 ++ir;
146 grid->addWidget(new QLabel("Comment(s)"), ir, 0);
147 grid->addWidget(_reqcComment, ir, 1, 1, 4);
148 ++ir;
149 grid->addWidget(new QLabel("Old"), ir, 1, 1, 2, Qt::AlignCenter);
150 grid->addWidget(new QLabel("New"), ir, 3, 1, 2, Qt::AlignCenter);
151 ++ir;
152 grid->addWidget(new QLabel("Marker Name"), ir, 0);
153 grid->addWidget(_reqcOldMarkerName, ir, 1, 1, 2);
154 grid->addWidget(_reqcNewMarkerName, ir, 3, 1, 2);
155 ++ir;
156 grid->addWidget(new QLabel("Antenna Name"), ir, 0);
157 grid->addWidget(_reqcOldAntennaName, ir, 1, 1, 2);
158 grid->addWidget(_reqcNewAntennaName, ir, 3, 1, 2);
159 ++ir;
160 grid->addWidget(new QLabel("Receiver Name"), ir, 0);
161 grid->addWidget(_reqcOldReceiverName, ir, 1, 1, 2);
162 grid->addWidget(_reqcNewReceiverName, ir, 3, 1, 2);
163
164 slotReqcTextChanged();
165 connect(_reqcRnxVersion, SIGNAL(currentIndexChanged(const QString &)),
166 this, SLOT(slotReqcTextChanged()));
167
168 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
169 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
170
171 _buttonOK = new QPushButton(tr("OK / Save"), this);
172 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(slotOK()));
173
174 _buttonCancel = new QPushButton(tr("Cancel"), this);
175 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
176
177 QHBoxLayout* buttonLayout = new QHBoxLayout;
178 buttonLayout->addWidget(_buttonWhatsThis);
179 buttonLayout->addStretch(1);
180 buttonLayout->addWidget(_buttonOK);
181 buttonLayout->addWidget(_buttonCancel);
182
183 QVBoxLayout* mainLayout = new QVBoxLayout(this);
184 mainLayout->addLayout(grid);
185 mainLayout->addLayout(buttonLayout);
186
187 _reqcRnxVersion->setWhatsThis(tr("<p>Select version number of emerging new RINEX file.</p><p>When converting RINEX Version 2 to RINEX Version 3 Observation files, the tracking mode or channel information (signal attribute, see RINEX Version 3 document) in the (last character out of the three characters) observation code is left blank if unknown.</p><p>When converting RINEX Version 3 to RINEX Version 2 the mapping of observations follows a 'Signal priority list' with signal attributes as defined in RINEX Version 3.</p>"));
188 _reqcUseObsTypes->setWhatsThis(tr("<p>This option lets you limit the RINEX output to specific observation types. Examples:</p><p><ul><li>G:C1C G:L1C R:C1C R:C1P S:C1C C:C1I C:L1I E:C1X E:L1X<br>(Valid for output of RINEX Version 3. Output contains GPS C1C and L1C, GLONASS C1C and C1P, SBAS C1C, BeiDou C1C, C1I andL1I, Galileo C1X and L1X.)</li><li>C1 L2 L5<br>(Valid for output of RINEX Version 2 with mapping of Version 3 signals to Version 2 according to 'Version 2 Signal Priority'. Output contains C1, L2 and L5 observations from any GNSS system.)</li></ul></p><p>Default is an empty option field, meaning that the RINEX output file contains all observations made available through RINEX input file."));
189 _reqcSampling->setWhatsThis(tr("<p>Select sampling rate of emerging new RINEX observation file.</p><p>'0 sec' means that observations from all epochs in the RINEX input file will become part of the RINEX output file.</p>"));
190 _reqcStartDateTime->setWhatsThis(tr("<p>Specify begin of emerging new RINEX observation file.</p>"));
191 _reqcEndDateTime->setWhatsThis(tr("<p>Specify end of emerging new RINEX observation file.</p>"));
192 _reqcOldMarkerName->setWhatsThis(tr("<p>Enter old marker name in RINEX observation file.</p><p>Default is an empty option field.</p>"));
193 _reqcNewMarkerName->setWhatsThis(tr("<p>Enter new marker name in RINEX observation file.</p><p>If option 'Old Marker Name' is either left blank or its contents is specified as given in the RINEX input file, then the marker name in the RINEX output file will be specified by 'New Marker Name'</p><p>Default is an empty option field, meaning that the contents of the marker name data field in the RINEX file will not be changed.</p>"));
194 _reqcOldAntennaName->setWhatsThis(tr("<p>Enter old antenna name in RINEX observation file.</p><p>Default is an empty option field.</p>"));
195 _reqcNewAntennaName->setWhatsThis(tr("<p>Enter new antenna name in RINEX observation file.</p><p>If option 'Old Antenna Name' is either left blank or its contents is specified as given in the RINEX input file, then the antenna name in the RINEX output file will be specified by 'New Antenna Name'</p><p>Default is an empty option field, meaning that the contents of the antenna name data field in the RINEX file will not be changed.</p>"));
196 _reqcOldReceiverName->setWhatsThis(tr("<p>Enter old receiver name in RINEX observation file.<p>Default is an empty option field.</p></p>"));
197 _reqcNewReceiverName->setWhatsThis(tr("<p>Enter new receiver name in RINEX observation file.</p><p>If option 'Old Receiver Name' is either left blank or its contents is specified as given in the RINEX input file, then the receiver name in the RINEX output file will be specified by 'New Receiver Name'</p><p>Default is an empty option field, meaning that the contents of the receiver name data field in the RINEX file will not be changed.</p>"));
198 _reqcComment->setWhatsThis(tr("<p>Specifying a comment line text to be added to the emerging new RINEX file header is an option. Any introduction of newline specification '\\n' in this enforces the beginning of a further comment line. The comment line(s) will be added to the header after the 'PGM / RUN BY / DATE' record.</p><p>Default is an empty option field meaning that no additional comment line is added to the RINEX header.</p>"));
199 _reqcRunBy->setWhatsThis(tr("<p>Specify a 'RUN BY' string to be included in the emerging new RINEX file header.</p><p>Default is an empty option field meanig the operator's user ID is used as 'RUN BY' string.</p>"));
200 _reqcV2Priority->setWhatsThis(tr("<p>Specify a priority list of characters defining signal attributes as defined in RINEX Version 3. Priorities will be used in post processing mode to map RINEX Version 3 observation files to Version 2. The underscore character '_' stands for undefined attributes. A question mark '?' can be used as wildcard which represents any one character.</p><p>Default is priority list 'CWPX_?'.</p>"));
201}
202
203// Destructor
204////////////////////////////////////////////////////////////////////////////
205reqcDlg::~reqcDlg() {
206 delete _buttonOK;
207 delete _buttonCancel;
208 delete _buttonWhatsThis;
209}
210
211// Accept the Options
212////////////////////////////////////////////////////////////////////////////
213void reqcDlg::slotOK() {
214 saveOptions();
215 done(0);
216}
217
218// Whats This Help
219////////////////////////////////////////////////////////////////////////////
220void reqcDlg::slotWhatsThis() {
221 QWhatsThis::enterWhatsThisMode();
222}
223
224// Close Dialog gracefully
225////////////////////////////////////////////////////////////////////////////
226void reqcDlg::closeEvent(QCloseEvent* event) {
227
228 int iRet = QMessageBox::question(this, "Close", "Save Options?",
229 QMessageBox::Yes, QMessageBox::No,
230 QMessageBox::Cancel);
231
232 if (iRet == QMessageBox::Cancel) {
233 event->ignore();
234 return;
235 }
236 else if (iRet == QMessageBox::Yes) {
237 saveOptions();
238 }
239
240 QDialog::closeEvent(event);
241}
242
243// Save Selected Options
244////////////////////////////////////////////////////////////////////////////
245void reqcDlg::saveOptions() {
246
247 bncSettings settings;
248
249 settings.setValue("reqcRnxVersion" , _reqcRnxVersion->currentText());
250 settings.setValue("reqcSampling" , _reqcSampling->value());
251 settings.setValue("reqcV2Priority" , _reqcV2Priority->text());
252 settings.setValue("reqcStartDateTime" , _reqcStartDateTime->dateTime().toString(Qt::ISODate));
253 settings.setValue("reqcEndDateTime" , _reqcEndDateTime->dateTime().toString(Qt::ISODate));
254 settings.setValue("reqcRunBy" , _reqcRunBy->text());
255 settings.setValue("reqcUseObsTypes" , _reqcUseObsTypes->text());
256 settings.setValue("reqcComment" , _reqcComment->text());
257 settings.setValue("reqcOldMarkerName" , _reqcOldMarkerName->text());
258 settings.setValue("reqcNewMarkerName" , _reqcNewMarkerName->text());
259 settings.setValue("reqcOldAntennaName" , _reqcOldAntennaName->text());
260 settings.setValue("reqcNewAntennaName" , _reqcNewAntennaName->text());
261 settings.setValue("reqcOldReceiverName", _reqcOldReceiverName->text());
262 settings.setValue("reqcNewReceiverName", _reqcNewReceiverName->text());
263}
264
265// Reqc Text Changed
266////////////////////////////////////////////////////////////////////////////
267void reqcDlg::slotReqcTextChanged(){
268
269 if (sender() == 0 || sender() == _reqcRnxVersion) {
270 if (_reqcRnxVersion->currentText() == "2") {
271 _reqcV2Priority->setStyleSheet("background-color: white");
272 _reqcV2Priority->setEnabled(true);
273 }
274 else {
275 _reqcV2Priority->setStyleSheet("background-color: lightGray");
276 _reqcV2Priority->setEnabled(false);
277 }
278 }
279}
Note: See TracBrowser for help on using the repository browser.