summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yuzu/configuration/configure_input.cpp16
-rw-r--r--src/yuzu/configuration/configure_input.h1
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp20
-rw-r--r--src/yuzu/configuration/configure_input_player.h12
4 files changed, 38 insertions, 11 deletions
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index 600cc03ae..d9009091b 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -124,8 +124,10 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
124 } 124 }
125 } 125 }
126 }); 126 });
127 connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputDevices, 127 connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputDevices, this,
128 [this] { UpdateAllInputDevices(); }); 128 &ConfigureInput::UpdateAllInputDevices);
129 connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputProfiles, this,
130 &ConfigureInput::UpdateAllInputProfiles, Qt::QueuedConnection);
129 connect(player_connected[i], &QCheckBox::stateChanged, [this, i](int state) { 131 connect(player_connected[i], &QCheckBox::stateChanged, [this, i](int state) {
130 player_controllers[i]->ConnectPlayer(state == Qt::Checked); 132 player_controllers[i]->ConnectPlayer(state == Qt::Checked);
131 }); 133 });
@@ -259,3 +261,13 @@ void ConfigureInput::UpdateAllInputDevices() {
259 player->UpdateInputDeviceCombobox(); 261 player->UpdateInputDeviceCombobox();
260 } 262 }
261} 263}
264
265void ConfigureInput::UpdateAllInputProfiles(std::size_t player_index) {
266 for (std::size_t i = 0; i < player_controllers.size(); ++i) {
267 if (i == player_index) {
268 continue;
269 }
270
271 player_controllers[i]->UpdateInputProfiles();
272 }
273}
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h
index 9eba9b523..f4eb0d78b 100644
--- a/src/yuzu/configuration/configure_input.h
+++ b/src/yuzu/configuration/configure_input.h
@@ -52,6 +52,7 @@ private:
52 52
53 void UpdateDockedState(bool is_handheld); 53 void UpdateDockedState(bool is_handheld);
54 void UpdateAllInputDevices(); 54 void UpdateAllInputDevices();
55 void UpdateAllInputProfiles(std::size_t player_index);
55 56
56 /// Load configuration settings. 57 /// Load configuration settings.
57 void LoadConfiguration(); 58 void LoadConfiguration();
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 0d10c1360..f65a7fe73 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -541,7 +541,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
541 } 541 }
542 }); 542 });
543 543
544 RefreshInputProfiles(); 544 UpdateInputProfiles();
545 545
546 connect(ui->buttonProfilesNew, &QPushButton::clicked, this, 546 connect(ui->buttonProfilesNew, &QPushButton::clicked, this,
547 &ConfigureInputPlayer::CreateProfile); 547 &ConfigureInputPlayer::CreateProfile);
@@ -1132,10 +1132,13 @@ void ConfigureInputPlayer::CreateProfile() {
1132 if (!profiles->CreateProfile(profile_name.toStdString(), player_index)) { 1132 if (!profiles->CreateProfile(profile_name.toStdString(), player_index)) {
1133 QMessageBox::critical(this, tr("Create Input Profile"), 1133 QMessageBox::critical(this, tr("Create Input Profile"),
1134 tr("Failed to create the input profile \"%1\"").arg(profile_name)); 1134 tr("Failed to create the input profile \"%1\"").arg(profile_name));
1135 RefreshInputProfiles(); 1135 UpdateInputProfiles();
1136 emit RefreshInputProfiles(player_index);
1136 return; 1137 return;
1137 } 1138 }
1138 1139
1140 emit RefreshInputProfiles(player_index);
1141
1139 ui->comboProfiles->addItem(profile_name); 1142 ui->comboProfiles->addItem(profile_name);
1140 ui->comboProfiles->setCurrentIndex(ui->comboProfiles->count() - 1); 1143 ui->comboProfiles->setCurrentIndex(ui->comboProfiles->count() - 1);
1141} 1144}
@@ -1150,10 +1153,13 @@ void ConfigureInputPlayer::DeleteProfile() {
1150 if (!profiles->DeleteProfile(profile_name.toStdString())) { 1153 if (!profiles->DeleteProfile(profile_name.toStdString())) {
1151 QMessageBox::critical(this, tr("Delete Input Profile"), 1154 QMessageBox::critical(this, tr("Delete Input Profile"),
1152 tr("Failed to delete the input profile \"%1\"").arg(profile_name)); 1155 tr("Failed to delete the input profile \"%1\"").arg(profile_name));
1153 RefreshInputProfiles(); 1156 UpdateInputProfiles();
1157 emit RefreshInputProfiles(player_index);
1154 return; 1158 return;
1155 } 1159 }
1156 1160
1161 emit RefreshInputProfiles(player_index);
1162
1157 ui->comboProfiles->removeItem(ui->comboProfiles->currentIndex()); 1163 ui->comboProfiles->removeItem(ui->comboProfiles->currentIndex());
1158 ui->comboProfiles->setCurrentIndex(-1); 1164 ui->comboProfiles->setCurrentIndex(-1);
1159} 1165}
@@ -1170,7 +1176,8 @@ void ConfigureInputPlayer::LoadProfile() {
1170 if (!profiles->LoadProfile(profile_name.toStdString(), player_index)) { 1176 if (!profiles->LoadProfile(profile_name.toStdString(), player_index)) {
1171 QMessageBox::critical(this, tr("Load Input Profile"), 1177 QMessageBox::critical(this, tr("Load Input Profile"),
1172 tr("Failed to load the input profile \"%1\"").arg(profile_name)); 1178 tr("Failed to load the input profile \"%1\"").arg(profile_name));
1173 RefreshInputProfiles(); 1179 UpdateInputProfiles();
1180 emit RefreshInputProfiles(player_index);
1174 return; 1181 return;
1175 } 1182 }
1176 1183
@@ -1189,12 +1196,13 @@ void ConfigureInputPlayer::SaveProfile() {
1189 if (!profiles->SaveProfile(profile_name.toStdString(), player_index)) { 1196 if (!profiles->SaveProfile(profile_name.toStdString(), player_index)) {
1190 QMessageBox::critical(this, tr("Save Input Profile"), 1197 QMessageBox::critical(this, tr("Save Input Profile"),
1191 tr("Failed to save the input profile \"%1\"").arg(profile_name)); 1198 tr("Failed to save the input profile \"%1\"").arg(profile_name));
1192 RefreshInputProfiles(); 1199 UpdateInputProfiles();
1200 emit RefreshInputProfiles(player_index);
1193 return; 1201 return;
1194 } 1202 }
1195} 1203}
1196 1204
1197void ConfigureInputPlayer::RefreshInputProfiles() { 1205void ConfigureInputPlayer::UpdateInputProfiles() {
1198 ui->comboProfiles->clear(); 1206 ui->comboProfiles->clear();
1199 1207
1200 for (const auto& profile_name : profiles->GetInputProfileNames()) { 1208 for (const auto& profile_name : profiles->GetInputProfileNames()) {
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index 4895e8850..23cf6f958 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -59,6 +59,9 @@ public:
59 /// Update the input devices combobox. 59 /// Update the input devices combobox.
60 void UpdateInputDeviceCombobox(); 60 void UpdateInputDeviceCombobox();
61 61
62 /// Updates the list of controller profiles.
63 void UpdateInputProfiles();
64
62 /// Restore all buttons to their default values. 65 /// Restore all buttons to their default values.
63 void RestoreDefaults(); 66 void RestoreDefaults();
64 67
@@ -72,6 +75,12 @@ signals:
72 void HandheldStateChanged(bool is_handheld); 75 void HandheldStateChanged(bool is_handheld);
73 /// Emitted when the input devices combobox is being refreshed. 76 /// Emitted when the input devices combobox is being refreshed.
74 void RefreshInputDevices(); 77 void RefreshInputDevices();
78 /**
79 * Emitted when the input profiles combobox is being refreshed.
80 * The player_index represents the current player's index, and the profile combobox
81 * will not be updated for this index as they are already updated by other mechanisms.
82 */
83 void RefreshInputProfiles(std::size_t player_index);
75 84
76protected: 85protected:
77 void showEvent(QShowEvent* event) override; 86 void showEvent(QShowEvent* event) override;
@@ -130,9 +139,6 @@ private:
130 /// Saves the current controller configuration into a selected controller profile. 139 /// Saves the current controller configuration into a selected controller profile.
131 void SaveProfile(); 140 void SaveProfile();
132 141
133 /// Refreshes the list of controller profiles.
134 void RefreshInputProfiles();
135
136 std::unique_ptr<Ui::ConfigureInputPlayer> ui; 142 std::unique_ptr<Ui::ConfigureInputPlayer> ui;
137 143
138 std::size_t player_index; 144 std::size_t player_index;