mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-31 00:44:19 +00:00
parent
4a66d705b8
commit
5dcc14153f
@ -101,6 +101,10 @@ if (MSVC)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (DBUS)
|
||||||
|
target_compile_definitions(qbt_common_cfg INTERFACE QBT_USES_DBUS)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (LibtorrentRasterbar_VERSION VERSION_GREATER_EQUAL ${minLibtorrentVersion})
|
if (LibtorrentRasterbar_VERSION VERSION_GREATER_EQUAL ${minLibtorrentVersion})
|
||||||
target_compile_definitions(qbt_common_cfg INTERFACE QBT_USES_LIBTORRENT2)
|
target_compile_definitions(qbt_common_cfg INTERFACE QBT_USES_LIBTORRENT2)
|
||||||
endif()
|
endif()
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -5649,7 +5649,7 @@ fi
|
|||||||
then :
|
then :
|
||||||
as_fn_error $? "Could not find QtDBus" "$LINENO" 5
|
as_fn_error $? "Could not find QtDBus" "$LINENO" 5
|
||||||
else $as_nop
|
else $as_nop
|
||||||
QBT_ADD_CONFIG="$QBT_ADD_CONFIG dbus"
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG dbus" QBT_ADD_DEFINES="$QBT_ADD_DEFINES QBT_USES_DBUS"
|
||||||
|
|
||||||
fi ;; #(
|
fi ;; #(
|
||||||
"xno") :
|
"xno") :
|
||||||
|
@ -165,7 +165,7 @@ AS_CASE(["x$enable_qt_dbus"],
|
|||||||
FIND_QTDBUS()
|
FIND_QTDBUS()
|
||||||
AS_IF([test "x$HAVE_QTDBUS" = "xfalse"],
|
AS_IF([test "x$HAVE_QTDBUS" = "xfalse"],
|
||||||
[AC_MSG_ERROR([Could not find QtDBus])],
|
[AC_MSG_ERROR([Could not find QtDBus])],
|
||||||
[QBT_ADD_CONFIG="$QBT_ADD_CONFIG dbus"]
|
[QBT_ADD_CONFIG="$QBT_ADD_CONFIG dbus" QBT_ADD_DEFINES="$QBT_ADD_DEFINES QBT_USES_DBUS"]
|
||||||
)],
|
)],
|
||||||
["xno"],
|
["xno"],
|
||||||
[AC_MSG_RESULT([no])
|
[AC_MSG_RESULT([no])
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
#ifdef QBT_USES_DBUS
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
|
|||||||
|
|
||||||
AEDisposeDesc(&eventReply);
|
AEDisposeDesc(&eventReply);
|
||||||
|
|
||||||
#elif (defined(Q_OS_UNIX) && defined(QT_DBUS_LIB))
|
#elif defined(QBT_USES_DBUS)
|
||||||
// Use dbus to power off / suspend the system
|
// Use dbus to power off / suspend the system
|
||||||
if (action != ShutdownDialogAction::Shutdown)
|
if (action != ShutdownDialogAction::Shutdown)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "base/preferences.h"
|
#include "base/preferences.h"
|
||||||
#include "base/unicodestrings.h"
|
#include "base/unicodestrings.h"
|
||||||
#include "gui/addnewtorrentdialog.h"
|
#include "gui/addnewtorrentdialog.h"
|
||||||
|
#include "gui/desktopintegration.h"
|
||||||
#include "gui/mainwindow.h"
|
#include "gui/mainwindow.h"
|
||||||
#include "interfaces/iguiapplication.h"
|
#include "interfaces/iguiapplication.h"
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ namespace
|
|||||||
RESOLVE_COUNTRIES,
|
RESOLVE_COUNTRIES,
|
||||||
PROGRAM_NOTIFICATIONS,
|
PROGRAM_NOTIFICATIONS,
|
||||||
TORRENT_ADDED_NOTIFICATIONS,
|
TORRENT_ADDED_NOTIFICATIONS,
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
NOTIFICATION_TIMEOUT,
|
NOTIFICATION_TIMEOUT,
|
||||||
#endif
|
#endif
|
||||||
CONFIRM_REMOVE_ALL_TAGS,
|
CONFIRM_REMOVE_ALL_TAGS,
|
||||||
@ -282,7 +283,7 @@ void AdvancedSettings::saveAdvancedSettings() const
|
|||||||
session->setStopTrackerTimeout(m_spinBoxStopTrackerTimeout.value());
|
session->setStopTrackerTimeout(m_spinBoxStopTrackerTimeout.value());
|
||||||
// Program notification
|
// Program notification
|
||||||
app()->desktopIntegration()->setNotificationsEnabled(m_checkBoxProgramNotifications.isChecked());
|
app()->desktopIntegration()->setNotificationsEnabled(m_checkBoxProgramNotifications.isChecked());
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
app()->desktopIntegration()->setNotificationTimeout(m_spinBoxNotificationTimeout.value());
|
app()->desktopIntegration()->setNotificationTimeout(m_spinBoxNotificationTimeout.value());
|
||||||
#endif
|
#endif
|
||||||
app()->setTorrentAddedNotificationsEnabled(m_checkBoxTorrentAddedNotifications.isChecked());
|
app()->setTorrentAddedNotificationsEnabled(m_checkBoxTorrentAddedNotifications.isChecked());
|
||||||
@ -332,7 +333,7 @@ void AdvancedSettings::updateCacheSpinSuffix(const int value)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
void AdvancedSettings::updateNotificationTimeoutSuffix(const int value)
|
void AdvancedSettings::updateNotificationTimeoutSuffix(const int value)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
@ -728,7 +729,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
// Torrent added notifications
|
// Torrent added notifications
|
||||||
m_checkBoxTorrentAddedNotifications.setChecked(app()->isTorrentAddedNotificationsEnabled());
|
m_checkBoxTorrentAddedNotifications.setChecked(app()->isTorrentAddedNotificationsEnabled());
|
||||||
addRow(TORRENT_ADDED_NOTIFICATIONS, tr("Display notifications for added torrents"), &m_checkBoxTorrentAddedNotifications);
|
addRow(TORRENT_ADDED_NOTIFICATIONS, tr("Display notifications for added torrents"), &m_checkBoxTorrentAddedNotifications);
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
// Notification timeout
|
// Notification timeout
|
||||||
m_spinBoxNotificationTimeout.setMinimum(-1);
|
m_spinBoxNotificationTimeout.setMinimum(-1);
|
||||||
m_spinBoxNotificationTimeout.setMaximum(std::numeric_limits<int>::max());
|
m_spinBoxNotificationTimeout.setMaximum(std::numeric_limits<int>::max());
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
|
|
||||||
#include "gui/desktopintegration.h"
|
|
||||||
#include "guiapplicationcomponent.h"
|
#include "guiapplicationcomponent.h"
|
||||||
|
|
||||||
class AdvancedSettings final : public QTableWidget, public GUIApplicationComponent
|
class AdvancedSettings final : public QTableWidget, public GUIApplicationComponent
|
||||||
@ -58,7 +57,7 @@ private slots:
|
|||||||
void updateCacheSpinSuffix(int value);
|
void updateCacheSpinSuffix(int value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
void updateNotificationTimeoutSuffix(int value);
|
void updateNotificationTimeoutSuffix(int value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -98,7 +97,7 @@ private:
|
|||||||
QCheckBox m_checkBoxIconsInMenusEnabled;
|
QCheckBox m_checkBoxIconsInMenusEnabled;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
QSpinBox m_spinBoxNotificationTimeout;
|
QSpinBox m_spinBoxNotificationTimeout;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#include "macutilities.h"
|
#include "macutilities.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
#include "notifications/dbusnotifier.h"
|
#include "notifications/dbusnotifier.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ using namespace std::chrono_literals;
|
|||||||
DesktopIntegration::DesktopIntegration(QObject *parent)
|
DesktopIntegration::DesktopIntegration(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_storeNotificationEnabled {NOTIFICATIONS_SETTINGS_KEY(u"Enabled"_qs), true}
|
, m_storeNotificationEnabled {NOTIFICATIONS_SETTINGS_KEY(u"Enabled"_qs), true}
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
, m_storeNotificationTimeOut {NOTIFICATIONS_SETTINGS_KEY(u"Timeout"_qs), -1}
|
, m_storeNotificationTimeOut {NOTIFICATIONS_SETTINGS_KEY(u"Timeout"_qs), -1}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ DesktopIntegration::DesktopIntegration(QObject *parent)
|
|||||||
if (Preferences::instance()->systemTrayEnabled())
|
if (Preferences::instance()->systemTrayEnabled())
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
|
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
if (isNotificationsEnabled())
|
if (isNotificationsEnabled())
|
||||||
{
|
{
|
||||||
m_notifier = new DBusNotifier(this);
|
m_notifier = new DBusNotifier(this);
|
||||||
@ -187,7 +187,7 @@ void DesktopIntegration::setNotificationsEnabled(const bool value)
|
|||||||
|
|
||||||
m_storeNotificationEnabled = value;
|
m_storeNotificationEnabled = value;
|
||||||
|
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
m_notifier = new DBusNotifier(this);
|
m_notifier = new DBusNotifier(this);
|
||||||
@ -203,14 +203,14 @@ void DesktopIntegration::setNotificationsEnabled(const bool value)
|
|||||||
|
|
||||||
int DesktopIntegration::notificationTimeout() const
|
int DesktopIntegration::notificationTimeout() const
|
||||||
{
|
{
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
return m_storeNotificationTimeOut;
|
return m_storeNotificationTimeOut;
|
||||||
#else
|
#else
|
||||||
return 5000;
|
return 5000;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
void DesktopIntegration::setNotificationTimeout(const int value)
|
void DesktopIntegration::setNotificationTimeout(const int value)
|
||||||
{
|
{
|
||||||
m_storeNotificationTimeOut = value;
|
m_storeNotificationTimeOut = value;
|
||||||
@ -225,7 +225,7 @@ void DesktopIntegration::showNotification(const QString &title, const QString &m
|
|||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
MacUtils::displayNotification(title, msg);
|
MacUtils::displayNotification(title, msg);
|
||||||
#else
|
#else
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
m_notifier->showMessage(title, msg, notificationTimeout());
|
m_notifier->showMessage(title, msg, notificationTimeout());
|
||||||
#else
|
#else
|
||||||
if (m_systrayIcon && QSystemTrayIcon::supportsMessages())
|
if (m_systrayIcon && QSystemTrayIcon::supportsMessages())
|
||||||
@ -276,7 +276,7 @@ void DesktopIntegration::createTrayIcon()
|
|||||||
if (reason == QSystemTrayIcon::Trigger)
|
if (reason == QSystemTrayIcon::Trigger)
|
||||||
emit activationRequested();
|
emit activationRequested();
|
||||||
});
|
});
|
||||||
#ifndef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifndef QBT_USES_DBUS
|
||||||
connect(m_systrayIcon, &QSystemTrayIcon::messageClicked, this, &DesktopIntegration::notificationClicked);
|
connect(m_systrayIcon, &QSystemTrayIcon::messageClicked, this, &DesktopIntegration::notificationClicked);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -37,8 +37,7 @@ class QMenu;
|
|||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
class QSystemTrayIcon;
|
class QSystemTrayIcon;
|
||||||
#endif
|
#endif
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
#ifdef QBT_USES_DBUS
|
||||||
#define QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
|
||||||
class DBusNotifier;
|
class DBusNotifier;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ public:
|
|||||||
void setNotificationsEnabled(bool value);
|
void setNotificationsEnabled(bool value);
|
||||||
|
|
||||||
int notificationTimeout() const;
|
int notificationTimeout() const;
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
void setNotificationTimeout(const int value);
|
void setNotificationTimeout(const int value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ private:
|
|||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
QSystemTrayIcon *m_systrayIcon = nullptr;
|
QSystemTrayIcon *m_systrayIcon = nullptr;
|
||||||
#endif
|
#endif
|
||||||
#ifdef QBT_USES_CUSTOMDBUSNOTIFICATIONS
|
#ifdef QBT_USES_DBUS
|
||||||
CachedSettingValue<int> m_storeNotificationTimeOut;
|
CachedSettingValue<int> m_storeNotificationTimeOut;
|
||||||
DBusNotifier *m_notifier = nullptr;
|
DBusNotifier *m_notifier = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
@ -359,7 +359,7 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState)
|
|||||||
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_MACOS)) || defined(QT_DBUS_LIB)
|
#if (!defined(Q_OS_UNIX) || defined(Q_OS_MACOS)) || defined(QBT_USES_DBUS)
|
||||||
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());
|
||||||
|
@ -369,7 +369,7 @@ void OptionsDialog::loadBehaviorTabOptions()
|
|||||||
connect(m_ui->checkProgramUpdates, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
connect(m_ui->checkProgramUpdates, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && !defined(QT_DBUS_LIB)
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && !defined(QBT_USES_DBUS)
|
||||||
m_ui->checkPreventFromSuspendWhenDownloading->setDisabled(true);
|
m_ui->checkPreventFromSuspendWhenDownloading->setDisabled(true);
|
||||||
m_ui->checkPreventFromSuspendWhenSeeding->setDisabled(true);
|
m_ui->checkPreventFromSuspendWhenSeeding->setDisabled(true);
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,14 +38,14 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
#ifdef QBT_USES_DBUS
|
||||||
#include "powermanagement_x11.h"
|
#include "powermanagement_x11.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PowerManagement::PowerManagement(QObject *parent)
|
PowerManagement::PowerManagement(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
#ifdef QBT_USES_DBUS
|
||||||
m_inhibitor = new PowerManagementInhibitor(this);
|
m_inhibitor = new PowerManagementInhibitor(this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ 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_MACOS)) && defined(QT_DBUS_LIB)
|
#elif defined(QBT_USES_DBUS)
|
||||||
m_inhibitor->requestBusy();
|
m_inhibitor->requestBusy();
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn
|
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn
|
||||||
@ -86,7 +86,7 @@ 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_MACOS)) && defined(QT_DBUS_LIB)
|
#elif defined(QBT_USES_DBUS)
|
||||||
m_inhibitor->requestIdle();
|
m_inhibitor->requestIdle();
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
IOPMAssertionRelease(m_assertionID);
|
IOPMAssertionRelease(m_assertionID);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
#ifdef QBT_USES_DBUS
|
||||||
// Require DBus
|
// Require DBus
|
||||||
class PowerManagementInhibitor;
|
class PowerManagementInhibitor;
|
||||||
#endif
|
#endif
|
||||||
@ -57,7 +57,7 @@ private:
|
|||||||
|
|
||||||
bool m_busy = false;
|
bool m_busy = false;
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
#ifdef QBT_USES_DBUS
|
||||||
PowerManagementInhibitor *m_inhibitor = nullptr;
|
PowerManagementInhibitor *m_inhibitor = nullptr;
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user