diff options
| author | Calvin Morrison <calvin@pobox.com> | 2026-05-17 23:38:18 -0400 |
|---|---|---|
| committer | Calvin Morrison <calvin@pobox.com> | 2026-05-17 23:38:18 -0400 |
| commit | 3909a06fe6786027c83e3adaef89c343cde4fbe3 (patch) | |
| tree | f5ea87c98b50764c8ad87e598f274319df0e74db /src/ui/tmixtray.cpp | |
| parent | 311b69c14203860ab6d98bd11633eea287c8f04e (diff) | |
ALSA backend, backend switcher, UX fixesalsa-wip
- ALSA backend: AlsaModel, AlsaDevice, AlsaMixerWindow, AlsaTray, AlsaPopup
- BackendController: live pulse↔alsa switching, preserves window position/visibility
- PA shutdown fix: stop mainloop thread before disconnect/free to prevent crash
- Exit crash fix: BackendController deleted explicitly before TQApplication exits
- Waiting-for-PulseAudio placeholder when PA not connected
- Preferences: live backend stack (Pulse/ALSA), Startup/Exit card with autostart,
Recording card, no-tabs greying, remove stale "requires restart" label
- Recording tray: track source outputs directly; fix LED init in popup;
level meter forwarding for monitor-source recordings via m_monitorSourceToSink
- TmixTray: fix config group General→Tray for scroll/mute/popup settings;
RecordingTray suppresses right-click menu
- audiodevice.h: add recordingActive() virtual accessor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/ui/tmixtray.cpp')
| -rw-r--r-- | src/ui/tmixtray.cpp | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/src/ui/tmixtray.cpp b/src/ui/tmixtray.cpp index f54961f..7603f37 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"), |
