diff --git a/Changelog b/Changelog index 89feac83f..bacef3d06 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ - BUGFIX: Fix possible crashes in full allocation mode - BUGFIX: Fix icon size issues (Linux, icon theme) - BUGFIX: Fixed file priority context menu + - BUGFIX: Remove dbus dependency in nox mode - I18N: Improve Web UI translation - I18N: Updated Polish translation diff --git a/src/misc.cpp b/src/misc.cpp index faf847883..77b091533 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -70,10 +70,12 @@ const int UNLEN = 256; #include #endif +#ifndef DISABLE_GUI #ifdef Q_WS_X11 #include #include #endif +#endif // DISABLE_GUI using namespace libtorrent; @@ -196,18 +198,7 @@ long long misc::freeDiskSpaceOnPath(QString path) { #endif } -void suspendComputer() { -#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 -} - +#ifndef DISABLE_GUI void misc::shutdownComputer(bool sleep) { #ifdef Q_WS_X11 // Use dbus to power off the system @@ -292,6 +283,7 @@ void misc::shutdownComputer(bool sleep) { (PTOKEN_PRIVILEGES) NULL, 0); #endif } +#endif // DISABLE_GUI QString misc::truncateRootFolder(boost::intrusive_ptr t) { #if LIBTORRENT_VERSION_MINOR >= 16 diff --git a/src/misc.h b/src/misc.h index 5d3072dd2..919431d5f 100644 --- a/src/misc.h +++ b/src/misc.h @@ -110,7 +110,9 @@ public: return extension; } +#ifndef DISABLE_GUI static void shutdownComputer(bool sleep=false); +#endif static bool safeRemove(QString file_path) { QFile MyFile(file_path); diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 4a997cb04..59a0716f3 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1965,16 +1965,21 @@ void QBtSession::readAlerts() { qDebug("Emitting finishedTorrent() signal"); emit finishedTorrent(h); qDebug("Received finished alert for %s", qPrintable(h.name())); +#ifndef DISABLE_GUI bool will_shutdown = (pref.shutdownWhenDownloadsComplete() || pref.shutdownqBTWhenDownloadsComplete() || pref.suspendWhenDownloadsComplete()) && !hasDownloadingTorrents(); +#else + bool will_shutdown = false; +#endif // AutoRun program if(pref.isAutoRunEnabled()) autoRunExternalProgram(h, will_shutdown); // Mail notification if(pref.isMailNotificationEnabled()) sendNotificationEmail(h); +#ifndef DISABLE_GUI // Auto-Shutdown if(will_shutdown) { bool suspend = pref.suspendWhenDownloadsComplete(); @@ -1998,6 +2003,7 @@ void QBtSession::readAlerts() { qApp->exit(); return; } +#endif // DISABLE_GUI } } } diff --git a/unixconf.pri b/unixconf.pri index ecf03fe6b..9c6443828 100644 --- a/unixconf.pri +++ b/unixconf.pri @@ -2,7 +2,9 @@ include(conf.pri) # COMPILATION SPECIFIC -QT += dbus +!nox { + QT += dbus +} QMAKE_LFLAGS_APP += -rdynamic CONFIG += link_pkgconfig PKGCONFIG += libtorrent-rasterbar