mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 05:48:47 +03:00
commit
3811612f80
31 changed files with 639 additions and 484 deletions
|
@ -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()
|
||||||
{
|
{
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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.");
|
||||||
|
|
|
@ -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
|
class QtLockedFile : public QFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum LockMode { NoLock = 0, ReadLock, WriteLock };
|
enum LockMode
|
||||||
|
{
|
||||||
|
NoLock = 0,
|
||||||
|
ReadLock,
|
||||||
|
WriteLock
|
||||||
|
};
|
||||||
|
|
||||||
QtLockedFile();
|
QtLockedFile();
|
||||||
QtLockedFile(const QString &name);
|
QtLockedFile(const QString &name);
|
||||||
|
@ -66,16 +100,17 @@ public:
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -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,15 +63,16 @@
|
||||||
**
|
**
|
||||||
** $QT_END_LICENSE$
|
** $QT_END_LICENSE$
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************
|
||||||
|
*/
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "qtlockedfile.h"
|
#include "qtlockedfile.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
bool QtLockedFile::lock(LockMode mode, bool block)
|
bool QtLockedFile::lock(LockMode mode, bool block)
|
||||||
{
|
{
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()) {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,17 @@
|
||||||
#include "../rss_article.h"
|
#include "../rss_article.h"
|
||||||
|
|
||||||
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", " "}, // no-break space = non-breaking space, U+00A0 ISOnum
|
{"nbsp", " "}, // no-break space = non-breaking space, U+00A0 ISOnum
|
||||||
{"iexcl", "¡"}, // inverted exclamation mark, U+00A1 ISOnum
|
{"iexcl", "¡"}, // inverted exclamation mark, U+00A1 ISOnum
|
||||||
{"cent", "¢"}, // cent sign, U+00A2 ISOnum
|
{"cent", "¢"}, // cent sign, U+00A2 ISOnum
|
||||||
|
@ -347,38 +351,30 @@ namespace
|
||||||
{"clubs", "♣"}, // black club suit = shamrock, U+2663 ISOpub
|
{"clubs", "♣"}, // black club suit = shamrock, U+2663 ISOpub
|
||||||
{"hearts", "♥"}, // black heart suit = valentine, U+2665 ISOpub
|
{"hearts", "♥"}, // black heart suit = valentine, U+2665 ISOpub
|
||||||
{"diams", "♦"} // black diamond suit, U+2666 ISOpub
|
{"diams", "♦"} // 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();
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 \
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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()))
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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…
Reference in a new issue