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 244f76de8d)
pull/20/head
Michele Calgaro 5 years ago
parent 86691144d6
commit 9859df0541
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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( "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" ); (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(), m_globalAccel->insert( "Increase volume", i18n( "Increase Volume of Master Channel"), TQString(),
TDEShortcut(TQString("XF86AudioRaiseVolume")), TDEShortcut(TQString("XF86AudioRaiseVolume")), TQT_TQOBJECT(this), TQT_SLOT( increaseVolume() ) ); TDEShortcut(TQString("XF86AudioRaiseVolume")), TDEShortcut(TQString("XF86AudioRaiseVolume")), TQT_TQOBJECT(this), TQT_SLOT( increaseVolume() ) );
m_globalAccel->insert( "Decrease volume", i18n( "Decrease Volume of Master Channel"), TQString(), m_globalAccel->insert( "Decrease volume", i18n( "Decrease Volume of Master Channel"), TQString(),

@ -102,8 +102,7 @@ void KMixDockWidget::createActions()
} }
void void KMixDockWidget::createMasterVolWidget()
KMixDockWidget::createMasterVolWidget()
{ {
// Reset flags, so that the dock icon will be reconstructed // Reset flags, so that the dock icon will be reconstructed
_oldToolTipValue = -1; _oldToolTipValue = -1;
@ -117,6 +116,11 @@ KMixDockWidget::createMasterVolWidget()
return; return;
} }
// create devices // 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 = new ViewDockAreaPopup(0, "dockArea", m_mixer, 0, this);
_dockAreaPopup->createDeviceWidgets(); _dockAreaPopup->createDeviceWidgets();
@ -134,9 +138,22 @@ KMixDockWidget::createMasterVolWidget()
* Refreshing the Icon * 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(setVolumeTip() ) ); connect(m_mixer, TQT_SIGNAL(newVolumeLevels()), TQT_TQOBJECT(this), TQT_SLOT(slotUpdatePixmap()));
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() 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; kdError(67100) << "KMixDockWidget::createPage(): Invalid Mixer (soundcard_id=" << soundcard_id << ")" << endl;
return; // can not happen return; // can not happen
} }
deleteMasterVolWidget();
m_mixer = mixer; m_mixer = mixer;
Mixer::setMasterCard(mixer->id()); // We must save this information "somewhere". Mixer::setMasterCard(mixer->id()); // We must save this information "somewhere".
Mixer::setMasterCardDevice( channel_id ); Mixer::setMasterCardDevice( channel_id );

@ -62,6 +62,7 @@ class KMixDockWidget : public KSystemTray {
protected: protected:
void createMasterVolWidget(); void createMasterVolWidget();
void deleteMasterVolWidget();
void createActions(); void createActions();
void mousePressEvent(TQMouseEvent *); void mousePressEvent(TQMouseEvent *);
void mouseReleaseEvent(TQMouseEvent *); void mouseReleaseEvent(TQMouseEvent *);

@ -372,7 +372,7 @@ TQString& Mixer::id()
return _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 // 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). // 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 ); 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 // @dcop only

@ -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 /// 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). /// 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. /// 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(); static Mixer* masterCard();
/// The global Master Device inside the current MasterCard (as returned by masterCard()). /// The global Master Device inside the current MasterCard (as returned by masterCard()).
static void setMasterCardDevice(TQString& ref_id); static void setMasterCardDevice(TQString& ref_id);

@ -213,13 +213,25 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
} // loop over sound card devices of current driver } // loop over sound card devices of current driver
} // loop over soundcard drivers } // 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 // We have no master card yet. This actually only happens when there was
// not one defined in the kmixrc. // not one defined in the kmixrc.
// So lets just set the first card as master card. // So lets just set the first card as master card.
if ( Mixer::mixers().count() > 0 ) { if (Mixer::mixers().count() > 0)
Mixer::setMasterCard( Mixer::mixers().first()->id()); {
} 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:"); ref_hwInfoString = i18n("Sound drivers supported:");

@ -130,14 +130,14 @@ TQWidget* ViewDockAreaPopup::add(MixDevice *md)
Qt::Vertical, // Direction: only 1 device, so doesn't matter Qt::Vertical, // Direction: only 1 device, so doesn't matter
_frame, // parent _frame, // parent
0, // Is "NULL", so that there is no RMB-popup 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, 2 );
_layoutMDW->addItem( new TQSpacerItem( 5, 20 ), 0, 0 ); _layoutMDW->addItem( new TQSpacerItem( 5, 20 ), 0, 0 );
_layoutMDW->addWidget( _mdw, 0, 1 ); _layoutMDW->addWidget( _mdw, 0, 1 );
// Add button to show main panel // Add button to show main panel
_showPanelBox = new TQPushButton( i18n("Mixer"), _frame, "MixerPanel" ); _showPanelBox = new TQPushButton( i18n("Mixer"), _frame, "MixerPanel" );
connect ( _showPanelBox, TQT_SIGNAL( clicked() ), TQT_SLOT( showPanelSlot() ) ); connect ( _showPanelBox, TQT_SIGNAL( clicked() ), TQT_SLOT( showPanelSlot() ) );
_layoutMDW->addMultiCellWidget( _showPanelBox, 1, 1, 0, 2 ); _layoutMDW->addMultiCellWidget( _showPanelBox, 1, 1, 0, 2 );
return _mdw; return _mdw;

Loading…
Cancel
Save