Some cleanup here and there
authorClément Stenac <zorglub@videolan.org>
Wed, 13 Sep 2006 12:45:46 +0000 (12:45 +0000)
committerClément Stenac <zorglub@videolan.org>
Wed, 13 Sep 2006 12:45:46 +0000 (12:45 +0000)
* Add a CONNECT macro for simple signal->slot connections
* Untested save support in simple preferences

20 files changed:
modules/gui/qt4/components/infopanels.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/preferences.cpp
modules/gui/qt4/components/preferences.hpp
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.hpp
modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/components/simple_preferences.hpp
modules/gui/qt4/dialogs/messages.cpp
modules/gui/qt4/dialogs/messages.hpp
modules/gui/qt4/dialogs/prefs_dialog.cpp
modules/gui/qt4/dialogs/prefs_dialog.hpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/playlist_model.cpp
modules/gui/qt4/playlist_model.hpp
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.hpp

index 592bb8c..01ae143 100644 (file)
@@ -45,9 +45,12 @@ void InputStatsPanel::Update( input_item_t *p_item )
     { QString str; ui.widget->setText( str.sprintf( format, ## calc ) );  }
 
     UPDATE( read_text, "%8.0f kB", (float)(p_item->p_stats->i_read_bytes)/1000);
-    UPDATE( input_bitrate_text, "%6.0f kb/s", (float)(p_item->p_stats->f_input_bitrate * 8000 ));
-    UPDATE( demuxed_text, "%8.0f kB", (float)(p_item->p_stats->i_demux_read_bytes)/1000 );
-    UPDATE( stream_bitrate_text, "%6.0f kb/s", (float)(p_item->p_stats->f_demux_bitrate * 8000 ));
+    UPDATE( input_bitrate_text, "%6.0f kb/s",
+                    (float)(p_item->p_stats->f_input_bitrate * 8000 ));
+    UPDATE( demuxed_text, "%8.0f kB",
+                    (float)(p_item->p_stats->i_demux_read_bytes)/1000 );
+    UPDATE( stream_bitrate_text, "%6.0f kb/s",
+                    (float)(p_item->p_stats->f_demux_bitrate * 8000 ));
 
     /* Video */
     UPDATE( vdecoded_text, "%5i", p_item->p_stats->i_decoded_video );
index 90a32d7..e78ce43 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include "qt4.hpp"
 #include "playlist_model.hpp"
 #include "components/playlist/panels.hpp"
+#include "util/customwidgets.hpp"
+
 #include <QTreeView>
 #include <QPushButton>
 #include <QHBoxLayout>
 #include <QVBoxLayout>
 #include <QHeaderView>
 #include <QKeyEvent>
-#include "qt4.hpp"
-#include <assert.h>
 #include <QModelIndexList>
 #include <QToolBar>
 #include <QLabel>
 #include <QSpacerItem>
-#include "util/customwidgets.hpp"
+
+#include <assert.h>
 
 StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
                                   playlist_t *p_playlist,
@@ -52,15 +54,12 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
     view->header()->setClickable( true );
     view->setSelectionMode( QAbstractItemView::ExtendedSelection );
 
-    connect( view, SIGNAL( activated( const QModelIndex& ) ), model,
-             SLOT( activateItem( const QModelIndex& ) ) );
-
-    connect( view, SIGNAL( rightClicked( QModelIndex , QPoint ) ),
-             this, SLOT( doPopup( QModelIndex, QPoint ) ) );
-
-    connect( model,
-             SIGNAL( dataChanged( const QModelIndex&, const QModelIndex& ) ),
-             this, SLOT( handleExpansion( const QModelIndex& ) ) );
+    CONNECT( view, activated( const QModelIndex& ) ,
+             model,activateItem( const QModelIndex& ) );
+    CONNECT( view, rightClicked( QModelIndex , QPoint ),
+             this, doPopup( QModelIndex, QPoint ) );
+    CONNECT( model, dataChanged( const QModelIndex&, const QModelIndex& ),
+             this, handleExpansion( const QModelIndex& ) );
 
     QVBoxLayout *layout = new QVBoxLayout();
     layout->setSpacing( 0 ); layout->setMargin( 0 );
index 162b86f..aeba7bb 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
-#include "components/preferences.hpp"
-#include "components/preferences_widgets.hpp"
-#include "qt4.hpp"
-#include <vlc_config_cat.h>
-#include <vlc_intf_strings.h>
-#include <assert.h>
 
-#include "pixmaps/audio.xpm"
-#include "pixmaps/video.xpm"
-#include "pixmaps/type_net.xpm"
-#include "pixmaps/type_playlist.xpm"
-#include "pixmaps/advanced.xpm"
-#include "pixmaps/codec.xpm"
-#include "pixmaps/intf.xpm"
 #include <QApplication>
 #include <QLabel>
 #include <QTreeWidget>
 #include <QHBoxLayout>
 #include <QGridLayout>
 #include <QHeaderView>
-
 #include <QPalette>
 #include <QColor>
 
+#include "components/preferences.hpp"
+#include "components/preferences_widgets.hpp"
+#include "qt4.hpp"
+
+#include <vlc_config_cat.h>
+#include <vlc_intf_strings.h>
+#include <assert.h>
+
+#include "pixmaps/audio.xpm"
+#include "pixmaps/video.xpm"
+#include "pixmaps/type_net.xpm"
+#include "pixmaps/type_playlist.xpm"
+#include "pixmaps/advanced.xpm"
+#include "pixmaps/codec.xpm"
+#include "pixmaps/intf.xpm"
+
 #define ITEM_HEIGHT 25
 
 /*********************************************************************
@@ -69,9 +71,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
     setAlternatingRowColors( true );
     header()->hide();
 
-    QFont myFont = QApplication::font(0);
-    myFont.setPointSize( myFont.pointSize() + 3 ); myFont.setBold( true );
-
 #define BI( a,b) QIcon a##_icon = QIcon( QPixmap( b##_xpm ))
     BI( audio, audio );
     BI( video, video );
@@ -338,7 +337,7 @@ PrefsPanel::PrefsPanel( QWidget *_parent ) : QWidget( _parent )
 {}
 
 PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
-                        PrefsItemData * data, bool currently_advanced ) :
+                        PrefsItemData * data ) :
                         QWidget( _parent ), p_intf( _p_intf )
 {
     module_config_t *p_item;
@@ -464,9 +463,8 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             control = ConfigControl::createControl( VLC_OBJECT( p_intf ),
                                     p_item, NULL, boxlayout, i_boxline );
         if( !control )
-        {
             continue;
-        }
+
         if( box ) i_boxline++;
         else i_line++;
         controls.append( control );
@@ -495,34 +493,12 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 
 void PrefsPanel::apply()
 {
-    /* todo */
     QList<ConfigControl *>::Iterator i;
     for( i = controls.begin() ; i != controls.end() ; i++ )
     {
         ConfigControl *c = qobject_cast<ConfigControl *>(*i);
-        switch( c->getType() )
-        {
-        case 1:
-            {
-            VIntConfigControl *vicc = qobject_cast<VIntConfigControl *>(*i);
-            config_PutInt( p_intf, vicc->getName(), vicc->getValue() );
-            break;
-            }
-        case 2:
-            {
-            VFloatConfigControl *vfcc = qobject_cast<VFloatConfigControl *>(*i);
-            config_PutFloat( p_intf, vfcc->getName(), vfcc->getValue() );
-            break;
-            }
-        case 3:
-            {
-            VStringConfigControl *vscc =
-                            qobject_cast<VStringConfigControl *>(*i);
-            config_PutPsz( p_intf, vscc->getName(), qta( vscc->getValue() ) );
-            }
-        }
+        c->doApply( p_intf );
     }
 }
-
 void PrefsPanel::clean()
 {}
index 85687b0..217a805 100644 (file)
@@ -78,7 +78,7 @@ class PrefsPanel : public QWidget
 {
     Q_OBJECT
 public:
-    PrefsPanel( intf_thread_t *, QWidget *, PrefsItemData *, bool );
+    PrefsPanel( intf_thread_t *, QWidget *, PrefsItemData * );
     PrefsPanel( QWidget *);
     virtual ~PrefsPanel() {};
     void apply();
@@ -87,15 +87,6 @@ private:
     intf_thread_t *p_intf;
     QList<ConfigControl *> controls;
     QVBoxLayout *global_layout;
-#if 0
-    QLabel *some_hidden_text;
-    bool advanced;
-#endif
-public slots:
-#if 0
-    void setAdvanced( bool, bool );
-    void setAdvanced( bool a ) { return setAdvanced( a, false ); }
-#endif
 };
 
 #endif
index 8365828..ca5a100 100644 (file)
@@ -105,6 +105,32 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
     return p_control;
 }
 
+void ConfigControl::doApply( intf_thread_t *p_intf )
+{
+    switch( getType() )
+    {
+        case 1:
+        {
+            VIntConfigControl *vicc = qobject_cast<VIntConfigControl *>(this);
+            config_PutInt( p_intf, vicc->getName(), vicc->getValue() );
+            break;
+        }
+        case 2:
+        {
+            VFloatConfigControl *vfcc = 
+                                    qobject_cast<VFloatConfigControl *>(this);
+            config_PutFloat( p_intf, vfcc->getName(), vfcc->getValue() );
+            break;
+        }
+        case 3:
+        {
+            VStringConfigControl *vscc =
+                            qobject_cast<VStringConfigControl *>(this);
+            config_PutPsz( p_intf, vscc->getName(), qta( vscc->getValue() ) );
+        }
+    }
+}
+
 /**************************************************************************
  * String-based controls
  *************************************************************************/
index f21f79d..12f2d66 100644 (file)
@@ -62,6 +62,7 @@ public:
     static ConfigControl * createControl( vlc_object_t*,
                                           module_config_t*,QWidget*,
                                           QGridLayout *, int);
+    void doApply( intf_thread_t *);
 protected:
     vlc_object_t *p_this;
     module_config_t *p_item;
@@ -196,18 +197,6 @@ public:
 private:
     void finish();
 };
