diff options
author | bunnei <bunneidev@gmail.com> | 2019-01-10 17:05:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-10 17:05:21 -0500 |
commit | c9ef8b0af1a5908822ca0f3bb3b2238018a555e8 (patch) | |
tree | 157da486e44b5f7083607159e1bb8bb3e4f20842 /src/yuzu/configuration/configure_system.cpp | |
parent | 83e8ad23310937bb72f4412c15f45231a19202f7 (diff) | |
parent | ac7d8983ebc75b1b5e150ea7e03ff54267faf670 (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.cpp | 19 |
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(); } |