diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-07-10 15:55:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-10 15:55:13 -0400 |
| commit | 4fc61c7cd4befb79beabc2cc4e6b8b9a954db95c (patch) | |
| tree | 5fe16c49d0fd410ba1c3440c5a09c36fb3128904 /src/settings.cpp | |
| parent | 69b86b206b2b659653b6f3c6cece77bf8c10ab0a (diff) | |
| parent | 315776799fe38b09b4c0684bd4c1236bdf2e329e (diff) | |
Merge pull request #1152 from isanae/small-fixes
Small fixes
Diffstat (limited to 'src/settings.cpp')
| -rw-r--r-- | src/settings.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 55283486..534e67c8 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -463,7 +463,7 @@ QSettings::Status Settings::sync() const void Settings::dump() const { static const QStringList ignore({ - "username", "password", "nexus_api_key" + "username", "password", "nexus_api_key", "nexus_username", "nexus_password" }); log::debug("settings:"); @@ -1868,6 +1868,40 @@ void NexusSettings::registerAsNXMHandler(bool force) } } +std::vector<std::chrono::seconds> NexusSettings::validationTimeouts() const +{ + using namespace std::chrono_literals; + + const auto s = get<QString>( + m_Settings, "Settings", "validation_timeouts", ""); + + const auto numbers = s.split(" "); + std::vector<std::chrono::seconds> v; + + for (auto ns : numbers) + { + ns = ns.trimmed(); + if (ns.isEmpty()) + continue; + + bool ok = false; + const auto n = ns.toInt(&ok); + + if (!ok || n < 0 || n > 100) + { + log::error("bad validation_timeouts number '{}'", ns); + continue; + } + + v.push_back(std::chrono::seconds(n)); + } + + if (v.empty()) + v = {10s, 15s, 20s}; + + return v; +} + SteamSettings::SteamSettings(Settings& parent, QSettings& settings) : m_Parent(parent), m_Settings(settings) |