-#if 0
-class FloatConfigControl : public VFloatConfigControl
-{
-public:
-    FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
-                ConfigControl(a,b,c) {};
-    virtual ~FloatConfigControl() {};
-    virtual float getValue();
-private:
-    QDoubleSpinBox *spin;
-};
-#endif
 
 /*******************************************************
  * String-based controls
index 13a270d..e0b6c40 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include <QListWidget>
+#include <QListWidgetItem>
+#include <QString>
+#include <QFont>
+
 #include "components/simple_preferences.hpp"
 #include "components/preferences_widgets.hpp"
 #include "qt4.hpp"
+
 #include <vlc_config_cat.h>
 #include <assert.h>
-#include <QListWidget>
-#include <QListWidgetItem>
-#include <QString>
-#include <QFont>
 
 #include "pixmaps/advanced_50x50.xpm"
 #include "pixmaps/audio_50x50.xpm"
@@ -58,50 +60,23 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
     setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) );
     setAlternatingRowColors( true );
 
-#ifndef WIN32
-    // Fixme - A bit UGLY
-    QFont f = font();
-    int pSize = f.pointSize();
-    if( pSize > 0 )
-        f.setPointSize( pSize + 1 );
-    else
-        f.setPixelSize( f.pixelSize() + 1 );
-    setFont( f );
-#endif
-
 #define ADD_CATEGORY( id, label, icon )                             \
     addItem( label );                                               \
     item( id )->setIcon( QIcon( QPixmap( icon ) ) );                \
     item( id )->setData( Qt::UserRole, qVariantFromValue( (int)id ) );
 
-    ADD_CATEGORY( SPrefsVideo, "Video", video_50x50_xpm );
-    ADD_CATEGORY( SPrefsAudio, "Audio", audio_50x50_xpm );
-    ADD_CATEGORY( SPrefsInputAndCodecs, "Input and Codecs",
+    ADD_CATEGORY( SPrefsVideo, qtr("Video"), video_50x50_xpm );
+    ADD_CATEGORY( SPrefsAudio, qtr("Audio"), audio_50x50_xpm );
+    ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input and Codecs"),
                   input_and_codecs_50x50_xpm );
-    ADD_CATEGORY( SPrefsPlaylist, "Playlist", playlist_50x50_xpm );
-    ADD_CATEGORY( SPrefsInterface, "Interface", interface_50x50_xpm );
-    ADD_CATEGORY( SPrefsSubtitles, "Subtitles", subtitles_50x50_xpm );
-    ADD_CATEGORY( SPrefsAdvanced, "Advanced", advanced_50x50_xpm );
+    ADD_CATEGORY( SPrefsPlaylist, qtr("Playlist"), playlist_50x50_xpm );
+    ADD_CATEGORY( SPrefsInterface, qtr("Interface"), interface_50x50_xpm );
+    ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles"), subtitles_50x50_xpm );
+    ADD_CATEGORY( SPrefsAdvanced, qtr("Advanced"), advanced_50x50_xpm );
 
     setCurrentRow( SPrefsInterface );
 }
 
-void SPrefsCatList::applyAll()
-{
-    doAll( false );
-}
-
-void SPrefsCatList::cleanAll()
-{
-    doAll( true );
-}
-
-/// \todo When cleaning, we should remove the panel ?
-void SPrefsCatList::doAll( bool doclean )
-{
-    /* Todo */
-}
-
 /*********************************************************************
  * The Panels
  *********************************************************************/
