general: Demote custom_rtc to regular setting
This commit is contained in:
parent
ab2677f0a1
commit
339dc4f806
6 changed files with 30 additions and 58 deletions
|
@ -868,17 +868,14 @@ void Config::ReadSystemValues() {
|
|||
}
|
||||
}
|
||||
|
||||
bool custom_rtc_enabled;
|
||||
ReadSettingGlobal(custom_rtc_enabled, QStringLiteral("custom_rtc_enabled"), false);
|
||||
bool custom_rtc_global =
|
||||
global || qt_config->value(QStringLiteral("custom_rtc/use_global"), true).toBool();
|
||||
Settings::values.custom_rtc.SetGlobal(custom_rtc_global);
|
||||
if (global || !custom_rtc_global) {
|
||||
if (global) {
|
||||
const auto custom_rtc_enabled =
|
||||
ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool();
|
||||
if (custom_rtc_enabled) {
|
||||
Settings::values.custom_rtc.SetValue(
|
||||
std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()));
|
||||
Settings::values.custom_rtc =
|
||||
std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong());
|
||||
} else {
|
||||
Settings::values.custom_rtc.SetValue(std::nullopt);
|
||||
Settings::values.custom_rtc = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1433,14 +1430,14 @@ void Config::SaveSystemValues() {
|
|||
Settings::values.rng_seed.GetValue(global).value_or(0),
|
||||
Settings::values.rng_seed.UsingGlobal(), 0);
|
||||
|
||||
WriteSettingGlobal(QStringLiteral("custom_rtc_enabled"),
|
||||
Settings::values.custom_rtc.GetValue(global).has_value(),
|
||||
Settings::values.custom_rtc.UsingGlobal(), false);
|
||||
WriteSettingGlobal(
|
||||
QStringLiteral("custom_rtc"),
|
||||
QVariant::fromValue<long long>(
|
||||
Settings::values.custom_rtc.GetValue(global).value_or(std::chrono::seconds{}).count()),
|
||||
Settings::values.custom_rtc.UsingGlobal(), 0);
|
||||
if (global) {
|
||||
WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(),
|
||||
false);
|
||||
WriteSetting(QStringLiteral("custom_rtc"),
|
||||
QVariant::fromValue<long long>(
|
||||
Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count()),
|
||||
0);
|
||||
}
|
||||
|
||||
WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue