Advanced controls bar
authorClément Stenac <zorglub@videolan.org>
Sat, 23 Sep 2006 13:16:33 +0000 (13:16 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 23 Sep 2006 13:16:33 +0000 (13:16 +0000)
Make some sttings persistent

15 files changed:
modules/gui/qt4/Modules.am
modules/gui/qt4/components/equalizer.cpp [deleted file]
modules/gui/qt4/components/equalizer.hpp [deleted file]
modules/gui/qt4/components/extended_panels.cpp [new file with mode: 0644]
modules/gui/qt4/components/extended_panels.hpp [new file with mode: 0644]
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/dialogs/extended.cpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.hpp
modules/gui/qt4/qt4.hpp

index 3e38bb5..3863561 100644 (file)
@@ -30,7 +30,7 @@ TOMOC = main_interface \
        dialogs/streaminfo \
        dialogs/extended \
        dialogs/interaction \
-       components/equalizer \
+       components/extended_panels \
        components/infopanels \
        components/preferences_widgets \
        components/preferences \
@@ -56,7 +56,7 @@ nodist_SOURCES_qt4 = \
                dialogs/errors.moc.cpp \
                dialogs/prefs_dialog.moc.cpp \
                dialogs/interaction.moc.cpp \
-               components/equalizer.moc.cpp \
+               components/extended_panels.moc.cpp \
                components/infopanels.moc.cpp \
                components/preferences_widgets.moc.cpp \
                components/preferences.moc.cpp \
@@ -102,7 +102,7 @@ SOURCES_qt4 =       qt4.cpp \
                dialogs/messages.cpp \
                dialogs/errors.cpp \
                dialogs/interaction.cpp \
-               components/equalizer.cpp \
+               components/extended_panels.cpp \
                components/infopanels.cpp \
                components/preferences_widgets.cpp \
                components/preferences.cpp \
@@ -130,7 +130,7 @@ EXTRA_DIST += \
        dialogs/errors.hpp \
        dialogs/prefs_dialog.hpp \
        dialogs/interaction.hpp \
-       components/equalizer.hpp \
+       components/extended_panels.hpp \
        components/infopanels.hpp \
        components/preferences_widgets.hpp \
        components/preferences.hpp \
diff --git a/modules/gui/qt4/components/equalizer.cpp b/modules/gui/qt4/components/equalizer.cpp
deleted file mode 100644 (file)
index 664cf0e..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*****************************************************************************
- * equalizer.cpp : Equalizer
- ****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
- * $Id: preferences.cpp 16643 2006-09-13 12:45:46Z zorglub $
- *
- * Authors: Clément Stenac <zorglub@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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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 <QLabel>
-#include <QVariant>
-#include <QString>
-#include <QFont>
-#include <QGridLayout>
-
-#include "components/equalizer.hpp"
-#include "qt4.hpp"
-
-#include "../../audio_filter/equalizer_presets.h"
-#include <audio_output.h>
-#include <aout_internal.h>
-#include <vlc_intf_strings.h>
-#include <assert.h>
-
-static const QString band_frequencies[] =
-{
-    "   60Hz  ", " 170 Hz " , " 310 Hz ", " 600 Hz ", "  1 kHz  ",
-    "  3 kHz  " , "  6 kHz ", " 12 kHz ", " 14 kHz ", " 16 kHz "
-};
-
-Equalizer::Equalizer( intf_thread_t *_p_intf, QWidget *_parent ) :
-                            QWidget( _parent ) , p_intf( _p_intf )
-{
-    QFont smallFont = QApplication::font(0);
-    smallFont.setPointSize( smallFont.pointSize() - 3 );
-
-    ui.setupUi( this );
-
-    ui.preampLabel->setFont( smallFont );
-    ui.preampSlider->setMaximum( 400 );
-    for( int i = 0 ; i < NB_PRESETS ; i ++ )
-    {
-        ui.presetsCombo->addItem( qfu( preset_list_text[i] ),
-                                  QVariant( i ) );
-    }
-    CONNECT( ui.presetsCombo, activated( int ), this, setPreset( int ) );
-
-    BUTTONACT( ui.enableCheck, enable() );
-    BUTTONACT( ui.eq2PassCheck, set2Pass() );
-
-    CONNECT( ui.preampSlider, valueChanged(int), this, setPreamp() );
-
-    QGridLayout *grid = new QGridLayout( ui.frame );
-    grid->setMargin( 0 );
-    for( int i = 0 ; i < BANDS ; i++ )
-    {
-        bands[i] = new QSlider( Qt::Vertical );
-        bands[i]->setMaximum( 400 );
-        bands[i]->setValue( 200 );
-        CONNECT( bands[i], valueChanged(int), this, setBand() );
-        band_texts[i] = new QLabel( band_frequencies[i] + "\n0.0dB" );
-        band_texts[i]->setFont( smallFont );
-        grid->addWidget( bands[i], 0, i );
-        grid->addWidget( band_texts[i], 1, i );
-    }
-
-    /* Write down initial values */
-    aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find(p_intf,
-                                    VLC_OBJECT_AOUT, FIND_ANYWHERE);
-    char *psz_af = NULL;
-    char *psz_bands;
-    float f_preamp;
-    if( p_aout )
-    {
-        psz_af = var_GetString( p_aout, "audio-filter" );
-        if( var_GetBool( p_aout, "equalizer-2pass" ) )
-            ui.eq2PassCheck->setChecked( true );
-        psz_bands = var_GetString( p_aout, "equalizer-bands" );
-        f_preamp = var_GetFloat( p_aout, "equalizer-preamp" );
-        vlc_object_release( p_aout );
-    }
-    else
-    {
-        psz_af = config_GetPsz( p_intf, "audio-filter" );
-        if( config_GetInt( p_intf, "equalizer-2pass" ) )
-            ui.eq2PassCheck->setChecked( true );
-        psz_bands = config_GetPsz( p_intf, "equalizer-bands" );
-        f_preamp = config_GetFloat( p_intf, "equalizer-preamp" );
-    }
-    if( psz_af && strstr( psz_af, "equalizer" ) != NULL )
-        ui.enableCheck->setChecked( true );
-    enable( ui.enableCheck->isChecked() );
-
-    setValues( psz_bands, f_preamp );
-}
-
-Equalizer::~Equalizer()
-{
-}
-
-void Equalizer::enable()
-{
-    bool en = ui.enableCheck->isChecked();
-    aout_EnableFilter( VLC_OBJECT( p_intf ), "equalizer",
-                       en ? VLC_TRUE : VLC_FALSE );
-    enable( en );
-}
-
-void Equalizer::enable( bool en )
-{
-    ui.eq2PassCheck->setEnabled( en );
-    ui.preampLabel->setEnabled( en );
-    ui.preampSlider->setEnabled( en  );
-    for( int i = 0 ; i< BANDS; i++ )
-    {
-        bands[i]->setEnabled( en ); band_texts[i]->setEnabled( en );
-    }
-}
-
-void Equalizer::set2Pass()
-{
-    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
-                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
-    vlc_bool_t b_2p = ui.eq2PassCheck->isChecked();
-
-    if( p_aout == NULL )
-        config_PutInt( p_intf, "equalizer-2pass", b_2p );
-    else
-    {
-        var_SetBool( p_aout, "equalizer-2pass", b_2p );
-        config_PutInt( p_intf, "equalizer-2pass", b_2p );
-        for( int i = 0; i < p_aout->i_nb_inputs; i++ )
-        {
-            p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
-        }
-        vlc_object_release( p_aout );
-    }
-}
-
-void Equalizer::setPreamp()
-{
-    float f= (float)(  ui.preampSlider->value() ) /10 - 20;
-    char psz_val[5];
-    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
-                                       VLC_OBJECT_AOUT, FIND_ANYWHERE);
-
-    sprintf( psz_val, "%.1f", f );
-    ui.preampLabel->setText( qtr("Preamp\n") + psz_val + qtr("dB") );
-    if( p_aout )
-    {
-        delCallbacks( p_aout );
-        var_SetFloat( p_aout, "equalizer-preamp", f );
-        addCallbacks( p_aout );
-        vlc_object_release( p_aout );
-    }
-    config_PutFloat( p_intf, "equalizer-preamp", f );
-}
-
-void Equalizer::setBand()
-{
-    char psz_values[102]; memset( psz_values, 0, 102 );
-
-    /**\todo smoothing */
-
-    for( int i = 0 ; i< BANDS ; i++ )
-    {
-        char psz_val[5];
-        float f_val = (float)(  bands[i]->value() ) / 10 - 20 ;
-        sprintf( psz_values, "%s %f", psz_values, f_val );
-        sprintf( psz_val, "% 5.1f", f_val );
-        band_texts[i]->setText( band_frequencies[i] + "\n" + psz_val + "dB" );
-    }
-    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
-                                          VLC_OBJECT_AOUT, FIND_ANYWHERE);
-    if( p_aout )
-    {
-        delCallbacks( p_aout );
-        var_SetString( p_aout, "equalizer-bands", psz_values );
-        addCallbacks( p_aout );
-        vlc_object_release( p_aout );
-    }
-}
-void Equalizer::setValues( char *psz_bands, float f_preamp )
-{
-    char *p = psz_bands;
-    if ( p )
-    {
-        for( int i = 0; i < 10; i++ )
-        {
-            char psz_val[5];
-            float f = strtof( p, &p );
-            int  i_val= (int)( ( f + 20 ) * 10 );
-            bands[i]->setValue(  i_val );
-            sprintf( psz_val, "% 5.1f", f );
-            band_texts[i]->setText( band_frequencies[i] + "\n" + psz_val +
-                                    "dB" );
-            if( p == NULL ) break;
-            p++;
-            if( *p == 0 )  break;
-        }
-    }
-    char psz_val[5];
-    int i_val = (int)( ( f_preamp + 20 ) * 10 );
-    sprintf( psz_val, "%.1f", f_preamp );
-    ui.preampSlider->setValue( i_val );
-    ui.preampLabel->setText( qtr("Preamp\n") + psz_val + qtr("dB") );
-}
-
-void Equalizer::setPreset( int preset )
-{
-    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
-                                                VLC_OBJECT_AOUT, FIND_ANYWHERE);
-
-    char psz_values[102]; memset( psz_values, 0, 102 );
-    for( int i = 0 ; i< 10 ;i++ )
-        sprintf( psz_values, "%s %.1f", psz_values,
-                                        eqz_preset_10b[preset]->f_amp[i] );
-
-    if( p_aout )
-    {
-        delCallbacks( p_aout );
-        var_SetString( p_aout, "equalizer-bands", psz_values );
-        var_SetFloat( p_aout, "equalizer-preamp",
-                      eqz_preset_10b[preset]->f_preamp );
-        addCallbacks( p_aout );
-        vlc_object_release( p_aout );
-    }
-    config_PutPsz( p_intf, "equalizer-bands", psz_values );
-    config_PutFloat( p_intf, "equalizer-preamp",
-                    eqz_preset_10b[preset]->f_preamp );
-
-    setValues( psz_values, eqz_preset_10b[preset]->f_preamp );
-}
-
-void Equalizer::delCallbacks( aout_instance_t *p_aout )
-{
-//    var_DelCallback( p_aout, "equalizer-bands", EqzCallback, this );
-//    var_DelCallback( p_aout, "equalizer-preamp", EqzCallback, this );
-}
-
-void Equalizer::addCallbacks( aout_instance_t *p_aout )
-{
-//    var_AddCallback( p_aout, "equalizer-bands", EqzCallback, this );
-//    var_AddCallback( p_aout, "equalizer-preamp", EqzCallback, this );
-}
diff --git a/modules/gui/qt4/components/equalizer.hpp b/modules/gui/qt4/components/equalizer.hpp
deleted file mode 100644 (file)
index 99130bc..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * preferences_tree.hpp : Tree of modules for preferences
- ****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
- * $Id: preferences.hpp 16643 2006-09-13 12:45:46Z zorglub $
- *
- * Authors: Clément Stenac <zorglub@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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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.
- *****************************************************************************/
-
-#ifndef _EQUALIZER_H_
-#define _EQUALIZER_H_
-
-#include <vlc/vlc.h>
-#include <vlc/aout.h>
-#include "ui/equalizer.h"
-
-#define BANDS 10
-
-class Equalizer: public QWidget
-{
-    Q_OBJECT
-public:
-    Equalizer( intf_thread_t *, QWidget * );
-    virtual ~Equalizer();
-
-private:
-    Ui::EqualizerWidget ui;
-    QSlider *bands[BANDS];
-    QLabel *band_texts[BANDS];
-
-    void delCallbacks( aout_instance_t * );
-    void addCallbacks( aout_instance_t * );
-    void setValues( char *, float );
-
-    intf_thread_t *p_intf;
-private slots:
-    void enable(bool);
-    void enable();
-    void set2Pass();
-    void setPreamp();
-    void setBand();
-    void setPreset(int);
-};
-
-#endif
diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
new file mode 100644 (file)
index 0000000..2721519
--- /dev/null
@@ -0,0 +1,276 @@
+/*****************************************************************************
+ * extended_panels.cpp : Extended controls panels
+ ****************************************************************************
+ * Copyright (C) 2006 the VideoLAN team
+ * $Id: preferences.cpp 16643 2006-09-13 12:45:46Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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 <QLabel>
+#include <QVariant>
+#include <QString>
+#include <QFont>
+#include <QGridLayout>
+
+#include "components/extended_panels.hpp"
+#include "qt4.hpp"
+
+#include "../../audio_filter/equalizer_presets.h"
+#include <audio_output.h>
+#include <aout_internal.h>
+#include <vlc_intf_strings.h>
+#include <assert.h>
+
+/**********************************************************************
+ * Equalizer
+ **********************************************************************/
+
+static const QString band_frequencies[] =
+{
+    "   60Hz  ", " 170 Hz " , " 310 Hz ", " 600 Hz ", "  1 kHz  ",
+    "  3 kHz  " , "  6 kHz ", " 12 kHz ", " 14 kHz ", " 16 kHz "
+};
+
+Equalizer::Equalizer( intf_thread_t *_p_intf, QWidget *_parent ) :
+                            QWidget( _parent ) , p_intf( _p_intf )
+{
+    QFont smallFont = QApplication::font(0);
+    smallFont.setPointSize( smallFont.pointSize() - 3 );
+
+    ui.setupUi( this );
+
+    ui.preampLabel->setFont( smallFont );
+    ui.preampSlider->setMaximum( 400 );
+    for( int i = 0 ; i < NB_PRESETS ; i ++ )
+    {
+        ui.presetsCombo->addItem( qfu( preset_list_text[i] ),
+                                  QVariant( i ) );
+    }
+    CONNECT( ui.presetsCombo, activated( int ), this, setPreset( int ) );
+
+    BUTTONACT( ui.enableCheck, enable() );
+    BUTTONACT( ui.eq2PassCheck, set2Pass() );
+
+    CONNECT( ui.preampSlider, valueChanged(int), this, setPreamp() );
+
+    QGridLayout *grid = new QGridLayout( ui.frame );
+    grid->setMargin( 0 );
+    for( int i = 0 ; i < BANDS ; i++ )
+    {
+        bands[i] = new QSlider( Qt::Vertical );
+        bands[i]->setMaximum( 400 );
+        bands[i]->setValue( 200 );
+        CONNECT( bands[i], valueChanged(int), this, setBand() );
+        band_texts[i] = new QLabel( band_frequencies[i] + "\n0.0dB" );
+        band_texts[i]->setFont( smallFont );
+        grid->addWidget( bands[i], 0, i );
+        grid->addWidget( band_texts[i], 1, i );
+    }
+
+    /* Write down initial values */
+    aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find(p_intf,
+                                    VLC_OBJECT_AOUT, FIND_ANYWHERE);
+    char *psz_af = NULL;
+    char *psz_bands;
+    float f_preamp;
+    if( p_aout )
+    {
+        psz_af = var_GetString( p_aout, "audio-filter" );
+        if( var_GetBool( p_aout, "equalizer-2pass" ) )
+            ui.eq2PassCheck->setChecked( true );
+        psz_bands = var_GetString( p_aout, "equalizer-bands" );
+        f_preamp = var_GetFloat( p_aout, "equalizer-preamp" );
+        vlc_object_release( p_aout );
+    }
+    else
+    {
+        psz_af = config_GetPsz( p_intf, "audio-filter" );
+        if( config_GetInt( p_intf, "equalizer-2pass" ) )
+            ui.eq2PassCheck->setChecked( true );
+        psz_bands = config_GetPsz( p_intf, "equalizer-bands" );
+        f_preamp = config_GetFloat( p_intf, "equalizer-preamp" );
+    }
+    if( psz_af && strstr( psz_af, "equalizer" ) != NULL )
+        ui.enableCheck->setChecked( true );
+    enable( ui.enableCheck->isChecked() );
+
+    setValues( psz_bands, f_preamp );
+}
+
+Equalizer::~Equalizer()
+{
+}
+
+void Equalizer::enable()
+{
+    bool en = ui.enableCheck->isChecked();
+    aout_EnableFilter( VLC_OBJECT( p_intf ), "equalizer",
+                       en ? VLC_TRUE : VLC_FALSE );
+    enable( en );
+}
+
+void Equalizer::enable( bool en )
+{
+    ui.eq2PassCheck->setEnabled( en );
+    ui.preampLabel->setEnabled( en );
+    ui.preampSlider->setEnabled( en  );
+    for( int i = 0 ; i< BANDS; i++ )
+    {
+        bands[i]->setEnabled( en ); band_texts[i]->setEnabled( en );
+    }
+}
+
+void Equalizer::set2Pass()
+{
+    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
+                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
+    vlc_bool_t b_2p = ui.eq2PassCheck->isChecked();
+
+    if( p_aout == NULL )
+        config_PutInt( p_intf, "equalizer-2pass", b_2p );
+    else
+    {
+        var_SetBool( p_aout, "equalizer-2pass", b_2p );
+        config_PutInt( p_intf, "equalizer-2pass", b_2p );
+        for( int i = 0; i < p_aout->i_nb_inputs; i++ )
+        {
+            p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
+        }
+        vlc_object_release( p_aout );
+    }
+}
+
+void Equalizer::setPreamp()
+{
+    float f= (float)(  ui.preampSlider->value() ) /10 - 20;
+    char psz_val[5];
+    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
+                                       VLC_OBJECT_AOUT, FIND_ANYWHERE);
+
+    sprintf( psz_val, "%.1f", f );
+    ui.preampLabel->setText( qtr("Preamp\n") + psz_val + qtr("dB") );
+    if( p_aout )
+    {
+        delCallbacks( p_aout );
+        var_SetFloat( p_aout, "equalizer-preamp", f );
+        addCallbacks( p_aout );
+        vlc_object_release( p_aout );
+    }
+    config_PutFloat( p_intf, "equalizer-preamp", f );
+}
+
+void Equalizer::setBand()
+{
+    char psz_values[102]; memset( psz_values, 0, 102 );
+
+    /**\todo smoothing */
+
+    for( int i = 0 ; i< BANDS ; i++ )
+    {
+        char psz_val[5];
+        float f_val = (float)(  bands[i]->value() ) / 10 - 20 ;
+        sprintf( psz_values, "%s %f", psz_values, f_val );
+        sprintf( psz_val, "% 5.1f", f_val );
+        band_texts[i]->setText( band_frequencies[i] + "\n" + psz_val + "dB" );
+    }
+    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
+                                          VLC_OBJECT_AOUT, FIND_ANYWHERE);
+    if( p_aout )
+    {
+        delCallbacks( p_aout );
+        var_SetString( p_aout, "equalizer-bands", psz_values );
+        addCallbacks( p_aout );
+        vlc_object_release( p_aout );
+    }
+}
+void Equalizer::setValues( char *psz_bands, float f_preamp )
+{
+    char *p = psz_bands;
+    if ( p )
+    {
+        for( int i = 0; i < 10; i++ )
+        {
+            char psz_val[5];
+            float f = strtof( p, &p );
+            int  i_val= (int)( ( f + 20 ) * 10 );
+            bands[i]->setValue(  i_val );
+            sprintf( psz_val, "% 5.1f", f );
+            band_texts[i]->setText( band_frequencies[i] + "\n" + psz_val +
+                                    "dB" );
+            if( p == NULL ) break;
+            p++;
+            if( *p == 0 )  break;
+        }
+    }
+    char psz_val[5];
+    int i_val = (int)( ( f_preamp + 20 ) * 10 );
+    sprintf( psz_val, "%.1f", f_preamp );
+    ui.preampSlider->setValue( i_val );
+    ui.preampLabel->setText( qtr("Preamp\n") + psz_val + qtr("dB") );
+}
+
+void Equalizer::setPreset( int preset )
+{
+    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
+                                                VLC_OBJECT_AOUT, FIND_ANYWHERE);
+
+    char psz_values[102]; memset( psz_values, 0, 102 );
+    for( int i = 0 ; i< 10 ;i++ )
+        sprintf( psz_values, "%s %.1f", psz_values,
+                                        eqz_preset_10b[preset]->f_amp[i] );
+
+    if( p_aout )
+    {
+        delCallbacks( p_aout );
+        var_SetString( p_aout, "equalizer-bands", psz_values );
+        var_SetFloat( p_aout, "equalizer-preamp",
+                      eqz_preset_10b[preset]->f_preamp );
+        addCallbacks( p_aout );
+        vlc_object_release( p_aout );
+    }
+    config_PutPsz( p_intf, "equalizer-bands", psz_values );
+    config_PutFloat( p_intf, "equalizer-preamp",
+                    eqz_preset_10b[preset]->f_preamp );
+
+    setValues( psz_values, eqz_preset_10b[preset]->f_preamp );
+}
+
+void Equalizer::delCallbacks( aout_instance_t *p_aout )
+{
+//    var_DelCallback( p_aout, "equalizer-bands", EqzCallback, this );
+//    var_DelCallback( p_aout, "equalizer-preamp", EqzCallback, this );
+}
+
+void Equalizer::addCallbacks( aout_instance_t *p_aout )
+{
+//    var_AddCallback( p_aout, "equalizer-bands", EqzCallback, this );
+//    var_AddCallback( p_aout, "equalizer-preamp", EqzCallback, this );
+}
+
+
+/**********************************************************************
+ * Video filters / Adjust
+ **********************************************************************/
+
+/**********************************************************************
+ * Audio filters
+ **********************************************************************/
+
+/**********************************************************************
+ * Extended playbak controls
+ **********************************************************************/
diff --git a/modules/gui/qt4/components/extended_panels.hpp b/modules/gui/qt4/components/extended_panels.hpp
new file mode 100644 (file)
index 0000000..de5e25b
--- /dev/null
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * preferences_tree.hpp : Tree of modules for preferences
+ ****************************************************************************
+ * Copyright (C) 2006 the VideoLAN team
+ * $Id: preferences.hpp 16643 2006-09-13 12:45:46Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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.
+ *****************************************************************************/
+
+#ifndef _EQUALIZER_H_
+#define _EQUALIZER_H_
+
+#include <vlc/vlc.h>
+#include <vlc/aout.h>
+#include "ui/equalizer.h"
+
+#define BANDS 10
+
+class Equalizer: public QWidget
+{
+    Q_OBJECT
+public:
+    Equalizer( intf_thread_t *, QWidget * );
+    virtual ~Equalizer();
+
+private:
+    Ui::EqualizerWidget ui;
+    QSlider *bands[BANDS];
+    QLabel *band_texts[BANDS];
+
+    void delCallbacks( aout_instance_t * );
+    void addCallbacks( aout_instance_t * );
+    void setValues( char *, float );
+
+    intf_thread_t *p_intf;
+private slots:
+    void enable(bool);
+    void enable();
+    void set2Pass();
+    void setPreamp();
+    void setBand();
+    void setPreset(int);
+};
+
+class ExtendedControls: public QWidget
+{
+    Q_OBJECT
+public:
+    ExtendedControls( intf_thread_t *, QWidget * ) {};
+    virtual ~ExtendedControls() {};
+
+private:
+    intf_thread_t *p_intf;
+private slots:
+    void slower() {};
+    void faster() {};
+    void normal() {};
+    void snapshot() {};
+};
+
+#endif
index 5de3633..c0fb11f 100644 (file)
@@ -30,6 +30,8 @@
 #include "pixmaps/art.xpm"
 #include <vlc/vout.h>
 