@@ -187,33 +162,15 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
     }
 }
 
-void SPrefsPanel::Apply()
+void SPrefsPanel::apply()
 {
-    /* todo: factorize with PrefsPanel  */
     QList<ConfigControl *>::Iterator i;
     for( i = controls.begin() ; i != controls.end() ; i++ )
     {
-        VIntConfigControl *vicc = qobject_cast<VIntConfigControl *>(*i);
-        if( !vicc )
-        {
-            VFloatConfigControl *vfcc = qobject_cast<VFloatConfigControl *>(*i);
-            if( !vfcc)
-            {
-                VStringConfigControl *vscc =
-                               qobject_cast<VStringConfigControl *>(*i);
-                assert( vscc );
-                config_PutPsz( p_intf, vscc->getName(),
-                                       vscc->getValue().toAscii().data() );
-                continue;
-            }
-            config_PutFloat( p_intf, vfcc->getName(),
-                                     vfcc->getValue() );
-            continue;
-        }
-        config_PutInt( p_intf, vicc->getName(),
-                               vicc->getValue() );
+        ConfigControl *c = qobject_cast<ConfigControl *>(*i);
+        c->doApply( p_intf );
     }
 }
 
-void SPrefsPanel::Clean()
+void SPrefsPanel::clean()
 {}
