Changeset 1058 in ntrip for trunk/BNS/bnswindow.cpp


Ignore:
Timestamp:
Aug 27, 2008, 10:21:47 AM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bnswindow.cpp

    r1057 r1058  
    358358  _log->setWhatsThis(tr("Records of BNS's activities are shown in the Log section."));
    359359
     360  // Status
     361  // ------
     362  _status = new QWidget();
     363  QGridLayout* layout_status = new QGridLayout;
     364
     365  _statusLbl[0] = new QLabel("0 byte(s)"); _statusCnt[0] = 0;
     366  _statusLbl[1] = new QLabel("0 byte(s)"); _statusCnt[1] = 0;
     367  _statusLbl[2] = new QLabel("0 byte(s)"); _statusCnt[2] = 0;
     368  _statusLbl[3] = new QLabel("Input Ephemeris"); 
     369  _statusLbl[4] = new QLabel("Input Clock & Orbits");
     370  _statusLbl[5] = new QLabel("Output"); 
     371
     372  layout_status->addWidget(_statusLbl[3], 0, 0);
     373  layout_status->addWidget(_statusLbl[0], 0, 1);
     374  layout_status->addWidget(_statusLbl[4], 0, 2);
     375  layout_status->addWidget(_statusLbl[1], 0, 3);
     376  layout_status->addWidget(_statusLbl[5], 1, 2);
     377  layout_status->addWidget(_statusLbl[2], 1, 3);
     378  _status->setLayout(layout_status);
     379
    360380  // Main Layout
    361381  // -----------
     
    363383  mainLayout->addWidget(tabs);
    364384  mainLayout->addWidget(_log);
     385  mainLayout->addWidget(_status);
    365386
    366387  _canvas->setLayout(mainLayout);
     
    541562          this, SLOT(slotError(const QByteArray)));
    542563
     564  connect(_bns, SIGNAL(newEphBytes(int)), this, SLOT(slotEphBytes(int)));
     565  connect(_bns, SIGNAL(newClkBytes(int)), this, SLOT(slotClkBytes(int)));
     566  connect(_bns, SIGNAL(newOutBytes(int)), this, SLOT(slotOutBytes(int)));
     567
    543568  _bns->start();
    544569}
     570
     571// Input and output bytes statistics
     572////////////////////////////////////////////////////////////////////////////
     573void bnsWindow::slotEphBytes(int nBytes) {
     574  updateStatus(0, nBytes);
     575}
     576void bnsWindow::slotClkBytes(int nBytes) {
     577  updateStatus(1, nBytes);
     578}
     579void bnsWindow::slotOutBytes(int nBytes) {
     580  updateStatus(2, nBytes);
     581}
     582
     583void bnsWindow::updateStatus(int ii, int nBytes) {
     584  QMutexLocker locker(&_mutex);
     585
     586  _statusCnt[ii] += nBytes;
     587
     588  if      (_statusCnt[ii] < 1e3) {
     589    _statusLbl[ii]->setText(QString("%1 byte(s)").arg((int)_statusCnt[ii]));
     590  }
     591  else if (_statusCnt[ii] < 1e6) {
     592    _statusLbl[ii]->setText(QString("%1 kb").arg(_statusCnt[ii]/1.e3, 5));
     593  }
     594  else {
     595    _statusLbl[ii]->setText(QString("%1 Mb").arg(_statusCnt[ii]/1.e6, 5));
     596  }
     597}
Note: See TracChangeset for help on using the changeset viewer.