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

Last change on this file since 5916 was 4278, checked in by mervart, 12 years ago
File size: 10.6 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 _reqcComment = new QLineEdit(this);
67 _reqcOldMarkerName = new QLineEdit(this);
68 _reqcNewMarkerName = new QLineEdit(this);
69 _reqcOldAntennaName = new QLineEdit(this);
70 _reqcNewAntennaName = new QLineEdit(this);
71 _reqcOldReceiverName = new QLineEdit(this);
72 _reqcNewReceiverName = new QLineEdit(this);
73
74 _reqcRnxVersion->setEditable(false);
75 _reqcRnxVersion->addItems(QString("2,3").split(","));
76 _reqcRnxVersion->setMaximumWidth(7*ww);
77
78 _reqcSampling->setMinimum(0);
79 _reqcSampling->setMaximum(60);
80 _reqcSampling->setSingleStep(5);
81 _reqcSampling->setSuffix(" sec");
82 _reqcSampling->setMaximumWidth(7*ww);
83
84 // Read Options
85 // ------------
86 bncSettings settings;
87
88 int kk = _reqcRnxVersion->findText(settings.value("reqcRnxVersion").toString());
89 if (kk != -1) {
90 _reqcRnxVersion->setCurrentIndex(kk);
91 }
92 _reqcSampling->setValue(settings.value("reqcSampling").toInt());
93 if (settings.value("reqcStartDateTime").toString().isEmpty()) {
94 _reqcStartDateTime->setDateTime(QDateTime::fromString("1967-11-02T00:00:00", Qt::ISODate));
95 }
96 else {
97 _reqcStartDateTime->setDateTime(settings.value("reqcStartDateTime").toDateTime());
98 }
99 if (settings.value("reqcEndDateTime").toString().isEmpty()) {
100 _reqcEndDateTime->setDateTime(QDateTime::fromString("2099-01-01T00:00:00", Qt::ISODate));
101 }
102 else {
103 _reqcEndDateTime->setDateTime(settings.value("reqcEndDateTime").toDateTime());
104 }
105 _reqcRunBy->setText(settings.value("reqcRunBy").toString());
106 _reqcComment->setText(settings.value("reqcComment").toString());
107 _reqcOldMarkerName->setText(settings.value("reqcOldMarkerName").toString());
108 _reqcNewMarkerName->setText(settings.value("reqcNewMarkerName").toString());
109 _reqcOldAntennaName->setText(settings.value("reqcOldAntennaName").toString());
110 _reqcNewAntennaName->setText(settings.value("reqcNewAntennaName").toString());
111 _reqcOldReceiverName->setText(settings.value("reqcOldReceiverName").toString());
112 _reqcNewReceiverName->setText(settings.value("reqcNewReceiverName").toString());
113
114 // Dialog Layout
115 // -------------
116 QGridLayout* grid = new QGridLayout;
117
118 int ir = 0;
119 grid->addWidget(new QLabel("RNX Version"), ir, 1);
120 grid->addWidget(_reqcRnxVersion, ir, 2);
121 grid->addWidget(new QLabel(" Sampling"), ir, 3);
122 grid->addWidget(_reqcSampling, ir, 4);
123 ++ir;
124 grid->addWidget(new QLabel("Start"), ir, 1);
125 grid->addWidget(_reqcStartDateTime, ir, 2);
126 grid->addWidget(new QLabel(" End"), ir, 3);
127 grid->addWidget(_reqcEndDateTime, ir, 4);
128 ++ir;
129 grid->addWidget(new QLabel("Run By"), ir, 0);
130 grid->addWidget(_reqcRunBy, ir, 1);
131 ++ir;
132 grid->addWidget(new QLabel("Comment(s)"), ir, 0);
133 grid->addWidget(_reqcComment, ir, 1, 1, 4);
134 ++ir;
135 grid->addWidget(new QLabel("Old"), ir, 1, 1, 2, Qt::AlignCenter);
136 grid->addWidget(new QLabel("New"), ir, 3, 1, 2, Qt::AlignCenter);
137 ++ir;
138 grid->addWidget(new QLabel("Marker Name"), ir, 0);
139 grid->addWidget(_reqcOldMarkerName, ir, 1, 1, 2);
140 grid->addWidget(_reqcNewMarkerName, ir, 3, 1, 2);
141 ++ir;
142 grid->addWidget(new QLabel("Antenna Name"), ir, 0);
143 grid->addWidget(_reqcOldAntennaName, ir, 1, 1, 2);
144 grid->addWidget(_reqcNewAntennaName, ir, 3, 1, 2);
145 ++ir;
146 grid->addWidget(new QLabel("Receiver Name"), ir, 0);
147 grid->addWidget(_reqcOldReceiverName, ir, 1, 1, 2);
148 grid->addWidget(_reqcNewReceiverName, ir, 3, 1, 2);
149
150 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
151 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
152
153 _buttonOK = new QPushButton(tr("OK / Save"), this);
154 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(slotOK()));
155
156 _buttonCancel = new QPushButton(tr("Cancel"), this);
157 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
158
159 QHBoxLayout* buttonLayout = new QHBoxLayout;
160 buttonLayout->addWidget(_buttonWhatsThis);
161 buttonLayout->addStretch(1);
162 buttonLayout->addWidget(_buttonOK);
163 buttonLayout->addWidget(_buttonCancel);
164
165 QVBoxLayout* mainLayout = new QVBoxLayout(this);
166 mainLayout->addLayout(grid);
167 mainLayout->addLayout(buttonLayout);
168
169 _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>"));
170 _reqcSampling->setWhatsThis(tr("<p>Select sampling rate of emerging new RINEX observation file.</p>"));
171 _reqcStartDateTime->setWhatsThis(tr("<p>Specify begin of emerging new RINEX observation file.</p>"));
172 _reqcEndDateTime->setWhatsThis(tr("<p>Specify end of emerging new RINEX observation file.</p>"));
173 _reqcOldMarkerName->setWhatsThis(tr("<p>Enter old marker name in RINEX observation file.</p>"));
174 _reqcNewMarkerName->setWhatsThis(tr("<p>Enter new marker name in RINEX observation file.</p>"));
175 _reqcOldAntennaName->setWhatsThis(tr("<p>Enter old antenna name in RINEX observation file.</p>"));
176 _reqcNewAntennaName->setWhatsThis(tr("<p>Enter new antenna name in RINEX observation file.</p>"));
177 _reqcOldReceiverName->setWhatsThis(tr("<p>Enter old receiver name in RINEX observation file.</p>"));
178 _reqcNewReceiverName->setWhatsThis(tr("<p>Enter new receiver name in RINEX observation file.</p>"));
179 _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>"));
180 _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>"));
181
182}
183
184// Destructor
185////////////////////////////////////////////////////////////////////////////
186reqcDlg::~reqcDlg() {
187 delete _buttonOK;
188 delete _buttonCancel;
189 delete _buttonWhatsThis;
190}
191
192// Accept the Options
193////////////////////////////////////////////////////////////////////////////
194void reqcDlg::slotOK() {
195 saveOptions();
196 done(0);
197}
198
199// Whats This Help
200////////////////////////////////////////////////////////////////////////////
201void reqcDlg::slotWhatsThis() {
202 QWhatsThis::enterWhatsThisMode();
203}
204
205// Close Dialog gracefully
206////////////////////////////////////////////////////////////////////////////
207void reqcDlg::closeEvent(QCloseEvent* event) {
208
209 int iRet = QMessageBox::question(this, "Close", "Save Options?",
210 QMessageBox::Yes, QMessageBox::No,
211 QMessageBox::Cancel);
212
213 if (iRet == QMessageBox::Cancel) {
214 event->ignore();
215 return;
216 }
217 else if (iRet == QMessageBox::Yes) {
218 saveOptions();
219 }
220
221 QDialog::closeEvent(event);
222}
223
224// Save Selected Options
225////////////////////////////////////////////////////////////////////////////
226void reqcDlg::saveOptions() {
227
228 bncSettings settings;
229
230 settings.setValue("reqcRnxVersion" , _reqcRnxVersion->currentText());
231 settings.setValue("reqcSampling" , _reqcSampling->value());
232 settings.setValue("reqcStartDateTime" , _reqcStartDateTime->dateTime().toString(Qt::ISODate));
233 settings.setValue("reqcEndDateTime" , _reqcEndDateTime->dateTime().toString(Qt::ISODate));
234 settings.setValue("reqcRunBy" , _reqcRunBy->text());
235 settings.setValue("reqcComment" , _reqcComment->text());
236 settings.setValue("reqcOldMarkerName" , _reqcOldMarkerName->text());
237 settings.setValue("reqcNewMarkerName" , _reqcNewMarkerName->text());
238 settings.setValue("reqcOldAntennaName" , _reqcOldAntennaName->text());
239 settings.setValue("reqcNewAntennaName" , _reqcNewAntennaName->text());
240 settings.setValue("reqcOldReceiverName", _reqcOldReceiverName->text());
241 settings.setValue("reqcNewReceiverName", _reqcNewReceiverName->text());
242}
Note: See TracBrowser for help on using the repository browser.