Browse Source

Merge pull request #10982 from Chocobo1/cleanup

Code base cleanup
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
3811612f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 83
      src/app/qtlocalpeer/qtlocalpeer.cpp
  2. 50
      src/app/qtlocalpeer/qtlocalpeer.h
  3. 34
      src/app/qtlocalpeer/qtlockedfile.cpp
  4. 61
      src/app/qtlocalpeer/qtlockedfile.h
  5. 43
      src/app/qtlocalpeer/qtlockedfile_unix.cpp
  6. 38
      src/app/qtlocalpeer/qtlockedfile_win.cpp
  7. 4
      src/base/bittorrent/session.cpp
  8. 4
      src/base/bittorrent/torrenthandle.cpp
  9. 2
      src/base/net/smtp.cpp
  10. 5
      src/base/private/profile_p.cpp
  11. 26
      src/base/rss/private/rss_parser.cpp
  12. 4
      src/gui/CMakeLists.txt
  13. 2
      src/gui/addnewtorrentdialog.cpp
  14. 6
      src/gui/advancedsettings.cpp
  15. 2
      src/gui/fspathedit.cpp
  16. 4
      src/gui/gui.pri
  17. 42
      src/gui/mainwindow.cpp
  18. 2
      src/gui/optionsdialog.cpp
  19. 0
      src/gui/private/fspathedit_p.cpp
  20. 0
      src/gui/private/fspathedit_p.h
  21. 12
      src/gui/programupdater.cpp
  22. 2
      src/gui/properties/propertieswidget.cpp
  23. 2
      src/gui/properties/proptabbar.cpp
  24. 2
      src/gui/properties/speedwidget.cpp
  25. 2
      src/gui/rss/automatedrssdownloader.cpp
  26. 2
      src/gui/scanfoldersdelegate.cpp
  27. 14
      src/gui/search/searchjobwidget.cpp
  28. 4
      src/gui/search/searchwidget.cpp
  29. 2
      src/gui/speedlimitdialog.cpp
  30. 7
      src/gui/transferlistfilterswidget.cpp
  31. 2
      src/gui/updownratiodialog.cpp

83
src/app/qtlocalpeer/qtlocalpeer.cpp

