summaryrefslogtreecommitdiff
path: root/src/ui/oss/ossmixerwindow.cpp
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-24 14:45:24 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-24 14:45:24 -0400
commitff020f03a29dd26bda0b891c562226fa7a61eb19 (patch)
tree2152d68b222dfc654e55a2add1860cbc6e8e5bdf /src/ui/oss/ossmixerwindow.cpp
parent71d01139cf2ac4380c2ee13ecdcff77eb1d42897 (diff)
show error page in OSS mixer window when backend fails to open
If /dev/mixer can't be opened (missing device, bad permissions, etc.) the window now shows the error reason instead of silently not appearing. The tray is also skipped in the error case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/ui/oss/ossmixerwindow.cpp')
-rw-r--r--src/ui/oss/ossmixerwindow.cpp46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/ui/oss/ossmixerwindow.cpp b/src/ui/oss/ossmixerwindow.cpp
index e817e29..f8d8a74 100644
--- a/src/ui/oss/ossmixerwindow.cpp
+++ b/src/ui/oss/ossmixerwindow.cpp
@@ -9,6 +9,7 @@
#include <tqcombobox.h>
#include <tqtabwidget.h>
#include <tqlabel.h>
+#include <tqwidgetstack.h>
#include <tdeapplication.h>
#include <tdelocale.h>
#include <tdemenubar.h>
@@ -22,26 +23,36 @@
OssMixerWindow::OssMixerWindow( OssModel *model, TQWidget *parent )
: TDEMainWindow(parent, "OssMixerWindow"),
- m_model(model), m_tray(0), m_posRestored(false)
+ m_model(model), m_tray(0), m_posRestored(false),
+ m_outerStack(0), m_errorLabel(0),
+ m_cardCombo(0), m_tabs(0), m_outputPage(0), m_inputPage(0),
+ m_outputLayout(0), m_inputLayout(0)
{
m_widgets.setAutoDelete(true);
setCaption(i18n("Volume Control"));
TQWidget *central = new TQWidget(this);
setCentralWidget(central);
- TQVBoxLayout *vbox = new TQVBoxLayout(central, 8, 6);
+ TQVBoxLayout *vbox = new TQVBoxLayout(central, 0, 0);
+
+ m_outerStack = new TQWidgetStack(central);
+ vbox->addWidget(m_outerStack, 1);
+
+ // Page 0: normal mixer content
+ TQWidget *mixerPage = new TQWidget(m_outerStack);
+ TQVBoxLayout *mixerLayout = new TQVBoxLayout(mixerPage, 8, 6);
TQHBoxLayout *topRow = new TQHBoxLayout(0, 0, 6);
topRow->addStretch();
- topRow->addWidget(new TQLabel(i18n("Card:"), central));
- m_cardCombo = new TQComboBox(false, central);
+ topRow->addWidget(new TQLabel(i18n("Card:"), mixerPage));
+ m_cardCombo = new TQComboBox(false, mixerPage);
TQValueList<OssCard> cards = model->cards();
for ( TQValueListConstIterator<OssCard> it = cards.begin(); it != cards.end(); ++it )
m_cardCombo->insertItem((*it).name);
topRow->addWidget(m_cardCombo);
- vbox->addLayout(topRow);
+ mixerLayout->addLayout(topRow);
- m_tabs = new TQTabWidget(central);
+ m_tabs = new TQTabWidget(mixerPage);
m_outputPage = new TQWidget(m_tabs);
m_outputLayout = new TQHBoxLayout(m_outputPage, 8, 6);
@@ -51,10 +62,25 @@ OssMixerWindow::OssMixerWindow( OssModel *model, TQWidget *parent )
m_inputLayout = new TQHBoxLayout(m_inputPage, 8, 6);
m_tabs->addTab(m_inputPage, i18n("Input"));
- vbox->addWidget(m_tabs, 1);
-
- if ( !cards.isEmpty() )
- rebuildTabs(cards.front().index);
+ mixerLayout->addWidget(m_tabs, 1);
+ m_outerStack->addWidget(mixerPage, 0);
+
+ // Page 1: error page
+ TQWidget *errorPage = new TQWidget(m_outerStack);
+ TQVBoxLayout *errorLayout = new TQVBoxLayout(errorPage, 8, 6);
+ m_errorLabel = new TQLabel(errorPage);
+ m_errorLabel->setAlignment(TQt::AlignCenter | TQt::WordBreak);
+ errorLayout->addWidget(m_errorLabel);
+ m_outerStack->addWidget(errorPage, 1);
+
+ if ( model->lastError().isEmpty() ) {
+ m_outerStack->raiseWidget(0);
+ if ( !cards.isEmpty() )
+ rebuildTabs(cards.front().index);
+ } else {
+ m_errorLabel->setText(i18n("Could not open OSS mixer:\n%1").arg(model->lastError()));
+ m_outerStack->raiseWidget(1);
+ }
setMinimumSize(400, 250);