source: ntrip/trunk/BNC/bnctabledlg.cpp@ 1491

Last change on this file since 1491 was 1491, checked in by mervart, 15 years ago

* empty log message *

File size: 21.1 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
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: bncTableDlg
30 *
31 * Purpose: Displays the source table, allows mountpoints selection
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include "bnctabledlg.h"
42#include "bncgetthread.h"
43#include "bncnetqueryv2.h"
44
45using namespace std;
46
47// Constructor
48////////////////////////////////////////////////////////////////////////////
49bncTableDlg::bncTableDlg(QWidget* parent) : QDialog(parent) {
50
51 setMinimumSize(600,400);
52 setWindowTitle(tr("Add Streams"));
53
54 QVBoxLayout* mainLayout = new QVBoxLayout(this);
55
56 int ww = QFontMetrics(font()).width('w');
57
58 _casterPortLineEdit = new QLineEdit();
59 _casterPortLineEdit->setMaximumWidth(9*ww);
60
61 _casterUserLineEdit = new QLineEdit();
62 _casterUserLineEdit->setMaximumWidth(9*ww);
63
64 _casterPasswordLineEdit = new QLineEdit();
65 _casterPasswordLineEdit->setMaximumWidth(9*ww);
66 _casterPasswordLineEdit->setEchoMode(QLineEdit::Password);
67
68 _casterHostComboBox = new QComboBox();
69 _casterHostComboBox->setMaxCount(10);
70 _casterHostComboBox->setDuplicatesEnabled(false);
71 _casterHostComboBox->setEditable(true);
72 _casterHostComboBox->setMinimumWidth(20*ww);
73 _casterHostComboBox->setMaximumWidth(20*ww);
74 connect(_casterHostComboBox, SIGNAL(currentIndexChanged(const QString&)),
75 this, SLOT(slotCasterHostChanged(const QString&)));
76 QSettings settings;
77 settings.remove("casterHostList");
78 settings.remove("casterHost");
79 settings.remove("casterPort");
80 settings.remove("casterUser");
81 settings.remove("casterPassword");
82 QStringList casterUrlList = settings.value("casterUrlList").toStringList();
83 for (int ii = 0; ii < casterUrlList.count(); ii++) {
84 QUrl url(casterUrlList[ii]);
85 _casterHostComboBox->addItem(url.host());
86 }
87
88 _ntripVersionComboBox = new QComboBox();
89 _ntripVersionComboBox->addItems(QString("1,2,R").split(","));
90 int kk = _ntripVersionComboBox->findText(settings.value("ntripVersion").toString());
91 if (kk != -1) {
92 _ntripVersionComboBox->setCurrentIndex(kk);
93 }
94 _ntripVersionComboBox->setMaximumWidth(5*ww);
95
96 _buttonCasterTable = new QPushButton(tr("Show"), this);
97 connect(_buttonCasterTable, SIGNAL(clicked()), this, SLOT(slotCasterTable()));
98 _buttonCasterTable->setMaximumWidth(5*ww);
99
100 // WhatsThis
101 // ---------
102 _casterUserLineEdit->setWhatsThis(tr("<p>Access to some streams on NTRIP broadcasters may be restricted. You'll need to enter a valid 'User ID' and 'Password' for access to these protected streams.</p><p>Accounts are usually provided per NTRIP broadcaster through a registration process. Register through <u>http://igs.bkg.bund.de/index_ntrip_reg.htm</u> for access to protected streams on <u>www.euref-ip.net</u> and <u>www.igs-ip.net</u>.</p>"));
103 _casterHostComboBox->setWhatsThis(tr("<p>Enter the NTRIP broadcaster hostname or IP number.</p><p>Note that EUREF and IGS operate NTRIP broadcasters at <u>http://www.euref-ip.net/home</u> and <u>http://www.igs-ip.net/home</u>.</p>"));
104 _casterPortLineEdit->setWhatsThis(tr("Enter the NTRIP broadcaster port number."));
105 _casterPasswordLineEdit->setWhatsThis(tr("Access to some streams on NTRIP broadcasters may be restricted. You'll need to enter a valid 'Password' for access to these protected streams."));
106
107 QGridLayout* editLayout = new QGridLayout;
108 editLayout->addWidget(new QLabel(tr("Caster host")), 0, 0);
109 editLayout->addWidget(_casterHostComboBox, 0, 1);
110 editLayout->addWidget(new QLabel(tr(" Caster port")), 0, 2, Qt::AlignRight);
111 editLayout->addWidget(_casterPortLineEdit, 0, 3);
112 editLayout->addWidget(new QLabel(tr("Caster table")), 0, 4, Qt::AlignRight);
113 editLayout->addWidget(_buttonCasterTable, 0, 5);
114 editLayout->addWidget(new QLabel(tr("User")), 1, 0, Qt::AlignRight);
115 editLayout->addWidget(_casterUserLineEdit, 1, 1);
116 editLayout->addWidget(new QLabel(tr("Password")), 1, 2, Qt::AlignRight);
117 editLayout->addWidget(_casterPasswordLineEdit, 1, 3);
118 editLayout->addWidget(new QLabel(tr(" NTRIP Version")),1, 4, Qt::AlignRight);
119 editLayout->addWidget(_ntripVersionComboBox, 1, 5);
120
121 mainLayout->addLayout(editLayout);
122
123 _buttonCasterTable->setWhatsThis(tr("<p>Hit 'Show' for a table of known NTRIP broadcaster installations as maintained at <u>www.rtcm-ntrip.org/home.</u></p><p>A window opens which allows to select a broadcaster for stream retrieval.</p>"));
124 _ntripVersionComboBox->setWhatsThis(tr("<p>Select the NTRIP transport protocol version you want to use. Implemented options are:<br>&nbsp; 1:&nbsp; NTRIP version 1, TCP/IP<br>&nbsp; 2:&nbsp; NTRIP version 2, TCP/IP mode<br>&nbsp; R:&nbsp; NTRIP Version 2, RTSP/RTP mode<br>Select option '1' if you are not sure whether the NTRIP broadcaster supports NTRIP version 2.</p><p>Note that RTSP/RTP (option 'R') is sometimes not supported by mobile Internet Service Providers.</p>"));
125
126 _table = new QTableWidget(this);
127 _table->setWhatsThis(tr("<p>Use the 'Get Table' button to download the sourcetable from the selected NTRIP broadcaster. Select the desired streams line by line, using +Shift and +Ctrl when necessary. Hit 'OK' to return to the main window.</p><p>Pay attention to data field 'format'. Keep in mind that BNC can only decode and convert streams that come in RTCM Version 2.x, RTCM Version 3.x, or RTIGS format. See data field 'format-details' for available message types and their repetition rates in brackets.</p><p>The content of data field 'nmea' tells you whether a stream comes from a virtual reference station (VRS).</p>"));
128 connect(_table, SIGNAL(itemSelectionChanged()),
129 this, SLOT(slotSelectionChanged()));
130 mainLayout->addWidget(_table);
131
132 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
133 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
134
135 _buttonGet = new QPushButton(tr("Get table"), this);
136 _buttonGet->setDefault(true);
137 connect(_buttonGet, SIGNAL(clicked()), this, SLOT(slotGetTable()));
138
139 _buttonCancel = new QPushButton(tr("Cancel"), this);
140 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
141
142 _buttonOK = new QPushButton(tr("OK"), this);
143 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
144
145 QHBoxLayout* buttonLayout = new QHBoxLayout;
146 buttonLayout->addWidget(_buttonWhatsThis);
147 buttonLayout->addStretch(1);
148 buttonLayout->addWidget(_buttonGet);
149 buttonLayout->addWidget(_buttonCancel);
150 buttonLayout->addWidget(_buttonOK);
151
152 mainLayout->addLayout(buttonLayout);
153}
154
155// Destructor
156////////////////////////////////////////////////////////////////////////////
157bncTableDlg::~bncTableDlg() {
158 delete _casterHostComboBox;
159 delete _casterPortLineEdit;
160 delete _casterUserLineEdit;
161 delete _casterPasswordLineEdit;
162 delete _ntripVersionComboBox;
163 delete _buttonGet;
164 delete _buttonCancel;
165 delete _buttonOK;
166 delete _buttonWhatsThis;
167 delete _buttonCasterTable;
168 delete _table;
169}
170
171// Read Table the caster (static)
172////////////////////////////////////////////////////////////////////////////
173t_irc bncTableDlg::getFullTable(const QString& casterHost,
174 int casterPort, QStringList& allLines,
175 bool alwaysRead) {
176
177 static QMutex mutex;
178 static QMap<QString, QStringList> allTables;
179
180 QMutexLocker locker(&mutex);
181
182 if (!alwaysRead && allTables.find(casterHost) != allTables.end()) {
183 allLines = allTables.find(casterHost).value();
184 return success;
185 }
186
187 allLines.clear();
188
189 QUrl url;
190 url.setHost(casterHost);
191 url.setPort(casterPort);
192 url.setScheme("http");
193 url.setPath("/");
194
195 bncNetQueryV2 query;
196 QByteArray outData;
197 query.waitForRequestResult(url, outData);
198 if (query.status() == bncNetQuery::finished) {
199 QTextStream in(outData);
200 QString line = in.readLine();
201 while ( !line.isNull() ) {
202 allLines.append(line);
203 line = in.readLine();
204 }
205 allTables.insert(casterHost, allLines);
206 return success;
207 }
208 else {
209 return failure;
210 }
211}
212
213// Read Table from Caster
214////////////////////////////////////////////////////////////////////////////
215void bncTableDlg::slotGetTable() {
216
217 _buttonGet->setEnabled(false);
218 _buttonCasterTable->setEnabled(false);
219
220 _allLines.clear();
221
222 if ( getFullTable(_casterHostComboBox->currentText(),
223 _casterPortLineEdit->text().toInt(),
224 _allLines) != success ) {
225 QMessageBox::warning(0, "BNC", "Cannot retrieve table of data");
226 _buttonGet->setEnabled(true);
227 return;
228 }
229
230 QStringList lines;
231 QStringListIterator it(_allLines);
232 int endSourceTable = 1;
233 while (it.hasNext()) {
234 QString line = it.next();
235 if ((endSourceTable == 1 ) && line.indexOf("ENDSOURCETABLE") == 0) {
236 endSourceTable = 0;
237 }
238 if (line.indexOf("STR") == 0) {
239 lines.push_back(line);
240 }
241 }
242
243 static const QStringList labels = QString("mountpoint,identifier,format,"
244 "format-details,carrier,system,network,country,lat,long,"
245 "nmea,solution,generator,compress.,auth.,fee,bitrate,"
246 "misc").split(",");
247
248 if (lines.size() > 0) {
249 _table->setSelectionMode(QAbstractItemView::ExtendedSelection);
250 _table->setSelectionBehavior(QAbstractItemView::SelectRows);
251
252 QStringList hlp = lines[0].split(";");
253 _table->setColumnCount(hlp.size()-1);
254 _table->setRowCount(lines.size() - endSourceTable);
255
256 QListIterator<QString> it(lines);
257 int nRow = -1;
258 while (it.hasNext()) {
259 QStringList columns = it.next().split(";");
260 ++nRow;
261 for (int ic = 0; ic < columns.size()-1; ic++) {
262
263 if (ic+1 == 11) { if (columns[ic+1] == "0") { columns[ic+1] = "no"; } else { columns[ic+1] = "yes"; }}
264
265 QTableWidgetItem* it = new QTableWidgetItem(columns[ic+1]);
266 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
267 _table->setItem(nRow, ic, it);
268 }
269 }
270 _table->sortItems(0);
271 _table->setHorizontalHeaderLabels(labels);
272 _table->setSortingEnabled(true);
273
274 int ww = QFontMetrics(this->font()).width('w');
275 _table->horizontalHeader()->resizeSection(0,10*ww);
276 _table->horizontalHeader()->resizeSection(1,10*ww);
277 _table->horizontalHeader()->resizeSection(2,8*ww);
278 _table->horizontalHeader()->resizeSection(3,22*ww);
279 _table->horizontalHeader()->resizeSection(4,5*ww);
280 _table->horizontalHeader()->resizeSection(5,8*ww);
281 _table->horizontalHeader()->resizeSection(6,8*ww);
282 _table->horizontalHeader()->resizeSection(7,7*ww);
283 _table->horizontalHeader()->resizeSection(8,6*ww);
284 _table->horizontalHeader()->resizeSection(9,6*ww);
285 _table->horizontalHeader()->resizeSection(10,6*ww);
286 _table->horizontalHeader()->resizeSection(11,6*ww);
287 _table->horizontalHeader()->resizeSection(12,15*ww);
288 _table->horizontalHeader()->resizeSection(13,8*ww);
289 _table->horizontalHeader()->resizeSection(14,5*ww);
290 _table->horizontalHeader()->resizeSection(15,5*ww);
291 _table->horizontalHeader()->resizeSection(16,7*ww);
292 _table->horizontalHeader()->resizeSection(17,15*ww);
293 }
294}
295
296// Accept slot
297////////////////////////////////////////////////////////////////////////////
298void bncTableDlg::accept() {
299
300 QSettings settings;
301 settings.setValue("ntripVersion", _ntripVersionComboBox->currentText());
302 QUrl url;
303 url.setScheme("http");
304 url.setHost(_casterHostComboBox->currentText());
305 url.setPort(_casterPortLineEdit->text().toInt());
306 url.setUserName(_casterUserLineEdit->text());
307 url.setPassword(_casterPasswordLineEdit->text());
308 addUrl(url);
309
310 QStringList* mountPoints = new QStringList;
311
312 if (_table) {
313 for (int ir = 0; ir < _table->rowCount(); ir++) {
314 QTableWidgetItem* item = _table->item(ir,0);
315 QString format = _table->item(ir,2)->text();
316 QString latitude = _table->item(ir,8)->text();
317 QString longitude = _table->item(ir,9)->text();
318 QString nmea = _table->item(ir,10)->text();
319 QString ntripVersion = _ntripVersionComboBox->currentText();
320 format.replace(" ", "_");
321 if (_table->isItemSelected(item)) {
322 url.setPath(item->text());
323 mountPoints->push_back(url.toString() + " " + format + " " + latitude
324 + " " + longitude + " " + nmea + " " + ntripVersion);
325 }
326 }
327 }
328 emit newMountPoints(mountPoints);
329
330 QDialog::accept();
331}
332
333// User changed the selection of mountPoints
334////////////////////////////////////////////////////////////////////////////
335void bncTableDlg::slotSelectionChanged() {
336 if (_table->selectedItems().isEmpty()) {
337 }
338}
339
340// Whats This Help
341void bncTableDlg::slotWhatsThis() {
342QWhatsThis::enterWhatsThisMode();
343}
344
345// Slot caster table
346////////////////////////////////////////////////////////////////////////////
347void bncTableDlg::slotCasterTable() {
348
349 _buttonCasterTable->setEnabled(false);
350 _casterHostComboBox->setEnabled(false);
351 _casterPortLineEdit->setEnabled(false);
352 _casterUserLineEdit->setEnabled(false);
353 _casterPasswordLineEdit->setEnabled(false);
354 _ntripVersionComboBox->setEnabled(false);
355 _buttonWhatsThis->setEnabled(false);
356 _buttonGet->setEnabled(false);
357 _buttonCancel->setEnabled(false);
358 _buttonOK->setEnabled(false);
359
360 bncCasterTableDlg* dlg = new bncCasterTableDlg(this);
361 dlg->move(this->pos().x()+50, this->pos().y()+50);
362 connect(dlg, SIGNAL(newCaster(QString, QString)),
363 this, SLOT(slotNewCaster(QString, QString)));
364 dlg->exec();
365 delete dlg;
366
367 _buttonCasterTable->setEnabled(true);
368 _casterHostComboBox->setEnabled(true);
369 _casterPortLineEdit->setEnabled(true);
370 _casterUserLineEdit->setEnabled(true);
371 _casterPasswordLineEdit->setEnabled(true);
372 _ntripVersionComboBox->setEnabled(true);
373 _buttonWhatsThis->setEnabled(true);
374 _buttonGet->setEnabled(true);
375 _buttonCancel->setEnabled(true);
376 _buttonOK->setEnabled(true);
377
378}
379
380// Caster table
381////////////////////////////////////////////////////////////////////////////
382bncCasterTableDlg::bncCasterTableDlg(QWidget* parent) :
383 QDialog(parent) {
384
385 static const QStringList labels = QString("host,port,identifier,operator,nmea,country,lat,long,link").split(",");
386
387 QStringList lines;
388 lines.clear();
389 _casterTable = new QTableWidget(this);
390
391 QUrl url;
392 url.setHost("www.rtcm-ntrip.org");
393 url.setPort(2101);
394 url.setScheme("http");
395 url.setPath("/");
396
397 bncNetQueryV2 query;
398 QByteArray outData;
399 query.waitForRequestResult(url, outData);
400 int endSourceTable = 1;
401 if (query.status() == bncNetQuery::finished) {
402 QTextStream in(outData);
403 QString line = in.readLine();
404 while ( !line.isNull() ) {
405 line = in.readLine();
406 if ((endSourceTable == 1 ) && line.indexOf("ENDSOURCETABLE") == 0) {
407 endSourceTable = 0;
408 }
409 if (line.indexOf("CAS") == 0) {
410 lines.append(line);
411 }
412 }
413 }
414 if (lines.size() > 0) {
415 _casterTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
416 _casterTable->setSelectionBehavior(QAbstractItemView::SelectRows);
417
418 QStringList hlp = lines[0].split(";");
419 _casterTable->setColumnCount(hlp.size()-1);
420 _casterTable->setRowCount(lines.size() - endSourceTable);
421
422 QListIterator<QString> it(lines);
423 int nRow = -1;
424 while (it.hasNext()) {
425 QStringList columns = it.next().split(";");
426 ++nRow;
427 for (int ic = 0; ic < columns.size()-1; ic++) {
428 if (ic+1 == 5) { if (columns[ic+1] == "0") { columns[ic+1] = "no"; } else { columns[ic+1] = "yes"; }}
429 QTableWidgetItem* it = new QTableWidgetItem(columns[ic+1]);
430 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
431 _casterTable->setItem(nRow, ic, it);
432 }
433 }
434 }
435 _casterTable->sortItems(0);
436 _casterTable->setHorizontalHeaderLabels(labels);
437 _casterTable->setSortingEnabled(true);
438
439 int ww = QFontMetrics(this->font()).width('w');
440 _casterTable->horizontalHeader()->resizeSection(0,15*ww);
441 _casterTable->horizontalHeader()->resizeSection(1,5*ww);
442 _casterTable->horizontalHeader()->resizeSection(2,15*ww);
443 _casterTable->horizontalHeader()->resizeSection(3,15*ww);
444 _casterTable->horizontalHeader()->resizeSection(4,5*ww);
445 _casterTable->horizontalHeader()->resizeSection(5,7*ww);
446 _casterTable->horizontalHeader()->resizeSection(6,7*ww);
447 _casterTable->horizontalHeader()->resizeSection(7,7*ww);
448 _casterTable->horizontalHeader()->resizeSection(8,15*ww);
449
450 ww = QFontMetrics(font()).width('w');
451
452 _closeButton = new QPushButton("Cancel");
453 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
454 _closeButton->setMinimumWidth(8*ww);
455 _closeButton->setMaximumWidth(8*ww);
456
457 _okButton = new QPushButton(tr("OK"), this);
458 connect(_okButton, SIGNAL(clicked()), this, SLOT(slotAcceptCasterTable()));
459 _okButton->setMinimumWidth(8*ww);
460 _okButton->setMaximumWidth(8*ww);
461
462 _whatsThisButton = new QPushButton(tr("Help=Shift+F1"), this);
463 connect(_whatsThisButton, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
464 _whatsThisButton->setMinimumWidth(12*ww);
465 _whatsThisButton->setMaximumWidth(12*ww);
466
467 _casterTable->setWhatsThis(tr("<p>Select an NTRIP broadcaster and hit 'OK'.</p><p>See <u>http://www.rtcm-ntrip.org/home</u> for further details on known NTRIP broadcaster installations.</u>."));
468
469 QGridLayout* dlgLayout = new QGridLayout();
470 dlgLayout->addWidget(new QLabel(" List of NTRIP Broadcasters from www.rtcm-ntrip.org"), 0,0,1,3,Qt::AlignLeft);
471 dlgLayout->addWidget(_casterTable, 1, 0, 1, 3);
472 dlgLayout->addWidget(_whatsThisButton, 2, 0);
473 dlgLayout->addWidget(_closeButton, 2, 1, Qt::AlignRight);
474 dlgLayout->addWidget(_okButton, 2, 2);
475
476 setMinimumSize(600,400);
477 setWindowTitle(tr("Select Broadcaster"));
478 setLayout(dlgLayout);
479 resize(68*ww, 60*ww);
480 show();
481}
482
483// Caster table destructor
484////////////////////////////////////////////////////////////////////////////
485bncCasterTableDlg::~bncCasterTableDlg() {
486 delete _casterTable;
487 delete _okButton;
488 delete _closeButton;
489 delete _whatsThisButton;
490}
491
492// Caster table what's this
493////////////////////////////////////////////////////////////////////////////
494void bncCasterTableDlg:: slotWhatsThis() {
495 QWhatsThis::enterWhatsThisMode();
496}
497
498// Accept caster table
499////////////////////////////////////////////////////////////////////////////
500void bncCasterTableDlg::slotAcceptCasterTable() {
501 if (_casterTable) {
502 for (int ir = _casterTable->rowCount() - 1; ir >= 0 ; ir--) {
503 if (_casterTable->isItemSelected(_casterTable->item(ir,0))) {
504 emit newCaster(_casterTable->item(ir,0)->text(),
505 _casterTable->item(ir,1)->text());
506 }
507 }
508 }
509 QDialog::accept();
510}
511
512// New caster selected
513////////////////////////////////////////////////////////////////////////////
514void bncTableDlg::slotNewCaster(QString newCasterHost, QString newCasterPort) {
515
516 _casterHostComboBox->insertItem(0, newCasterHost);
517 _casterHostComboBox->setCurrentIndex(0);
518 _casterUserLineEdit->setText("");
519 _casterPortLineEdit->setText(newCasterPort);
520
521 QUrl url;
522 url.setScheme("http");
523 url.setHost(newCasterHost);
524 url.setPort(newCasterPort.toInt());
525 addUrl(url);
526
527 _casterHostComboBox->setCurrentIndex(0);
528}
529
530// New caster selected
531////////////////////////////////////////////////////////////////////////////
532void bncTableDlg::addUrl(const QUrl& url) {
533 QSettings settings;
534 QStringList oldUrlList = settings.value("casterUrlList").toStringList();
535 QStringList newUrlList;
536 newUrlList << url.toString();
537 for (int ii = 0; ii < oldUrlList.count(); ii++) {
538 QUrl oldUrl(oldUrlList[ii]);
539 if (url.host() != oldUrl.host()) {
540 newUrlList << oldUrl.toString();
541 }
542 }
543 settings.setValue("casterUrlList", newUrlList);
544 settings.sync();
545}
546
547// New caster selected in combobox
548////////////////////////////////////////////////////////////////////////////
549void bncTableDlg::slotCasterHostChanged(const QString& newHost) {
550 QSettings settings;
551 QStringList casterUrlList = settings.value("casterUrlList").toStringList();
552 for (int ii = 0; ii < casterUrlList.count(); ii++) {
553 QUrl url(casterUrlList[ii]);
554 if (url.host() == newHost) {
555 _casterUserLineEdit->setText(url.userName());
556 _casterPasswordLineEdit->setText(url.password());
557 if (url.port() > 0) {
558 _casterPortLineEdit->setText(QString("%1").arg(url.port()));
559 }
560 else {
561 _casterPortLineEdit->setText("");
562 }
563 }
564 }
565}
Note: See TracBrowser for help on using the repository browser.