source: ntrip/branches/BNC_2.12/src/bncipport.cpp@ 8465

Last change on this file since 8465 was 7679, checked in by weber, 8 years ago

Documentation completed

File size: 6.5 KB
Line 
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: bncIpPort
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 "bncipport.h"
44
45using namespace std;
46
47// Constructor
48////////////////////////////////////////////////////////////////////////////
49bncIpPort::bncIpPort(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 TCP/IP Port"));
56
57 _ipHostLineEdit = new QLineEdit();
58 _ipPortLineEdit = new QLineEdit();
59 _ipMountLineEdit = new QLineEdit();
60 _ipFormatLineEdit = new QLineEdit();
61 _ipLatLineEdit = new QLineEdit();
62 _ipLonLineEdit = new QLineEdit();
63 _ipCountryLineEdit = new QLineEdit();
64
65 int ww = QFontMetrics(font()).width('w');
66 _ipPortLineEdit->setMaximumWidth(9*ww);
67 _ipMountLineEdit->setMaximumWidth(9*ww);
68 _ipFormatLineEdit->setMaximumWidth(9*ww);
69 _ipLatLineEdit->setMaximumWidth(9*ww);
70 _ipLonLineEdit->setMaximumWidth(9*ww);
71 _ipCountryLineEdit->setMaximumWidth(9*ww);
72
73 // WhatsThis, Add Stream from TCP/IP Port
74 // --------------------------------------
75 _ipHostLineEdit->setWhatsThis(tr("<p>If no proxy server is involved in the communication, BNC allows to retrieve streams via TCP directly from an IP address without using the Ntrip transport protocol.</p><p>Enter the IP address of the stream providing host.</p>"));
76 _ipPortLineEdit->setWhatsThis(tr("<p>Enter the IP port number of the stream providing host.</p>"));
77 _ipMountLineEdit->setWhatsThis(tr("<p>Specify a mountpoint.</p><p>Recommended is a 4-character station ID.<br>Example: FFMJ</p>"));
78 _ipFormatLineEdit->setWhatsThis(tr("<p>Specify the stream format.</p><p>Available options are 'RTCM_2', 'RTCM_3', RTNET, and 'ZERO'.</p>"));
79 _ipLatLineEdit->setWhatsThis(tr("<p>Enter the approximate latitude of the stream providing receiver in degrees.<p></p>Example: 45.32</p>"));
80 _ipLonLineEdit->setWhatsThis(tr("<p>Enter the approximate longitude of the stream providing receiver in degrees.<p></p>Example: -15.20</p>"));
81 _ipCountryLineEdit->setWhatsThis(tr("<p>Specify the country code.</p><p>Follow the ISO 3166-1 alpha-3a code.<br>Example, Germany: DEU</p>"));
82
83 editLayout->addWidget(new QLabel(tr("Host")), 0, 0, Qt::AlignRight);
84 editLayout->addWidget(_ipHostLineEdit, 0, 1);
85 editLayout->addWidget(new QLabel(tr("Port")), 0, 2, Qt::AlignRight);
86 editLayout->addWidget(_ipPortLineEdit, 0, 3);
87 editLayout->addWidget(new QLabel(tr("Mountpoint")),1, 0, Qt::AlignRight);
88 editLayout->addWidget(_ipMountLineEdit, 1, 1);
89 editLayout->addWidget(new QLabel(tr("Format")), 1, 2, Qt::AlignRight);
90 editLayout->addWidget(_ipFormatLineEdit, 1, 3);
91 editLayout->addWidget(new QLabel(tr("Latitude")), 2, 0, Qt::AlignRight);
92 editLayout->addWidget(_ipLatLineEdit, 2, 1);
93 editLayout->addWidget(new QLabel(tr("Longitude")), 2, 2, Qt::AlignRight);
94 editLayout->addWidget(_ipLonLineEdit, 2, 3);
95 editLayout->addWidget(new QLabel(tr("Country")), 3, 0, Qt::AlignRight);
96 editLayout->addWidget(_ipCountryLineEdit, 3, 1);
97
98 mainLayout->addLayout(editLayout);
99
100 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
101 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
102
103 _buttonCancel = new QPushButton(tr("Cancel"), this);
104 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
105
106 _buttonOK = new QPushButton(tr("OK"), this);
107 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
108
109 _buttonOK->setDefault(true);
110
111 QHBoxLayout* buttonLayout = new QHBoxLayout;
112
113 buttonLayout->addWidget(_buttonWhatsThis);
114 buttonLayout->addStretch(1);
115 buttonLayout->addWidget(_buttonCancel);
116 buttonLayout->addWidget(_buttonOK);
117
118 mainLayout->addLayout(buttonLayout);
119}
120
121// Destructor
122////////////////////////////////////////////////////////////////////////////
123bncIpPort::~bncIpPort() {
124 delete _buttonCancel;
125 delete _buttonOK;
126 delete _buttonWhatsThis;
127}
128
129// Accept slot
130////////////////////////////////////////////////////////////////////////////
131void bncIpPort::accept() {
132
133 QStringList* mountPoints = new QStringList;
134
135 if ( !_ipHostLineEdit->text().isEmpty() &&
136 !_ipPortLineEdit->text().isEmpty() &&
137 !_ipMountLineEdit->text().isEmpty() &&
138 !_ipFormatLineEdit->text().isEmpty() &&
139 !_ipCountryLineEdit->text().isEmpty() &&
140 !_ipLatLineEdit->text().isEmpty() &&
141 !_ipLonLineEdit->text().isEmpty() ) {
142
143 mountPoints->push_back("//" + _ipHostLineEdit->text() + ":"
144 + _ipPortLineEdit->text() + "/"
145 + _ipMountLineEdit->text() + " "
146 + _ipFormatLineEdit->text() + " "
147 + _ipCountryLineEdit->text() + " "
148 + _ipLatLineEdit->text() + " "
149 + _ipLonLineEdit->text() + " "
150 + "no N");
151 } else {
152 QMessageBox::warning(this, tr("Warning"),
153 tr("Incomplete settings"),
154 QMessageBox::Ok);
155 }
156
157 emit newMountPoints(mountPoints);
158
159 QDialog::accept();
160}
161
162// Whats This Help
163void bncIpPort::slotWhatsThis() {
164QWhatsThis::enterWhatsThisMode();
165}
166
Note: See TracBrowser for help on using the repository browser.