Changeset View
Changeset View
Standalone View
Standalone View
src/qt/clientmodel.cpp
Show All 10 Lines | |||||
#include <interfaces/node.h> | #include <interfaces/node.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <qt/bantablemodel.h> | #include <qt/bantablemodel.h> | ||||
#include <qt/guiconstants.h> | #include <qt/guiconstants.h> | ||||
#include <qt/guiutil.h> | #include <qt/guiutil.h> | ||||
#include <qt/peertablemodel.h> | #include <qt/peertablemodel.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/threadnames.h> | |||||
#include <validation.h> | #include <validation.h> | ||||
#include <QDebug> | #include <QDebug> | ||||
#include <QThread> | #include <QThread> | ||||
#include <QTimer> | #include <QTimer> | ||||
#include <cstdint> | #include <cstdint> | ||||
Show All 20 Lines | connect(timer, &QTimer::timeout, [this] { | ||||
Q_EMIT bytesChanged(m_node.getTotalBytesRecv(), | Q_EMIT bytesChanged(m_node.getTotalBytesRecv(), | ||||
m_node.getTotalBytesSent()); | m_node.getTotalBytesSent()); | ||||
}); | }); | ||||
connect(m_thread, &QThread::finished, timer, &QObject::deleteLater); | connect(m_thread, &QThread::finished, timer, &QObject::deleteLater); | ||||
connect(m_thread, &QThread::started, [timer] { timer->start(); }); | connect(m_thread, &QThread::started, [timer] { timer->start(); }); | ||||
// move timer to thread so that polling doesn't disturb main event loop | // move timer to thread so that polling doesn't disturb main event loop | ||||
timer->moveToThread(m_thread); | timer->moveToThread(m_thread); | ||||
m_thread->start(); | m_thread->start(); | ||||
QTimer::singleShot(0, timer, []() { util::ThreadRename("qt-clientmodl"); }); | |||||
subscribeToCoreSignals(); | subscribeToCoreSignals(); | ||||
} | } | ||||
ClientModel::~ClientModel() { | ClientModel::~ClientModel() { | ||||
unsubscribeFromCoreSignals(); | unsubscribeFromCoreSignals(); | ||||
m_thread->quit(); | m_thread->quit(); | ||||
▲ Show 20 Lines • Show All 261 Lines • Show Last 20 Lines |