[748] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
[749] | 3 | * BKG NTRIP Server
|
---|
[748] | 4 | * -------------------------------------------------------------------------
|
---|
| 5 | *
|
---|
| 6 | * Class: bnsWindow
|
---|
| 7 | *
|
---|
| 8 | * Purpose: This class implements the main application window.
|
---|
| 9 | *
|
---|
| 10 | * Author: L. Mervart
|
---|
| 11 | *
|
---|
| 12 | * Created: 29-Mar-2008
|
---|
| 13 | *
|
---|
| 14 | * Changes:
|
---|
| 15 | *
|
---|
| 16 | * -----------------------------------------------------------------------*/
|
---|
| 17 |
|
---|
[749] | 18 | #include <iostream>
|
---|
| 19 |
|
---|
[748] | 20 | #include "bnswindow.h"
|
---|
[749] | 21 | #include "bnshlpdlg.h"
|
---|
[748] | 22 |
|
---|
| 23 | using namespace std;
|
---|
| 24 |
|
---|
[754] | 25 | // About Dialog - Constructor
|
---|
| 26 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 27 | bnsAboutDlg::bnsAboutDlg(QWidget* parent) :
|
---|
| 28 | QDialog(parent) {
|
---|
| 29 |
|
---|
| 30 | QTextBrowser* tb = new QTextBrowser;
|
---|
| 31 | QUrl url; url.setPath(":bnsabout.html");
|
---|
| 32 | tb->setSource(url);
|
---|
| 33 | tb->setReadOnly(true);
|
---|
| 34 |
|
---|
| 35 | int ww = QFontMetrics(font()).width('w');
|
---|
| 36 | QPushButton* _closeButton = new QPushButton("Close");
|
---|
| 37 | _closeButton->setMaximumWidth(10*ww);
|
---|
| 38 | connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
---|
| 39 |
|
---|
| 40 | QGridLayout* dlgLayout = new QGridLayout();
|
---|
| 41 | QLabel* img = new QLabel();
|
---|
| 42 | img->setPixmap(QPixmap(":ntrip-logo.png"));
|
---|
| 43 | dlgLayout->addWidget(img, 0,0);
|
---|
[1015] | 44 | dlgLayout->addWidget(new QLabel("BKG Ntrip State Space Server (BNS) Version 1.0"), 0,1);
|
---|
[754] | 45 | dlgLayout->addWidget(tb,1,0,1,2);
|
---|
| 46 | dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
|
---|
| 47 |
|
---|
| 48 | setLayout(dlgLayout);
|
---|
| 49 | resize(60*ww, 60*ww);
|
---|
| 50 | show();
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | // About Dialog - Destructor
|
---|
| 54 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 55 | bnsAboutDlg::~bnsAboutDlg() {
|
---|
| 56 | };
|
---|
| 57 |
|
---|
[998] | 58 | // Flowchart Dialog - Constructor
|
---|
| 59 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 60 | bnsFlowchartDlg::bnsFlowchartDlg(QWidget* parent) :
|
---|
| 61 | QDialog(parent) {
|
---|
| 62 |
|
---|
| 63 | int ww = QFontMetrics(font()).width('w');
|
---|
| 64 | QPushButton* _closeButton = new QPushButton("Close");
|
---|
| 65 | _closeButton->setMaximumWidth(10*ww);
|
---|
| 66 | connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
---|
| 67 |
|
---|
| 68 | QGridLayout* dlgLayout = new QGridLayout();
|
---|
| 69 | QLabel* img = new QLabel();
|
---|
| 70 | img->setPixmap(QPixmap(":bnsflowchart.png"));
|
---|
| 71 | dlgLayout->addWidget(img, 0,0);
|
---|
| 72 | dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
|
---|
| 73 |
|
---|
| 74 | setLayout(dlgLayout);
|
---|
| 75 | show();
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | // Flowchart Dialog - Destructor
|
---|
| 79 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 80 | bnsFlowchartDlg::~bnsFlowchartDlg() {
|
---|
| 81 | };
|
---|
| 82 |
|
---|
[748] | 83 | // Constructor
|
---|
| 84 | ////////////////////////////////////////////////////////////////////////////
|
---|
[758] | 85 | bnsWindow::bnsWindow() {
|
---|
[749] | 86 |
|
---|
[758] | 87 | _bns = 0;
|
---|
[757] | 88 |
|
---|
[752] | 89 | QSettings settings;
|
---|
| 90 |
|
---|
| 91 | QString fontString = settings.value("font").toString();
|
---|
| 92 | if ( !fontString.isEmpty() ) {
|
---|
| 93 | QFont newFont;
|
---|
| 94 | if (newFont.fromString(fontString)) {
|
---|
[1057] | 95 | QApplication::setFont(newFont);
|
---|
[752] | 96 | }
|
---|
| 97 | }
|
---|
| 98 |
|
---|
[749] | 99 | int ww = QFontMetrics(this->font()).width('w');
|
---|
| 100 | setMinimumSize(77*ww, 65*ww);
|
---|
[1015] | 101 | setWindowTitle(tr("BKG Ntrip State Space Server (BNS) Version 1.0"));
|
---|
[752] | 102 | setWindowIcon(QPixmap(":ntrip-logo.png"));
|
---|
[749] | 103 |
|
---|
| 104 | // Create Actions
|
---|
| 105 | // --------------
|
---|
| 106 | _actHelp = new QAction(tr("&Help Contents"),this);
|
---|
| 107 | connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
|
---|
| 108 |
|
---|
| 109 | _actAbout = new QAction(tr("&About BNS"),this);
|
---|
| 110 | connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
|
---|
| 111 |
|
---|
[998] | 112 | _actFlowchart = new QAction(tr("&Flow Chart"),this);
|
---|
| 113 | connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
|
---|
| 114 |
|
---|
[749] | 115 | _actFontSel = new QAction(tr("Select &Font"),this);
|
---|
| 116 | connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
|
---|
| 117 |
|
---|
| 118 | _actSaveOpt = new QAction(tr("&Save Options"),this);
|
---|
| 119 | connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
|
---|
| 120 |
|
---|
| 121 | _actQuit = new QAction(tr("&Quit"),this);
|
---|
| 122 | connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
|
---|
| 123 |
|
---|
[753] | 124 | _actWhatsThis= new QAction(tr("Help=Shift+F1"),this);
|
---|
| 125 | connect(_actWhatsThis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
|
---|
[749] | 126 |
|
---|
[753] | 127 | _actStart = new QAction(tr("Sta&rt"),this);
|
---|
| 128 | connect(_actStart, SIGNAL(triggered()), SLOT(slotStart()));
|
---|
| 129 |
|
---|
| 130 | _actStop = new QAction(tr("Sto&p"),this);
|
---|
| 131 | connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
|
---|
| 132 | _actStop->setEnabled(false);
|
---|
| 133 |
|
---|
[749] | 134 | CreateMenu();
|
---|
| 135 | AddToolbar();
|
---|
| 136 |
|
---|
| 137 | // Canvas with Editable Fields
|
---|
| 138 | // ---------------------------
|
---|
| 139 | _canvas = new QWidget;
|
---|
| 140 | setCentralWidget(_canvas);
|
---|
| 141 |
|
---|
[958] | 142 | _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
|
---|
[964] | 143 | _proxyHostLineEdit->setWhatsThis(tr("<p>If you are running BNS within a protected Local Area Network (LAN), you might need to use a proxy server to access the Internet. Enter your proxy server IP and port number in case one is operated in front of BNS. If you do not know the IP and port of your proxy server, check the proxy server settings in your Internet browser or ask your network administrator.</p><p>Note that IP streaming is sometimes not allowed in a LAN. In this case you need to ask your network administrator for an appropriate modification of the local security policy or for the installation of a TCP relay to the NTRIP broadcasters. If these are not possible, you might need to run BNS outside your LAN on a network that has unobstructed connection to the Internet.</p>"));
|
---|
[958] | 144 | _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
|
---|
[964] | 145 | _proxyPortLineEdit->setWhatsThis(tr("<p>Enter your proxy server port number in case one is operated in front of BNS.</p>"));
|
---|
[958] | 146 | _proxyPortLineEdit->setMaximumWidth(9*ww);
|
---|
| 147 |
|
---|
| 148 | _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
|
---|
| 149 | _logFileLineEdit->setWhatsThis(tr("<p>Records of BNS activities are shown in the Log section on the bottom of this window. They can be saved into a file when a valid path is specified in the 'Logfile (full path)' field.</p>"));
|
---|
| 150 | _fileAppendCheckBox = new QCheckBox();
|
---|
| 151 | _fileAppendCheckBox->setCheckState(Qt::CheckState(settings.value("fileAppend").toInt()));
|
---|
| 152 | _fileAppendCheckBox->setWhatsThis(tr("<p>When BNS is started, new files are created by default and any existing files with the same name will be overwritten. However, users might want to append already existing files following a restart of BNS, a system crash or when BNS crashed. Tick 'Append files' to continue with existing files and keep what has been recorded so far.</p>"));
|
---|
| 153 |
|
---|
[1070] | 154 | _inpEchoLineEdit = new QLineEdit(settings.value("inpEcho").toString());
|
---|
[1083] | 155 | _inpEchoLineEdit->setWhatsThis(tr("Specify the full path to a file where incoming clocks and orbits are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that incoming clocks and orbits are not saved."));
|
---|
[1070] | 156 |
|
---|
[958] | 157 | _ephHostLineEdit = new QLineEdit(settings.value("ephHost").toString());
|
---|
| 158 | _ephHostLineEdit->setWhatsThis(tr("BNS reads Broadcast Ephemeris in RINEX Version 3 Navigation file format from an IP address. Specify the host IP e.g. of a BNC installation providing this information."));
|
---|
[752] | 159 | _ephPortLineEdit = new QLineEdit(settings.value("ephPort").toString());
|
---|
[958] | 160 | _ephPortLineEdit->setWhatsThis(tr("BNS reads Broadcast Ephemeris in RINEX Version 3 Navigation file format from an IP address. Specify the IP port e.g. of a BNC installation providing this information."));
|
---|
[752] | 161 | _ephPortLineEdit->setMaximumWidth(9*ww);
|
---|
[1089] | 162 | _ephEchoLineEdit = new QLineEdit(settings.value("ephEcho").toString());
|
---|
| 163 | _ephEchoLineEdit->setWhatsThis(tr("Specify the full path to a file where incoming Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that incoming Broadcast Ephemeris are not saved."));
|
---|
[752] | 164 |
|
---|
[787] | 165 | _clkPortLineEdit = new QLineEdit(settings.value("clkPort").toString());
|
---|
[1267] | 166 | _clkPortLineEdit->setWhatsThis(tr("BNS reads Clocks & Orbits referring to the IGS system (X,Y,Z, ECEF) in SP3 format from an IP port. Specify a local IP port e.g. for an RTNet installation to provide this information."));
|
---|
[787] | 167 | _clkPortLineEdit->setMaximumWidth(9*ww);
|
---|
[750] | 168 |
|
---|
[1249] | 169 | _outHost_1_LineEdit = new QLineEdit(settings.value("outHost1").toString());
|
---|
| 170 | _outHost_1_LineEdit->setWhatsThis(tr("BNS can stream clock and orbit corrections to Broadcast Ephemeris in RTCM Version 3 format. Specify the host IP of an NTRIP Broadcaster to upload the stream. An empty option field means that you don't want to upload corrections."));
|
---|
| 171 | _outPort_1_LineEdit = new QLineEdit(settings.value("outPort1").toString());
|
---|
| 172 | _outPort_1_LineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
|
---|
| 173 | _outPort_1_LineEdit->setMaximumWidth(9*ww);
|
---|
| 174 | _password_1_LineEdit = new QLineEdit(settings.value("password1").toString());
|
---|
| 175 | _password_1_LineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
|
---|
| 176 | _password_1_LineEdit->setMaximumWidth(9*ww);
|
---|
| 177 | _password_1_LineEdit->setEchoMode(QLineEdit::Password);
|
---|
| 178 |
|
---|
| 179 | _outHost_2_LineEdit = new QLineEdit(settings.value("outHost2").toString());
|
---|
| 180 | _outHost_2_LineEdit->setWhatsThis(tr("BNS can stream clock and orbit corrections to Broadcast Ephemeris in RTCM Version 3 format. Specify the host IP of an NTRIP Broadcaster to upload the stream. An empty option field means that you don't want to upload corrections."));
|
---|
| 181 | _outPort_2_LineEdit = new QLineEdit(settings.value("outPort2").toString());
|
---|
| 182 | _outPort_2_LineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
|
---|
| 183 | _outPort_2_LineEdit->setMaximumWidth(9*ww);
|
---|
| 184 | _password_2_LineEdit = new QLineEdit(settings.value("password2").toString());
|
---|
| 185 | _password_2_LineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
|
---|
| 186 | _password_2_LineEdit->setMaximumWidth(9*ww);
|
---|
| 187 | _password_2_LineEdit->setEchoMode(QLineEdit::Password);
|
---|
| 188 |
|
---|
[1068] | 189 | _mountpoint_1_LineEdit = new QLineEdit(settings.value("mountpoint_1").toString());
|
---|
| 190 | _mountpoint_1_LineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
|
---|
[1249] | 191 | _mountpoint_1_LineEdit->setMaximumWidth(12*ww);
|
---|
[1068] | 192 | _mountpoint_2_LineEdit = new QLineEdit(settings.value("mountpoint_2").toString());
|
---|
| 193 | _mountpoint_2_LineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
|
---|
[1249] | 194 | _mountpoint_2_LineEdit->setMaximumWidth(12*ww);
|
---|
[1068] | 195 | _refSys_1_ComboBox = new QComboBox;
|
---|
[1249] | 196 | _refSys_1_ComboBox->setMaximumWidth(12*ww);
|
---|
[1068] | 197 | _refSys_1_ComboBox->setEditable(false);
|
---|
[1243] | 198 | _refSys_1_ComboBox->addItems(QString("IGS05,ETRF2000").split(","));
|
---|
[1068] | 199 | int ii = _refSys_1_ComboBox->findText(settings.value("refSys_1").toString());
|
---|
| 200 | if (ii != -1) {
|
---|
| 201 | _refSys_1_ComboBox->setCurrentIndex(ii);
|
---|
| 202 | }
|
---|
| 203 | _refSys_1_ComboBox->setWhatsThis(tr("Select the target reference system for outgoing clock and orbit corrections."));
|
---|
| 204 | _refSys_2_ComboBox = new QComboBox;
|
---|
[1249] | 205 | _refSys_2_ComboBox->setMaximumWidth(12*ww);
|
---|
[1068] | 206 | _refSys_2_ComboBox->setEditable(false);
|
---|
[1243] | 207 | _refSys_2_ComboBox->addItems(QString("IGS05,ETRF2000").split(","));
|
---|
[1068] | 208 | ii = _refSys_2_ComboBox->findText(settings.value("refSys_2").toString());
|
---|
| 209 | if (ii != -1) {
|
---|
| 210 | _refSys_2_ComboBox->setCurrentIndex(ii);
|
---|
| 211 | }
|
---|
| 212 | _refSys_2_ComboBox->setWhatsThis(tr("Select the target reference system for outgoing clock and orbit corrections."));
|
---|
| 213 | _outFile_1_LineEdit = new QLineEdit(settings.value("outFile_1").toString());
|
---|
| 214 | _outFile_1_LineEdit->setWhatsThis(tr("Specify the full path to a file where outgoing clock and orbit corrections to Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that outgoing corrections are not saved."));
|
---|
| 215 | _outFile_2_LineEdit = new QLineEdit(settings.value("outFile_2").toString());
|
---|
| 216 | _outFile_2_LineEdit->setWhatsThis(tr("Specify the full path to a file where outgoing clock and orbit corrections to Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that outgoing corrections are not saved."));
|
---|
[813] | 217 |
|
---|
[846] | 218 | _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
|
---|
[958] | 219 | _rnxPathLineEdit->setWhatsThis(tr("Specify the path for saving the generated clock corrections as Clock RINEX files. If the specified directory does not exist, BNS will not create Clock RINEX files."));
|
---|
[845] | 220 | _rnxIntrComboBox = new QComboBox;
|
---|
[846] | 221 | _rnxIntrComboBox->setMaximumWidth(9*ww);
|
---|
| 222 | _rnxIntrComboBox->setEditable(false);
|
---|
| 223 | _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
|
---|
[958] | 224 | ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
|
---|
[846] | 225 | if (ii != -1) {
|
---|
| 226 | _rnxIntrComboBox->setCurrentIndex(ii);
|
---|
| 227 | }
|
---|
[958] | 228 | _rnxIntrComboBox->setWhatsThis(tr("Select the length of the Clock RINEX file."));
|
---|
[845] | 229 | _rnxSamplSpinBox = new QSpinBox;
|
---|
[846] | 230 | _rnxSamplSpinBox->setMinimum(0);
|
---|
| 231 | _rnxSamplSpinBox->setMaximum(60);
|
---|
| 232 | _rnxSamplSpinBox->setSingleStep(5);
|
---|
| 233 | _rnxSamplSpinBox->setMaximumWidth(9*ww);
|
---|
| 234 | _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
|
---|
| 235 | _rnxSamplSpinBox->setSuffix(" sec");
|
---|
[958] | 236 | _rnxSamplSpinBox->setWhatsThis(tr("Select the Clock RINEX file sampling interval in seconds. A value of zero '0' tells BNS to store all available samples into Clock RINEX files."));
|
---|
[845] | 237 |
|
---|
[846] | 238 | _sp3PathLineEdit = new QLineEdit(settings.value("sp3Path").toString());
|
---|
[969] | 239 | _sp3PathLineEdit->setWhatsThis(tr("Specify the path for saving the generated orbit corrections as SP3 orbit files. If the specified directory does not exist, BNS will not create SP3 orbit files."));
|
---|
[845] | 240 | _sp3IntrComboBox = new QComboBox;
|
---|
[846] | 241 | _sp3IntrComboBox->setMaximumWidth(9*ww);
|
---|
| 242 | _sp3IntrComboBox->setEditable(false);
|
---|
| 243 | _sp3IntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
|
---|
| 244 | ii = _sp3IntrComboBox->findText(settings.value("sp3Intr").toString());
|
---|
| 245 | if (ii != -1) {
|
---|
| 246 | _sp3IntrComboBox->setCurrentIndex(ii);
|
---|
| 247 | }
|
---|
[958] | 248 | _sp3IntrComboBox->setWhatsThis(tr("Select the length of the SP3 orbit file."));
|
---|
[845] | 249 | _sp3SamplSpinBox = new QSpinBox;
|
---|
[846] | 250 | _sp3SamplSpinBox->setMinimum(0);
|
---|
[855] | 251 | _sp3SamplSpinBox->setMaximum(900);
|
---|
| 252 | _sp3SamplSpinBox->setSingleStep(60);
|
---|
[846] | 253 | _sp3SamplSpinBox->setMaximumWidth(9*ww);
|
---|
| 254 | _sp3SamplSpinBox->setValue(settings.value("sp3Sampl").toInt());
|
---|
| 255 | _sp3SamplSpinBox->setSuffix(" sec");
|
---|
[958] | 256 | _sp3SamplSpinBox->setWhatsThis(tr("Select the SP3 orbit file sampling interval in seconds. A value of zero '0' tells BNS to store all available samples into SP3 orbit files."));
|
---|
[845] | 257 |
|
---|
[750] | 258 | // TabWidget
|
---|
| 259 | // ---------
|
---|
[844] | 260 | QTabWidget* tabs = new QTabWidget();
|
---|
[813] | 261 |
|
---|
[958] | 262 | // Proxy Tab
|
---|
| 263 | // ---------
|
---|
| 264 | QWidget* tab_prx = new QWidget();
|
---|
| 265 | tabs->setMaximumHeight(20*ww);
|
---|
| 266 | tabs->addTab(tab_prx, "Proxy");
|
---|
[750] | 267 |
|
---|
[958] | 268 | QGridLayout* layout_prx = new QGridLayout;
|
---|
| 269 | layout_prx->setColumnMinimumWidth(0,9*ww);
|
---|
[845] | 270 |
|
---|
[1083] | 271 | layout_prx->addWidget(new QLabel("Host"), 0, 0, Qt::AlignLeft);
|
---|
[958] | 272 | layout_prx->addWidget(_proxyHostLineEdit, 0, 1);
|
---|
[1083] | 273 | layout_prx->addWidget(new QLabel("Port"), 1, 0, Qt::AlignLeft);
|
---|
[958] | 274 | layout_prx->addWidget(_proxyPortLineEdit, 1, 1);
|
---|
| 275 | layout_prx->addWidget(new QLabel("Settings for the proxy in protected networks, leave boxes blank if none."),2, 0, 1, 2, Qt::AlignLeft);
|
---|
| 276 | layout_prx->addWidget(new QLabel(" "), 3, 0);
|
---|
[813] | 277 |
|
---|
[958] | 278 | tab_prx->setLayout(layout_prx);
|
---|
[752] | 279 |
|
---|
[958] | 280 | // General Tab
|
---|
| 281 | // -----------
|
---|
| 282 | QWidget* tab_gen = new QWidget();
|
---|
| 283 | tabs->addTab(tab_gen, "General");
|
---|
| 284 |
|
---|
| 285 | QGridLayout* layout_gen = new QGridLayout;
|
---|
| 286 | layout_gen->setColumnMinimumWidth(0,9*ww);
|
---|
| 287 |
|
---|
| 288 | layout_gen->addWidget(new QLabel("Logfile (full path)"), 0, 0);
|
---|
| 289 | layout_gen->addWidget(_logFileLineEdit, 0, 1);
|
---|
| 290 | layout_gen->addWidget(new QLabel("Append files"), 1, 0);
|
---|
| 291 | layout_gen->addWidget(_fileAppendCheckBox, 1, 1);
|
---|
[1083] | 292 | layout_gen->addWidget(new QLabel("General settings for logfile and file handling."), 2, 0, 1, 2, Qt::AlignLeft);
|
---|
[1068] | 293 | layout_gen->addWidget(new QLabel(" "), 3, 0);
|
---|
[958] | 294 |
|
---|
| 295 | tab_gen->setLayout(layout_gen);
|
---|
| 296 |
|
---|
[1083] | 297 | // Ephemeris Tab
|
---|
| 298 | // -------------
|
---|
| 299 | QWidget* tab_eph = new QWidget();
|
---|
[1084] | 300 | tabs->addTab(tab_eph, "RINEX Ephemeris");
|
---|
[958] | 301 |
|
---|
[1083] | 302 | QGridLayout* layout_eph = new QGridLayout;
|
---|
| 303 | layout_eph->setColumnMinimumWidth(0, 9*ww);
|
---|
[958] | 304 |
|
---|
[1083] | 305 | layout_eph->addWidget(new QLabel("Host"), 0, 0);
|
---|
| 306 | layout_eph->addWidget(_ephHostLineEdit, 0, 1);
|
---|
| 307 | layout_eph->addWidget(new QLabel("Port"), 1, 0);
|
---|
| 308 | layout_eph->addWidget(_ephPortLineEdit, 1, 1);
|
---|
[1089] | 309 | layout_eph->addWidget(new QLabel("Save (full path)"), 2, 0);
|
---|
| 310 | layout_eph->addWidget(_ephEchoLineEdit, 2, 1);
|
---|
[1111] | 311 | layout_eph->addWidget(new QLabel("Read broadcast ephemeris in RINEX Version 3 Navigation format."), 3, 0, 1, 2, Qt::AlignLeft);
|
---|
[1094] | 312 | //layout_eph->addWidget(new QLabel(""), 4, 0);
|
---|
[958] | 313 |
|
---|
[1083] | 314 | tab_eph->setLayout(layout_eph);
|
---|
[958] | 315 |
|
---|
[1083] | 316 | // Clock & Orbit Tab
|
---|
| 317 | // -----------------
|
---|
| 318 | QWidget* tab_co = new QWidget();
|
---|
| 319 | tabs->addTab(tab_co,"Clocks && Orbits");
|
---|
| 320 |
|
---|
| 321 |
|
---|
| 322 | QGridLayout* layout_co = new QGridLayout;
|
---|
| 323 | layout_co->setColumnMinimumWidth(0, 9*ww);
|
---|
| 324 |
|
---|
| 325 | layout_co->addWidget(new QLabel("Listening port"), 0, 0);
|
---|
| 326 | layout_co->addWidget(_clkPortLineEdit, 0, 1);
|
---|
| 327 | layout_co->addWidget(new QLabel("Save (full path)"), 1, 0);
|
---|
| 328 | layout_co->addWidget(_inpEchoLineEdit, 1, 1);
|
---|
[1111] | 329 | layout_co->addWidget(new QLabel("Read clocks and orbits in SP3 format."), 2, 0, 1, 2, Qt::AlignLeft);
|
---|
[1083] | 330 | layout_co->addWidget(new QLabel(""), 3, 0);
|
---|
| 331 |
|
---|
| 332 | tab_co->setLayout(layout_co);
|
---|
| 333 |
|
---|
[1249] | 334 | // Caster Tab I
|
---|
| 335 | // ------------
|
---|
| 336 | QWidget* tab_cas1 = new QWidget();
|
---|
| 337 | tabs->addTab(tab_cas1, "Ephemeris Corrections I");
|
---|
[813] | 338 |
|
---|
[1249] | 339 | QGridLayout* layout_cas1 = new QGridLayout;
|
---|
| 340 | layout_cas1->setColumnMinimumWidth(0, 9*ww);
|
---|
| 341 | layout_cas1->addWidget(new QLabel("Host"), 0, 0);
|
---|
| 342 | layout_cas1->addWidget(_outHost_1_LineEdit, 0, 1, 1, 3);
|
---|
| 343 | layout_cas1->addWidget(new QLabel("Port"), 0, 4, Qt::AlignRight);
|
---|
| 344 | layout_cas1->addWidget(_outPort_1_LineEdit, 0, 5);
|
---|
| 345 | layout_cas1->addWidget(new QLabel("Mountpoint"), 1, 0);
|
---|
| 346 | layout_cas1->addWidget(_mountpoint_1_LineEdit, 1, 1);
|
---|
| 347 | layout_cas1->addWidget(new QLabel("Password"), 1, 2, Qt::AlignRight);
|
---|
| 348 | layout_cas1->addWidget(_password_1_LineEdit, 1, 3);
|
---|
| 349 | layout_cas1->addWidget(new QLabel(" "), 1, 4);
|
---|
| 350 | layout_cas1->addWidget(new QLabel(" "), 1, 5);
|
---|
| 351 | layout_cas1->addWidget(new QLabel("System"), 2, 0);
|
---|
| 352 | layout_cas1->addWidget(_refSys_1_ComboBox, 2, 1);
|
---|
| 353 | layout_cas1->addWidget(new QLabel("Save (full path)"), 2, 2, Qt::AlignRight);
|
---|
| 354 | layout_cas1->addWidget(_outFile_1_LineEdit, 2, 3, 1, 10);
|
---|
| 355 | layout_cas1->addWidget(new QLabel("Produce broadcast ephemeris corrections, upload to caster, reference system, local storage."), 3, 0, 1, 10);
|
---|
[845] | 356 |
|
---|
[1249] | 357 | tab_cas1->setLayout(layout_cas1);
|
---|
[844] | 358 |
|
---|
[1249] | 359 | // Caster Tab II
|
---|
| 360 | // -------------
|
---|
| 361 | QWidget* tab_cas2 = new QWidget();
|
---|
| 362 | tabs->addTab(tab_cas2, "Ephemeris Corrections II");
|
---|
[1068] | 363 |
|
---|
[1249] | 364 | QGridLayout* layout_cas2 = new QGridLayout;
|
---|
| 365 | layout_cas2->setColumnMinimumWidth(0, 9*ww);
|
---|
| 366 | layout_cas2->addWidget(new QLabel("Host"), 0, 0);
|
---|
| 367 | layout_cas2->addWidget(_outHost_2_LineEdit, 0, 1, 1, 3);
|
---|
| 368 | layout_cas2->addWidget(new QLabel("Port"), 0, 4, Qt::AlignRight);
|
---|
| 369 | layout_cas2->addWidget(_outPort_2_LineEdit, 0, 5);
|
---|
| 370 | layout_cas2->addWidget(new QLabel("Mountpoint"), 1, 0);
|
---|
| 371 | layout_cas2->addWidget(_mountpoint_2_LineEdit, 1, 1);
|
---|
| 372 | layout_cas2->addWidget(new QLabel("Password"), 1, 2, Qt::AlignRight);
|
---|
| 373 | layout_cas2->addWidget(_password_2_LineEdit, 1, 3);
|
---|
| 374 | layout_cas2->addWidget(new QLabel(" "), 1, 4);
|
---|
| 375 | layout_cas2->addWidget(new QLabel(" "), 1, 5);
|
---|
| 376 | layout_cas2->addWidget(new QLabel("System"), 2, 0);
|
---|
| 377 | layout_cas2->addWidget(_refSys_2_ComboBox, 2, 1);
|
---|
| 378 | layout_cas2->addWidget(new QLabel("Save (full path)"), 2, 2, Qt::AlignRight);
|
---|
| 379 | layout_cas2->addWidget(_outFile_2_LineEdit, 2, 3, 1, 10);
|
---|
| 380 | layout_cas2->addWidget(new QLabel("Produce broadcast ephemeris corrections, upload to caster, reference system, local storage."), 3, 0, 1, 10);
|
---|
[1068] | 381 |
|
---|
[1249] | 382 | tab_cas2->setLayout(layout_cas2);
|
---|
[1068] | 383 |
|
---|
[958] | 384 | // RINEX Tab
|
---|
| 385 | // ---------
|
---|
[845] | 386 | QWidget* tab_rin = new QWidget();
|
---|
[958] | 387 | tabs->addTab(tab_rin, "RINEX Clocks ");
|
---|
[845] | 388 |
|
---|
| 389 | QGridLayout* layout_rin = new QGridLayout;
|
---|
[958] | 390 | layout_rin->setColumnMinimumWidth(0, 9*ww);
|
---|
[845] | 391 |
|
---|
[958] | 392 | layout_rin->addWidget(new QLabel("Directory"), 0, 0);
|
---|
| 393 | layout_rin->addWidget(_rnxPathLineEdit, 0, 1);
|
---|
| 394 | layout_rin->addWidget(new QLabel("Interval"), 1, 0);
|
---|
| 395 | layout_rin->addWidget(_rnxIntrComboBox, 1, 1);
|
---|
| 396 | layout_rin->addWidget(new QLabel("Sampling"), 2, 0);
|
---|
| 397 | layout_rin->addWidget(_rnxSamplSpinBox, 2, 1);
|
---|
| 398 | layout_rin->addWidget(new QLabel("Save clock corrections in Clock RINEX file format."), 3, 0, 1, 2, Qt::AlignLeft);
|
---|
[845] | 399 |
|
---|
| 400 | tab_rin->setLayout(layout_rin);
|
---|
| 401 |
|
---|
[958] | 402 | // SP3 Tab
|
---|
| 403 | // -------
|
---|
| 404 | QWidget* tab_sp3 = new QWidget();
|
---|
| 405 | tabs->addTab(tab_sp3, "SP3 Orbits");
|
---|
| 406 |
|
---|
| 407 | QGridLayout* layout_sp3 = new QGridLayout;
|
---|
| 408 | layout_sp3->setColumnMinimumWidth(0, 9*ww);
|
---|
| 409 |
|
---|
| 410 | layout_sp3->addWidget(new QLabel("Directory"), 0, 0);
|
---|
| 411 | layout_sp3->addWidget(_sp3PathLineEdit, 0, 1);
|
---|
| 412 | layout_sp3->addWidget(new QLabel("Interval"), 1, 0);
|
---|
| 413 | layout_sp3->addWidget(_sp3IntrComboBox, 1, 1);
|
---|
| 414 | layout_sp3->addWidget(new QLabel("Sampling"), 2, 0);
|
---|
| 415 | layout_sp3->addWidget(_sp3SamplSpinBox, 2, 1);
|
---|
| 416 | layout_sp3->addWidget(new QLabel("Save orbit corrections in SP3 file format."), 3, 0, 1, 2, Qt::AlignLeft);
|
---|
| 417 |
|
---|
| 418 | tab_sp3->setLayout(layout_sp3);
|
---|
| 419 |
|
---|
[750] | 420 | // Log
|
---|
| 421 | // ---
|
---|
| 422 | _log = new QTextBrowser();
|
---|
| 423 | _log->setReadOnly(true);
|
---|
| 424 | _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section."));
|
---|
| 425 |
|
---|
[1058] | 426 | // Status
|
---|
| 427 | // ------
|
---|
[1083] | 428 | //_status = new QWidget();
|
---|
| 429 | _status = new QGroupBox(tr("Status"));
|
---|
[1058] | 430 | QGridLayout* layout_status = new QGridLayout;
|
---|
| 431 |
|
---|
| 432 | _statusLbl[0] = new QLabel("0 byte(s)"); _statusCnt[0] = 0;
|
---|
| 433 | _statusLbl[1] = new QLabel("0 byte(s)"); _statusCnt[1] = 0;
|
---|
| 434 | _statusLbl[2] = new QLabel("0 byte(s)"); _statusCnt[2] = 0;
|
---|
[1262] | 435 | _statusLbl[7] = new QLabel("RINEX Ephemeris:");
|
---|
[1083] | 436 | _statusLbl[4] = new QLabel("Clocks & Orbits:");
|
---|
[1255] | 437 | _statusLbl[5] = new QLabel("Ephemeris Corrections I:");
|
---|
[1256] | 438 | _statusLbl[6] = new QLabel("Ephemeris Corrections II:");
|
---|
[1262] | 439 | _statusLbl[3] = new QLabel("0 byte(s)"); _statusCnt[3] = 0;
|
---|
[1058] | 440 |
|
---|
[1083] | 441 | _statusLbl[0]->setWhatsThis(tr("Status of incoming broadcast ephemeris."));
|
---|
| 442 | _statusLbl[1]->setWhatsThis(tr("Status of incoming stream of clocks and orbits."));
|
---|
| 443 | _statusLbl[2]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster."));
|
---|
[1262] | 444 | _statusLbl[7]->setWhatsThis(tr("Status of incoming broadcast ephemeris."));
|
---|
[1258] | 445 | _statusLbl[4]->setWhatsThis(tr("Status of incoming stream of clocks and orbits I."));
|
---|
| 446 | _statusLbl[5]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster I."));
|
---|
| 447 | _statusLbl[6]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster II."));
|
---|
[1262] | 448 | _statusLbl[3]->setWhatsThis(tr("Status of outgoing stream to NTRIP broadcaster II."));
|
---|
[1083] | 449 |
|
---|
[1262] | 450 | layout_status->addWidget(_statusLbl[7], 0, 0);
|
---|
[1058] | 451 | layout_status->addWidget(_statusLbl[0], 0, 1);
|
---|
[1083] | 452 | layout_status->addWidget(_statusLbl[4], 1, 0);
|
---|
| 453 | layout_status->addWidget(_statusLbl[1], 1, 1);
|
---|
| 454 | layout_status->addWidget(_statusLbl[5], 0, 2);
|
---|
| 455 | layout_status->addWidget(_statusLbl[2], 0, 3);
|
---|
[1256] | 456 | layout_status->addWidget(_statusLbl[6], 1, 2);
|
---|
[1262] | 457 | layout_status->addWidget(_statusLbl[3], 1, 3);
|
---|
[1058] | 458 | _status->setLayout(layout_status);
|
---|
| 459 |
|
---|
[750] | 460 | // Main Layout
|
---|
| 461 | // -----------
|
---|
| 462 | QVBoxLayout* mainLayout = new QVBoxLayout;
|
---|
| 463 | mainLayout->addWidget(tabs);
|
---|
| 464 | mainLayout->addWidget(_log);
|
---|
[1058] | 465 | mainLayout->addWidget(_status);
|
---|
[750] | 466 |
|
---|
| 467 | _canvas->setLayout(mainLayout);
|
---|
[748] | 468 | }
|
---|
| 469 |
|
---|
| 470 | // Destructor
|
---|
| 471 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 472 | bnsWindow::~bnsWindow() {
|
---|
| 473 | }
|
---|
| 474 |
|
---|
| 475 | // Close Application gracefully
|
---|
| 476 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 477 | void bnsWindow::closeEvent(QCloseEvent* event) {
|
---|
[749] | 478 |
|
---|
| 479 | int iRet = QMessageBox::question(this, "Close", "Save Options?",
|
---|
| 480 | QMessageBox::Yes, QMessageBox::No,
|
---|
| 481 | QMessageBox::Cancel);
|
---|
| 482 |
|
---|
| 483 | if (iRet == QMessageBox::Cancel) {
|
---|
| 484 | event->ignore();
|
---|
| 485 | return;
|
---|
| 486 | }
|
---|
| 487 | else if (iRet == QMessageBox::Yes) {
|
---|
| 488 | slotSaveOptions();
|
---|
| 489 | }
|
---|
| 490 |
|
---|
[748] | 491 | QMainWindow::closeEvent(event);
|
---|
| 492 | }
|
---|
| 493 |
|
---|
[749] | 494 | // About Message
|
---|
| 495 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 496 | void bnsWindow::slotAbout() {
|
---|
| 497 | new bnsAboutDlg(0);
|
---|
| 498 | }
|
---|
| 499 |
|
---|
[998] | 500 | //Flowchart
|
---|
| 501 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 502 | void bnsWindow::slotFlowchart() {
|
---|
| 503 | new bnsFlowchartDlg(0);
|
---|
| 504 | }
|
---|
| 505 |
|
---|
[749] | 506 | // Help Window
|
---|
| 507 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 508 | void bnsWindow::slotHelp() {
|
---|
| 509 | QUrl url;
|
---|
| 510 | url.setPath(":bnshelp.html");
|
---|
| 511 | new bnsHlpDlg(0, url);
|
---|
| 512 | }
|
---|
| 513 |
|
---|
| 514 | // Select Fonts
|
---|
| 515 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 516 | void bnsWindow::slotFontSel() {
|
---|
| 517 | bool ok;
|
---|
| 518 | QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
|
---|
| 519 | if (ok) {
|
---|
| 520 | QSettings settings;
|
---|
| 521 | settings.setValue("font", newFont.toString());
|
---|
| 522 | QApplication::setFont(newFont);
|
---|
| 523 | int ww = QFontMetrics(newFont).width('w');
|
---|
[752] | 524 | setMinimumSize(77*ww, 65*ww);
|
---|
[749] | 525 | }
|
---|
| 526 | }
|
---|
| 527 |
|
---|
| 528 | // Whats This Help
|
---|
| 529 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 530 | void bnsWindow::slotWhatsThis() {
|
---|
| 531 | QWhatsThis::enterWhatsThisMode();
|
---|
| 532 | }
|
---|
| 533 |
|
---|
| 534 | // Create Menus
|
---|
| 535 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 536 | void bnsWindow::CreateMenu() {
|
---|
| 537 | _menuFile = menuBar()->addMenu(tr("&File"));
|
---|
| 538 | _menuFile->addAction(_actFontSel);
|
---|
| 539 | _menuFile->addSeparator();
|
---|
| 540 | _menuFile->addAction(_actSaveOpt);
|
---|
| 541 | _menuFile->addSeparator();
|
---|
| 542 | _menuFile->addAction(_actQuit);
|
---|
| 543 |
|
---|
| 544 | _menuHlp = menuBar()->addMenu(tr("&Help"));
|
---|
| 545 | _menuHlp->addAction(_actHelp);
|
---|
[998] | 546 | _menuHlp->addAction(_actFlowchart);
|
---|
[749] | 547 | _menuHlp->addAction(_actAbout);
|
---|
| 548 | }
|
---|
| 549 |
|
---|
| 550 | // Tool (Command) Bar
|
---|
| 551 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 552 | void bnsWindow::AddToolbar() {
|
---|
| 553 | QToolBar* toolBar = new QToolBar;
|
---|
| 554 | addToolBar(Qt::BottomToolBarArea, toolBar);
|
---|
| 555 | toolBar->setMovable(false);
|
---|
[753] | 556 | toolBar->addAction(_actStart);
|
---|
| 557 | toolBar->addAction(_actStop);
|
---|
[749] | 558 | toolBar->addWidget(new QLabel(" "));
|
---|
[753] | 559 | toolBar->addAction(_actWhatsThis);
|
---|
[749] | 560 | }
|
---|
| 561 |
|
---|
| 562 | // Save Options
|
---|
| 563 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 564 | void bnsWindow::slotSaveOptions() {
|
---|
[750] | 565 | QSettings settings;
|
---|
[1249] | 566 | settings.setValue("proxyHost", _proxyHostLineEdit->text());
|
---|
| 567 | settings.setValue("proxyPort", _proxyPortLineEdit->text());
|
---|
| 568 | settings.setValue("logFile", _logFileLineEdit->text());
|
---|
| 569 | settings.setValue("fileAppend", _fileAppendCheckBox->checkState());
|
---|
| 570 | settings.setValue("refSys_1", _refSys_1_ComboBox->currentText());
|
---|
| 571 | settings.setValue("refSys_2", _refSys_2_ComboBox->currentText());
|
---|
| 572 | settings.setValue("inpEcho", _inpEchoLineEdit->text());
|
---|
| 573 | settings.setValue("ephHost", _ephHostLineEdit->text());
|
---|
| 574 | settings.setValue("ephPort", _ephPortLineEdit->text());
|
---|
| 575 | settings.setValue("ephEcho", _ephEchoLineEdit->text());
|
---|
| 576 | settings.setValue("clkPort", _clkPortLineEdit->text());
|
---|
| 577 | settings.setValue("outHost1", _outHost_1_LineEdit->text());
|
---|
| 578 | settings.setValue("outPort1", _outPort_1_LineEdit->text());
|
---|
[1251] | 579 | settings.setValue("outHost2", _outHost_2_LineEdit->text());
|
---|
| 580 | settings.setValue("outPort2", _outPort_2_LineEdit->text());
|
---|
[1249] | 581 | settings.setValue("mountpoint_1",_mountpoint_1_LineEdit->text());
|
---|
| 582 | settings.setValue("mountpoint_2",_mountpoint_2_LineEdit->text());
|
---|
| 583 | settings.setValue("outFile_1", _outFile_1_LineEdit->text());
|
---|
| 584 | settings.setValue("outFile_2", _outFile_2_LineEdit->text());
|
---|
| 585 | settings.setValue("password1", _password_1_LineEdit->text());
|
---|
| 586 | settings.setValue("password2", _password_2_LineEdit->text());
|
---|
| 587 | settings.setValue("rnxPath", _rnxPathLineEdit->text());
|
---|
| 588 | settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
|
---|
| 589 | settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
|
---|
| 590 | settings.setValue("sp3Path", _sp3PathLineEdit->text());
|
---|
| 591 | settings.setValue("sp3Intr", _sp3IntrComboBox->currentText());
|
---|
| 592 | settings.setValue("sp3Sampl", _sp3SamplSpinBox->value());
|
---|
[749] | 593 | }
|
---|
| 594 |
|
---|
[750] | 595 | // Display Program Messages
|
---|
| 596 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 597 | void bnsWindow::slotMessage(const QByteArray msg) {
|
---|
| 598 |
|
---|
| 599 | const int maxBufferSize = 10000;
|
---|
| 600 |
|
---|
| 601 | QString txt = _log->toPlainText() + "\n" +
|
---|
| 602 | QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
|
---|
| 603 | _log->clear();
|
---|
| 604 | _log->append(txt.right(maxBufferSize));
|
---|
| 605 | }
|
---|
[753] | 606 |
|
---|
[760] | 607 | // Delete bns
|
---|
| 608 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 609 | void bnsWindow::deleteBns() {
|
---|
| 610 | _actStart->setEnabled(true);
|
---|
| 611 | _actStop->setEnabled(false);
|
---|
[762] | 612 | _bns->terminate();
|
---|
[764] | 613 | _bns->wait(100);
|
---|
[760] | 614 | delete _bns;
|
---|
| 615 | _bns = 0;
|
---|
| 616 | }
|
---|
| 617 |
|
---|
| 618 | // Error in bns
|
---|
| 619 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 620 | void bnsWindow::slotError(const QByteArray msg) {
|
---|
| 621 | slotMessage(msg);
|
---|
| 622 | deleteBns();
|
---|
| 623 | }
|
---|
| 624 |
|
---|
[753] | 625 | // Stop
|
---|
| 626 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 627 | void bnsWindow::slotStop() {
|
---|
| 628 | int iRet = QMessageBox::question(this, "Stop", "Do you want to stop?",
|
---|
| 629 | QMessageBox::Yes, QMessageBox::No,
|
---|
| 630 | QMessageBox::NoButton);
|
---|
| 631 | if (iRet == QMessageBox::Yes) {
|
---|
[760] | 632 | deleteBns();
|
---|
[753] | 633 | }
|
---|
| 634 | }
|
---|
| 635 |
|
---|
| 636 | // Start
|
---|
| 637 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 638 | void bnsWindow::slotStart() {
|
---|
| 639 | slotSaveOptions();
|
---|
| 640 |
|
---|
| 641 | _actStart->setEnabled(false);
|
---|
| 642 | _actStop->setEnabled(true);
|
---|
| 643 |
|
---|
[758] | 644 | _bns = new t_bns(0);
|
---|
[760] | 645 |
|
---|
[758] | 646 | connect(_bns, SIGNAL(newMessage(QByteArray)),
|
---|
| 647 | this, SLOT(slotMessage(const QByteArray)));
|
---|
[760] | 648 |
|
---|
| 649 | connect(_bns, SIGNAL(error(QByteArray)),
|
---|
| 650 | this, SLOT(slotError(const QByteArray)));
|
---|
| 651 |
|
---|
[1058] | 652 | connect(_bns, SIGNAL(newEphBytes(int)), this, SLOT(slotEphBytes(int)));
|
---|
| 653 | connect(_bns, SIGNAL(newClkBytes(int)), this, SLOT(slotClkBytes(int)));
|
---|
[1258] | 654 | connect(_bns, SIGNAL(newOutBytes1(int)), this, SLOT(slotOutBytes1(int)));
|
---|
| 655 | connect(_bns, SIGNAL(newOutBytes2(int)), this, SLOT(slotOutBytes2(int)));
|
---|
[1058] | 656 |
|
---|
[757] | 657 | _bns->start();
|
---|
[753] | 658 | }
|
---|
[1058] | 659 |
|
---|
| 660 | // Input and output bytes statistics
|
---|
| 661 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 662 | void bnsWindow::slotEphBytes(int nBytes) {
|
---|
| 663 | updateStatus(0, nBytes);
|
---|
| 664 | }
|
---|
| 665 | void bnsWindow::slotClkBytes(int nBytes) {
|
---|
| 666 | updateStatus(1, nBytes);
|
---|
| 667 | }
|
---|
[1258] | 668 | void bnsWindow::slotOutBytes1(int nBytes) {
|
---|
[1058] | 669 | updateStatus(2, nBytes);
|
---|
| 670 | }
|
---|
[1258] | 671 | void bnsWindow::slotOutBytes2(int nBytes) {
|
---|
| 672 | updateStatus(3, nBytes);
|
---|
| 673 | }
|
---|
[1058] | 674 |
|
---|
| 675 | void bnsWindow::updateStatus(int ii, int nBytes) {
|
---|
| 676 | QMutexLocker locker(&_mutex);
|
---|
| 677 |
|
---|
| 678 | _statusCnt[ii] += nBytes;
|
---|
| 679 |
|
---|
| 680 | if (_statusCnt[ii] < 1e3) {
|
---|
| 681 | _statusLbl[ii]->setText(QString("%1 byte(s)").arg((int)_statusCnt[ii]));
|
---|
| 682 | }
|
---|
| 683 | else if (_statusCnt[ii] < 1e6) {
|
---|
| 684 | _statusLbl[ii]->setText(QString("%1 kb").arg(_statusCnt[ii]/1.e3, 5));
|
---|
| 685 | }
|
---|
| 686 | else {
|
---|
| 687 | _statusLbl[ii]->setText(QString("%1 Mb").arg(_statusCnt[ii]/1.e6, 5));
|
---|
| 688 | }
|
---|
| 689 | }
|
---|