mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Get rid of DBus dependency in nox mode
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
- BUGFIX: Fix possible crashes in full allocation mode
|
- BUGFIX: Fix possible crashes in full allocation mode
|
||||||
- BUGFIX: Fix icon size issues (Linux, icon theme)
|
- BUGFIX: Fix icon size issues (Linux, icon theme)
|
||||||
- BUGFIX: Fixed file priority context menu
|
- BUGFIX: Fixed file priority context menu
|
||||||
|
- BUGFIX: Remove dbus dependency in nox mode
|
||||||
- I18N: Improve Web UI translation
|
- I18N: Improve Web UI translation
|
||||||
- I18N: Updated Polish translation
|
- I18N: Updated Polish translation
|
||||||
|
|
||||||
|
|||||||
16
src/misc.cpp
16
src/misc.cpp
@@ -70,10 +70,12 @@ const int UNLEN = 256;
|
|||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DISABLE_GUI
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
#endif
|
#endif
|
||||||
|
#endif // DISABLE_GUI
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
@@ -196,18 +198,7 @@ long long misc::freeDiskSpaceOnPath(QString path) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void suspendComputer() {
|
#ifndef DISABLE_GUI
|
||||||
#ifdef Q_WS_X11
|
|
||||||
// Use dbus to power off the system
|
|
||||||
// dbus-send --print-reply --system --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown
|
|
||||||
QDBusInterface computer("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device.SystemPowerManagement", QDBusConnection::systemBus());
|
|
||||||
computer.call("Suspend", 5);
|
|
||||||
#endif
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void misc::shutdownComputer(bool sleep) {
|
void misc::shutdownComputer(bool sleep) {
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
// Use dbus to power off the system
|
// Use dbus to power off the system
|
||||||
@@ -292,6 +283,7 @@ void misc::shutdownComputer(bool sleep) {
|
|||||||
(PTOKEN_PRIVILEGES) NULL, 0);
|
(PTOKEN_PRIVILEGES) NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif // DISABLE_GUI
|
||||||
|
|
||||||
QString misc::truncateRootFolder(boost::intrusive_ptr<torrent_info> t) {
|
QString misc::truncateRootFolder(boost::intrusive_ptr<torrent_info> t) {
|
||||||
#if LIBTORRENT_VERSION_MINOR >= 16
|
#if LIBTORRENT_VERSION_MINOR >= 16
|
||||||
|
|||||||
@@ -110,7 +110,9 @@ public:
|
|||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_GUI
|
||||||
static void shutdownComputer(bool sleep=false);
|
static void shutdownComputer(bool sleep=false);
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool safeRemove(QString file_path) {
|
static bool safeRemove(QString file_path) {
|
||||||
QFile MyFile(file_path);
|
QFile MyFile(file_path);
|
||||||
|
|||||||
@@ -1965,16 +1965,21 @@ void QBtSession::readAlerts() {
|
|||||||
qDebug("Emitting finishedTorrent() signal");
|
qDebug("Emitting finishedTorrent() signal");
|
||||||
emit finishedTorrent(h);
|
emit finishedTorrent(h);
|
||||||
qDebug("Received finished alert for %s", qPrintable(h.name()));
|
qDebug("Received finished alert for %s", qPrintable(h.name()));
|
||||||
|
#ifndef DISABLE_GUI
|
||||||
bool will_shutdown = (pref.shutdownWhenDownloadsComplete() ||
|
bool will_shutdown = (pref.shutdownWhenDownloadsComplete() ||
|
||||||
pref.shutdownqBTWhenDownloadsComplete() ||
|
pref.shutdownqBTWhenDownloadsComplete() ||
|
||||||
pref.suspendWhenDownloadsComplete())
|
pref.suspendWhenDownloadsComplete())
|
||||||
&& !hasDownloadingTorrents();
|
&& !hasDownloadingTorrents();
|
||||||
|
#else
|
||||||
|
bool will_shutdown = false;
|
||||||
|
#endif
|
||||||
// AutoRun program
|
// AutoRun program
|
||||||
if(pref.isAutoRunEnabled())
|
if(pref.isAutoRunEnabled())
|
||||||
autoRunExternalProgram(h, will_shutdown);
|
autoRunExternalProgram(h, will_shutdown);
|
||||||
// Mail notification
|
// Mail notification
|
||||||
if(pref.isMailNotificationEnabled())
|
if(pref.isMailNotificationEnabled())
|
||||||
sendNotificationEmail(h);
|
sendNotificationEmail(h);
|
||||||
|
#ifndef DISABLE_GUI
|
||||||
// Auto-Shutdown
|
// Auto-Shutdown
|
||||||
if(will_shutdown) {
|
if(will_shutdown) {
|
||||||
bool suspend = pref.suspendWhenDownloadsComplete();
|
bool suspend = pref.suspendWhenDownloadsComplete();
|
||||||
@@ -1998,6 +2003,7 @@ void QBtSession::readAlerts() {
|
|||||||
qApp->exit();
|
qApp->exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif // DISABLE_GUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
include(conf.pri)
|
include(conf.pri)
|
||||||
|
|
||||||
# COMPILATION SPECIFIC
|
# COMPILATION SPECIFIC
|
||||||
QT += dbus
|
!nox {
|
||||||
|
QT += dbus
|
||||||
|
}
|
||||||
QMAKE_LFLAGS_APP += -rdynamic
|
QMAKE_LFLAGS_APP += -rdynamic
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
PKGCONFIG += libtorrent-rasterbar
|
PKGCONFIG += libtorrent-rasterbar
|
||||||
|
|||||||
Reference in New Issue
Block a user