index 0c43f13..a5b39a7 100644 (file)
 #include <vlc/intf.h>
 
 enum {
-    SPrefsVideo,
+    SPrefsVideo = 0,
     SPrefsAudio,
     SPrefsInputAndCodecs,
     SPrefsPlaylist,
     SPrefsInterface,
     SPrefsSubtitles,
-    SPrefsAdvanced
+    SPrefsAdvanced,
+    SPrefsMax
 };
 #define SPrefsDefaultCat SPrefsInterface
 
@@ -47,12 +48,7 @@ class SPrefsCatList : public QListWidget
 public:
     SPrefsCatList( intf_thread_t *, QWidget *);
     virtual ~SPrefsCatList() {};
-
-    void applyAll();
-    void cleanAll();
-
 private:
-    void doAll( bool );
     intf_thread_t *p_intf;
 };
 
@@ -62,8 +58,8 @@ class SPrefsPanel : public QWidget
 public:
     SPrefsPanel( intf_thread_t *, QWidget *, int );
     virtual ~SPrefsPanel() {};
-    void Apply();
-    void Clean();
+    void apply();
+    void clean();
 private:
     intf_thread_t *p_intf;
     QList<ConfigControl *> controls;
index 1ae22b0..58925e4 100644 (file)
@@ -64,14 +64,10 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
     layout->addWidget(clearButton, 1, 4 );
     layout->addWidget(closeButton, 1, 5 );
 
-    connect( closeButton, SIGNAL( clicked() ) ,
-           this, SLOT( onCloseButton()));
-    connect( clearButton, SIGNAL( clicked() ) ,
-           this, SLOT( onClearButton()));
-    connect( saveLogButton, SIGNAL( clicked() ) ,
-           this, SLOT( onSaveButton()));
-    connect( DialogsProvider::getInstance(NULL)->fixed_timer,
-             SIGNAL( timeout() ), this, SLOT(updateLog() ) );
+    CONNECT( closeButton, clicked(), this, close() );
+    CONNECT( clearButton, clicked(), this, clear() );
+    CONNECT( saveLogButton, clicked(), this, save() );
+    CONNECT( THEDP->fixed_timer, timeout(), this, updateLog() );
 }
 
 MessagesDialog::~MessagesDialog()
@@ -153,25 +149,24 @@ void MessagesDialog::updateLog()
     }
 }
 
-void MessagesDialog::onCloseButton()
+void MessagesDialog::close()
 {
     this->toggleVisible();
 }
 
-void MessagesDialog::onClearButton()
+void MessagesDialog::clear()
 {
     messages->clear();
 }
 