+#include <QLabel>
+#include <QSpacerItem>
 #include <QCursor>
 #include <QPushButton>
 #include <QHBoxLayout>
@@ -154,6 +156,17 @@ VisualSelector::VisualSelector( intf_thread_t *_p_i ) :
     QPushButton *nextButton = new QPushButton( "Next");
     layout->addWidget( prevButton );
     layout->addWidget( nextButton );
+
+    layout->addItem( new QSpacerItem( 40,20,
+                              QSizePolicy::Expanding, QSizePolicy::Minimum) );
+    layout->addWidget( new QLabel( qtr("Current visualization:") ) );
+
+    current = new QLabel( qtr( "None" ) );
+    layout->addWidget( current );
+
+    BUTTONACT( prevButton, prev() );
+    BUTTONACT( nextButton, next() );
+
     setLayout( layout );
     setMaximumHeight( 35 );
 }
@@ -162,6 +175,103 @@ VisualSelector::~VisualSelector()
 {
 }
 
+void VisualSelector::prev()
+{
+    char *psz_new = aout_VisualPrev( p_intf );
+    if( psz_new )
+    {
+        current->setText( qfu( psz_new ) );
+        free( psz_new );
+    }
+}
+
+void VisualSelector::next()
+{
+    char *psz_new = aout_VisualNext( p_intf );
+    if( psz_new )
+    {
+        current->setText( qfu( psz_new ) );
+        free( psz_new );
+    }
+}
+
+/**********************************************************************
+ * More controls
+ **********************************************************************/
+ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) :
+                                           QFrame( NULL ), p_intf( _p_i )
+{
+    QHBoxLayout *layout = new QHBoxLayout( this );
+    layout->setMargin( 0 );
+
+    slowerButton = new QPushButton( "S" );
+    BUTTON_SET_ACT( slowerButton, "S", qtr("Slower" ), slower() );
+    layout->addWidget( slowerButton );
+    slowerButton->setMaximumWidth( 35 );
+
+    normalButton = new QPushButton( "N" );
+    BUTTON_SET_ACT( normalButton, "N", qtr("Normal rate"), normal() );
+    layout->addWidget( normalButton );
+    normalButton->setMaximumWidth( 35 );
+
+    fasterButton = new QPushButton( "F" );
+    BUTTON_SET_ACT( fasterButton, "F", qtr("Faster" ), faster() );
+    layout->addWidget( fasterButton );
+    fasterButton->setMaximumWidth( 35 );
+
+    layout->addItem( new QSpacerItem( 100,20,
+                              QSizePolicy::Expanding, QSizePolicy::Minimum) );
+
+    snapshotButton = new QPushButton( "S" );
+    BUTTON_SET_ACT( snapshotButton, "S", qtr("Take a snapshot"), snapshot() );
+    layout->addWidget( snapshotButton );
+    snapshotButton->setMaximumWidth( 35 );
+
+    fullscreenButton = new QPushButton( "F" );
+    BUTTON_SET_ACT( fullscreenButton, "F", qtr("Fullscreen"), fullscreen() );
+    layout->addWidget( fullscreenButton );
+    fullscreenButton->setMaximumWidth( 35 );
+}
+
+ControlsWidget::~ControlsWidget()
+{
+}
+
+void ControlsWidget::enableInput( bool enable )
+{
+    slowerButton->setEnabled( enable );
+    normalButton->setEnabled( enable );
+    fasterButton->setEnabled( enable );
+}
+void ControlsWidget::enableVideo( bool enable )
+{
+    snapshotButton->setEnabled( enable );
+    fullscreenButton->setEnabled( enable );
+}
+
+void ControlsWidget::slower()
+{
+    THEMIM->getIM()->slower();
+}
+
+void ControlsWidget::faster()
+{
+    THEMIM->getIM()->faster();
+}
+
+void ControlsWidget::normal()
+{
+    THEMIM->getIM()->normalRate();
+}
+
+void ControlsWidget::snapshot()
+{
+}
+
+void ControlsWidget::fullscreen()
+{
+}
+
 /**********************************************************************
  * Playlist Widget. The embedded playlist
  **********************************************************************/
