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:24:32 +0900 |
commit | 244f76de8db33b6d659c91ca9424d8556f2f20eb (patch) | |
tree | c4931d8d863c5a1ddad1244e238f641640c8ad0e /kmix | |
parent | 2251b3395ac880f0b24db47615bf21ed97ec69f3 (diff) | |
download | tdemultimedia-244f76de8db33b6d659c91ca9424d8556f2f20eb.tar.gz tdemultimedia-244f76de8db33b6d659c91ca9424d8556f2f20eb.zip |
KMix: fixed update of tray volume icon when muting/unmuting the selected
channel.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
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 98548db9..5bee4585 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 42ccccaa..1900f184 100644 --- a/kmix/kmixdockwidget.cpp +++ b/kmix/kmixdockwidget.cpp @@ -107,8 +107,7 @@ void KMixDockWidget::createActions() } -void -KMixDockWidget::createMasterVolWidget() +void KMixDockWidget::createMasterVolWidget() { // Reset flags, so that the dock icon will be reconstructed _oldToolTipValue = -1; @@ -122,6 +121,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(); @@ -139,9 +143,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() @@ -194,6 +211,7 @@ void KMixDockWidget::handleNewMaster(bool defaultMaster, int soundcard_id, const << soundcard_id << ", channel_id=" << channel_id << ")" << endl; return; // can not happen } + deleteMasterVolWidget(); m_mixer = mixer; Mixer::setMasterCard(mixer->id()); // We must save this information "somewhere". Mixer::setMasterCardDevice(channel); diff --git a/kmix/kmixdockwidget.h b/kmix/kmixdockwidget.h index 6be2b4b7..47e44b99 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 bda80910..46e4e138 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). @@ -702,7 +702,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 2fc44a85..80610c59 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(const 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; |