mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Added 'Shutdown now' button in shutdown confirmation dialog. Closes #969.
This commit is contained in:
parent
634000e7a9
commit
f6156217d0
3 changed files with 95 additions and 31 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue