Use spinbox special value to represent "Use any available port"

WebAPI functionality is preserved (deprecated) for now and should be
removed in the future.
This commit is contained in:
Chocobo1
2021-07-28 12:24:03 +08:00
parent 09e558ae0b
commit 49aab492e0
9 changed files with 39 additions and 54 deletions

View File

@@ -102,12 +102,28 @@ namespace
settingsStorage->storeValue(newKey, Utils::String::fromEnum(torrentContentLayout));
settingsStorage->removeValue(oldKey);
}
void upgradeListenPortSettings()
{
const auto oldKey = QString::fromLatin1("BitTorrent/Session/UseRandomPort");
const auto newKey = QString::fromLatin1("Preferences/Connection/PortRangeMin");
auto *settingsStorage = SettingsStorage::instance();
if (settingsStorage->hasKey(oldKey))
{
if (settingsStorage->loadValue<bool>(oldKey))
settingsStorage->storeValue(newKey, 0);
settingsStorage->removeValue(oldKey);
}
}
}
bool upgrade(const bool /*ask*/)
{
exportWebUIHttpsFiles();
upgradeTorrentContentLayout();
upgradeListenPortSettings();
return true;
}