index fd89468..04b476f 100644 (file)
@@ -89,8 +89,34 @@ public:
     virtual ~VisualSelector();
 private:
     intf_thread_t *p_intf;
+    QLabel *current;
+private slots:
+    void prev();
+    void next();
 };
 
+class QPushButton;
+class ControlsWidget : public QFrame
+{
+    Q_OBJECT
+public:
+    ControlsWidget( intf_thread_t *);
+    virtual ~ControlsWidget();
+    void enableInput( bool );
+    void enableVideo( bool );
+private:
+    intf_thread_t *p_intf;
+    QPushButton *slowerButton, *normalButton, *fasterButton;
+    QPushButton *fullscreenButton, *snapshotButton;
+private slots:
+    void faster();
+    void slower();
+    void normal();
+    void snapshot();
+    void fullscreen();
+};
+
+
 /******************** Playlist Widgets ****************/
 #include <QModelIndex>
 class QSignalMapper;
index a1b88c3..4f8ec7b 100644 (file)
@@ -26,7 +26,7 @@
 #include "dialogs/extended.hpp"
 #include "dialogs_provider.hpp"
 #include "util/qvlcframe.hpp"
-#include "components/equalizer.hpp"
+#include "components/extended_panels.hpp"
 #include "qt4.hpp"
 
 ExtendedDialog *ExtendedDialog::instance = NULL;
