1 | // Part of BNC, a utility for retrieving decoding and
|
---|
2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2009
|
---|
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: bncUdpPort
|
---|
30 | *
|
---|
31 | * Purpose: Select host for stream retrieval without NTRIP
|
---|
32 | *
|
---|
33 | * Author: G. Weber
|
---|
34 | *
|
---|
35 | * Created: 18-Feb-2009
|
---|
36 | *
|
---|
37 | * Changes:
|
---|
38 | *
|
---|
39 | * -----------------------------------------------------------------------*/
|
---|
40 |
|
---|
41 | #include <iostream>
|
---|
42 |
|
---|
43 | #include "bncudpport.h"
|
---|
44 |
|
---|
45 | using namespace std;
|
---|
46 |
|
---|
47 | // Constructor
|
---|
48 | ////////////////////////////////////////////////////////////////////////////
|
---|
49 | bncUdpPort::bncUdpPort(QWidget* parent) : QDialog(parent) {
|
---|
50 |
|
---|
51 | setMinimumSize(400,150);
|
---|
52 | QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
---|
53 | QGridLayout* editLayout = new QGridLayout;
|
---|
54 |
|
---|
55 | setWindowTitle(tr("Add Stream from UDP Port"));
|
---|
56 |
|
---|
57 | _ipPortLineEdit = new QLineEdit();
|
---|
58 | _ipMountLineEdit = new QLineEdit();
|
---|
59 | _ipFormatLineEdit = new QLineEdit();
|
---|
60 | _ipLatLineEdit = new QLineEdit();
|
---|
61 | _ipLonLineEdit = new QLineEdit();
|
---|
62 | _ipCountryLineEdit = new QLineEdit();
|
---|
63 |
|
---|
64 | int ww = QFontMetrics(font()).width('w');
|
---|
65 | _ipPortLineEdit->setMaximumWidth(9*ww);
|
---|
66 | _ipMountLineEdit->setMaximumWidth(9*ww);
|
---|
67 | _ipFormatLineEdit->setMaximumWidth(9*ww);
|
---|
68 | _ipLatLineEdit->setMaximumWidth(9*ww);
|
---|
69 | _ipLonLineEdit->setMaximumWidth(9*ww);
|
---|
70 | _ipCountryLineEdit->setMaximumWidth(9*ww);
|
---|
71 |
|
---|
72 | // WhatsThis
|
---|
73 | // ---------
|
---|
74 | _ipPortLineEdit->setWhatsThis(tr("<p>BNC allows to pick up streams arriving directly at one of the local host's UDP ports without using the Ntrip transport protocol.</p><p>Enter the local port number where the UDP stream arrives.</p>"));
|
---|
75 | _ipMountLineEdit->setWhatsThis(tr("<p>Specify a mountpoint.</p><p>Recommended is a 4-character station ID.<br>Example: FFMJ</p>"));
|
---|
76 | _ipFormatLineEdit->setWhatsThis(tr("<p>Specify the stream format.</p><p>Available options are 'RTCM_2', 'RTCM_3', 'RTNET', and 'ZERO'.</p>"));
|
---|
77 | _ipLatLineEdit->setWhatsThis(tr("<p>Enter the approximate latitude of the stream providing receiver in degrees.<p></p>Example: 45.32</p>"));
|
---|
78 | _ipLonLineEdit->setWhatsThis(tr("<p>Enter the approximate longitude of the stream providing receiver in degrees.<p></p>Example: -15.20</p>"));
|
---|
79 | _ipCountryLineEdit->setWhatsThis(tr("<p>Specify the country code.</p><p>Recommended is the ISO 3166-1 alpha-3a code.<br>Example: DEU</p>"));
|
---|
80 |
|
---|
81 | editLayout->addWidget(new QLabel(tr("UDP Port")), 0, 0, Qt::AlignRight);
|
---|
82 | editLayout->addWidget(_ipPortLineEdit, 0, 1);
|
---|
83 | editLayout->addWidget(new QLabel(tr("Mountpoint")),1, 0, Qt::AlignRight);
|
---|
84 | editLayout->addWidget(_ipMountLineEdit, 1, 1);
|
---|
85 | editLayout->addWidget(new QLabel(tr("Format")), 1, 2, Qt::AlignRight);
|
---|
86 | editLayout->addWidget(_ipFormatLineEdit, 1, 3);
|
---|
87 | editLayout->addWidget(new QLabel(tr("Latitude")), 2, 0, Qt::AlignRight);
|
---|
88 | editLayout->addWidget(_ipLatLineEdit, 2, 1);
|
---|
89 | editLayout->addWidget(new QLabel(tr("Longitude")), 2, 2, Qt::AlignRight);
|
---|
90 | editLayout->addWidget(_ipLonLineEdit, 2, 3);
|
---|
91 | editLayout->addWidget(new QLabel(tr("Country")), 3, 0, Qt::AlignRight);
|
---|
92 | editLayout->addWidget(_ipCountryLineEdit, 3, 1);
|
---|
93 |
|
---|
94 | mainLayout->addLayout(editLayout);
|
---|
95 |
|
---|
96 | _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
|
---|
97 | connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
|
---|
98 |
|
---|
99 | _buttonCancel = new QPushButton(tr("Cancel"), this);
|
---|
100 | connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
---|
101 |
|
---|
102 | _buttonOK = new QPushButton(tr("OK"), this);
|
---|
103 | connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
|
---|
104 |
|
---|
105 | _buttonOK->setDefault(true);
|
---|
106 |
|
---|
107 | QHBoxLayout* buttonLayout = new QHBoxLayout;
|
---|
108 |
|
---|
109 | buttonLayout->addWidget(_buttonWhatsThis);
|
---|
110 | buttonLayout->addStretch(1);
|
---|
111 | buttonLayout->addWidget(_buttonCancel);
|
---|
112 | buttonLayout->addWidget(_buttonOK);
|
---|
113 |
|
---|
114 | mainLayout->addLayout(buttonLayout);
|
---|
115 | }
|
---|
116 |
|
---|
117 | // Destructor
|
---|
118 | ////////////////////////////////////////////////////////////////////////////
|
---|
119 | bncUdpPort::~bncUdpPort() {
|
---|
120 | delete _buttonCancel;
|
---|
121 | delete _buttonOK;
|
---|
122 | delete _buttonWhatsThis;
|
---|
123 | }
|
---|
124 |
|
---|
125 | // Accept slot
|
---|
126 | ////////////////////////////////////////////////////////////////////////////
|
---|
127 | void bncUdpPort::accept() {
|
---|
128 |
|
---|
129 | QStringList* mountPoints = new QStringList;
|
---|
130 |
|
---|
131 | if ( !_ipPortLineEdit->text().isEmpty() &&
|
---|
132 | !_ipMountLineEdit->text().isEmpty() &&
|
---|
133 | !_ipFormatLineEdit->text().isEmpty() &&
|
---|
134 | !_ipCountryLineEdit->text().isEmpty() &&
|
---|
135 | !_ipLatLineEdit->text().isEmpty() &&
|
---|
136 | !_ipLonLineEdit->text().isEmpty() ) {
|
---|
137 |
|
---|
138 | mountPoints->push_back("//127.0.0.1:"
|
---|
139 | + _ipPortLineEdit->text() + "/"
|
---|
140 | + _ipMountLineEdit->text() + " "
|
---|
141 | + _ipFormatLineEdit->text() + " "
|
---|
142 | + _ipCountryLineEdit->text() + " "
|
---|
143 | + _ipLatLineEdit->text() + " "
|
---|
144 | + _ipLonLineEdit->text() + " "
|
---|
145 | + "no UN");
|
---|
146 | } else {
|
---|
147 | QMessageBox::warning(this, tr("Warning"),
|
---|
148 | tr("Incomplete settings"),
|
---|
149 | QMessageBox::Ok);
|
---|
150 | }
|
---|
151 |
|
---|
152 | emit newMountPoints(mountPoints);
|
---|
153 |
|
---|
154 | QDialog::accept();
|
---|
155 | }
|
---|
156 |
|
---|
157 | // Whats This Help
|
---|
158 | void bncUdpPort::slotWhatsThis() {
|
---|
159 | QWhatsThis::enterWhatsThisMode();
|
---|
160 | }
|
---|
161 |
|
---|