|
|
@ -34,6 +34,7 @@ |
|
|
|
#include <QMenu> |
|
|
|
#include <QMenu> |
|
|
|
#include <QSignalMapper> |
|
|
|
#include <QSignalMapper> |
|
|
|
#include <QThread> |
|
|
|
#include <QThread> |
|
|
|
|
|
|
|
#include <QTimer> |
|
|
|
|
|
|
|
|
|
|
|
#include <libtorrent/session_status.hpp> |
|
|
|
#include <libtorrent/session_status.hpp> |
|
|
|
|
|
|
|
|
|
|
@ -116,8 +117,9 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent) |
|
|
|
|
|
|
|
|
|
|
|
loadSettings(); |
|
|
|
loadSettings(); |
|
|
|
|
|
|
|
|
|
|
|
m_isUpdating = true; |
|
|
|
QTimer *localUpdateTimer = new QTimer(this); |
|
|
|
m_updateFuture = QtConcurrent::run(this, &SpeedWidget::update); |
|
|
|
connect(localUpdateTimer, &QTimer::timeout, this, &SpeedWidget::update); |
|
|
|
|
|
|
|
localUpdateTimer->start(1000); |
|
|
|
|
|
|
|
|
|
|
|
m_plot->show(); |
|
|
|
m_plot->show(); |
|
|
|
} |
|
|
|
} |
|
|
@ -125,19 +127,12 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent) |
|
|
|
SpeedWidget::~SpeedWidget() |
|
|
|
SpeedWidget::~SpeedWidget() |
|
|
|
{ |
|
|
|
{ |
|
|
|
qDebug("SpeedWidget::~SpeedWidget() ENTER"); |
|
|
|
qDebug("SpeedWidget::~SpeedWidget() ENTER"); |
|
|
|
|
|
|
|
|
|
|
|
m_isUpdating = false; |
|
|
|
|
|
|
|
m_updateFuture.waitForFinished(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveSettings(); |
|
|
|
saveSettings(); |
|
|
|
|
|
|
|
|
|
|
|
qDebug("SpeedWidget::~SpeedWidget() EXIT"); |
|
|
|
qDebug("SpeedWidget::~SpeedWidget() EXIT"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SpeedWidget::update() |
|
|
|
void SpeedWidget::update() |
|
|
|
{ |
|
|
|
{ |
|
|
|
while (m_isUpdating) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const BitTorrent::SessionStatus &btStatus = BitTorrent::Session::instance()->status(); |
|
|
|
const BitTorrent::SessionStatus &btStatus = BitTorrent::Session::instance()->status(); |
|
|
|
|
|
|
|
|
|
|
|
SpeedPlotView::PointData point; |
|
|
|
SpeedPlotView::PointData point; |
|
|
@ -154,14 +149,6 @@ void SpeedWidget::update() |
|
|
|
point.y[SpeedPlotView::TRACKER_DOWN] = btStatus.trackerDownloadRate; |
|
|
|
point.y[SpeedPlotView::TRACKER_DOWN] = btStatus.trackerDownloadRate; |
|
|
|
|
|
|
|
|
|
|
|
m_plot->pushPoint(point); |
|
|
|
m_plot->pushPoint(point); |
|
|
|
|
|
|
|
|
|
|
|
QMetaObject::invokeMethod(this, "graphUpdate", Qt::QueuedConnection); |
|
|
|
|
|
|
|
QThread::msleep(1000); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SpeedWidget::graphUpdate() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_plot->replot(); |
|
|
|
m_plot->replot(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|