index 6b2ed82..305fa77 100644 (file)
@@ -55,6 +55,11 @@ void InputManager::setInput( input_thread_t *_p_input )
     b_had_audio = b_had_video = b_has_audio = b_has_video = false;
     if( p_input )
     {
+        vlc_value_t val;
+        var_Change( p_input, "video-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
+        b_has_video = val.i_int > 0;
+        var_Change( p_input, "audio-es", VLC_VAR_CHOICESCOUNT, &val, NULL );
+        b_has_audio = val.i_int > 0;
         var_AddCallback( p_input, "audio-es", ChangeAudio, this );
         var_AddCallback( p_input, "video-es", ChangeVideo, this );
     }
@@ -139,7 +144,7 @@ void InputManager::update()
 
 void InputManager::sliderUpdate( float new_pos )
 {
-    if( p_input && !p_input->b_die && !p_input->b_dead )
+    if( hasInput() )
         var_SetFloat( p_input, "position", new_pos );
 }
 
@@ -161,6 +166,24 @@ void InputManager::togglePlayPause()
     emit statusChanged( state.i_int );
 }
 
+void InputManager::slower()
+{
+    if( hasInput() )
+        var_SetVoid( p_input, "rate-slower" );
+}
+
+void InputManager::faster()
+{
+    if( hasInput() )
+        var_SetVoid( p_input, "rate-faster" );
+}
+
+void InputManager::normalRate()
+{
+    if( hasInput() )
+        var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT );
+}
+
 /**********************************************************************
  * MainInputManager implementation. Wrap an input manager and
  * take care of updating the main playlist input
index 0f9427b..e0197b9 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <QObject>
 #include <vlc/vlc.h>
+#include <vlc/input.h>
 
 class InputManager : public QObject
 {
@@ -35,6 +36,7 @@ public:
     virtual ~InputManager();
 
     void delInput();
+    bool hasInput() { return p_input && !p_input->b_dead && !p_input->b_die; }
     bool hasAudio() { return b_has_audio; }
     bool hasVideo() { return b_has_video; }
     bool b_has_audio, b_has_video, b_had_audio, b_had_video;
@@ -48,6 +50,9 @@ public slots:
     void update(); ///< Periodic updates
     void setInput( input_thread_t * ); ///< Our controlled input changed
     void sliderUpdate( float ); ///< User dragged the slider. We get new pos
+    void slower();
+    void faster();
+    void normalRate();
 signals:
     /// Send new position, new time and new length
     void positionUpdated( float , int, int );
index 9fe6506..ac79266 100644 (file)
@@ -39,6 +39,7 @@
 #include <assert.h>
 #include <vlc_keys.h>
 #include <vlc/vout.h>
+#include <aout_internal.h>
 
 #ifdef WIN32
     #define PREF_W 410
     #define PREF_H 125
 #endif
 
-#define BUTTON_SET( button, image, tooltip ) ui.button##Button->setText(""); \
-    ui.button##Button->setIcon( QIcon( ":/pixmaps/"#image ) ); \
-    ui.button##Button->setToolTip( tooltip );
-
 #define VISIBLE(i) (i && i->isVisible())
 
 #define SET_WIDTH(i,j) i->widgetSize.setWidth(j)
@@ -90,10 +87,24 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
     embeddedPlaylistWasActive = videoIsActive = false;
 
+    /* Fetch configuration from settings and vlc config */
+    videoEmbeddedFlag = false;
+    if( config_GetInt( p_intf, "embedded-video" ) )
+        videoEmbeddedFlag = true;
+
+    alwaysVideoFlag = false;
+    if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ))
+        alwaysVideoFlag = true;
+
+    playlistEmbeddedFlag = settings->value( "playlist-embedded", true ).
+                                                                    toBool();
+    advControlsEnabled= settings->value( "adv-controls", false ).toBool();
+
     setWindowTitle( QString::fromUtf8( _("VLC media player") ) );
     handleMainUi( settings );
 