@ -1,4 +1,31 @@
/**************************************************************************** /*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2019 Mike Tzou (Chocobo1)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
****************************************************************************
** **
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
@ -36,28 +63,29 @@
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************
*/
#include "qtlocalpeer.h" #include "qtlocalpeer.h"
#include <QCoreApplication>
#include <QDataStream>
#include <QTime>
#if defined(Q_OS_WIN)
#include <QLibrary>
#include <qt_windows.h>
typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*);
static PProcessIdToSessionId pProcessIdToSessionId = 0;
#endif
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
namespace QtLP_Private { #include <QCoreApplication>
#include <QDataStream>
#include <QDir>
#include <QLocalServer>
#include <QLocalSocket>
#include "base/utils/misc.h"
namespace QtLP_Private
{
#include "qtlockedfile.cpp" #include "qtlockedfile.cpp"
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include "qtlockedfile_win.cpp" #include "qtlockedfile_win.cpp"
#else #else
@ -68,7 +96,8 @@ namespace QtLP_Private {
const char* QtLocalPeer::ack = "ack"; const char* QtLocalPeer::ack = "ack";
QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
: QObject(parent), id(appId) : QObject(parent)
, id(appId)
{ {
QString prefix = id; QString prefix = id;
if (id.isEmpty()) { if (id.isEmpty()) {
@ -87,17 +116,16 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
+ QLatin1Char('-') + QString::number(idNum, 16); + QLatin1Char('-') + QString::number(idNum, 16);
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
if (!pProcessIdToSessionId) { using PPROCESSIDTOSESSIONID = BOOL (WINAPI *)(DWORD, DWORD *);
QLibrary lib("kernel32"); const auto processIdToSessionId = Utils::Misc::loadWinAPI<PPROCESSIDTOSESSIONID>("kernel32.dll", "ProcessIdToSessionId");
pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId");
} if (processIdToSessionId) {
if (pProcessIdToSessionId) {
DWORD sessionId = 0; DWORD sessionId = 0;
pProcessIdToSessionId(GetCurrentProcessId(), &sessionId); processIdToSessionId(GetCurrentProcessId(), &sessionId);
socketName += QLatin1Char('-') + QString::number(sessionId, 16); socketName += (QLatin1Char('-') + QString::number(sessionId, 16));
} }
#else #else
socketName += QLatin1Char('-') + QString::number(::getuid(), 16); socketName += (QLatin1Char('-') + QString::number(::getuid(), 16));
#endif #endif
server = new QLocalServer(this); server = new QLocalServer(this);
@ -109,8 +137,6 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
lockFile.open(QIODevice::ReadWrite); lockFile.open(QIODevice::ReadWrite);
} }
bool QtLocalPeer::isClient() bool QtLocalPeer::isClient()
{ {
if (lockFile.isLocked()) if (lockFile.isLocked())
@ -120,7 +146,7 @@ bool QtLocalPeer::isClient()
return true; return true;
bool res = server->listen(socketName); bool res = server->listen(socketName);
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) #if defined(Q_OS_UNIX)
// ### Workaround // ### Workaround
if (!res && server->serverError() == QAbstractSocket::AddressInUseError) { if (!res && server->serverError() == QAbstractSocket::AddressInUseError) {
QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName); QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName);
@ -133,8 +159,7 @@ bool QtLocalPeer::isClient()
return false; return false;
} }
bool QtLocalPeer::sendMessage(const QString &message, const int timeout)
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
{ {
if (!isClient()) if (!isClient())
return false; return false;
@ -170,6 +195,10 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
return res; return res;
} }
QString QtLocalPeer::applicationId() const
{
return id;
}
void QtLocalPeer::receiveConnection() void QtLocalPeer::receiveConnection()
{ {

50
src/app/qtlocalpeer/qtlocalpeer.h

@ -1,4 +1,31 @@
/**************************************************************************** /*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2019 Mike Tzou (Chocobo1)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
****************************************************************************
** **
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
@ -36,38 +63,37 @@
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************
*/
#ifndef QTLOCALPEER_H #ifndef QTLOCALPEER_H
#define QTLOCALPEER_H #define QTLOCALPEER_H
#include <QLocalServer>
#include <QLocalSocket>
#include <QDir>
#include "qtlockedfile.h" #include "qtlockedfile.h"
class QLocalServer;
class QtLocalPeer : public QObject class QtLocalPeer : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
QtLocalPeer(QObject *parent = 0, const QString &appId = QString()); QtLocalPeer(QObject *parent = nullptr, const QString &appId = QString());
bool isClient(); bool isClient();
bool sendMessage(const QString &message, int timeout); bool sendMessage(const QString &message, int timeout);
QString applicationId() const QString applicationId() const;
{ return id; }
Q_SIGNALS: signals:
void messageReceived(const QString &message); void messageReceived(const QString &message);
protected Q_SLOTS: protected slots:
void receiveConnection(); void receiveConnection();
protected: protected:
QString id; QString id;
QString socketName; QString socketName;
QLocalServer* server; QLocalServer *server = nullptr;
QtLP_Private::QtLockedFile lockFile; QtLP_Private::QtLockedFile lockFile;
private: private:

34
src/app/qtlocalpeer/qtlockedfile.cpp

@ -1,4 +1,31 @@
/**************************************************************************** /*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2019 Mike Tzou (Chocobo1)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
****************************************************************************
** **
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
@ -36,7 +63,8 @@
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************
*/
#include "qtlockedfile.h" #include "qtlockedfile.h"
@ -120,7 +148,7 @@ QtLockedFile::QtLockedFile(const QString &name)
\sa QFile::open(), QFile::resize() \sa QFile::open(), QFile::resize()
*/ */
bool QtLockedFile::open(OpenMode mode) bool QtLockedFile::open(const OpenMode mode)
{ {
if (mode & QIODevice::Truncate) { if (mode & QIODevice::Truncate) {
qWarning("QtLockedFile::open(): Truncate mode not allowed."); qWarning("QtLockedFile::open(): Truncate mode not allowed.");

61
src/app/qtlocalpeer/qtlockedfile.h

@ -1,4 +1,31 @@
/**************************************************************************** /*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2019 Mike Tzou (Chocobo1)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
****************************************************************************
** **
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
@ -36,22 +63,29 @@
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************
*/
#ifndef QTLOCKEDFILE_H #ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H #define QTLOCKEDFILE_H
#include <QFile> #include <QFile>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <QVector> #include <QVector>
#endif #endif
namespace QtLP_Private { namespace QtLP_Private
class QtLockedFile : public QFile
{ {
public: class QtLockedFile : public QFile
enum LockMode { NoLock = 0, ReadLock, WriteLock }; {
public:
enum LockMode
{
NoLock = 0,
ReadLock,
WriteLock
};
QtLockedFile(); QtLockedFile();
QtLockedFile(const QString &name); QtLockedFile(const QString &name);
@ -64,18 +98,19 @@ public:
bool isLocked() const; bool isLocked() const;
LockMode lockMode() const; LockMode lockMode() const;
private: private:
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
Qt::HANDLE getMutexHandle(int idx, bool doCreate);
bool waitMutex(Qt::HANDLE mutex, bool doBlock);
Qt::HANDLE wmutex; Qt::HANDLE wmutex;
Qt::HANDLE rmutex; Qt::HANDLE rmutex;
QVector<Qt::HANDLE> rmutexes; QVector<Qt::HANDLE> rmutexes;
QString mutexname; QString mutexname;
Qt::HANDLE getMutexHandle(int idx, bool doCreate);
bool waitMutex(Qt::HANDLE mutex, bool doBlock);
#endif #endif
LockMode m_lock_mode; LockMode m_lock_mode;
}; };
} }
#endif #endif

43
src/app/qtlocalpeer/qtlockedfile_unix.cpp

@ -1,4 +1,31 @@
/**************************************************************************** /*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2019 Mike Tzou (Chocobo1)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
****************************************************************************
** **
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
@ -36,14 +63,15 @@
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************
*/
#include "qtlockedfile.h"
#include <string.h>
#include <errno.h> #include <errno.h>
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h>
#include "qtlockedfile.h" #include <unistd.h>
bool QtLockedFile::lock(LockMode mode, bool block) bool QtLockedFile::lock(LockMode mode, bool block)
{ {
@ -75,12 +103,10 @@ bool QtLockedFile::lock(LockMode mode, bool block)
return false; return false;
} }
m_lock_mode = mode; m_lock_mode = mode;
return true; return true;
} }
bool QtLockedFile::unlock() bool QtLockedFile::unlock()
{ {
if (!isOpen()) { if (!isOpen()) {
@ -112,4 +138,3 @@ QtLockedFile::~QtLockedFile()
if (isOpen()) if (isOpen())
unlock(); unlock();
} }

38
src/app/qtlocalpeer/qtlockedfile_win.cpp

@ -1,4 +1,31 @@
/**************************************************************************** /*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2019 Mike Tzou (Chocobo1)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
****************************************************************************
** **
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
@ -36,19 +63,18 @@
** **
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************
*/
#include "qtlockedfile.h" #include "qtlockedfile.h"
#include <qt_windows.h>
#include <QFileInfo> #include <QFileInfo>
#define MUTEX_PREFIX "QtLockedFile mutex " #define MUTEX_PREFIX "QtLockedFile mutex "
// Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS // Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS
#define MAX_READERS MAXIMUM_WAIT_OBJECTS #define MAX_READERS MAXIMUM_WAIT_OBJECTS
#if QT_VERSION >= 0x050000
#define QT_WA(unicode, ansi) unicode #define QT_WA(unicode, ansi) unicode
#endif
Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
{ {
@ -99,8 +125,6 @@ bool QtLockedFile::waitMutex(Qt::HANDLE mutex, bool doBlock)
return false; return false;
} }
bool QtLockedFile::lock(LockMode mode, bool block) bool QtLockedFile::lock(LockMode mode, bool block)
{ {
if (!isOpen()) { if (!isOpen()) {

4
src/base/bittorrent/session.cpp

@ -3570,7 +3570,7 @@ void Session::configureDeferred()
if (!m_deferredConfigureScheduled) { if (!m_deferredConfigureScheduled) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QMetaObject::invokeMethod(this QMetaObject::invokeMethod(this
, static_cast<void (Session::*)()>(&Session::configure) , qOverload<>(&Session::configure)
, Qt::QueuedConnection); , Qt::QueuedConnection);
#else #else
QMetaObject::invokeMethod(this, "configure", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "configure", Qt::QueuedConnection);
@ -4032,7 +4032,7 @@ void Session::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_ale
if (p->error) { if (p->error) {
LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...") LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...")
.arg(tmpRemovingTorrentData.name, QString::fromStdString(p->error.message())) .arg(tmpRemovingTorrentData.name, QString::fromLocal8Bit(p->error.message().c_str()))
, Log::WARNING); , Log::WARNING);
} }
else { else {

4
src/base/bittorrent/torrenthandle.cpp

@ -1801,7 +1801,7 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(const lt::save_resume_data_f
} }
else { else {
LogMsg(tr("Save resume data failed. Torrent: \"%1\", error: \"%2\"") LogMsg(tr("Save resume data failed. Torrent: \"%1\", error: \"%2\"")
.arg(name(), QString::fromStdString(p->error.message())), Log::CRITICAL); .arg(name(), QString::fromLocal8Bit(p->error.message().c_str())), Log::CRITICAL);
m_session->handleTorrentResumeDataFailed(this); m_session->handleTorrentResumeDataFailed(this);
} }
} }
@ -1871,7 +1871,7 @@ void TorrentHandle::handleFileRenameFailedAlert(const lt::file_rename_failed_ale
{ {
LogMsg(tr("File rename failed. Torrent: \"%1\", file: \"%2\", reason: \"%3\"") LogMsg(tr("File rename failed. Torrent: \"%1\", file: \"%2\", reason: \"%3\"")
.arg(name(), filePath(LTUnderlyingType<LTFileIndex> {p->index}) .arg(name(), filePath(LTUnderlyingType<LTFileIndex> {p->index})
, QString::fromStdString(p->error.message())), Log::WARNING); , QString::fromLocal8Bit(p->error.message().c_str())), Log::WARNING);
m_oldPath[p->index].removeFirst(); m_oldPath[p->index].removeFirst();
if (m_oldPath[p->index].isEmpty()) if (m_oldPath[p->index].isEmpty())

2
src/base/net/smtp.cpp

@ -113,7 +113,7 @@ Smtp::Smtp(QObject *parent)
connect(m_socket, &QIODevice::readyRead, this, &Smtp::readyRead); connect(m_socket, &QIODevice::readyRead, this, &Smtp::readyRead);
connect(m_socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater); connect(m_socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater);
connect(m_socket, static_cast<void (QAbstractSocket::*)(QAbstractSocket::SocketError)>(&QAbstractSocket::error) connect(m_socket, qOverload<QAbstractSocket::SocketError>(&QAbstractSocket::error)
, this, &Smtp::error); , this, &Smtp::error);
// Test hmacMD5 function (http://www.faqs.org/rfcs/rfc2202.html) // Test hmacMD5 function (http://www.faqs.org/rfcs/rfc2202.html)

5
src/base/private/profile_p.cpp

@ -84,11 +84,6 @@ QString Private::DefaultProfile::dataLocation() const
QString Private::DefaultProfile::downloadLocation() const QString Private::DefaultProfile::downloadLocation() const
{ {
#if defined(Q_OS_WIN)
if (QSysInfo::windowsVersion() <= QSysInfo::WV_XP) // Windows XP
return QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).absoluteFilePath(
QCoreApplication::translate("fsutils", "Downloads"));
#endif
return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
} }

26
src/base/rss/private/rss_parser.cpp

@ -44,12 +44,16 @@
namespace namespace
{ {
class XmlStreamEntityResolver : public QXmlStreamEntityResolver
{
public:
QString resolveUndeclaredEntity(const QString &name) override
{
// (X)HTML entities declared in: // (X)HTML entities declared in:
// http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent // http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent
// http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent // http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent
// http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent // http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
using StringHash = QHash<QString, QString>; static const QHash<QString, QString> HTMLEntities {
Q_GLOBAL_STATIC_WITH_ARGS(StringHash, HTML_ENTITIES, ({
{"nbsp", "&#160;"}, // no-break space = non-breaking space, U+00A0 ISOnum {"nbsp", "&#160;"}, // no-break space = non-breaking space, U+00A0 ISOnum
{"iexcl", "&#161;"}, // inverted exclamation mark, U+00A1 ISOnum {"iexcl", "&#161;"}, // inverted exclamation mark, U+00A1 ISOnum
{"cent", "&#162;"}, // cent sign, U+00A2 ISOnum {"cent", "&#162;"}, // cent sign, U+00A2 ISOnum
@ -347,38 +351,30 @@ namespace
{"clubs", "&#9827;"}, // black club suit = shamrock, U+2663 ISOpub {"clubs", "&#9827;"}, // black club suit = shamrock, U+2663 ISOpub
{"hearts", "&#9829;"}, // black heart suit = valentine, U+2665 ISOpub {"hearts", "&#9829;"}, // black heart suit = valentine, U+2665 ISOpub
{"diams", "&#9830;"} // black diamond suit, U+2666 ISOpub {"diams", "&#9830;"} // black diamond suit, U+2666 ISOpub
})) };
return HTMLEntities.value(name);
class XmlStreamEntityResolver : public QXmlStreamEntityResolver
{
public:
QString resolveUndeclaredEntity(const QString &name) override
{
return HTML_ENTITIES->value(name);
} }
}; };
// Ported to Qt from KDElibs4
QDateTime parseDate(const QString &string)
{
const char shortDay[][4] = { const char shortDay[][4] = {
"Mon", "Tue", "Wed", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat", "Thu", "Fri", "Sat",
"Sun" "Sun"
}; };
const char longDay[][10] = { const char longDay[][10] = {
"Monday", "Tuesday", "Wednesday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Thursday", "Friday", "Saturday",
"Sunday" "Sunday"
}; };
const char shortMonth[][4] = { const char shortMonth[][4] = {
"Jan", "Feb", "Mar", "Apr", "Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec" "Sep", "Oct", "Nov", "Dec"
}; };
// Ported to Qt from KDElibs4
QDateTime parseDate(const QString &string)
{
const QString str = string.trimmed(); const QString str = string.trimmed();
if (str.isEmpty()) if (str.isEmpty())
return QDateTime::currentDateTime(); return QDateTime::currentDateTime();

4
src/gui/CMakeLists.txt

@ -25,7 +25,6 @@ deletionconfirmationdialog.h
downloadfromurldialog.h downloadfromurldialog.h
executionlogwidget.h executionlogwidget.h
fspathedit.h fspathedit.h
fspathedit_p.h
hidabletabwidget.h hidabletabwidget.h
ipsubnetwhitelistoptionsdialog.h ipsubnetwhitelistoptionsdialog.h
lineedit.h lineedit.h
@ -34,6 +33,7 @@ mainwindow.h
optionsdialog.h optionsdialog.h
previewlistdelegate.h previewlistdelegate.h
previewselectdialog.h previewselectdialog.h
private/fspathedit_p.h
private/tristatewidget.h private/tristatewidget.h
raisedmessagebox.h raisedmessagebox.h
scanfoldersdelegate.h scanfoldersdelegate.h
@ -77,7 +77,6 @@ cookiesmodel.cpp
downloadfromurldialog.cpp downloadfromurldialog.cpp
executionlogwidget.cpp executionlogwidget.cpp
fspathedit.cpp fspathedit.cpp
fspathedit_p.cpp
hidabletabwidget.cpp hidabletabwidget.cpp
ipsubnetwhitelistoptionsdialog.cpp ipsubnetwhitelistoptionsdialog.cpp
lineedit.cpp lineedit.cpp
@ -86,6 +85,7 @@ mainwindow.cpp
optionsdialog.cpp optionsdialog.cpp
previewlistdelegate.cpp previewlistdelegate.cpp
previewselectdialog.cpp previewselectdialog.cpp
private/fspathedit_p.cpp
private/tristatewidget.cpp private/tristatewidget.cpp
raisedmessagebox.cpp raisedmessagebox.cpp
scanfoldersdelegate.cpp scanfoldersdelegate.cpp

2
src/gui/addnewtorrentdialog.cpp

@ -612,7 +612,7 @@ void AddNewTorrentDialog::setupTreeview()
m_contentDelegate = new PropListDelegate(nullptr); m_contentDelegate = new PropListDelegate(nullptr);
m_ui->contentTreeView->setItemDelegate(m_contentDelegate); m_ui->contentTreeView->setItemDelegate(m_contentDelegate);
connect(m_ui->contentTreeView, &QAbstractItemView::clicked, m_ui->contentTreeView connect(m_ui->contentTreeView, &QAbstractItemView::clicked, m_ui->contentTreeView
, static_cast<void (QAbstractItemView::*)(const QModelIndex &)>(&QAbstractItemView::edit)); , qOverload<const QModelIndex &>(&QAbstractItemView::edit));
connect(m_ui->contentTreeView, &QWidget::customContextMenuRequested, this, &AddNewTorrentDialog::displayContentTreeMenu); connect(m_ui->contentTreeView, &QWidget::customContextMenuRequested, this, &AddNewTorrentDialog::displayContentTreeMenu);
// List files in torrent // List files in torrent

6
src/gui/advancedsettings.cpp

@ -137,11 +137,11 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
setSelectionMode(QAbstractItemView::NoSelection); setSelectionMode(QAbstractItemView::NoSelection);
setEditTriggers(QAbstractItemView::NoEditTriggers); setEditTriggers(QAbstractItemView::NoEditTriggers);
// Signals // Signals
connect(&m_spinBoxCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged) connect(&m_spinBoxCache, qOverload<int>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateCacheSpinSuffix); , this, &AdvancedSettings::updateCacheSpinSuffix);
connect(&m_comboBoxInterface, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(&m_comboBoxInterface, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &AdvancedSettings::updateInterfaceAddressCombo); , this, &AdvancedSettings::updateInterfaceAddressCombo);
connect(&m_spinBoxSaveResumeDataInterval, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged) connect(&m_spinBoxSaveResumeDataInterval, qOverload<int>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateSaveResumeDataIntervalSuffix); , this, &AdvancedSettings::updateSaveResumeDataIntervalSuffix);
// Load settings // Load settings
loadAdvancedSettings(); loadAdvancedSettings();

2
src/gui/fspathedit.cpp

@ -39,7 +39,7 @@
#include <QToolButton> #include <QToolButton>
#include "base/utils/fs.h" #include "base/utils/fs.h"
#include "fspathedit_p.h" #include "private/fspathedit_p.h"
namespace namespace
{ {

4
src/gui/gui.pri

@ -19,7 +19,6 @@ HEADERS += \
$$PWD/downloadfromurldialog.h \ $$PWD/downloadfromurldialog.h \
$$PWD/executionlogwidget.h \ $$PWD/executionlogwidget.h \
$$PWD/fspathedit.h \ $$PWD/fspathedit.h \
$$PWD/fspathedit_p.h \
$$PWD/hidabletabwidget.h \ $$PWD/hidabletabwidget.h \
$$PWD/ipsubnetwhitelistoptionsdialog.h \ $$PWD/ipsubnetwhitelistoptionsdialog.h \
$$PWD/lineedit.h \ $$PWD/lineedit.h \
@ -28,6 +27,7 @@ HEADERS += \
$$PWD/optionsdialog.h \ $$PWD/optionsdialog.h \
$$PWD/previewlistdelegate.h \ $$PWD/previewlistdelegate.h \
$$PWD/previewselectdialog.h \ $$PWD/previewselectdialog.h \
$$PWD/private/fspathedit_p.h \
$$PWD/private/tristatewidget.h \ $$PWD/private/tristatewidget.h \
$$PWD/raisedmessagebox.h \ $$PWD/raisedmessagebox.h \
$$PWD/rss/articlelistwidget.h \ $$PWD/rss/articlelistwidget.h \
@ -82,7 +82,6 @@ SOURCES += \
$$PWD/downloadfromurldialog.cpp \ $$PWD/downloadfromurldialog.cpp \
$$PWD/executionlogwidget.cpp \ $$PWD/executionlogwidget.cpp \
$$PWD/fspathedit.cpp \ $$PWD/fspathedit.cpp \
$$PWD/fspathedit_p.cpp \
$$PWD/hidabletabwidget.cpp \ $$PWD/hidabletabwidget.cpp \
$$PWD/ipsubnetwhitelistoptionsdialog.cpp \ $$PWD/ipsubnetwhitelistoptionsdialog.cpp \
$$PWD/lineedit.cpp \ $$PWD/lineedit.cpp \
@ -91,6 +90,7 @@ SOURCES += \
$$PWD/optionsdialog.cpp \ $$PWD/optionsdialog.cpp \
$$PWD/previewlistdelegate.cpp \ $$PWD/previewlistdelegate.cpp \
$$PWD/previewselectdialog.cpp \ $$PWD/previewselectdialog.cpp \
$$PWD/private/fspathedit_p.cpp \
$$PWD/private/tristatewidget.cpp \ $$PWD/private/tristatewidget.cpp \
$$PWD/raisedmessagebox.cpp \ $$PWD/raisedmessagebox.cpp \
$$PWD/rss/articlelistwidget.cpp \ $$PWD/rss/articlelistwidget.cpp \

42
src/gui/mainwindow.cpp

@ -40,7 +40,6 @@
#include <QShortcut> #include <QShortcut>
#include <QSplitter> #include <QSplitter>
#include <QStatusBar> #include <QStatusBar>
#include <QSysInfo>
#include <QtGlobal> #include <QtGlobal>
#include <QTimer> #include <QTimer>
@ -253,10 +252,12 @@ MainWindow::MainWindow(QWidget *parent)
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackersRemoved, m_transferListFiltersWidget, &TransferListFiltersWidget::removeTrackers); connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackersRemoved, m_transferListFiltersWidget, &TransferListFiltersWidget::removeTrackers);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerlessStateChanged, m_transferListFiltersWidget, &TransferListFiltersWidget::changeTrackerless); connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerlessStateChanged, m_transferListFiltersWidget, &TransferListFiltersWidget::changeTrackerless);
using Func = void (TransferListFiltersWidget::*)(BitTorrent::TorrentHandle *const, const QString &); connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerSuccess
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerSuccess, m_transferListFiltersWidget, static_cast<Func>(&TransferListFiltersWidget::trackerSuccess)); , m_transferListFiltersWidget, qOverload<BitTorrent::TorrentHandle *const, const QString &>(&TransferListFiltersWidget::trackerSuccess));
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerError, m_transferListFiltersWidget, static_cast<Func>(&TransferListFiltersWidget::trackerError)); connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerError
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerWarning, m_transferListFiltersWidget, static_cast<Func>(&TransferListFiltersWidget::trackerWarning)); , m_transferListFiltersWidget, qOverload<BitTorrent::TorrentHandle *const, const QString &>(&TransferListFiltersWidget::trackerError));
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerWarning
, m_transferListFiltersWidget, qOverload<BitTorrent::TorrentHandle *const, const QString &>(&TransferListFiltersWidget::trackerWarning));
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// Increase top spacing to avoid tab overlapping // Increase top spacing to avoid tab overlapping
@ -856,17 +857,15 @@ void MainWindow::createKeyboardShortcuts()
m_ui->actionCloseWindow->setVisible(false); m_ui->actionCloseWindow->setVisible(false);
#endif #endif
QShortcut *switchTransferShortcut = new QShortcut(Qt::ALT + Qt::Key_1, this); const auto *switchTransferShortcut = new QShortcut(Qt::ALT + Qt::Key_1, this);
connect(switchTransferShortcut, &QShortcut::activated, this, &MainWindow::displayTransferTab); connect(switchTransferShortcut, &QShortcut::activated, this, &MainWindow::displayTransferTab);
const auto *switchSearchShortcut = new QShortcut(Qt::ALT + Qt::Key_2, this);
using Func = void (MainWindow::*)(); connect(switchSearchShortcut, &QShortcut::activated, this, qOverload<>(&MainWindow::displaySearchTab));
QShortcut *switchSearchShortcut = new QShortcut(Qt::ALT + Qt::Key_2, this); const auto *switchRSSShortcut = new QShortcut(Qt::ALT + Qt::Key_3, this);
connect(switchSearchShortcut, &QShortcut::activated, this, static_cast<Func>(&MainWindow::displaySearchTab)); connect(switchRSSShortcut, &QShortcut::activated, this, qOverload<>(&MainWindow::displayRSSTab));
QShortcut *switchRSSShortcut = new QShortcut(Qt::ALT + Qt::Key_3, this); const auto *switchExecutionLogShortcut = new QShortcut(Qt::ALT + Qt::Key_4, this);
connect(switchRSSShortcut, &QShortcut::activated, this, static_cast<Func>(&MainWindow::displayRSSTab));
QShortcut *switchExecutionLogShortcut = new QShortcut(Qt::ALT + Qt::Key_4, this);
connect(switchExecutionLogShortcut, &QShortcut::activated, this, &MainWindow::displayExecutionLogTab); connect(switchExecutionLogShortcut, &QShortcut::activated, this, &MainWindow::displayExecutionLogTab);
QShortcut *switchSearchFilterShortcut = new QShortcut(QKeySequence::Find, m_transferListWidget); const auto *switchSearchFilterShortcut = new QShortcut(QKeySequence::Find, m_transferListWidget);
connect(switchSearchFilterShortcut, &QShortcut::activated, this, &MainWindow::focusSearchFilter); connect(switchSearchFilterShortcut, &QShortcut::activated, this, &MainWindow::focusSearchFilter);
m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents); m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents);
@ -2003,9 +2002,7 @@ void MainWindow::installPython()
{ {
setCursor(QCursor(Qt::WaitCursor)); setCursor(QCursor(Qt::WaitCursor));
// Download python // Download python
const QString installerURL = ((QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) const QString installerURL = "https://www.python.org/ftp/python/3.6.6/python-3.6.6.exe";
? "https://www.python.org/ftp/python/3.6.6/python-3.6.6.exe"
: "https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi");
Net::DownloadManager::instance()->download( Net::DownloadManager::instance()->download(
Net::DownloadRequest(installerURL).saveToFile(true) Net::DownloadRequest(installerURL).saveToFile(true)
, this, &MainWindow::pythonDownloadFinished); , this, &MainWindow::pythonDownloadFinished);
@ -2026,14 +2023,8 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
QProcess installer; QProcess installer;
qDebug("Launching Python installer in passive mode..."); qDebug("Launching Python installer in passive mode...");
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
QFile::rename(result.filePath, result.filePath + ".exe"); QFile::rename(result.filePath, result.filePath + ".exe");
installer.start('"' + Utils::Fs::toNativePath(result.filePath) + ".exe\" /passive"); installer.start('"' + Utils::Fs::toNativePath(result.filePath) + ".exe\" /passive");
}
else {
QFile::rename(result.filePath, result.filePath + ".msi");
installer.start(Utils::Misc::windowsSystemPath() + "\\msiexec.exe /passive /i \"" + Utils::Fs::toNativePath(result.filePath) + ".msi\"");
}
// Wait for setup to complete // Wait for setup to complete
installer.waitForFinished(10 * 60 * 1000); installer.waitForFinished(10 * 60 * 1000);
@ -2041,11 +2032,10 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
qDebug("Installer stdout: %s", installer.readAllStandardOutput().data()); qDebug("Installer stdout: %s", installer.readAllStandardOutput().data());
qDebug("Installer stderr: %s", installer.readAllStandardError().data()); qDebug("Installer stderr: %s", installer.readAllStandardError().data());
qDebug("Setup should be complete!"); qDebug("Setup should be complete!");
// Delete temp file // Delete temp file
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
Utils::Fs::forceRemove(result.filePath + ".exe"); Utils::Fs::forceRemove(result.filePath + ".exe");
else
Utils::Fs::forceRemove(result.filePath + ".msi");
// Reload search engine // Reload search engine
if (Utils::ForeignApps::pythonInfo().isSupportedVersion()) { if (Utils::ForeignApps::pythonInfo().isSupportedVersion()) {
m_ui->actionSearchWidget->setChecked(true); m_ui->actionSearchWidget->setChecked(true);

2
src/gui/optionsdialog.cpp

@ -341,7 +341,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->comboEncryption, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton); connect(m_ui->comboEncryption, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxRatio, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkMaxRatio, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxRatio, &QAbstractButton::toggled, this, &ThisType::toggleComboRatioLimitAct); connect(m_ui->checkMaxRatio, &QAbstractButton::toggled, this, &ThisType::toggleComboRatioLimitAct);
connect(m_ui->spinMaxRatio, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), connect(m_ui->spinMaxRatio, qOverload<double>(&QDoubleSpinBox::valueChanged),
this, &ThisType::enableApplyButton); this, &ThisType::enableApplyButton);
connect(m_ui->comboRatioLimitAct, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton); connect(m_ui->comboRatioLimitAct, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxSeedingMinutes, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkMaxSeedingMinutes, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);

0
src/gui/fspathedit_p.cpp → src/gui/private/fspathedit_p.cpp

0
src/gui/fspathedit_p.h → src/gui/private/fspathedit_p.h

12
src/gui/programupdater.cpp

@ -28,13 +28,21 @@
#include "programupdater.h" #include "programupdater.h"
#if defined(Q_OS_WIN)
#include <Windows.h>
#include <versionhelpers.h> // must follow after Windows.h
#endif
#include <QDebug> #include <QDebug>
#include <QDesktopServices> #include <QDesktopServices>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStringList> #include <QStringList>
#include <QSysInfo>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#if defined(Q_OS_WIN)
#include <QSysInfo>
#endif
#include "base/net/downloadmanager.h" #include "base/net/downloadmanager.h"
namespace namespace
@ -73,7 +81,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
const QString OS_TYPE {"Mac OS X"}; const QString OS_TYPE {"Mac OS X"};
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
const QString OS_TYPE {((QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) const QString OS_TYPE {(::IsWindows7OrGreater()
&& QSysInfo::currentCpuArchitecture().endsWith("64")) && QSysInfo::currentCpuArchitecture().endsWith("64"))
? "Windows x64" : "Windows"}; ? "Windows x64" : "Windows"};
#endif #endif

2
src/gui/properties/propertieswidget.cpp

@ -97,7 +97,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
// SIGNAL/SLOTS // SIGNAL/SLOTS
connect(m_ui->filesList, &QAbstractItemView::clicked connect(m_ui->filesList, &QAbstractItemView::clicked
, m_ui->filesList, static_cast<void (QAbstractItemView::*)(const QModelIndex &)>(&QAbstractItemView::edit)); , m_ui->filesList, qOverload<const QModelIndex &>(&QAbstractItemView::edit));
connect(m_ui->selectAllButton, &QPushButton::clicked, m_propListModel, &TorrentContentFilterModel::selectAll); connect(m_ui->selectAllButton, &QPushButton::clicked, m_propListModel, &TorrentContentFilterModel::selectAll);
connect(m_ui->selectNoneButton, &QPushButton::clicked, m_propListModel, &TorrentContentFilterModel::selectNone); connect(m_ui->selectNoneButton, &QPushButton::clicked, m_propListModel, &TorrentContentFilterModel::selectNone);
connect(m_ui->filesList, &QWidget::customContextMenuRequested, this, &PropertiesWidget::displayFilesListMenu); connect(m_ui->filesList, &QWidget::customContextMenuRequested, this, &PropertiesWidget::displayFilesListMenu);

2
src/gui/properties/proptabbar.cpp

@ -100,7 +100,7 @@ PropTabBar::PropTabBar(QWidget *parent)
addWidget(speedButton); addWidget(speedButton);
m_btnGroup->addButton(speedButton, SpeedTab); m_btnGroup->addButton(speedButton, SpeedTab);
// SIGNAL/SLOT // SIGNAL/SLOT
connect(m_btnGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked) connect(m_btnGroup, qOverload<int>(&QButtonGroup::buttonClicked)
, this, &PropTabBar::setCurrentIndex); , this, &PropTabBar::setCurrentIndex);
// Disable buttons focus // Disable buttons focus
for (QAbstractButton *btn : asConst(m_btnGroup->buttons())) for (QAbstractButton *btn : asConst(m_btnGroup->buttons()))

2
src/gui/properties/speedwidget.cpp

@ -75,7 +75,7 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent)
m_periodCombobox->addItem(tr("12 Hours")); m_periodCombobox->addItem(tr("12 Hours"));
m_periodCombobox->addItem(tr("24 Hours")); m_periodCombobox->addItem(tr("24 Hours"));
connect(m_periodCombobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(m_periodCombobox, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SpeedWidget::onPeriodChange); , this, &SpeedWidget::onPeriodChange);
m_graphsMenu = new QMenu(this); m_graphsMenu = new QMenu(this);

2
src/gui/rss/automatedrssdownloader.cpp

@ -113,7 +113,7 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
connect(m_ui->checkRegex, &QCheckBox::stateChanged, this, &AutomatedRssDownloader::updateMustLineValidity); connect(m_ui->checkRegex, &QCheckBox::stateChanged, this, &AutomatedRssDownloader::updateMustLineValidity);
connect(m_ui->checkRegex, &QCheckBox::stateChanged, this, &AutomatedRssDownloader::updateMustNotLineValidity); connect(m_ui->checkRegex, &QCheckBox::stateChanged, this, &AutomatedRssDownloader::updateMustNotLineValidity);
connect(m_ui->checkSmart, &QCheckBox::stateChanged, this, &AutomatedRssDownloader::handleRuleDefinitionChanged); connect(m_ui->checkSmart, &QCheckBox::stateChanged, this, &AutomatedRssDownloader::handleRuleDefinitionChanged);
connect(m_ui->spinIgnorePeriod, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged) connect(m_ui->spinIgnorePeriod, qOverload<int>(&QSpinBox::valueChanged)
, this, &AutomatedRssDownloader::handleRuleDefinitionChanged); , this, &AutomatedRssDownloader::handleRuleDefinitionChanged);
connect(m_ui->listFeeds, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleFeedCheckStateChange); connect(m_ui->listFeeds, &QListWidget::itemChanged, this, &AutomatedRssDownloader::handleFeedCheckStateChange);

2
src/gui/scanfoldersdelegate.cpp

@ -67,7 +67,7 @@ QWidget *ScanFoldersDelegate::createEditor(QWidget *parent, const QStyleOptionVi
editor->addItem(index.data().toString()); editor->addItem(index.data().toString());
} }
connect(editor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(editor, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &ScanFoldersDelegate::comboboxIndexChanged); , this, &ScanFoldersDelegate::comboboxIndexChanged);
return editor; return editor;
} }

