mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-25 14:04:23 +00:00
Really get rid of nox dependency in nox mode
This commit is contained in:
parent
76ea7525e3
commit
ab8e35b6b4
14
src/misc.cpp
14
src/misc.cpp
@ -198,18 +198,6 @@ long long misc::freeDiskSpaceOnPath(QString path) {
|
|||||||
#endif
|
#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
|
#ifndef DISABLE_GUI
|
||||||
void misc::shutdownComputer(bool sleep) {
|
void misc::shutdownComputer(bool sleep) {
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
@ -295,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
|
||||||
@ -328,7 +317,6 @@ QString misc::truncateRootFolder(boost::intrusive_ptr<torrent_info> t) {
|
|||||||
}
|
}
|
||||||
return root_folder;
|
return root_folder;
|
||||||
}
|
}
|
||||||
#endif // DISABLE_GUI
|
|
||||||
|
|
||||||
QString misc::truncateRootFolder(libtorrent::torrent_handle h) {
|
QString misc::truncateRootFolder(libtorrent::torrent_handle h) {
|
||||||
torrent_info t = h.get_torrent_info();
|
torrent_info t = h.get_torrent_info();
|
||||||
|
@ -1964,16 +1964,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();
|
||||||
@ -1997,6 +2002,7 @@ void QBtSession::readAlerts() {
|
|||||||
qApp->exit();
|
qApp->exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif // DISABLE_GUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user