-    QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag );
+    QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag,
+                             advControlsEnabled );
 
     /* Status bar */
     timeLabel = new QLabel( 0 );
@@ -126,7 +137,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
 MainInterface::~MainInterface()
 {
-    /// \todo Save everything
+    settings->setValue( "playlist-embedded", playlistEmbeddedFlag );
+    settings->setValue( "adv-controls", advControlsEnabled );
+    settings->setValue( "pos", pos() );
+    settings->endGroup();
+    delete settings;
     p_intf->b_interaction = VLC_FALSE;
     var_DelCallback( p_intf, "interaction", InteractCallback, this );
 
@@ -144,17 +159,13 @@ void MainInterface::handleMainUi( QSettings *settings )
     slider = new InputSlider( Qt::Horizontal, NULL );
     ui.hboxLayout->insertWidget( 0, slider );
 
-    BUTTON_SET( prev, previous.png, qtr( "Previous" ) );
-    BUTTONACT( ui.prevButton, prev() );
-    BUTTON_SET( next, next.png , qtr( "Next" ) );
-    BUTTONACT( ui.nextButton, next() );
-    BUTTON_SET( play, play.png , qtr( "Play" ) );
-    BUTTONACT( ui.playButton, play() );
-    BUTTON_SET( stop, stop.png , qtr( "Stop" )  );
-    BUTTONACT( ui.stopButton, stop() );
-
-    BUTTON_SET( visual,  stop.png, qtr( "Audio visualizations" ) );
-    BUTTONACT( ui.visualButton, visual() );
+    BUTTON_SET_ACT_I( ui.prevButton, "" , previous.png,
+                      qtr("Previous"), prev() );
+    BUTTON_SET_ACT_I( ui.nextButton, "", next.png, qtr("Next"), next() );
+    BUTTON_SET_ACT_I( ui.playButton, "", play.png, qtr("Play"), play() );
+    BUTTON_SET_ACT_I( ui.stopButton, "", stop.png, qtr("Stop"), stop() );
+    BUTTON_SET_ACT_I( ui.visualButton, "", stop.png,
+                    qtr( "Audio visualizations" ), visual() );
 
     /* Volume */
     ui.volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
@@ -164,20 +175,8 @@ void MainInterface::handleMainUi( QSettings *settings )
     ui.volMuteLabel->installEventFilter(h);
     ui.volumeSlider->setFocusPolicy( Qt::NoFocus );
 
-    /* Fetch configuration from settings and vlc config */
-    videoEmbeddedFlag = false;
-    if( config_GetInt( p_intf, "embedded-video" ) )
-        videoEmbeddedFlag = true;
-
-    alwaysVideoFlag = false;
-    if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ))
-        alwaysVideoFlag = true;
-
-    playlistEmbeddedFlag = true;
-    /// \todo fetch playlist settings
-
-    BUTTON_SET( playlist, volume-low.png, playlistEmbeddedFlag ?
-                                                qtr( "Show playlist" ) :
+    BUTTON_SET_IMG( ui.playlistButton, "" ,volume-low.png,
+                        playlistEmbeddedFlag ?  qtr( "Show playlist" ) :
                                                 qtr( "Open playlist" ) );
     BUTTONACT( ui.playlistButton, playlist() );
 
@@ -186,6 +185,12 @@ void MainInterface::handleMainUi( QSettings *settings )
 
     addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H );
 
