mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 15:56:17 -07:00
Inhibit sleep regardless of activity
"Active torrents" is a somewhat unintuitive concept as a basis for preventing sleep, as torrents can become active or inactive on the network at any time. This brings some predictability to the inhibit sleep option, and will inhibit sleep as long as there are unpaused downloads or uploads, regardless of network activity. Closes #1696, #4592, #4655, #7019, #7159, #7452
This commit is contained in:
parent
e59841d35c
commit
48cd993c92
9 changed files with 72 additions and 36 deletions
|
@ -235,14 +235,24 @@ void Preferences::setSplashScreenDisabled(bool b)
|
|||
}
|
||||
|
||||
// Preventing from system suspend while active torrents are presented.
|
||||
bool Preferences::preventFromSuspend() const
|
||||
bool Preferences::preventFromSuspendWhenDownloading() const
|
||||
{
|
||||
return value("Preferences/General/PreventFromSuspend", false).toBool();
|
||||
return value("Preferences/General/PreventFromSuspendWhenDownloading", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setPreventFromSuspend(bool b)
|
||||
void Preferences::setPreventFromSuspendWhenDownloading(bool b)
|
||||
{
|
||||
setValue("Preferences/General/PreventFromSuspend", b);
|
||||
setValue("Preferences/General/PreventFromSuspendWhenDownloading", b);
|
||||
}
|
||||
|
||||
bool Preferences::preventFromSuspendWhenSeeding() const
|
||||
{
|
||||
return value("Preferences/General/PreventFromSuspendWhenSeeding", false).toBool();
|
||||
}
|
||||
|
||||
void Preferences::setPreventFromSuspendWhenSeeding(bool b)
|
||||
{
|
||||
setValue("Preferences/General/PreventFromSuspendWhenSeeding", b);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -1552,6 +1562,8 @@ void Preferences::setSpeedWidgetGraphEnable(int id, const bool enable)
|
|||
|
||||
void Preferences::upgrade()
|
||||
{
|
||||
SettingsStorage *settingsStorage = SettingsStorage::instance();
|
||||
|
||||
QStringList labels = value("TransferListFilters/customLabels").toStringList();
|
||||
if (!labels.isEmpty()) {
|
||||
QVariantMap categories = value("BitTorrent/Session/Categories").toMap();
|
||||
|
@ -1560,10 +1572,17 @@ void Preferences::upgrade()
|
|||
categories[label] = "";
|
||||
}
|
||||
setValue("BitTorrent/Session/Categories", categories);
|
||||
SettingsStorage::instance()->removeValue("TransferListFilters/customLabels");
|
||||
settingsStorage->removeValue("TransferListFilters/customLabels");
|
||||
}
|
||||
|
||||
SettingsStorage::instance()->removeValue("Preferences/Downloads/AppendLabel");
|
||||
settingsStorage->removeValue("Preferences/Downloads/AppendLabel");
|
||||
|
||||
// Inhibit sleep based on running downloads/available seeds rather than network activity.
|
||||
if (value("Preferences/General/PreventFromSuspend", false).toBool()) {
|
||||
setPreventFromSuspendWhenDownloading(true);
|
||||
setPreventFromSuspendWhenSeeding(true);
|
||||
}
|
||||
settingsStorage->removeValue("Preferences/General/PreventFromSuspend");
|
||||
}
|
||||
|
||||
void Preferences::apply()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue