Changeset 1493 in ntrip


Ignore:
Timestamp:
Jan 18, 2009, 11:06:24 AM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnctabledlg.cpp

    r1492 r1493  
    3939 * -----------------------------------------------------------------------*/
    4040
     41#include <iostream>
     42
    4143#include "bnctabledlg.h"
    4244#include "bncgetthread.h"
     
    169171}
    170172
    171 // Read Table the caster (static)
     173// Read full caster table (static)
    172174////////////////////////////////////////////////////////////////////////////
    173175t_irc bncTableDlg::getFullTable(const QString& casterHost,
     
    218220  _buttonCasterTable->setEnabled(false);
    219221
    220   _allLines.clear();
    221 
    222222  if ( getFullTable(_casterHostComboBox->currentText(),
    223223                    _casterPortLineEdit->text().toInt(),
    224                     _allLines) != success ) {
     224                    _allLines, true) != success ) {
    225225    QMessageBox::warning(0, "BNC", "Cannot retrieve table of data");
    226226    _buttonGet->setEnabled(true);
    227227    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     }
    241228  }
    242229
     
    246233    "misc").split(",");
    247234
     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
    248247  if (lines.size() > 0) {
    249248    _table->setSelectionMode(QAbstractItemView::ExtendedSelection);
    250249    _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    }
    271267    _table->setHorizontalHeaderLabels(labels);
    272268    _table->setSortingEnabled(true);
    273 
    274269    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);
    287282    _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);
    292287    _table->horizontalHeader()->resizeSection(17,15*ww);
     288    _table->sortItems(0);
    293289  }
    294290}
Note: See TracChangeset for help on using the changeset viewer.