-bool MessagesDialog::onSaveButton()
+bool MessagesDialog::save()
 {
     QString saveLogFileName = QFileDialog::getSaveFileName(
-            this,
-            "Choose a filename to save the logs under...",
+            this, qtr("Choose a filename to save the logs under..."),
             p_intf->p_vlc->psz_homedir,
             "Texts / Logs (*.log *.txt);; All (*.*) ");
 
-    if (saveLogFileName != NULL)
+    if( saveLogFileName != NULL )
     {
         QFile file(saveLogFileName);
         if (!file.open(QFile::WriteOnly | QFile::Text)) {
index 5425324..b07c804 100644 (file)
@@ -50,9 +50,9 @@ private:
     QTextEdit *messages;
 public slots:
     void updateLog();
-    void onCloseButton();
-    void onClearButton();
-    bool onSaveButton();
+    void close();
+    void clear();
+    bool save();
 };
 
 #endif
index 4c1c99d..67ed860 100644 (file)
@@ -34,6 +34,7 @@
 #include <QVBoxLayout>
 #include <QPushButton>
 #include <QCheckBox>
+
 PrefsDialog *PrefsDialog::instance = NULL;
 
 PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
@@ -74,18 +75,19 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
      setSmall();
 
      QPushButton *save, *cancel;
-     QHBoxLayout *buttonsLayout =
-         QVLCFrame::doButtons( this, NULL, &save, _("Save"),
-                                           &cancel, _("Cancel"),
-                                                NULL, NULL );
-     connect( save, SIGNAL( clicked() ), this, SLOT( save() ) );
-     connect( cancel, SIGNAL( clicked() ), this, SLOT( cancel() ) );
+     QHBoxLayout *buttonsLayout = QVLCFrame::doButtons( this, NULL, 
+                                                        &save, _("Save"),
+                                                        &cancel, _("Cancel"),
+                                                        NULL, NULL );
      main_layout->addLayout( buttonsLayout, 2,0, 1 ,3 );
-
      setLayout( main_layout );
 
-     connect( small, SIGNAL( clicked() ), this, SLOT( setSmall()) );
-     connect( all, SIGNAL( clicked() ), this, SLOT( setAll()) );
+     CONNECT( save, clicked(), this, save() );
+     CONNECT( cancel, clicked(), this, cancel() );
+     CONNECT( small, clicked(), this, setSmall() );
+     CONNECT( all, clicked(), this, setAll() );
+
+     for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
 }
 
 void PrefsDialog::setAll()
@@ -127,9 +129,9 @@ void PrefsDialog::setSmall()
     if( !simple_tree )
     {
          simple_tree = new SPrefsCatList( p_intf, tree_panel );
-         connect( simple_tree,
-          SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem *) ),
-          this, SLOT( changeSimplePanel( QListWidgetItem * ) ) );
+         CONNECT( simple_tree,
+                  currentItemChanged( QListWidgetItem *, QListWidgetItem *),
+                  this,  changeSimplePanel( QListWidgetItem * ) );
     }
     tree_panel_l->addWidget( simple_tree );
     simple_tree->show();
@@ -145,10 +147,6 @@ void PrefsDialog::setSmall()
     simple_panel->show();
 }
 
-PrefsDialog::~PrefsDialog()
-{
-}
-
 void PrefsDialog::changeSimplePanel( QListWidgetItem *item )
 {
     int number = item->data( Qt::UserRole ).toInt();
@@ -156,10 +154,10 @@ void PrefsDialog::changeSimplePanel( QListWidgetItem *item )
     {
         main_panel_l->removeWidget( simple_panel );
         simple_panel->hide();
-        /* Don't do this once it works, you would loose all changes */
-        delete simple_panel;
     }
-    simple_panel = new SPrefsPanel( p_intf, main_panel, number );
+    if( !simple_panels[number] )
+        simple_panel = new SPrefsPanel( p_intf, main_panel, number );
+    simple_panels[number] = simple_panel;
     main_panel_l->addWidget( simple_panel );
     simple_panel->show();
 }
@@ -174,7 +172,7 @@ void PrefsDialog::changePanel( QTreeWidgetItem *item )
         advanced_panel->hide();
     }
     if( !data->panel )
-        data->panel = new PrefsPanel( p_intf, main_panel , data, true );
+        data->panel = new PrefsPanel( p_intf, main_panel , data );
 
     advanced_panel = data->panel;
     main_panel_l->addWidget( advanced_panel );
