[5692] | 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: t_pppWidgets
|
---|
| 30 | *
|
---|
| 31 | * Purpose: This class stores widgets for PPP options
|
---|
| 32 | *
|
---|
| 33 | * Author: L. Mervart
|
---|
| 34 | *
|
---|
| 35 | * Created: 29-Jul-2014
|
---|
| 36 | *
|
---|
| 37 | * Changes:
|
---|
| 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
| 41 | #include <iostream>
|
---|
| 42 |
|
---|
| 43 | #include "PPP/pppwidgets.h"
|
---|
| 44 | #include "qtfilechooser.h"
|
---|
[5694] | 45 | #include "bncsettings.h"
|
---|
[5692] | 46 |
|
---|
| 47 | using namespace std;
|
---|
| 48 |
|
---|
| 49 | // Constructor
|
---|
| 50 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 51 | t_pppWidgets::t_pppWidgets() {
|
---|
[5699] | 52 |
|
---|
| 53 | _dataSource = new QComboBox(); _dataSource ->setObjectName("PPP/dataSource"); _widgets << _dataSource;
|
---|
| 54 | _rinexObs = new qtFileChooser(); _rinexObs ->setObjectName("PPP/rinexObs"); _widgets << _rinexObs;
|
---|
| 55 | _rinexNav = new qtFileChooser(); _rinexNav ->setObjectName("PPP/rinexNav"); _widgets << _rinexNav;
|
---|
[5701] | 56 | _corrMount = new QLineEdit(); _corrMount ->setObjectName("PPP/corrMount"); _widgets << _corrMount;
|
---|
[5699] | 57 | _corrFile = new qtFileChooser(); _corrFile ->setObjectName("PPP/corrFile"); _widgets << _corrFile;
|
---|
| 58 | _crdFile = new qtFileChooser(); _crdFile ->setObjectName("PPP/crdFile"); _widgets << _crdFile;
|
---|
| 59 | _antexFile = new qtFileChooser(); _antexFile ->setObjectName("PPP/antexFile"); _widgets << _antexFile;
|
---|
| 60 | _logFile = new QLineEdit(); _logFile ->setObjectName("PPP/logFile"); _widgets << _logFile;
|
---|
| 61 | _nmeaFile = new QLineEdit(); _nmeaFile ->setObjectName("PPP/nmeaFile"); _widgets << _nmeaFile;
|
---|
| 62 | _nmeaPort = new QLineEdit(); _nmeaPort ->setObjectName("PPP/nmeaPort"); _widgets << _nmeaPort;
|
---|
| 63 | _staTable = new QTableWidget(); _staTable ->setObjectName("PPP/staTable"); _widgets << _staTable;
|
---|
| 64 | _lcGPS = new QComboBox(); _lcGPS ->setObjectName("PPP/lcGPS"); _widgets << _lcGPS;
|
---|
| 65 | _lcGLONASS = new QComboBox(); _lcGLONASS ->setObjectName("PPP/lcGLONASS"); _widgets << _lcGLONASS;
|
---|
| 66 | _lcGalileo = new QComboBox(); _lcGalileo ->setObjectName("PPP/lcGalileo"); _widgets << _lcGalileo;
|
---|
| 67 | _sigmaC1 = new QLineEdit(); _sigmaC1 ->setObjectName("PPP/sigmaC1"); _widgets << _sigmaC1;
|
---|
| 68 | _sigmaL1 = new QLineEdit(); _sigmaL1 ->setObjectName("PPP/sigmaL1"); _widgets << _sigmaL1;
|
---|
| 69 | _corrWaitTime = new QSpinBox(); _corrWaitTime->setObjectName("PPP/corrWaitTime"); _widgets << _corrWaitTime;
|
---|
[5703] | 70 | _addStaButton = new QPushButton("Add Station"); _widgets << _addStaButton;
|
---|
| 71 | _delStaButton = new QPushButton("Delete Station"); _widgets << _delStaButton;
|
---|
[5696] | 72 |
|
---|
[5697] | 73 | _dataSource->setEditable(false);
|
---|
[5699] | 74 | _dataSource->addItems(QString("no,Real-Time Streams,RINEX Files").split(","));
|
---|
| 75 | connect(_dataSource, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotEnableWidgets()));
|
---|
[5697] | 76 |
|
---|
| 77 | _lcGPS->setEditable(false);
|
---|
[5699] | 78 | _lcGPS->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
[5697] | 79 |
|
---|
| 80 | _lcGLONASS->setEditable(false);
|
---|
[5699] | 81 | _lcGLONASS->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
[5697] | 82 |
|
---|
| 83 | _lcGalileo->setEditable(false);
|
---|
[5699] | 84 | _lcGalileo->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
[5697] | 85 |
|
---|
[5698] | 86 | _corrWaitTime->setMinimum(0);
|
---|
| 87 | _corrWaitTime->setMaximum(20);
|
---|
| 88 | _corrWaitTime->setSingleStep(1);
|
---|
| 89 | _corrWaitTime->setSuffix(" sec");
|
---|
| 90 | _corrWaitTime->setSpecialValueText("no");
|
---|
| 91 |
|
---|
[5702] | 92 | _staTable->setColumnCount(9);
|
---|
[5703] | 93 | _staTable->setRowCount(0);
|
---|
[5702] | 94 | _staTable->setHorizontalHeaderLabels(
|
---|
| 95 | QString("Station,Sigma N,Sigma E,Sigma H,Noise N,Noise E,Noise H,Tropo Sigma,Tropo Noise").split(","));
|
---|
[5703] | 96 | _staTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
---|
| 97 | _staTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
---|
| 98 | _staTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
|
---|
| 99 | /// _staTable->horizontalHeader()->setStretchLastSection(true);
|
---|
| 100 | _staTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
---|
| 101 |
|
---|
| 102 | connect(_addStaButton, SIGNAL(clicked()), this, SLOT(slotAddStation()));
|
---|
| 103 | connect(_delStaButton, SIGNAL(clicked()), this, SLOT(slotDelStation()));
|
---|
[5702] | 104 |
|
---|
[5696] | 105 | readOptions();
|
---|
[5692] | 106 | }
|
---|
| 107 |
|
---|
[5694] | 108 | //
|
---|
| 109 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5696] | 110 | void t_pppWidgets::readOptions() {
|
---|
| 111 |
|
---|
| 112 | bncSettings settings;
|
---|
| 113 |
|
---|
| 114 | int ii = _dataSource->findText(settings.value(_dataSource->objectName()).toString());
|
---|
| 115 | if (ii != -1) {
|
---|
| 116 | _dataSource->setCurrentIndex(ii);
|
---|
| 117 | }
|
---|
| 118 | ii = _lcGPS->findText(settings.value(_lcGPS->objectName()).toString());
|
---|
| 119 | if (ii != -1) {
|
---|
| 120 | _lcGPS->setCurrentIndex(ii);
|
---|
| 121 | }
|
---|
| 122 | ii = _lcGLONASS->findText(settings.value(_lcGLONASS->objectName()).toString());
|
---|
| 123 | if (ii != -1) {
|
---|
| 124 | _lcGLONASS->setCurrentIndex(ii);
|
---|
| 125 | }
|
---|
| 126 | ii = _lcGalileo->findText(settings.value(_lcGalileo->objectName()).toString());
|
---|
| 127 | if (ii != -1) {
|
---|
| 128 | _lcGalileo->setCurrentIndex(ii);
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | _rinexObs ->setFileName(settings.value(_rinexObs ->objectName()).toString());
|
---|
| 132 | _rinexNav ->setFileName(settings.value(_rinexNav ->objectName()).toString());
|
---|
| 133 | _corrFile ->setFileName(settings.value(_corrFile ->objectName()).toString());
|
---|
| 134 | _crdFile ->setFileName(settings.value(_crdFile ->objectName()).toString());
|
---|
| 135 | _antexFile->setFileName(settings.value(_antexFile->objectName()).toString());
|
---|
| 136 |
|
---|
[5701] | 137 | _corrMount->setText(settings.value(_corrMount->objectName()).toString());
|
---|
| 138 | _logFile ->setText(settings.value(_logFile ->objectName()).toString());
|
---|
| 139 | _nmeaFile ->setText(settings.value(_nmeaFile ->objectName()).toString());
|
---|
| 140 | _nmeaPort ->setText(settings.value(_nmeaPort ->objectName()).toString());
|
---|
| 141 | _sigmaC1 ->setText(settings.value(_sigmaC1 ->objectName()).toString());
|
---|
| 142 | _sigmaL1 ->setText(settings.value(_sigmaL1 ->objectName()).toString());
|
---|
[5696] | 143 |
|
---|
| 144 | _corrWaitTime->setValue(settings.value(_corrWaitTime->objectName()).toInt());
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | //
|
---|
| 148 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5694] | 149 | void t_pppWidgets::saveOptions() {
|
---|
| 150 |
|
---|
| 151 | bncSettings settings;
|
---|
| 152 |
|
---|
[5695] | 153 | settings.setValue(_dataSource ->objectName(), _dataSource ->currentText());
|
---|
| 154 | settings.setValue(_rinexObs ->objectName(), _rinexObs ->fileName());
|
---|
| 155 | settings.setValue(_rinexNav ->objectName(), _rinexNav ->fileName());
|
---|
[5701] | 156 | settings.setValue(_corrMount ->objectName(), _corrMount ->text());
|
---|
[5695] | 157 | settings.setValue(_corrFile ->objectName(), _corrFile ->fileName());
|
---|
| 158 | settings.setValue(_crdFile ->objectName(), _crdFile ->fileName());
|
---|
| 159 | settings.setValue(_antexFile ->objectName(), _antexFile ->fileName());
|
---|
| 160 | settings.setValue(_logFile ->objectName(), _logFile ->text());
|
---|
| 161 | settings.setValue(_nmeaFile ->objectName(), _nmeaFile ->text());
|
---|
| 162 | settings.setValue(_nmeaPort ->objectName(), _nmeaPort ->text());
|
---|
| 163 | settings.setValue(_lcGPS ->objectName(), _lcGPS ->currentText());
|
---|
| 164 | settings.setValue(_lcGLONASS ->objectName(), _lcGLONASS ->currentText());
|
---|
| 165 | settings.setValue(_lcGalileo ->objectName(), _lcGalileo ->currentText());
|
---|
| 166 | settings.setValue(_sigmaC1 ->objectName(), _sigmaC1 ->text());
|
---|
| 167 | settings.setValue(_sigmaL1 ->objectName(), _sigmaL1 ->text());
|
---|
| 168 | settings.setValue(_corrWaitTime->objectName(), _corrWaitTime->value());
|
---|
[5694] | 169 |
|
---|
| 170 | }
|
---|
[5699] | 171 |
|
---|
| 172 | //
|
---|
| 173 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 174 | void t_pppWidgets::slotEnableWidgets() {
|
---|
| 175 |
|
---|
| 176 | const static QPalette paletteWhite(QColor(255, 255, 255));
|
---|
| 177 | const static QPalette paletteGray(QColor(230, 230, 230));
|
---|
| 178 |
|
---|
| 179 | bool allDisabled = _dataSource->currentText() == "no";
|
---|
| 180 | bool realTime = _dataSource->currentText() == "Real-Time Streams";
|
---|
[5701] | 181 | bool rinexFiles = _dataSource->currentText() == "RINEX Files";
|
---|
[5699] | 182 |
|
---|
| 183 | QListIterator<QWidget*> it(_widgets);
|
---|
| 184 | while (it.hasNext()) {
|
---|
[5700] | 185 | QWidget* widget = it.next();
|
---|
| 186 | widget->setEnabled(!allDisabled);
|
---|
[5699] | 187 | }
|
---|
| 188 |
|
---|
[5701] | 189 | if (realTime) {
|
---|
| 190 | _rinexObs->setEnabled(false);
|
---|
| 191 | _rinexNav->setEnabled(false);
|
---|
| 192 | _corrFile->setEnabled(false);
|
---|
| 193 | }
|
---|
| 194 | else if (rinexFiles) {
|
---|
| 195 | _corrMount->setEnabled(false);
|
---|
| 196 | }
|
---|
| 197 |
|
---|
[5699] | 198 | _dataSource->setEnabled(true);
|
---|
[5700] | 199 |
|
---|
| 200 | it.toFront();
|
---|
| 201 | while (it.hasNext()) {
|
---|
| 202 | QWidget* widget = it.next();
|
---|
| 203 | if (widget->isEnabled()) {
|
---|
| 204 | widget->setPalette(paletteWhite);
|
---|
| 205 | }
|
---|
| 206 | else {
|
---|
| 207 | widget->setPalette(paletteGray);
|
---|
| 208 | }
|
---|
| 209 | }
|
---|
[5699] | 210 | }
|
---|
[5703] | 211 |
|
---|
| 212 | //
|
---|
| 213 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 214 | void t_pppWidgets::slotAddStation() {
|
---|
[5706] | 215 | int iRow = _staTable->rowCount();
|
---|
| 216 | _staTable->insertRow(iRow);
|
---|
| 217 | for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
|
---|
| 218 | _staTable->setItem(iRow, iCol, new QTableWidgetItem(""));
|
---|
| 219 | }
|
---|
[5703] | 220 | }
|
---|
| 221 |
|
---|
| 222 | //
|
---|
| 223 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 224 | void t_pppWidgets::slotDelStation() {
|
---|
[5706] | 225 | int nRows = _staTable->rowCount();
|
---|
| 226 | bool flg[nRows];
|
---|
| 227 | for (int iRow = 0; iRow < nRows; iRow++) {
|
---|
| 228 | if (_staTable->isItemSelected(_staTable->item(iRow,1))) {
|
---|
| 229 | flg[iRow] = true;
|
---|
| 230 | }
|
---|
| 231 | else {
|
---|
| 232 | flg[iRow] = false;
|
---|
| 233 | }
|
---|
| 234 | }
|
---|
| 235 | for (int iRow = nRows-1; iRow >= 0; iRow--) {
|
---|
| 236 | if (flg[iRow]) {
|
---|
| 237 | _staTable->removeRow(iRow);
|
---|
| 238 | }
|
---|
| 239 | }
|
---|
[5703] | 240 | }
|
---|