mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-05 06:22:45 +01:00
parent
cfd885163f
commit
d9c1b94f03
3 changed files with 52 additions and 178 deletions
|
@ -16,28 +16,8 @@
|
||||||
#include "ui_configure_system.h"
|
#include "ui_configure_system.h"
|
||||||
#include "yuzu/configuration/configure_system.h"
|
#include "yuzu/configuration/configure_system.h"
|
||||||
|
|
||||||
namespace {
|
|
||||||
constexpr std::array<int, 12> days_in_month = {{
|
|
||||||
31,
|
|
||||||
29,
|
|
||||||
31,
|
|
||||||
30,
|
|
||||||
31,
|
|
||||||
30,
|
|
||||||
31,
|
|
||||||
31,
|
|
||||||
30,
|
|
||||||
31,
|
|
||||||
30,
|
|
||||||
31,
|
|
||||||
}};
|
|
||||||
} // Anonymous namespace
|
|
||||||
|
|
||||||
ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) {
|
ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->combo_birthmonth,
|
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
|
||||||
&ConfigureSystem::UpdateBirthdayComboBox);
|
|
||||||
connect(ui->button_regenerate_console_id, &QPushButton::clicked, this,
|
connect(ui->button_regenerate_console_id, &QPushButton::clicked, this,
|
||||||
&ConfigureSystem::RefreshConsoleID);
|
&ConfigureSystem::RefreshConsoleID);
|
||||||
|
|
||||||
|
@ -101,31 +81,6 @@ void ConfigureSystem::applyConfiguration() {
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureSystem::UpdateBirthdayComboBox(int birthmonth_index) {
|
|
||||||
if (birthmonth_index < 0 || birthmonth_index >= 12)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// store current day selection
|
|
||||||
int birthday_index = ui->combo_birthday->currentIndex();
|
|
||||||
|
|
||||||
// get number of days in the new selected month
|
|
||||||
int days = days_in_month[birthmonth_index];
|
|
||||||
|
|
||||||
// if the selected day is out of range,
|
|
||||||
// reset it to 1st
|
|
||||||
if (birthday_index < 0 || birthday_index >= days)
|
|
||||||
birthday_index = 0;
|
|
||||||
|
|
||||||
// update the day combo box
|
|
||||||
ui->combo_birthday->clear();
|
|
||||||
for (int i = 1; i <= days; ++i) {
|
|
||||||
ui->combo_birthday->addItem(QString::number(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
// restore the day selection
|
|
||||||
ui->combo_birthday->setCurrentIndex(birthday_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigureSystem::RefreshConsoleID() {
|
void ConfigureSystem::RefreshConsoleID() {
|
||||||
QMessageBox::StandardButton reply;
|
QMessageBox::StandardButton reply;
|
||||||
QString warning_text = tr("This will replace your current virtual Switch with a new one. "
|
QString warning_text = tr("This will replace your current virtual Switch with a new one. "
|
||||||
|
|
|
@ -26,14 +26,11 @@ public:
|
||||||
private:
|
private:
|
||||||
void ReadSystemSettings();
|
void ReadSystemSettings();
|
||||||
|
|
||||||
void UpdateBirthdayComboBox(int birthmonth_index);
|
|
||||||
void RefreshConsoleID();
|
void RefreshConsoleID();
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureSystem> ui;
|
std::unique_ptr<Ui::ConfigureSystem> ui;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
|
||||||
int birthmonth = 0;
|
|
||||||
int birthday = 0;
|
|
||||||
int language_index = 0;
|
int language_index = 0;
|
||||||
int sound_index = 0;
|
int sound_index = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,14 +22,21 @@
|
||||||
<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">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_sound">
|
<widget class="QLabel" name="label_sound">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sound output mode</string>
|
<string>Sound output mode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_console_id">
|
||||||
|
<property name="text">
|
||||||
|
<string>Console ID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="combo_language">
|
<widget class="QComboBox" name="combo_language">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Note: this can be overridden when region setting is auto-select</string>
|
<string>Note: this can be overridden when region setting is auto-select</string>
|
||||||
|
@ -121,108 +128,14 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="4" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_birthday2">
|
<widget class="QCheckBox" name="rng_seed_checkbox">
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="combo_birthmonth">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>January</string>
|
<string>RNG Seed</string>
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>February</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>March</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>April</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>May</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>June</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>July</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>August</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>September</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>October</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>November</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>December</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="combo_birthday"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_console_id">
|
|
||||||
<property name="text">
|
|
||||||
<string>Console ID:</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="label_birthday">
|
|
||||||
<property name="text">
|
|
||||||
<string>Birthday</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QPushButton" name="button_regenerate_console_id">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Regenerate</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="combo_sound">
|
<widget class="QComboBox" name="combo_sound">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -241,21 +154,51 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="rng_seed_checkbox">
|
|
||||||
<property name="text">
|
|
||||||
<string>RNG Seed</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_language">
|
<widget class="QLabel" name="label_language">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Language</string>
|
<string>Language</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="button_regenerate_console_id">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::RightToLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Regenerate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QCheckBox" name="custom_rtc_checkbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Custom RTC</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" 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>
|
||||||
|
<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,27 +219,6 @@
|
||||||
</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