UI: Fix "invalid" audio devices in audio settings
If a global audio device is disconnected or for whatever reason is no
longer available when audio settings is opened, it will erroneously
select index 0 of the combo box ("Disabled") by default because it can't
find it in the combo box. This fixes that issue by making it insert an
item in to the combo box specifying that the previously available audio
device is no longer available, and properly preserving the user's
settings.
This commit is contained in:
parent
bbbdd4442c
commit
3749436cd5
2 changed files with 11 additions and 2 deletions
|
|
@ -1406,9 +1406,17 @@ void OBSBasicSettings::LoadListValues(QComboBox *widget, obs_property_t *prop,
|
|||
}
|
||||
|
||||
if (deviceId) {
|
||||
int idx = widget->findData(QVariant(QT_UTF8(deviceId)));
|
||||
if (idx != -1)
|
||||
QVariant var(QT_UTF8(deviceId));
|
||||
int idx = widget->findData(var);
|
||||
if (idx != -1) {
|
||||
widget->setCurrentIndex(idx);
|
||||
} else {
|
||||
widget->insertItem(0,
|
||||
QTStr("Basic.Settings.Audio."
|
||||
"UnknownAudioDevice"),
|
||||
var);
|
||||
widget->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (settings)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue