mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-08 21:04:26 +00:00
commit
d2c21ce507
@ -306,7 +306,7 @@ Example:
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#ifdef Q_OS_MAC // conditional
|
#ifdef Q_OS_MACOS // conditional
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
|
|||||||
if (APPLE)
|
if (APPLE)
|
||||||
# Workaround CMake bug (autogen does not pass required parameters to moc)
|
# Workaround CMake bug (autogen does not pass required parameters to moc)
|
||||||
# Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
|
# Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
|
||||||
list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MAC -DQ_OS_DARWIN)
|
list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MACOS -DQ_OS_DARWIN)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
@ -56,9 +56,9 @@
|
|||||||
#include <QSessionManager>
|
#include <QSessionManager>
|
||||||
#include <QSharedMemory>
|
#include <QSharedMemory>
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
@ -121,7 +121,9 @@ namespace
|
|||||||
const int MAX_FILELOG_SIZE = 1000 * 1024 * 1024; // 1000MiB
|
const int MAX_FILELOG_SIZE = 1000 * 1024 * 1024; // 1000MiB
|
||||||
const int DEFAULT_FILELOG_SIZE = 65 * 1024; // 65KiB
|
const int DEFAULT_FILELOG_SIZE = 65 * 1024; // 65KiB
|
||||||
|
|
||||||
|
#if !defined(DISABLE_GUI)
|
||||||
const int PIXMAP_CACHE_SIZE = 64 * 1024 * 1024; // 64MiB
|
const int PIXMAP_CACHE_SIZE = 64 * 1024 * 1024; // 64MiB
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::Application(const QString &id, int &argc, char **argv)
|
Application::Application(const QString &id, int &argc, char **argv)
|
||||||
@ -586,7 +588,7 @@ bool Application::isRunning()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
bool Application::event(QEvent *ev)
|
bool Application::event(QEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->type() == QEvent::FileOpen) {
|
if (ev->type() == QEvent::FileOpen) {
|
||||||
@ -605,7 +607,7 @@ bool Application::event(QEvent *ev)
|
|||||||
return BaseApplication::event(ev);
|
return BaseApplication::event(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
#endif // DISABLE_GUI
|
#endif // DISABLE_GUI
|
||||||
|
|
||||||
void Application::initializeTranslation()
|
void Application::initializeTranslation()
|
||||||
|
@ -105,7 +105,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
bool event(QEvent *) override;
|
bool event(QEvent *) override;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,7 +221,7 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MACOS)
|
||||||
// Since Apple made difficult for users to set PATH, we set here for convenience.
|
// Since Apple made difficult for users to set PATH, we set here for convenience.
|
||||||
// Users are supposed to install Homebrew Python for search function.
|
// Users are supposed to install Homebrew Python for search function.
|
||||||
// For more info see issue #5571.
|
// For more info see issue #5571.
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
|
#if defined(Q_OS_MACOS) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -188,7 +188,7 @@ void Preferences::setHideZeroComboValues(const int n)
|
|||||||
|
|
||||||
// In Mac OS X the dock is sufficient for our needs so we disable the sys tray functionality.
|
// In Mac OS X the dock is sufficient for our needs so we disable the sys tray functionality.
|
||||||
// See extensive discussion in https://github.com/qbittorrent/qBittorrent/pull/3018
|
// See extensive discussion in https://github.com/qbittorrent/qBittorrent/pull/3018
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
bool Preferences::systrayIntegration() const
|
bool Preferences::systrayIntegration() const
|
||||||
{
|
{
|
||||||
return value("Preferences/General/SystrayEnabled", true).toBool();
|
return value("Preferences/General/SystrayEnabled", true).toBool();
|
||||||
@ -238,7 +238,7 @@ void Preferences::setCloseToTrayNotified(const bool b)
|
|||||||
{
|
{
|
||||||
setValue("Preferences/General/CloseToTrayNotified", b);
|
setValue("Preferences/General/CloseToTrayNotified", b);
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
bool Preferences::isToolbarDisplayed() const
|
bool Preferences::isToolbarDisplayed() const
|
||||||
{
|
{
|
||||||
@ -884,7 +884,7 @@ void Preferences::resolvePeerHostNames(const bool resolve)
|
|||||||
setValue("Preferences/Connection/ResolvePeerHostNames", resolve);
|
setValue("Preferences/Connection/ResolvePeerHostNames", resolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
bool Preferences::useSystemIconTheme() const
|
bool Preferences::useSystemIconTheme() const
|
||||||
{
|
{
|
||||||
return value("Preferences/Advanced/useSystemIconTheme", true).toBool();
|
return value("Preferences/Advanced/useSystemIconTheme", true).toBool();
|
||||||
@ -988,7 +988,7 @@ void Preferences::setMagnetLinkAssoc(const bool set)
|
|||||||
}
|
}
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const CFStringRef torrentExtension = CFSTR("torrent");
|
const CFStringRef torrentExtension = CFSTR("torrent");
|
||||||
@ -1042,7 +1042,7 @@ void Preferences::setMagnetLinkAssoc()
|
|||||||
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||||
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
|
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
int Preferences::getTrackerPort() const
|
int Preferences::getTrackerPort() const
|
||||||
{
|
{
|
||||||
@ -1054,7 +1054,7 @@ void Preferences::setTrackerPort(const int port)
|
|||||||
setValue("Preferences/Advanced/trackerPort", port);
|
setValue("Preferences/Advanced/trackerPort", port);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
bool Preferences::isUpdateCheckEnabled() const
|
bool Preferences::isUpdateCheckEnabled() const
|
||||||
{
|
{
|
||||||
return value("Preferences/Advanced/updateCheck", true).toBool();
|
return value("Preferences/Advanced/updateCheck", true).toBool();
|
||||||
@ -1096,7 +1096,7 @@ void Preferences::setConfirmRemoveAllTags(const bool enabled)
|
|||||||
setValue("Preferences/Advanced/confirmRemoveAllTags", enabled);
|
setValue("Preferences/Advanced/confirmRemoveAllTags", enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
TrayIcon::Style Preferences::trayIconStyle() const
|
TrayIcon::Style Preferences::trayIconStyle() const
|
||||||
{
|
{
|
||||||
return TrayIcon::Style(value("Preferences/Advanced/TrayIconStyle", TrayIcon::NORMAL).toInt());
|
return TrayIcon::Style(value("Preferences/Advanced/TrayIconStyle", TrayIcon::NORMAL).toInt());
|
||||||
|
@ -254,7 +254,7 @@ public:
|
|||||||
void resolvePeerCountries(bool resolve);
|
void resolvePeerCountries(bool resolve);
|
||||||
bool resolvePeerHostNames() const;
|
bool resolvePeerHostNames() const;
|
||||||
void resolvePeerHostNames(bool resolve);
|
void resolvePeerHostNames(bool resolve);
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
bool useSystemIconTheme() const;
|
bool useSystemIconTheme() const;
|
||||||
void useSystemIconTheme(bool enabled);
|
void useSystemIconTheme(bool enabled);
|
||||||
#endif
|
#endif
|
||||||
@ -268,7 +268,7 @@ public:
|
|||||||
static void setTorrentFileAssoc(bool set);
|
static void setTorrentFileAssoc(bool set);
|
||||||
static void setMagnetLinkAssoc(bool set);
|
static void setMagnetLinkAssoc(bool set);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
static bool isTorrentFileAssocSet();
|
static bool isTorrentFileAssocSet();
|
||||||
static bool isMagnetLinkAssocSet();
|
static bool isMagnetLinkAssocSet();
|
||||||
static void setTorrentFileAssoc();
|
static void setTorrentFileAssoc();
|
||||||
@ -276,7 +276,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
int getTrackerPort() const;
|
int getTrackerPort() const;
|
||||||
void setTrackerPort(int port);
|
void setTrackerPort(int port);
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
bool isUpdateCheckEnabled() const;
|
bool isUpdateCheckEnabled() const;
|
||||||
void setUpdateCheckEnabled(bool enabled);
|
void setUpdateCheckEnabled(bool enabled);
|
||||||
#endif
|
#endif
|
||||||
@ -286,7 +286,7 @@ public:
|
|||||||
void setConfirmTorrentRecheck(bool enabled);
|
void setConfirmTorrentRecheck(bool enabled);
|
||||||
bool confirmRemoveAllTags() const;
|
bool confirmRemoveAllTags() const;
|
||||||
void setConfirmRemoveAllTags(bool enabled);
|
void setConfirmRemoveAllTags(bool enabled);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
bool systrayIntegration() const;
|
bool systrayIntegration() const;
|
||||||
void setSystrayIntegration(bool enabled);
|
void setSystrayIntegration(bool enabled);
|
||||||
bool minimizeToTrayNotified() const;
|
bool minimizeToTrayNotified() const;
|
||||||
@ -299,7 +299,7 @@ public:
|
|||||||
void setCloseToTrayNotified(bool b);
|
void setCloseToTrayNotified(bool b);
|
||||||
TrayIcon::Style trayIconStyle() const;
|
TrayIcon::Style trayIconStyle() const;
|
||||||
void setTrayIconStyle(TrayIcon::Style style);
|
void setTrayIconStyle(TrayIcon::Style style);
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
// Stuff that don't appear in the Options GUI but are saved
|
// Stuff that don't appear in the Options GUI but are saved
|
||||||
// in the same file.
|
// in the same file.
|
||||||
|
@ -73,7 +73,7 @@ QString Private::DefaultProfile::configLocation() const
|
|||||||
|
|
||||||
QString Private::DefaultProfile::dataLocation() const
|
QString Private::DefaultProfile::dataLocation() const
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN) || defined (Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined (Q_OS_MACOS)
|
||||||
return locationWithConfigurationName(QStandardPaths::AppLocalDataLocation);
|
return locationWithConfigurationName(QStandardPaths::AppLocalDataLocation);
|
||||||
#else
|
#else
|
||||||
// on Linux gods know why qBittorrent creates 'data' subdirectory in ~/.local/share/
|
// on Linux gods know why qBittorrent creates 'data' subdirectory in ~/.local/share/
|
||||||
@ -89,7 +89,7 @@ QString Private::DefaultProfile::downloadLocation() const
|
|||||||
|
|
||||||
SettingsPtr Private::DefaultProfile::applicationSettings(const QString &name) const
|
SettingsPtr Private::DefaultProfile::applicationSettings(const QString &name) const
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
return SettingsPtr(new QSettings(QSettings::IniFormat, QSettings::UserScope, profileName(), name));
|
return SettingsPtr(new QSettings(QSettings::IniFormat, QSettings::UserScope, profileName(), name));
|
||||||
#else
|
#else
|
||||||
return SettingsPtr(new QSettings(profileName(), name));
|
return SettingsPtr(new QSettings(profileName(), name));
|
||||||
@ -135,7 +135,7 @@ QString Private::CustomProfile::downloadLocation() const
|
|||||||
SettingsPtr Private::CustomProfile::applicationSettings(const QString &name) const
|
SettingsPtr Private::CustomProfile::applicationSettings(const QString &name) const
|
||||||
{
|
{
|
||||||
// here we force QSettings::IniFormat format always because we need it to be portable across platforms
|
// here we force QSettings::IniFormat format always because we need it to be portable across platforms
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
constexpr const char *CONF_FILE_EXTENSION = ".ini";
|
constexpr const char *CONF_FILE_EXTENSION = ".ini";
|
||||||
#else
|
#else
|
||||||
constexpr const char *CONF_FILE_EXTENSION = ".conf";
|
constexpr const char *CONF_FILE_EXTENSION = ".conf";
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#elif defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
|
#elif defined(Q_OS_MACOS) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#elif defined(Q_OS_HAIKU)
|
#elif defined(Q_OS_HAIKU)
|
||||||
@ -321,7 +321,7 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (::GetDriveTypeW(volumePath.get()) == DRIVE_REMOTE);
|
return (::GetDriveTypeW(volumePath.get()) == DRIVE_REMOTE);
|
||||||
#elif defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
|
#elif defined(Q_OS_MACOS) || defined(Q_OS_OPENBSD)
|
||||||
QString file = path;
|
QString file = path;
|
||||||
if (!file.endsWith('/'))
|
if (!file.endsWith('/'))
|
||||||
file += '/';
|
file += '/';
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#endif
|
#endif
|
||||||
@ -51,7 +51,7 @@
|
|||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
|
|||||||
tkp.Privileges[0].Attributes = 0;
|
tkp.Privileges[0].Attributes = 0;
|
||||||
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES) NULL, 0);
|
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES) NULL, 0);
|
||||||
|
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MACOS)
|
||||||
AEEventID EventToSend;
|
AEEventID EventToSend;
|
||||||
if (action != ShutdownDialogAction::Shutdown)
|
if (action != ShutdownDialogAction::Shutdown)
|
||||||
EventToSend = kAESleep;
|
EventToSend = kAESleep;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include <QThreadStorage>
|
#include <QThreadStorage>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ int Utils::String::naturalCompare(const QString &left, const QString &right, con
|
|||||||
// provide a single `NaturalCompare` instance for easy use
|
// provide a single `NaturalCompare` instance for easy use
|
||||||
// https://doc.qt.io/qt-5/threads-reentrancy.html
|
// https://doc.qt.io/qt-5/threads-reentrancy.html
|
||||||
if (caseSensitivity == Qt::CaseSensitive) {
|
if (caseSensitivity == Qt::CaseSensitive) {
|
||||||
#ifdef Q_OS_MAC // workaround for Apple xcode: https://stackoverflow.com/a/29929949
|
#ifdef Q_OS_MACOS // workaround for Apple xcode: https://stackoverflow.com/a/29929949
|
||||||
static QThreadStorage<NaturalCompare> nCmp;
|
static QThreadStorage<NaturalCompare> nCmp;
|
||||||
if (!nCmp.hasLocalData())
|
if (!nCmp.hasLocalData())
|
||||||
nCmp.setLocalData(NaturalCompare(Qt::CaseSensitive));
|
nCmp.setLocalData(NaturalCompare(Qt::CaseSensitive));
|
||||||
@ -150,7 +150,7 @@ int Utils::String::naturalCompare(const QString &left, const QString &right, con
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
static QThreadStorage<NaturalCompare> nCmp;
|
static QThreadStorage<NaturalCompare> nCmp;
|
||||||
if (!nCmp.hasLocalData())
|
if (!nCmp.hasLocalData())
|
||||||
nCmp.setLocalData(NaturalCompare(Qt::CaseInsensitive));
|
nCmp.setLocalData(NaturalCompare(Qt::CaseInsensitive));
|
||||||
|
@ -80,7 +80,7 @@ enum AdvSettingsRows
|
|||||||
DOWNLOAD_TRACKER_FAVICON,
|
DOWNLOAD_TRACKER_FAVICON,
|
||||||
SAVE_PATH_HISTORY_LENGTH,
|
SAVE_PATH_HISTORY_LENGTH,
|
||||||
ENABLE_SPEED_WIDGET,
|
ENABLE_SPEED_WIDGET,
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
USE_ICON_THEME,
|
USE_ICON_THEME,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ void AdvancedSettings::saveAdvancedSettings()
|
|||||||
session->setSeedChokingAlgorithm(static_cast<BitTorrent::SeedChokingAlgorithm>(m_comboBoxSeedChokingAlgorithm.currentIndex()));
|
session->setSeedChokingAlgorithm(static_cast<BitTorrent::SeedChokingAlgorithm>(m_comboBoxSeedChokingAlgorithm.currentIndex()));
|
||||||
|
|
||||||
// Icon theme
|
// Icon theme
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
pref->useSystemIconTheme(m_checkBoxUseIconTheme.isChecked());
|
pref->useSystemIconTheme(m_checkBoxUseIconTheme.isChecked());
|
||||||
#endif
|
#endif
|
||||||
pref->setConfirmTorrentRecheck(m_checkBoxConfirmTorrentRecheck.isChecked());
|
pref->setConfirmTorrentRecheck(m_checkBoxConfirmTorrentRecheck.isChecked());
|
||||||
@ -515,7 +515,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
addRow(SEED_CHOKING_ALGORITHM, (tr("Upload choking algorithm") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#seed_choking_algorithm", "(?)"))
|
addRow(SEED_CHOKING_ALGORITHM, (tr("Upload choking algorithm") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#seed_choking_algorithm", "(?)"))
|
||||||
, &m_comboBoxSeedChokingAlgorithm);
|
, &m_comboBoxSeedChokingAlgorithm);
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
m_checkBoxUseIconTheme.setChecked(pref->useSystemIconTheme());
|
m_checkBoxUseIconTheme.setChecked(pref->useSystemIconTheme());
|
||||||
addRow(USE_ICON_THEME, tr("Use system icon theme"), &m_checkBoxUseIconTheme);
|
addRow(USE_ICON_THEME, tr("Use system icon theme"), &m_checkBoxUseIconTheme);
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,7 +69,7 @@ private:
|
|||||||
QLineEdit m_lineEditAnnounceIP;
|
QLineEdit m_lineEditAnnounceIP;
|
||||||
|
|
||||||
// OS dependent settings
|
// OS dependent settings
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
QCheckBox m_checkBoxUseIconTheme;
|
QCheckBox m_checkBoxUseIconTheme;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -69,7 +69,7 @@ CategoryFilterWidget::CategoryFilterWidget(QWidget *parent)
|
|||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
setHeaderHidden(true);
|
setHeaderHidden(true);
|
||||||
setIconSize(Utils::Gui::smallIconSize());
|
setIconSize(Utils::Gui::smallIconSize());
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
#endif
|
#endif
|
||||||
m_defaultIndentation = indentation();
|
m_defaultIndentation = indentation();
|
||||||
|
@ -44,7 +44,7 @@ ExecutionLogWidget::ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &typ
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon("view-calendar-journal"));
|
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon("view-calendar-journal"));
|
||||||
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon("view-filter"));
|
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon("view-filter"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <QTabBar>
|
#include <QTabBar>
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#endif
|
#endif
|
||||||
@ -53,7 +53,7 @@ void HidableTabWidget::tabRemoved(const int index)
|
|||||||
tabBar()->setVisible(count() != 1);
|
tabBar()->setVisible(count() != 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
void HidableTabWidget::paintEvent(QPaintEvent *event)
|
void HidableTabWidget::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
// Hide the pane for macintosh style
|
// Hide the pane for macintosh style
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
class QPaintEvent;
|
class QPaintEvent;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ private:
|
|||||||
void tabInserted(int index) override;
|
void tabInserted(int index) override;
|
||||||
void tabRemoved(int index) override;
|
void tabRemoved(int index) override;
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -43,11 +43,11 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include <QtMac>
|
#include <QtMac>
|
||||||
#include <QtMacExtras>
|
#include <QtMacExtras>
|
||||||
#endif
|
#endif
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include "notifications.h"
|
#include "notifications.h"
|
||||||
#endif
|
#endif
|
||||||
@ -92,10 +92,10 @@
|
|||||||
#include "uithememanager.h"
|
#include "uithememanager.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include "macutilities.h"
|
#include "macutilities.h"
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
#include "programupdater.h"
|
#include "programupdater.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
, m_posInitialized(false)
|
, m_posInitialized(false)
|
||||||
, m_forceExit(false)
|
, m_forceExit(false)
|
||||||
, m_unlockDlgShowing(false)
|
, m_unlockDlgShowing(false)
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
, m_wasUpdateCheckEnabled(false)
|
, m_wasUpdateCheckEnabled(false)
|
||||||
#endif
|
#endif
|
||||||
, m_hasPython(false)
|
, m_hasPython(false)
|
||||||
@ -144,7 +144,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
setWindowTitle("qBittorrent " QBT_VERSION);
|
setWindowTitle("qBittorrent " QBT_VERSION);
|
||||||
m_displaySpeedInTitle = pref->speedInTitleBar();
|
m_displaySpeedInTitle = pref->speedInTitleBar();
|
||||||
// Setting icons
|
// Setting icons
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
const QIcon appLogo = Preferences::instance()->useSystemIconTheme()
|
const QIcon appLogo = Preferences::instance()->useSystemIconTheme()
|
||||||
? QIcon::fromTheme("qbittorrent", QIcon(":/icons/skin/qbittorrent-tray.svg"))
|
? QIcon::fromTheme("qbittorrent", QIcon(":/icons/skin/qbittorrent-tray.svg"))
|
||||||
@ -153,7 +153,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
const QIcon appLogo(":/icons/skin/qbittorrent-tray.svg");
|
const QIcon appLogo(":/icons/skin/qbittorrent-tray.svg");
|
||||||
#endif // Q_OS_UNIX
|
#endif // Q_OS_UNIX
|
||||||
setWindowIcon(appLogo);
|
setWindowIcon(appLogo);
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX))
|
#if (defined(Q_OS_UNIX))
|
||||||
m_ui->actionOptions->setText(tr("Preferences"));
|
m_ui->actionOptions->setText(tr("Preferences"));
|
||||||
@ -239,7 +239,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
m_splitter->setCollapsible(0, true);
|
m_splitter->setCollapsible(0, true);
|
||||||
m_splitter->setCollapsible(1, false);
|
m_splitter->setCollapsible(1, false);
|
||||||
m_tabs->addTab(m_splitter,
|
m_tabs->addTab(m_splitter,
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("folder-remote"),
|
UIThemeManager::instance()->getIcon("folder-remote"),
|
||||||
#endif
|
#endif
|
||||||
tr("Transfers"));
|
tr("Transfers"));
|
||||||
@ -259,7 +259,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerWarning
|
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerWarning
|
||||||
, m_transferListFiltersWidget, qOverload<BitTorrent::TorrentHandle *const, const QString &>(&TransferListFiltersWidget::trackerWarning));
|
, m_transferListFiltersWidget, qOverload<BitTorrent::TorrentHandle *const, const QString &>(&TransferListFiltersWidget::trackerWarning));
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
// Increase top spacing to avoid tab overlapping
|
// Increase top spacing to avoid tab overlapping
|
||||||
m_ui->centralWidgetLayout->addSpacing(8);
|
m_ui->centralWidgetLayout->addSpacing(8);
|
||||||
#endif
|
#endif
|
||||||
@ -269,7 +269,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
m_queueSeparator = m_ui->toolBar->insertSeparator(m_ui->actionTopQueuePos);
|
m_queueSeparator = m_ui->toolBar->insertSeparator(m_ui->actionTopQueuePos);
|
||||||
m_queueSeparatorMenu = m_ui->menuEdit->insertSeparator(m_ui->actionTopQueuePos);
|
m_queueSeparatorMenu = m_ui->menuEdit->insertSeparator(m_ui->actionTopQueuePos);
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
for (QAction *action : asConst(m_ui->toolBar->actions())) {
|
for (QAction *action : asConst(m_ui->toolBar->actions())) {
|
||||||
if (action->isSeparator()) {
|
if (action->isSeparator()) {
|
||||||
QWidget *spacer = new QWidget(this);
|
QWidget *spacer = new QWidget(this);
|
||||||
@ -291,7 +291,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
spacer->setMinimumWidth(8);
|
spacer->setMinimumWidth(8);
|
||||||
m_ui->toolBar->addWidget(spacer);
|
m_ui->toolBar->addWidget(spacer);
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
// Transfer list slots
|
// Transfer list slots
|
||||||
connect(m_ui->actionStart, &QAction::triggered, m_transferListWidget, &TransferListWidget::startSelectedTorrents);
|
connect(m_ui->actionStart, &QAction::triggered, m_transferListWidget, &TransferListWidget::startSelectedTorrents);
|
||||||
@ -303,13 +303,13 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(m_ui->actionIncreaseQueuePos, &QAction::triggered, m_transferListWidget, &TransferListWidget::increaseQueuePosSelectedTorrents);
|
connect(m_ui->actionIncreaseQueuePos, &QAction::triggered, m_transferListWidget, &TransferListWidget::increaseQueuePosSelectedTorrents);
|
||||||
connect(m_ui->actionDecreaseQueuePos, &QAction::triggered, m_transferListWidget, &TransferListWidget::decreaseQueuePosSelectedTorrents);
|
connect(m_ui->actionDecreaseQueuePos, &QAction::triggered, m_transferListWidget, &TransferListWidget::decreaseQueuePosSelectedTorrents);
|
||||||
connect(m_ui->actionBottomQueuePos, &QAction::triggered, m_transferListWidget, &TransferListWidget::bottomQueuePosSelectedTorrents);
|
connect(m_ui->actionBottomQueuePos, &QAction::triggered, m_transferListWidget, &TransferListWidget::bottomQueuePosSelectedTorrents);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
connect(m_ui->actionToggleVisibility, &QAction::triggered, this, [this]() { toggleVisibility(); });
|
connect(m_ui->actionToggleVisibility, &QAction::triggered, this, [this]() { toggleVisibility(); });
|
||||||
#endif
|
#endif
|
||||||
connect(m_ui->actionMinimize, &QAction::triggered, this, &MainWindow::minimizeWindow);
|
connect(m_ui->actionMinimize, &QAction::triggered, this, &MainWindow::minimizeWindow);
|
||||||
connect(m_ui->actionUseAlternativeSpeedLimits, &QAction::triggered, this, &MainWindow::toggleAlternativeSpeeds);
|
connect(m_ui->actionUseAlternativeSpeedLimits, &QAction::triggered, this, &MainWindow::toggleAlternativeSpeeds);
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
m_programUpdateTimer = new QTimer(this);
|
m_programUpdateTimer = new QTimer(this);
|
||||||
m_programUpdateTimer->setInterval(60 * 60 * 1000);
|
m_programUpdateTimer->setInterval(60 * 60 * 1000);
|
||||||
m_programUpdateTimer->setSingleShot(true);
|
m_programUpdateTimer->setSingleShot(true);
|
||||||
@ -341,7 +341,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
createKeyboardShortcuts();
|
createKeyboardShortcuts();
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
autoShutdownGroup->addAction(m_ui->actionAutoShutdown);
|
autoShutdownGroup->addAction(m_ui->actionAutoShutdown);
|
||||||
autoShutdownGroup->addAction(m_ui->actionAutoSuspend);
|
autoShutdownGroup->addAction(m_ui->actionAutoSuspend);
|
||||||
autoShutdownGroup->addAction(m_ui->actionAutoHibernate);
|
autoShutdownGroup->addAction(m_ui->actionAutoHibernate);
|
||||||
#if (!defined(Q_OS_UNIX) || defined(Q_OS_MAC)) || defined(QT_DBUS_LIB)
|
#if (!defined(Q_OS_UNIX) || defined(Q_OS_MACOS)) || defined(QT_DBUS_LIB)
|
||||||
m_ui->actionAutoShutdown->setChecked(pref->shutdownWhenDownloadsComplete());
|
m_ui->actionAutoShutdown->setChecked(pref->shutdownWhenDownloadsComplete());
|
||||||
m_ui->actionAutoSuspend->setChecked(pref->suspendWhenDownloadsComplete());
|
m_ui->actionAutoSuspend->setChecked(pref->suspendWhenDownloadsComplete());
|
||||||
m_ui->actionAutoHibernate->setChecked(pref->hibernateWhenDownloadsComplete());
|
m_ui->actionAutoHibernate->setChecked(pref->hibernateWhenDownloadsComplete());
|
||||||
@ -393,7 +393,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
// Load Window state and sizes
|
// Load Window state and sizes
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
if (m_systrayIcon) {
|
if (m_systrayIcon) {
|
||||||
if (!(pref->startMinimized() || m_uiLocked)) {
|
if (!(pref->startMinimized() || m_uiLocked)) {
|
||||||
show();
|
show();
|
||||||
@ -422,7 +422,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
activateWindow();
|
activateWindow();
|
||||||
raise();
|
raise();
|
||||||
}
|
}
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
setupDockClickHandler();
|
setupDockClickHandler();
|
||||||
trayIconMenu()->setAsDockMenu();
|
trayIconMenu()->setAsDockMenu();
|
||||||
#endif
|
#endif
|
||||||
@ -669,7 +669,7 @@ void MainWindow::displayRSSTab(bool enable)
|
|||||||
if (!m_rssWidget) {
|
if (!m_rssWidget) {
|
||||||
m_rssWidget = new RSSWidget(m_tabs);
|
m_rssWidget = new RSSWidget(m_tabs);
|
||||||
connect(m_rssWidget.data(), &RSSWidget::unreadCountUpdated, this, &MainWindow::handleRSSUnreadCountUpdated);
|
connect(m_rssWidget.data(), &RSSWidget::unreadCountUpdated, this, &MainWindow::handleRSSUnreadCountUpdated);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
|
m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
|
||||||
#else
|
#else
|
||||||
const int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
|
const int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
|
||||||
@ -707,7 +707,7 @@ void MainWindow::displaySearchTab(bool enable)
|
|||||||
if (!m_searchWidget) {
|
if (!m_searchWidget) {
|
||||||
m_searchWidget = new SearchWidget(this);
|
m_searchWidget = new SearchWidget(this);
|
||||||
m_tabs->insertTab(1, m_searchWidget,
|
m_tabs->insertTab(1, m_searchWidget,
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("edit-find"),
|
UIThemeManager::instance()->getIcon("edit-find"),
|
||||||
#endif
|
#endif
|
||||||
tr("Search"));
|
tr("Search"));
|
||||||
@ -771,13 +771,13 @@ void MainWindow::cleanup()
|
|||||||
delete m_rssWidget;
|
delete m_rssWidget;
|
||||||
|
|
||||||
delete m_executableWatcher;
|
delete m_executableWatcher;
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
if (m_systrayCreator)
|
if (m_systrayCreator)
|
||||||
m_systrayCreator->stop();
|
m_systrayCreator->stop();
|
||||||
#endif
|
#endif
|
||||||
if (m_preventTimer)
|
if (m_preventTimer)
|
||||||
m_preventTimer->stop();
|
m_preventTimer->stop();
|
||||||
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC))
|
#if (defined(Q_OS_WIN) || defined(Q_OS_MACOS))
|
||||||
m_programUpdateTimer->stop();
|
m_programUpdateTimer->stop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -851,7 +851,7 @@ void MainWindow::createKeyboardShortcuts()
|
|||||||
m_ui->actionDelete->setShortcutContext(Qt::WidgetShortcut); // nullify its effect: delete key event is handled by respective widgets, not here
|
m_ui->actionDelete->setShortcutContext(Qt::WidgetShortcut); // nullify its effect: delete key event is handled by respective widgets, not here
|
||||||
m_ui->actionDownloadFromURL->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O);
|
m_ui->actionDownloadFromURL->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O);
|
||||||
m_ui->actionExit->setShortcut(Qt::CTRL + Qt::Key_Q);
|
m_ui->actionExit->setShortcut(Qt::CTRL + Qt::Key_Q);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
m_ui->actionCloseWindow->setShortcut(QKeySequence::Close);
|
m_ui->actionCloseWindow->setShortcut(QKeySequence::Close);
|
||||||
#else
|
#else
|
||||||
m_ui->actionCloseWindow->setVisible(false);
|
m_ui->actionCloseWindow->setVisible(false);
|
||||||
@ -878,7 +878,7 @@ void MainWindow::createKeyboardShortcuts()
|
|||||||
m_ui->actionDecreaseQueuePos->setShortcut(Qt::CTRL + Qt::Key_Minus);
|
m_ui->actionDecreaseQueuePos->setShortcut(Qt::CTRL + Qt::Key_Minus);
|
||||||
m_ui->actionIncreaseQueuePos->setShortcut(Qt::CTRL + Qt::Key_Plus);
|
m_ui->actionIncreaseQueuePos->setShortcut(Qt::CTRL + Qt::Key_Plus);
|
||||||
m_ui->actionTopQueuePos->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Plus);
|
m_ui->actionTopQueuePos->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Plus);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
m_ui->actionMinimize->setShortcut(Qt::CTRL + Qt::Key_M);
|
m_ui->actionMinimize->setShortcut(Qt::CTRL + Qt::Key_M);
|
||||||
addAction(m_ui->actionMinimize);
|
addAction(m_ui->actionMinimize);
|
||||||
#endif
|
#endif
|
||||||
@ -998,7 +998,7 @@ void MainWindow::on_actionExit_triggered()
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
void MainWindow::on_actionCloseWindow_triggered()
|
void MainWindow::on_actionCloseWindow_triggered()
|
||||||
{
|
{
|
||||||
// On macOS window close is basically equivalent to window hide.
|
// On macOS window close is basically equivalent to window hide.
|
||||||
@ -1057,7 +1057,7 @@ void MainWindow::notifyOfUpdate(const QString &)
|
|||||||
m_executableWatcher = nullptr;
|
m_executableWatcher = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
// Toggle Main window visibility
|
// Toggle Main window visibility
|
||||||
void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason)
|
void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason)
|
||||||
{
|
{
|
||||||
@ -1084,7 +1084,7 @@ void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
// Display About Dialog
|
// Display About Dialog
|
||||||
void MainWindow::on_actionAbout_triggered()
|
void MainWindow::on_actionAbout_triggered()
|
||||||
@ -1124,7 +1124,7 @@ void MainWindow::showEvent(QShowEvent *e)
|
|||||||
void MainWindow::closeEvent(QCloseEvent *e)
|
void MainWindow::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
Preferences *const pref = Preferences::instance();
|
Preferences *const pref = Preferences::instance();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
if (!m_forceExit) {
|
if (!m_forceExit) {
|
||||||
hide();
|
hide();
|
||||||
e->accept();
|
e->accept();
|
||||||
@ -1141,7 +1141,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
if (pref->confirmOnExit() && BitTorrent::Session::instance()->hasActiveTorrents()) {
|
if (pref->confirmOnExit() && BitTorrent::Session::instance()->hasActiveTorrents()) {
|
||||||
if (e->spontaneous() || m_forceExit) {
|
if (e->spontaneous() || m_forceExit) {
|
||||||
@ -1173,7 +1173,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
|||||||
delete m_searchWidget;
|
delete m_searchWidget;
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
// Hide tray icon
|
// Hide tray icon
|
||||||
if (m_systrayIcon)
|
if (m_systrayIcon)
|
||||||
m_systrayIcon->hide();
|
m_systrayIcon->hide();
|
||||||
@ -1201,7 +1201,7 @@ void MainWindow::createTorrentTriggered(const QString &path)
|
|||||||
|
|
||||||
bool MainWindow::event(QEvent *e)
|
bool MainWindow::event(QEvent *e)
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
case QEvent::WindowStateChange: {
|
case QEvent::WindowStateChange: {
|
||||||
qDebug("Window change event");
|
qDebug("Window change event");
|
||||||
@ -1246,7 +1246,7 @@ bool MainWindow::event(QEvent *e)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
return QMainWindow::event(e);
|
return QMainWindow::event(e);
|
||||||
}
|
}
|
||||||
@ -1313,7 +1313,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
|
|||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
|
|
||||||
static MainWindow *dockMainWindowHandle;
|
static MainWindow *dockMainWindowHandle;
|
||||||
|
|
||||||
@ -1335,7 +1335,7 @@ void MainWindow::setupDockClickHandler()
|
|||||||
MacUtils::overrideDockClickHandler(dockClickHandler);
|
MacUtils::overrideDockClickHandler(dockClickHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* *
|
* *
|
||||||
@ -1405,7 +1405,7 @@ void MainWindow::loadPreferences(bool configureSession)
|
|||||||
{
|
{
|
||||||
Logger::instance()->addMessage(tr("Options were saved successfully."));
|
Logger::instance()->addMessage(tr("Options were saved successfully."));
|
||||||
const Preferences *const pref = Preferences::instance();
|
const Preferences *const pref = Preferences::instance();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
Q_UNUSED(configureSession);
|
Q_UNUSED(configureSession);
|
||||||
#else
|
#else
|
||||||
const bool newSystrayIntegration = pref->systrayIntegration();
|
const bool newSystrayIntegration = pref->systrayIntegration();
|
||||||
@ -1472,7 +1472,7 @@ void MainWindow::loadPreferences(bool configureSession)
|
|||||||
m_ui->actionIncreaseQueuePos->setVisible(true);
|
m_ui->actionIncreaseQueuePos->setVisible(true);
|
||||||
m_ui->actionTopQueuePos->setVisible(true);
|
m_ui->actionTopQueuePos->setVisible(true);
|
||||||
m_ui->actionBottomQueuePos->setVisible(true);
|
m_ui->actionBottomQueuePos->setVisible(true);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
m_queueSeparator->setVisible(true);
|
m_queueSeparator->setVisible(true);
|
||||||
#endif
|
#endif
|
||||||
m_queueSeparatorMenu->setVisible(true);
|
m_queueSeparatorMenu->setVisible(true);
|
||||||
@ -1485,7 +1485,7 @@ void MainWindow::loadPreferences(bool configureSession)
|
|||||||
m_ui->actionIncreaseQueuePos->setVisible(false);
|
m_ui->actionIncreaseQueuePos->setVisible(false);
|
||||||
m_ui->actionTopQueuePos->setVisible(false);
|
m_ui->actionTopQueuePos->setVisible(false);
|
||||||
m_ui->actionBottomQueuePos->setVisible(false);
|
m_ui->actionBottomQueuePos->setVisible(false);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
m_queueSeparator->setVisible(false);
|
m_queueSeparator->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
m_queueSeparatorMenu->setVisible(false);
|
m_queueSeparatorMenu->setVisible(false);
|
||||||
@ -1495,7 +1495,7 @@ void MainWindow::loadPreferences(bool configureSession)
|
|||||||
// Torrent properties
|
// Torrent properties
|
||||||
m_propertiesWidget->reloadPreferences();
|
m_propertiesWidget->reloadPreferences();
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
if (pref->isUpdateCheckEnabled() && !m_wasUpdateCheckEnabled) {
|
if (pref->isUpdateCheckEnabled() && !m_wasUpdateCheckEnabled) {
|
||||||
m_wasUpdateCheckEnabled = true;
|
m_wasUpdateCheckEnabled = true;
|
||||||
checkProgramUpdate();
|
checkProgramUpdate();
|
||||||
@ -1518,7 +1518,7 @@ void MainWindow::updateGUI()
|
|||||||
const BitTorrent::SessionStatus &status = BitTorrent::Session::instance()->status();
|
const BitTorrent::SessionStatus &status = BitTorrent::Session::instance()->status();
|
||||||
|
|
||||||
// update global information
|
// update global information
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
if (m_systrayIcon) {
|
if (m_systrayIcon) {
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
const QString html = QString(QLatin1String(
|
const QString html = QString(QLatin1String(
|
||||||
@ -1547,7 +1547,7 @@ void MainWindow::updateGUI()
|
|||||||
.arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate)));
|
.arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate)));
|
||||||
else if (!QtMac::badgeLabelText().isEmpty())
|
else if (!QtMac::badgeLabelText().isEmpty())
|
||||||
QtMac::setBadgeLabelText("");
|
QtMac::setBadgeLabelText("");
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
if (m_displaySpeedInTitle) {
|
if (m_displaySpeedInTitle) {
|
||||||
setWindowTitle(tr("[D: %1, U: %2] qBittorrent %3", "D = Download; U = Upload; %3 is qBittorrent version")
|
setWindowTitle(tr("[D: %1, U: %2] qBittorrent %3", "D = Download; U = Upload; %3 is qBittorrent version")
|
||||||
@ -1560,7 +1560,7 @@ void MainWindow::updateGUI()
|
|||||||
void MainWindow::showNotificationBaloon(const QString &title, const QString &msg) const
|
void MainWindow::showNotificationBaloon(const QString &title, const QString &msg) const
|
||||||
{
|
{
|
||||||
if (!isNotificationsEnabled()) return;
|
if (!isNotificationsEnabled()) return;
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
org::freedesktop::Notifications notifications("org.freedesktop.Notifications",
|
org::freedesktop::Notifications notifications("org.freedesktop.Notifications",
|
||||||
"/org/freedesktop/Notifications",
|
"/org/freedesktop/Notifications",
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
@ -1580,7 +1580,7 @@ void MainWindow::showNotificationBaloon(const QString &title, const QString &msg
|
|||||||
reply.waitForFinished();
|
reply.waitForFinished();
|
||||||
if (!reply.isError())
|
if (!reply.isError())
|
||||||
return;
|
return;
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MACOS)
|
||||||
MacUtils::displayNotification(title, msg);
|
MacUtils::displayNotification(title, msg);
|
||||||
#else
|
#else
|
||||||
if (m_systrayIcon && QSystemTrayIcon::supportsMessages())
|
if (m_systrayIcon && QSystemTrayIcon::supportsMessages())
|
||||||
@ -1611,7 +1611,7 @@ void MainWindow::downloadFromURLList(const QStringList &urlList)
|
|||||||
* *
|
* *
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
void MainWindow::createSystrayDelayed()
|
void MainWindow::createSystrayDelayed()
|
||||||
{
|
{
|
||||||
static int timeout = 20;
|
static int timeout = 20;
|
||||||
@ -1654,14 +1654,14 @@ void MainWindow::createTrayIcon()
|
|||||||
connect(m_systrayIcon.data(), &QSystemTrayIcon::activated, this, &MainWindow::toggleVisibility);
|
connect(m_systrayIcon.data(), &QSystemTrayIcon::activated, this, &MainWindow::toggleVisibility);
|
||||||
m_systrayIcon->show();
|
m_systrayIcon->show();
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
QMenu *MainWindow::trayIconMenu()
|
QMenu *MainWindow::trayIconMenu()
|
||||||
{
|
{
|
||||||
if (m_trayIconMenu) return m_trayIconMenu;
|
if (m_trayIconMenu) return m_trayIconMenu;
|
||||||
|
|
||||||
m_trayIconMenu = new QMenu(this);
|
m_trayIconMenu = new QMenu(this);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
connect(m_trayIconMenu.data(), &QMenu::aboutToShow, this, &MainWindow::updateTrayIconMenu);
|
connect(m_trayIconMenu.data(), &QMenu::aboutToShow, this, &MainWindow::updateTrayIconMenu);
|
||||||
m_trayIconMenu->addAction(m_ui->actionToggleVisibility);
|
m_trayIconMenu->addAction(m_ui->actionToggleVisibility);
|
||||||
m_trayIconMenu->addSeparator();
|
m_trayIconMenu->addSeparator();
|
||||||
@ -1678,7 +1678,7 @@ QMenu *MainWindow::trayIconMenu()
|
|||||||
m_trayIconMenu->addSeparator();
|
m_trayIconMenu->addSeparator();
|
||||||
m_trayIconMenu->addAction(m_ui->actionStartAll);
|
m_trayIconMenu->addAction(m_ui->actionStartAll);
|
||||||
m_trayIconMenu->addAction(m_ui->actionPauseAll);
|
m_trayIconMenu->addAction(m_ui->actionPauseAll);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
m_trayIconMenu->addSeparator();
|
m_trayIconMenu->addSeparator();
|
||||||
m_trayIconMenu->addAction(m_ui->actionExit);
|
m_trayIconMenu->addAction(m_ui->actionExit);
|
||||||
#endif
|
#endif
|
||||||
@ -1803,7 +1803,7 @@ void MainWindow::on_actionDownloadFromURL_triggered()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVersion, bool invokedByUser)
|
void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVersion, bool invokedByUser)
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton answer = QMessageBox::Yes;
|
QMessageBox::StandardButton answer = QMessageBox::Yes;
|
||||||
@ -1860,7 +1860,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked)
|
|||||||
if (checked) {
|
if (checked) {
|
||||||
Q_ASSERT(!m_executionLog);
|
Q_ASSERT(!m_executionLog);
|
||||||
m_executionLog = new ExecutionLogWidget(m_tabs, static_cast<Log::MsgType>(executionLogMsgTypes()));
|
m_executionLog = new ExecutionLogWidget(m_tabs, static_cast<Log::MsgType>(executionLogMsgTypes()));
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
m_tabs->addTab(m_executionLog, tr("Execution Log"));
|
m_tabs->addTab(m_executionLog, tr("Execution Log"));
|
||||||
#else
|
#else
|
||||||
const int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log"));
|
const int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log"));
|
||||||
@ -1949,12 +1949,12 @@ void MainWindow::updatePowerManagementState()
|
|||||||
m_pwr->setActivityState(inhibitSuspend);
|
m_pwr->setActivityState(inhibitSuspend);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
QIcon MainWindow::getSystrayIcon() const
|
QIcon MainWindow::getSystrayIcon() const
|
||||||
{
|
{
|
||||||
const TrayIcon::Style style = Preferences::instance()->trayIconStyle();
|
const TrayIcon::Style style = Preferences::instance()->trayIconStyle();
|
||||||
// on Linux we use theme icons, and icons from resources everywhere else
|
// on Linux we use theme icons, and icons from resources everywhere else
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
switch (style) {
|
switch (style) {
|
||||||
case TrayIcon::NORMAL:
|
case TrayIcon::NORMAL:
|
||||||
return QIcon::fromTheme(QLatin1String("qbittorrent-tray"));
|
return QIcon::fromTheme(QLatin1String("qbittorrent-tray"));
|
||||||
@ -1981,9 +1981,9 @@ QIcon MainWindow::getSystrayIcon() const
|
|||||||
// As a failsafe in case the enum is invalid
|
// As a failsafe in case the enum is invalid
|
||||||
return QIcon(QLatin1String(":/icons/skin/qbittorrent-tray.svg"));
|
return QIcon(QLatin1String(":/icons/skin/qbittorrent-tray.svg"));
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
void MainWindow::checkProgramUpdate()
|
void MainWindow::checkProgramUpdate()
|
||||||
{
|
{
|
||||||
m_programUpdateTimer->stop(); // If the user had clicked the menu item
|
m_programUpdateTimer->stop(); // If the user had clicked the menu item
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ private slots:
|
|||||||
void finishedTorrent(BitTorrent::TorrentHandle *const torrent) const;
|
void finishedTorrent(BitTorrent::TorrentHandle *const torrent) const;
|
||||||
void askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHandle *const torrent);
|
void askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHandle *const torrent);
|
||||||
void optionsSaved();
|
void optionsSaved();
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
void handleUpdateCheckFinished(bool updateAvailable, QString newVersion, bool invokedByUser);
|
void handleUpdateCheckFinished(bool updateAvailable, QString newVersion, bool invokedByUser);
|
||||||
#endif
|
#endif
|
||||||
void toggleAlternativeSpeeds();
|
void toggleAlternativeSpeeds();
|
||||||
@ -178,7 +178,7 @@ private slots:
|
|||||||
void on_actionLock_triggered();
|
void on_actionLock_triggered();
|
||||||
// Check for unpaused downloading or seeding torrents and prevent system suspend/sleep according to preferences
|
// Check for unpaused downloading or seeding torrents and prevent system suspend/sleep according to preferences
|
||||||
void updatePowerManagementState();
|
void updatePowerManagementState();
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
void checkProgramUpdate();
|
void checkProgramUpdate();
|
||||||
#endif
|
#endif
|
||||||
void toolbarMenuRequested(const QPoint &point);
|
void toolbarMenuRequested(const QPoint &point);
|
||||||
@ -187,7 +187,7 @@ private slots:
|
|||||||
void toolbarTextBeside();
|
void toolbarTextBeside();
|
||||||
void toolbarTextUnder();
|
void toolbarTextUnder();
|
||||||
void toolbarFollowSystem();
|
void toolbarFollowSystem();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
void on_actionCloseWindow_triggered();
|
void on_actionCloseWindow_triggered();
|
||||||
#else
|
#else
|
||||||
void toggleVisibility(const QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Trigger);
|
void toggleVisibility(const QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Trigger);
|
||||||
@ -196,7 +196,7 @@ private slots:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
void setupDockClickHandler();
|
void setupDockClickHandler();
|
||||||
#else
|
#else
|
||||||
void createTrayIcon();
|
void createTrayIcon();
|
||||||
@ -228,7 +228,7 @@ private:
|
|||||||
QPointer<StatsDialog> m_statsDlg;
|
QPointer<StatsDialog> m_statsDlg;
|
||||||
QPointer<TorrentCreatorDialog> m_createTorrentDlg;
|
QPointer<TorrentCreatorDialog> m_createTorrentDlg;
|
||||||
QPointer<DownloadFromURLDialog> m_downloadFromURLDialog;
|
QPointer<DownloadFromURLDialog> m_downloadFromURLDialog;
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
QPointer<QSystemTrayIcon> m_systrayIcon;
|
QPointer<QSystemTrayIcon> m_systrayIcon;
|
||||||
QPointer<QTimer> m_systrayCreator;
|
QPointer<QTimer> m_systrayCreator;
|
||||||
#endif
|
#endif
|
||||||
@ -252,7 +252,7 @@ private:
|
|||||||
// Power Management
|
// Power Management
|
||||||
PowerManagement *m_pwr;
|
PowerManagement *m_pwr;
|
||||||
QTimer *m_preventTimer;
|
QTimer *m_preventTimer;
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
QTimer *m_programUpdateTimer;
|
QTimer *m_programUpdateTimer;
|
||||||
bool m_wasUpdateCheckEnabled;
|
bool m_wasUpdateCheckEnabled;
|
||||||
#endif
|
#endif
|
||||||
|
@ -182,7 +182,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
|
|
||||||
// Load options
|
// Load options
|
||||||
loadOptions();
|
loadOptions();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
m_ui->checkShowSystray->setVisible(false);
|
m_ui->checkShowSystray->setVisible(false);
|
||||||
#else
|
#else
|
||||||
// Disable systray integration if it is not supported by the system
|
// Disable systray integration if it is not supported by the system
|
||||||
@ -198,7 +198,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
m_ui->checkStartup->setVisible(false);
|
m_ui->checkStartup->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(defined(Q_OS_WIN) || defined(Q_OS_MAC))
|
#if !(defined(Q_OS_WIN) || defined(Q_OS_MACOS))
|
||||||
m_ui->groupFileAssociation->setVisible(false);
|
m_ui->groupFileAssociation->setVisible(false);
|
||||||
m_ui->checkProgramUpdates->setVisible(false);
|
m_ui->checkProgramUpdates->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
@ -237,11 +237,11 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
connect(m_ui->checkPreventFromSuspendWhenDownloading, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkPreventFromSuspendWhenDownloading, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkPreventFromSuspendWhenSeeding, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkPreventFromSuspendWhenSeeding, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->comboTrayIcon, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
connect(m_ui->comboTrayIcon, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && !defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && !defined(QT_DBUS_LIB)
|
||||||
m_ui->checkPreventFromSuspendWhenDownloading->setDisabled(true);
|
m_ui->checkPreventFromSuspendWhenDownloading->setDisabled(true);
|
||||||
m_ui->checkPreventFromSuspendWhenSeeding->setDisabled(true);
|
m_ui->checkPreventFromSuspendWhenSeeding->setDisabled(true);
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
connect(m_ui->checkAssociateTorrents, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkAssociateTorrents, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkAssociateMagnetLinks, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkAssociateMagnetLinks, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
connect(m_ui->checkProgramUpdates, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkProgramUpdates, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
@ -611,7 +611,7 @@ void OptionsDialog::saveOptions()
|
|||||||
pref->setAlternatingRowColors(m_ui->checkAltRowColors->isChecked());
|
pref->setAlternatingRowColors(m_ui->checkAltRowColors->isChecked());
|
||||||
pref->setHideZeroValues(m_ui->checkHideZero->isChecked());
|
pref->setHideZeroValues(m_ui->checkHideZero->isChecked());
|
||||||
pref->setHideZeroComboValues(m_ui->comboHideZero->currentIndex());
|
pref->setHideZeroComboValues(m_ui->comboHideZero->currentIndex());
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
pref->setSystrayIntegration(systrayIntegration());
|
pref->setSystrayIntegration(systrayIntegration());
|
||||||
pref->setTrayIconStyle(TrayIcon::Style(m_ui->comboTrayIcon->currentIndex()));
|
pref->setTrayIconStyle(TrayIcon::Style(m_ui->comboTrayIcon->currentIndex()));
|
||||||
pref->setCloseToTray(closeToTray());
|
pref->setCloseToTray(closeToTray());
|
||||||
@ -629,7 +629,7 @@ void OptionsDialog::saveOptions()
|
|||||||
Preferences::setTorrentFileAssoc(m_ui->checkAssociateTorrents->isChecked());
|
Preferences::setTorrentFileAssoc(m_ui->checkAssociateTorrents->isChecked());
|
||||||
Preferences::setMagnetLinkAssoc(m_ui->checkAssociateMagnetLinks->isChecked());
|
Preferences::setMagnetLinkAssoc(m_ui->checkAssociateMagnetLinks->isChecked());
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
if (m_ui->checkAssociateTorrents->isChecked()) {
|
if (m_ui->checkAssociateTorrents->isChecked()) {
|
||||||
Preferences::setTorrentFileAssoc();
|
Preferences::setTorrentFileAssoc();
|
||||||
m_ui->checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
m_ui->checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
||||||
@ -641,7 +641,7 @@ void OptionsDialog::saveOptions()
|
|||||||
m_ui->checkAssociateMagnetLinks->setEnabled(!m_ui->checkAssociateMagnetLinks->isChecked());
|
m_ui->checkAssociateMagnetLinks->setEnabled(!m_ui->checkAssociateMagnetLinks->isChecked());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
pref->setUpdateCheckEnabled(m_ui->checkProgramUpdates->isChecked());
|
pref->setUpdateCheckEnabled(m_ui->checkProgramUpdates->isChecked());
|
||||||
#endif
|
#endif
|
||||||
auto *const app = static_cast<Application *>(QCoreApplication::instance());
|
auto *const app = static_cast<Application *>(QCoreApplication::instance());
|
||||||
@ -851,7 +851,7 @@ void OptionsDialog::loadOptions()
|
|||||||
m_ui->checkProgramExitConfirm->setChecked(pref->confirmOnExit());
|
m_ui->checkProgramExitConfirm->setChecked(pref->confirmOnExit());
|
||||||
m_ui->checkProgramAutoExitConfirm->setChecked(!pref->dontConfirmAutoExit());
|
m_ui->checkProgramAutoExitConfirm->setChecked(!pref->dontConfirmAutoExit());
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
m_ui->checkShowSystray->setChecked(pref->systrayIntegration());
|
m_ui->checkShowSystray->setChecked(pref->systrayIntegration());
|
||||||
if (m_ui->checkShowSystray->isChecked()) {
|
if (m_ui->checkShowSystray->isChecked()) {
|
||||||
m_ui->checkMinimizeToSysTray->setChecked(pref->minimizeToTray());
|
m_ui->checkMinimizeToSysTray->setChecked(pref->minimizeToTray());
|
||||||
@ -868,13 +868,13 @@ void OptionsDialog::loadOptions()
|
|||||||
m_ui->checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
m_ui->checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
||||||
m_ui->checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
|
m_ui->checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
m_ui->checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
m_ui->checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
||||||
m_ui->checkAssociateTorrents->setEnabled(!m_ui->checkAssociateTorrents->isChecked());
|
m_ui->checkAssociateTorrents->setEnabled(!m_ui->checkAssociateTorrents->isChecked());
|
||||||
m_ui->checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
|
m_ui->checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
|
||||||
m_ui->checkAssociateMagnetLinks->setEnabled(!m_ui->checkAssociateMagnetLinks->isChecked());
|
m_ui->checkAssociateMagnetLinks->setEnabled(!m_ui->checkAssociateMagnetLinks->isChecked());
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
m_ui->checkProgramUpdates->setChecked(pref->isUpdateCheckEnabled());
|
m_ui->checkProgramUpdates->setChecked(pref->isUpdateCheckEnabled());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1222,7 +1222,7 @@ bool OptionsDialog::startMinimized() const
|
|||||||
return m_ui->checkStartMinimized->isChecked();
|
return m_ui->checkStartMinimized->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
bool OptionsDialog::systrayIntegration() const
|
bool OptionsDialog::systrayIntegration() const
|
||||||
{
|
{
|
||||||
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
|
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
|
||||||
@ -1240,7 +1240,7 @@ bool OptionsDialog::closeToTray() const
|
|||||||
if (!m_ui->checkShowSystray->isChecked()) return false;
|
if (!m_ui->checkShowSystray->isChecked()) return false;
|
||||||
return m_ui->checkCloseToSystray->isChecked();
|
return m_ui->checkCloseToSystray->isChecked();
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
// Return Share ratio
|
// Return Share ratio
|
||||||
qreal OptionsDialog::getMaxRatio() const
|
qreal OptionsDialog::getMaxRatio() const
|
||||||
|
@ -120,7 +120,7 @@ private:
|
|||||||
static QString languageToLocalizedString(const QLocale &locale);
|
static QString languageToLocalizedString(const QLocale &locale);
|
||||||
// General options
|
// General options
|
||||||
QString getLocale() const;
|
QString getLocale() const;
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
bool systrayIntegration() const;
|
bool systrayIntegration() const;
|
||||||
bool minimizeToTray() const;
|
bool minimizeToTray() const;
|
||||||
bool closeToTray() const;
|
bool closeToTray() const;
|
||||||
|
@ -30,11 +30,11 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
#include "powermanagement_x11.h"
|
#include "powermanagement_x11.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ PowerManagement::PowerManagement(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_busy(false)
|
, m_busy(false)
|
||||||
{
|
{
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
m_inhibitor = new PowerManagementInhibitor(this);
|
m_inhibitor = new PowerManagementInhibitor(this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ void PowerManagement::setBusy()
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
||||||
#elif (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#elif (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
m_inhibitor->requestBusy();
|
m_inhibitor->requestBusy();
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MACOS)
|
||||||
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn
|
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn
|
||||||
, tr("qBittorrent is active").toCFString(), &m_assertionID);
|
, tr("qBittorrent is active").toCFString(), &m_assertionID);
|
||||||
if (success != kIOReturnSuccess)
|
if (success != kIOReturnSuccess)
|
||||||
@ -87,9 +87,9 @@ void PowerManagement::setIdle()
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
SetThreadExecutionState(ES_CONTINUOUS);
|
SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
#elif (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#elif (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
m_inhibitor->requestIdle();
|
m_inhibitor->requestIdle();
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MACOS)
|
||||||
IOPMAssertionRelease(m_assertionID);
|
IOPMAssertionRelease(m_assertionID);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
// Require Mac OS X >= 10.5
|
// Require Mac OS X >= 10.5
|
||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
// Require DBus
|
// Require DBus
|
||||||
class PowerManagementInhibitor;
|
class PowerManagementInhibitor;
|
||||||
#endif
|
#endif
|
||||||
@ -57,10 +57,10 @@ private:
|
|||||||
void setBusy();
|
void setBusy();
|
||||||
void setIdle();
|
void setIdle();
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||||
PowerManagementInhibitor *m_inhibitor;
|
PowerManagementInhibitor *m_inhibitor;
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
IOPMAssertionID m_assertionID;
|
IOPMAssertionID m_assertionID;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -78,7 +78,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
|
|||||||
|
|
||||||
qDebug("Finished downloading the new qBittorrent updates RSS");
|
qDebug("Finished downloading the new qBittorrent updates RSS");
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
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 {(::IsWindows7OrGreater()
|
const QString OS_TYPE {(::IsWindows7OrGreater()
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
#include "ui_propertieswidget.h"
|
#include "ui_propertieswidget.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include "macutilities.h"
|
#include "macutilities.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ void PropertiesWidget::openFolder(const QModelIndex &index, bool containingFolde
|
|||||||
|
|
||||||
// Flush data
|
// Flush data
|
||||||
m_torrent->flushCache();
|
m_torrent->flushCache();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
Q_UNUSED(containingFolder);
|
Q_UNUSED(containingFolder);
|
||||||
MacUtils::openFiles(QSet<QString>{absolutePath});
|
MacUtils::openFiles(QSet<QString>{absolutePath});
|
||||||
#else
|
#else
|
||||||
|
@ -45,7 +45,7 @@ PropTabBar::PropTabBar(QWidget *parent)
|
|||||||
m_btnGroup = new QButtonGroup(this);
|
m_btnGroup = new QButtonGroup(this);
|
||||||
// General tab
|
// General tab
|
||||||
QPushButton *mainInfosButton = new QPushButton(
|
QPushButton *mainInfosButton = new QPushButton(
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("document-properties"),
|
UIThemeManager::instance()->getIcon("document-properties"),
|
||||||
#endif
|
#endif
|
||||||
tr("General"), parent);
|
tr("General"), parent);
|
||||||
@ -54,7 +54,7 @@ PropTabBar::PropTabBar(QWidget *parent)
|
|||||||
m_btnGroup->addButton(mainInfosButton, MainTab);
|
m_btnGroup->addButton(mainInfosButton, MainTab);
|
||||||
// Trackers tab
|
// Trackers tab
|
||||||
QPushButton *trackersButton = new QPushButton(
|
QPushButton *trackersButton = new QPushButton(
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("network-server"),
|
UIThemeManager::instance()->getIcon("network-server"),
|
||||||
#endif
|
#endif
|
||||||
tr("Trackers"), parent);
|
tr("Trackers"), parent);
|
||||||
@ -63,7 +63,7 @@ PropTabBar::PropTabBar(QWidget *parent)
|
|||||||
m_btnGroup->addButton(trackersButton, TrackersTab);
|
m_btnGroup->addButton(trackersButton, TrackersTab);
|
||||||
// Peers tab
|
// Peers tab
|
||||||
QPushButton *peersButton = new QPushButton(
|
QPushButton *peersButton = new QPushButton(
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("edit-find-user"),
|
UIThemeManager::instance()->getIcon("edit-find-user"),
|
||||||
#endif
|
#endif
|
||||||
tr("Peers"), parent);
|
tr("Peers"), parent);
|
||||||
@ -72,7 +72,7 @@ PropTabBar::PropTabBar(QWidget *parent)
|
|||||||
m_btnGroup->addButton(peersButton, PeersTab);
|
m_btnGroup->addButton(peersButton, PeersTab);
|
||||||
// URL seeds tab
|
// URL seeds tab
|
||||||
QPushButton *URLSeedsButton = new QPushButton(
|
QPushButton *URLSeedsButton = new QPushButton(
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("network-server"),
|
UIThemeManager::instance()->getIcon("network-server"),
|
||||||
#endif
|
#endif
|
||||||
tr("HTTP Sources"), parent);
|
tr("HTTP Sources"), parent);
|
||||||
@ -81,7 +81,7 @@ PropTabBar::PropTabBar(QWidget *parent)
|
|||||||
m_btnGroup->addButton(URLSeedsButton, URLSeedsTab);
|
m_btnGroup->addButton(URLSeedsButton, URLSeedsTab);
|
||||||
// Files tab
|
// Files tab
|
||||||
QPushButton *filesButton = new QPushButton(
|
QPushButton *filesButton = new QPushButton(
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("inode-directory"),
|
UIThemeManager::instance()->getIcon("inode-directory"),
|
||||||
#endif
|
#endif
|
||||||
tr("Content"), parent);
|
tr("Content"), parent);
|
||||||
@ -92,7 +92,7 @@ PropTabBar::PropTabBar(QWidget *parent)
|
|||||||
addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
|
addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||||
// Speed tab
|
// Speed tab
|
||||||
QPushButton *speedButton = new QPushButton(
|
QPushButton *speedButton = new QPushButton(
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
UIThemeManager::instance()->getIcon("office-chart-line"),
|
UIThemeManager::instance()->getIcon("office-chart-line"),
|
||||||
#endif
|
#endif
|
||||||
tr("Speed"), parent);
|
tr("Speed"), parent);
|
||||||
|
@ -72,7 +72,7 @@ RSSWidget::RSSWidget(QWidget *parent)
|
|||||||
m_ui->actionRename->setIcon(UIThemeManager::instance()->getIcon("edit-rename"));
|
m_ui->actionRename->setIcon(UIThemeManager::instance()->getIcon("edit-rename"));
|
||||||
m_ui->actionUpdate->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
|
m_ui->actionUpdate->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
|
||||||
m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
|
m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon("list-add"));
|
m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon("list-add"));
|
||||||
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon("mail-mark-read"));
|
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon("mail-mark-read"));
|
||||||
m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
|
m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
|
||||||
|
@ -102,7 +102,7 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
|
|||||||
<< "</p></body></html>" << flush;
|
<< "</p></body></html>" << flush;
|
||||||
m_ui->lineEditSearchPattern->setToolTip(searchPatternHint);
|
m_ui->lineEditSearchPattern->setToolTip(searchPatternHint);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
// Icons
|
// Icons
|
||||||
m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon("edit-find"));
|
m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon("edit-find"));
|
||||||
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon("preferences-system-network"));
|
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon("preferences-system-network"));
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
StatusBar::StatusBar(QWidget *parent)
|
StatusBar::StatusBar(QWidget *parent)
|
||||||
: QStatusBar(parent)
|
: QStatusBar(parent)
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
// Redefining global stylesheet breaks certain elements on mac like tabs.
|
// Redefining global stylesheet breaks certain elements on mac like tabs.
|
||||||
// Qt checks whether the stylesheet class inherts("QMacStyle") and this becomes false.
|
// Qt checks whether the stylesheet class inherts("QMacStyle") and this becomes false.
|
||||||
qApp->setStyleSheet("QStatusBar::item { border-width: 0; }");
|
qApp->setStyleSheet("QStatusBar::item { border-width: 0; }");
|
||||||
@ -111,22 +111,22 @@ StatusBar::StatusBar(QWidget *parent)
|
|||||||
|
|
||||||
QFrame *statusSep1 = new QFrame(this);
|
QFrame *statusSep1 = new QFrame(this);
|
||||||
statusSep1->setFrameStyle(QFrame::VLine);
|
statusSep1->setFrameStyle(QFrame::VLine);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
statusSep1->setFrameShadow(QFrame::Raised);
|
statusSep1->setFrameShadow(QFrame::Raised);
|
||||||
#endif
|
#endif
|
||||||
QFrame *statusSep2 = new QFrame(this);
|
QFrame *statusSep2 = new QFrame(this);
|
||||||
statusSep2->setFrameStyle(QFrame::VLine);
|
statusSep2->setFrameStyle(QFrame::VLine);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
statusSep2->setFrameShadow(QFrame::Raised);
|
statusSep2->setFrameShadow(QFrame::Raised);
|
||||||
#endif
|
#endif
|
||||||
QFrame *statusSep3 = new QFrame(this);
|
QFrame *statusSep3 = new QFrame(this);
|
||||||
statusSep3->setFrameStyle(QFrame::VLine);
|
statusSep3->setFrameStyle(QFrame::VLine);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
statusSep3->setFrameShadow(QFrame::Raised);
|
statusSep3->setFrameShadow(QFrame::Raised);
|
||||||
#endif
|
#endif
|
||||||
QFrame *statusSep4 = new QFrame(this);
|
QFrame *statusSep4 = new QFrame(this);
|
||||||
statusSep4->setFrameStyle(QFrame::VLine);
|
statusSep4->setFrameStyle(QFrame::VLine);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MACOS
|
||||||
statusSep4->setFrameShadow(QFrame::Raised);
|
statusSep4->setFrameShadow(QFrame::Raised);
|
||||||
#endif
|
#endif
|
||||||
layout->addWidget(m_DHTLbl);
|
layout->addWidget(m_DHTLbl);
|
||||||
|
@ -69,7 +69,7 @@ TagFilterWidget::TagFilterWidget(QWidget *parent)
|
|||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
setHeaderHidden(true);
|
setHeaderHidden(true);
|
||||||
setIconSize(Utils::Gui::smallIconSize());
|
setIconSize(Utils::Gui::smallIconSize());
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MACOS)
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
#endif
|
#endif
|
||||||
setIndentation(0);
|
setIndentation(0);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include <QMimeType>
|
#include <QMimeType>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined Q_OS_WIN || defined Q_OS_MAC
|
#if defined Q_OS_WIN || defined Q_OS_MACOS
|
||||||
#define QBT_PIXMAP_CACHE_FOR_FILE_ICONS
|
#define QBT_PIXMAP_CACHE_FOR_FILE_ICONS
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#endif
|
#endif
|
||||||
@ -57,7 +57,7 @@
|
|||||||
#include "torrentcontentmodelitem.h"
|
#include "torrentcontentmodelitem.h"
|
||||||
#include "uithememanager.h"
|
#include "uithememanager.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include "macutilities.h"
|
#include "macutilities.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ namespace
|
|||||||
return iconPixmap;
|
return iconPixmap;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MACOS)
|
||||||
// There is a similar bug on macOS, to be reported to Qt
|
// There is a similar bug on macOS, to be reported to Qt
|
||||||
// https://github.com/qbittorrent/qBittorrent/pull/6156#issuecomment-316302615
|
// https://github.com/qbittorrent/qBittorrent/pull/6156#issuecomment-316302615
|
||||||
class MacFileIconProvider final : public CachingFileIconProvider
|
class MacFileIconProvider final : public CachingFileIconProvider
|
||||||
@ -184,7 +184,7 @@ TorrentContentModel::TorrentContentModel(QObject *parent)
|
|||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
m_fileIconProvider = new WinShellFileIconProvider();
|
m_fileIconProvider = new WinShellFileIconProvider();
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MACOS)
|
||||||
m_fileIconProvider = new MacFileIconProvider();
|
m_fileIconProvider = new MacFileIconProvider();
|
||||||
#else
|
#else
|
||||||
static bool doesBuiltInProviderWork = doesQFileIconProviderWork();
|
static bool doesBuiltInProviderWork = doesQFileIconProviderWork();
|
||||||
|
@ -103,7 +103,7 @@ BaseFilterWidget::BaseFilterWidget(QWidget *parent, TransferListWidget *transfer
|
|||||||
|
|
||||||
setIconSize(Utils::Gui::smallIconSize());
|
setIconSize(Utils::Gui::smallIconSize());
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MACOS)
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
#include "updownratiodialog.h"
|
#include "updownratiodialog.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
#include "macutilities.h"
|
#include "macutilities.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
|
|||||||
setItemsExpandable(false);
|
setItemsExpandable(false);
|
||||||
setAutoScroll(true);
|
setAutoScroll(true);
|
||||||
setDragDropMode(QAbstractItemView::DragOnly);
|
setDragDropMode(QAbstractItemView::DragOnly);
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MACOS)
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
#endif
|
#endif
|
||||||
header()->setStretchLastSection(false);
|
header()->setStretchLastSection(false);
|
||||||
@ -259,7 +259,7 @@ void TransferListWidget::torrentDoubleClicked()
|
|||||||
torrent->pause();
|
torrent->pause();
|
||||||
break;
|
break;
|
||||||
case OPEN_DEST:
|
case OPEN_DEST:
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
MacUtils::openFiles(QSet<QString>{torrent->contentPath(true)});
|
MacUtils::openFiles(QSet<QString>{torrent->contentPath(true)});
|
||||||
#else
|
#else
|
||||||
if (torrent->filesCount() == 1)
|
if (torrent->filesCount() == 1)
|
||||||
@ -455,7 +455,7 @@ void TransferListWidget::hideQueuePosColumn(bool hide)
|
|||||||
void TransferListWidget::openSelectedTorrentsFolder() const
|
void TransferListWidget::openSelectedTorrentsFolder() const
|
||||||
{
|
{
|
||||||
QSet<QString> pathsList;
|
QSet<QString> pathsList;
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MACOS
|
||||||
// On macOS you expect both the files and folders to be opened in their parent
|
// On macOS you expect both the files and folders to be opened in their parent
|
||||||
// folders prehilighted for opening, so we use a custom method.
|
// folders prehilighted for opening, so we use a custom method.
|
||||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents())) {
|
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents())) {
|
||||||
@ -474,7 +474,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const
|
|||||||
}
|
}
|
||||||
pathsList.insert(path);
|
pathsList.insert(path);
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MACOS
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::previewSelectedTorrents()
|
void TransferListWidget::previewSelectedTorrents()
|
||||||
|
@ -62,7 +62,7 @@ UIThemeManager::UIThemeManager()
|
|||||||
&& !QResource::registerResource(pref->customUIThemePath(), "/uitheme"))
|
&& !QResource::registerResource(pref->customUIThemePath(), "/uitheme"))
|
||||||
LogMsg(tr("Failed to load UI theme from file: \"%1\"").arg(pref->customUIThemePath()), Log::WARNING);
|
LogMsg(tr("Failed to load UI theme from file: \"%1\"").arg(pref->customUIThemePath()), Log::WARNING);
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
m_useSystemTheme = pref->useSystemIconTheme();
|
m_useSystemTheme = pref->useSystemIconTheme();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ QIcon UIThemeManager::getIcon(const QString &iconId) const
|
|||||||
|
|
||||||
QIcon UIThemeManager::getIcon(const QString &iconId, const QString &fallback) const
|
QIcon UIThemeManager::getIcon(const QString &iconId, const QString &fallback) const
|
||||||
{
|
{
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
if (m_useSystemTheme) {
|
if (m_useSystemTheme) {
|
||||||
QIcon icon = QIcon::fromTheme(iconId);
|
QIcon icon = QIcon::fromTheme(iconId);
|
||||||
if (icon.name() != iconId)
|
if (icon.name() != iconId)
|
||||||
@ -126,7 +126,7 @@ QIcon UIThemeManager::getFlagIcon(const QString &countryIsoCode) const
|
|||||||
|
|
||||||
QString UIThemeManager::getIconPath(const QString &iconId) const
|
QString UIThemeManager::getIconPath(const QString &iconId) const
|
||||||
{
|
{
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
if (m_useSystemTheme) {
|
if (m_useSystemTheme) {
|
||||||
QString path = Utils::Fs::tempPath() + iconId + ".png";
|
QString path = Utils::Fs::tempPath() + iconId + ".png";
|
||||||
if (!QFile::exists(path)) {
|
if (!QFile::exists(path)) {
|
||||||
|
@ -54,7 +54,7 @@ private:
|
|||||||
QString getIconPath(const QString &iconId) const;
|
QString getIconPath(const QString &iconId) const;
|
||||||
|
|
||||||
static UIThemeManager *m_instance;
|
static UIThemeManager *m_instance;
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||||
bool m_useSystemTheme;
|
bool m_useSystemTheme;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -68,7 +68,7 @@ qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const int screen = qApp->desktop()->screenNumber(widget);
|
const int screen = qApp->desktop()->screenNumber(widget);
|
||||||
return (QApplication::screens()[screen]->logicalDotsPerInch() / 96);
|
return (QApplication::screens()[screen]->logicalDotsPerInch() / 96);
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MACOS)
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
return widget->devicePixelRatioF();
|
return widget->devicePixelRatioF();
|
||||||
@ -181,7 +181,7 @@ void Utils::Gui::openFolderSelect(const QString &absolutePath)
|
|||||||
}
|
}
|
||||||
if ((hresult == S_OK) || (hresult == S_FALSE))
|
if ((hresult == S_OK) || (hresult == S_FALSE))
|
||||||
::CoUninitialize();
|
::CoUninitialize();
|
||||||
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
proc.start("xdg-mime", {"query", "default", "inode/directory"});
|
proc.start("xdg-mime", {"query", "default", "inode/directory"});
|
||||||
proc.waitForFinished();
|
proc.waitForFinished();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user