14
src/gui/search/searchjobwidget.cpp

@ -135,23 +135,23 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
m_ui->horizontalLayout->insertWidget(0, m_lineEditSearchResultsFilter); m_ui->horizontalLayout->insertWidget(0, m_lineEditSearchResultsFilter);
connect(m_lineEditSearchResultsFilter, &LineEdit::textChanged, this, &SearchJobWidget::filterSearchResults); connect(m_lineEditSearchResultsFilter, &LineEdit::textChanged, this, &SearchJobWidget::filterSearchResults);
connect(m_ui->filterMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(m_ui->filterMode, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SearchJobWidget::updateFilter); , this, &SearchJobWidget::updateFilter);
connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->minSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged) connect(m_ui->minSeeds, qOverload<int>(&QSpinBox::valueChanged)
, this, &SearchJobWidget::updateFilter); , this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->maxSeeds, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged) connect(m_ui->maxSeeds, qOverload<int>(&QSpinBox::valueChanged)
, this, &SearchJobWidget::updateFilter); , this, &SearchJobWidget::updateFilter);
connect(m_ui->minSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->minSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->minSize, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged) connect(m_ui->minSize, qOverload<double>(&QDoubleSpinBox::valueChanged)
, this, &SearchJobWidget::updateFilter); , this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter); connect(m_ui->maxSize, &QAbstractSpinBox::editingFinished, this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSize, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged) connect(m_ui->maxSize, qOverload<double>(&QDoubleSpinBox::valueChanged)
, this, &SearchJobWidget::updateFilter); , this, &SearchJobWidget::updateFilter);
connect(m_ui->minSizeUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(m_ui->minSizeUnit, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SearchJobWidget::updateFilter); , this, &SearchJobWidget::updateFilter);
connect(m_ui->maxSizeUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(m_ui->maxSizeUnit, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SearchJobWidget::updateFilter); , this, &SearchJobWidget::updateFilter);
connect(m_ui->resultsBrowser, &QAbstractItemView::doubleClicked, this, &SearchJobWidget::onItemDoubleClicked); connect(m_ui->resultsBrowser, &QAbstractItemView::doubleClicked, this, &SearchJobWidget::onItemDoubleClicked);