@@ -184,7 +182,10 @@ void PrefsDialog::changePanel( QTreeWidgetItem *item )
 void PrefsDialog::save()
 {
     if( small->isChecked() && simple_tree )
-        simple_tree->applyAll();
+    {
+        for( int i = 0 ; i< SPrefsMax; i++ )
+            if( simple_panels[i] ) simple_panels[i]->apply();
+    }
     else if( all->isChecked() && advanced_tree )
         advanced_tree->applyAll();
     config_SaveConfigFile( p_intf, NULL );
@@ -195,8 +196,8 @@ void PrefsDialog::cancel()
 {
     if( small->isChecked() && simple_tree )
     {
-        simple_tree->cleanAll();
-        simple_panel = NULL;
+        for( int i = 0 ; i< SPrefsMax; i++ )
+            if( simple_panels[i] ) simple_panels[i]->clean();
     }
     else if( all->isChecked() && advanced_tree )
     {
index 8a11c36..06ab224 100644 (file)
@@ -25,6 +25,7 @@
 #define _PREFS_DIALOG_H_
 
 #include "util/qvlcframe.hpp"
+#include "components/simple_preferences.hpp"
 
 class PrefsTree;
 class SPrefsCatList;
@@ -51,7 +52,7 @@ public:
             instance = new PrefsDialog( _p_intf );
         return instance;
     }
-    virtual ~PrefsDialog();
+    virtual ~PrefsDialog() {};
 private:
     PrefsDialog( intf_thread_t * );
 
@@ -59,6 +60,7 @@ private:
     QHBoxLayout *main_panel_l;
     PrefsPanel *advanced_panel;
     SPrefsPanel *simple_panel;
+    SPrefsPanel *simple_panels[SPrefsMax];
 
     QWidget *tree_panel;
     QHBoxLayout *tree_panel_l;
@@ -67,9 +69,6 @@ private:
 
     QGroupBox *types;
     QRadioButton *small,*all;
-#if 0
-    QCheckBox *adv_chk;
-#endif
 
     QGridLayout *main_layout;
 
@@ -81,9 +80,6 @@ private slots:
      void setSmall();
      void save();
      void cancel();
-#if 0
-     void setAdvanced( bool );
-#endif
 };
 
 #endif
index 49546ee..7cd53e1 100644 (file)
  * 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 "qt4.hpp"
+
 #include <QEvent>
+#include <QApplication>
+#include <QSignalMapper>
+#include <QFileDialog>
+
+#include "qt4.hpp"
 #include "dialogs_provider.hpp"
+#include "menus.hpp"
+#include <vlc_intf_strings.h>
+
+/* The dialogs */
 #include "dialogs/playlist.hpp"
 #include "dialogs/prefs_dialog.hpp"
 #include "dialogs/streaminfo.hpp"
 #include "dialogs/messages.hpp"
-#include <QApplication>
-#include <QSignalMapper>
-#include "menus.hpp"
-#include <vlc_intf_strings.h>
-#include <QFileDialog>
 
 DialogsProvider* DialogsProvider::instance = NULL;
 
@@ -41,12 +45,11 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
     fixed_timer->start( 150 /* milliseconds */ );
 
     menusMapper = new QSignalMapper();
-    connect( menusMapper, SIGNAL( mapped(QObject *) ), this,
-            SLOT(menuAction( QObject *)) );
+    CONNECT( menusMapper, mapped(QObject *), this, menuAction( QObject *) );
 
     menusUpdateMapper = new QSignalMapper();
-    connect( menusUpdateMapper, SIGNAL( mapped(QObject *) ), this,
-            SLOT(menuUpdateAction( QObject *)) );
+    CONNECT( menusUpdateMapper, mapped(QObject *),
+             this, menuUpdateAction( QObject *) );
 }
 
 void DialogsProvider::customEvent( QEvent *event )
index 73b7e77..4ef2362 100644 (file)
 #include <QObject>
 #include <QTimer>
 #include <QApplication>
-#include <vlc/vlc.h>
-#include <vlc/intf.h>
+
 #include "dialogs/interaction.hpp"
+
 #include <assert.h>
+#include <vlc/vlc.h>
+#include <vlc/intf.h>
 
 class QEvent;
 class QSignalMapper;
@@ -87,5 +89,4 @@ public slots:
     void quit();
 };
 
-
 #endif
index 195a10f..32e4186 100644 (file)
@@ -23,9 +23,9 @@
 
 #include <assert.h>
 
