mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix closing video device after changing tab
This commit is contained in:
parent
0e9cfd948e
commit
83bcf2b8ae
|
@ -211,7 +211,7 @@ void AVForm::onVideoDevChanged(int index)
|
||||||
QSize savedRes = Settings::getInstance().getCamVideoRes();
|
QSize savedRes = Settings::getInstance().getCamVideoRes();
|
||||||
int savedResIndex = -1;
|
int savedResIndex = -1;
|
||||||
bodyUI->videoModescomboBox->clear();
|
bodyUI->videoModescomboBox->clear();
|
||||||
bodyUI->videoModescomboBox->blockSignals(true);
|
bodyUI->videoModescomboBox->blockSignals(true);
|
||||||
for (int i=0; i<res.size(); ++i)
|
for (int i=0; i<res.size(); ++i)
|
||||||
{
|
{
|
||||||
QSize& r = res[i];
|
QSize& r = res[i];
|
||||||
|
@ -266,37 +266,37 @@ void AVForm::getVideoDevices()
|
||||||
void AVForm::getAudioInDevices()
|
void AVForm::getAudioInDevices()
|
||||||
{
|
{
|
||||||
QString settingsInDev = Settings::getInstance().getInDev();
|
QString settingsInDev = Settings::getInstance().getInDev();
|
||||||
int inDevIndex = 0;
|
int inDevIndex = 0;
|
||||||
bodyUI->inDevCombobox->clear();
|
bodyUI->inDevCombobox->clear();
|
||||||
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);
|
bodyUI->inDevCombobox->blockSignals(true);
|
||||||
while (*pDeviceList)
|
while (*pDeviceList)
|
||||||
{
|
{
|
||||||
int len = strlen(pDeviceList);
|
int len = strlen(pDeviceList);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QString inDev = QString::fromUtf8(pDeviceList,len);
|
QString inDev = QString::fromUtf8(pDeviceList,len);
|
||||||
#else
|
#else
|
||||||
QString inDev = QString::fromLocal8Bit(pDeviceList,len);
|
QString inDev = QString::fromLocal8Bit(pDeviceList,len);
|
||||||
#endif
|
#endif
|
||||||
bodyUI->inDevCombobox->addItem(inDev);
|
bodyUI->inDevCombobox->addItem(inDev);
|
||||||
if (settingsInDev == inDev)
|
if (settingsInDev == inDev)
|
||||||
inDevIndex = bodyUI->inDevCombobox->count()-1;
|
inDevIndex = bodyUI->inDevCombobox->count()-1;
|
||||||
pDeviceList += len+1;
|
pDeviceList += len+1;
|
||||||
}
|
}
|
||||||
//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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVForm::getAudioOutDevices()
|
void AVForm::getAudioOutDevices()
|
||||||
{
|
{
|
||||||
QString settingsOutDev = Settings::getInstance().getOutDev();
|
QString settingsOutDev = Settings::getInstance().getOutDev();
|
||||||
int outDevIndex = 0;
|
int outDevIndex = 0;
|
||||||
bodyUI->outDevCombobox->clear();
|
bodyUI->outDevCombobox->clear();
|
||||||
const ALchar *pDeviceList;
|
const ALchar *pDeviceList;
|
||||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
||||||
|
@ -305,15 +305,15 @@ void AVForm::getAudioOutDevices()
|
||||||
pDeviceList = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
pDeviceList = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||||
if (pDeviceList)
|
if (pDeviceList)
|
||||||
{
|
{
|
||||||
//prevent currentIndexChanged to be fired while adding items
|
//prevent currentIndexChanged to be fired while adding items
|
||||||
bodyUI->outDevCombobox->blockSignals(true);
|
bodyUI->outDevCombobox->blockSignals(true);
|
||||||
while (*pDeviceList)
|
while (*pDeviceList)
|
||||||
{
|
{
|
||||||
int len = strlen(pDeviceList);
|
int len = strlen(pDeviceList);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QString outDev = QString::fromUtf8(pDeviceList,len);
|
QString outDev = QString::fromUtf8(pDeviceList,len);
|
||||||
#else
|
#else
|
||||||
QString outDev = QString::fromLocal8Bit(pDeviceList,len);
|
QString outDev = QString::fromLocal8Bit(pDeviceList,len);
|
||||||
#endif
|
#endif
|
||||||
bodyUI->outDevCombobox->addItem(outDev);
|
bodyUI->outDevCombobox->addItem(outDev);
|
||||||
if (settingsOutDev == outDev)
|
if (settingsOutDev == outDev)
|
||||||
|
@ -322,11 +322,11 @@ void AVForm::getAudioOutDevices()
|
||||||
}
|
}
|
||||||
pDeviceList += len+1;
|
pDeviceList += len+1;
|
||||||
}
|
}
|
||||||
//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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVForm::onInDevChanged(const QString &deviceDescriptor)
|
void AVForm::onInDevChanged(const QString &deviceDescriptor)
|
||||||
|
@ -388,6 +388,7 @@ void AVForm::killVideoSurface()
|
||||||
while ((child = bodyUI->gridLayout->takeAt(0)) != 0)
|
while ((child = bodyUI->gridLayout->takeAt(0)) != 0)
|
||||||
delete child;
|
delete child;
|
||||||
|
|
||||||
|
camVideoSurface->close();
|
||||||
delete camVideoSurface;
|
delete camVideoSurface;
|
||||||
camVideoSurface = nullptr;
|
camVideoSurface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user