|
|
@ -67,12 +67,6 @@ void ConfigureSystem::SetConfiguration() {
|
|
|
|
const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or(
|
|
|
|
const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or(
|
|
|
|
std::chrono::seconds(QDateTime::currentSecsSinceEpoch()));
|
|
|
|
std::chrono::seconds(QDateTime::currentSecsSinceEpoch()));
|
|
|
|
|
|
|
|
|
|
|
|
if (Settings::configuring_global) {
|
|
|
|
|
|
|
|
ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue());
|
|
|
|
|
|
|
|
ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue());
|
|
|
|
|
|
|
|
ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue());
|
|
|
|
|
|
|
|
ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value());
|
|
|
|
ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value());
|
|
|
|
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() &&
|
|
|
|
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() &&
|
|
|
|
Settings::values.rng_seed.UsingGlobal());
|
|
|
|
Settings::values.rng_seed.UsingGlobal());
|
|
|
@ -82,6 +76,12 @@ void ConfigureSystem::SetConfiguration() {
|
|
|
|
ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() &&
|
|
|
|
ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() &&
|
|
|
|
Settings::values.rng_seed.UsingGlobal());
|
|
|
|
Settings::values.rng_seed.UsingGlobal());
|
|
|
|
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
|
|
|
|
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Settings::configuring_global) {
|
|
|
|
|
|
|
|
ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue());
|
|
|
|
|
|
|
|
ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue());
|
|
|
|
|
|
|
|
ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue());
|
|
|
|
|
|
|
|
ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ConfigurationShared::SetPerGameSetting(ui->combo_language,
|
|
|
|
ConfigurationShared::SetPerGameSetting(ui->combo_language,
|
|
|
|
&Settings::values.language_index);
|
|
|
|
&Settings::values.language_index);
|
|
|
@ -90,27 +90,14 @@ void ConfigureSystem::SetConfiguration() {
|
|
|
|
&Settings::values.time_zone_index);
|
|
|
|
&Settings::values.time_zone_index);
|
|
|
|
ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index);
|
|
|
|
ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index);
|
|
|
|
|
|
|
|
|
|
|
|
if (Settings::values.rng_seed.UsingGlobal()) {
|
|
|
|
ConfigurationShared::SetHighlight(ui->label_language, "label_language",
|
|
|
|
ui->rng_seed_checkbox->setCheckState(Qt::PartiallyChecked);
|
|
|
|
!Settings::values.language_index.UsingGlobal());
|
|
|
|
} else {
|
|
|
|
ConfigurationShared::SetHighlight(ui->label_region, "label_region",
|
|
|
|
ui->rng_seed_checkbox->setCheckState(
|
|
|
|
!Settings::values.region_index.UsingGlobal());
|
|
|
|
Settings::values.rng_seed.GetValue().has_value() ? Qt::Checked : Qt::Unchecked);
|
|
|
|
ConfigurationShared::SetHighlight(ui->label_timezone, "label_timezone",
|
|
|
|
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value());
|
|
|
|
!Settings::values.time_zone_index.UsingGlobal());
|
|
|
|
if (Settings::values.rng_seed.GetValue().has_value()) {
|
|
|
|
ConfigurationShared::SetHighlight(ui->label_sound, "label_sound",
|
|
|
|
ui->rng_seed_edit->setText(rng_seed);
|
|
|
|
!Settings::values.sound_index.UsingGlobal());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Settings::values.custom_rtc.UsingGlobal()) {
|
|
|
|
|
|
|
|
ui->custom_rtc_checkbox->setCheckState(Qt::PartiallyChecked);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ui->custom_rtc_checkbox->setCheckState(
|
|
|
|
|
|
|
|
Settings::values.custom_rtc.GetValue().has_value() ? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
|
|
|
ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value());
|
|
|
|
|
|
|
|
if (Settings::values.custom_rtc.GetValue().has_value()) {
|
|
|
|
|
|
|
|
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -161,37 +148,44 @@ void ConfigureSystem::ApplyConfiguration() {
|
|
|
|
ui->combo_time_zone);
|
|
|
|
ui->combo_time_zone);
|
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
|
|
|
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
|
|
|
|
|
|
|
|
|
|
|
|
switch (ui->rng_seed_checkbox->checkState()) {
|
|
|
|
switch (use_rng_seed) {
|
|
|
|
case Qt::Checked:
|
|
|
|
case ConfigurationShared::CheckState::On:
|
|
|
|
Settings::values.rng_seed.SetGlobal(false);
|
|
|
|
case ConfigurationShared::CheckState::Off:
|
|
|
|
Settings::values.rng_seed.SetValue(ui->rng_seed_edit->text().toULongLong(nullptr, 16));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Qt::Unchecked:
|
|
|
|
|
|
|
|
Settings::values.rng_seed.SetGlobal(false);
|
|
|
|
Settings::values.rng_seed.SetGlobal(false);
|
|
|
|
|
|
|
|
if (ui->rng_seed_checkbox->isChecked()) {
|
|
|
|
|
|
|
|
Settings::values.rng_seed.SetValue(
|
|
|
|
|
|
|
|
ui->rng_seed_edit->text().toULongLong(nullptr, 16));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
Settings::values.rng_seed.SetValue(std::nullopt);
|
|
|
|
Settings::values.rng_seed.SetValue(std::nullopt);
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case Qt::PartiallyChecked:
|
|
|
|
case ConfigurationShared::CheckState::Global:
|
|
|
|
Settings::values.rng_seed.SetGlobal(false);
|
|
|
|
Settings::values.rng_seed.SetGlobal(false);
|
|
|
|
Settings::values.rng_seed.SetValue(std::nullopt);
|
|
|
|
Settings::values.rng_seed.SetValue(std::nullopt);
|
|
|
|
Settings::values.rng_seed.SetGlobal(true);
|
|
|
|
Settings::values.rng_seed.SetGlobal(true);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ConfigurationShared::CheckState::Count:
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (ui->custom_rtc_checkbox->checkState()) {
|
|
|
|
switch (use_custom_rtc) {
|
|
|
|
case Qt::Checked:
|
|
|
|
case ConfigurationShared::CheckState::On:
|
|
|
|
|
|
|
|
case ConfigurationShared::CheckState::Off:
|
|
|
|
Settings::values.custom_rtc.SetGlobal(false);
|
|
|
|
Settings::values.custom_rtc.SetGlobal(false);
|
|
|
|
|
|
|
|
if (ui->custom_rtc_checkbox->isChecked()) {
|
|
|
|
Settings::values.custom_rtc.SetValue(
|
|
|
|
Settings::values.custom_rtc.SetValue(
|
|
|
|
std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()));
|
|
|
|
std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()));
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
case Qt::Unchecked:
|
|
|
|
|
|
|
|
Settings::values.custom_rtc.SetGlobal(false);
|
|
|
|
|
|
|
|
Settings::values.custom_rtc.SetValue(std::nullopt);
|
|
|
|
Settings::values.custom_rtc.SetValue(std::nullopt);
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case Qt::PartiallyChecked:
|
|
|
|
case ConfigurationShared::CheckState::Global:
|
|
|
|
Settings::values.custom_rtc.SetGlobal(false);
|
|
|
|
Settings::values.custom_rtc.SetGlobal(false);
|
|
|
|
Settings::values.custom_rtc.SetValue(std::nullopt);
|
|
|
|
Settings::values.custom_rtc.SetValue(std::nullopt);
|
|
|
|
Settings::values.custom_rtc.SetGlobal(true);
|
|
|
|
Settings::values.custom_rtc.SetGlobal(true);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ConfigurationShared::CheckState::Count:
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -229,10 +223,23 @@ void ConfigureSystem::SetupPerGameUI() {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ConfigurationShared::InsertGlobalItem(ui->combo_language);
|
|
|
|
ConfigurationShared::SetColoredComboBox(ui->combo_language, ui->label_language,
|
|
|
|
ConfigurationShared::InsertGlobalItem(ui->combo_region);
|
|
|
|
"label_language",
|
|
|
|
ConfigurationShared::InsertGlobalItem(ui->combo_time_zone);
|
|
|
|
Settings::values.language_index.GetValue(true));
|
|
|
|
ConfigurationShared::InsertGlobalItem(ui->combo_sound);
|
|
|
|
ConfigurationShared::SetColoredComboBox(ui->combo_region, ui->label_region, "label_region",
|
|
|
|
ui->rng_seed_checkbox->setTristate(true);
|
|
|
|
Settings::values.region_index.GetValue(true));
|
|
|
|
ui->custom_rtc_checkbox->setTristate(true);
|
|
|
|
ConfigurationShared::SetColoredComboBox(ui->combo_time_zone, ui->label_timezone,
|
|
|
|
|
|
|
|
"label_timezone",
|
|
|
|
|
|
|
|
Settings::values.time_zone_index.GetValue(true));
|
|
|
|
|
|
|
|
ConfigurationShared::SetColoredComboBox(ui->combo_sound, ui->label_sound, "label_sound",
|
|
|
|
|
|
|
|
Settings::values.sound_index.GetValue(true));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConfigurationShared::SetColoredTristate(
|
|
|
|
|
|
|
|
ui->rng_seed_checkbox, "rng_seed_checkbox", Settings::values.rng_seed.UsingGlobal(),
|
|
|
|
|
|
|
|
Settings::values.rng_seed.GetValue().has_value(),
|
|
|
|
|
|
|
|
Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed);
|
|
|
|
|
|
|
|
ConfigurationShared::SetColoredTristate(
|
|
|
|
|
|
|
|
ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(),
|
|
|
|
|
|
|
|
Settings::values.custom_rtc.GetValue().has_value(),
|
|
|
|
|
|
|
|
Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|