mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 00:17:23 -06:00
Add reboot option when downloads complete
This commit implements a new "Reboot System" option that allows users to automatically reboot the computer when all downloads are complete, similar to the existing shutdown, suspend, and hibernate options. Closes #10774. PR #23525.
This commit is contained in:
@@ -776,8 +776,9 @@ void Application::allTorrentsFinished()
|
||||
bool isShutdown = pref->shutdownWhenDownloadsComplete();
|
||||
bool isSuspend = pref->suspendWhenDownloadsComplete();
|
||||
bool isHibernate = pref->hibernateWhenDownloadsComplete();
|
||||
bool isReboot = pref->rebootWhenDownloadsComplete();
|
||||
|
||||
bool haveAction = isExit || isShutdown || isSuspend || isHibernate;
|
||||
const bool haveAction = isExit || isShutdown || isSuspend || isHibernate || isReboot;
|
||||
if (!haveAction) return;
|
||||
|
||||
ShutdownDialogAction action = ShutdownDialogAction::Exit;
|
||||
@@ -787,6 +788,8 @@ void Application::allTorrentsFinished()
|
||||
action = ShutdownDialogAction::Hibernate;
|
||||
else if (isShutdown)
|
||||
action = ShutdownDialogAction::Shutdown;
|
||||
else if (isReboot)
|
||||
action = ShutdownDialogAction::Reboot;
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
// ask confirm
|
||||
@@ -808,6 +811,7 @@ void Application::allTorrentsFinished()
|
||||
pref->setShutdownWhenDownloadsComplete(false);
|
||||
pref->setSuspendWhenDownloadsComplete(false);
|
||||
pref->setHibernateWhenDownloadsComplete(false);
|
||||
pref->setRebootWhenDownloadsComplete(false);
|
||||
// Make sure preferences are synced before exiting
|
||||
m_shutdownAct = action;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user