diff options
Diffstat (limited to 'kmix/kmixdockwidget.cpp')
-rw-r--r-- | kmix/kmixdockwidget.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/kmix/kmixdockwidget.cpp b/kmix/kmixdockwidget.cpp index 1402191c..2c21eb50 100644 --- a/kmix/kmixdockwidget.cpp +++ b/kmix/kmixdockwidget.cpp @@ -102,8 +102,7 @@ void KMixDockWidget::createActions() } -void -KMixDockWidget::createMasterVolWidget() +void KMixDockWidget::createMasterVolWidget() { // Reset flags, so that the dock icon will be reconstructed _oldToolTipValue = -1; @@ -117,6 +116,11 @@ KMixDockWidget::createMasterVolWidget() return; } // create devices + if (_dockAreaPopup) + { + // Delete the old popup widget if we are changing the channel + deleteMasterVolWidget(); + } _dockAreaPopup = new ViewDockAreaPopup(0, "dockArea", m_mixer, 0, this); _dockAreaPopup->createDeviceWidgets(); @@ -134,9 +138,22 @@ KMixDockWidget::createMasterVolWidget() * Refreshing the Icon * */ - // connect( m_mixer, TQT_SIGNAL(newVolumeLevels()), _dockAreaPopup, TQT_SLOT(refreshVolumeLevels()) ); - connect( m_mixer, TQT_SIGNAL(newVolumeLevels()), TQT_TQOBJECT(this), TQT_SLOT(setVolumeTip() ) ); - connect( m_mixer, TQT_SIGNAL(newVolumeLevels()), TQT_TQOBJECT(this), TQT_SLOT(slotUpdatePixmap() ) ); + connect(m_mixer, TQT_SIGNAL(newVolumeLevels()), TQT_TQOBJECT(this), TQT_SLOT(setVolumeTip())); + connect(m_mixer, TQT_SIGNAL(newVolumeLevels()), TQT_TQOBJECT(this), TQT_SLOT(slotUpdatePixmap())); +} + +void KMixDockWidget::deleteMasterVolWidget() +{ + if (_dockAreaPopup) + { + delete _dockAreaPopup; + _dockAreaPopup = NULL; + } + if (m_mixer) + { + disconnect(m_mixer, TQT_SIGNAL(newVolumeLevels()), TQT_TQOBJECT(this), TQT_SLOT(setVolumeTip())); + disconnect(m_mixer, TQT_SIGNAL(newVolumeLevels()), TQT_TQOBJECT(this), TQT_SLOT(slotUpdatePixmap())); + } } void KMixDockWidget::slotUpdatePixmap() @@ -161,6 +178,7 @@ void KMixDockWidget::handleNewMaster(int soundcard_id, TQString& channel_id) // kdError(67100) << "KMixDockWidget::createPage(): Invalid Mixer (soundcard_id=" << soundcard_id << ")" << endl; return; // can not happen } + deleteMasterVolWidget(); m_mixer = mixer; Mixer::setMasterCard(mixer->id()); // We must save this information "somewhere". Mixer::setMasterCardDevice( channel_id ); |