- Timestamp:
- Nov 11, 2009, 7:57:09 PM (15 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncwindow.cpp
r1926 r1927 62 62 QListIterator<QString> it(settings.value("mountPoints").toStringList()); 63 63 while (it.hasNext()) { 64 QStringList hlp = it.next().split(" "); 65 QUrl url(hlp[0]); 66 _MPName.append(url.path().toAscii()); _bytesMP.append(0);67 }68 connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));69 _timer.start(1000);64 QStringList hlp = it.next().split(" "); 65 QUrl url(hlp[0]); 66 QByteArray staID = url.path().mid(1).toAscii(); 67 _bytes[staID] = 0.0; 68 } 69 slotNextAnimationFrame(); 70 70 } 71 71 … … 73 73 //////////////////////////////////////////////////////////////////////////// 74 74 FWidget::~FWidget() { 75 _timer.stop();76 75 } 77 76 78 77 // 79 78 //////////////////////////////////////////////////////////////////////////// 80 void FWidget::slotNextAnimationFrame(const QByteArray staID, double nbyte) { 81 _timer.stop(); 79 void FWidget::slotNewData(const QByteArray staID, double nbyte) { 82 80 cout << staID.data() << " " << nbyte << endl; 81 } 82 83 // 84 //////////////////////////////////////////////////////////////////////////// 85 void FWidget::slotNextAnimationFrame() { 83 86 update(); 84 _timer.start(1000);87 QTimer::singleShot(1000, this, SLOT(slotNextAnimationFrame())); 85 88 } 86 89 … … 107 110 textP.setX(300); 108 111 109 Q ListIterator<QByteArray> it(_MPName);112 QMapIterator<QByteArray, double> it(_bytes); 110 113 while (it.hasNext()) { 111 QByteArray hlp=it.next(); 112 double bytesnew=_bytesMP[_MPName.lastIndexOf(hlp)]; 113 double vv = bytesnew/30; 114 it.next(); 115 QByteArray staID = it.key(); 116 double bytesnew = it.value(); 117 double vv = bytesnew/30; 114 118 QRectF vrect((100+anker*40), (140-vv), (30), (vv)); 115 119 QBrush xBrush(Qt::green,Qt::SolidPattern); … … 117 121 painter.fillRect(vrect,xBrush); 118 122 painter.drawRect(vrect); 119 painter.drawText(textP, hlp);123 painter.drawText(textP, staID); 120 124 anker++; 121 125 } … … 1305 1309 ((bncTableItem*) _mountPointsTable->item(iRow, 7))->setGetThread(thread); 1306 1310 connect(thread, SIGNAL(newBytes(QByteArray, double)), 1307 _Figure1, SLOT(slotNe xtAnimationFrame(QByteArray, double)));1311 _Figure1, SLOT(slotNewData(QByteArray, double))); 1308 1312 1309 1313 break; -
trunk/BNC/bncwindow.h
r1926 r1927 38 38 ~FWidget(); 39 39 public slots: 40 void slotNe xtAnimationFrame(const QByteArray staID, double nbyte);40 void slotNewData(const QByteArray staID, double nbyte); 41 41 protected: 42 42 void paintEvent(QPaintEvent *event); 43 private slots: 44 void slotNextAnimationFrame(); 43 45 private: 44 QList<QByteArray> _MPName; 45 QList<double> _bytesMP; 46 QTimer _timer; 46 QMap<QByteArray, double> _bytes; 47 47 }; 48 48
Note:
See TracChangeset
for help on using the changeset viewer.