mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
SpeedPlotView: Simplify code using PointData struct
This commit is contained in:
@@ -138,17 +138,20 @@ void SpeedWidget::update()
|
||||
|
||||
BitTorrent::SessionStatus btStatus = BitTorrent::Session::instance()->status();
|
||||
|
||||
m_plot->pushXPoint(QDateTime::currentDateTime().toTime_t());
|
||||
m_plot->pushYPoint(SpeedPlotView::UP, btStatus.uploadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::DOWN, btStatus.downloadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::PAYLOAD_UP, btStatus.payloadUploadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::PAYLOAD_DOWN, btStatus.payloadDownloadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::OVERHEAD_UP, btStatus.ipOverheadUploadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::OVERHEAD_DOWN, btStatus.ipOverheadDownloadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::DHT_UP, btStatus.dhtUploadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::DHT_DOWN, btStatus.dhtDownloadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::TRACKER_UP, btStatus.trackerUploadRate());
|
||||
m_plot->pushYPoint(SpeedPlotView::TRACKER_DOWN, btStatus.trackerDownloadRate());
|
||||
SpeedPlotView::PointData point;
|
||||
point.x = QDateTime::currentDateTime().toTime_t();
|
||||
point.y[SpeedPlotView::UP] = btStatus.uploadRate();
|
||||
point.y[SpeedPlotView::DOWN] = btStatus.downloadRate();
|
||||
point.y[SpeedPlotView::PAYLOAD_UP] = btStatus.payloadUploadRate();
|
||||
point.y[SpeedPlotView::PAYLOAD_DOWN] = btStatus.payloadDownloadRate();
|
||||
point.y[SpeedPlotView::OVERHEAD_UP] = btStatus.ipOverheadUploadRate();
|
||||
point.y[SpeedPlotView::OVERHEAD_DOWN] = btStatus.ipOverheadDownloadRate();
|
||||
point.y[SpeedPlotView::DHT_UP] = btStatus.dhtUploadRate();
|
||||
point.y[SpeedPlotView::DHT_DOWN] = btStatus.dhtDownloadRate();
|
||||
point.y[SpeedPlotView::TRACKER_UP] = btStatus.trackerUploadRate();
|
||||
point.y[SpeedPlotView::TRACKER_DOWN] = btStatus.trackerDownloadRate();
|
||||
|
||||
m_plot->pushPoint(point);
|
||||
|
||||
QMetaObject::invokeMethod(this, "graphUpdate", Qt::QueuedConnection);
|
||||
Utils::Misc::msleep(1000);
|
||||
|
||||
Reference in New Issue
Block a user