mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(settings): correct empty listbox audio device
fix incorrect checking index fix #3709
This commit is contained in:
parent
077a844461
commit
84a9570039
|
@ -455,10 +455,14 @@ void AVForm::getAudioInDevices()
|
||||||
inDevCombobox->addItems(deviceNames);
|
inDevCombobox->addItems(deviceNames);
|
||||||
inDevCombobox->blockSignals(false);
|
inDevCombobox->blockSignals(false);
|
||||||
|
|
||||||
int idx = Settings::getInstance().getAudioInDevEnabled()
|
int idx = 0;
|
||||||
? deviceNames.indexOf(Settings::getInstance().getInDev())
|
if (Settings::getInstance().getAudioInDevEnabled() && deviceNames.size() > 1)
|
||||||
: 0;
|
{
|
||||||
inDevCombobox->setCurrentIndex(idx < 0 ? 1 : idx);
|
idx = deviceNames.indexOf(Settings::getInstance().getInDev()) + 1;
|
||||||
|
if (idx <= 0)
|
||||||
|
idx = 1;
|
||||||
|
}
|
||||||
|
inDevCombobox->setCurrentIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVForm::getAudioOutDevices()
|
void AVForm::getAudioOutDevices()
|
||||||
|
@ -471,10 +475,14 @@ void AVForm::getAudioOutDevices()
|
||||||
outDevCombobox->addItems(deviceNames);
|
outDevCombobox->addItems(deviceNames);
|
||||||
outDevCombobox->blockSignals(false);
|
outDevCombobox->blockSignals(false);
|
||||||
|
|
||||||
int idx = Settings::getInstance().getAudioOutDevEnabled()
|
int idx = 0;
|
||||||
? deviceNames.indexOf(Settings::getInstance().getOutDev())
|
if (Settings::getInstance().getAudioOutDevEnabled() && deviceNames.size() > 1)
|
||||||
: 0;
|
{
|
||||||
outDevCombobox->setCurrentIndex(idx < 0 ? 1 : idx);
|
idx = deviceNames.indexOf(Settings::getInstance().getOutDev()) + 1;
|
||||||
|
if (idx <= 0)
|
||||||
|
idx = 1;
|
||||||
|
}
|
||||||
|
outDevCombobox->setCurrentIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVForm::on_inDevCombobox_currentIndexChanged(int deviceIndex)
|
void AVForm::on_inDevCombobox_currentIndexChanged(int deviceIndex)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user