mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-10 12:21:12 +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 <QProcess>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#ifdef DISABLE_GUI
|
#ifdef DISABLE_GUI
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@ -631,3 +632,18 @@ QString misc::accurateDoubleToString(const double &n, const int &precision, bool
|
|||||||
else
|
else
|
||||||
return QString::number(std::floor(n*prec)/prec, 'f', precision);
|
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 <sstream>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QThread>
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -106,15 +105,8 @@ namespace misc
|
|||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
bool naturalSort(QString left, QString right, bool& result);
|
bool naturalSort(QString left, QString right, bool& result);
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
@ -666,7 +666,7 @@ void PropertiesWidget::renameSelectedFile() {
|
|||||||
int timeout = 10;
|
int timeout = 10;
|
||||||
while(!QDir().rmpath(old_folder.absolutePath()) && timeout > 0) {
|
while(!QDir().rmpath(old_folder.absolutePath()) && timeout > 0) {
|
||||||
// XXX: We should not sleep here (freezes the UI for 1 second)
|
// XXX: We should not sleep here (freezes the UI for 1 second)
|
||||||
SleeperThread::msleep(100);
|
misc::msleep(100);
|
||||||
--timeout;
|
--timeout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user