+    advControls = new ControlsWidget( p_intf );
+    ui.vboxLayout->insertWidget( 0, advControls );
+    advControls->updateGeometry();
+    if( !advControlsEnabled ) advControls->hide();
+    need_components_update = true;
+
     visualSelector = new VisualSelector( p_intf );
     ui.vboxLayout->insertWidget( 0, visualSelector );
     visualSelector->hide();
@@ -211,10 +216,6 @@ void MainInterface::handleMainUi( QSettings *settings )
         p_intf->pf_release_window  = ::DoRelease;
         p_intf->pf_control_window  = ::DoControl;
     }
-
-    calculateInterfaceSize();
-    resize( mainSize );
-
     setMinimumSize( PREF_W, addSize.height() );
 }
 
@@ -249,7 +250,14 @@ void MainInterface::calculateInterfaceSize()
     }
     if( VISIBLE( visualSelector ) )
         height += visualSelector->height();
+    fprintf( stderr, "Adv %p - visible %i\n", advControls, advControls->isVisible() );
+    if( VISIBLE( advControls) )
+    {
+        fprintf( stderr, "visible\n" );
+        height += advControls->sizeHint().height();
+    }
 
+    fprintf( stderr, "Adv height %i\n", advControls->sizeHint().height() );
     fprintf( stderr, "Setting to %ix%i\n",
                      width + addSize.width() , height + addSize.height() );
 
