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

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