summaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_system.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-01-10 17:05:21 -0500
committerGitHub <noreply@github.com>2019-01-10 17:05:21 -0500
commitc9ef8b0af1a5908822ca0f3bb3b2238018a555e8 (patch)
tree157da486e44b5f7083607159e1bb8bb3e4f20842 /src/yuzu/configuration/configure_system.cpp
parent83e8ad23310937bb72f4412c15f45231a19202f7 (diff)
parentac7d8983ebc75b1b5e150ea7e03ff54267faf670 (diff)
Merge pull request #1959 from DarkLordZach/custom-rtc
settings: Add support for setting the RTC manually
Diffstat (limited to 'src/yuzu/configuration/configure_system.cpp')
-rw-r--r--src/yuzu/configuration/configure_system.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 445d01ca0..94e27349d 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -51,6 +51,12 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::
ui->rng_seed_edit->setText(QStringLiteral("00000000"));
});
+ connect(ui->custom_rtc_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) {
+ ui->custom_rtc_edit->setEnabled(checked);
+ if (!checked)
+ ui->custom_rtc_edit->setDateTime(QDateTime::currentDateTime());
+ });
+
this->setConfiguration();
}
@@ -67,6 +73,13 @@ void ConfigureSystem::setConfiguration() {
const auto rng_seed =
QString("%1").arg(Settings::values.rng_seed.value_or(0), 8, 16, QLatin1Char{'0'}).toUpper();
ui->rng_seed_edit->setText(rng_seed);
+
+ ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value());
+ ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value());
+
+ const auto rtc_time = Settings::values.custom_rtc.value_or(
+ std::chrono::seconds(QDateTime::currentSecsSinceEpoch()));
+ ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
}
void ConfigureSystem::ReadSystemSettings() {}
@@ -82,6 +95,12 @@ void ConfigureSystem::applyConfiguration() {
else
Settings::values.rng_seed = std::nullopt;
+ if (ui->custom_rtc_checkbox->isChecked())
+ Settings::values.custom_rtc =
+ std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch());
+ else
+ Settings::values.custom_rtc = std::nullopt;
+
Settings::Apply();
}