1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-03-10 04:11:16 +00:00

Remove inclusion of <QThread> from misc.h

This commit is contained in:
Ivan Sorokin 2014-10-18 03:29:12 +04:00
parent be338b969c
commit 5ea1a4c3cc
3 changed files with 19 additions and 11 deletions

View File

@ -41,6 +41,7 @@
#include <QProcess>
#include <QSettings>
#include <QLocale>
#include <QThread>
#ifdef DISABLE_GUI
#include <QCoreApplication>
@ -631,3 +632,18 @@ QString misc::accurateDoubleToString(const double &n, const int &precision, bool
else
return QString::number(std::floor(n*prec)/prec, 'f', precision);
}
namespace {
// Trick to get a portable sleep() function
class SleeperThread : public QThread {
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
}
void misc::msleep(unsigned long msecs) {
SleeperThread::msleep(msecs);
}

View File

@ -34,7 +34,6 @@
#include <sstream>
#include <QString>
#include <QStringList>
#include <QThread>
#include <ctime>
#include <QPoint>
#include <QFile>
@ -106,15 +105,8 @@ namespace misc
#ifndef DISABLE_GUI
bool naturalSort(QString left, QString right, bool& result);
#endif
void msleep(unsigned long msecs);
}
// Trick to get a portable sleep() function
class SleeperThread : public QThread {
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
#endif

View File

@ -666,7 +666,7 @@ void PropertiesWidget::renameSelectedFile() {
int timeout = 10;
while(!QDir().rmpath(old_folder.absolutePath()) && timeout > 0) {
// XXX: We should not sleep here (freezes the UI for 1 second)
SleeperThread::msleep(100);
misc::msleep(100);
--timeout;
}
}