mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 15:56:17 -07:00
Merge pull request #9244 from Couchy/inhibit_sleep_options
Inhibit sleep for running downloads or uploads regardless of network activity
This commit is contained in:
commit
366239ca7b
9 changed files with 72 additions and 36 deletions
|
@ -255,14 +255,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
|
||||
|
@ -1582,6 +1592,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();
|
||||
|
@ -1590,10 +1602,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