diff --git a/src/gui/qt/ConfigurationPanel.ui b/src/gui/qt/ConfigurationPanel.ui index 2f7db9b3449865e73cf516dbf4678dd2e5bc9fb6..450a9c82e4d09350fe264d77776be70678dfc12b 100644 --- a/src/gui/qt/ConfigurationPanel.ui +++ b/src/gui/qt/ConfigurationPanel.ui @@ -749,11 +749,18 @@ <widget class="QVButtonGroup"> <property name="name"><cstring>DriverChoice</cstring></property> <property name="title"><string>Driver for Speaker</string></property> + <widget class="QComboBox"> + <property name="name"><cstring>cboDriverChoiceOut</cstring></property> + </widget> </widget> <widget class="QVButtonGroup"> <property name="name"><cstring>DriverChoiceIn</cstring></property> <property name="title"><string>Driver for Microphone</string></property> - </widget> + <widget class="QComboBox"> + <property name="name"><cstring>cboDriverChoiceIn</cstring></property> + </widget> + </widget> + <widget class="QLayoutWidget"> <property name="name"><cstring>layoutforsounddriver</cstring></property> <hbox> @@ -1426,18 +1433,6 @@ Montreal, Quebec H2T 1S6</p></string> <receiver>ConfigurationPanel</receiver> <slot>slotRegister()</slot> </connection> - <connection> - <sender>DriverChoice</sender> - <signal>clicked(int)</signal> - <receiver>ConfigurationPanel</receiver> - <slot>driverSlot(int)</slot> - </connection> - <connection> - <sender>DriverChoiceIn</sender> - <signal>clicked(int)</signal> - <receiver>ConfigurationPanel</receiver> - <slot>driverSlotIn(int)</slot> - </connection> <connection> <sender>buttonTestSoundDriver</sender> <signal>clicked()</signal> @@ -1495,6 +1490,8 @@ Montreal, Quebec H2T 1S6</p></string> <tabstop>sendDTMFas</tabstop> <tabstop>Menu</tabstop> <tabstop>Tab_Audio</tabstop> + <tabstop>cboDriverChoiceOut</tabstop> + <tabstop>cboDriverChoiceIn</tabstop> <tabstop>buttonTestSoundDriver</tabstop> <tabstop>codec1</tabstop> <tabstop>codec2</tabstop> @@ -1520,8 +1517,6 @@ Montreal, Quebec H2T 1S6</p></string> <slot>changeTabSlot()</slot> <slot>useStunSlot( int id )</slot> <slot>applySkinSlot()</slot> - <slot>driverSlot( int id )</slot> - <slot>driverSlotIn( int id )</slot> <slot>updateSkins()</slot> <slot>updateRingtones()</slot> <slot>updateCodecs()</slot> diff --git a/src/gui/qt/ConfigurationPanel.ui.h b/src/gui/qt/ConfigurationPanel.ui.h index 0e81493e93992131e0337c35b8db9963a4b21ea4..743f77e2321e9ea73adc1dbd6be793f010d7d5e0 100644 --- a/src/gui/qt/ConfigurationPanel.ui.h +++ b/src/gui/qt/ConfigurationPanel.ui.h @@ -162,19 +162,8 @@ ConfigurationPanel::generate() .get(SIGNALISATION_SECTION, SIGNALISATION_PULSE_LENGTH).toUInt()); - QRadioButton* device = - static_cast< QRadioButton * >(DriverChoice->find(ConfigurationManager::instance() - .get(AUDIO_SECTION, - AUDIO_DEFAULT_DEVICEOUT).toUInt())); - if(device) { - device->setChecked(true); - } - - device = static_cast< QRadioButton * >(DriverChoiceIn->find(ConfigurationManager::instance() - .get(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEIN).toUInt())); - if (device) { - device->setChecked(true); - } + cboDriverChoiceOut->setCurrentItem(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEOUT).toUInt()); + cboDriverChoiceIn->setCurrentItem(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEIN).toUInt()); //preference tab updateSkins(); @@ -228,10 +217,15 @@ void ConfigurationPanel::saveSlot() if (codec3->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_CODEC3, codec3->currentText()); } - if (ringsChoice->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_RINGTONE, ringsChoice->currentText()); } + if (cboDriverChoiceOut->currentText() != NULL) { + ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEOUT, QString::number(cboDriverChoiceOut->currentItem())); + } + if (cboDriverChoiceIn->currentText() != NULL) { + ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEIN, QString::number(cboDriverChoiceIn->currentItem())); + } SkinManager::instance().load(SkinChoice->currentText()); SkinManager::instance().save(); @@ -297,24 +291,6 @@ void ConfigurationPanel::applySkinSlot() } -void ConfigurationPanel::driverSlot(int id) -{ - ConfigurationManager::instance().set(AUDIO_SECTION, - AUDIO_DEFAULT_DEVICEOUT, - QString::number(id)); - lblSoundDriver->setPaletteForegroundColor(black); - lblSoundDriver->setText(tr("Not tested")); -} - -void ConfigurationPanel::driverSlotIn(int id) -{ - ConfigurationManager::instance().set(AUDIO_SECTION, - AUDIO_DEFAULT_DEVICEIN, - QString::number(id)); - lblSoundDriver->setPaletteForegroundColor(black); - lblSoundDriver->setText(tr("Not tested")); -} - void ConfigurationPanel::updateSkins() { SkinChoice->clear(); @@ -352,46 +328,21 @@ void ConfigurationPanel::updateCodecs() void ConfigurationPanel::updateAudioDevicesIn() { - static std::list< QRadioButton * > buttonsIn; - while(buttonsIn.begin() != buttonsIn.end()) { - DriverChoiceIn->remove(*buttonsIn.begin()); - buttonsIn.pop_front(); - } - int top = 0; - - //In + QComboBox* cbo = cboDriverChoiceIn; std::list< AudioDevice > audio = ConfigurationManager::instance().getAudioDevicesIn(); std::list< AudioDevice >::iterator pos; - + cbo->clear(); + for (pos = audio.begin(); pos != audio.end(); pos++) { QString hostApiName = pos->hostApiName; QString deviceName = pos->deviceName; - QString name = hostApiName + - QObject::tr(" (device #%1)").arg(pos->index); - - // New radio button with found device name - QRadioButton* device = new QRadioButton(DriverChoiceIn); - buttonsIn.push_back(device); - DriverChoiceIn->insert(device, pos->index.toUInt()); - //device->setGeometry( QRect( 10, 30 + top, 360, 21 ) ); - // Set label of radio button - //device->setText(deviceName); - // Add tooltip for each one - QString text = deviceName + " " + name; - - if(text.length() > 50) { - device->setText(text.left(50) + "..."); - } - else { - device->setText(text); + QString name = hostApiName + QObject::tr(" (device #%1)").arg(pos->index); + if (name.length() > 50) { + name = name.left(50) + "..."; } - - QToolTip::add(device, text); - top += 30; + cbo->insertItem(name); } - // Set position of the button group, with appropriate length - //DriverChoiceIn->setGeometry( QRect( 10, 200, 410, top + 30 ) ); } void ConfigurationPanel::updateAudioDevicesOut() @@ -401,50 +352,21 @@ void ConfigurationPanel::updateAudioDevicesOut() void ConfigurationPanel::updateAudioDevices() { - static std::list< QRadioButton * > buttons; - - while(buttons.begin() != buttons.end()) { - DriverChoice->remove(*buttons.begin()); - buttons.pop_front(); - } - - int top = 0; + QComboBox* cbo = cboDriverChoiceOut; std::list< AudioDevice > audio = ConfigurationManager::instance().getAudioDevicesOut(); std::list< AudioDevice >::iterator pos; - + cbo->clear(); + for (pos = audio.begin(); pos != audio.end(); pos++) { QString hostApiName = pos->hostApiName; QString deviceName = pos->deviceName; - QString name = hostApiName + - QObject::tr(" (device #%1)").arg(pos->index); - - // New radio button with found device name - QRadioButton* device = new QRadioButton(DriverChoice); - buttons.push_back(device); - DriverChoice->insert(device, pos->index.toUInt()); - //device->setGeometry( QRect( 10, 30 + top, 360, 21 ) ); - // Set label of radio button - //device->setText(deviceName); - // Add tooltip for each one - QString text = deviceName + " " + name; - - if(text.length() > 50) { - device->setText(text.left(50) + "..."); + QString name = hostApiName + QObject::tr(" (device #%1)").arg(pos->index); + if (name.length() > 50) { + name = name.left(50) + "..."; } - else { - device->setText(text); - } - - QToolTip::add(device, text); - - - top += 30; + cbo->insertItem(name); } - - // Set position of the button group, with appropriate length - //DriverChoice->setGeometry( QRect( 10, 10, 410, top + 30 ) ); - } @@ -476,6 +398,15 @@ ConfigurationPanel::slotRegisterReturn( bool hasError, QString ) void ConfigurationPanel::slotTestSoundDriver() { + // save driver in configuration manager + if (cboDriverChoiceOut->currentText() != NULL) { + ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEOUT, QString::number(cboDriverChoiceOut->currentItem())); + } + if (cboDriverChoiceIn->currentText() != NULL) { + ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEIN, QString::number(cboDriverChoiceIn->currentItem())); + } + + // save driver on portaudio ConfigurationManager::instance().save(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEOUT); ConfigurationManager::instance().save(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEIN); emit soundDriverChanged();