source: ntrip/trunk/BNC/teqcdlg.cpp@ 3834

Last change on this file since 3834 was 3834, checked in by mervart, 12 years ago
File size: 7.7 KB
RevLine 
[3740]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: teqcDlg
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 "teqcdlg.h"
[3830]44#include "bncsettings.h"
[3740]45
46using namespace std;
47
[3831]48
[3740]49// Constructor
50////////////////////////////////////////////////////////////////////////////
51teqcDlg::teqcDlg(QWidget* parent) : QDialog(parent) {
52
[3742]53 setWindowTitle(tr("Teqc Editing Options"));
[3740]54
55 int ww = QFontMetrics(font()).width('w');
56
[3833]57 const QString timeFmtString = "yyyy-MM-dd hh:mm:ss";
58
[3743]59 _teqcRnxVersion = new QComboBox(this);
60 _teqcSampling = new QSpinBox(this);
61 _teqcStartDateTime = new QDateTimeEdit(this);
[3831]62 _teqcStartDateTime->setDisplayFormat(timeFmtString);
[3743]63 _teqcEndDateTime = new QDateTimeEdit(this);
[3831]64 _teqcEndDateTime->setDisplayFormat(timeFmtString);
[3742]65 _teqcOldMarkerName = new QLineEdit(this);
66 _teqcNewMarkerName = new QLineEdit(this);
67 _teqcOldAntennaName = new QLineEdit(this);
68 _teqcNewAntennaName = new QLineEdit(this);
69 _teqcOldReceiverName = new QLineEdit(this);
70 _teqcNewReceiverName = new QLineEdit(this);
71
[3745]72 _teqcRnxVersion->setEditable(false);
73 _teqcRnxVersion->addItems(QString("2,3").split(","));
74 _teqcRnxVersion->setMaximumWidth(7*ww);
75
76 _teqcSampling->setMinimum(0);
77 _teqcSampling->setMaximum(60);
78 _teqcSampling->setSingleStep(5);
79 _teqcSampling->setSuffix(" sec");
80 _teqcSampling->setMaximumWidth(7*ww);
81
[3833]82 // Read Options
83 // ------------
84 // settings.setValue("teqcRnxVersion" , _teqcRnxVersion->currentText());
85 // settings.setValue("teqcSampling" , _teqcSampling->value());
86
87 bncSettings settings;
88
89 if (settings.value("teqcStartDateTime").toString().isEmpty()) {
90 _teqcStartDateTime->setDateTime(QDateTime::fromString("1967-11-02T00:00:00", Qt::ISODate));
91 }
92 else {
93 _teqcStartDateTime->setDateTime(settings.value("teqcStartDateTime").toDateTime());
94 }
[3834]95 if (settings.value("teqcEndDateTime").toString().isEmpty()) {
96 _teqcEndDateTime->setDateTime(QDateTime::fromString("1967-11-02T00:00:00", Qt::ISODate));
97 }
98 else {
99 _teqcEndDateTime->setDateTime(settings.value("teqcEndDateTime").toDateTime());
100 }
101 _teqcOldMarkerName->setText(settings.value("teqcOldMarkerName").toString());
102 _teqcNewMarkerName->setText(settings.value("teqcNewMarkerName").toString());
103 _teqcOldAntennaName->setText(settings.value("teqcOldAntennaName").toString());
104 _teqcNewAntennaName->setText(settings.value("teqcNewAntennaName").toString());
105 _teqcOldReceiverName->setText(settings.value("teqcOldReceiverName").toString());
106 _teqcNewReceiverName->setText(settings.value("teqcNewReceiverName").toString());
[3833]107
108 // Dialog Layout
109 // -------------
[3745]110 QGridLayout* grid = new QGridLayout;
111
[3742]112 int ir = 0;
[3743]113 grid->addWidget(new QLabel("RNX Version"), ir, 1);
114 grid->addWidget(_teqcRnxVersion, ir, 2);
[3745]115 grid->addWidget(new QLabel(" Sampling"), ir, 3);
[3743]116 grid->addWidget(_teqcSampling, ir, 4);
[3742]117 ++ir;
[3743]118 grid->addWidget(new QLabel("Start"), ir, 1);
119 grid->addWidget(_teqcStartDateTime, ir, 2);
[3745]120 grid->addWidget(new QLabel(" End"), ir, 3);
[3743]121 grid->addWidget(_teqcEndDateTime, ir, 4);
[3742]122 ++ir;
[3743]123 grid->addWidget(new QLabel("Old"), ir, 1, 1, 2, Qt::AlignCenter);
124 grid->addWidget(new QLabel("New"), ir, 3, 1, 2, Qt::AlignCenter);
125 ++ir;
126 grid->addWidget(new QLabel("Marker Name"), ir, 0);
127 grid->addWidget(_teqcOldMarkerName, ir, 1, 1, 2);
128 grid->addWidget(_teqcNewMarkerName, ir, 3, 1, 2);
129 ++ir;
130 grid->addWidget(new QLabel("Antenna Name"), ir, 0);
131 grid->addWidget(_teqcOldAntennaName, ir, 1, 1, 2);
132 grid->addWidget(_teqcNewAntennaName, ir, 3, 1, 2);
133 ++ir;
[3742]134 grid->addWidget(new QLabel("Receiver Name"), ir, 0);
[3743]135 grid->addWidget(_teqcOldReceiverName, ir, 1, 1, 2);
136 grid->addWidget(_teqcNewReceiverName, ir, 3, 1, 2);
[3742]137
[3740]138 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
139 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
140
[3828]141 _buttonOK = new QPushButton(tr("OK / Save"), this);
[3740]142 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(slotOK()));
143
144 _buttonCancel = new QPushButton(tr("Cancel"), this);
[3741]145 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
[3740]146
147 QHBoxLayout* buttonLayout = new QHBoxLayout;
148 buttonLayout->addWidget(_buttonWhatsThis);
149 buttonLayout->addStretch(1);
150 buttonLayout->addWidget(_buttonOK);
151 buttonLayout->addWidget(_buttonCancel);
152
[3745]153 QVBoxLayout* mainLayout = new QVBoxLayout(this);
[3742]154 mainLayout->addLayout(grid);
[3740]155 mainLayout->addLayout(buttonLayout);
156}
157
158// Destructor
159////////////////////////////////////////////////////////////////////////////
160teqcDlg::~teqcDlg() {
161 delete _buttonOK;
162 delete _buttonCancel;
163 delete _buttonWhatsThis;
164}
165
[3741]166// Accept the Options
167////////////////////////////////////////////////////////////////////////////
168void teqcDlg::slotOK() {
[3829]169 saveOptions();
[3828]170 done(0);
[3741]171}
172
173// Whats This Help
174////////////////////////////////////////////////////////////////////////////
175void teqcDlg::slotWhatsThis() {
176 QWhatsThis::enterWhatsThisMode();
177}
[3828]178
179// Close Dialog gracefully
180////////////////////////////////////////////////////////////////////////////
181void teqcDlg::closeEvent(QCloseEvent* event) {
182
183 int iRet = QMessageBox::question(this, "Close", "Save Options?",
184 QMessageBox::Yes, QMessageBox::No,
185 QMessageBox::Cancel);
186
187 if (iRet == QMessageBox::Cancel) {
188 event->ignore();
189 return;
190 }
191 else if (iRet == QMessageBox::Yes) {
[3829]192 saveOptions();
[3828]193 }
194
195 QDialog::closeEvent(event);
196}
[3829]197
198// Save Selected Options
199////////////////////////////////////////////////////////////////////////////
200void teqcDlg::saveOptions() {
201
[3830]202 bncSettings settings;
203
204 settings.setValue("teqcRnxVersion" , _teqcRnxVersion->currentText());
205 settings.setValue("teqcSampling" , _teqcSampling->value());
[3833]206 settings.setValue("teqcStartDateTime" , _teqcStartDateTime->dateTime().toString(Qt::ISODate));
207 settings.setValue("teqcEndDateTime" , _teqcEndDateTime->dateTime().toString(Qt::ISODate));
[3830]208 settings.setValue("teqcOldMarkerName" , _teqcOldMarkerName->text());
209 settings.setValue("teqcNewMarkerName" , _teqcNewMarkerName->text());
210 settings.setValue("teqcOldAntennaName" , _teqcOldAntennaName->text());
211 settings.setValue("teqcNewAntennaName" , _teqcNewAntennaName->text());
212 settings.setValue("teqcOldReceiverName", _teqcOldReceiverName->text());
213 settings.setValue("teqcNewReceiverName", _teqcNewReceiverName->text());
214
215 settings.sync();
[3829]216}
Note: See TracBrowser for help on using the repository browser.