summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-12-25 10:42:02 -0500
committerGravatar Zach Hilman2018-12-25 10:42:14 -0500
commit4d61ac08aa0a5a65512f92a52b7a986080b20f74 (patch)
treefa9f7af5b309cb4c1839eaa6648450cf782d6e60 /src
parentMerge pull request #1886 from FearlessTobi/port-4164 (diff)
downloadyuzu-4d61ac08aa0a5a65512f92a52b7a986080b20f74.tar.gz
yuzu-4d61ac08aa0a5a65512f92a52b7a986080b20f74.tar.xz
yuzu-4d61ac08aa0a5a65512f92a52b7a986080b20f74.zip
qt: Add setting to prompt for user on game boot
Using the QtProfileSelectorDialog, this implementation is trivial. This mimics the real switch behavior of asking which user on every game boot, but it is default disabled as that might get inconvenient.
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/configuration/config.cpp3
-rw-r--r--src/yuzu/configuration/configure_general.cpp2
-rw-r--r--src/yuzu/configuration/configure_general.ui7
-rw-r--r--src/yuzu/main.cpp16
-rw-r--r--src/yuzu/main.h2
-rw-r--r--src/yuzu/ui_settings.h2
6 files changed, 32 insertions, 0 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index c4349ccc8..9ced6e0e2 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -470,6 +470,8 @@ void Config::ReadValues() {
470 qt_config->value("enable_discord_presence", true).toBool(); 470 qt_config->value("enable_discord_presence", true).toBool();
471 UISettings::values.screenshot_resolution_factor = 471 UISettings::values.screenshot_resolution_factor =
472 static_cast<u16>(qt_config->value("screenshot_resolution_factor", 0).toUInt()); 472 static_cast<u16>(qt_config->value("screenshot_resolution_factor", 0).toUInt());
473 UISettings::values.select_user_on_boot =
474 qt_config->value("select_user_on_boot", false).toBool();
473 475
474 qt_config->beginGroup("UIGameList"); 476 qt_config->beginGroup("UIGameList");
475 UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool(); 477 UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool();
@@ -693,6 +695,7 @@ void Config::SaveValues() {
693 qt_config->setValue("enable_discord_presence", UISettings::values.enable_discord_presence); 695 qt_config->setValue("enable_discord_presence", UISettings::values.enable_discord_presence);
694 qt_config->setValue("screenshot_resolution_factor", 696 qt_config->setValue("screenshot_resolution_factor",
695 UISettings::values.screenshot_resolution_factor); 697 UISettings::values.screenshot_resolution_factor);
698 qt_config->setValue("select_user_on_boot", UISettings::values.select_user_on_boot);
696 699
697 qt_config->beginGroup("UIGameList"); 700 qt_config->beginGroup("UIGameList");
698 qt_config->setValue("show_unknown", UISettings::values.show_unknown); 701 qt_config->setValue("show_unknown", UISettings::values.show_unknown);
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index 92a441308..4116b6cd7 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -30,6 +30,7 @@ ConfigureGeneral::~ConfigureGeneral() = default;
30void ConfigureGeneral::setConfiguration() { 30void ConfigureGeneral::setConfiguration() {
31 ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan); 31 ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
32 ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); 32 ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
33 ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot);
33 ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); 34 ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
34 ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit); 35 ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit);
35 ui->enable_nfc->setChecked(Settings::values.enable_nfc); 36 ui->enable_nfc->setChecked(Settings::values.enable_nfc);
@@ -42,6 +43,7 @@ void ConfigureGeneral::PopulateHotkeyList(const HotkeyRegistry& registry) {
42void ConfigureGeneral::applyConfiguration() { 43void ConfigureGeneral::applyConfiguration() {
43 UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked(); 44 UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
44 UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); 45 UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
46 UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked();
45 UISettings::values.theme = 47 UISettings::values.theme =
46 ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); 48 ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
47 49
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui
index bf37446c6..dff0ad5d0 100644
--- a/src/yuzu/configuration/configure_general.ui
+++ b/src/yuzu/configuration/configure_general.ui
@@ -38,6 +38,13 @@
38 </property> 38 </property>
39 </widget> 39 </widget>
40 </item> 40 </item>
41 <item>
42 <widget class="QCheckBox" name="toggle_user_on_boot">
43 <property name="text">
44 <string>Prompt for user on game boot</string>
45 </property>
46 </widget>
47 </item>
41 </layout> 48 </layout>
42 </item> 49 </item>
43 </layout> 50 </layout>
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 01a0f94ab..8c1d132f5 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -687,10 +687,26 @@ bool GMainWindow::LoadROM(const QString& filename) {
687 return true; 687 return true;
688} 688}
689 689
690void GMainWindow::SelectAndSetCurrentUser() {
691 QtProfileSelectionDialog dialog(this);
692 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
693 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
694 dialog.setWindowModality(Qt::WindowModal);
695 dialog.exec();
696
697 if (dialog.GetStatus()) {
698 Settings::values.current_user = static_cast<s32>(dialog.GetIndex());
699 }
700}
701
690void GMainWindow::BootGame(const QString& filename) { 702void GMainWindow::BootGame(const QString& filename) {
691 LOG_INFO(Frontend, "yuzu starting..."); 703 LOG_INFO(Frontend, "yuzu starting...");
692 StoreRecentFile(filename); // Put the filename on top of the list 704 StoreRecentFile(filename); // Put the filename on top of the list
693 705
706 if (UISettings::values.select_user_on_boot) {
707 SelectAndSetCurrentUser();
708 }
709
694 if (!LoadROM(filename)) 710 if (!LoadROM(filename))
695 return; 711 return;
696 712
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 4e37f6a2d..d560bf75b 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -128,6 +128,8 @@ private:
128 void ShowTelemetryCallout(); 128 void ShowTelemetryCallout();
129 void SetDiscordEnabled(bool state); 129 void SetDiscordEnabled(bool state);
130 130
131 void SelectAndSetCurrentUser();
132
131 /** 133 /**
132 * Stores the filename in the recently loaded files list. 134 * Stores the filename in the recently loaded files list.
133 * The new filename is stored at the beginning of the recently loaded files list. 135 * The new filename is stored at the beginning of the recently loaded files list.
diff --git a/src/yuzu/ui_settings.h b/src/yuzu/ui_settings.h
index 58ba240fd..82aaeedb0 100644
--- a/src/yuzu/ui_settings.h
+++ b/src/yuzu/ui_settings.h
@@ -40,6 +40,8 @@ struct Values {
40 bool confirm_before_closing; 40 bool confirm_before_closing;
41 bool first_start; 41 bool first_start;
42 42
43 bool select_user_on_boot;
44
43 // Discord RPC 45 // Discord RPC
44 bool enable_discord_presence; 46 bool enable_discord_presence;
45 47