Changeset 1493 in ntrip
- Timestamp:
- Jan 18, 2009, 11:06:24 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bnctabledlg.cpp
r1492 r1493 39 39 * -----------------------------------------------------------------------*/ 40 40 41 #include <iostream> 42 41 43 #include "bnctabledlg.h" 42 44 #include "bncgetthread.h" … … 169 171 } 170 172 171 // Read Table the caster(static)173 // Read full caster table (static) 172 174 //////////////////////////////////////////////////////////////////////////// 173 175 t_irc bncTableDlg::getFullTable(const QString& casterHost, … … 218 220 _buttonCasterTable->setEnabled(false); 219 221 220 _allLines.clear();221 222 222 if ( getFullTable(_casterHostComboBox->currentText(), 223 223 _casterPortLineEdit->text().toInt(), 224 _allLines ) != success ) {224 _allLines, true) != success ) { 225 225 QMessageBox::warning(0, "BNC", "Cannot retrieve table of data"); 226 226 _buttonGet->setEnabled(true); 227 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 228 } 242 229 … … 246 233 "misc").split(","); 247 234 235 QStringList lines; 236 QStringListIterator it(_allLines); 237 while (it.hasNext()) { 238 QString line = it.next(); 239 if (line.indexOf("STR") == 0) { 240 QStringList hlp = line.split(";"); 241 if (hlp.size() > labels.size()) { 242 lines.push_back(line); 243 } 244 } 245 } 246 248 247 if (lines.size() > 0) { 249 248 _table->setSelectionMode(QAbstractItemView::ExtendedSelection); 250 249 _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); 250 _table->setColumnCount(labels.size()); 251 _table->setRowCount(lines.size()); 252 for (int nRow = 0; nRow < lines.size(); nRow++) { 253 QStringList columns = lines[nRow].split(";"); 254 for (int ic = 1; ic < columns.size(); ic++) { 255 if (ic == 11) { 256 if (columns[ic] == "0") { 257 columns[ic] = "no"; 258 } else { 259 columns[ic] = "yes"; 260 } 261 } 262 QTableWidgetItem* item = new QTableWidgetItem(columns[ic]); 263 item->setFlags(item->flags() & ~Qt::ItemIsEditable); 264 _table->setItem(nRow, ic-1, item); 265 } 266 } 271 267 _table->setHorizontalHeaderLabels(labels); 272 268 _table->setSortingEnabled(true); 273 274 269 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);270 _table->horizontalHeader()->resizeSection( 0,10*ww); 271 _table->horizontalHeader()->resizeSection( 1,10*ww); 272 _table->horizontalHeader()->resizeSection( 2, 8*ww); 273 _table->horizontalHeader()->resizeSection( 3,22*ww); 274 _table->horizontalHeader()->resizeSection( 4, 5*ww); 275 _table->horizontalHeader()->resizeSection( 5, 8*ww); 276 _table->horizontalHeader()->resizeSection( 6, 8*ww); 277 _table->horizontalHeader()->resizeSection( 7, 7*ww); 278 _table->horizontalHeader()->resizeSection( 8, 6*ww); 279 _table->horizontalHeader()->resizeSection( 9, 6*ww); 280 _table->horizontalHeader()->resizeSection(10, 6*ww); 281 _table->horizontalHeader()->resizeSection(11, 6*ww); 287 282 _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);283 _table->horizontalHeader()->resizeSection(13, 8*ww); 284 _table->horizontalHeader()->resizeSection(14, 5*ww); 285 _table->horizontalHeader()->resizeSection(15, 5*ww); 286 _table->horizontalHeader()->resizeSection(16, 7*ww); 292 287 _table->horizontalHeader()->resizeSection(17,15*ww); 288 _table->sortItems(0); 293 289 } 294 290 }
Note:
See TracChangeset
for help on using the changeset viewer.