[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 |
|
---|
| 46 | using namespace std;
|
---|
| 47 |
|
---|
[3831] | 48 |
|
---|
[3740] | 49 | // Constructor
|
---|
| 50 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 51 | teqcDlg::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 | bncSettings settings;
|
---|
| 85 |
|
---|
[3836] | 86 | int kk = _teqcRnxVersion->findText(settings.value("teqcRnxVersion").toString());
|
---|
| 87 | if (kk != -1) {
|
---|
| 88 | _teqcRnxVersion->setCurrentIndex(kk);
|
---|
| 89 | }
|
---|
| 90 | _teqcSampling->setValue(settings.value("teqcSampling").toInt());
|
---|
[3833] | 91 | if (settings.value("teqcStartDateTime").toString().isEmpty()) {
|
---|
| 92 | _teqcStartDateTime->setDateTime(QDateTime::fromString("1967-11-02T00:00:00", Qt::ISODate));
|
---|
| 93 | }
|
---|
| 94 | else {
|
---|
| 95 | _teqcStartDateTime->setDateTime(settings.value("teqcStartDateTime").toDateTime());
|
---|
| 96 | }
|
---|
[3834] | 97 | if (settings.value("teqcEndDateTime").toString().isEmpty()) {
|
---|
[3835] | 98 | _teqcEndDateTime->setDateTime(QDateTime::fromString("2099-01-01T00:00:00", Qt::ISODate));
|
---|
[3834] | 99 | }
|
---|
| 100 | else {
|
---|
| 101 | _teqcEndDateTime->setDateTime(settings.value("teqcEndDateTime").toDateTime());
|
---|
| 102 | }
|
---|
| 103 | _teqcOldMarkerName->setText(settings.value("teqcOldMarkerName").toString());
|
---|
| 104 | _teqcNewMarkerName->setText(settings.value("teqcNewMarkerName").toString());
|
---|
| 105 | _teqcOldAntennaName->setText(settings.value("teqcOldAntennaName").toString());
|
---|
| 106 | _teqcNewAntennaName->setText(settings.value("teqcNewAntennaName").toString());
|
---|
| 107 | _teqcOldReceiverName->setText(settings.value("teqcOldReceiverName").toString());
|
---|
| 108 | _teqcNewReceiverName->setText(settings.value("teqcNewReceiverName").toString());
|
---|
[3833] | 109 |
|
---|
| 110 | // Dialog Layout
|
---|
| 111 | // -------------
|
---|
[3745] | 112 | QGridLayout* grid = new QGridLayout;
|
---|
| 113 |
|
---|
[3742] | 114 | int ir = 0;
|
---|
[3743] | 115 | grid->addWidget(new QLabel("RNX Version"), ir, 1);
|
---|
| 116 | grid->addWidget(_teqcRnxVersion, ir, 2);
|
---|
[3745] | 117 | grid->addWidget(new QLabel(" Sampling"), ir, 3);
|
---|
[3743] | 118 | grid->addWidget(_teqcSampling, ir, 4);
|
---|
[3742] | 119 | ++ir;
|
---|
[3743] | 120 | grid->addWidget(new QLabel("Start"), ir, 1);
|
---|
| 121 | grid->addWidget(_teqcStartDateTime, ir, 2);
|
---|
[3745] | 122 | grid->addWidget(new QLabel(" End"), ir, 3);
|
---|
[3743] | 123 | grid->addWidget(_teqcEndDateTime, ir, 4);
|
---|
[3742] | 124 | ++ir;
|
---|
[3743] | 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(_teqcOldMarkerName, ir, 1, 1, 2);
|
---|
| 130 | grid->addWidget(_teqcNewMarkerName, ir, 3, 1, 2);
|
---|
| 131 | ++ir;
|
---|
| 132 | grid->addWidget(new QLabel("Antenna Name"), ir, 0);
|
---|
| 133 | grid->addWidget(_teqcOldAntennaName, ir, 1, 1, 2);
|
---|
| 134 | grid->addWidget(_teqcNewAntennaName, ir, 3, 1, 2);
|
---|
| 135 | ++ir;
|
---|
[3742] | 136 | grid->addWidget(new QLabel("Receiver Name"), ir, 0);
|
---|
[3743] | 137 | grid->addWidget(_teqcOldReceiverName, ir, 1, 1, 2);
|
---|
| 138 | grid->addWidget(_teqcNewReceiverName, ir, 3, 1, 2);
|
---|
[3742] | 139 |
|
---|
[3740] | 140 | _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
|
---|
| 141 | connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
|
---|
| 142 |
|
---|
[3828] | 143 | _buttonOK = new QPushButton(tr("OK / Save"), this);
|
---|
[3740] | 144 | connect(_buttonOK, SIGNAL(clicked()), this, SLOT(slotOK()));
|
---|
| 145 |
|
---|
| 146 | _buttonCancel = new QPushButton(tr("Cancel"), this);
|
---|
[3741] | 147 | connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
|
---|
[3740] | 148 |
|
---|
| 149 | QHBoxLayout* buttonLayout = new QHBoxLayout;
|
---|
| 150 | buttonLayout->addWidget(_buttonWhatsThis);
|
---|
| 151 | buttonLayout->addStretch(1);
|
---|
| 152 | buttonLayout->addWidget(_buttonOK);
|
---|
| 153 | buttonLayout->addWidget(_buttonCancel);
|
---|
| 154 |
|
---|
[3745] | 155 | QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
---|
[3742] | 156 | mainLayout->addLayout(grid);
|
---|
[3740] | 157 | mainLayout->addLayout(buttonLayout);
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | // Destructor
|
---|
| 161 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 162 | teqcDlg::~teqcDlg() {
|
---|
| 163 | delete _buttonOK;
|
---|
| 164 | delete _buttonCancel;
|
---|
| 165 | delete _buttonWhatsThis;
|
---|
| 166 | }
|
---|
| 167 |
|
---|
[3741] | 168 | // Accept the Options
|
---|
| 169 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 170 | void teqcDlg::slotOK() {
|
---|
[3829] | 171 | saveOptions();
|
---|
[3828] | 172 | done(0);
|
---|
[3741] | 173 | }
|
---|
| 174 |
|
---|
| 175 | // Whats This Help
|
---|
| 176 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 177 | void teqcDlg::slotWhatsThis() {
|
---|
| 178 | QWhatsThis::enterWhatsThisMode();
|
---|
| 179 | }
|
---|
[3828] | 180 |
|
---|
| 181 | // Close Dialog gracefully
|
---|
| 182 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 183 | void teqcDlg::closeEvent(QCloseEvent* event) {
|
---|
| 184 |
|
---|
| 185 | int iRet = QMessageBox::question(this, "Close", "Save Options?",
|
---|
| 186 | QMessageBox::Yes, QMessageBox::No,
|
---|
| 187 | QMessageBox::Cancel);
|
---|
| 188 |
|
---|
| 189 | if (iRet == QMessageBox::Cancel) {
|
---|
| 190 | event->ignore();
|
---|
| 191 | return;
|
---|
| 192 | }
|
---|
| 193 | else if (iRet == QMessageBox::Yes) {
|
---|
[3829] | 194 | saveOptions();
|
---|
[3828] | 195 | }
|
---|
| 196 |
|
---|
| 197 | QDialog::closeEvent(event);
|
---|
| 198 | }
|
---|
[3829] | 199 |
|
---|
| 200 | // Save Selected Options
|
---|
| 201 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 202 | void teqcDlg::saveOptions() {
|
---|
| 203 |
|
---|
[3830] | 204 | bncSettings settings;
|
---|
| 205 |
|
---|
| 206 | settings.setValue("teqcRnxVersion" , _teqcRnxVersion->currentText());
|
---|
| 207 | settings.setValue("teqcSampling" , _teqcSampling->value());
|
---|
[3833] | 208 | settings.setValue("teqcStartDateTime" , _teqcStartDateTime->dateTime().toString(Qt::ISODate));
|
---|
| 209 | settings.setValue("teqcEndDateTime" , _teqcEndDateTime->dateTime().toString(Qt::ISODate));
|
---|
[3830] | 210 | settings.setValue("teqcOldMarkerName" , _teqcOldMarkerName->text());
|
---|
| 211 | settings.setValue("teqcNewMarkerName" , _teqcNewMarkerName->text());
|
---|
| 212 | settings.setValue("teqcOldAntennaName" , _teqcOldAntennaName->text());
|
---|
| 213 | settings.setValue("teqcNewAntennaName" , _teqcNewAntennaName->text());
|
---|
| 214 | settings.setValue("teqcOldReceiverName", _teqcOldReceiverName->text());
|
---|
| 215 | settings.setValue("teqcNewReceiverName", _teqcNewReceiverName->text());
|
---|
| 216 |
|
---|
| 217 | settings.sync();
|
---|
[3829] | 218 | }
|
---|