@@ -265,14 +273,12 @@ void MainInterface::resizeEvent( QResizeEvent *e )
         SET_WH( videoWidget, e->size().width() - addSize.width(),
                              e->size().height()  - addSize.height() );
         videoWidget->updateGeometry();
-        fprintf( stderr, "Video set to %ix%i\n", DS( videoWidget->widgetSize) );
     }
     if( VISIBLE( playlistWidget ) )
     {
         SET_WH( playlistWidget , e->size().width() - addSize.width(),
                                  e->size().height() - addSize.height() );
         playlistWidget->updateGeometry();
-        fprintf( stderr, "PL set to %ix%i\n",DS(playlistWidget->widgetSize ) );
     }
 }
 
@@ -361,6 +367,21 @@ int MainInterface::controlVideo( void *p_window, int i_query, va_list args )
     return i_ret;
 }
 
+void MainInterface::advanced()
+{
+    if( !VISIBLE( advControls ) )
+    {
+        advControls->show();
+        advControlsEnabled = true;
+    }
+    else
+    {
+        advControls->hide();
+        advControlsEnabled = false;
+    }
+    doComponentsUpdate();
+}
+
 void MainInterface::visual()
 {
     if( !VISIBLE( visualSelector) )
@@ -404,7 +425,6 @@ void MainInterface::playlist()
     /// Todo, reset its size ?
     if( VISIBLE( playlistWidget) )
     {
-        fprintf( stderr, "hiding playlist\n" );
         playlistWidget->hide();
         if( videoIsActive )
         {
@@ -415,7 +435,6 @@ void MainInterface::playlist()
     }
     else
     {
-        fprintf( stderr, "showing playlist\n" );
         playlistWidget->show();
         if( videoIsActive )
         {
@@ -448,7 +467,7 @@ void MainInterface::undockPlaylist()
         playlistEmbeddedFlag = false;
 
         menuBar()->clear();
-        QVLCMenu::createMenuBar( this, p_intf, false );
+        QVLCMenu::createMenuBar( this, p_intf, false, advControlsEnabled );
 
         if( videoIsActive )
         {
@@ -469,7 +488,7 @@ void MainInterface::customEvent( QEvent *event )
         PlaylistDialog::killInstance();
         playlistEmbeddedFlag = true;
         menuBar()->clear();
-        QVLCMenu::createMenuBar(this, p_intf, true );
+        QVLCMenu::createMenuBar(this, p_intf, true, advControlsEnabled );
         playlist();
     }
 }
@@ -587,6 +606,21 @@ static bool b_my_volume;
 
 void MainInterface::updateOnTimer()
 {
+    aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find( p_intf,
+                                    VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    /* Todo: make this event-driven */
+    if( p_aout )
+    {
+        ui.visualButton->setEnabled( true );
+        vlc_object_release( p_aout );
+    }
+    else
+        ui.visualButton->setEnabled( false );
+
+    /* And this too */
+    advControls->enableInput( THEMIM->getIM()->hasInput() );
+    advControls->enableVideo( THEMIM->getIM()->hasVideo() );
+
     if( p_intf->b_die )
     {
         QApplication::closeAllWindows();
@@ -634,8 +668,6 @@ static int InteractCallback( vlc_object_t *p_this,
 {
     intf_dialog_args_t *p_arg = new intf_dialog_args_t;
     p_arg->p_dialog = (interaction_dialog_t *)(new_val.p_address);
-
-    MainInterface *p_interface = (MainInterface*)param;
     DialogEvent *event = new DialogEvent( INTF_DIALOG_INTERACTION, 0, p_arg );
     QApplication::postEvent( THEDP, static_cast<QEvent*>(event) );
     return VLC_SUCCESS;
index 2cfb0ac..cbece4b 100644 (file)
@@ -42,6 +42,7 @@ class BackgroundWidget;
 class PlaylistWidget;
 class VolumeClickHandler;
 class VisualSelector;
+class ControlsWidget;
 
 class MainInterface : public QVLCMW
 {
@@ -74,11 +75,13 @@ private:
 
     BackgroundWidget    *bgWidget;
     VisualSelector      *visualSelector;
+    ControlsWidget      *advControls;
     PlaylistWidget      *playlistWidget;
 
     bool                 playlistEmbeddedFlag;
     bool                 videoEmbeddedFlag;
     bool                 alwaysVideoFlag;
+    bool                 advControlsEnabled;
 
     InputManager        *main_input_manager;
     InputSlider         *slider;
@@ -101,6 +104,7 @@ private slots:
     void next();
     void playlist();
     void visual();
+    void advanced();
     void updateVolume( int sliderVolume );
 };
 
index f814834..f004544 100644 (file)
@@ -120,15 +120,15 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object,
     THEDP->menusUpdateMapper->setMapping( menu, f ); }
 
 void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
-                              bool playlist )
+                              bool playlist, bool adv_controls_enabled )
 {
     QMenuBar *bar = mi->menuBar();
-    BAR_ADD( FileMenu(), qtr("File") );
+    BAR_ADD( FileMenu(), qtr("Media") );
     if( playlist )
     {
         BAR_ADD( PlaylistMenu( mi,p_intf ), qtr("Playlist" ) );
     }
-    BAR_ADD( ToolsMenu( p_intf ), qtr("Tools") );
+    BAR_ADD( ToolsMenu( p_intf, mi, adv_controls_enabled ), qtr("Tools") );
     BAR_DADD( VideoMenu( p_intf, NULL ), qtr("Video"), 1 );
     BAR_DADD( AudioMenu( p_intf, NULL ), qtr("Audio"), 2 );
     BAR_DADD( NavigMenu( p_intf, NULL ), qtr("Navigation"), 3 );
@@ -161,7 +161,8 @@ QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
     return menu;
 }
 
-QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, bool with_intf )
+QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
+                            bool adv_controls_enabled, bool with_intf )
 {
     QMenu *menu = new QMenu();
     if( with_intf )
@@ -169,15 +170,22 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, bool with_intf )
         QMenu *intfmenu = InterfacesMenu( p_intf, NULL );
         intfmenu->setTitle( qtr("Interfaces" ) );
         menu->addMenu( intfmenu );
-        /** \todo ADD EXT GUI HERE */
         menu->addSeparator();
     }
     DP_SADD( qtr("Messages" ), "", "", messagesDialog() );
     DP_SADD( qtr("Information") , "", "", streaminfoDialog() );
     DP_SADD( qtr("Bookmarks"), "", "", bookmarksDialog() );
+    DP_SADD( qtr("Extended settings"), "","",extendedDialog() );
+    if( mi )
+    {
+        menu->addSeparator();
+        QAction *adv = menu->addAction( qtr("Advanced controls" ),
+                                        mi, SLOT( advanced() ) );
+        adv->setCheckable( true );
+        if( adv_controls_enabled ) adv->setChecked( true );
+    }
     menu->addSeparator();
     DP_SADD( qtr("Preferences"), "", "", prefsDialog() );
-    DP_SADD( qtr("Extended"), "","",extendedDialog() );
     return menu;
 }
 
@@ -340,7 +348,7 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
     intfmenu->setTitle( qtr("Interfaces" ) ); \
     menu->addMenu( intfmenu ); \
     \
-    QMenu *toolsmenu = ToolsMenu( p_intf, false ); \
+    QMenu *toolsmenu = ToolsMenu( p_intf, NULL, false, false ); \
     toolsmenu->setTitle( qtr("Tools" ) ); \
     menu->addMenu( toolsmenu ); \
 
index 8929c6d..f50f18e 100644 (file)
@@ -58,13 +58,14 @@ class QVLCMenu : public QObject
 {
     Q_OBJECT;
 public:
-    static void createMenuBar( MainInterface *mi, intf_thread_t *, bool );
+    static void createMenuBar( MainInterface *mi, intf_thread_t *, bool, bool );
 
     /* Menus */
     static QMenu *FileMenu();
     static QMenu *SDMenu( intf_thread_t * );
     static QMenu *PlaylistMenu( MainInterface *, intf_thread_t *);
-    static QMenu *ToolsMenu( intf_thread_t *, bool with_intf = true );
+    static QMenu *ToolsMenu( intf_thread_t *, MainInterface *, bool,
+                             bool with = true );
     static QMenu *NavigMenu( intf_thread_t * , QMenu * );
     static QMenu *VideoMenu( intf_thread_t * , QMenu * );
     static QMenu *AudioMenu( intf_thread_t * , QMenu * );
index fe66a73..5d1a489 100644 (file)
@@ -62,6 +62,22 @@ struct intf_sys_t
 #define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
 #define ON_TIMEOUT( act ) CONNECT( THEDP->fixed_timer, timeout(), this, act )
 
+#define BUTTON_SET( button, text, tooltip ) \
+    button->setText( text ); \
+    button->setToolTip( tooltip );
+
+#define BUTTON_SET_ACT( button, text, tooltip, thisslot ) \
+    BUTTON_SET( button, text, tooltip ); \
+    BUTTONACT( button, thisslot );
+
+#define BUTTON_SET_IMG( button, text, image, tooltip ) \
+    BUTTON_SET( button, text, tooltip ); \
+    button->setIcon( QIcon( ":/pixmaps/"#image ) );
+
+#define BUTTON_SET_ACT_I( button, text, image, tooltip, thisslot ) \
+    BUTTON_SET_IMG( button, text, image, tooltip ); \
+    BUTTONACT( button, thisslot );
+
 static int DialogEvent_Type = QEvent::User + 1;
 static int PLUndockEvent_Type = QEvent::User + 2;
 static int PLDockEvent_Type = QEvent::User + 3;