4
src/gui/search/searchwidget.cpp

@ -132,9 +132,9 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
connect(m_ui->lineEditSearchPattern, &LineEdit::returnPressed, m_ui->searchButton, &QPushButton::click); connect(m_ui->lineEditSearchPattern, &LineEdit::returnPressed, m_ui->searchButton, &QPushButton::click);
connect(m_ui->lineEditSearchPattern, &LineEdit::textEdited, this, &SearchWidget::searchTextEdited); connect(m_ui->lineEditSearchPattern, &LineEdit::textEdited, this, &SearchWidget::searchTextEdited);
connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(m_ui->selectPlugin, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SearchWidget::selectMultipleBox); , this, &SearchWidget::selectMultipleBox);
connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged) connect(m_ui->selectPlugin, qOverload<int>(&QComboBox::currentIndexChanged)
, this, &SearchWidget::fillCatCombobox); , this, &SearchWidget::fillCatCombobox);
const auto focusSearchHotkey = new QShortcut(QKeySequence::Find, this); const auto focusSearchHotkey = new QShortcut(QKeySequence::Find, this);

2
src/gui/speedlimitdialog.cpp

@ -39,7 +39,7 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
// Connect to slots // Connect to slots
connect(m_ui->bandwidthSlider, &QSlider::valueChanged, this, &SpeedLimitDialog::updateSpinValue); connect(m_ui->bandwidthSlider, &QSlider::valueChanged, this, &SpeedLimitDialog::updateSpinValue);
connect(m_ui->spinBandwidth, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged) connect(m_ui->spinBandwidth, qOverload<int>(&QSpinBox::valueChanged)
, this, &SpeedLimitDialog::updateSliderValue); , this, &SpeedLimitDialog::updateSliderValue);
Utils::Gui::resize(this); Utils::Gui::resize(this);

