Changeset 1912 in ntrip for trunk/BNC/bncwindow.cpp


Ignore:
Timestamp:
Nov 6, 2009, 5:07:43 PM (13 years ago)
Author:
weber
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncwindow.cpp

    r1905 r1912  
    5656using namespace std;
    5757
     58// Begin new Perlt
     59FWidget::FWidget(QWidget *parent)
     60    : QWidget(parent)
     61{
     62  bncSettings settings;
     63  QListIterator<QString> it(settings.value("mountPoints").toStringList());
     64  while (it.hasNext()) {
     65    QStringList hlp = it.next().split(" ");
     66    QUrl    url(hlp[0]);
     67    MPName.append(url.path().toAscii()); bytesMP.append(0);
     68    }
     69}
     70
     71FWidget::~FWidget() { };
     72
     73void FWidget::nextAnimationFrame(){update();}
     74
     75void FWidget::paintEvent(QPaintEvent *)
     76{
     77    QRectF rectangle(0, 0, 640, 180);
     78    QBrush rBrush(Qt::white,Qt::SolidPattern);
     79    QPainter painter(this);
     80    painter.fillRect(rectangle,rBrush);
     81    painter.drawRect(rectangle);
     82    QLine line(50, 140, 630, 140);
     83    painter.drawLine(line);
     84
     85    line.setLine(50, 105, 50, 10);
     86    painter.drawLine(line);
     87    line.setLine(50, 105, 400, 105);
     88    painter.drawLine(line);
     89
     90    QPoint textP(40, 140);
     91    painter.drawText(textP, tr("0"));
     92    textP.setX(20);
     93    textP.setY(25);
     94    painter.drawText(textP, tr("3000"));
     95    textP.setX(20);
     96    textP.setY(40);
     97    painter.drawText(textP, tr("bps"));
     98
     99    textP.setX(410);
     100    textP.setY(105);
     101    painter.drawText(textP, tr("Mountpoints"));
     102
     103    int anker=0;
     104    textP.setY(160);
     105    painter.drawText(textP, tr(QTime::currentTime().toString().toAscii()));
     106    textP.setX(300);
     107
     108//  QString hlp = (QString("%1").arg(MPName.size()));
     109//  if (MPName.isEmpty()) {painter.drawText(textP, tr("Empty"));} else {painter.drawText(textP, tr(hlp.toAscii()));}
     110
     111    QListIterator<QByteArray> it(MPName);
     112    while (it.hasNext()) {
     113    QByteArray hlp=it.next();
     114    double bytesnew=bytesMP[MPName.lastIndexOf(hlp)];
     115    double vv = bytesnew/30;
     116      QRectF vrect((100+anker*40), (140-vv), (30), (vv));
     117      QBrush xBrush(Qt::green,Qt::SolidPattern);
     118      textP.setX(100+anker*40);
     119      painter.fillRect(vrect,xBrush);
     120      painter.drawRect(vrect);
     121      painter.drawText(textP, hlp);
     122      anker++;
     123    }
     124}
     125// End new Perlt
     126
    58127// Constructor
    59128////////////////////////////////////////////////////////////////////////////
     
    61130
    62131  _caster = 0;
     132
     133// Begin new Perlt
     134  // Figure
     135  _Figure1 = new FWidget(this);
     136// End new Perlt
    63137
    64138  int ww = QFontMetrics(this->font()).width('w');
     
    390464  aogroup->addTab(rgroup,tr("Miscellaneous"));
    391465
     466// Begin new Perlt
     467
     468  loggroup = new QTabWidget();
     469  QWidget* log1group = new QWidget();
     470  QWidget* log2group = new QWidget();
     471  loggroup->addTab(log1group,tr("Log"));
     472  loggroup->addTab(log2group,tr("Status"));
     473
     474  // log Tab
     475  // -------
     476  QGridLayout* log1Layout = new QGridLayout;
     477  log1Layout->addWidget(_log,                0,0);
     478  log1group->setLayout(log1Layout);
     479
     480  // Status Tab
     481  // ----------
     482  QGridLayout* log2Layout = new QGridLayout;
     483  log2Layout->addWidget(_Figure1,            0,0);
     484  log2group->setLayout(log2Layout);
     485
     486// End new Perlt
     487
    392488  // Proxy Tab
    393489  // ---------
     
    708804  mLayout->addWidget(aogroup,             0,0);
    709805  mLayout->addWidget(_mountPointsTable,   1,0);
    710   mLayout->addWidget(new QLabel(" Logs:"),2,0);
    711   mLayout->addWidget(_log,                3,0);
     806
     807// Begin new Perlt
     808//  mLayout->addWidget(new QLabel(" Logs:"),2,0);
     809//  mLayout->addWidget(_log,                3,0);
     810  QTimer *timer = new QTimer(this);
     811  connect(timer, SIGNAL(timeout()), _Figure1, SLOT(nextAnimationFrame()));
     812  mLayout->addWidget(loggroup,            2,0);
     813  timer->start(100);
     814
     815// End new Perlt
    712816
    713817  _canvas->setLayout(mLayout);
     
    13281432  QColor lightGray(230, 230, 230);
    13291433  QColor white(255, 255, 255);
     1434
    13301435
    13311436  // Proxy
     
    15351640  }
    15361641}
     1642
Note: See TracChangeset for help on using the changeset viewer.