Changeset 191 in ntrip
- Timestamp:
- Sep 24, 2006, 6:49:47 PM (18 years ago)
- Location:
- trunk/BNC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bnccaster.cpp
r188 r191 72 72 thread->terminate(); 73 73 thread->wait(); 74 delete thread;74 //// delete thread; 75 75 } 76 76 delete _out; -
trunk/BNC/bnctabledlg.cpp
r136 r191 84 84 } 85 85 86 // Read Table from Caster 87 //////////////////////////////////////////////////////////////////////////// 88 void bncTableDlg::slotGetTable() { 86 // Read Table the caster (static) 87 //////////////////////////////////////////////////////////////////////////// 88 t_irc bncTableDlg::getFullTable(const QString& casterHost, 89 int casterPort, QStringList& allLines) { 90 91 allLines.clear(); 89 92 90 93 QUrl url; 91 url.setHost( _casterHostLineEdit->text());92 url.setPort( _casterPortLineEdit->text().toInt());94 url.setHost(casterHost); 95 url.setPort(casterPort); 93 96 94 97 // Send the Request … … 99 102 100 103 if (!socket) { 101 QMessageBox::warning(0, "BNC", msg); 102 return; 104 return failure; 103 105 } 104 106 105 107 // Read Caster Response 106 108 // -------------------- 107 QStringList allLines;108 109 bool first = true; 109 110 while (true) { 110 111 if (socket->canReadLine()) { 111 112 QString line = socket->readLine(); 113 allLines.push_back(line); 112 114 if (first) { 113 115 first = false; 114 116 if (line.indexOf("SOURCETABLE 200 OK") != 0) { 115 QMessageBox::warning(0, "BNC", "Wrong Caster Response:\n" + line);116 117 break; 117 118 } … … 121 122 break; 122 123 } 123 if (line.indexOf("STR") == 0) {124 allLines.push_back(line);125 }126 124 } 127 125 } … … 132 130 } 133 131 else { 134 QMessageBox::warning(0, "BNC", "Data Timeout");135 132 break; 136 133 } … … 138 135 } 139 136 delete socket; 137 138 return success; 139 } 140 141 // Read Table from Caster 142 //////////////////////////////////////////////////////////////////////////// 143 void bncTableDlg::slotGetTable() { 144 145 QStringList allLines; 146 147 if ( getFullTable(_casterHostLineEdit->text(), 148 _casterPortLineEdit->text().toInt(), 149 allLines) != success ) { 150 QMessageBox::warning(0, "BNC", "Cannot retrieve table of data"); 151 return; 152 } 153 154 QStringList lines; 155 QStringListIterator it(allLines); 156 while (it.hasNext()) { 157 QString line = it.next(); 158 if (line.indexOf("STR") == 0) { 159 lines.push_back(line); 160 } 161 } 140 162 141 163 static const QStringList labels = QString("mountpoint,identifier,format," … … 144 166 "misc").split(","); 145 167 146 if ( allLines.size() > 0) {168 if (lines.size() > 0) { 147 169 _table->setSelectionMode(QAbstractItemView::ExtendedSelection); 148 170 _table->setSelectionBehavior(QAbstractItemView::SelectRows); 149 171 150 QStringList hlp = allLines[0].split(";");172 QStringList hlp = lines[0].split(";"); 151 173 _table->setColumnCount(hlp.size()-1); 152 _table->setRowCount( allLines.size());153 154 QListIterator<QString> it( allLines);174 _table->setRowCount(lines.size()); 175 176 QListIterator<QString> it(lines); 155 177 int nRow = -1; 156 178 while (it.hasNext()) { -
trunk/BNC/bnctabledlg.h
r105 r191 3 3 #define BNCTABLEDLG_H 4 4 5 #include <QtCore> 5 6 #include <QtGui> 7 8 #include "bncconst.h" 6 9 7 10 class bncTableDlg : public QDialog { … … 11 14 bncTableDlg(QWidget* parent); 12 15 ~bncTableDlg(); 16 static t_irc getFullTable(const QString& casterHost, int casterPort, 17 QStringList& allLines); 13 18 14 19 signals: 15 20 void newMountPoints(QStringList* mountPoints); 16 21 17 22 private slots: 18 23 virtual void accept();
Note:
See TracChangeset
for help on using the changeset viewer.