diff --git a/Client/qtTeamTalk/preferencesdlg.cpp b/Client/qtTeamTalk/preferencesdlg.cpp index a459f1063..a6c06bac9 100644 --- a/Client/qtTeamTalk/preferencesdlg.cpp +++ b/Client/qtTeamTalk/preferencesdlg.cpp @@ -129,21 +129,10 @@ PreferencesDlg::PreferencesDlg(SoundDevice& devin, SoundDevice& devout, QWidget this, &PreferencesDlg::slotDesktopAccess); //sound tab - ui.sndSysBox->clear(); -#if defined(Q_OS_WIN32) - ui.sndSysBox->addItem(tr("Windows Audio Session API (WASAPI)"), SOUNDSYSTEM_WASAPI); - ui.sndSysBox->addItem(tr("DirectSound"), SOUNDSYSTEM_DSOUND); - ui.sndSysBox->addItem(tr("Windows legacy audio system"), SOUNDSYSTEM_WINMM); -#elif defined(Q_OS_DARWIN) - ui.sndSysBox->addItem(tr("CoreAudio"), SOUNDSYSTEM_COREAUDIO); - ui.winfwChkBox->hide(); -#else - ui.sndSysBox->addItem(tr("Advanced Linux Sound Architecture (ALSA)"), SOUNDSYSTEM_ALSA); - ui.sndSysBox->addItem(tr("PulseAudio"), SOUNDSYSTEM_PULSEAUDIO); - ui.winfwChkBox->hide(); -#endif - connect(ui.sndSysBox, QOverload::of(&QComboBox::currentIndexChanged), - this, &PreferencesDlg::slotSoundSystemChange); + connect(ui.sndSysBox, QOverload::of(&QComboBox::currentIndexChanged), this, [&]() + { + showDevices(SoundSystem(ui.sndSysBox->currentData().toInt())); + }); connect(ui.inputdevBox, QOverload::of(&QComboBox::currentIndexChanged), this, &PreferencesDlg::slotSoundInputChange); connect(ui.outputdevBox, QOverload::of(&QComboBox::currentIndexChanged), @@ -308,10 +297,6 @@ void PreferencesDlg::showDevices(SoundSystem snd) ui.inputdevBox->clear(); ui.outputdevBox->clear(); - int comboIndex = ui.sndSysBox->findData(snd); - if(comboIndex>=0) - ui.sndSysBox->setCurrentIndex(comboIndex); - SoundDevice dev; int devid; QString uid; @@ -537,6 +522,8 @@ void PreferencesDlg::initConnectionTab() QString appPath = QApplication::applicationFilePath(); appPath = QDir::toNativeSeparators(appPath); ui.winfwChkBox->setChecked(TT_Firewall_AppExceptionExists(_W(appPath))); +#else + ui.winfwChkBox->hide(); #endif ui.subusermsgChkBox->setChecked(ttSettings->value(SETTINGS_CONNECTION_SUBSCRIBE_USERMSG, SETTINGS_CONNECTION_SUBSCRIBE_USERMSG_DEFAULT).toBool()); ui.subchanmsgChkBox->setChecked(ttSettings->value(SETTINGS_CONNECTION_SUBSCRIBE_CHANNELMSG, SETTINGS_CONNECTION_SUBSCRIBE_CHANNELMSG_DEFAULT).toBool()); @@ -551,6 +538,22 @@ void PreferencesDlg::initConnectionTab() void PreferencesDlg::initSoundSystemTab() { + ui.sndSysBox->clear(); +#if defined(Q_OS_WIN32) + ui.sndSysBox->addItem(tr("Windows Audio Session API (WASAPI)"), SOUNDSYSTEM_WASAPI); + ui.sndSysBox->addItem(tr("DirectSound"), SOUNDSYSTEM_DSOUND); + ui.sndSysBox->addItem(tr("Windows legacy audio system"), SOUNDSYSTEM_WINMM); +#elif defined(Q_OS_DARWIN) + ui.sndSysBox->addItem(tr("CoreAudio"), SOUNDSYSTEM_COREAUDIO); + ui.winfwChkBox->hide(); +#else + ui.sndSysBox->addItem(tr("Advanced Linux Sound Architecture (ALSA)"), SOUNDSYSTEM_ALSA); + ui.sndSysBox->addItem(tr("PulseAudio"), SOUNDSYSTEM_PULSEAUDIO); + ui.winfwChkBox->hide(); +#endif + int comboIndex = ui.sndSysBox->findData(SoundSystem(ttSettings->value(SETTINGS_SOUND_SOUNDSYSTEM, SOUNDSYSTEM_NONE).toInt())); + if(comboIndex>=0) + ui.sndSysBox->setCurrentIndex(comboIndex); initDevices(); ui.mediavsvoiceSlider->setValue(ttSettings->value(SETTINGS_SOUND_MEDIASTREAM_VOLUME, SETTINGS_SOUND_MEDIASTREAM_VOLUME_DEFAULT).toInt()); @@ -1134,11 +1137,6 @@ void PreferencesDlg::slotDesktopAccess() dlg.exec(); } -void PreferencesDlg::slotSoundSystemChange() -{ - showDevices(getSoundSystem()); -} - void PreferencesDlg::slotSoundInputChange(int index) { int channels = 0; diff --git a/Client/qtTeamTalk/preferencesdlg.h b/Client/qtTeamTalk/preferencesdlg.h index 1c8d7db34..4e93b10d3 100644 --- a/Client/qtTeamTalk/preferencesdlg.h +++ b/Client/qtTeamTalk/preferencesdlg.h @@ -81,7 +81,6 @@ class PreferencesDlg : public QDialog SoundSystem getSoundSystem(); void showDevices(SoundSystem snd); QVector m_sounddevices; - void slotSoundSystemChange(); void slotSoundInputChange(int index); void slotSoundOutputChange(int index); void slotSoundRestart();