diff options
| -rw-r--r-- | src/yuzu/configuration/configure_dialog.cpp | 14 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_dialog.h | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.cpp | 14 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 40 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 2 |
6 files changed, 57 insertions, 18 deletions
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 3ad40d2b3..6028135c5 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp | |||
| @@ -2,8 +2,11 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <QAbstractButton> | ||
| 6 | #include <QDialogButtonBox> | ||
| 5 | #include <QHash> | 7 | #include <QHash> |
| 6 | #include <QListWidgetItem> | 8 | #include <QListWidgetItem> |
| 9 | #include <QPushButton> | ||
| 7 | #include <QSignalBlocker> | 10 | #include <QSignalBlocker> |
| 8 | #include "common/settings.h" | 11 | #include "common/settings.h" |
| 9 | #include "core/core.h" | 12 | #include "core/core.h" |
| @@ -31,6 +34,12 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, | |||
| 31 | connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, | 34 | connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, |
| 32 | &ConfigureDialog::UpdateVisibleTabs); | 35 | &ConfigureDialog::UpdateVisibleTabs); |
| 33 | 36 | ||
| 37 | if (Core::System::GetInstance().IsPoweredOn()) { | ||
| 38 | QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); | ||
| 39 | connect(apply_button, &QAbstractButton::clicked, this, | ||
| 40 | &ConfigureDialog::HandleApplyButtonClicked); | ||
| 41 | } | ||
| 42 | |||
| 34 | adjustSize(); | 43 | adjustSize(); |
| 35 | ui->selectorList->setCurrentRow(0); | 44 | ui->selectorList->setCurrentRow(0); |
| 36 | } | 45 | } |
| @@ -80,6 +89,11 @@ void ConfigureDialog::RetranslateUI() { | |||
| 80 | ui->tabWidget->setCurrentIndex(old_index); | 89 | ui->tabWidget->setCurrentIndex(old_index); |
| 81 | } | 90 | } |
| 82 | 91 | ||
| 92 | void ConfigureDialog::HandleApplyButtonClicked() { | ||
| 93 | UISettings::values.configuration_applied = true; | ||
| 94 | ApplyConfiguration(); | ||
| 95 | } | ||
| 96 | |||
| 83 | Q_DECLARE_METATYPE(QList<QWidget*>); | 97 | Q_DECLARE_METATYPE(QList<QWidget*>); |
| 84 | 98 | ||
| 85 | void ConfigureDialog::PopulateSelectionList() { | 99 | void ConfigureDialog::PopulateSelectionList() { |
diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h index 570c3b941..abe019635 100644 --- a/src/yuzu/configuration/configure_dialog.h +++ b/src/yuzu/configuration/configure_dialog.h | |||
| @@ -35,9 +35,10 @@ signals: | |||
| 35 | 35 | ||
| 36 | private: | 36 | private: |
| 37 | void changeEvent(QEvent* event) override; | 37 | void changeEvent(QEvent* event) override; |
| 38 | |||
| 39 | void RetranslateUI(); | 38 | void RetranslateUI(); |
| 40 | 39 | ||
| 40 | void HandleApplyButtonClicked(); | ||
| 41 | |||
| 41 | void SetConfiguration(); | 42 | void SetConfiguration(); |
| 42 | void UpdateVisibleTabs(); | 43 | void UpdateVisibleTabs(); |
| 43 | void PopulateSelectionList(); | 44 | void PopulateSelectionList(); |
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index 3e13bd438..d89f1ad4b 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp | |||
| @@ -6,9 +6,12 @@ | |||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <utility> | 7 | #include <utility> |
| 8 | 8 | ||
| 9 | #include <QAbstractButton> | ||
| 9 | #include <QCheckBox> | 10 | #include <QCheckBox> |
| 11 | #include <QDialogButtonBox> | ||
| 10 | #include <QHeaderView> | 12 | #include <QHeaderView> |
| 11 | #include <QMenu> | 13 | #include <QMenu> |
| 14 | #include <QPushButton> | ||
| 12 | #include <QStandardItemModel> | 15 | #include <QStandardItemModel> |
| 13 | #include <QString> | 16 | #include <QString> |
| 14 | #include <QTimer> | 17 | #include <QTimer> |
| @@ -42,6 +45,12 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id) | |||
| 42 | scene = new QGraphicsScene; | 45 | scene = new QGraphicsScene; |
| 43 | ui->icon_view->setScene(scene); | 46 | ui->icon_view->setScene(scene); |
| 44 | 47 | ||
| 48 | if (Core::System::GetInstance().IsPoweredOn()) { | ||
| 49 | QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); | ||
| 50 | connect(apply_button, &QAbstractButton::clicked, this, | ||
| 51 | &ConfigurePerGame::HandleApplyButtonClicked); | ||
| 52 | } | ||
| 53 | |||
| 45 | LoadConfiguration(); | 54 | LoadConfiguration(); |
| 46 | } | 55 | } |
| 47 | 56 | ||
| @@ -74,6 +83,11 @@ void ConfigurePerGame::RetranslateUI() { | |||
| 74 | ui->retranslateUi(this); | 83 | ui->retranslateUi(this); |
| 75 | } | 84 | } |
| 76 | 85 | ||
| 86 | void ConfigurePerGame::HandleApplyButtonClicked() { | ||
| 87 | UISettings::values.configuration_applied = true; | ||
| 88 | ApplyConfiguration(); | ||
| 89 | } | ||
| 90 | |||
| 77 | void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file) { | 91 | void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file) { |
| 78 | this->file = std::move(file); | 92 | this->file = std::move(file); |
| 79 | LoadConfiguration(); | 93 | LoadConfiguration(); |
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index 5f9a08cef..f6e6ab7c4 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h | |||
| @@ -39,6 +39,8 @@ private: | |||
| 39 | void changeEvent(QEvent* event) override; | 39 | void changeEvent(QEvent* event) override; |
| 40 | void RetranslateUI(); | 40 | void RetranslateUI(); |
| 41 | 41 | ||
| 42 | void HandleApplyButtonClicked(); | ||
| 43 | |||
| 42 | void LoadConfiguration(); | 44 | void LoadConfiguration(); |
| 43 | 45 | ||
| 44 | std::unique_ptr<Ui::ConfigurePerGame> ui; | 46 | std::unique_ptr<Ui::ConfigurePerGame> ui; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 37ef62967..0f0e228b0 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2587,12 +2587,12 @@ void GMainWindow::OnConfigure() { | |||
| 2587 | &GMainWindow::OnLanguageChanged); | 2587 | &GMainWindow::OnLanguageChanged); |
| 2588 | 2588 | ||
| 2589 | const auto result = configure_dialog.exec(); | 2589 | const auto result = configure_dialog.exec(); |
| 2590 | if (result != QDialog::Accepted) { | 2590 | if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { |
| 2591 | return; | 2591 | return; |
| 2592 | } else if (result == QDialog::Accepted) { | ||
| 2593 | configure_dialog.ApplyConfiguration(); | ||
| 2594 | controller_dialog->refreshConfiguration(); | ||
| 2592 | } | 2595 | } |
| 2593 | |||
| 2594 | configure_dialog.ApplyConfiguration(); | ||
| 2595 | controller_dialog->refreshConfiguration(); | ||
| 2596 | InitializeHotkeys(); | 2596 | InitializeHotkeys(); |
| 2597 | if (UISettings::values.theme != old_theme) { | 2597 | if (UISettings::values.theme != old_theme) { |
| 2598 | UpdateUITheme(); | 2598 | UpdateUITheme(); |
| @@ -2607,6 +2607,8 @@ void GMainWindow::OnConfigure() { | |||
| 2607 | game_list->PopulateAsync(UISettings::values.game_dirs); | 2607 | game_list->PopulateAsync(UISettings::values.game_dirs); |
| 2608 | } | 2608 | } |
| 2609 | 2609 | ||
| 2610 | UISettings::values.configuration_applied = false; | ||
| 2611 | |||
| 2610 | config->Save(); | 2612 | config->Save(); |
| 2611 | 2613 | ||
| 2612 | if ((UISettings::values.hide_mouse || Settings::values.mouse_panning) && emulation_running) { | 2614 | if ((UISettings::values.hide_mouse || Settings::values.mouse_panning) && emulation_running) { |
| @@ -2636,23 +2638,27 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file | |||
| 2636 | ConfigurePerGame dialog(this, title_id); | 2638 | ConfigurePerGame dialog(this, title_id); |
| 2637 | dialog.LoadFromFile(v_file); | 2639 | dialog.LoadFromFile(v_file); |
| 2638 | const auto result = dialog.exec(); | 2640 | const auto result = dialog.exec(); |
| 2639 | if (result == QDialog::Accepted) { | 2641 | |
| 2642 | if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { | ||
| 2643 | Settings::RestoreGlobalState(system.IsPoweredOn()); | ||
| 2644 | return; | ||
| 2645 | } else if (result == QDialog::Accepted) { | ||
| 2640 | dialog.ApplyConfiguration(); | 2646 | dialog.ApplyConfiguration(); |
| 2647 | } | ||
| 2641 | 2648 | ||
| 2642 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); | 2649 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); |
| 2643 | if (reload) { | 2650 | if (reload) { |
| 2644 | game_list->PopulateAsync(UISettings::values.game_dirs); | 2651 | game_list->PopulateAsync(UISettings::values.game_dirs); |
| 2645 | } | 2652 | } |
| 2646 | 2653 | ||
| 2647 | // Do not cause the global config to write local settings into the config file | 2654 | // Do not cause the global config to write local settings into the config file |
| 2648 | const bool is_powered_on = system.IsPoweredOn(); | 2655 | const bool is_powered_on = system.IsPoweredOn(); |
| 2649 | Settings::RestoreGlobalState(is_powered_on); | 2656 | Settings::RestoreGlobalState(is_powered_on); |
| 2650 | 2657 | ||
| 2651 | if (!is_powered_on) { | 2658 | UISettings::values.configuration_applied = false; |
| 2652 | config->Save(); | 2659 | |
| 2653 | } | 2660 | if (!is_powered_on) { |
| 2654 | } else { | 2661 | config->Save(); |
| 2655 | Settings::RestoreGlobalState(system.IsPoweredOn()); | ||
| 2656 | } | 2662 | } |
| 2657 | } | 2663 | } |
| 2658 | 2664 | ||
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 5ba00b8c8..49122ec32 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -95,6 +95,8 @@ struct Values { | |||
| 95 | uint8_t row_2_text_id; | 95 | uint8_t row_2_text_id; |
| 96 | std::atomic_bool is_game_list_reload_pending{false}; | 96 | std::atomic_bool is_game_list_reload_pending{false}; |
| 97 | bool cache_game_list; | 97 | bool cache_game_list; |
| 98 | |||
| 99 | bool configuration_applied; | ||
| 98 | }; | 100 | }; |
| 99 | 101 | ||
| 100 | extern Values values; | 102 | extern Values values; |