mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
Added 'Shutdown now' button in shutdown confirmation dialog. Closes #969.
This commit is contained in:
@@ -2299,18 +2299,17 @@ void QBtSession::handleTorrentFinishedAlert(libtorrent::torrent_finished_alert*
|
||||
bool hibernate = pref->hibernateWhenDownloadsComplete();
|
||||
bool shutdown = pref->shutdownWhenDownloadsComplete();
|
||||
// Confirm shutdown
|
||||
QString confirm_msg;
|
||||
if (suspend) {
|
||||
confirm_msg = tr("The computer will now go to sleep mode unless you cancel within the next 15 seconds...");
|
||||
} else if (hibernate) {
|
||||
confirm_msg = tr("The computer will now go to hibernation mode unless you cancel within the next 15 seconds...");
|
||||
} else if (shutdown) {
|
||||
confirm_msg = tr("The computer will now be switched off unless you cancel within the next 15 seconds...");
|
||||
} else {
|
||||
confirm_msg = tr("qBittorrent will now exit unless you cancel within the next 15 seconds...");
|
||||
}
|
||||
if (!ShutdownConfirmDlg::askForConfirmation(confirm_msg))
|
||||
shutDownAction action = NO_SHUTDOWN;
|
||||
|
||||
if (suspend)
|
||||
action = SUSPEND_COMPUTER;
|
||||
else if (hibernate)
|
||||
action = HIBERNATE_COMPUTER;
|
||||
else if (shutdown)
|
||||
action = SHUTDOWN_COMPUTER;
|
||||
if (!ShutdownConfirmDlg::askForConfirmation(action))
|
||||
return;
|
||||
|
||||
// Actually shut down
|
||||
if (suspend || hibernate || shutdown) {
|
||||
qDebug("Preparing for auto-shutdown because all downloads are complete!");
|
||||
@@ -2319,12 +2318,7 @@ void QBtSession::handleTorrentFinishedAlert(libtorrent::torrent_finished_alert*
|
||||
pref->setSuspendWhenDownloadsComplete(false);
|
||||
pref->setHibernateWhenDownloadsComplete(false);
|
||||
// Make sure preferences are synced before exiting
|
||||
if (suspend)
|
||||
m_shutdownAct = SUSPEND_COMPUTER;
|
||||
else if (hibernate)
|
||||
m_shutdownAct = HIBERNATE_COMPUTER;
|
||||
else
|
||||
m_shutdownAct = SHUTDOWN_COMPUTER;
|
||||
m_shutdownAct = action;
|
||||
}
|
||||
qDebug("Exiting the application");
|
||||
qApp->exit();
|
||||
|
||||
Reference in New Issue
Block a user