diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-05-17 01:22:02 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-05-25 13:37:28 +0900 |
commit | 9859df0541de6016cacea2032d5fe75e98b53a0b (patch) | |
tree | 4129344a63afb6eb9809f1bb6262748229b9bf8a /kmix | |
parent | 86691144d6ce506dfcb5016dbffda4da3db256fc (diff) | |
download | tdemultimedia-9859df0541de6016cacea2032d5fe75e98b53a0b.tar.gz tdemultimedia-9859df0541de6016cacea2032d5fe75e98b53a0b.zip |
KMix: fixed update of tray volume icon when muting/unmuting the selected
channel.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 244f76de8db33b6d659c91ca9424d8556f2f20eb)
Diffstat (limited to 'kmix')
-rw-r--r-- | kmix/kmix.cpp | 2 | ||||
-rw-r--r-- | kmix/kmixdockwidget.cpp | 28 | ||||
-rw-r--r-- | kmix/kmixdockwidget.h | 1 | ||||
-rw-r--r-- | kmix/mixer.cpp | 9 | ||||
-rw-r--r-- | kmix/mixer.h | 2 | ||||
-rw-r--r-- | kmix/mixertoolbox.cpp | 20 | ||||
-rw-r--r-- | kmix/viewdockareapopup.cpp | 8 |
7 files changed, 53 insertions, 17 deletions
diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp index fc33d671..985c7cd4 100644 --- a/kmix/kmix.cpp +++ b/kmix/kmix.cpp @@ -119,7 +119,7 @@ KMixWindow::initActions() (void) new TDEAction( i18n( "Hardware &Information" ), 0, TQT_TQOBJECT(this), TQT_SLOT( slotHWInfo() ), actionCollection(), "hwinfo" ); (void) new TDEAction( i18n( "Hide Mixer Window" ), Key_Escape, TQT_TQOBJECT(this), TQT_SLOT(hide()), actionCollection(), "hide_kmixwindow" ); - m_globalAccel = new TDEGlobalAccel( TQT_TQOBJECT(this) ); + m_globalAccel = new TDEGlobalAccel(this, "KMix"); m_globalAccel->insert( "Increase volume", i18n( "Increase Volume of Master Channel"), TQString(), TDEShortcut(TQString("XF86AudioRaiseVolume")), TDEShortcut(TQString("XF86AudioRaiseVolume")), TQT_TQOBJECT(this), TQT_SLOT( increaseVolume() ) ); m_globalAccel->insert( "Decrease volume", i18n( "Decrease Volume of Master Channel"), TQString(), 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 ); diff --git a/kmix/kmixdockwidget.h b/kmix/kmixdockwidget.h index 0899d28f..7bb5b9da 100644 --- a/kmix/kmixdockwidget.h +++ b/kmix/kmixdockwidget.h @@ -62,6 +62,7 @@ class KMixDockWidget : public KSystemTray { protected: void createMasterVolWidget(); + void deleteMasterVolWidget(); void createActions(); void mousePressEvent(TQMouseEvent *); void mouseReleaseEvent(TQMouseEvent *); diff --git a/kmix/mixer.cpp b/kmix/mixer.cpp index ba3bfee8..2b48f512 100644 --- a/kmix/mixer.cpp +++ b/kmix/mixer.cpp @@ -372,7 +372,7 @@ TQString& Mixer::id() return _id; } -void Mixer::setMasterCard(TQString& ref_id) +void Mixer::setMasterCard(const TQString& ref_id) { // The value is taken over without checking on existance. This allows the User to define // a MasterCard that is not always available (e.g. it is an USB hotplugging device). @@ -703,7 +703,12 @@ void Mixer::toggleMute( int deviceidx ) mixdev->setMuted( !previousState ); - _mixerBackend->writeVolumeToHW(deviceidx, mixdev->getVolume() ); + _mixerBackend->writeVolumeToHW(deviceidx, mixdev->getVolume()); + + // Muting/unmuting PulseAudio directly does not send back any notification to the mixer + // so we make sure we always update the tray icon after each operation. + readSetFromHWforceUpdate(); + TQTimer::singleShot(50, this, TQT_SLOT(readSetFromHW())); } // @dcop only diff --git a/kmix/mixer.h b/kmix/mixer.h index d9566e81..85b2fe7d 100644 --- a/kmix/mixer.h +++ b/kmix/mixer.h @@ -97,7 +97,7 @@ class Mixer : public TQObject, virtual public MixerIface /// The KMix global master card. Please note that KMix and KMixPanelApplet can have a /// different MasterCard's at the moment (but actually KMixPanelApplet does not read/save this yet). /// At the moment it is only used for selecting the Mixer to use in KMix's DockIcon. - static void setMasterCard(TQString& ref_id); + static void setMasterCard(const TQString& ref_id); static Mixer* masterCard(); /// The global Master Device inside the current MasterCard (as returned by masterCard()). static void setMasterCardDevice(TQString& ref_id); diff --git a/kmix/mixertoolbox.cpp b/kmix/mixertoolbox.cpp index b474eca6..4a19673b 100644 --- a/kmix/mixertoolbox.cpp +++ b/kmix/mixertoolbox.cpp @@ -213,13 +213,25 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS } // loop over sound card devices of current driver } // loop over soundcard drivers - if ( Mixer::masterCard() == 0 ) { + if (Mixer::masterCard() == 0) + { // We have no master card yet. This actually only happens when there was // not one defined in the kmixrc. // So lets just set the first card as master card. - if ( Mixer::mixers().count() > 0 ) { - Mixer::setMasterCard( Mixer::mixers().first()->id()); - } + if (Mixer::mixers().count() > 0) + { + Mixer *mixer = Mixer::mixers().first(); + Mixer::setMasterCard(mixer->id()); + MixSet ms = mixer->getMixSet(); + for (MixDevice *md = ms.first(); md != 0; md = ms.next()) + { + if (!md->isRecordable() && !md->isSwitch() && !md->isEnum()) + { + Mixer::setMasterCardDevice(md->getPK()); + break; + } + } + } } ref_hwInfoString = i18n("Sound drivers supported:"); diff --git a/kmix/viewdockareapopup.cpp b/kmix/viewdockareapopup.cpp index 081aec18..e9cd9155 100644 --- a/kmix/viewdockareapopup.cpp +++ b/kmix/viewdockareapopup.cpp @@ -130,14 +130,14 @@ TQWidget* ViewDockAreaPopup::add(MixDevice *md) Qt::Vertical, // Direction: only 1 device, so doesn't matter _frame, // parent 0, // Is "NULL", so that there is no RMB-popup - _dockDevice->name().latin1() ); + _dockDevice->name().local8Bit()); _layoutMDW->addItem( new TQSpacerItem( 5, 20 ), 0, 2 ); _layoutMDW->addItem( new TQSpacerItem( 5, 20 ), 0, 0 ); _layoutMDW->addWidget( _mdw, 0, 1 ); - // Add button to show main panel - _showPanelBox = new TQPushButton( i18n("Mixer"), _frame, "MixerPanel" ); - connect ( _showPanelBox, TQT_SIGNAL( clicked() ), TQT_SLOT( showPanelSlot() ) ); + // Add button to show main panel + _showPanelBox = new TQPushButton( i18n("Mixer"), _frame, "MixerPanel" ); + connect ( _showPanelBox, TQT_SIGNAL( clicked() ), TQT_SLOT( showPanelSlot() ) ); _layoutMDW->addMultiCellWidget( _showPanelBox, 1, 1, 0, 2 ); return _mdw; |