7
src/gui/transferlistfilterswidget.cpp

@ -652,12 +652,11 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
connect(trackerLabel, &QCheckBox::toggled, m_trackerFilters, &TrackerFiltersList::toggleFilter); connect(trackerLabel, &QCheckBox::toggled, m_trackerFilters, &TrackerFiltersList::toggleFilter);
connect(trackerLabel, &QCheckBox::toggled, pref, &Preferences::setTrackerFilterState); connect(trackerLabel, &QCheckBox::toggled, pref, &Preferences::setTrackerFilterState);
using Func = void (TransferListFiltersWidget::*)(const QString&, const QString&); connect(this, qOverload<const QString &, const QString &>(&TransferListFiltersWidget::trackerSuccess)
connect(this, static_cast<Func>(&TransferListFiltersWidget::trackerSuccess)
, m_trackerFilters, &TrackerFiltersList::trackerSuccess); , m_trackerFilters, &TrackerFiltersList::trackerSuccess);
connect(this, static_cast<Func>(&TransferListFiltersWidget::trackerError) connect(this, qOverload<const QString &, const QString &>(&TransferListFiltersWidget::trackerError)
, m_trackerFilters, &TrackerFiltersList::trackerError); , m_trackerFilters, &TrackerFiltersList::trackerError);
connect(this, static_cast<Func>(&TransferListFiltersWidget::trackerWarning) connect(this, qOverload<const QString &, const QString &>(&TransferListFiltersWidget::trackerWarning)
, m_trackerFilters, &TrackerFiltersList::trackerWarning); , m_trackerFilters, &TrackerFiltersList::trackerWarning);
} }

2
src/gui/updownratiodialog.cpp

@ -69,7 +69,7 @@ UpDownRatioDialog::UpDownRatioDialog(bool useDefault, qreal initialRatioValue,
m_ui->timeSpinBox->setMaximum(maxTimeValue); m_ui->timeSpinBox->setMaximum(maxTimeValue);
m_ui->timeSpinBox->setValue(initialTimeValue); m_ui->timeSpinBox->setValue(initialTimeValue);
connect(m_ui->buttonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked) connect(m_ui->buttonGroup, qOverload<int>(&QButtonGroup::buttonClicked)
, this, &UpDownRatioDialog::handleRatioTypeChanged); , this, &UpDownRatioDialog::handleRatioTypeChanged);
connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDialog::enableRatioSpin); connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDialog::enableRatioSpin);
connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDialog::enableTimeSpin); connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDialog::enableTimeSpin);

Loading…
Cancel
Save