mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-30 20:05:31 +00:00
qt: Provide UI to edit custom RTC settings
This commit is contained in:
parent
c6016856d8
commit
26c9f12271
|
@ -51,6 +51,12 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::
|
||||||
ui->rng_seed_edit->setText(QStringLiteral("00000000"));
|
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();
|
this->setConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +73,12 @@ void ConfigureSystem::setConfiguration() {
|
||||||
const auto rng_seed =
|
const auto rng_seed =
|
||||||
QString("%1").arg(Settings::values.rng_seed.value_or(0), 8, 16, QLatin1Char{'0'}).toUpper();
|
QString("%1").arg(Settings::values.rng_seed.value_or(0), 8, 16, QLatin1Char{'0'}).toUpper();
|
||||||
ui->rng_seed_edit->setText(rng_seed);
|
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(QDateTime::currentSecsSinceEpoch());
|
||||||
|
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureSystem::ReadSystemSettings() {}
|
void ConfigureSystem::ReadSystemSettings() {}
|
||||||
|
@ -82,6 +94,11 @@ void ConfigureSystem::applyConfiguration() {
|
||||||
else
|
else
|
||||||
Settings::values.rng_seed = std::nullopt;
|
Settings::values.rng_seed = std::nullopt;
|
||||||
|
|
||||||
|
if (ui->custom_rtc_checkbox->isChecked())
|
||||||
|
Settings::values.custom_rtc = ui->custom_rtc_edit->dateTime().toSecsSinceEpoch();
|
||||||
|
else
|
||||||
|
Settings::values.custom_rtc = std::nullopt;
|
||||||
|
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,13 @@
|
||||||
<string>System Settings</string>
|
<string>System Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_sound">
|
||||||
|
<property name="text">
|
||||||
|
<string>Sound output mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="combo_language">
|
<widget class="QComboBox" name="combo_language">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -114,27 +121,6 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_console_id">
|
|
||||||
<property name="text">
|
|
||||||
<string>Console ID:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_sound">
|
|
||||||
<property name="text">
|
|
||||||
<string>Sound output mode</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_birthday">
|
|
||||||
<property name="text">
|
|
||||||
<string>Birthday</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_birthday2">
|
<layout class="QHBoxLayout" name="horizontalLayout_birthday2">
|
||||||
<item>
|
<item>
|
||||||
|
@ -206,6 +192,20 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_console_id">
|
||||||
|
<property name="text">
|
||||||
|
<string>Console ID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_birthday">
|
||||||
|
<property name="text">
|
||||||
|
<string>Birthday</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QPushButton" name="button_regenerate_console_id">
|
<widget class="QPushButton" name="button_regenerate_console_id">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -241,6 +241,13 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QCheckBox" name="rng_seed_checkbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>RNG Seed</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_language">
|
<widget class="QLabel" name="label_language">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -248,14 +255,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="1">
|
||||||
<widget class="QCheckBox" name="rng_seed_checkbox">
|
|
||||||
<property name="text">
|
|
||||||
<string>RNG Seed</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLineEdit" name="rng_seed_edit">
|
<widget class="QLineEdit" name="rng_seed_edit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
@ -276,6 +276,27 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QCheckBox" name="custom_rtc_checkbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Custom RTC</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QDateTimeEdit" name="custom_rtc_edit">
|
||||||
|
<property name="minimumDate">
|
||||||
|
<date>
|
||||||
|
<year>1970</year>
|
||||||
|
<month>1</month>
|
||||||
|
<day>1</day>
|
||||||
|
</date>
|
||||||
|
</property>
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string>d MMM yyyy h:mm:ss AP</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue