parent
							
								
									cfd885163f
								
							
						
					
					
						commit
						d9c1b94f03
					
				@ -16,28 +16,8 @@
 | 
			
		||||
#include "ui_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) {
 | 
			
		||||
    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,
 | 
			
		||||
            &ConfigureSystem::RefreshConsoleID);
 | 
			
		||||
 | 
			
		||||
@ -101,31 +81,6 @@ void ConfigureSystem::applyConfiguration() {
 | 
			
		||||
    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() {
 | 
			
		||||
    QMessageBox::StandardButton reply;
 | 
			
		||||
    QString warning_text = tr("This will replace your current virtual Switch with a new one. "
 | 
			
		||||
 | 
			
		||||
@ -26,14 +26,11 @@ public:
 | 
			
		||||
private:
 | 
			
		||||
    void ReadSystemSettings();
 | 
			
		||||
 | 
			
		||||
    void UpdateBirthdayComboBox(int birthmonth_index);
 | 
			
		||||
    void RefreshConsoleID();
 | 
			
		||||
 | 
			
		||||
    std::unique_ptr<Ui::ConfigureSystem> ui;
 | 
			
		||||
    bool enabled = false;
 | 
			
		||||
 | 
			
		||||
    int birthmonth = 0;
 | 
			
		||||
    int birthday = 0;
 | 
			
		||||
    int language_index = 0;
 | 
			
		||||
    int sound_index = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -22,14 +22,21 @@
 | 
			
		||||
        <string>System Settings</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <layout class="QGridLayout" name="gridLayout">
 | 
			
		||||
        <item row="2" column="0">
 | 
			
		||||
        <item row="1" 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="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">
 | 
			
		||||
          <property name="toolTip">
 | 
			
		||||
           <string>Note: this can be overridden when region setting is auto-select</string>
 | 
			
		||||
@ -121,108 +128,14 @@
 | 
			
		||||
          </item>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item row="0" column="1">
 | 
			
		||||
         <layout class="QHBoxLayout" name="horizontalLayout_birthday2">
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QComboBox" name="combo_birthmonth">
 | 
			
		||||
            <item>
 | 
			
		||||
             <property name="text">
 | 
			
		||||
              <string>January</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">
 | 
			
		||||
        <item row="4" column="0">
 | 
			
		||||
         <widget class="QCheckBox" name="rng_seed_checkbox">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Console ID:</string>
 | 
			
		||||
           <string>RNG Seed</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">
 | 
			
		||||
         <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">
 | 
			
		||||
        <item row="1" column="1">
 | 
			
		||||
         <widget class="QComboBox" name="combo_sound">
 | 
			
		||||
          <item>
 | 
			
		||||
           <property name="text">
 | 
			
		||||
@ -241,21 +154,51 @@
 | 
			
		||||
          </item>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </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="0" column="0">
 | 
			
		||||
         <widget class="QLabel" name="label_language">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Language</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </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">
 | 
			
		||||
          <property name="sizePolicy">
 | 
			
		||||
           <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
 | 
			
		||||
@ -276,27 +219,6 @@
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </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>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user