source: ntrip/trunk/BNC/src/bncipport.cpp@ 8450

Last change on this file since 8450 was 8252, checked in by stoecker, 7 years ago

see #105 - reenable Qt4 build options, drop generic version dependend includes, replace by direct requirements, remaining QtCore lines should also be replaced

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