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( "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(),

@ -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 );

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

@ -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

@ -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);

@ -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:");

@ -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;

Loading…
Cancel
Save