1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix spurious audio i/o changed signal

This commit is contained in:
tux3 2015-11-07 22:06:24 +01:00
parent ad5578e44e
commit c6220545c9
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -249,13 +249,13 @@ void AVForm::getAudioInDevices()
{ {
QString settingsInDev = Settings::getInstance().getInDev(); QString settingsInDev = Settings::getInstance().getInDev();
int inDevIndex = 0; int inDevIndex = 0;
bodyUI->inDevCombobox->blockSignals(true);
bodyUI->inDevCombobox->clear(); bodyUI->inDevCombobox->clear();
bodyUI->inDevCombobox->addItem(tr("None")); bodyUI->inDevCombobox->addItem(tr("None"));
const ALchar *pDeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); const ALchar *pDeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
if (pDeviceList) if (pDeviceList)
{ {
//prevent currentIndexChanged to be fired while adding items //prevent currentIndexChanged to be fired while adding items
bodyUI->inDevCombobox->blockSignals(true);
while (*pDeviceList) while (*pDeviceList)
{ {
int len = strlen(pDeviceList); int len = strlen(pDeviceList);
@ -271,8 +271,8 @@ void AVForm::getAudioInDevices()
} }
//addItem changes currentIndex -> reset //addItem changes currentIndex -> reset
bodyUI->inDevCombobox->setCurrentIndex(-1); bodyUI->inDevCombobox->setCurrentIndex(-1);
bodyUI->inDevCombobox->blockSignals(false);
} }
bodyUI->inDevCombobox->blockSignals(false);
bodyUI->inDevCombobox->setCurrentIndex(inDevIndex); bodyUI->inDevCombobox->setCurrentIndex(inDevIndex);
} }
@ -280,6 +280,7 @@ void AVForm::getAudioOutDevices()
{ {
QString settingsOutDev = Settings::getInstance().getOutDev(); QString settingsOutDev = Settings::getInstance().getOutDev();
int outDevIndex = 0; int outDevIndex = 0;
bodyUI->outDevCombobox->blockSignals(true);
bodyUI->outDevCombobox->clear(); bodyUI->outDevCombobox->clear();
bodyUI->outDevCombobox->addItem(tr("None")); bodyUI->outDevCombobox->addItem(tr("None"));
const ALchar *pDeviceList; const ALchar *pDeviceList;
@ -290,7 +291,6 @@ void AVForm::getAudioOutDevices()
if (pDeviceList) if (pDeviceList)
{ {
//prevent currentIndexChanged to be fired while adding items //prevent currentIndexChanged to be fired while adding items
bodyUI->outDevCombobox->blockSignals(true);
while (*pDeviceList) while (*pDeviceList)
{ {
int len = strlen(pDeviceList); int len = strlen(pDeviceList);
@ -308,8 +308,8 @@ void AVForm::getAudioOutDevices()
} }
//addItem changes currentIndex -> reset //addItem changes currentIndex -> reset
bodyUI->outDevCombobox->setCurrentIndex(-1); bodyUI->outDevCombobox->setCurrentIndex(-1);
bodyUI->outDevCombobox->blockSignals(false);
} }
bodyUI->outDevCombobox->blockSignals(false);
bodyUI->outDevCombobox->setCurrentIndex(outDevIndex); bodyUI->outDevCombobox->setCurrentIndex(outDevIndex);
} }