diff options
| author | 2019-05-26 00:39:23 -0400 | |
|---|---|---|
| committer | 2019-06-05 15:40:33 -0400 | |
| commit | e1d755bdda96fe8b25fc8be4181f48ca158679f1 (patch) | |
| tree | fa967793555c54493be142d693d3bbb33e028910 /src | |
| parent | Merge pull request #2527 from lioncash/index (diff) | |
| download | yuzu-e1d755bdda96fe8b25fc8be4181f48ca158679f1.tar.gz yuzu-e1d755bdda96fe8b25fc8be4181f48ca158679f1.tar.xz yuzu-e1d755bdda96fe8b25fc8be4181f48ca158679f1.zip | |
yuzu/configuration: Make function naming consistent
Diffstat (limited to 'src')
33 files changed, 234 insertions, 213 deletions
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index b0f9b814d..110842eb2 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -22,11 +22,11 @@ ConfigureAudio::ConfigureAudio(QWidget* parent) | |||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | connect(ui->volume_slider, &QSlider::valueChanged, this, | 24 | connect(ui->volume_slider, &QSlider::valueChanged, this, |
| 25 | &ConfigureAudio::setVolumeIndicatorText); | 25 | &ConfigureAudio::SetVolumeIndicatorText); |
| 26 | 26 | ||
| 27 | this->setConfiguration(); | 27 | SetConfiguration(); |
| 28 | connect(ui->output_sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this, | 28 | connect(ui->output_sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this, |
| 29 | &ConfigureAudio::updateAudioDevices); | 29 | &ConfigureAudio::UpdateAudioDevices); |
| 30 | 30 | ||
| 31 | const bool is_powered_on = Core::System::GetInstance().IsPoweredOn(); | 31 | const bool is_powered_on = Core::System::GetInstance().IsPoweredOn(); |
| 32 | ui->output_sink_combo_box->setEnabled(!is_powered_on); | 32 | ui->output_sink_combo_box->setEnabled(!is_powered_on); |
| @@ -35,20 +35,20 @@ ConfigureAudio::ConfigureAudio(QWidget* parent) | |||
| 35 | 35 | ||
| 36 | ConfigureAudio::~ConfigureAudio() = default; | 36 | ConfigureAudio::~ConfigureAudio() = default; |
| 37 | 37 | ||
| 38 | void ConfigureAudio::setConfiguration() { | 38 | void ConfigureAudio::SetConfiguration() { |
| 39 | setOutputSinkFromSinkID(); | 39 | SetOutputSinkFromSinkID(); |
| 40 | 40 | ||
| 41 | // The device list cannot be pre-populated (nor listed) until the output sink is known. | 41 | // The device list cannot be pre-populated (nor listed) until the output sink is known. |
| 42 | updateAudioDevices(ui->output_sink_combo_box->currentIndex()); | 42 | UpdateAudioDevices(ui->output_sink_combo_box->currentIndex()); |
| 43 | 43 | ||
| 44 | setAudioDeviceFromDeviceID(); | 44 | SetAudioDeviceFromDeviceID(); |
| 45 | 45 | ||
| 46 | ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching); | 46 | ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching); |
| 47 | ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum()); | 47 | ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum()); |
| 48 | setVolumeIndicatorText(ui->volume_slider->sliderPosition()); | 48 | SetVolumeIndicatorText(ui->volume_slider->sliderPosition()); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | void ConfigureAudio::setOutputSinkFromSinkID() { | 51 | void ConfigureAudio::SetOutputSinkFromSinkID() { |
| 52 | int new_sink_index = 0; | 52 | int new_sink_index = 0; |
| 53 | 53 | ||
| 54 | const QString sink_id = QString::fromStdString(Settings::values.sink_id); | 54 | const QString sink_id = QString::fromStdString(Settings::values.sink_id); |
| @@ -62,7 +62,7 @@ void ConfigureAudio::setOutputSinkFromSinkID() { | |||
| 62 | ui->output_sink_combo_box->setCurrentIndex(new_sink_index); | 62 | ui->output_sink_combo_box->setCurrentIndex(new_sink_index); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | void ConfigureAudio::setAudioDeviceFromDeviceID() { | 65 | void ConfigureAudio::SetAudioDeviceFromDeviceID() { |
| 66 | int new_device_index = -1; | 66 | int new_device_index = -1; |
| 67 | 67 | ||
| 68 | const QString device_id = QString::fromStdString(Settings::values.audio_device_id); | 68 | const QString device_id = QString::fromStdString(Settings::values.audio_device_id); |
| @@ -76,11 +76,11 @@ void ConfigureAudio::setAudioDeviceFromDeviceID() { | |||
| 76 | ui->audio_device_combo_box->setCurrentIndex(new_device_index); | 76 | ui->audio_device_combo_box->setCurrentIndex(new_device_index); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void ConfigureAudio::setVolumeIndicatorText(int percentage) { | 79 | void ConfigureAudio::SetVolumeIndicatorText(int percentage) { |
| 80 | ui->volume_indicator->setText(tr("%1%", "Volume percentage (e.g. 50%)").arg(percentage)); | 80 | ui->volume_indicator->setText(tr("%1%", "Volume percentage (e.g. 50%)").arg(percentage)); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | void ConfigureAudio::applyConfiguration() { | 83 | void ConfigureAudio::ApplyConfiguration() { |
| 84 | Settings::values.sink_id = | 84 | Settings::values.sink_id = |
| 85 | ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()) | 85 | ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()) |
| 86 | .toStdString(); | 86 | .toStdString(); |
| @@ -92,7 +92,7 @@ void ConfigureAudio::applyConfiguration() { | |||
| 92 | static_cast<float>(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum(); | 92 | static_cast<float>(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum(); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void ConfigureAudio::updateAudioDevices(int sink_index) { | 95 | void ConfigureAudio::UpdateAudioDevices(int sink_index) { |
| 96 | ui->audio_device_combo_box->clear(); | 96 | ui->audio_device_combo_box->clear(); |
| 97 | ui->audio_device_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name)); | 97 | ui->audio_device_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name)); |
| 98 | 98 | ||
| @@ -102,6 +102,6 @@ void ConfigureAudio::updateAudioDevices(int sink_index) { | |||
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | void ConfigureAudio::retranslateUi() { | 105 | void ConfigureAudio::RetranslateUI() { |
| 106 | ui->retranslateUi(this); | 106 | ui->retranslateUi(this); |
| 107 | } | 107 | } |
diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index 8771421c0..2bb92d9b5 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h | |||
| @@ -18,16 +18,16 @@ public: | |||
| 18 | explicit ConfigureAudio(QWidget* parent = nullptr); | 18 | explicit ConfigureAudio(QWidget* parent = nullptr); |
| 19 | ~ConfigureAudio() override; | 19 | ~ConfigureAudio() override; |
| 20 | 20 | ||
| 21 | void applyConfiguration(); | 21 | void ApplyConfiguration(); |
| 22 | void retranslateUi(); | 22 | void RetranslateUI(); |
| 23 | 23 | ||
| 24 | private: | 24 | private: |
| 25 | void updateAudioDevices(int sink_index); | 25 | void UpdateAudioDevices(int sink_index); |
| 26 | 26 | ||
| 27 | void setConfiguration(); | 27 | void SetConfiguration(); |
| 28 | void setOutputSinkFromSinkID(); | 28 | void SetOutputSinkFromSinkID(); |
| 29 | void setAudioDeviceFromDeviceID(); | 29 | void SetAudioDeviceFromDeviceID(); |
| 30 | void setVolumeIndicatorText(int percentage); | 30 | void SetVolumeIndicatorText(int percentage); |
| 31 | 31 | ||
| 32 | std::unique_ptr<Ui::ConfigureAudio> ui; | 32 | std::unique_ptr<Ui::ConfigureAudio> ui; |
| 33 | }; | 33 | }; |
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 550cf9dca..afc2e3b38 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp | |||
| @@ -16,7 +16,8 @@ | |||
| 16 | 16 | ||
| 17 | ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { | 17 | ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { |
| 18 | ui->setupUi(this); | 18 | ui->setupUi(this); |
| 19 | this->setConfiguration(); | 19 | SetConfiguration(); |
| 20 | |||
| 20 | connect(ui->open_log_button, &QPushButton::pressed, []() { | 21 | connect(ui->open_log_button, &QPushButton::pressed, []() { |
| 21 | QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir)); | 22 | QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir)); |
| 22 | QDesktopServices::openUrl(QUrl::fromLocalFile(path)); | 23 | QDesktopServices::openUrl(QUrl::fromLocalFile(path)); |
| @@ -25,7 +26,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co | |||
| 25 | 26 | ||
| 26 | ConfigureDebug::~ConfigureDebug() = default; | 27 | ConfigureDebug::~ConfigureDebug() = default; |
| 27 | 28 | ||
| 28 | void ConfigureDebug::setConfiguration() { | 29 | void ConfigureDebug::SetConfiguration() { |
| 29 | ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub); | 30 | ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub); |
| 30 | ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub); | 31 | ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub); |
| 31 | ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port); | 32 | ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port); |
| @@ -37,7 +38,7 @@ void ConfigureDebug::setConfiguration() { | |||
| 37 | ui->dump_decompressed_nso->setChecked(Settings::values.dump_nso); | 38 | ui->dump_decompressed_nso->setChecked(Settings::values.dump_nso); |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | void ConfigureDebug::applyConfiguration() { | 41 | void ConfigureDebug::ApplyConfiguration() { |
| 41 | Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked(); | 42 | Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked(); |
| 42 | Settings::values.gdbstub_port = ui->gdbport_spinbox->value(); | 43 | Settings::values.gdbstub_port = ui->gdbport_spinbox->value(); |
| 43 | UISettings::values.show_console = ui->toggle_console->isChecked(); | 44 | UISettings::values.show_console = ui->toggle_console->isChecked(); |
diff --git a/src/yuzu/configuration/configure_debug.h b/src/yuzu/configuration/configure_debug.h index c6420b18c..06b89026c 100644 --- a/src/yuzu/configuration/configure_debug.h +++ b/src/yuzu/configuration/configure_debug.h | |||
| @@ -18,10 +18,10 @@ public: | |||
| 18 | explicit ConfigureDebug(QWidget* parent = nullptr); | 18 | explicit ConfigureDebug(QWidget* parent = nullptr); |
| 19 | ~ConfigureDebug() override; | 19 | ~ConfigureDebug() override; |
| 20 | 20 | ||
| 21 | void applyConfiguration(); | 21 | void ApplyConfiguration(); |
| 22 | 22 | ||
| 23 | private: | 23 | private: |
| 24 | void setConfiguration(); | 24 | void SetConfiguration(); |
| 25 | 25 | ||
| 26 | std::unique_ptr<Ui::ConfigureDebug> ui; | 26 | std::unique_ptr<Ui::ConfigureDebug> ui; |
| 27 | }; | 27 | }; |
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 8086f9d6b..a1b1e00bc 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp | |||
| @@ -15,11 +15,11 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry) | |||
| 15 | : QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) { | 15 | : QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) { |
| 16 | ui->setupUi(this); | 16 | ui->setupUi(this); |
| 17 | ui->hotkeysTab->Populate(registry); | 17 | ui->hotkeysTab->Populate(registry); |
| 18 | this->setConfiguration(); | ||
| 19 | this->PopulateSelectionList(); | ||
| 20 | |||
| 21 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | 18 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); |
| 22 | 19 | ||
| 20 | SetConfiguration(); | ||
| 21 | PopulateSelectionList(); | ||
| 22 | |||
| 23 | connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, | 23 | connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, |
| 24 | &ConfigureDialog::UpdateVisibleTabs); | 24 | &ConfigureDialog::UpdateVisibleTabs); |
| 25 | 25 | ||
| @@ -29,19 +29,19 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry) | |||
| 29 | 29 | ||
| 30 | ConfigureDialog::~ConfigureDialog() = default; | 30 | ConfigureDialog::~ConfigureDialog() = default; |
| 31 | 31 | ||
| 32 | void ConfigureDialog::setConfiguration() {} | 32 | void ConfigureDialog::SetConfiguration() {} |
| 33 | 33 | ||
| 34 | void ConfigureDialog::applyConfiguration() { | 34 | void ConfigureDialog::ApplyConfiguration() { |
| 35 | ui->generalTab->applyConfiguration(); | 35 | ui->generalTab->ApplyConfiguration(); |
| 36 | ui->gameListTab->applyConfiguration(); | 36 | ui->gameListTab->ApplyConfiguration(); |
| 37 | ui->systemTab->applyConfiguration(); | 37 | ui->systemTab->ApplyConfiguration(); |
| 38 | ui->profileManagerTab->applyConfiguration(); | 38 | ui->profileManagerTab->ApplyConfiguration(); |
| 39 | ui->inputTab->applyConfiguration(); | 39 | ui->inputTab->ApplyConfiguration(); |
| 40 | ui->hotkeysTab->applyConfiguration(registry); | 40 | ui->hotkeysTab->ApplyConfiguration(registry); |
| 41 | ui->graphicsTab->applyConfiguration(); | 41 | ui->graphicsTab->ApplyConfiguration(); |
| 42 | ui->audioTab->applyConfiguration(); | 42 | ui->audioTab->ApplyConfiguration(); |
| 43 | ui->debugTab->applyConfiguration(); | 43 | ui->debugTab->ApplyConfiguration(); |
| 44 | ui->webTab->applyConfiguration(); | 44 | ui->webTab->ApplyConfiguration(); |
| 45 | Settings::Apply(); | 45 | Settings::Apply(); |
| 46 | Settings::LogSettings(); | 46 | Settings::LogSettings(); |
| 47 | } | 47 | } |
diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h index 2363ba584..7e7d90f59 100644 --- a/src/yuzu/configuration/configure_dialog.h +++ b/src/yuzu/configuration/configure_dialog.h | |||
| @@ -20,10 +20,10 @@ public: | |||
| 20 | explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry); | 20 | explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry); |
| 21 | ~ConfigureDialog() override; | 21 | ~ConfigureDialog() override; |
| 22 | 22 | ||
| 23 | void applyConfiguration(); | 23 | void ApplyConfiguration(); |
| 24 | 24 | ||
| 25 | private: | 25 | private: |
| 26 | void setConfiguration(); | 26 | void SetConfiguration(); |
| 27 | void UpdateVisibleTabs(); | 27 | void UpdateVisibleTabs(); |
| 28 | void PopulateSelectionList(); | 28 | void PopulateSelectionList(); |
| 29 | 29 | ||
diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_gamelist.cpp index 6f0d75605..4b5b0ee48 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_gamelist.cpp | |||
| @@ -12,20 +12,20 @@ | |||
| 12 | #include "yuzu/ui_settings.h" | 12 | #include "yuzu/ui_settings.h" |
| 13 | 13 | ||
| 14 | namespace { | 14 | namespace { |
| 15 | constexpr std::array<std::pair<u32, const char*>, 5> default_icon_sizes{{ | 15 | constexpr std::array default_icon_sizes{ |
| 16 | std::make_pair(0, QT_TR_NOOP("None")), | 16 | std::make_pair(0, QT_TR_NOOP("None")), |
| 17 | std::make_pair(32, QT_TR_NOOP("Small (32x32)")), | 17 | std::make_pair(32, QT_TR_NOOP("Small (32x32)")), |
| 18 | std::make_pair(64, QT_TR_NOOP("Standard (64x64)")), | 18 | std::make_pair(64, QT_TR_NOOP("Standard (64x64)")), |
| 19 | std::make_pair(128, QT_TR_NOOP("Large (128x128)")), | 19 | std::make_pair(128, QT_TR_NOOP("Large (128x128)")), |
| 20 | std::make_pair(256, QT_TR_NOOP("Full Size (256x256)")), | 20 | std::make_pair(256, QT_TR_NOOP("Full Size (256x256)")), |
| 21 | }}; | 21 | }; |
| 22 | 22 | ||
| 23 | constexpr std::array<const char*, 4> row_text_names{{ | 23 | constexpr std::array row_text_names{ |
| 24 | QT_TR_NOOP("Filename"), | 24 | QT_TR_NOOP("Filename"), |
| 25 | QT_TR_NOOP("Filetype"), | 25 | QT_TR_NOOP("Filetype"), |
| 26 | QT_TR_NOOP("Title ID"), | 26 | QT_TR_NOOP("Title ID"), |
| 27 | QT_TR_NOOP("Title Name"), | 27 | QT_TR_NOOP("Title Name"), |
| 28 | }}; | 28 | }; |
| 29 | } // Anonymous namespace | 29 | } // Anonymous namespace |
| 30 | 30 | ||
| 31 | ConfigureGameList::ConfigureGameList(QWidget* parent) | 31 | ConfigureGameList::ConfigureGameList(QWidget* parent) |
| @@ -35,7 +35,7 @@ ConfigureGameList::ConfigureGameList(QWidget* parent) | |||
| 35 | InitializeIconSizeComboBox(); | 35 | InitializeIconSizeComboBox(); |
| 36 | InitializeRowComboBoxes(); | 36 | InitializeRowComboBoxes(); |
| 37 | 37 | ||
| 38 | this->setConfiguration(); | 38 | SetConfiguration(); |
| 39 | 39 | ||
| 40 | // Force game list reload if any of the relevant settings are changed. | 40 | // Force game list reload if any of the relevant settings are changed. |
| 41 | connect(ui->show_unknown, &QCheckBox::stateChanged, this, | 41 | connect(ui->show_unknown, &QCheckBox::stateChanged, this, |
| @@ -50,7 +50,7 @@ ConfigureGameList::ConfigureGameList(QWidget* parent) | |||
| 50 | 50 | ||
| 51 | ConfigureGameList::~ConfigureGameList() = default; | 51 | ConfigureGameList::~ConfigureGameList() = default; |
| 52 | 52 | ||
| 53 | void ConfigureGameList::applyConfiguration() { | 53 | void ConfigureGameList::ApplyConfiguration() { |
| 54 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); | 54 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); |
| 55 | UISettings::values.show_add_ons = ui->show_add_ons->isChecked(); | 55 | UISettings::values.show_add_ons = ui->show_add_ons->isChecked(); |
| 56 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); | 56 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); |
| @@ -63,7 +63,7 @@ void ConfigureGameList::RequestGameListUpdate() { | |||
| 63 | UISettings::values.is_game_list_reload_pending.exchange(true); | 63 | UISettings::values.is_game_list_reload_pending.exchange(true); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void ConfigureGameList::setConfiguration() { | 66 | void ConfigureGameList::SetConfiguration() { |
| 67 | ui->show_unknown->setChecked(UISettings::values.show_unknown); | 67 | ui->show_unknown->setChecked(UISettings::values.show_unknown); |
| 68 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); | 68 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); |
| 69 | ui->icon_size_combobox->setCurrentIndex( | 69 | ui->icon_size_combobox->setCurrentIndex( |
diff --git a/src/yuzu/configuration/configure_gamelist.h b/src/yuzu/configuration/configure_gamelist.h index bf3f1cdfa..e11822919 100644 --- a/src/yuzu/configuration/configure_gamelist.h +++ b/src/yuzu/configuration/configure_gamelist.h | |||
| @@ -18,12 +18,12 @@ public: | |||
| 18 | explicit ConfigureGameList(QWidget* parent = nullptr); | 18 | explicit ConfigureGameList(QWidget* parent = nullptr); |
| 19 | ~ConfigureGameList() override; | 19 | ~ConfigureGameList() override; |
| 20 | 20 | ||
| 21 | void applyConfiguration(); | 21 | void ApplyConfiguration(); |
| 22 | 22 | ||
| 23 | private: | 23 | private: |
| 24 | void RequestGameListUpdate(); | 24 | void RequestGameListUpdate(); |
| 25 | 25 | ||
| 26 | void setConfiguration(); | 26 | void SetConfiguration(); |
| 27 | 27 | ||
| 28 | void changeEvent(QEvent*) override; | 28 | void changeEvent(QEvent*) override; |
| 29 | void RetranslateUI(); | 29 | void RetranslateUI(); |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index dd25dc6e1..8bdc1787a 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -18,7 +18,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) | |||
| 18 | QString::fromUtf8(theme.second)); | 18 | QString::fromUtf8(theme.second)); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | this->setConfiguration(); | 21 | SetConfiguration(); |
| 22 | 22 | ||
| 23 | connect(ui->toggle_deepscan, &QCheckBox::stateChanged, this, | 23 | connect(ui->toggle_deepscan, &QCheckBox::stateChanged, this, |
| 24 | [] { UISettings::values.is_game_list_reload_pending.exchange(true); }); | 24 | [] { UISettings::values.is_game_list_reload_pending.exchange(true); }); |
| @@ -28,7 +28,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) | |||
| 28 | 28 | ||
| 29 | ConfigureGeneral::~ConfigureGeneral() = default; | 29 | ConfigureGeneral::~ConfigureGeneral() = default; |
| 30 | 30 | ||
| 31 | void ConfigureGeneral::setConfiguration() { | 31 | void ConfigureGeneral::SetConfiguration() { |
| 32 | ui->toggle_deepscan->setChecked(UISettings::values.game_directory_deepscan); | 32 | ui->toggle_deepscan->setChecked(UISettings::values.game_directory_deepscan); |
| 33 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); | 33 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); |
| 34 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); | 34 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); |
| @@ -36,7 +36,7 @@ void ConfigureGeneral::setConfiguration() { | |||
| 36 | ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit); | 36 | ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void ConfigureGeneral::applyConfiguration() { | 39 | void ConfigureGeneral::ApplyConfiguration() { |
| 40 | UISettings::values.game_directory_deepscan = ui->toggle_deepscan->isChecked(); | 40 | UISettings::values.game_directory_deepscan = ui->toggle_deepscan->isChecked(); |
| 41 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); | 41 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); |
| 42 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); | 42 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); |
diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index df41d995b..fd5fd2a91 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h | |||
| @@ -20,10 +20,10 @@ public: | |||
| 20 | explicit ConfigureGeneral(QWidget* parent = nullptr); | 20 | explicit ConfigureGeneral(QWidget* parent = nullptr); |
| 21 | ~ConfigureGeneral() override; | 21 | ~ConfigureGeneral() override; |
| 22 | 22 | ||
| 23 | void applyConfiguration(); | 23 | void ApplyConfiguration(); |
| 24 | 24 | ||
| 25 | private: | 25 | private: |
| 26 | void setConfiguration(); | 26 | void SetConfiguration(); |
| 27 | 27 | ||
| 28 | std::unique_ptr<Ui::ConfigureGeneral> ui; | 28 | std::unique_ptr<Ui::ConfigureGeneral> ui; |
| 29 | }; | 29 | }; |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 6daf82ab1..02e91701a 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -52,7 +52,8 @@ Resolution FromResolutionFactor(float factor) { | |||
| 52 | ConfigureGraphics::ConfigureGraphics(QWidget* parent) | 52 | ConfigureGraphics::ConfigureGraphics(QWidget* parent) |
| 53 | : QWidget(parent), ui(new Ui::ConfigureGraphics) { | 53 | : QWidget(parent), ui(new Ui::ConfigureGraphics) { |
| 54 | ui->setupUi(this); | 54 | ui->setupUi(this); |
| 55 | setConfiguration(); | 55 | |
| 56 | SetConfiguration(); | ||
| 56 | 57 | ||
| 57 | connect(ui->toggle_frame_limit, &QCheckBox::toggled, ui->frame_limit, &QSpinBox::setEnabled); | 58 | connect(ui->toggle_frame_limit, &QCheckBox::toggled, ui->frame_limit, &QSpinBox::setEnabled); |
| 58 | connect(ui->bg_button, &QPushButton::clicked, this, [this] { | 59 | connect(ui->bg_button, &QPushButton::clicked, this, [this] { |
| @@ -66,7 +67,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) | |||
| 66 | 67 | ||
| 67 | ConfigureGraphics::~ConfigureGraphics() = default; | 68 | ConfigureGraphics::~ConfigureGraphics() = default; |
| 68 | 69 | ||
| 69 | void ConfigureGraphics::setConfiguration() { | 70 | void ConfigureGraphics::SetConfiguration() { |
| 70 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 71 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); |
| 71 | 72 | ||
| 72 | ui->resolution_factor_combobox->setCurrentIndex( | 73 | ui->resolution_factor_combobox->setCurrentIndex( |
| @@ -87,7 +88,7 @@ void ConfigureGraphics::setConfiguration() { | |||
| 87 | Settings::values.bg_blue)); | 88 | Settings::values.bg_blue)); |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | void ConfigureGraphics::applyConfiguration() { | 91 | void ConfigureGraphics::ApplyConfiguration() { |
| 91 | Settings::values.resolution_factor = | 92 | Settings::values.resolution_factor = |
| 92 | ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex())); | 93 | ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex())); |
| 93 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); | 94 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); |
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index f2799822d..6b3c39705 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h | |||
| @@ -18,10 +18,10 @@ public: | |||
| 18 | explicit ConfigureGraphics(QWidget* parent = nullptr); | 18 | explicit ConfigureGraphics(QWidget* parent = nullptr); |
| 19 | ~ConfigureGraphics() override; | 19 | ~ConfigureGraphics() override; |
| 20 | 20 | ||
| 21 | void applyConfiguration(); | 21 | void ApplyConfiguration(); |
| 22 | 22 | ||
| 23 | private: | 23 | private: |
| 24 | void setConfiguration(); | 24 | void SetConfiguration(); |
| 25 | 25 | ||
| 26 | void UpdateBackgroundColorButton(QColor color); | 26 | void UpdateBackgroundColorButton(QColor color); |
| 27 | 27 | ||
diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp index 9fb970c21..04119e9d7 100644 --- a/src/yuzu/configuration/configure_hotkeys.cpp +++ b/src/yuzu/configuration/configure_hotkeys.cpp | |||
| @@ -92,7 +92,7 @@ bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const { | |||
| 92 | return false; | 92 | return false; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void ConfigureHotkeys::applyConfiguration(HotkeyRegistry& registry) { | 95 | void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) { |
| 96 | for (int key_id = 0; key_id < model->rowCount(); key_id++) { | 96 | for (int key_id = 0; key_id < model->rowCount(); key_id++) { |
| 97 | const QStandardItem* parent = model->item(key_id, 0); | 97 | const QStandardItem* parent = model->item(key_id, 0); |
| 98 | for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) { | 98 | for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) { |
| @@ -113,6 +113,6 @@ void ConfigureHotkeys::applyConfiguration(HotkeyRegistry& registry) { | |||
| 113 | registry.SaveHotkeys(); | 113 | registry.SaveHotkeys(); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | void ConfigureHotkeys::retranslateUi() { | 116 | void ConfigureHotkeys::RetranslateUI() { |
| 117 | ui->retranslateUi(this); | 117 | ui->retranslateUi(this); |
| 118 | } | 118 | } |
diff --git a/src/yuzu/configuration/configure_hotkeys.h b/src/yuzu/configuration/configure_hotkeys.h index e77d73c35..a1f4c7134 100644 --- a/src/yuzu/configuration/configure_hotkeys.h +++ b/src/yuzu/configuration/configure_hotkeys.h | |||
| @@ -21,8 +21,8 @@ public: | |||
| 21 | explicit ConfigureHotkeys(QWidget* parent = nullptr); | 21 | explicit ConfigureHotkeys(QWidget* parent = nullptr); |
| 22 | ~ConfigureHotkeys() override; | 22 | ~ConfigureHotkeys() override; |
| 23 | 23 | ||
| 24 | void applyConfiguration(HotkeyRegistry& registry); | 24 | void ApplyConfiguration(HotkeyRegistry& registry); |
| 25 | void retranslateUi(); | 25 | void RetranslateUI(); |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * Populates the hotkey list widget using data from the provided registry. | 28 | * Populates the hotkey list widget using data from the provided registry. |
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 87e459714..fb1210bcb 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -50,12 +50,12 @@ void OnDockedModeChanged(bool last_state, bool new_state) { | |||
| 50 | namespace { | 50 | namespace { |
| 51 | template <typename Dialog, typename... Args> | 51 | template <typename Dialog, typename... Args> |
| 52 | void CallConfigureDialog(ConfigureInput& parent, Args&&... args) { | 52 | void CallConfigureDialog(ConfigureInput& parent, Args&&... args) { |
| 53 | parent.applyConfiguration(); | 53 | parent.ApplyConfiguration(); |
| 54 | Dialog dialog(&parent, std::forward<Args>(args)...); | 54 | Dialog dialog(&parent, std::forward<Args>(args)...); |
| 55 | 55 | ||
| 56 | const auto res = dialog.exec(); | 56 | const auto res = dialog.exec(); |
| 57 | if (res == QDialog::Accepted) { | 57 | if (res == QDialog::Accepted) { |
| 58 | dialog.applyConfiguration(); | 58 | dialog.ApplyConfiguration(); |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | } // Anonymous namespace | 61 | } // Anonymous namespace |
| @@ -79,24 +79,24 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| 79 | tr("Single Right Joycon"), tr("Single Left Joycon")}); | 79 | tr("Single Right Joycon"), tr("Single Left Joycon")}); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | this->loadConfiguration(); | 82 | LoadConfiguration(); |
| 83 | updateUIEnabled(); | 83 | UpdateUIEnabled(); |
| 84 | 84 | ||
| 85 | connect(ui->restore_defaults_button, &QPushButton::pressed, this, | 85 | connect(ui->restore_defaults_button, &QPushButton::pressed, this, |
| 86 | &ConfigureInput::restoreDefaults); | 86 | &ConfigureInput::RestoreDefaults); |
| 87 | 87 | ||
| 88 | for (auto* enabled : players_controller) { | 88 | for (auto* enabled : players_controller) { |
| 89 | connect(enabled, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | 89 | connect(enabled, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
| 90 | &ConfigureInput::updateUIEnabled); | 90 | &ConfigureInput::UpdateUIEnabled); |
| 91 | } | 91 | } |
| 92 | connect(ui->use_docked_mode, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled); | 92 | connect(ui->use_docked_mode, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled); |
| 93 | connect(ui->handheld_connected, &QCheckBox::stateChanged, this, | 93 | connect(ui->handheld_connected, &QCheckBox::stateChanged, this, |
| 94 | &ConfigureInput::updateUIEnabled); | 94 | &ConfigureInput::UpdateUIEnabled); |
| 95 | connect(ui->mouse_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled); | 95 | connect(ui->mouse_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled); |
| 96 | connect(ui->keyboard_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled); | 96 | connect(ui->keyboard_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled); |
| 97 | connect(ui->debug_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled); | 97 | connect(ui->debug_enabled, &QCheckBox::stateChanged, this, &ConfigureInput::UpdateUIEnabled); |
| 98 | connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this, | 98 | connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this, |
| 99 | &ConfigureInput::updateUIEnabled); | 99 | &ConfigureInput::UpdateUIEnabled); |
| 100 | 100 | ||
| 101 | for (std::size_t i = 0; i < players_configure.size(); ++i) { | 101 | for (std::size_t i = 0; i < players_configure.size(); ++i) { |
| 102 | connect(players_configure[i], &QPushButton::pressed, this, | 102 | connect(players_configure[i], &QPushButton::pressed, this, |
| @@ -118,7 +118,7 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| 118 | 118 | ||
| 119 | ConfigureInput::~ConfigureInput() = default; | 119 | ConfigureInput::~ConfigureInput() = default; |
| 120 | 120 | ||
| 121 | void ConfigureInput::applyConfiguration() { | 121 | void ConfigureInput::ApplyConfiguration() { |
| 122 | for (std::size_t i = 0; i < players_controller.size(); ++i) { | 122 | for (std::size_t i = 0; i < players_controller.size(); ++i) { |
| 123 | const auto controller_type_index = players_controller[i]->currentIndex(); | 123 | const auto controller_type_index = players_controller[i]->currentIndex(); |
| 124 | 124 | ||
| @@ -144,7 +144,7 @@ void ConfigureInput::applyConfiguration() { | |||
| 144 | Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked(); | 144 | Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked(); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | void ConfigureInput::updateUIEnabled() { | 147 | void ConfigureInput::UpdateUIEnabled() { |
| 148 | bool hit_disabled = false; | 148 | bool hit_disabled = false; |
| 149 | for (auto* player : players_controller) { | 149 | for (auto* player : players_controller) { |
| 150 | player->setDisabled(hit_disabled); | 150 | player->setDisabled(hit_disabled); |
| @@ -168,7 +168,7 @@ void ConfigureInput::updateUIEnabled() { | |||
| 168 | ui->touchscreen_advanced->setEnabled(ui->touchscreen_enabled->isChecked()); | 168 | ui->touchscreen_advanced->setEnabled(ui->touchscreen_enabled->isChecked()); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | void ConfigureInput::loadConfiguration() { | 171 | void ConfigureInput::LoadConfiguration() { |
| 172 | std::stable_partition( | 172 | std::stable_partition( |
| 173 | Settings::values.players.begin(), | 173 | Settings::values.players.begin(), |
| 174 | Settings::values.players.begin() + | 174 | Settings::values.players.begin() + |
| @@ -191,10 +191,10 @@ void ConfigureInput::loadConfiguration() { | |||
| 191 | ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled); | 191 | ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled); |
| 192 | ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled); | 192 | ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled); |
| 193 | 193 | ||
| 194 | updateUIEnabled(); | 194 | UpdateUIEnabled(); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | void ConfigureInput::restoreDefaults() { | 197 | void ConfigureInput::RestoreDefaults() { |
| 198 | players_controller[0]->setCurrentIndex(2); | 198 | players_controller[0]->setCurrentIndex(2); |
| 199 | 199 | ||
| 200 | for (std::size_t i = 1; i < players_controller.size(); ++i) { | 200 | for (std::size_t i = 1; i < players_controller.size(); ++i) { |
| @@ -207,5 +207,5 @@ void ConfigureInput::restoreDefaults() { | |||
| 207 | ui->keyboard_enabled->setCheckState(Qt::Unchecked); | 207 | ui->keyboard_enabled->setCheckState(Qt::Unchecked); |
| 208 | ui->debug_enabled->setCheckState(Qt::Unchecked); | 208 | ui->debug_enabled->setCheckState(Qt::Unchecked); |
| 209 | ui->touchscreen_enabled->setCheckState(Qt::Checked); | 209 | ui->touchscreen_enabled->setCheckState(Qt::Checked); |
| 210 | updateUIEnabled(); | 210 | UpdateUIEnabled(); |
| 211 | } | 211 | } |
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h index b8e62cc2b..6a2125215 100644 --- a/src/yuzu/configuration/configure_input.h +++ b/src/yuzu/configuration/configure_input.h | |||
| @@ -30,15 +30,15 @@ public: | |||
| 30 | ~ConfigureInput() override; | 30 | ~ConfigureInput() override; |
| 31 | 31 | ||
| 32 | /// Save all button configurations to settings file | 32 | /// Save all button configurations to settings file |
| 33 | void applyConfiguration(); | 33 | void ApplyConfiguration(); |
| 34 | 34 | ||
| 35 | private: | 35 | private: |
| 36 | void updateUIEnabled(); | 36 | void UpdateUIEnabled(); |
| 37 | 37 | ||
| 38 | /// Load configuration settings. | 38 | /// Load configuration settings. |
| 39 | void loadConfiguration(); | 39 | void LoadConfiguration(); |
| 40 | /// Restore all buttons to their default values. | 40 | /// Restore all buttons to their default values. |
| 41 | void restoreDefaults(); | 41 | void RestoreDefaults(); |
| 42 | 42 | ||
| 43 | std::unique_ptr<Ui::ConfigureInput> ui; | 43 | std::unique_ptr<Ui::ConfigureInput> ui; |
| 44 | 44 | ||
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 95b0a656a..32d2a6815 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -245,7 +245,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 245 | 245 | ||
| 246 | button->setContextMenuPolicy(Qt::CustomContextMenu); | 246 | button->setContextMenuPolicy(Qt::CustomContextMenu); |
| 247 | connect(button, &QPushButton::released, [=] { | 247 | connect(button, &QPushButton::released, [=] { |
| 248 | handleClick( | 248 | HandleClick( |
| 249 | button_map[button_id], | 249 | button_map[button_id], |
| 250 | [=](const Common::ParamPackage& params) { buttons_param[button_id] = params; }, | 250 | [=](const Common::ParamPackage& params) { buttons_param[button_id] = params; }, |
| 251 | InputCommon::Polling::DeviceType::Button); | 251 | InputCommon::Polling::DeviceType::Button); |
| @@ -274,7 +274,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 274 | 274 | ||
| 275 | analog_button->setContextMenuPolicy(Qt::CustomContextMenu); | 275 | analog_button->setContextMenuPolicy(Qt::CustomContextMenu); |
| 276 | connect(analog_button, &QPushButton::released, [=]() { | 276 | connect(analog_button, &QPushButton::released, [=]() { |
| 277 | handleClick(analog_map_buttons[analog_id][sub_button_id], | 277 | HandleClick(analog_map_buttons[analog_id][sub_button_id], |
| 278 | [=](const Common::ParamPackage& params) { | 278 | [=](const Common::ParamPackage& params) { |
| 279 | SetAnalogButton(params, analogs_param[analog_id], | 279 | SetAnalogButton(params, analogs_param[analog_id], |
| 280 | analog_sub_buttons[sub_button_id]); | 280 | analog_sub_buttons[sub_button_id]); |
| @@ -304,7 +304,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 304 | QMessageBox::information(this, tr("Information"), | 304 | QMessageBox::information(this, tr("Information"), |
| 305 | tr("After pressing OK, first move your joystick horizontally, " | 305 | tr("After pressing OK, first move your joystick horizontally, " |
| 306 | "and then vertically.")); | 306 | "and then vertically.")); |
| 307 | handleClick( | 307 | HandleClick( |
| 308 | analog_map_stick[analog_id], | 308 | analog_map_stick[analog_id], |
| 309 | [=](const Common::ParamPackage& params) { analogs_param[analog_id] = params; }, | 309 | [=](const Common::ParamPackage& params) { analogs_param[analog_id] = params; }, |
| 310 | InputCommon::Polling::DeviceType::Analog); | 310 | InputCommon::Polling::DeviceType::Analog); |
| @@ -312,17 +312,17 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); | 314 | connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); |
| 315 | connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); }); | 315 | connect(ui->buttonRestoreDefaults, &QPushButton::released, [this] { RestoreDefaults(); }); |
| 316 | 316 | ||
| 317 | timeout_timer->setSingleShot(true); | 317 | timeout_timer->setSingleShot(true); |
| 318 | connect(timeout_timer.get(), &QTimer::timeout, [this]() { setPollingResult({}, true); }); | 318 | connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); }); |
| 319 | 319 | ||
| 320 | connect(poll_timer.get(), &QTimer::timeout, [this]() { | 320 | connect(poll_timer.get(), &QTimer::timeout, [this] { |
| 321 | Common::ParamPackage params; | 321 | Common::ParamPackage params; |
| 322 | for (auto& poller : device_pollers) { | 322 | for (auto& poller : device_pollers) { |
| 323 | params = poller->GetNextInput(); | 323 | params = poller->GetNextInput(); |
| 324 | if (params.Has("engine")) { | 324 | if (params.Has("engine")) { |
| 325 | setPollingResult(params, false); | 325 | SetPollingResult(params, false); |
| 326 | return; | 326 | return; |
| 327 | } | 327 | } |
| 328 | } | 328 | } |
| @@ -340,8 +340,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 340 | [this, i] { OnControllerButtonClick(static_cast<int>(i)); }); | 340 | [this, i] { OnControllerButtonClick(static_cast<int>(i)); }); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | this->loadConfiguration(); | 343 | LoadConfiguration(); |
| 344 | this->resize(0, 0); | 344 | resize(0, 0); |
| 345 | 345 | ||
| 346 | // TODO(wwylele): enable this when we actually emulate it | 346 | // TODO(wwylele): enable this when we actually emulate it |
| 347 | ui->buttonHome->setEnabled(false); | 347 | ui->buttonHome->setEnabled(false); |
| @@ -349,7 +349,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 349 | 349 | ||
| 350 | ConfigureInputPlayer::~ConfigureInputPlayer() = default; | 350 | ConfigureInputPlayer::~ConfigureInputPlayer() = default; |
| 351 | 351 | ||
| 352 | void ConfigureInputPlayer::applyConfiguration() { | 352 | void ConfigureInputPlayer::ApplyConfiguration() { |
| 353 | auto& buttons = | 353 | auto& buttons = |
| 354 | debug ? Settings::values.debug_pad_buttons : Settings::values.players[player_index].buttons; | 354 | debug ? Settings::values.debug_pad_buttons : Settings::values.players[player_index].buttons; |
| 355 | auto& analogs = | 355 | auto& analogs = |
| @@ -382,7 +382,7 @@ void ConfigureInputPlayer::OnControllerButtonClick(int i) { | |||
| 382 | QStringLiteral("QPushButton { background-color: %1 }").arg(controller_colors[i].name())); | 382 | QStringLiteral("QPushButton { background-color: %1 }").arg(controller_colors[i].name())); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | void ConfigureInputPlayer::loadConfiguration() { | 385 | void ConfigureInputPlayer::LoadConfiguration() { |
| 386 | if (debug) { | 386 | if (debug) { |
| 387 | std::transform(Settings::values.debug_pad_buttons.begin(), | 387 | std::transform(Settings::values.debug_pad_buttons.begin(), |
| 388 | Settings::values.debug_pad_buttons.end(), buttons_param.begin(), | 388 | Settings::values.debug_pad_buttons.end(), buttons_param.begin(), |
| @@ -399,7 +399,7 @@ void ConfigureInputPlayer::loadConfiguration() { | |||
| 399 | [](const std::string& str) { return Common::ParamPackage(str); }); | 399 | [](const std::string& str) { return Common::ParamPackage(str); }); |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | updateButtonLabels(); | 402 | UpdateButtonLabels(); |
| 403 | 403 | ||
| 404 | if (debug) | 404 | if (debug) |
| 405 | return; | 405 | return; |
| @@ -421,7 +421,7 @@ void ConfigureInputPlayer::loadConfiguration() { | |||
| 421 | } | 421 | } |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | void ConfigureInputPlayer::restoreDefaults() { | 424 | void ConfigureInputPlayer::RestoreDefaults() { |
| 425 | for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) { | 425 | for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) { |
| 426 | buttons_param[button_id] = Common::ParamPackage{ | 426 | buttons_param[button_id] = Common::ParamPackage{ |
| 427 | InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])}; | 427 | InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])}; |
| @@ -434,7 +434,7 @@ void ConfigureInputPlayer::restoreDefaults() { | |||
| 434 | SetAnalogButton(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]); | 434 | SetAnalogButton(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]); |
| 435 | } | 435 | } |
| 436 | } | 436 | } |
| 437 | updateButtonLabels(); | 437 | UpdateButtonLabels(); |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | void ConfigureInputPlayer::ClearAll() { | 440 | void ConfigureInputPlayer::ClearAll() { |
| @@ -458,10 +458,10 @@ void ConfigureInputPlayer::ClearAll() { | |||
| 458 | } | 458 | } |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | updateButtonLabels(); | 461 | UpdateButtonLabels(); |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | void ConfigureInputPlayer::updateButtonLabels() { | 464 | void ConfigureInputPlayer::UpdateButtonLabels() { |
| 465 | for (int button = 0; button < Settings::NativeButton::NumButtons; button++) { | 465 | for (int button = 0; button < Settings::NativeButton::NumButtons; button++) { |
| 466 | button_map[button]->setText(ButtonToText(buttons_param[button])); | 466 | button_map[button]->setText(ButtonToText(buttons_param[button])); |
| 467 | } | 467 | } |
| @@ -481,7 +481,7 @@ void ConfigureInputPlayer::updateButtonLabels() { | |||
| 481 | } | 481 | } |
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | void ConfigureInputPlayer::handleClick( | 484 | void ConfigureInputPlayer::HandleClick( |
| 485 | QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter, | 485 | QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter, |
| 486 | InputCommon::Polling::DeviceType type) { | 486 | InputCommon::Polling::DeviceType type) { |
| 487 | button->setText(tr("[press key]")); | 487 | button->setText(tr("[press key]")); |
| @@ -509,7 +509,7 @@ void ConfigureInputPlayer::handleClick( | |||
| 509 | poll_timer->start(200); // Check for new inputs every 200ms | 509 | poll_timer->start(200); // Check for new inputs every 200ms |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | void ConfigureInputPlayer::setPollingResult(const Common::ParamPackage& params, bool abort) { | 512 | void ConfigureInputPlayer::SetPollingResult(const Common::ParamPackage& params, bool abort) { |
| 513 | releaseKeyboard(); | 513 | releaseKeyboard(); |
| 514 | releaseMouse(); | 514 | releaseMouse(); |
| 515 | timeout_timer->stop(); | 515 | timeout_timer->stop(); |
| @@ -522,22 +522,23 @@ void ConfigureInputPlayer::setPollingResult(const Common::ParamPackage& params, | |||
| 522 | (*input_setter)(params); | 522 | (*input_setter)(params); |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | updateButtonLabels(); | 525 | UpdateButtonLabels(); |
| 526 | input_setter = std::nullopt; | 526 | input_setter = std::nullopt; |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) { | 529 | void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) { |
| 530 | if (!input_setter || !event) | 530 | if (!input_setter || !event) { |
| 531 | return; | 531 | return; |
| 532 | } | ||
| 532 | 533 | ||
| 533 | if (event->key() != Qt::Key_Escape) { | 534 | if (event->key() != Qt::Key_Escape) { |
| 534 | if (want_keyboard_keys) { | 535 | if (want_keyboard_keys) { |
| 535 | setPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())}, | 536 | SetPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())}, |
| 536 | false); | 537 | false); |
| 537 | } else { | 538 | } else { |
| 538 | // Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling | 539 | // Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling |
| 539 | return; | 540 | return; |
| 540 | } | 541 | } |
| 541 | } | 542 | } |
| 542 | setPollingResult({}, true); | 543 | SetPollingResult({}, true); |
| 543 | } | 544 | } |
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h index ade8d4435..27924fcce 100644 --- a/src/yuzu/configuration/configure_input_player.h +++ b/src/yuzu/configuration/configure_input_player.h | |||
| @@ -38,28 +38,28 @@ public: | |||
| 38 | ~ConfigureInputPlayer() override; | 38 | ~ConfigureInputPlayer() override; |
| 39 | 39 | ||
| 40 | /// Save all button configurations to settings file | 40 | /// Save all button configurations to settings file |
| 41 | void applyConfiguration(); | 41 | void ApplyConfiguration(); |
| 42 | 42 | ||
| 43 | private: | 43 | private: |
| 44 | void OnControllerButtonClick(int i); | 44 | void OnControllerButtonClick(int i); |
| 45 | 45 | ||
| 46 | /// Load configuration settings. | 46 | /// Load configuration settings. |
| 47 | void loadConfiguration(); | 47 | void LoadConfiguration(); |
| 48 | /// Restore all buttons to their default values. | 48 | /// Restore all buttons to their default values. |
| 49 | void restoreDefaults(); | 49 | void RestoreDefaults(); |
| 50 | /// Clear all input configuration | 50 | /// Clear all input configuration |
| 51 | void ClearAll(); | 51 | void ClearAll(); |
| 52 | 52 | ||
| 53 | /// Update UI to reflect current configuration. | 53 | /// Update UI to reflect current configuration. |
| 54 | void updateButtonLabels(); | 54 | void UpdateButtonLabels(); |
| 55 | 55 | ||
| 56 | /// Called when the button was pressed. | 56 | /// Called when the button was pressed. |
| 57 | void handleClick(QPushButton* button, | 57 | void HandleClick(QPushButton* button, |
| 58 | std::function<void(const Common::ParamPackage&)> new_input_setter, | 58 | std::function<void(const Common::ParamPackage&)> new_input_setter, |
| 59 | InputCommon::Polling::DeviceType type); | 59 | InputCommon::Polling::DeviceType type); |
| 60 | 60 | ||
| 61 | /// Finish polling and configure input using the input_setter | 61 | /// Finish polling and configure input using the input_setter |
| 62 | void setPollingResult(const Common::ParamPackage& params, bool abort); | 62 | void SetPollingResult(const Common::ParamPackage& params, bool abort); |
| 63 | 63 | ||
| 64 | /// Handle key press events. | 64 | /// Handle key press events. |
| 65 | void keyPressEvent(QKeyEvent* event) override; | 65 | void keyPressEvent(QKeyEvent* event) override; |
diff --git a/src/yuzu/configuration/configure_input_simple.cpp b/src/yuzu/configuration/configure_input_simple.cpp index 07d71e9d1..6140a5573 100644 --- a/src/yuzu/configuration/configure_input_simple.cpp +++ b/src/yuzu/configuration/configure_input_simple.cpp | |||
| @@ -15,12 +15,12 @@ namespace { | |||
| 15 | 15 | ||
| 16 | template <typename Dialog, typename... Args> | 16 | template <typename Dialog, typename... Args> |
| 17 | void CallConfigureDialog(ConfigureInputSimple* caller, Args&&... args) { | 17 | void CallConfigureDialog(ConfigureInputSimple* caller, Args&&... args) { |
| 18 | caller->applyConfiguration(); | 18 | caller->ApplyConfiguration(); |
| 19 | Dialog dialog(caller, std::forward<Args>(args)...); | 19 | Dialog dialog(caller, std::forward<Args>(args)...); |
| 20 | 20 | ||
| 21 | const auto res = dialog.exec(); | 21 | const auto res = dialog.exec(); |
| 22 | if (res == QDialog::Accepted) { | 22 | if (res == QDialog::Accepted) { |
| 23 | dialog.applyConfiguration(); | 23 | dialog.ApplyConfiguration(); |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| @@ -103,27 +103,29 @@ ConfigureInputSimple::ConfigureInputSimple(QWidget* parent) | |||
| 103 | &ConfigureInputSimple::OnSelectProfile); | 103 | &ConfigureInputSimple::OnSelectProfile); |
| 104 | connect(ui->profile_configure, &QPushButton::pressed, this, &ConfigureInputSimple::OnConfigure); | 104 | connect(ui->profile_configure, &QPushButton::pressed, this, &ConfigureInputSimple::OnConfigure); |
| 105 | 105 | ||
| 106 | this->loadConfiguration(); | 106 | LoadConfiguration(); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | ConfigureInputSimple::~ConfigureInputSimple() = default; | 109 | ConfigureInputSimple::~ConfigureInputSimple() = default; |
| 110 | 110 | ||
| 111 | void ConfigureInputSimple::applyConfiguration() { | 111 | void ConfigureInputSimple::ApplyConfiguration() { |
| 112 | auto index = ui->profile_combobox->currentIndex(); | 112 | auto index = ui->profile_combobox->currentIndex(); |
| 113 | // Make the stored index for "Custom" very large so that if new profiles are added it | 113 | // Make the stored index for "Custom" very large so that if new profiles are added it |
| 114 | // doesn't change. | 114 | // doesn't change. |
| 115 | if (index >= static_cast<int>(INPUT_PROFILES.size() - 1)) | 115 | if (index >= static_cast<int>(INPUT_PROFILES.size() - 1)) { |
| 116 | index = std::numeric_limits<int>::max(); | 116 | index = std::numeric_limits<int>::max(); |
| 117 | } | ||
| 117 | 118 | ||
| 118 | UISettings::values.profile_index = index; | 119 | UISettings::values.profile_index = index; |
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | void ConfigureInputSimple::loadConfiguration() { | 122 | void ConfigureInputSimple::LoadConfiguration() { |
| 122 | const auto index = UISettings::values.profile_index; | 123 | const auto index = UISettings::values.profile_index; |
| 123 | if (index >= static_cast<int>(INPUT_PROFILES.size()) || index < 0) | 124 | if (index >= static_cast<int>(INPUT_PROFILES.size()) || index < 0) { |
| 124 | ui->profile_combobox->setCurrentIndex(static_cast<int>(INPUT_PROFILES.size() - 1)); | 125 | ui->profile_combobox->setCurrentIndex(static_cast<int>(INPUT_PROFILES.size() - 1)); |
| 125 | else | 126 | } else { |
| 126 | ui->profile_combobox->setCurrentIndex(index); | 127 | ui->profile_combobox->setCurrentIndex(index); |
| 128 | } | ||
| 127 | } | 129 | } |
| 128 | 130 | ||
| 129 | void ConfigureInputSimple::OnSelectProfile(int index) { | 131 | void ConfigureInputSimple::OnSelectProfile(int index) { |
diff --git a/src/yuzu/configuration/configure_input_simple.h b/src/yuzu/configuration/configure_input_simple.h index 5b6b69994..573c2db2b 100644 --- a/src/yuzu/configuration/configure_input_simple.h +++ b/src/yuzu/configuration/configure_input_simple.h | |||
| @@ -27,11 +27,11 @@ public: | |||
| 27 | ~ConfigureInputSimple() override; | 27 | ~ConfigureInputSimple() override; |
| 28 | 28 | ||
| 29 | /// Save all button configurations to settings file | 29 | /// Save all button configurations to settings file |
| 30 | void applyConfiguration(); | 30 | void ApplyConfiguration(); |
| 31 | 31 | ||
| 32 | private: | 32 | private: |
| 33 | /// Load configuration settings. | 33 | /// Load configuration settings. |
| 34 | void loadConfiguration(); | 34 | void LoadConfiguration(); |
| 35 | 35 | ||
| 36 | void OnSelectProfile(int index); | 36 | void OnSelectProfile(int index); |
| 37 | void OnConfigure(); | 37 | void OnConfigure(); |
diff --git a/src/yuzu/configuration/configure_mouse_advanced.cpp b/src/yuzu/configuration/configure_mouse_advanced.cpp index a14bb1475..26f53128f 100644 --- a/src/yuzu/configuration/configure_mouse_advanced.cpp +++ b/src/yuzu/configuration/configure_mouse_advanced.cpp | |||
| @@ -84,7 +84,7 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent) | |||
| 84 | 84 | ||
| 85 | button->setContextMenuPolicy(Qt::CustomContextMenu); | 85 | button->setContextMenuPolicy(Qt::CustomContextMenu); |
| 86 | connect(button, &QPushButton::released, [=] { | 86 | connect(button, &QPushButton::released, [=] { |
| 87 | handleClick( | 87 | HandleClick( |
| 88 | button_map[button_id], | 88 | button_map[button_id], |
| 89 | [=](const Common::ParamPackage& params) { buttons_param[button_id] = params; }, | 89 | [=](const Common::ParamPackage& params) { buttons_param[button_id] = params; }, |
| 90 | InputCommon::Polling::DeviceType::Button); | 90 | InputCommon::Polling::DeviceType::Button); |
| @@ -105,48 +105,48 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent) | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); | 107 | connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); |
| 108 | connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); }); | 108 | connect(ui->buttonRestoreDefaults, &QPushButton::released, [this] { RestoreDefaults(); }); |
| 109 | 109 | ||
| 110 | timeout_timer->setSingleShot(true); | 110 | timeout_timer->setSingleShot(true); |
| 111 | connect(timeout_timer.get(), &QTimer::timeout, [this]() { setPollingResult({}, true); }); | 111 | connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); }); |
| 112 | 112 | ||
| 113 | connect(poll_timer.get(), &QTimer::timeout, [this]() { | 113 | connect(poll_timer.get(), &QTimer::timeout, [this] { |
| 114 | Common::ParamPackage params; | 114 | Common::ParamPackage params; |
| 115 | for (auto& poller : device_pollers) { | 115 | for (auto& poller : device_pollers) { |
| 116 | params = poller->GetNextInput(); | 116 | params = poller->GetNextInput(); |
| 117 | if (params.Has("engine")) { | 117 | if (params.Has("engine")) { |
| 118 | setPollingResult(params, false); | 118 | SetPollingResult(params, false); |
| 119 | return; | 119 | return; |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | }); | 122 | }); |
| 123 | 123 | ||
| 124 | loadConfiguration(); | 124 | LoadConfiguration(); |
| 125 | resize(0, 0); | 125 | resize(0, 0); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | ConfigureMouseAdvanced::~ConfigureMouseAdvanced() = default; | 128 | ConfigureMouseAdvanced::~ConfigureMouseAdvanced() = default; |
| 129 | 129 | ||
| 130 | void ConfigureMouseAdvanced::applyConfiguration() { | 130 | void ConfigureMouseAdvanced::ApplyConfiguration() { |
| 131 | std::transform(buttons_param.begin(), buttons_param.end(), | 131 | std::transform(buttons_param.begin(), buttons_param.end(), |
| 132 | Settings::values.mouse_buttons.begin(), | 132 | Settings::values.mouse_buttons.begin(), |
| 133 | [](const Common::ParamPackage& param) { return param.Serialize(); }); | 133 | [](const Common::ParamPackage& param) { return param.Serialize(); }); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | void ConfigureMouseAdvanced::loadConfiguration() { | 136 | void ConfigureMouseAdvanced::LoadConfiguration() { |
| 137 | std::transform(Settings::values.mouse_buttons.begin(), Settings::values.mouse_buttons.end(), | 137 | std::transform(Settings::values.mouse_buttons.begin(), Settings::values.mouse_buttons.end(), |
| 138 | buttons_param.begin(), | 138 | buttons_param.begin(), |
| 139 | [](const std::string& str) { return Common::ParamPackage(str); }); | 139 | [](const std::string& str) { return Common::ParamPackage(str); }); |
| 140 | updateButtonLabels(); | 140 | UpdateButtonLabels(); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | void ConfigureMouseAdvanced::restoreDefaults() { | 143 | void ConfigureMouseAdvanced::RestoreDefaults() { |
| 144 | for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) { | 144 | for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) { |
| 145 | buttons_param[button_id] = Common::ParamPackage{ | 145 | buttons_param[button_id] = Common::ParamPackage{ |
| 146 | InputCommon::GenerateKeyboardParam(Config::default_mouse_buttons[button_id])}; | 146 | InputCommon::GenerateKeyboardParam(Config::default_mouse_buttons[button_id])}; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | updateButtonLabels(); | 149 | UpdateButtonLabels(); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | void ConfigureMouseAdvanced::ClearAll() { | 152 | void ConfigureMouseAdvanced::ClearAll() { |
| @@ -157,16 +157,16 @@ void ConfigureMouseAdvanced::ClearAll() { | |||
| 157 | } | 157 | } |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | updateButtonLabels(); | 160 | UpdateButtonLabels(); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | void ConfigureMouseAdvanced::updateButtonLabels() { | 163 | void ConfigureMouseAdvanced::UpdateButtonLabels() { |
| 164 | for (int button = 0; button < Settings::NativeMouseButton::NumMouseButtons; button++) { | 164 | for (int button = 0; button < Settings::NativeMouseButton::NumMouseButtons; button++) { |
| 165 | button_map[button]->setText(ButtonToText(buttons_param[button])); | 165 | button_map[button]->setText(ButtonToText(buttons_param[button])); |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | void ConfigureMouseAdvanced::handleClick( | 169 | void ConfigureMouseAdvanced::HandleClick( |
| 170 | QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter, | 170 | QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter, |
| 171 | InputCommon::Polling::DeviceType type) { | 171 | InputCommon::Polling::DeviceType type) { |
| 172 | button->setText(tr("[press key]")); | 172 | button->setText(tr("[press key]")); |
| @@ -194,7 +194,7 @@ void ConfigureMouseAdvanced::handleClick( | |||
| 194 | poll_timer->start(200); // Check for new inputs every 200ms | 194 | poll_timer->start(200); // Check for new inputs every 200ms |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | void ConfigureMouseAdvanced::setPollingResult(const Common::ParamPackage& params, bool abort) { | 197 | void ConfigureMouseAdvanced::SetPollingResult(const Common::ParamPackage& params, bool abort) { |
| 198 | releaseKeyboard(); | 198 | releaseKeyboard(); |
| 199 | releaseMouse(); | 199 | releaseMouse(); |
| 200 | timeout_timer->stop(); | 200 | timeout_timer->stop(); |
| @@ -207,22 +207,23 @@ void ConfigureMouseAdvanced::setPollingResult(const Common::ParamPackage& params | |||
| 207 | (*input_setter)(params); | 207 | (*input_setter)(params); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | updateButtonLabels(); | 210 | UpdateButtonLabels(); |
| 211 | input_setter = std::nullopt; | 211 | input_setter = std::nullopt; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | void ConfigureMouseAdvanced::keyPressEvent(QKeyEvent* event) { | 214 | void ConfigureMouseAdvanced::keyPressEvent(QKeyEvent* event) { |
| 215 | if (!input_setter || !event) | 215 | if (!input_setter || !event) { |
| 216 | return; | 216 | return; |
| 217 | } | ||
| 217 | 218 | ||
| 218 | if (event->key() != Qt::Key_Escape) { | 219 | if (event->key() != Qt::Key_Escape) { |
| 219 | if (want_keyboard_keys) { | 220 | if (want_keyboard_keys) { |
| 220 | setPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())}, | 221 | SetPollingResult(Common::ParamPackage{InputCommon::GenerateKeyboardParam(event->key())}, |
| 221 | false); | 222 | false); |
| 222 | } else { | 223 | } else { |
| 223 | // Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling | 224 | // Escape key wasn't pressed and we don't want any keyboard keys, so don't stop polling |
| 224 | return; | 225 | return; |
| 225 | } | 226 | } |
| 226 | } | 227 | } |
| 227 | setPollingResult({}, true); | 228 | SetPollingResult({}, true); |
| 228 | } | 229 | } |
diff --git a/src/yuzu/configuration/configure_mouse_advanced.h b/src/yuzu/configuration/configure_mouse_advanced.h index e04da4bf2..373f992c9 100644 --- a/src/yuzu/configuration/configure_mouse_advanced.h +++ b/src/yuzu/configuration/configure_mouse_advanced.h | |||
| @@ -25,26 +25,26 @@ public: | |||
| 25 | explicit ConfigureMouseAdvanced(QWidget* parent); | 25 | explicit ConfigureMouseAdvanced(QWidget* parent); |
| 26 | ~ConfigureMouseAdvanced() override; | 26 | ~ConfigureMouseAdvanced() override; |
| 27 | 27 | ||
| 28 | void applyConfiguration(); | 28 | void ApplyConfiguration(); |
| 29 | 29 | ||
| 30 | private: | 30 | private: |
| 31 | /// Load configuration settings. | 31 | /// Load configuration settings. |
| 32 | void loadConfiguration(); | 32 | void LoadConfiguration(); |
| 33 | /// Restore all buttons to their default values. | 33 | /// Restore all buttons to their default values. |
| 34 | void restoreDefaults(); | 34 | void RestoreDefaults(); |
| 35 | /// Clear all input configuration | 35 | /// Clear all input configuration |
| 36 | void ClearAll(); | 36 | void ClearAll(); |
| 37 | 37 | ||
| 38 | /// Update UI to reflect current configuration. | 38 | /// Update UI to reflect current configuration. |
| 39 | void updateButtonLabels(); | 39 | void UpdateButtonLabels(); |
| 40 | 40 | ||
| 41 | /// Called when the button was pressed. | 41 | /// Called when the button was pressed. |
| 42 | void handleClick(QPushButton* button, | 42 | void HandleClick(QPushButton* button, |
| 43 | std::function<void(const Common::ParamPackage&)> new_input_setter, | 43 | std::function<void(const Common::ParamPackage&)> new_input_setter, |
| 44 | InputCommon::Polling::DeviceType type); | 44 | InputCommon::Polling::DeviceType type); |
| 45 | 45 | ||
| 46 | /// Finish polling and configure input using the input_setter | 46 | /// Finish polling and configure input using the input_setter |
| 47 | void setPollingResult(const Common::ParamPackage& params, bool abort); | 47 | void SetPollingResult(const Common::ParamPackage& params, bool abort); |
| 48 | 48 | ||
| 49 | /// Handle key press events. | 49 | /// Handle key press events. |
| 50 | void keyPressEvent(QKeyEvent* event) override; | 50 | void keyPressEvent(QKeyEvent* event) override; |
diff --git a/src/yuzu/configuration/configure_per_general.cpp b/src/yuzu/configuration/configure_per_general.cpp index c3e68fdf5..275519c7b 100644 --- a/src/yuzu/configuration/configure_per_general.cpp +++ b/src/yuzu/configuration/configure_per_general.cpp | |||
| @@ -67,12 +67,12 @@ ConfigurePerGameGeneral::ConfigurePerGameGeneral(QWidget* parent, u64 title_id) | |||
| 67 | connect(item_model, &QStandardItemModel::itemChanged, | 67 | connect(item_model, &QStandardItemModel::itemChanged, |
| 68 | [] { UISettings::values.is_game_list_reload_pending.exchange(true); }); | 68 | [] { UISettings::values.is_game_list_reload_pending.exchange(true); }); |
| 69 | 69 | ||
| 70 | this->loadConfiguration(); | 70 | LoadConfiguration(); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | ConfigurePerGameGeneral::~ConfigurePerGameGeneral() = default; | 73 | ConfigurePerGameGeneral::~ConfigurePerGameGeneral() = default; |
| 74 | 74 | ||
| 75 | void ConfigurePerGameGeneral::applyConfiguration() { | 75 | void ConfigurePerGameGeneral::ApplyConfiguration() { |
| 76 | std::vector<std::string> disabled_addons; | 76 | std::vector<std::string> disabled_addons; |
| 77 | 77 | ||
| 78 | for (const auto& item : list_items) { | 78 | for (const auto& item : list_items) { |
| @@ -92,12 +92,12 @@ void ConfigurePerGameGeneral::applyConfiguration() { | |||
| 92 | Settings::values.disabled_addons[title_id] = disabled_addons; | 92 | Settings::values.disabled_addons[title_id] = disabled_addons; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void ConfigurePerGameGeneral::loadFromFile(FileSys::VirtualFile file) { | 95 | void ConfigurePerGameGeneral::LoadFromFile(FileSys::VirtualFile file) { |
| 96 | this->file = std::move(file); | 96 | this->file = std::move(file); |
| 97 | this->loadConfiguration(); | 97 | LoadConfiguration(); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | void ConfigurePerGameGeneral::loadConfiguration() { | 100 | void ConfigurePerGameGeneral::LoadConfiguration() { |
| 101 | if (file == nullptr) { | 101 | if (file == nullptr) { |
| 102 | return; | 102 | return; |
| 103 | } | 103 | } |
diff --git a/src/yuzu/configuration/configure_per_general.h b/src/yuzu/configuration/configure_per_general.h index f8a7d5326..b95e07079 100644 --- a/src/yuzu/configuration/configure_per_general.h +++ b/src/yuzu/configuration/configure_per_general.h | |||
| @@ -30,11 +30,13 @@ public: | |||
| 30 | ~ConfigurePerGameGeneral() override; | 30 | ~ConfigurePerGameGeneral() override; |
| 31 | 31 | ||
| 32 | /// Save all button configurations to settings file | 32 | /// Save all button configurations to settings file |
| 33 | void applyConfiguration(); | 33 | void ApplyConfiguration(); |
| 34 | 34 | ||
| 35 | void loadFromFile(FileSys::VirtualFile file); | 35 | void LoadFromFile(FileSys::VirtualFile file); |
| 36 | 36 | ||
| 37 | private: | 37 | private: |
| 38 | void LoadConfiguration(); | ||
| 39 | |||
| 38 | std::unique_ptr<Ui::ConfigurePerGameGeneral> ui; | 40 | std::unique_ptr<Ui::ConfigurePerGameGeneral> ui; |
| 39 | FileSys::VirtualFile file; | 41 | FileSys::VirtualFile file; |
| 40 | u64 title_id; | 42 | u64 title_id; |
| @@ -45,6 +47,4 @@ private: | |||
| 45 | QGraphicsScene* scene; | 47 | QGraphicsScene* scene; |
| 46 | 48 | ||
| 47 | std::vector<QList<QStandardItem*>> list_items; | 49 | std::vector<QList<QStandardItem*>> list_items; |
| 48 | |||
| 49 | void loadConfiguration(); | ||
| 50 | }; | 50 | }; |
diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index 6d7d04c98..7c1597488 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp | |||
| @@ -119,12 +119,12 @@ ConfigureProfileManager ::ConfigureProfileManager(QWidget* parent) | |||
| 119 | scene = new QGraphicsScene; | 119 | scene = new QGraphicsScene; |
| 120 | ui->current_user_icon->setScene(scene); | 120 | ui->current_user_icon->setScene(scene); |
| 121 | 121 | ||
| 122 | this->setConfiguration(); | 122 | SetConfiguration(); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | ConfigureProfileManager::~ConfigureProfileManager() = default; | 125 | ConfigureProfileManager::~ConfigureProfileManager() = default; |
| 126 | 126 | ||
| 127 | void ConfigureProfileManager::setConfiguration() { | 127 | void ConfigureProfileManager::SetConfiguration() { |
| 128 | enabled = !Core::System::GetInstance().IsPoweredOn(); | 128 | enabled = !Core::System::GetInstance().IsPoweredOn(); |
| 129 | item_model->removeRows(0, item_model->rowCount()); | 129 | item_model->removeRows(0, item_model->rowCount()); |
| 130 | list_items.clear(); | 130 | list_items.clear(); |
| @@ -164,9 +164,10 @@ void ConfigureProfileManager::UpdateCurrentUser() { | |||
| 164 | ui->current_user_username->setText(username); | 164 | ui->current_user_username->setText(username); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | void ConfigureProfileManager::applyConfiguration() { | 167 | void ConfigureProfileManager::ApplyConfiguration() { |
| 168 | if (!enabled) | 168 | if (!enabled) { |
| 169 | return; | 169 | return; |
| 170 | } | ||
| 170 | 171 | ||
| 171 | Settings::Apply(); | 172 | Settings::Apply(); |
| 172 | } | 173 | } |
diff --git a/src/yuzu/configuration/configure_profile_manager.h b/src/yuzu/configuration/configure_profile_manager.h index 7fe95a2a8..4e9b4e8ea 100644 --- a/src/yuzu/configuration/configure_profile_manager.h +++ b/src/yuzu/configuration/configure_profile_manager.h | |||
| @@ -30,10 +30,11 @@ public: | |||
| 30 | explicit ConfigureProfileManager(QWidget* parent = nullptr); | 30 | explicit ConfigureProfileManager(QWidget* parent = nullptr); |
| 31 | ~ConfigureProfileManager() override; | 31 | ~ConfigureProfileManager() override; |
| 32 | 32 | ||
| 33 | void applyConfiguration(); | 33 | void ApplyConfiguration(); |
| 34 | void setConfiguration(); | ||
| 35 | 34 | ||
| 36 | private: | 35 | private: |
| 36 | void SetConfiguration(); | ||
| 37 | |||
| 37 | void PopulateUserList(); | 38 | void PopulateUserList(); |
| 38 | void UpdateCurrentUser(); | 39 | void UpdateCurrentUser(); |
| 39 | 40 | ||
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index e588b21f2..5f0ed2f61 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -23,22 +23,24 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui:: | |||
| 23 | 23 | ||
| 24 | connect(ui->rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) { | 24 | connect(ui->rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) { |
| 25 | ui->rng_seed_edit->setEnabled(checked); | 25 | ui->rng_seed_edit->setEnabled(checked); |
| 26 | if (!checked) | 26 | if (!checked) { |
| 27 | ui->rng_seed_edit->setText(QStringLiteral("00000000")); | 27 | ui->rng_seed_edit->setText(QStringLiteral("00000000")); |
| 28 | } | ||
| 28 | }); | 29 | }); |
| 29 | 30 | ||
| 30 | connect(ui->custom_rtc_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) { | 31 | connect(ui->custom_rtc_checkbox, &QCheckBox::stateChanged, this, [this](bool checked) { |
| 31 | ui->custom_rtc_edit->setEnabled(checked); | 32 | ui->custom_rtc_edit->setEnabled(checked); |
| 32 | if (!checked) | 33 | if (!checked) { |
| 33 | ui->custom_rtc_edit->setDateTime(QDateTime::currentDateTime()); | 34 | ui->custom_rtc_edit->setDateTime(QDateTime::currentDateTime()); |
| 35 | } | ||
| 34 | }); | 36 | }); |
| 35 | 37 | ||
| 36 | this->setConfiguration(); | 38 | SetConfiguration(); |
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | ConfigureSystem::~ConfigureSystem() = default; | 41 | ConfigureSystem::~ConfigureSystem() = default; |
| 40 | 42 | ||
| 41 | void ConfigureSystem::setConfiguration() { | 43 | void ConfigureSystem::SetConfiguration() { |
| 42 | enabled = !Core::System::GetInstance().IsPoweredOn(); | 44 | enabled = !Core::System::GetInstance().IsPoweredOn(); |
| 43 | 45 | ||
| 44 | ui->combo_language->setCurrentIndex(Settings::values.language_index); | 46 | ui->combo_language->setCurrentIndex(Settings::values.language_index); |
| @@ -61,22 +63,25 @@ void ConfigureSystem::setConfiguration() { | |||
| 61 | 63 | ||
| 62 | void ConfigureSystem::ReadSystemSettings() {} | 64 | void ConfigureSystem::ReadSystemSettings() {} |
| 63 | 65 | ||
| 64 | void ConfigureSystem::applyConfiguration() { | 66 | void ConfigureSystem::ApplyConfiguration() { |
| 65 | if (!enabled) | 67 | if (!enabled) { |
| 66 | return; | 68 | return; |
| 69 | } | ||
| 67 | 70 | ||
| 68 | Settings::values.language_index = ui->combo_language->currentIndex(); | 71 | Settings::values.language_index = ui->combo_language->currentIndex(); |
| 69 | 72 | ||
| 70 | if (ui->rng_seed_checkbox->isChecked()) | 73 | if (ui->rng_seed_checkbox->isChecked()) { |
| 71 | Settings::values.rng_seed = ui->rng_seed_edit->text().toULongLong(nullptr, 16); | 74 | Settings::values.rng_seed = ui->rng_seed_edit->text().toULongLong(nullptr, 16); |
| 72 | else | 75 | } else { |
| 73 | Settings::values.rng_seed = std::nullopt; | 76 | Settings::values.rng_seed = std::nullopt; |
| 77 | } | ||
| 74 | 78 | ||
| 75 | if (ui->custom_rtc_checkbox->isChecked()) | 79 | if (ui->custom_rtc_checkbox->isChecked()) { |
| 76 | Settings::values.custom_rtc = | 80 | Settings::values.custom_rtc = |
| 77 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()); | 81 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()); |
| 78 | else | 82 | } else { |
| 79 | Settings::values.custom_rtc = std::nullopt; | 83 | Settings::values.custom_rtc = std::nullopt; |
| 84 | } | ||
| 80 | 85 | ||
| 81 | Settings::Apply(); | 86 | Settings::Apply(); |
| 82 | } | 87 | } |
| @@ -89,8 +94,10 @@ void ConfigureSystem::RefreshConsoleID() { | |||
| 89 | "if you use an outdated config savegame. Continue?"); | 94 | "if you use an outdated config savegame. Continue?"); |
| 90 | reply = QMessageBox::critical(this, tr("Warning"), warning_text, | 95 | reply = QMessageBox::critical(this, tr("Warning"), warning_text, |
| 91 | QMessageBox::No | QMessageBox::Yes); | 96 | QMessageBox::No | QMessageBox::Yes); |
| 92 | if (reply == QMessageBox::No) | 97 | if (reply == QMessageBox::No) { |
| 93 | return; | 98 | return; |
| 99 | } | ||
| 100 | |||
| 94 | u64 console_id{}; | 101 | u64 console_id{}; |
| 95 | ui->label_console_id->setText( | 102 | ui->label_console_id->setText( |
| 96 | tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper())); | 103 | tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper())); |
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index 41d03c56f..4c0329d57 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h | |||
| @@ -20,10 +20,11 @@ public: | |||
| 20 | explicit ConfigureSystem(QWidget* parent = nullptr); | 20 | explicit ConfigureSystem(QWidget* parent = nullptr); |
| 21 | ~ConfigureSystem() override; | 21 | ~ConfigureSystem() override; |
| 22 | 22 | ||
| 23 | void applyConfiguration(); | 23 | void ApplyConfiguration(); |
| 24 | void setConfiguration(); | ||
| 25 | 24 | ||
| 26 | private: | 25 | private: |
| 26 | void SetConfiguration(); | ||
| 27 | |||
| 27 | void ReadSystemSettings(); | 28 | void ReadSystemSettings(); |
| 28 | 29 | ||
| 29 | void RefreshConsoleID(); | 30 | void RefreshConsoleID(); |
diff --git a/src/yuzu/configuration/configure_touchscreen_advanced.cpp b/src/yuzu/configuration/configure_touchscreen_advanced.cpp index 9c1561e9d..bad224239 100644 --- a/src/yuzu/configuration/configure_touchscreen_advanced.cpp +++ b/src/yuzu/configuration/configure_touchscreen_advanced.cpp | |||
| @@ -12,29 +12,29 @@ ConfigureTouchscreenAdvanced::ConfigureTouchscreenAdvanced(QWidget* parent) | |||
| 12 | ui->setupUi(this); | 12 | ui->setupUi(this); |
| 13 | 13 | ||
| 14 | connect(ui->restore_defaults_button, &QPushButton::pressed, this, | 14 | connect(ui->restore_defaults_button, &QPushButton::pressed, this, |
| 15 | &ConfigureTouchscreenAdvanced::restoreDefaults); | 15 | &ConfigureTouchscreenAdvanced::RestoreDefaults); |
| 16 | 16 | ||
| 17 | loadConfiguration(); | 17 | LoadConfiguration(); |
| 18 | resize(0, 0); | 18 | resize(0, 0); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | ConfigureTouchscreenAdvanced::~ConfigureTouchscreenAdvanced() = default; | 21 | ConfigureTouchscreenAdvanced::~ConfigureTouchscreenAdvanced() = default; |
| 22 | 22 | ||
| 23 | void ConfigureTouchscreenAdvanced::applyConfiguration() { | 23 | void ConfigureTouchscreenAdvanced::ApplyConfiguration() { |
| 24 | Settings::values.touchscreen.finger = ui->finger_box->value(); | 24 | Settings::values.touchscreen.finger = ui->finger_box->value(); |
| 25 | Settings::values.touchscreen.diameter_x = ui->diameter_x_box->value(); | 25 | Settings::values.touchscreen.diameter_x = ui->diameter_x_box->value(); |
| 26 | Settings::values.touchscreen.diameter_y = ui->diameter_y_box->value(); | 26 | Settings::values.touchscreen.diameter_y = ui->diameter_y_box->value(); |
| 27 | Settings::values.touchscreen.rotation_angle = ui->angle_box->value(); | 27 | Settings::values.touchscreen.rotation_angle = ui->angle_box->value(); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void ConfigureTouchscreenAdvanced::loadConfiguration() { | 30 | void ConfigureTouchscreenAdvanced::LoadConfiguration() { |
| 31 | ui->finger_box->setValue(Settings::values.touchscreen.finger); | 31 | ui->finger_box->setValue(Settings::values.touchscreen.finger); |
| 32 | ui->diameter_x_box->setValue(Settings::values.touchscreen.diameter_x); | 32 | ui->diameter_x_box->setValue(Settings::values.touchscreen.diameter_x); |
| 33 | ui->diameter_y_box->setValue(Settings::values.touchscreen.diameter_y); | 33 | ui->diameter_y_box->setValue(Settings::values.touchscreen.diameter_y); |
| 34 | ui->angle_box->setValue(Settings::values.touchscreen.rotation_angle); | 34 | ui->angle_box->setValue(Settings::values.touchscreen.rotation_angle); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | void ConfigureTouchscreenAdvanced::restoreDefaults() { | 37 | void ConfigureTouchscreenAdvanced::RestoreDefaults() { |
| 38 | ui->finger_box->setValue(0); | 38 | ui->finger_box->setValue(0); |
| 39 | ui->diameter_x_box->setValue(15); | 39 | ui->diameter_x_box->setValue(15); |
| 40 | ui->diameter_y_box->setValue(15); | 40 | ui->diameter_y_box->setValue(15); |
diff --git a/src/yuzu/configuration/configure_touchscreen_advanced.h b/src/yuzu/configuration/configure_touchscreen_advanced.h index 3d0772c87..94edd85b1 100644 --- a/src/yuzu/configuration/configure_touchscreen_advanced.h +++ b/src/yuzu/configuration/configure_touchscreen_advanced.h | |||
| @@ -18,13 +18,13 @@ public: | |||
| 18 | explicit ConfigureTouchscreenAdvanced(QWidget* parent); | 18 | explicit ConfigureTouchscreenAdvanced(QWidget* parent); |
| 19 | ~ConfigureTouchscreenAdvanced() override; | 19 | ~ConfigureTouchscreenAdvanced() override; |
| 20 | 20 | ||
| 21 | void applyConfiguration(); | 21 | void ApplyConfiguration(); |
| 22 | 22 | ||
| 23 | private: | 23 | private: |
| 24 | /// Load configuration settings. | 24 | /// Load configuration settings. |
| 25 | void loadConfiguration(); | 25 | void LoadConfiguration(); |
| 26 | /// Restore all buttons to their default values. | 26 | /// Restore all buttons to their default values. |
| 27 | void restoreDefaults(); | 27 | void RestoreDefaults(); |
| 28 | 28 | ||
| 29 | std::unique_ptr<Ui::ConfigureTouchscreenAdvanced> ui; | 29 | std::unique_ptr<Ui::ConfigureTouchscreenAdvanced> ui; |
| 30 | }; | 30 | }; |
diff --git a/src/yuzu/configuration/configure_web.cpp b/src/yuzu/configuration/configure_web.cpp index 9dc34412d..8cacb75f3 100644 --- a/src/yuzu/configuration/configure_web.cpp +++ b/src/yuzu/configuration/configure_web.cpp | |||
| @@ -22,12 +22,12 @@ ConfigureWeb::ConfigureWeb(QWidget* parent) | |||
| 22 | #ifndef USE_DISCORD_PRESENCE | 22 | #ifndef USE_DISCORD_PRESENCE |
| 23 | ui->discord_group->setVisible(false); | 23 | ui->discord_group->setVisible(false); |
| 24 | #endif | 24 | #endif |
| 25 | this->setConfiguration(); | 25 | SetConfiguration(); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | ConfigureWeb::~ConfigureWeb() = default; | 28 | ConfigureWeb::~ConfigureWeb() = default; |
| 29 | 29 | ||
| 30 | void ConfigureWeb::setConfiguration() { | 30 | void ConfigureWeb::SetConfiguration() { |
| 31 | ui->web_credentials_disclaimer->setWordWrap(true); | 31 | ui->web_credentials_disclaimer->setWordWrap(true); |
| 32 | ui->telemetry_learn_more->setOpenExternalLinks(true); | 32 | ui->telemetry_learn_more->setOpenExternalLinks(true); |
| 33 | ui->telemetry_learn_more->setText( | 33 | ui->telemetry_learn_more->setText( |
| @@ -56,7 +56,7 @@ void ConfigureWeb::setConfiguration() { | |||
| 56 | ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence); | 56 | ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | void ConfigureWeb::applyConfiguration() { | 59 | void ConfigureWeb::ApplyConfiguration() { |
| 60 | Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked(); | 60 | Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked(); |
| 61 | UISettings::values.enable_discord_presence = ui->toggle_discordrpc->isChecked(); | 61 | UISettings::values.enable_discord_presence = ui->toggle_discordrpc->isChecked(); |
| 62 | if (user_verified) { | 62 | if (user_verified) { |
| @@ -121,6 +121,6 @@ void ConfigureWeb::OnLoginVerified() { | |||
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | void ConfigureWeb::retranslateUi() { | 124 | void ConfigureWeb::RetranslateUI() { |
| 125 | ui->retranslateUi(this); | 125 | ui->retranslateUi(this); |
| 126 | } | 126 | } |
diff --git a/src/yuzu/configuration/configure_web.h b/src/yuzu/configuration/configure_web.h index 7752ae4a1..49bee171b 100644 --- a/src/yuzu/configuration/configure_web.h +++ b/src/yuzu/configuration/configure_web.h | |||
| @@ -19,8 +19,8 @@ public: | |||
| 19 | explicit ConfigureWeb(QWidget* parent = nullptr); | 19 | explicit ConfigureWeb(QWidget* parent = nullptr); |
| 20 | ~ConfigureWeb() override; | 20 | ~ConfigureWeb() override; |
| 21 | 21 | ||
| 22 | void applyConfiguration(); | 22 | void ApplyConfiguration(); |
| 23 | void retranslateUi(); | 23 | void RetranslateUI(); |
| 24 | 24 | ||
| 25 | private: | 25 | private: |
| 26 | void RefreshTelemetryID(); | 26 | void RefreshTelemetryID(); |
| @@ -28,7 +28,7 @@ private: | |||
| 28 | void VerifyLogin(); | 28 | void VerifyLogin(); |
| 29 | void OnLoginVerified(); | 29 | void OnLoginVerified(); |
| 30 | 30 | ||
| 31 | void setConfiguration(); | 31 | void SetConfiguration(); |
| 32 | 32 | ||
| 33 | bool user_verified = true; | 33 | bool user_verified = true; |
| 34 | QFutureWatcher<bool> verify_watcher; | 34 | QFutureWatcher<bool> verify_watcher; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index c6526f855..d2258a487 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1294,10 +1294,10 @@ void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { | |||
| 1294 | } | 1294 | } |
| 1295 | 1295 | ||
| 1296 | ConfigurePerGameGeneral dialog(this, title_id); | 1296 | ConfigurePerGameGeneral dialog(this, title_id); |
| 1297 | dialog.loadFromFile(v_file); | 1297 | dialog.LoadFromFile(v_file); |
| 1298 | auto result = dialog.exec(); | 1298 | auto result = dialog.exec(); |
| 1299 | if (result == QDialog::Accepted) { | 1299 | if (result == QDialog::Accepted) { |
| 1300 | dialog.applyConfiguration(); | 1300 | dialog.ApplyConfiguration(); |
| 1301 | 1301 | ||
| 1302 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); | 1302 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); |
| 1303 | if (reload) { | 1303 | if (reload) { |
| @@ -1688,26 +1688,31 @@ void GMainWindow::ToggleWindowMode() { | |||
| 1688 | } | 1688 | } |
| 1689 | 1689 | ||
| 1690 | void GMainWindow::OnConfigure() { | 1690 | void GMainWindow::OnConfigure() { |
| 1691 | ConfigureDialog configureDialog(this, hotkey_registry); | 1691 | const auto old_theme = UISettings::values.theme; |
| 1692 | auto old_theme = UISettings::values.theme; | ||
| 1693 | const bool old_discord_presence = UISettings::values.enable_discord_presence; | 1692 | const bool old_discord_presence = UISettings::values.enable_discord_presence; |
| 1694 | auto result = configureDialog.exec(); | ||
| 1695 | if (result == QDialog::Accepted) { | ||
| 1696 | configureDialog.applyConfiguration(); | ||
| 1697 | InitializeHotkeys(); | ||
| 1698 | if (UISettings::values.theme != old_theme) | ||
| 1699 | UpdateUITheme(); | ||
| 1700 | if (UISettings::values.enable_discord_presence != old_discord_presence) | ||
| 1701 | SetDiscordEnabled(UISettings::values.enable_discord_presence); | ||
| 1702 | 1693 | ||
| 1703 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); | 1694 | ConfigureDialog configure_dialog(this, hotkey_registry); |
| 1704 | if (reload) { | 1695 | const auto result = configure_dialog.exec(); |
| 1705 | game_list->PopulateAsync(UISettings::values.game_directory_path, | 1696 | if (result != QDialog::Accepted) { |
| 1706 | UISettings::values.game_directory_deepscan); | 1697 | return; |
| 1707 | } | 1698 | } |
| 1708 | 1699 | ||
| 1709 | config->Save(); | 1700 | configure_dialog.ApplyConfiguration(); |
| 1701 | InitializeHotkeys(); | ||
| 1702 | if (UISettings::values.theme != old_theme) { | ||
| 1703 | UpdateUITheme(); | ||
| 1704 | } | ||
| 1705 | if (UISettings::values.enable_discord_presence != old_discord_presence) { | ||
| 1706 | SetDiscordEnabled(UISettings::values.enable_discord_presence); | ||
| 1707 | } | ||
| 1708 | |||
| 1709 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); | ||
| 1710 | if (reload) { | ||
| 1711 | game_list->PopulateAsync(UISettings::values.game_directory_path, | ||
| 1712 | UISettings::values.game_directory_deepscan); | ||
| 1710 | } | 1713 | } |
| 1714 | |||
| 1715 | config->Save(); | ||
| 1711 | } | 1716 | } |
| 1712 | 1717 | ||
| 1713 | void GMainWindow::OnLoadAmiibo() { | 1718 | void GMainWindow::OnLoadAmiibo() { |