Browse Source

Drop QThread::msleep wrapper

adaptive-webui-19844
Vladimir Golovnev (Glassez) 8 years ago
parent
commit
335443e6a0
  1. 3
      src/app/main.cpp
  2. 19
      src/base/utils/misc.cpp
  3. 2
      src/base/utils/misc.h
  4. 3
      src/gui/properties/propertieswidget.cpp
  5. 4
      src/gui/properties/speedwidget.cpp

3
src/app/main.cpp

@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
#include <QDebug>
#include <QScopedPointer>
#include <QThread>
#ifndef DISABLE_GUI
// GUI-only includes
@ -168,7 +169,7 @@ int main(int argc, char *argv[]) @@ -168,7 +169,7 @@ int main(int argc, char *argv[])
#endif
qDebug("qBittorrent is already running for this user.");
Utils::Misc::msleep(300);
QThread::msleep(300);
app->sendParams(params.torrents);
return EXIT_SUCCESS;

19
src/base/utils/misc.cpp

@ -36,7 +36,6 @@ @@ -36,7 +36,6 @@
#include <QDebug>
#include <QProcess>
#include <QRegularExpression>
#include <QThread>
#include <QSysInfo>
#include <boost/version.hpp>
#include <libtorrent/version.hpp>
@ -641,24 +640,6 @@ QSize Utils::Misc::largeIconSize() @@ -641,24 +640,6 @@ QSize Utils::Misc::largeIconSize()
}
#endif // DISABLE_GUI
namespace
{
// Trick to get a portable sleep() function
class SleeperThread: public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
}
void Utils::Misc::msleep(unsigned long msecs)
{
SleeperThread::msleep(msecs);
}
QString Utils::Misc::osName()
{
// static initialization for usage in signal handler

2
src/base/utils/misc.h

@ -98,8 +98,6 @@ namespace Utils @@ -98,8 +98,6 @@ namespace Utils
QList<int> intListfromStringList(const QStringList &l);
QList<bool> boolListfromStringList(const QStringList &l);
void msleep(unsigned long msecs);
#ifndef DISABLE_GUI
void openPath(const QString& absolutePath);
void openFolderSelect(const QString& absolutePath);

3
src/gui/properties/propertieswidget.cpp

@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
#include <QMenu>
#include <QFileDialog>
#include <QBitArray>
#include <QThread>
#include "base/bittorrent/session.h"
#include "base/preferences.h"
@ -780,7 +781,7 @@ void PropertiesWidget::renameSelectedFile() @@ -780,7 +781,7 @@ void PropertiesWidget::renameSelectedFile()
int timeout = 10;
while (!QDir().rmpath(old_folder.absolutePath()) && timeout > 0) {
// FIXME: We should not sleep here (freezes the UI for 1 second)
Utils::Misc::msleep(100);
QThread::msleep(100);
--timeout;
}
}

4
src/gui/properties/speedwidget.cpp

@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
#include <QLabel>
#include <QMenu>
#include <QSignalMapper>
#include <QThread>
#include <libtorrent/session_status.hpp>
@ -40,7 +41,6 @@ @@ -40,7 +41,6 @@
#include "base/bittorrent/session.h"
#include "base/bittorrent/sessionstatus.h"
#include "base/preferences.h"
#include "base/utils/misc.h"
ComboBoxMenuButton::ComboBoxMenuButton(QWidget *parent, QMenu *menu)
: QComboBox(parent)
@ -152,7 +152,7 @@ void SpeedWidget::update() @@ -152,7 +152,7 @@ void SpeedWidget::update()
m_plot->pushPoint(point);
QMetaObject::invokeMethod(this, "graphUpdate", Qt::QueuedConnection);
Utils::Misc::msleep(1000);
QThread::msleep(1000);
}
}

Loading…
Cancel
Save