|
|
@ -35,10 +35,14 @@ |
|
|
|
#include "qbtsession.h" |
|
|
|
#include "qbtsession.h" |
|
|
|
#include "torrentpersistentdata.h" |
|
|
|
#include "torrentpersistentdata.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) |
|
|
|
#include <QElapsedTimer> |
|
|
|
#include <QElapsedTimer> |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
using namespace libtorrent; |
|
|
|
using namespace libtorrent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) |
|
|
|
|
|
|
|
|
|
|
|
#define CACHED_VARIABLE(VARTYPE, VAR, DUR) \ |
|
|
|
#define CACHED_VARIABLE(VARTYPE, VAR, DUR) \ |
|
|
|
static VARTYPE VAR; \ |
|
|
|
static VARTYPE VAR; \ |
|
|
|
static QElapsedTimer cacheTimer; \ |
|
|
|
static QElapsedTimer cacheTimer; \ |
|
|
@ -59,6 +63,16 @@ using namespace libtorrent; |
|
|
|
cacheTimer.start(); \ |
|
|
|
cacheTimer.start(); \ |
|
|
|
VAR.clear() |
|
|
|
VAR.clear() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
// We don't support caching for Qt < 4.7 at the moment
|
|
|
|
|
|
|
|
#define CACHED_VARIABLE(VARTYPE, VAR, DUR) \ |
|
|
|
|
|
|
|
VARTYPE VAR |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define CACHED_VARIABLE_FOR_HASH(VARTYPE, VAR, DUR, HASH) \ |
|
|
|
|
|
|
|
VARTYPE VAR |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Numerical constants
|
|
|
|
// Numerical constants
|
|
|
|
static const int CACHE_DURATION_MS = 1500; // 1500ms
|
|
|
|
static const int CACHE_DURATION_MS = 1500; // 1500ms
|
|
|
|
|
|
|
|
|
|
|
|