source: ntrip/trunk/BNC/src/bncudpport.cpp@ 6462

Last change on this file since 6462 was 4278, checked in by mervart, 13 years ago
File size: 5.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: 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
45using namespace std;
46
47// Constructor
48////////////////////////////////////////////////////////////////////////////
49bncUdpPort::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
63 int ww = QFontMetrics(font()).width('w');
64 _ipPortLineEdit->setMaximumWidth(9*ww);
65 _ipMountLineEdit->setMaximumWidth(9*ww);
66 _ipFormatLineEdit->setMaximumWidth(9*ww);
67 _ipLatLineEdit->setMaximumWidth(9*ww);
68 _ipLonLineEdit->setMaximumWidth(9*ww);
69
70 // WhatsThis
71 // ---------
72 _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>"));
73 _ipMountLineEdit->setWhatsThis(tr("<p>Specify a mountpoint.</p><p>Recommended is a 4-character station ID.<br>Example: FFMJ</p>"));
74 _ipFormatLineEdit->setWhatsThis(tr("<p>Specify the stream format.</p><p>Available options are 'RTCM_2', 'RTCM_3', 'RTNET', and 'ZERO'.</p>"));
75 _ipLatLineEdit->setWhatsThis(tr("<p>Enter the approximate latitude of the stream providing receiver in degrees.<p></p>Example: 45.32</p>"));
76 _ipLonLineEdit->setWhatsThis(tr("<p>Enter the approximate longitude of the stream providing receiver in degrees.<p></p>Example: -15.20</p>"));
77
78 editLayout->addWidget(new QLabel(tr("UDP Port")), 0, 0, Qt::AlignRight);
79 editLayout->addWidget(_ipPortLineEdit, 0, 1);
80 editLayout->addWidget(new QLabel(tr("Mountpoint")),1, 0, Qt::AlignRight);
81 editLayout->addWidget(_ipMountLineEdit, 1, 1);
82 editLayout->addWidget(new QLabel(tr("Format")), 1, 2, Qt::AlignRight);
83 editLayout->addWidget(_ipFormatLineEdit, 1, 3);
84 editLayout->addWidget(new QLabel(tr("Latitude")), 2, 0, Qt::AlignRight);
85 editLayout->addWidget(_ipLatLineEdit, 2, 1);
86 editLayout->addWidget(new QLabel(tr("Longitude")), 2, 2, Qt::AlignRight);
87 editLayout->addWidget(_ipLonLineEdit, 2, 3);
88
89 mainLayout->addLayout(editLayout);
90
91 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
92 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
93
94 _buttonCancel = new QPushButton(tr("Cancel"), this);
95 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
96
97 _buttonOK = new QPushButton(tr("OK"), this);
98 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
99
100 _buttonOK->setDefault(true);
101
102 QHBoxLayout* buttonLayout = new QHBoxLayout;
103
104 buttonLayout->addWidget(_buttonWhatsThis);
105 buttonLayout->addStretch(1);
106 buttonLayout->addWidget(_buttonCancel);
107 buttonLayout->addWidget(_buttonOK);
108
109 mainLayout->addLayout(buttonLayout);
110}
111
112// Destructor
113////////////////////////////////////////////////////////////////////////////
114bncUdpPort::~bncUdpPort() {
115 delete _buttonCancel;
116 delete _buttonOK;
117 delete _buttonWhatsThis;
118}
119
120// Accept slot
121////////////////////////////////////////////////////////////////////////////
122void bncUdpPort::accept() {
123
124 QStringList* mountPoints = new QStringList;
125
126 if ( !_ipPortLineEdit->text().isEmpty() &&
127 !_ipMountLineEdit->text().isEmpty() &&
128 !_ipFormatLineEdit->text().isEmpty() &&
129 !_ipLatLineEdit->text().isEmpty() &&
130 !_ipLonLineEdit->text().isEmpty() ) {
131
132 mountPoints->push_back("//127.0.0.1:"
133 + _ipPortLineEdit->text() + "/"
134 + _ipMountLineEdit->text() + " "
135 + _ipFormatLineEdit->text() + " "
136 + _ipLatLineEdit->text() + " "
137 + _ipLonLineEdit->text() + " "
138 + "no UN");
139 } else {
140 QMessageBox::warning(this, tr("Warning"),
141 tr("Incomplete settings"),
142 QMessageBox::Ok);
143 }
144
145 emit newMountPoints(mountPoints);
146
147 QDialog::accept();
148}
149
150// Whats This Help
151void bncUdpPort::slotWhatsThis() {
152QWhatsThis::enterWhatsThisMode();
153}
154
Note: See TracBrowser for help on using the repository browser.