summaryrefslogtreecommitdiffstats
path: root/kmix/dialogselectmaster.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmix/dialogselectmaster.cpp')
-rw-r--r--kmix/dialogselectmaster.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/kmix/dialogselectmaster.cpp b/kmix/dialogselectmaster.cpp
index 06b8d22c..7dbd9d13 100644
--- a/kmix/dialogselectmaster.cpp
+++ b/kmix/dialogselectmaster.cpp
@@ -38,7 +38,7 @@
#include "mixdevice.h"
#include "mixer.h"
-DialogSelectMaster::DialogSelectMaster( Mixer *mixer )
+DialogSelectMaster::DialogSelectMaster(Mixer *mixer)
: KDialogBase( Plain, i18n( "Select Master Channel" ), Ok|Cancel, Ok )
{
_layout = 0;
@@ -69,8 +69,8 @@ void DialogSelectMaster::createWidgets(Mixer *ptr_mixer)
m_vboxChannels = new TQVBox(m_mainFrame);
_layout->add(m_vboxChannels);
- if ( Mixer::mixers().count() > 1 ) {
- //kdDebug(67100) << "DialogSelectMaster::createPage count()>1" << "\n";
+ if (Mixer::mixers().count() > 1) {
+ //kdDebug(67100) << "DialogSelectMaster::createWidgets count()>1" << "\n";
// More than one Mixer => show Combo-Box to select Mixer
// Mixer widget line
TQHBox *hboxMixerName = new TQHBox(m_vboxChannels);
@@ -84,19 +84,12 @@ void DialogSelectMaster::createWidgets(Mixer *ptr_mixer)
TQToolTip::add(m_cMixer, i18n("Current mixer"));
connect(m_cMixer, TQT_SIGNAL(activated(int)), this, TQT_SLOT(createPageByID(int)));
- //int id=1;
for ( Mixer *mixer = Mixer::mixers().first(); mixer !=0; mixer = Mixer::mixers().next() ) {
- m_cMixer->insertItem( mixer->mixerName() );
- if ( ptr_mixer == mixer ) {
- // Make the current Mixer the current item in the ComboBos
- m_cMixer->setCurrentItem( m_cMixer->count()-1 );
- }
- //id++;
- } // end for all_Mixers
- } // end if (more_than_1_Mixer)
+ m_cMixer->insertItem(mixer->mixerName());
+ }
+ }
TQLabel *qlbl = new TQLabel( i18n("Select the channel representing the master volume:"), m_vboxChannels );
- _layout->addWidget(qlbl);
m_scrollableChannelSelector = new TQScrollView(m_vboxChannels, "scrollableChannelSelector");
m_scrollableChannelSelector->viewport()->setBackgroundMode(TQt::PaletteBackground);
@@ -104,8 +97,11 @@ void DialogSelectMaster::createWidgets(Mixer *ptr_mixer)
m_buttonGroupForScrollView = new TQButtonGroup(this); // invisible TQButtonGroup
m_buttonGroupForScrollView->hide();
- createPage(ptr_mixer);
+ connect( this, TQT_SIGNAL(okClicked()) , this, TQT_SLOT(apply()) );
+}
+void DialogSelectMaster::show(Mixer *curr_mixer)
+{
kapp->config()->setGroup(0);
bool useDefaultMaster = kapp->config()->readBoolEntry("UseDefaultMaster", true);
if (useDefaultMaster)
@@ -118,7 +114,16 @@ void DialogSelectMaster::createWidgets(Mixer *ptr_mixer)
}
masterSelectionChanged(0);
- connect( this, TQT_SIGNAL(okClicked()) , this, TQT_SLOT(apply()) );
+ for (Mixer *mixer = Mixer::mixers().first(); mixer; mixer = Mixer::mixers().next())
+ {
+ if (curr_mixer == mixer)
+ {
+ m_cMixer->setCurrentItem(mixer->mixerName());
+ }
+ }
+ createPage(curr_mixer);
+
+ KDialog::show();
}
void DialogSelectMaster::masterSelectionChanged(int _unused)
@@ -132,9 +137,10 @@ void DialogSelectMaster::masterSelectionChanged(int _unused)
*/
void DialogSelectMaster::createPageByID(int mixerId)
{
- //kdDebug(67100) << "DialogSelectMaster::createPage()" << endl;
+ //kdDebug(67100) << "DialogSelectMaster::createPageByID()" << endl;
Mixer *mixer = Mixer::mixers().at(mixerId);
- if ( mixer == 0 ) {
+ if (!mixer)
+ {
kdError(67100) << "DialogSelectMaster::createPage(): Invalid Mixer (mixerID=" << mixerId << ")" << endl;
return; // can not happen
}
@@ -145,7 +151,7 @@ void DialogSelectMaster::createPageByID(int mixerId)
* Create RadioButton's for the Mixer with number 'mixerId'.
* @par mixerId The Mixer, for which the RadioButton's should be created.
*/
-void DialogSelectMaster::createPage(Mixer* mixer)
+void DialogSelectMaster::createPage(Mixer *mixer)
{
/** --- Reset page -----------------------------------------------
@@ -186,7 +192,7 @@ void DialogSelectMaster::createPage(Mixer* mixer)
}
}
- m_vboxForScrollView->show(); // show() is neccesary starting with the second call to createPage()
+ m_vboxForScrollView->show(); // show() is necessary starting with the second call to createPage()
}
@@ -202,7 +208,7 @@ void DialogSelectMaster::apply()
//kdDebug(67100) << "DialogSelectMaster::apply(): default master=" << m_defaultMaster->isChecked() << ", card=" << soundcard_id << ", channel=" << channel_id << endl;
Mixer *mixer = Mixer::mixers().at(soundcard_id);
if ( mixer == 0 ) {
- kdError(67100) << "DialogSelectMaster::createPage(): Invalid Mixer (mixerID=" << soundcard_id << ")" << endl;
+ kdError(67100) << "DialogSelectMaster::apply(): Invalid Mixer (mixerID=" << soundcard_id << ")" << endl;
return; // can not happen
}
else {