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/mixerwindow.cpp | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'src/ui/mixerwindow.cpp') diff --git a/src/ui/mixerwindow.cpp b/src/ui/mixerwindow.cpp index d8463f1..12a6666 100644 --- a/src/ui/mixerwindow.cpp +++ b/src/ui/mixerwindow.cpp @@ -4,6 +4,7 @@ #include "../model/pulsemodel.h" #include +#include #include #include #include @@ -54,7 +55,8 @@ static MixerWindow::Tab makeTab( KTabWidget *tabs, const TQString &label ) MixerWindow::MixerWindow( PulseModel *model, TQWidget *parent ) : TDEMainWindow(parent), m_model(model), m_prefsDlg(0), - m_devicesBtn(0), m_devicesPage(0), m_devicesInTabs(false), m_quitting(false) + m_devicesBtn(0), m_devicesPage(0), m_devicesInTabs(false), + m_quitting(false), m_totalDevCount(0), m_waitLabel(0) { setPlainCaption( i18n("Volume Control") ); setIcon( TDEGlobal::iconLoader()->loadIcon( "kmix", TDEIcon::Desktop, 48 ) ); @@ -82,7 +84,7 @@ MixerWindow::MixerWindow( PulseModel *model, TQWidget *parent ) onDefaultOutputChanged( model->defaultOutput() ); TDEConfig *cfg = TDEGlobal::config(); - cfg->setGroup("General"); + cfg->setGroup("Tray"); if ( cfg->readBoolEntry("DockInTray", true) ) m_tray->show(); @@ -93,14 +95,23 @@ MixerWindow::MixerWindow( PulseModel *model, TQWidget *parent ) TQVBoxLayout *top = new TQVBoxLayout( central, 0, 0 ); - // Outer stack: page 0 = mixer content, page 1 = devices (no-tab mode only) + // Outer stack: page 0 = mixer, page 1 = devices (no-tab mode), page 2 = waiting m_outerStack = new TQWidgetStack( central ); top->addWidget( m_outerStack, 1 ); TQWidget *mixerPage = new TQWidget( m_outerStack ); TQVBoxLayout *mixerLayout = new TQVBoxLayout( mixerPage, 0, 0 ); m_outerStack->addWidget( mixerPage, 0 ); - m_outerStack->raiseWidget( 0 ); + + // Page 2: shown when PA is not yet connected / no devices present + TQWidget *waitPage = new TQWidget( m_outerStack ); + TQVBoxLayout *waitLayout = new TQVBoxLayout( waitPage, 0, 0 ); + m_waitLabel = new TQLabel( i18n("Waiting for PulseAudio to start..."), waitPage ); + m_waitLabel->setAlignment( Qt::AlignCenter ); + waitLayout->addWidget( m_waitLabel ); + m_outerStack->addWidget( waitPage, 2 ); + + m_outerStack->raiseWidget( 2 ); // start on waiting page; switch to 0 on first device m_stack = new TQWidgetStack( mixerPage ); mixerLayout->addWidget( m_stack ); @@ -189,7 +200,7 @@ bool MixerWindow::queryClose() if ( m_quitting || tdeApp->sessionSaving() ) return true; TDEConfig *cfg = TDEGlobal::config(); - cfg->setGroup("General"); + cfg->setGroup("Tray"); if ( cfg->readBoolEntry("DockInTray", true) ) { saveMainWindowSettings( TDEGlobal::config(), "MainWindow" ); TDEConfig *c = TDEGlobal::config(); @@ -200,6 +211,21 @@ bool MixerWindow::queryClose() hide(); return false; } + // Not in systray — show confirm if needed, then let TDE close the window + // normally (returning true). TDE quits the app when the last main window closes. + TDEConfig *gcfg = TDEGlobal::config(); + gcfg->setGroup("General"); + if ( gcfg->readBoolEntry("ConfirmQuit", false) ) { + int r = KMessageBox::questionYesNo( + this, + i18n("Are you sure you want to quit TMix?"), + i18n("Quit TMix"), + KStdGuiItem::quit(), + KStdGuiItem::cancel() ); + if ( r != KMessageBox::Yes ) + return false; + } + m_quitting = true; return true; } @@ -249,6 +275,10 @@ static void updateSeparators( TQHBoxLayout *layout ) void MixerWindow::onDeviceAdded( AudioDevice *dev ) { + if ( m_totalDevCount == 0 ) + m_outerStack->raiseWidget( 0 ); + m_totalDevCount++; + if ( m_stack->id( m_stack->visibleWidget() ) == 1 ) { TQWidget *w = dev->createWidget( m_allStrip ); m_allLayout->insertWidget( m_allCount, w ); @@ -291,6 +321,9 @@ void MixerWindow::onDeviceRemoved( AudioDevice *dev ) delete w; updateSeparators( t.layout ); } + m_totalDevCount--; + if ( m_totalDevCount == 0 ) + m_outerStack->raiseWidget( 2 ); } @@ -381,7 +414,7 @@ void MixerWindow::applySettings() { TDEConfig *cfg = TDEGlobal::config(); - cfg->setGroup("General"); + cfg->setGroup("Tray"); if ( cfg->readBoolEntry("DockInTray", true) ) m_tray->show(); else @@ -398,6 +431,7 @@ void MixerWindow::applySettings() m_tabs->setTabEnabled( m_playback.scroll, cfg->readBoolEntry("ShowPlayback", true) ); m_tabs->setTabEnabled( m_recording.scroll, cfg->readBoolEntry("ShowRecording", true) ); } + emit settingsChanged(); } void MixerWindow::toggleDevices() -- cgit v1.2.3 From 30ea77bff2c64b9c0e6262679199d0cb445c98fe Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Thu, 21 May 2026 10:18:57 -0400 Subject: wall werr whatever --- CMakeLists.txt | 2 +- src/model/pulsemodel.cpp | 5 ++--- src/ui/mixerwindow.cpp | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/ui/mixerwindow.cpp') diff --git a/CMakeLists.txt b/CMakeLists.txt index 773b32f..80e5966 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include( FindPkgConfig ) find_package( TQt ) find_package( TDE ) -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS} -Wall -Wextra -Werror -Wno-nonnull-compare" ) ##### subdirectories ############################ diff --git a/src/model/pulsemodel.cpp b/src/model/pulsemodel.cpp index 24c1af8..4e73473 100644 --- a/src/model/pulsemodel.cpp +++ b/src/model/pulsemodel.cpp @@ -573,11 +573,10 @@ void PulseModel::customEvent( TQCustomEvent *e ) PulseDevice *dev = findDevice( *list, ev->paIndex ); if ( dev ) { // Remove from name maps if present. - TQMap::Iterator it; - for ( it = m_sinksByName.begin(); it != m_sinksByName.end(); ++it ) { + for ( TQMap::Iterator it = m_sinksByName.begin(); it != m_sinksByName.end(); ++it ) { if ( it.data() == dev ) { m_sinksByName.remove(it); break; } } - for ( it = m_sourcesByName.begin(); it != m_sourcesByName.end(); ++it ) { + for ( TQMap::Iterator it = m_sourcesByName.begin(); it != m_sourcesByName.end(); ++it ) { if ( it.data() == dev ) { m_sourcesByName.remove(it); break; } } // Clean up port tracking maps. diff --git a/src/ui/mixerwindow.cpp b/src/ui/mixerwindow.cpp index 12a6666..4e84005 100644 --- a/src/ui/mixerwindow.cpp +++ b/src/ui/mixerwindow.cpp @@ -365,8 +365,7 @@ void MixerWindow::showPreferences() void MixerWindow::rebuildView() { // Tear down all existing device widgets - TQMap::iterator it; - for ( it = m_widgets.begin(); it != m_widgets.end(); ++it ) + for ( TQMap::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) delete it.data(); m_widgets.clear(); m_output.count = m_input.count = m_playback.count = m_recording.count = 0; -- cgit v1.2.3 From dd3f8434813e851d941df9d5e22d14d8f97aaeba Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Thu, 21 May 2026 12:56:39 -0400 Subject: Qt->TQt --- src/ui/devicespage.cpp | 6 +++--- src/ui/mixerwindow.cpp | 2 +- src/ui/preferencesdlg.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/ui/mixerwindow.cpp') diff --git a/src/ui/devicespage.cpp b/src/ui/devicespage.cpp index 6ae12e6..fd61acb 100644 --- a/src/ui/devicespage.cpp +++ b/src/ui/devicespage.cpp @@ -38,8 +38,8 @@ static TQPixmap availDot( bool plugged, int size ) TQBitmap mask( size, size, true ); { TQPainter mp( &mask ); - mp.setBrush( Qt::color1 ); - mp.setPen( Qt::NoPen ); + mp.setBrush(TQt::color1 ); + mp.setPen(TQt::NoPen ); mp.drawEllipse( 1, 1, size-2, size-2 ); } pm.setMask( mask ); @@ -89,7 +89,7 @@ void DevicesPage::rebuild() PulseCardInfo &info = *it; TQGroupBox *grp = new TQGroupBox( info.description, m_container ); - grp->setColumnLayout( 0, Qt::Vertical ); + grp->setColumnLayout( 0, TQt::Vertical ); grp->layout()->setSpacing( 4 ); grp->layout()->setMargin( 8 ); vbox->addWidget( grp ); diff --git a/src/ui/mixerwindow.cpp b/src/ui/mixerwindow.cpp index 4e84005..57dfbfc 100644 --- a/src/ui/mixerwindow.cpp +++ b/src/ui/mixerwindow.cpp @@ -107,7 +107,7 @@ MixerWindow::MixerWindow( PulseModel *model, TQWidget *parent ) TQWidget *waitPage = new TQWidget( m_outerStack ); TQVBoxLayout *waitLayout = new TQVBoxLayout( waitPage, 0, 0 ); m_waitLabel = new TQLabel( i18n("Waiting for PulseAudio to start..."), waitPage ); - m_waitLabel->setAlignment( Qt::AlignCenter ); + m_waitLabel->setAlignment( TQt::AlignCenter ); waitLayout->addWidget( m_waitLabel ); m_outerStack->addWidget( waitPage, 2 ); diff --git a/src/ui/preferencesdlg.cpp b/src/ui/preferencesdlg.cpp index 9797c93..1167f97 100644 --- a/src/ui/preferencesdlg.cpp +++ b/src/ui/preferencesdlg.cpp @@ -130,7 +130,7 @@ void PreferencesDlg::buildGeneralPage() gl->addSpacing( 8 ); TQGroupBox *trayCard = new TQGroupBox( i18n("System Tray"), gen ); - trayCard->setColumnLayout( 0, Qt::Vertical ); + trayCard->setColumnLayout( 0, TQt::Vertical ); trayCard->layout()->setSpacing( spacingHint() ); trayCard->layout()->setMargin( marginHint() ); TQVBoxLayout *tl = new TQVBoxLayout( trayCard->layout() ); @@ -165,7 +165,7 @@ void PreferencesDlg::buildGeneralPage() gl->addSpacing( 4 ); TQGroupBox *startupCard = new TQGroupBox( i18n("Startup / Exit"), gen ); - startupCard->setColumnLayout( 0, Qt::Vertical ); + startupCard->setColumnLayout( 0, TQt::Vertical ); startupCard->layout()->setSpacing( spacingHint() ); startupCard->layout()->setMargin( marginHint() ); TQVBoxLayout *sl = new TQVBoxLayout( startupCard->layout() ); @@ -193,7 +193,7 @@ void PreferencesDlg::buildBackendPage() TQVBoxLayout *pl = new TQVBoxLayout( pulseWidget, 0, spacingHint() ); TQGroupBox *popupBox = new TQGroupBox( i18n("Mini popup shows:"), pulseWidget ); - popupBox->setColumnLayout( 0, Qt::Vertical ); + popupBox->setColumnLayout( 0, TQt::Vertical ); popupBox->layout()->setSpacing( spacingHint() ); popupBox->layout()->setMargin( marginHint() ); TQVBoxLayout *pcl = new TQVBoxLayout( popupBox->layout() ); @@ -206,7 +206,7 @@ void PreferencesDlg::buildBackendPage() pl->addWidget( popupBox ); TQGroupBox *recBox = new TQGroupBox( i18n("Recording"), pulseWidget ); - recBox->setColumnLayout( 0, Qt::Vertical ); + recBox->setColumnLayout( 0, TQt::Vertical ); recBox->layout()->setSpacing( spacingHint() ); recBox->layout()->setMargin( marginHint() ); TQVBoxLayout *rcl = new TQVBoxLayout( recBox->layout() ); @@ -217,7 +217,7 @@ void PreferencesDlg::buildBackendPage() pl->addSpacing( 8 ); TQGroupBox *viewBox = new TQGroupBox( i18n("View"), pulseWidget ); - viewBox->setColumnLayout( 0, Qt::Vertical ); + viewBox->setColumnLayout( 0, TQt::Vertical ); viewBox->layout()->setSpacing( spacingHint() ); viewBox->layout()->setMargin( marginHint() ); TQVBoxLayout *vbl = new TQVBoxLayout( viewBox->layout() ); -- cgit v1.2.3