/*****************************************************************************
* extended.cpp : Extended controls - Undocked
****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
- * $Id: streaminfo.cpp 16687 2006-09-17 12:15:42Z jb $
+ * Copyright (C) 2006-2008 the VideoLAN team
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
+ * Jean-Baptiste Kempf <jb@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
-
-#include <QTabWidget>
-#include <QBoxLayout>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include "dialogs/extended.hpp"
-#include "dialogs_provider.hpp"
-#include "util/qvlcframe.hpp"
-#include "components/extended_panels.hpp"
-#include "qt4.hpp"
-ExtendedDialog *ExtendedDialog::instance = NULL;
+#include "main_interface.hpp" /* Needed for external MI size */
+#include "input_manager.hpp"
+
+#include <QTabWidget>
+#include <QGridLayout>
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <vlc_modules.h>
ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
{
- QHBoxLayout *l = new QHBoxLayout( this );
- QTabWidget *tab = new QTabWidget( this );
+ setWindowFlags( Qt::Tool );
+ setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
+ setWindowTitle( qtr( "Adjustments and Effects" ) );
+ setWindowRole( "vlc-extended" );
+
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ layout->setContentsMargins( 0, 2, 0, 1 );
+ layout->setSpacing( 3 );
+
+ mainTabW = new QTabWidget( this );
+
+ /* AUDIO effects */
+ QWidget *audioWidget = new QWidget;
+ QHBoxLayout *audioLayout = new QHBoxLayout( audioWidget );
+ QTabWidget *audioTab = new QTabWidget( audioWidget );
+
+ equal = new Equalizer( p_intf, audioTab );
+ audioTab->addTab( equal, qtr( "Graphic Equalizer" ) );
+
+ Compressor *compres = new Compressor( p_intf, audioTab );
+ audioTab->addTab( compres, qtr( "Compressor" ) );
+
+ Spatializer *spatial = new Spatializer( p_intf, audioTab );
+ audioTab->addTab( spatial, qtr( "Spatializer" ) );
+ audioLayout->addWidget( audioTab );
+
+ mainTabW->addTab( audioWidget, qtr( "Audio Effects" ) );
+
+ /* Video Effects */
+ QWidget *videoWidget = new QWidget;
+ QHBoxLayout *videoLayout = new QHBoxLayout( videoWidget );
+ QTabWidget *videoTab = new QTabWidget( videoWidget );
+
+ videoEffect = new ExtVideo( p_intf, videoTab );
+ videoLayout->addWidget( videoTab );
+ videoTab->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
- l->addWidget( tab );
+ mainTabW->addTab( videoWidget, qtr( "Video Effects" ) );
- setWindowTitle( qtr( "Extended controls" ) );
+ syncW = new SyncControls( p_intf, videoTab );
+ mainTabW->addTab( syncW, qtr( "Synchronization" ) );
- Equalizer *foo = new Equalizer( p_intf, this );
- tab->addTab( foo, qtr( "Eqqualizer" ) );
+ if( module_exists( "v4l2" ) )
+ {
+ ExtV4l2 *v4l2 = new ExtV4l2( p_intf, mainTabW );
+ mainTabW->addTab( v4l2, qtr( "v4l2 controls" ) );
+ }
- ExtVideo *bar = new ExtVideo( p_intf, this );
- tab->addTab( bar, qtr( "Video effects" ) );
+ layout->addWidget( mainTabW );
+
+ QDialogButtonBox *closeButtonBox = new QDialogButtonBox( Qt::Horizontal, this );
+ closeButtonBox->addButton(
+ new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole );
+ layout->addWidget( closeButtonBox );
+ CONNECT( closeButtonBox, rejected(), this, close() );
+
+ /* Restore geometry or move this dialog on the left pane of the MI */
+ if( !restoreGeometry( getSettings()->value("EPanel/geometry").toByteArray() ) )
+ {
+ resize( QSize( 400, 280 ) );
+
+ MainInterface *p_mi = p_intf->p_sys->p_mi;
+ if( p_mi && p_mi->x() > 50 )
+ move( ( p_mi->x() - frameGeometry().width() - 10 ), p_mi->y() );
+ else
+ move ( 450 , 0 );
+ }
+
+ CONNECT( THEMIM->getIM(), statusChanged( int ), this, changedItem( int ) );
}
ExtendedDialog::~ExtendedDialog()
{
+ writeSettings( "EPanel" );
+}
+
+void ExtendedDialog::showTab( int i )
+{
+ mainTabW->setCurrentIndex( i );
+ show();
+}
+
+int ExtendedDialog::currentTab()
+{
+ return mainTabW->currentIndex();
}
+void ExtendedDialog::changedItem( int i_status )
+{
+ if( i_status != END_S ) return;
+ syncW->clean();
+ videoEffect->clean();
+ equal->clean();
+}