diff options
Diffstat (limited to 'src/ui/backendcontroller.cpp')
| -rw-r--r-- | src/ui/backendcontroller.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/ui/backendcontroller.cpp b/src/ui/backendcontroller.cpp index 3a41b8d..037c797 100644 --- a/src/ui/backendcontroller.cpp +++ b/src/ui/backendcontroller.cpp @@ -17,6 +17,12 @@ #include "alsa/alsatray.h" #endif +#ifdef WITH_OSS +#include "../model/ossmodel.h" +#include "oss/ossmixerwindow.h" +#include "oss/osstray.h" +#endif + BackendController::BackendController( TQObject *parent ) : TQObject(parent) #ifdef WITH_PULSE @@ -25,6 +31,9 @@ BackendController::BackendController( TQObject *parent ) #ifdef WITH_ALSA , m_alsaModel(0), m_alsaWin(0), m_alsaTray(0) #endif +#ifdef WITH_OSS + , m_ossModel(0), m_ossWin(0), m_ossTray(0) +#endif {} BackendController::~BackendController() @@ -41,6 +50,9 @@ void BackendController::start() #ifdef WITH_ALSA if ( m_currentBackend == "alsa" ) { startAlsa(); return; } #endif +#ifdef WITH_OSS + if ( m_currentBackend == "oss" ) { startOss(); return; } +#endif #ifdef WITH_PULSE startPulse(); #endif @@ -53,6 +65,11 @@ void BackendController::stop() if ( m_alsaWin ) { delete m_alsaWin; m_alsaWin = 0; } if ( m_alsaModel ) { delete m_alsaModel; m_alsaModel = 0; } #endif +#ifdef WITH_OSS + if ( m_ossTray ) { delete m_ossTray; m_ossTray = 0; } + if ( m_ossWin ) { delete m_ossWin; m_ossWin = 0; } + if ( m_ossModel ) { delete m_ossModel; m_ossModel = 0; } +#endif #ifdef WITH_PULSE // Model first: stops the PA mainloop thread before any widget is destroyed. if ( m_pulseModel ) { delete m_pulseModel; m_pulseModel = 0; } @@ -109,6 +126,33 @@ void BackendController::startAlsa( bool showWindow ) } #endif +#ifdef WITH_OSS +void BackendController::startOss( bool showWindow ) +{ + m_ossModel = new OssModel( this ); + if ( !m_ossModel->open() ) { + delete m_ossModel; + m_ossModel = 0; + return; + } + m_ossWin = new OssMixerWindow( m_ossModel ); + connect( m_ossWin, TQ_SIGNAL(settingsChanged()), + this, TQ_SLOT(onSettingsChanged()) ); + static_cast<TmixApp*>(kapp)->setMainWindow( m_ossWin ); + + TDEConfig *cfg = TDEGlobal::config(); + cfg->setGroup("Tray"); + bool dockInTray = cfg->readBoolEntry("DockInTray", true); + if ( dockInTray ) { + m_ossTray = new OssTray( m_ossModel, m_ossWin, m_ossWin ); + m_ossWin->setTray( m_ossTray ); + m_ossTray->show(); + } + if ( !dockInTray || showWindow ) + m_ossWin->show(); +} +#endif + void BackendController::onSettingsChanged() { TDEConfig *cfg = TDEGlobal::config(); @@ -148,12 +192,26 @@ void BackendController::doSwitch() } } #endif +#ifdef WITH_OSS + if ( m_ossWin ) { + wasVisible = wasVisible || m_ossWin->isVisible(); + if ( m_ossWin->isVisible() ) { + cfg->setGroup("MainWindow"); + cfg->writeEntry("XPos", m_ossWin->x()); + cfg->writeEntry("YPos", m_ossWin->y()); + cfg->sync(); + } + } +#endif stop(); #ifdef WITH_ALSA if ( m_currentBackend == "alsa" ) { startAlsa( wasVisible ); return; } #endif +#ifdef WITH_OSS + if ( m_currentBackend == "oss" ) { startOss( wasVisible ); return; } +#endif #ifdef WITH_PULSE startPulse( wasVisible ); #endif |