+#include "qt4.hpp"
 #include "input_manager.hpp"
 #include "dialogs_provider.hpp"
-#include "qt4.hpp"
 
 static int ChangeVideo( vlc_object_t *p_this, const char *var, vlc_value_t o,
                         vlc_value_t n, void *param );
@@ -41,8 +41,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
 {
     i_old_playing_status = END_S;
     p_input = NULL;
-    /* Subscribe to updates */
-    connect( THEDP->fixed_timer, SIGNAL( timeout() ), this, SLOT( update() ) );
+    CONNECT( THEDP->fixed_timer, timeout(), this, update() );
 }
 
 InputManager::~InputManager()
@@ -174,11 +173,10 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL),
     p_input = NULL;
     im = new InputManager( this, p_intf );
     /* Get timer updates */
-    connect( DialogsProvider::getInstance(p_intf)->fixed_timer,
-             SIGNAL(timeout() ), this, SLOT( updateInput() ) );
+    CONNECT( THEDP->fixed_timer, timeout(), this, updateInput() );
     /* Warn our embedded IM about input changes */
-    connect( this, SIGNAL( inputChanged( input_thread_t * ) ),
-             im, SLOT( setInput( input_thread_t * ) ) );
+    CONNECT( this, inputChanged( input_thread_t * ),
+             im,   setInput( input_thread_t * ) );
 }
 
 MainInputManager::~MainInputManager()
@@ -232,6 +230,7 @@ static int ChangeAudio( vlc_object_t *p_this, const char *var, vlc_value_t o,
     InputManager *im = (InputManager*)param;
     im->b_has_audio = true;
 }
+
 static int ChangeVideo( vlc_object_t *p_this, const char *var, vlc_value_t o,
                         vlc_value_t n, void *param )
 {
index 163696b..f055d9b 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include "menus.hpp"
-#include "dialogs_provider.hpp"
-#include "input_manager.hpp"
 #include <QMenu>
 #include <QMenuBar>
 #include <QAction>
 #include <QActionGroup>
 #include <QSignalMapper>
 
+#include "menus.hpp"
+#include "dialogs_provider.hpp"
+#include "input_manager.hpp"
+
 enum
 {
     ITEM_NORMAL,
@@ -167,8 +168,7 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
     objects.push_back( p_intf->i_object_id );
 
     QMenu *menu = Populate( p_intf, current, varnames, objects );
-    connect( menu, SIGNAL( aboutToShow() ),
-             THEDP->menusUpdateMapper, SLOT(map()) );
+    CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() );
     THEDP->menusUpdateMapper->setMapping( menu, 4 );
 
     return menu;
@@ -695,7 +695,7 @@ void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
     }
     MenuItemData *itemData = new MenuItemData( i_object_id, i_val_type,
                                                val, psz_var );
-    connect( action, SIGNAL(triggered()), THEDP->menusMapper, SLOT(map()) );
+    CONNECT( action, triggered(), THEDP->menusMapper, map() );
     THEDP->menusMapper->setMapping( action, itemData );
     menu->addAction( action );
 }
index 58d8441..3223b17 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include <assert.h>
 #include <QIcon>
 #include <QFont>
-#include "qt4.hpp"
+#include <QMenu>
 #include <QApplication>
+
+#include "qt4.hpp"
 #include "playlist_model.hpp"
-#include <assert.h>
-#include <QMenu>
 #include <vlc_intf_strings.h>
 
 #include "pixmaps/type_unknown.xpm"
index 849e0fa..bb7b0bf 100644 (file)
@@ -27,6 +27,7 @@
 #include <QModelIndex>
 #include <QObject>
 #include <QEvent>
+
 #include <vlc/vlc.h>
 #include <vlc/input.h>
 #include <vlc_playlist.h>
index df73c81..824283b 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
 
 #include <QApplication>
+
 #include "qt4.hpp"
 #include "dialogs_provider.hpp"
 #include "input_manager.hpp"
 #include "main_interface.hpp"
+
 #include "../../../share/vlc32x32.xpm"
 
 /*****************************************************************************
index af82343..cf84e50 100644 (file)
@@ -55,6 +55,8 @@ struct intf_sys_t
 #define qtu( i ) i.toUtf8().data()
 #define qta( i ) i.toAscii().data()
 
+#define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) )
+
 static int DialogEvent_Type = QEvent::User + 1;
 
 class DialogEvent : public QEvent