diff options
Diffstat (limited to 'src/ui/mixerwindow.cpp')
| -rw-r--r-- | src/ui/mixerwindow.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/ui/mixerwindow.cpp b/src/ui/mixerwindow.cpp index caa6af5..53113e6 100644 --- a/src/ui/mixerwindow.cpp +++ b/src/ui/mixerwindow.cpp @@ -1,5 +1,6 @@ #include "mixerwindow.h" #include "preferencesdlg.h" +#include "devicewidget.h" #include "../model/pulsemodel.h" #include <tqlayout.h> @@ -20,6 +21,7 @@ #include <tdeaboutapplication.h> #include <tdeaboutdata.h> #include <tdeapplication.h> +#include <twin.h> #include "tmixtray.h" #include "devicespage.h" #include <tdeconfig.h> @@ -202,6 +204,12 @@ bool MixerWindow::queryClose() } +void MixerWindow::bringToFront() +{ + show(); + KWin::forceActiveWindow( winId() ); +} + void MixerWindow::showAbout() { TDEAboutData about( @@ -224,6 +232,21 @@ MixerWindow::Tab &MixerWindow::tabForCategory( AudioDevice::Category cat ) return m_output; } +static void updateSeparators( TQHBoxLayout *layout ) +{ + TQLayoutIterator it = layout->iterator(); + DeviceWidget *last = 0; + while ( TQLayoutItem *item = it.current() ) { + DeviceWidget *dw = dynamic_cast<DeviceWidget*>( item->widget() ); + if ( dw ) { + if ( last ) last->setSeparatorVisible( true ); + last = dw; + } + ++it; + } + if ( last ) last->setSeparatorVisible( false ); +} + void MixerWindow::onDeviceAdded( AudioDevice *dev ) { if ( m_stack->id( m_stack->visibleWidget() ) == 1 ) { @@ -232,6 +255,7 @@ void MixerWindow::onDeviceAdded( AudioDevice *dev ) m_allCount++; w->show(); m_widgets.insert( dev, w ); + updateSeparators( m_allLayout ); } else { Tab &t = tabForCategory( dev->category() ); TQWidget *w = dev->createWidget( t.page ); @@ -239,6 +263,7 @@ void MixerWindow::onDeviceAdded( AudioDevice *dev ) t.count++; w->show(); m_widgets.insert( dev, w ); + updateSeparators( t.layout ); } } @@ -255,13 +280,17 @@ void MixerWindow::onDeviceRemoved( AudioDevice *dev ) if ( m_stack->id( m_stack->visibleWidget() ) == 1 ) { m_allLayout->remove( w ); m_allCount--; + m_widgets.remove( dev ); + delete w; + updateSeparators( m_allLayout ); } else { Tab &t = tabForCategory( dev->category() ); t.layout->remove( w ); t.count--; + m_widgets.remove( dev ); + delete w; + updateSeparators( t.layout ); } - m_widgets.remove( dev ); - delete w; } |
