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. 53
      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 @@ @@ -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).
** Contact: http://www.qt-project.org/legal
@ -36,28 +63,29 @@ @@ -36,28 +63,29 @@
**
** $QT_END_LICENSE$
**
****************************************************************************/
****************************************************************************
*/
#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)
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#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"
#if defined(Q_OS_WIN)
#include "qtlockedfile_win.cpp"
#else
@ -68,7 +96,8 @@ namespace QtLP_Private { @@ -68,7 +96,8 @@ namespace QtLP_Private {
const char* QtLocalPeer::ack = "ack";
QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
: QObject(parent), id(appId)
: QObject(parent)
, id(appId)
{
QString prefix = id;
if (id.isEmpty()) {
@ -87,17 +116,16 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) @@ -87,17 +116,16 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
+ QLatin1Char('-') + QString::number(idNum, 16);
#if defined(Q_OS_WIN)
if (!pProcessIdToSessionId) {
QLibrary lib("kernel32");
pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId");
}
if (pProcessIdToSessionId) {
using PPROCESSIDTOSESSIONID = BOOL (WINAPI *)(DWORD, DWORD *);
const auto processIdToSessionId = Utils::Misc::loadWinAPI<PPROCESSIDTOSESSIONID>("kernel32.dll", "ProcessIdToSessionId");
if (processIdToSessionId) {
DWORD sessionId = 0;
pProcessIdToSessionId(GetCurrentProcessId(), &sessionId);
socketName += QLatin1Char('-') + QString::number(sessionId, 16);
processIdToSessionId(GetCurrentProcessId(), &sessionId);
socketName += (QLatin1Char('-') + QString::number(sessionId, 16));
}
#else
socketName += QLatin1Char('-') + QString::number(::getuid(), 16);
socketName += (QLatin1Char('-') + QString::number(::getuid(), 16));
#endif
server = new QLocalServer(this);
@ -109,8 +137,6 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) @@ -109,8 +137,6 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
lockFile.open(QIODevice::ReadWrite);
}
bool QtLocalPeer::isClient()
{
if (lockFile.isLocked())
@ -120,7 +146,7 @@ bool QtLocalPeer::isClient() @@ -120,7 +146,7 @@ bool QtLocalPeer::isClient()
return true;
bool res = server->listen(socketName);
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0))
#if defined(Q_OS_UNIX)
// ### Workaround
if (!res && server->serverError() == QAbstractSocket::AddressInUseError) {
QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName);
@ -133,8 +159,7 @@ bool QtLocalPeer::isClient() @@ -133,8 +159,7 @@ bool QtLocalPeer::isClient()
return false;
}
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
bool QtLocalPeer::sendMessage(const QString &message, const int timeout)
{
if (!isClient())
return false;
@ -170,6 +195,10 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout) @@ -170,6 +195,10 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
return res;
}
QString QtLocalPeer::applicationId() const
{
return id;
}
void QtLocalPeer::receiveConnection()
{

50
src/app/qtlocalpeer/qtlocalpeer.h

@ -1,4 +1,31 @@ @@ -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).
** Contact: http://www.qt-project.org/legal
@ -36,38 +63,37 @@ @@ -36,38 +63,37 @@
**
** $QT_END_LICENSE$
**
****************************************************************************/
****************************************************************************
*/
#ifndef QTLOCALPEER_H
#define QTLOCALPEER_H
#include <QLocalServer>
#include <QLocalSocket>
#include <QDir>
#include "qtlockedfile.h"
class QLocalServer;
class QtLocalPeer : public QObject
{
Q_OBJECT
public:
QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
QtLocalPeer(QObject *parent = nullptr, const QString &appId = QString());
bool isClient();
bool sendMessage(const QString &message, int timeout);
QString applicationId() const
{ return id; }
QString applicationId() const;
Q_SIGNALS:
signals:
void messageReceived(const QString &message);
protected Q_SLOTS:
protected slots:
void receiveConnection();
protected:
QString id;
QString socketName;
QLocalServer* server;
QLocalServer *server = nullptr;
QtLP_Private::QtLockedFile lockFile;
private:

34
src/app/qtlocalpeer/qtlockedfile.cpp

@ -1,4 +1,31 @@ @@ -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).
** Contact: http://www.qt-project.org/legal
@ -36,7 +63,8 @@ @@ -36,7 +63,8 @@
**
** $QT_END_LICENSE$
**
****************************************************************************/
****************************************************************************
*/
#include "qtlockedfile.h"
@ -120,7 +148,7 @@ QtLockedFile::QtLockedFile(const QString &name) @@ -120,7 +148,7 @@ QtLockedFile::QtLockedFile(const QString &name)
\sa QFile::open(), QFile::resize()
*/
bool QtLockedFile::open(OpenMode mode)
bool QtLockedFile::open(const OpenMode mode)
{
if (mode & QIODevice::Truncate) {
qWarning("QtLockedFile::open(): Truncate mode not allowed.");

53
src/app/qtlocalpeer/qtlockedfile.h

@ -1,4 +1,31 @@ @@ -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).
** Contact: http://www.qt-project.org/legal
@ -36,22 +63,29 @@ @@ -36,22 +63,29 @@
**
** $QT_END_LICENSE$
**
****************************************************************************/
****************************************************************************
*/
#ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H
#include <QFile>
#ifdef Q_OS_WIN
#include <QVector>
#endif
namespace QtLP_Private {
namespace QtLP_Private
{
class QtLockedFile : public QFile
{
public:
enum LockMode { NoLock = 0, ReadLock, WriteLock };
enum LockMode
{
NoLock = 0,
ReadLock,
WriteLock
};
QtLockedFile();
QtLockedFile(const QString &name);
@ -66,16 +100,17 @@ public: @@ -66,16 +100,17 @@ public:
private:
#ifdef Q_OS_WIN
Qt::HANDLE getMutexHandle(int idx, bool doCreate);
bool waitMutex(Qt::HANDLE mutex, bool doBlock);
Qt::HANDLE wmutex;
Qt::HANDLE rmutex;
QVector<Qt::HANDLE> rmutexes;
QString mutexname;
Qt::HANDLE getMutexHandle(int idx, bool doCreate);
bool waitMutex(Qt::HANDLE mutex, bool doBlock);
#endif
LockMode m_lock_mode;
};
}
#endif

43
src/app/qtlocalpeer/qtlockedfile_unix.cpp

@ -1,4 +1,31 @@ @@ -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).
** Contact: http://www.qt-project.org/legal
@ -36,14 +63,15 @@ @@ -36,14 +63,15 @@
**
** $QT_END_LICENSE$
**
****************************************************************************/
****************************************************************************
*/
#include "qtlockedfile.h"
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include "qtlockedfile.h"
#include <string.h>
#include <unistd.h>
bool QtLockedFile::lock(LockMode mode, bool block)
{
@ -75,12 +103,10 @@ bool QtLockedFile::lock(LockMode mode, bool block) @@ -75,12 +103,10 @@ bool QtLockedFile::lock(LockMode mode, bool block)
return false;
}
m_lock_mode = mode;
return true;
}
bool QtLockedFile::unlock()
{
if (!isOpen()) {
@ -112,4 +138,3 @@ QtLockedFile::~QtLockedFile() @@ -112,4 +138,3 @@ QtLockedFile::~QtLockedFile()
if (isOpen())
unlock();
}

38
src/app/qtlocalpeer/qtlockedfile_win.cpp

@ -1,4 +1,31 @@ @@ -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).
** Contact: http://www.qt-project.org/legal
@ -36,19 +63,18 @@ @@ -36,19 +63,18 @@
**
** $QT_END_LICENSE$
**
****************************************************************************/
****************************************************************************
*/
#include "qtlockedfile.h"
#include <qt_windows.h>
#include <QFileInfo>
#define MUTEX_PREFIX "QtLockedFile mutex "
// Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS
#define MAX_READERS MAXIMUM_WAIT_OBJECTS
#if QT_VERSION >= 0x050000
#define QT_WA(unicode, ansi) unicode
#endif
Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
{
@ -99,8 +125,6 @@ bool QtLockedFile::waitMutex(Qt::HANDLE mutex, bool doBlock) @@ -99,8 +125,6 @@ bool QtLockedFile::waitMutex(Qt::HANDLE mutex, bool doBlock)
return false;
}
bool QtLockedFile::lock(LockMode mode, bool block)
{
if (!isOpen()) {

4
src/base/bittorrent/session.cpp

@ -3570,7 +3570,7 @@ void Session::configureDeferred() @@ -3570,7 +3570,7 @@ void Session::configureDeferred()
if (!m_deferredConfigureScheduled) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QMetaObject::invokeMethod(this
, static_cast<void (Session::*)()>(&Session::configure)
, qOverload<>(&Session::configure)
, Qt::QueuedConnection);
#else
QMetaObject::invokeMethod(this, "configure", Qt::QueuedConnection);
@ -4032,7 +4032,7 @@ void Session::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_ale @@ -4032,7 +4032,7 @@ void Session::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_ale
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...")
.arg(tmpRemovingTorrentData.name, QString::fromStdString(p->error.message()))
.arg(tmpRemovingTorrentData.name, QString::fromLocal8Bit(p->error.message().c_str()))
, Log::WARNING);
}
else {

4
src/base/bittorrent/torrenthandle.cpp

@ -1801,7 +1801,7 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(const lt::save_resume_data_f @@ -1801,7 +1801,7 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(const lt::save_resume_data_f
}
else {
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);
}
}
@ -1871,7 +1871,7 @@ void TorrentHandle::handleFileRenameFailedAlert(const lt::file_rename_failed_ale @@ -1871,7 +1871,7 @@ void TorrentHandle::handleFileRenameFailedAlert(const lt::file_rename_failed_ale
{
LogMsg(tr("File rename failed. Torrent: \"%1\", file: \"%2\", reason: \"%3\"")
.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();
if (m_oldPath[p->index].isEmpty())

2
src/base/net/smtp.cpp

@ -113,7 +113,7 @@ Smtp::Smtp(QObject *parent) @@ -113,7 +113,7 @@ Smtp::Smtp(QObject *parent)
connect(m_socket, &QIODevice::readyRead, this, &Smtp::readyRead);
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);
// 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 @@ -84,11 +84,6 @@ QString Private::DefaultProfile::dataLocation() 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);
}

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

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

4
src/gui/CMakeLists.txt

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

2
src/gui/addnewtorrentdialog.cpp

@ -612,7 +612,7 @@ void AddNewTorrentDialog::setupTreeview() @@ -612,7 +612,7 @@ void AddNewTorrentDialog::setupTreeview()
m_contentDelegate = new PropListDelegate(nullptr);
m_ui->contentTreeView->setItemDelegate(m_contentDelegate);
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);
// List files in torrent

6
src/gui/advancedsettings.cpp

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

2
src/gui/fspathedit.cpp

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

4
src/gui/gui.pri

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

42
src/gui/mainwindow.cpp

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

2
src/gui/optionsdialog.cpp

@ -341,7 +341,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -341,7 +341,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
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::toggleComboRatioLimitAct);
connect(m_ui->spinMaxRatio, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
connect(m_ui->spinMaxRatio, qOverload<double>(&QDoubleSpinBox::valueChanged),
this, &ThisType::enableApplyButton);
connect(m_ui->comboRatioLimitAct, qComboBoxCurrentIndexChanged, 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 @@ @@ -28,13 +28,21 @@
#include "programupdater.h"
#if defined(Q_OS_WIN)
#include <Windows.h>
#include <versionhelpers.h> // must follow after Windows.h
#endif
#include <QDebug>
#include <QDesktopServices>
#include <QRegularExpression>
#include <QStringList>
#include <QSysInfo>
#include <QXmlStreamReader>
#if defined(Q_OS_WIN)
#include <QSysInfo>
#endif
#include "base/net/downloadmanager.h"
namespace
@ -73,7 +81,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result) @@ -73,7 +81,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
#ifdef Q_OS_MAC
const QString OS_TYPE {"Mac OS X"};
#elif defined(Q_OS_WIN)
const QString OS_TYPE {((QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7)
const QString OS_TYPE {(::IsWindows7OrGreater()
&& QSysInfo::currentCpuArchitecture().endsWith("64"))
? "Windows x64" : "Windows"};
#endif

2
src/gui/properties/propertieswidget.cpp

@ -97,7 +97,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent) @@ -97,7 +97,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
// SIGNAL/SLOTS
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->selectNoneButton, &QPushButton::clicked, m_propListModel, &TorrentContentFilterModel::selectNone);
connect(m_ui->filesList, &QWidget::customContextMenuRequested, this, &PropertiesWidget::displayFilesListMenu);

2
src/gui/properties/proptabbar.cpp

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

2
src/gui/properties/speedwidget.cpp

@ -75,7 +75,7 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent) @@ -75,7 +75,7 @@ SpeedWidget::SpeedWidget(PropertiesWidget *parent)
m_periodCombobox->addItem(tr("12 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);
m_graphsMenu = new QMenu(this);

2
src/gui/rss/automatedrssdownloader.cpp

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

14
src/gui/search/searchjobwidget.cpp

@ -135,23 +135,23 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent) @@ -135,23 +135,23 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
m_ui->horizontalLayout->insertWidget(0, m_lineEditSearchResultsFilter);
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);
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);
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);
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);
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);
connect(m_ui->minSizeUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
connect(m_ui->minSizeUnit, qOverload<int>(&QComboBox::currentIndexChanged)
, 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);
connect(m_ui->resultsBrowser, &QAbstractItemView::doubleClicked, this, &SearchJobWidget::onItemDoubleClicked);

4
src/gui/search/searchwidget.cpp

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

2
src/gui/speedlimitdialog.cpp

@ -39,7 +39,7 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent) @@ -39,7 +39,7 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
// Connect to slots
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);
Utils::Gui::resize(this);

7
src/gui/transferlistfilterswidget.cpp

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

2
src/gui/updownratiodialog.cpp

@ -69,7 +69,7 @@ UpDownRatioDialog::UpDownRatioDialog(bool useDefault, qreal initialRatioValue, @@ -69,7 +69,7 @@ UpDownRatioDialog::UpDownRatioDialog(bool useDefault, qreal initialRatioValue,
m_ui->timeSpinBox->setMaximum(maxTimeValue);
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);
connect(m_ui->checkMaxRatio, &QCheckBox::toggled, this, &UpDownRatioDialog::enableRatioSpin);
connect(m_ui->checkMaxTime, &QCheckBox::toggled, this, &UpDownRatioDialog::enableTimeSpin);

Loading…
Cancel
Save