diff options
| author | 2018-12-28 18:36:14 -0500 | |
|---|---|---|
| committer | 2019-01-07 19:19:40 -0500 | |
| commit | 26c9f122717302bda10e084d8f3c3ed9c388a08d (patch) | |
| tree | e726809ee6467b88128d7dc207830cfece2e5044 /src | |
| parent | settings: Add custom RTC settings (diff) | |
| download | yuzu-26c9f122717302bda10e084d8f3c3ed9c388a08d.tar.gz yuzu-26c9f122717302bda10e084d8f3c3ed9c388a08d.tar.xz yuzu-26c9f122717302bda10e084d8f3c3ed9c388a08d.zip | |
qt: Provide UI to edit custom RTC settings
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 17 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_system.ui | 77 |
2 files changed, 66 insertions, 28 deletions
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 445d01ca0..753db75d2 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:: | |||
| 51 | ui->rng_seed_edit->setText(QStringLiteral("00000000")); | 51 | ui->rng_seed_edit->setText(QStringLiteral("00000000")); |
| 52 | }); | 52 | }); |
| 53 | 53 | ||
| 54 | connect(ui->custom_rtc_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) { | ||
| 55 | ui->custom_rtc_edit->setEnabled(checked); | ||
| 56 | if (!checked) | ||
| 57 | ui->custom_rtc_edit->setDateTime(QDateTime::currentDateTime()); | ||
| 58 | }); | ||
| 59 | |||
| 54 | this->setConfiguration(); | 60 | this->setConfiguration(); |
| 55 | } | 61 | } |
| 56 | 62 | ||
| @@ -67,6 +73,12 @@ void ConfigureSystem::setConfiguration() { | |||
| 67 | const auto rng_seed = | 73 | const auto rng_seed = |
| 68 | QString("%1").arg(Settings::values.rng_seed.value_or(0), 8, 16, QLatin1Char{'0'}).toUpper(); | 74 | QString("%1").arg(Settings::values.rng_seed.value_or(0), 8, 16, QLatin1Char{'0'}).toUpper(); |
| 69 | ui->rng_seed_edit->setText(rng_seed); | 75 | ui->rng_seed_edit->setText(rng_seed); |
| 76 | |||
| 77 | ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); | ||
| 78 | ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); | ||
| 79 | |||
| 80 | const auto rtc_time = Settings::values.custom_rtc.value_or(QDateTime::currentSecsSinceEpoch()); | ||
| 81 | ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time)); | ||
| 70 | } | 82 | } |
| 71 | 83 | ||
| 72 | void ConfigureSystem::ReadSystemSettings() {} | 84 | void ConfigureSystem::ReadSystemSettings() {} |
| @@ -82,6 +94,11 @@ void ConfigureSystem::applyConfiguration() { | |||
| 82 | else | 94 | else |
| 83 | Settings::values.rng_seed = std::nullopt; | 95 | Settings::values.rng_seed = std::nullopt; |
| 84 | 96 | ||
| 97 | if (ui->custom_rtc_checkbox->isChecked()) | ||
| 98 | Settings::values.custom_rtc = ui->custom_rtc_edit->dateTime().toSecsSinceEpoch(); | ||
| 99 | else | ||
| 100 | Settings::values.custom_rtc = std::nullopt; | ||
| 101 | |||
| 85 | Settings::Apply(); | 102 | Settings::Apply(); |
| 86 | } | 103 | } |
| 87 | 104 | ||
diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index 74e800c2a..073327298 100644 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui | |||
| @@ -22,6 +22,13 @@ | |||
| 22 | <string>System Settings</string> | 22 | <string>System Settings</string> |
| 23 | </property> | 23 | </property> |
| 24 | <layout class="QGridLayout" name="gridLayout"> | 24 | <layout class="QGridLayout" name="gridLayout"> |
| 25 | <item row="2" column="0"> | ||
| 26 | <widget class="QLabel" name="label_sound"> | ||
| 27 | <property name="text"> | ||
| 28 | <string>Sound output mode</string> | ||
| 29 | </property> | ||
| 30 | </widget> | ||
| 31 | </item> | ||
| 25 | <item row="1" column="1"> | 32 | <item row="1" column="1"> |
| 26 | <widget class="QComboBox" name="combo_language"> | 33 | <widget class="QComboBox" name="combo_language"> |
| 27 | <property name="toolTip"> | 34 | <property name="toolTip"> |
| @@ -114,27 +121,6 @@ | |||
| 114 | </item> | 121 | </item> |
| 115 | </widget> | 122 | </widget> |
| 116 | </item> | 123 | </item> |
| 117 | <item row="3" column="0"> | ||
| 118 | <widget class="QLabel" name="label_console_id"> | ||
| 119 | <property name="text"> | ||
| 120 | <string>Console ID:</string> | ||
| 121 | </property> | ||
| 122 | </widget> | ||
| 123 | </item> | ||
| 124 | <item row="2" column="0"> | ||
| 125 | <widget class="QLabel" name="label_sound"> | ||
| 126 | <property name="text"> | ||
| 127 | <string>Sound output mode</string> | ||
| 128 | </property> | ||
| 129 | </widget> | ||
| 130 | </item> | ||
| 131 | <item row="0" column="0"> | ||
| 132 | <widget class="QLabel" name="label_birthday"> | ||
| 133 | <property name="text"> | ||
| 134 | <string>Birthday</string> | ||
| 135 | </property> | ||
| 136 | </widget> | ||
| 137 | </item> | ||
| 138 | <item row="0" column="1"> | 124 | <item row="0" column="1"> |
| 139 | <layout class="QHBoxLayout" name="horizontalLayout_birthday2"> | 125 | <layout class="QHBoxLayout" name="horizontalLayout_birthday2"> |
| 140 | <item> | 126 | <item> |
| @@ -206,6 +192,20 @@ | |||
| 206 | </item> | 192 | </item> |
| 207 | </layout> | 193 | </layout> |
| 208 | </item> | 194 | </item> |
| 195 | <item row="3" column="0"> | ||
| 196 | <widget class="QLabel" name="label_console_id"> | ||
| 197 | <property name="text"> | ||
| 198 | <string>Console ID:</string> | ||
| 199 | </property> | ||
| 200 | </widget> | ||
| 201 | </item> | ||
| 202 | <item row="0" column="0"> | ||
| 203 | <widget class="QLabel" name="label_birthday"> | ||
| 204 | <property name="text"> | ||
| 205 | <string>Birthday</string> | ||
| 206 | </property> | ||
| 207 | </widget> | ||
| 208 | </item> | ||
| 209 | <item row="3" column="1"> | 209 | <item row="3" column="1"> |
| 210 | <widget class="QPushButton" name="button_regenerate_console_id"> | 210 | <widget class="QPushButton" name="button_regenerate_console_id"> |
| 211 | <property name="sizePolicy"> | 211 | <property name="sizePolicy"> |
| @@ -241,21 +241,21 @@ | |||
| 241 | </item> | 241 | </item> |
| 242 | </widget> | 242 | </widget> |
| 243 | </item> | 243 | </item> |
| 244 | <item row="1" column="0"> | 244 | <item row="5" column="0"> |
| 245 | <widget class="QLabel" name="label_language"> | 245 | <widget class="QCheckBox" name="rng_seed_checkbox"> |
| 246 | <property name="text"> | 246 | <property name="text"> |
| 247 | <string>Language</string> | 247 | <string>RNG Seed</string> |
| 248 | </property> | 248 | </property> |
| 249 | </widget> | 249 | </widget> |
| 250 | </item> | 250 | </item> |
| 251 | <item row="4" column="0"> | 251 | <item row="1" column="0"> |
| 252 | <widget class="QCheckBox" name="rng_seed_checkbox"> | 252 | <widget class="QLabel" name="label_language"> |
| 253 | <property name="text"> | 253 | <property name="text"> |
| 254 | <string>RNG Seed</string> | 254 | <string>Language</string> |
| 255 | </property> | 255 | </property> |
| 256 | </widget> | 256 | </widget> |
| 257 | </item> | 257 | </item> |
| 258 | <item row="4" column="1"> | 258 | <item row="5" column="1"> |
| 259 | <widget class="QLineEdit" name="rng_seed_edit"> | 259 | <widget class="QLineEdit" name="rng_seed_edit"> |
| 260 | <property name="sizePolicy"> | 260 | <property name="sizePolicy"> |
| 261 | <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> | 261 | <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
| @@ -276,6 +276,27 @@ | |||
| 276 | </property> | 276 | </property> |
| 277 | </widget> | 277 | </widget> |
| 278 | </item> | 278 | </item> |
| 279 | <item row="4" column="0"> | ||
| 280 | <widget class="QCheckBox" name="custom_rtc_checkbox"> | ||
| 281 | <property name="text"> | ||
| 282 | <string>Custom RTC</string> | ||
| 283 | </property> | ||
| 284 | </widget> | ||
| 285 | </item> | ||
| 286 | <item row="4" column="1"> | ||
| 287 | <widget class="QDateTimeEdit" name="custom_rtc_edit"> | ||
| 288 | <property name="minimumDate"> | ||
| 289 | <date> | ||
| 290 | <year>1970</year> | ||
| 291 | <month>1</month> | ||
| 292 | <day>1</day> | ||
| 293 | </date> | ||
| 294 | </property> | ||
| 295 | <property name="displayFormat"> | ||
| 296 | <string>d MMM yyyy h:mm:ss AP</string> | ||
| 297 | </property> | ||
| 298 | </widget> | ||
| 299 | </item> | ||
| 279 | </layout> | 300 | </layout> |
| 280 | </widget> | 301 | </widget> |
| 281 | </item> | 302 | </item> |