yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #9495 from german77/no_refresh

yuzu: Automatically refresh device list
This commit is contained in:
bunnei 2022-12-27 00:07:13 -05:00 committed by GitHub
commit 343c01b87a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 23 deletions

View File

@ -738,13 +738,10 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this, connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this,
&ConfigureInputPlayer::UpdateMappingWithDefaults); &ConfigureInputPlayer::UpdateMappingWithDefaults);
ui->comboDevices->installEventFilter(this);
ui->comboDevices->setCurrentIndex(-1); ui->comboDevices->setCurrentIndex(-1);
ui->buttonRefreshDevices->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
connect(ui->buttonRefreshDevices, &QPushButton::clicked,
[this] { emit RefreshInputDevices(); });
timeout_timer->setSingleShot(true); timeout_timer->setSingleShot(true);
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); }); connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
@ -1479,6 +1476,13 @@ void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) {
} }
} }
bool ConfigureInputPlayer::eventFilter(QObject* object, QEvent* event) {
if (object == ui->comboDevices && event->type() == QEvent::MouseButtonPress) {
RefreshInputDevices();
}
return object->eventFilter(object, event);
}
void ConfigureInputPlayer::CreateProfile() { void ConfigureInputPlayer::CreateProfile() {
const auto profile_name = const auto profile_name =
LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 30, LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 30,

View File

@ -119,6 +119,9 @@ private:
/// Handle key press events. /// Handle key press events.
void keyPressEvent(QKeyEvent* event) override; void keyPressEvent(QKeyEvent* event) override;
/// Handle combobox list refresh
bool eventFilter(QObject* object, QEvent* event) override;
/// Update UI to reflect current configuration. /// Update UI to reflect current configuration.
void UpdateUI(); void UpdateUI();

View File

@ -122,25 +122,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="buttonRefreshDevices">
<property name="minimumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>21</width>
<height>21</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>