|
|
@ -31,8 +31,8 @@ |
|
|
|
#include <algorithm> |
|
|
|
#include <algorithm> |
|
|
|
|
|
|
|
|
|
|
|
#include <QJsonObject> |
|
|
|
#include <QJsonObject> |
|
|
|
|
|
|
|
#include <QMetaObject> |
|
|
|
#include <QThread> |
|
|
|
#include <QThread> |
|
|
|
#include <QTimer> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "base/bittorrent/peerinfo.h" |
|
|
|
#include "base/bittorrent/peerinfo.h" |
|
|
|
#include "base/bittorrent/session.h" |
|
|
|
#include "base/bittorrent/session.h" |
|
|
@ -335,7 +335,7 @@ SyncController::SyncController(ISessionManager *sessionManager, QObject *parent) |
|
|
|
connect(m_freeDiskSpaceChecker, &FreeDiskSpaceChecker::checked, this, &SyncController::freeDiskSpaceSizeUpdated); |
|
|
|
connect(m_freeDiskSpaceChecker, &FreeDiskSpaceChecker::checked, this, &SyncController::freeDiskSpaceSizeUpdated); |
|
|
|
|
|
|
|
|
|
|
|
m_freeDiskSpaceThread->start(); |
|
|
|
m_freeDiskSpaceThread->start(); |
|
|
|
QTimer::singleShot(0, m_freeDiskSpaceChecker, &FreeDiskSpaceChecker::check); |
|
|
|
invokeChecker(); |
|
|
|
m_freeDiskSpaceElapsedTimer.start(); |
|
|
|
m_freeDiskSpaceElapsedTimer.start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -521,7 +521,7 @@ void SyncController::torrentPeersAction() |
|
|
|
qint64 SyncController::getFreeDiskSpace() |
|
|
|
qint64 SyncController::getFreeDiskSpace() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_freeDiskSpaceElapsedTimer.hasExpired(FREEDISKSPACE_CHECK_TIMEOUT)) { |
|
|
|
if (m_freeDiskSpaceElapsedTimer.hasExpired(FREEDISKSPACE_CHECK_TIMEOUT)) { |
|
|
|
QTimer::singleShot(0, m_freeDiskSpaceChecker, &FreeDiskSpaceChecker::check); |
|
|
|
invokeChecker(); |
|
|
|
m_freeDiskSpaceElapsedTimer.restart(); |
|
|
|
m_freeDiskSpaceElapsedTimer.restart(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -532,3 +532,12 @@ void SyncController::freeDiskSpaceSizeUpdated(qint64 freeSpaceSize) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_freeDiskSpace = freeSpaceSize; |
|
|
|
m_freeDiskSpace = freeSpaceSize; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SyncController::invokeChecker() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) |
|
|
|
|
|
|
|
QMetaObject::invokeMethod(m_freeDiskSpaceChecker, &FreeDiskSpaceChecker::check, Qt::QueuedConnection); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
QMetaObject::invokeMethod(m_freeDiskSpaceChecker, "check", Qt::QueuedConnection); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|