Changeset 191 in ntrip


Ignore:
Timestamp:
Sep 24, 2006, 6:49:47 PM (18 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnccaster.cpp

    r188 r191  
    7272    thread->terminate();
    7373    thread->wait();
    74     delete thread;
     74    ////    delete thread;
    7575  }
    7676  delete _out;
  • trunk/BNC/bnctabledlg.cpp

    r136 r191  
    8484}
    8585
    86 // Read Table from Caster
    87 ////////////////////////////////////////////////////////////////////////////
    88 void bncTableDlg::slotGetTable() {
     86// Read Table the caster (static)
     87////////////////////////////////////////////////////////////////////////////
     88t_irc bncTableDlg::getFullTable(const QString& casterHost,
     89                                int casterPort, QStringList& allLines) {
     90
     91  allLines.clear();
    8992
    9093  QUrl url;
    91   url.setHost(_casterHostLineEdit->text());
    92   url.setPort(_casterPortLineEdit->text().toInt());
     94  url.setHost(casterHost);
     95  url.setPort(casterPort);
    9396
    9497  // Send the Request
     
    99102
    100103  if (!socket) {
    101     QMessageBox::warning(0, "BNC", msg);
    102     return;
     104    return failure;
    103105  }
    104106
    105107  // Read Caster Response
    106108  // --------------------
    107   QStringList allLines;
    108109  bool first = true;
    109110  while (true) {
    110111    if (socket->canReadLine()) {
    111112      QString line = socket->readLine();
     113      allLines.push_back(line);
    112114      if (first) {
    113115        first = false;
    114116        if (line.indexOf("SOURCETABLE 200 OK") != 0) {
    115           QMessageBox::warning(0, "BNC", "Wrong Caster Response:\n" + line);
    116117          break;
    117118        }
     
    121122          break;
    122123        }
    123         if (line.indexOf("STR") == 0) {
    124           allLines.push_back(line);
    125         }
    126124      }
    127125    }
     
    132130      }
    133131      else {
    134         QMessageBox::warning(0, "BNC", "Data Timeout");
    135132        break;
    136133      }
     
    138135  }
    139136  delete socket;
     137
     138  return success;
     139}
     140
     141// Read Table from Caster
     142////////////////////////////////////////////////////////////////////////////
     143void 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  }
    140162
    141163  static const QStringList labels = QString("mountpoint,identifier,format,"
     
    144166    "misc").split(",");
    145167
    146   if (allLines.size() > 0) {
     168  if (lines.size() > 0) {
    147169    _table->setSelectionMode(QAbstractItemView::ExtendedSelection);
    148170    _table->setSelectionBehavior(QAbstractItemView::SelectRows);
    149171
    150     QStringList hlp = allLines[0].split(";");
     172    QStringList hlp = lines[0].split(";");
    151173    _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);
    155177    int nRow = -1;
    156178    while (it.hasNext()) {
  • trunk/BNC/bnctabledlg.h

    r105 r191  
    33#define BNCTABLEDLG_H
    44
     5#include <QtCore>
    56#include <QtGui>
     7
     8#include "bncconst.h"
    69
    710class bncTableDlg : public QDialog {
     
    1114    bncTableDlg(QWidget* parent);
    1215    ~bncTableDlg();
     16    static t_irc getFullTable(const QString& casterHost, int casterPort,
     17                              QStringList& allLines);
    1318
    1419  signals:
    1520    void newMountPoints(QStringList* mountPoints);
    16  
     21
    1722  private slots:
    1823    virtual void accept();
Note: See TracChangeset for help on using the changeset viewer.