summaryrefslogtreecommitdiff
path: root/src/ui/tmixtray.cpp
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-22 10:16:15 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-22 10:16:15 -0400
commitcdf72828e599a63fca4a0f1ceeb3145fba581aa3 (patch)
tree16ee02f0ce1e317a09fd4c2a3f9fbdc04aadfe60 /src/ui/tmixtray.cpp
parentb30b234afa3ec18156e432b9f2a7ad2ca80cc672 (diff)
parentd9876849f0208291cc7010522e85593703ff52bd (diff)
Merge branch 'and-the-oss-you-rode-in-on'
Diffstat (limited to 'src/ui/tmixtray.cpp')
-rw-r--r--src/ui/tmixtray.cpp61
1 files changed, 39 insertions, 22 deletions
diff --git a/src/ui/tmixtray.cpp b/src/ui/tmixtray.cpp
index c9aed4e..db04de1 100644
--- a/src/ui/tmixtray.cpp
+++ b/src/ui/tmixtray.cpp
@@ -14,7 +14,7 @@ protected:
m_owner->toggleRecordingPopup();
e->accept();
} else {
- KSystemTray::mousePressEvent( e );
+ e->accept();
}
}
private:
@@ -68,13 +68,15 @@ void TmixTray::setDevice( AudioDevice *dev )
void TmixTray::setModel( PulseModel *model )
{
m_model = model;
- TQPtrList<AudioDevice> inputs = model->devices( AudioDevice::Input );
- for ( TQPtrListIterator<AudioDevice> it(inputs); *it; ++it ) {
- connect( *it, TQ_SIGNAL(recordingActiveChanged(bool)),
- this, TQ_SLOT(onRecordingActive(bool)) );
- }
connect( model, TQ_SIGNAL(deviceAdded(AudioDevice*)),
this, TQ_SLOT(onDeviceAdded(AudioDevice*)) );
+ connect( model, TQ_SIGNAL(deviceRemoved(AudioDevice*)),
+ this, TQ_SLOT(onDeviceRemoved(AudioDevice*)) );
+ // Count any Recording devices already present (e.g. after reconnect).
+ TQPtrList<AudioDevice> recs = model->devices( AudioDevice::Recording );
+ for ( TQPtrListIterator<AudioDevice> it(recs); *it; ++it )
+ m_recordingCount++;
+ updateRecordingTray();
}
void TmixTray::mousePressEvent( TQMouseEvent *e )
@@ -85,6 +87,15 @@ void TmixTray::mousePressEvent( TQMouseEvent *e )
e->accept();
return;
}
+ if ( e->button() == TQt::MidButton && m_device ) {
+ TDEConfig *cfg = TDEGlobal::config();
+ cfg->setGroup("Tray");
+ if ( cfg->readBoolEntry("MiddleClickMute", false) ) {
+ m_device->setMuted( !m_device->muted() );
+ e->accept();
+ return;
+ }
+ }
KSystemTray::mousePressEvent( e );
}
@@ -92,7 +103,7 @@ void TmixTray::mousePressEvent( TQMouseEvent *e )
void TmixTray::executeSingleClick()
{
TDEConfig *cfg = TDEGlobal::config();
- cfg->setGroup("General");
+ cfg->setGroup("Tray");
int mode = cfg->readNumEntry( "PopupMode", 1 );
bool showOutput = cfg->readBoolEntry("PopupShowOutput", true );
bool showMic = cfg->readBoolEntry("PopupShowMic", false );
@@ -141,24 +152,33 @@ void TmixTray::updateIcon()
setPixmap( TQPixmap(path) );
}
-void TmixTray::onRecordingActive( bool active )
+void TmixTray::onRecordingActive( bool /*active*/ )
{
- m_recordingCount += active ? 1 : -1;
- if ( m_recordingCount < 0 ) m_recordingCount = 0;
- updateRecordingTray();
+ // Kept for any future per-source signal use; recording count is now
+ // driven by onDeviceAdded/onDeviceRemoved for Recording devices.
}
void TmixTray::onDeviceAdded( AudioDevice *dev )
{
- if ( dev->category() == AudioDevice::Input )
- connect( dev, TQ_SIGNAL(recordingActiveChanged(bool)),
- this, TQ_SLOT(onRecordingActive(bool)) );
+ if ( dev->category() == AudioDevice::Recording ) {
+ m_recordingCount++;
+ updateRecordingTray();
+ }
+}
+
+void TmixTray::onDeviceRemoved( AudioDevice *dev )
+{
+ if ( dev->category() == AudioDevice::Recording ) {
+ if ( m_recordingCount > 0 )
+ m_recordingCount--;
+ updateRecordingTray();
+ }
}
void TmixTray::updateRecordingTray()
{
TDEConfig *cfg = TDEGlobal::config();
- cfg->setGroup("General");
+ cfg->setGroup("Tray");
bool showRec = cfg->readBoolEntry("ShowRecordingTray", true);
if ( m_recordingCount > 0 && showRec ) {
@@ -213,7 +233,7 @@ void TmixTray::wheelEvent( TQWheelEvent *e )
{
if ( !m_device ) return;
TDEConfig *cfg = TDEGlobal::config();
- cfg->setGroup("General");
+ cfg->setGroup("Tray");
int step = cfg->readNumEntry("ScrollStep", 5);
int delta = e->delta() > 0 ? step : -step;
int newVol = m_device->volume() + delta;
@@ -229,12 +249,9 @@ void TmixTray::contextMenuAboutToShow( TDEPopupMenu *menu )
MixerWindow *win = static_cast<MixerWindow*>( parentWidget() );
- TDEConfig *cfg = TDEGlobal::config();
- cfg->setGroup("General");
- if ( cfg->readNumEntry("PopupMode", 1) >= 1 )
- menu->insertItem( SmallIcon("tmix"), i18n("&Open Mixer"),
- win, TQ_SLOT(bringToFront()) );
-
+ menu->insertItem( SmallIcon("tmix"), i18n("&Open Mixer"),
+ win, TQ_SLOT(bringToFront()) );
+ menu->insertSeparator();
menu->insertItem( SmallIcon("configure"), i18n("&Configure TMix..."),
win, TQ_SLOT(showPreferences()) );
menu->insertItem( SmallIcon("help"), i18n("&About TMix"),