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:
parent
be338b969c
commit
5ea1a4c3cc
16
src/misc.cpp
16
src/misc.cpp
@ -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);
|
||||
}
|
||||
|
12
src/misc.h
12
src/misc.h
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user