Changeset 1178 in ntrip


Ignore:
Timestamp:
Oct 27, 2008, 5:54:25 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnccaster.cpp

    r1177 r1178  
    193193
    194194  getThread->start();
    195 
    196   emit newGetThread(getThread);
    197195}
    198196
     
    387385
    388386    if (!existFlg) {
    389       emit deleteGetThread(thread);
    390387      disconnect(thread, 0, 0, 0);
    391388      _staIDs.removeAll(thread->staID());
     
    397394  }
    398395
     396  emit mountPointsRead();
    399397  emit( newMessage(QString("Table of Mountpoints (re-)read: new number = %1")
    400398                            .arg(_threads.count()).toAscii()) );
  • trunk/BNC/bnccaster.h

    r1177 r1178  
    4848
    4949 signals:
    50    void newGetThread(bncGetThread* thread);
    51    void deleteGetThread(bncGetThread* thread);
     50   void mountPointsRead();
    5251   void getThreadErrors();   
    5352   void newMessage(QByteArray msg);
  • trunk/BNC/bncwindow.cpp

    r1177 r1178  
    249249  _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
    250250  _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    251   QListIterator<QString> it(settings.value("mountPoints").toStringList());
    252   if (!it.hasNext()) {
    253     _actGetData->setEnabled(false);
    254   }
    255   int iRow = 0;
    256   while (it.hasNext()) {
    257     QStringList hlp = it.next().split(" ");
    258     if (hlp.size() < 5) continue;
    259     _mountPointsTable->insertRow(iRow);
    260 
    261     QUrl    url(hlp[0]);
    262 
    263     QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
    264     QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
    265     QString nmea(hlp[4]);
    266 
    267     QTableWidgetItem* it;
    268     it = new QTableWidgetItem(url.userInfo());
    269     it->setFlags(it->flags() & ~Qt::ItemIsEditable);
    270     _mountPointsTable->setItem(iRow, 0, it);
    271 
    272     it = new QTableWidgetItem(fullPath);
    273     it->setFlags(it->flags() & ~Qt::ItemIsEditable);
    274     _mountPointsTable->setItem(iRow, 1, it);
    275 
    276     it = new QTableWidgetItem(format);
    277     _mountPointsTable->setItem(iRow, 2, it);
    278 
    279     if      (nmea == "yes") {
    280     it = new QTableWidgetItem(latitude);
    281     _mountPointsTable->setItem(iRow, 3, it);
    282     it = new QTableWidgetItem(longitude);
    283     _mountPointsTable->setItem(iRow, 4, it);
    284     } else {
    285     it = new QTableWidgetItem(latitude);
    286     it->setFlags(it->flags() & ~Qt::ItemIsEditable);
    287     _mountPointsTable->setItem(iRow, 3, it);
    288     it = new QTableWidgetItem(longitude);
    289     it->setFlags(it->flags() & ~Qt::ItemIsEditable);
    290     _mountPointsTable->setItem(iRow, 4, it);
    291     }
    292 
    293     it = new QTableWidgetItem(nmea);
    294     it->setFlags(it->flags() & ~Qt::ItemIsEditable);
    295     _mountPointsTable->setItem(iRow, 5, it);
    296 
    297     bncTableItem* bncIt = new bncTableItem();
    298     bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
    299     _mountPointsTable->setItem(iRow, 6, bncIt);
    300 
    301     iRow++;
    302   }
    303251  _mountPointsTable->hideColumn(0);
    304   _mountPointsTable->sortItems(1);
    305 
    306252  connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
    307253          SLOT(slotSelectionChanged()));
     254  populateMountPointsTable();
    308255
    309256  _log = new QTextBrowser();
     
    493440bncWindow::~bncWindow() {
    494441  delete _caster;
     442}
     443
     444//
     445////////////////////////////////////////////////////////////////////////////
     446void bncWindow::populateMountPointsTable() {
     447
     448  for (int iRow = _mountPointsTable->rowCount()-1; iRow >=0; iRow--) {
     449    _mountPointsTable->removeRow(iRow);
     450  }
     451
     452  QSettings settings;
     453
     454  QListIterator<QString> it(settings.value("mountPoints").toStringList());
     455  if (!it.hasNext()) {
     456    _actGetData->setEnabled(false);
     457  }
     458  int iRow = 0;
     459  while (it.hasNext()) {
     460    QStringList hlp = it.next().split(" ");
     461    if (hlp.size() < 5) continue;
     462    _mountPointsTable->insertRow(iRow);
     463
     464    QUrl    url(hlp[0]);
     465
     466    QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
     467    QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
     468    QString nmea(hlp[4]);
     469
     470    QTableWidgetItem* it;
     471    it = new QTableWidgetItem(url.userInfo());
     472    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
     473    _mountPointsTable->setItem(iRow, 0, it);
     474
     475    it = new QTableWidgetItem(fullPath);
     476    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
     477    _mountPointsTable->setItem(iRow, 1, it);
     478
     479    it = new QTableWidgetItem(format);
     480    _mountPointsTable->setItem(iRow, 2, it);
     481
     482    if      (nmea == "yes") {
     483    it = new QTableWidgetItem(latitude);
     484    _mountPointsTable->setItem(iRow, 3, it);
     485    it = new QTableWidgetItem(longitude);
     486    _mountPointsTable->setItem(iRow, 4, it);
     487    } else {
     488    it = new QTableWidgetItem(latitude);
     489    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
     490    _mountPointsTable->setItem(iRow, 3, it);
     491    it = new QTableWidgetItem(longitude);
     492    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
     493    _mountPointsTable->setItem(iRow, 4, it);
     494    }
     495
     496    it = new QTableWidgetItem(nmea);
     497    it->setFlags(it->flags() & ~Qt::ItemIsEditable);
     498    _mountPointsTable->setItem(iRow, 5, it);
     499
     500    bncTableItem* bncIt = new bncTableItem();
     501    bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
     502    _mountPointsTable->setItem(iRow, 6, bncIt);
     503
     504    iRow++;
     505  }
     506
     507  _mountPointsTable->sortItems(1);
    495508}
    496509
     
    683696          this, SLOT(slotGetThreadErrors()));
    684697
    685   connect (_caster, SIGNAL(newGetThread(bncGetThread*)),
    686            this, SLOT(slotNewGetThread(bncGetThread*)));
    687 
    688   connect (_caster, SIGNAL(deleteGetThread(bncGetThread*)),
    689            this, SLOT(slotDeleteGetThread(bncGetThread*)));
     698  connect (_caster, SIGNAL(mountPointsRead()),
     699           this, SLOT(slotMountPointsRead()));
    690700
    691701  _caster->slotReadMountpoints();
     
    792802//
    793803////////////////////////////////////////////////////////////////////////////
    794 void bncWindow::slotNewGetThread(bncGetThread* thread) {
    795   for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
    796     QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
    797               "@"  + _mountPointsTable->item(iRow, 1)->text() );
    798     if (url                                      == thread->mountPoint() &&
    799         _mountPointsTable->item(iRow, 3)->text() == thread->latitude()   &&
    800         _mountPointsTable->item(iRow, 4)->text() == thread->longitude() ) {
    801 
    802       connect(thread, SIGNAL(newBytes(QByteArray, double)),
    803               (bncTableItem*) _mountPointsTable->item(iRow, 6),
    804               SLOT(slotNewBytes(QByteArray, double)));
    805       break;
    806     }
    807   }
    808 }
    809 
    810 //
    811 ////////////////////////////////////////////////////////////////////////////
    812 void bncWindow::slotDeleteGetThread(bncGetThread* thread) {
     804void bncWindow::slotMountPointsRead() {
     805  populateMountPointsTable();
    813806}
    814807
  • trunk/BNC/bncwindow.h

    r1177 r1178  
    5858 
    5959  public slots: 
    60     void slotNewGetThread(bncGetThread* thread);
    61     void slotDeleteGetThread(bncGetThread* thread);
     60    void slotMountPointsRead();
    6261
    6362  private slots:
     
    8180
    8281  private:
     82    void populateMountPointsTable();
     83
    8384    QMenu*     _menuHlp;
    8485    QMenu*     _menuFile;
Note: See TracChangeset for help on using the changeset viewer.