[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 | const QString timeFmtString = "yyyy-MM-dd hh:mm:ss";
|
---|
| 49 |
|
---|
[3740] | 50 | // Constructor
|
---|
| 51 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 52 | teqcDlg::teqcDlg(QWidget* parent) : QDialog(parent) {
|
---|
| 53 |
|
---|
[3742] | 54 | setWindowTitle(tr("Teqc Editing Options"));
|
---|
[3740] | 55 |
|
---|
| 56 | int ww = QFontMetrics(font()).width('w');
|
---|
| 57 |
|
---|
[3743] | 58 | _teqcRnxVersion = new QComboBox(this);
|
---|
| 59 | _teqcSampling = new QSpinBox(this);
|
---|
| 60 | _teqcStartDateTime = new QDateTimeEdit(this);
|
---|
[3831] | 61 | _teqcStartDateTime->setDisplayFormat(timeFmtString);
|
---|
[3743] | 62 | _teqcEndDateTime = new QDateTimeEdit(this);
|
---|
[3831] | 63 | _teqcEndDateTime->setDisplayFormat(timeFmtString);
|
---|
[3742] | 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 |
|
---|
[3745] | 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 |
|
---|
[3742] | 83 | int ir = 0;
|
---|
[3743] | 84 | grid->addWidget(new QLabel("RNX Version"), ir, 1);
|
---|
| 85 | grid->addWidget(_teqcRnxVersion, ir, 2);
|
---|
[3745] | 86 | grid->addWidget(new QLabel(" Sampling"), ir, 3);
|
---|
[3743] | 87 | grid->addWidget(_teqcSampling, ir, 4);
|
---|
[3742] | 88 | ++ir;
|
---|
[3743] | 89 | grid->addWidget(new QLabel("Start"), ir, 1);
|
---|
| 90 | grid->addWidget(_teqcStartDateTime, ir, 2);
|
---|
[3745] | 91 | grid->addWidget(new QLabel(" End"), ir, 3);
|
---|
[3743] | 92 | grid->addWidget(_teqcEndDateTime, ir, 4);
|
---|
[3742] | 93 | ++ir;
|
---|
[3743] | 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;
|
---|
[3742] | 105 | grid->addWidget(new QLabel("Receiver Name"), ir, 0);
|
---|
[3743] | 106 | grid->addWidget(_teqcOldReceiverName, ir, 1, 1, 2);
|
---|
| 107 | grid->addWidget(_teqcNewReceiverName, ir, 3, 1, 2);
|
---|
[3742] | 108 |
|
---|
[3740] | 109 | _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
|
---|
| 110 | connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
|
---|
| 111 |
|
---|
[3828] | 112 | _buttonOK = new QPushButton(tr("OK / Save"), this);
|
---|
[3740] | 113 | connect(_buttonOK, SIGNAL(clicked()), this, SLOT(slotOK()));
|
---|
| 114 |
|
---|
| 115 | _buttonCancel = new QPushButton(tr("Cancel"), this);
|
---|
[3741] | 116 | connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
|
---|
[3740] | 117 |
|
---|
| 118 | QHBoxLayout* buttonLayout = new QHBoxLayout;
|
---|
| 119 | buttonLayout->addWidget(_buttonWhatsThis);
|
---|
| 120 | buttonLayout->addStretch(1);
|
---|
| 121 | buttonLayout->addWidget(_buttonOK);
|
---|
| 122 | buttonLayout->addWidget(_buttonCancel);
|
---|
| 123 |
|
---|
[3745] | 124 | QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
---|
[3742] | 125 | mainLayout->addLayout(grid);
|
---|
[3740] | 126 | mainLayout->addLayout(buttonLayout);
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | // Destructor
|
---|
| 130 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 131 | teqcDlg::~teqcDlg() {
|
---|
| 132 | delete _buttonOK;
|
---|
| 133 | delete _buttonCancel;
|
---|
| 134 | delete _buttonWhatsThis;
|
---|
| 135 | }
|
---|
| 136 |
|
---|
[3741] | 137 | // Accept the Options
|
---|
| 138 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 139 | void teqcDlg::slotOK() {
|
---|
[3829] | 140 | saveOptions();
|
---|
[3828] | 141 | done(0);
|
---|
[3741] | 142 | }
|
---|
| 143 |
|
---|
| 144 | // Whats This Help
|
---|
| 145 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 146 | void teqcDlg::slotWhatsThis() {
|
---|
| 147 | QWhatsThis::enterWhatsThisMode();
|
---|
| 148 | }
|
---|
[3828] | 149 |
|
---|
| 150 | // Close Dialog gracefully
|
---|
| 151 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 152 | void 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) {
|
---|
[3829] | 163 | saveOptions();
|
---|
[3828] | 164 | }
|
---|
| 165 |
|
---|
| 166 | QDialog::closeEvent(event);
|
---|
| 167 | }
|
---|
[3829] | 168 |
|
---|
| 169 | // Save Selected Options
|
---|
| 170 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 171 | void teqcDlg::saveOptions() {
|
---|
| 172 |
|
---|
[3830] | 173 | bncSettings settings;
|
---|
| 174 |
|
---|
| 175 | settings.setValue("teqcRnxVersion" , _teqcRnxVersion->currentText());
|
---|
| 176 | settings.setValue("teqcSampling" , _teqcSampling->value());
|
---|
[3831] | 177 | settings.setValue("teqcStartDateTime" , _teqcStartDateTime->dateTime().toString(timeFmtString));
|
---|
| 178 | settings.setValue("teqcEndDateTime" , _teqcEndDateTime->dateTime().toString(timeFmtString));
|
---|
[3830] | 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();
|
---|
[3829] | 187 | }
|
---|