From ab8e35b6b4721c4491ff368db97a9a4aac953e83 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 15 Jan 2011 08:48:20 +0000 Subject: [PATCH] Really get rid of nox dependency in nox mode --- src/misc.cpp | 14 +------------- src/qtlibtorrent/qbtsession.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/misc.cpp b/src/misc.cpp index 19b533cf0..77b091533 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -198,18 +198,6 @@ 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 @@ -295,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 @@ -328,7 +317,6 @@ QString misc::truncateRootFolder(boost::intrusive_ptr t) { } return root_folder; } -#endif // DISABLE_GUI QString misc::truncateRootFolder(libtorrent::torrent_handle h) { torrent_info t = h.get_torrent_info(); diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 61bc2789d..f4f3ed50b 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1964,16 +1964,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(); @@ -1997,6 +2002,7 @@ void QBtSession::readAlerts() { qApp->exit(); return; } +#endif // DISABLE_GUI } } }