From 3909a06fe6786027c83e3adaef89c343cde4fbe3 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Sun, 17 May 2026 23:38:18 -0400 Subject: ALSA backend, backend switcher, UX fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/ui/alsa/alsapopup.cpp | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/ui/alsa/alsapopup.cpp (limited to 'src/ui/alsa/alsapopup.cpp') diff --git a/src/ui/alsa/alsapopup.cpp b/src/ui/alsa/alsapopup.cpp new file mode 100644 index 0000000..0a6269d --- /dev/null +++ b/src/ui/alsa/alsapopup.cpp @@ -0,0 +1,79 @@ +#include "alsapopup.h" +#include "alsadevicewidget.h" +#include "../../model/alsamodel.h" +#include "../../model/alsadevice.h" + +#include +#include +#include +#include +#include +#include + +AlsaPopup::AlsaPopup( AlsaModel *model, TQWidget *parent ) + : TQWidget( parent, "AlsaPopup", + WStyle_Customize | WType_Popup | WStyle_DialogBorder ), + m_model(model), m_container(0), m_widget(0) +{ + TQVBoxLayout *outer = new TQVBoxLayout( this, 4, 0 ); + m_container = new TQWidget( this ); + outer->addWidget( m_container ); + + connect( model, TQ_SIGNAL(deviceAdded(AlsaDevice*)), this, TQ_SLOT(rebuild()) ); + connect( model, TQ_SIGNAL(preferredOutputChanged(AlsaDevice*)), this, TQ_SLOT(rebuild()) ); + + rebuild(); +} + +void AlsaPopup::rebuild() +{ + delete m_container->layout(); + if ( m_widget ) { delete m_widget; m_widget = 0; } + + TQVBoxLayout *vbox = new TQVBoxLayout( m_container, 4, 0 ); + AlsaDevice *dev = m_model->preferredOutput(); + if ( dev ) { + m_widget = new AlsaDeviceWidget( dev, m_container ); + vbox->addWidget( m_widget ); + m_widget->show(); + } else { + vbox->addWidget( new TQLabel( i18n("No output device."), m_container ) ); + } + + if ( isVisible() ) + adjustSize(); +} + +void AlsaPopup::toggleAt( const TQPoint &trayPos, const TQSize &traySize ) +{ + if ( isVisible() ) { hide(); return; } + + rebuild(); + adjustSize(); + + TQRect screen = TQApplication::desktop()->screenGeometry( trayPos ); + int x = trayPos.x() + traySize.width() / 2 - width() / 2; + int y = trayPos.y() - height(); + if ( y < screen.top() ) y = trayPos.y() + traySize.height(); + if ( x + width() > screen.right() ) x = screen.right() - width(); + if ( x < screen.left() ) x = screen.left(); + + move( x, y ); + show(); + + KWin::setState( winId(), NET::KeepAbove | NET::SkipTaskbar | NET::SkipPager ); + KWin::setOnAllDesktops( winId(), true ); +} + +bool AlsaPopup::justHidden() const +{ + return m_hideTime.isValid() && m_hideTime.elapsed() < 100; +} + +void AlsaPopup::hideEvent( TQHideEvent *e ) +{ + TQWidget::hideEvent( e ); + m_hideTime.start(); +} + +#include "alsapopup.moc" -- cgit v1.2.3