Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(settings): correct empty listbox audio device
Browse files Browse the repository at this point in the history
fix incorrect checking index
fix #3709
  • Loading branch information
PKEv committed Sep 16, 2016
1 parent 077a844 commit 84a9570
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/widget/form/settings/avform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,14 @@ void AVForm::getAudioInDevices()
inDevCombobox->addItems(deviceNames);
inDevCombobox->blockSignals(false);

int idx = Settings::getInstance().getAudioInDevEnabled()
? deviceNames.indexOf(Settings::getInstance().getInDev())
: 0;
inDevCombobox->setCurrentIndex(idx < 0 ? 1 : idx);
int idx = 0;
if (Settings::getInstance().getAudioInDevEnabled() && deviceNames.size() > 1)
{
idx = deviceNames.indexOf(Settings::getInstance().getInDev()) + 1;
if (idx <= 0)
idx = 1;
}
inDevCombobox->setCurrentIndex(idx);
}

void AVForm::getAudioOutDevices()
Expand All @@ -471,10 +475,14 @@ void AVForm::getAudioOutDevices()
outDevCombobox->addItems(deviceNames);
outDevCombobox->blockSignals(false);

int idx = Settings::getInstance().getAudioOutDevEnabled()
? deviceNames.indexOf(Settings::getInstance().getOutDev())
: 0;
outDevCombobox->setCurrentIndex(idx < 0 ? 1 : idx);
int idx = 0;
if (Settings::getInstance().getAudioOutDevEnabled() && deviceNames.size() > 1)
{
idx = deviceNames.indexOf(Settings::getInstance().getOutDev()) + 1;
if (idx <= 0)
idx = 1;
}
outDevCombobox->setCurrentIndex(idx);
}

void AVForm::on_inDevCombobox_currentIndexChanged(int deviceIndex)
Expand Down

0 comments on commit 84a9570

Please sign in to comment.