]> git.sesse.net Git - vlc/commitdiff
Some more cleanup and macros
authorClément Stenac <zorglub@videolan.org>
Wed, 13 Sep 2006 13:11:42 +0000 (13:11 +0000)
committerClément Stenac <zorglub@videolan.org>
Wed, 13 Sep 2006 13:11:42 +0000 (13:11 +0000)
15 files changed:
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/video_widget.cpp
modules/gui/qt4/dialogs/errors.cpp
modules/gui/qt4/dialogs/errors.hpp
modules/gui/qt4/dialogs/interaction.cpp
modules/gui/qt4/dialogs/messages.cpp
modules/gui/qt4/dialogs/playlist.cpp
modules/gui/qt4/dialogs/prefs_dialog.cpp
modules/gui/qt4/dialogs/streaminfo.cpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/qt4.hpp
modules/gui/qt4/util/input_slider.cpp

index 3c2ec87597b5960bdff461bcc2c456d9521c17e6..347e7c7b4794d472187f1e16f47a73e45278d950 100644 (file)
@@ -38,10 +38,10 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf,
     view->header()->hide();
     view->setModel( model );
 
-    connect( view, SIGNAL( activated( const QModelIndex& ) ),
-             this, SLOT( setSource( const QModelIndex& ) ) );
-    connect( view, SIGNAL( clicked( const QModelIndex& ) ),
-             this, SLOT( setSource( const QModelIndex& ) ) );
+    CONNECT( view, activated( const QModelIndex& ),
+             this, setSource( const QModelIndex& ) );
+    CONNECT( view, clicked( const QModelIndex& ),
+             this, setSource( const QModelIndex& ) );
 
     QVBoxLayout *layout = new QVBoxLayout();
     layout->setSpacing( 0 ); layout->setMargin( 0 );
index e78ce43ac6269a2f13729963564d58fb9e1426cb..cd86ce09f2fde50451466b2a5518e0ef126d0a3f 100644 (file)
@@ -70,25 +70,24 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
     if( model->hasRepeat() ) repeatButton->setText( qtr( "Repeat One" ) );
     else if( model->hasLoop() ) repeatButton->setText( qtr( "Repeat All" ) );
     else repeatButton->setText( qtr( "No Repeat" ) );
-    connect( repeatButton, SIGNAL( clicked() ), this, SLOT( toggleRepeat() ));
+    BUTTONACT( repeatButton, toggleRepeat() );
 
     randomButton = new QPushButton( 0 ); buttons->addWidget( randomButton );
     if( model->hasRandom() ) randomButton->setText( qtr( "Random" ) );
     else randomButton->setText( qtr( "No random" ) );
-    connect( randomButton, SIGNAL( clicked() ), this, SLOT( toggleRandom() ));
+    BUTTONACT( randomButton, toggleRandom() );
 
     QSpacerItem *spacer = new QSpacerItem( 10, 20 );buttons->addItem( spacer );
 
     QLabel *filter = new QLabel( qfu( "&Search:" ) + " " );
     buttons->addWidget( filter );
     searchLine = new  ClickLineEdit( qfu( "Playlist filter" ), 0 );
-    connect( searchLine, SIGNAL( textChanged(QString) ),
-             this, SLOT( search(QString)) );
+    CONNECT( searchLine, textChanged(QString), this, search(QString));
     buttons->addWidget( searchLine ); filter->setBuddy( searchLine );
 
     QPushButton *clear = new QPushButton( qfu( "CL") );
     buttons->addWidget( clear );
-    connect( clear, SIGNAL( clicked() ), this, SLOT( clearFilter() ) );
+    BUTTONACT( clear, clearFilter() );
 
     layout->addWidget( view );
     layout->addLayout( buttons );
index e05d1c0c7fde75fca76293179885dd50513ac3bf..c68a85e478d22a7fccbd202b88f102e062fda3ba 100644 (file)
@@ -52,16 +52,13 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i, bool _always ) : QFrame( NULL ),
 
     setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
 
-    connect( DialogsProvider::getInstance(NULL)->fixed_timer,
-             SIGNAL( timeout() ), this, SLOT( update() ) );
+    ON_TIMEOUT( update() );
 
     if( always )
     {
-       DrawBackground();
-       connect( THEMIM->getIM(), SIGNAL( audioStarted() ),
-                this, SLOT( hasAudio() ) );
-       connect( THEMIM->getIM(), SIGNAL( audioStarted() ),
-                this, SLOT( hasVideo() ) );
+        DrawBackground();
+        CONNECT( THEMIM->getIM(), audioStarted(), this, hasAudio() );
+        CONNECT( THEMIM->getIM(), audioStarted(), this, hasVideo() );
     }
     need_update = false;
 }
index 67bcf76f85e04a065b02eba46075c8baf67c17a8..6b57bbbb1db355fcd19ca9608c87dd73452c27e0 100644 (file)
@@ -51,9 +51,9 @@ ErrorsDialog::ErrorsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
     layout->addWidget( clearButton, 2, 1 );
     layout->addWidget( closeButton, 2, 2 );
 
-    connect( closeButton, SIGNAL( clicked() ), this, SLOT( onClose() ));
-    connect( clearButton, SIGNAL( clicked() ), this, SLOT( onClear() ));
-    connect( stopShowing, SIGNAL( clicked() ), this, SLOT( dontShow() ) );
+    BUTTONACT( closeButton, close() );
+    BUTTONACT( clearButton, clear() );
+    BUTTONACT( stopShowing, dontShow() );
 }
 
 void ErrorsDialog::addError( QString title, QString text )
@@ -78,12 +78,12 @@ void ErrorsDialog::add( bool error, QString title, QString text )
     show();
 }
 
-void ErrorsDialog::onClose()
+void ErrorsDialog::close()
 {
     hide();
 }
 
-void ErrorsDialog::onClear()
+void ErrorsDialog::clear()
 {
     messages->clear();
 }
index 62291407debd9d34458e58a6c89818187544161b..cc23d156a5db16b551cd8cde8d95f17e943be378 100644 (file)
@@ -52,8 +52,8 @@ private:
     QCheckBox *stopShowing;
     QTextEdit *messages;
 public slots:
-    void onClose();
-    void onClear();
+    void close();
+    void clear();
     void dontShow();
 };
 
index 7e59a052b08b8a511f969a3b89809dd03f916d08..8960afbfe67171fb2f618ec3ba1cf2a6a9c54062 100644 (file)
@@ -130,12 +130,11 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
                               &altButton, p_dialog->psz_alternate_button,
                               &otherButton, p_dialog->psz_other_button );
         if( p_dialog->psz_default_button )
-            connect( defaultButton, SIGNAL( clicked() ),
-                     this, SLOT( defaultB() ) );
+            BUTTONACT( defaultButton, defaultB );
         if( p_dialog->psz_alternate_button )
-            connect( altButton, SIGNAL( clicked() ), this, SLOT( altB() ) );
+            BUTTONACT( altButton, altB );
         if( p_dialog->psz_other_button )
-            connect( otherButton, SIGNAL( clicked() ), this, SLOT( otherB() ) );
+            BUTTONACT( otherButton, otherB );
         setLayout( layout );
         setWindowTitle( qfu( p_dialog->psz_title ) );
     }
index 58925e474468bd6aad164b5ddc252b694291dc0c..87c3a8e3cd03e0b88ea7ddd39a0ffdd36081c0c4 100644 (file)
@@ -64,10 +64,10 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
     layout->addWidget(clearButton, 1, 4 );
     layout->addWidget(closeButton, 1, 5 );
 
-    CONNECT( closeButton, clicked(), this, close() );
-    CONNECT( clearButton, clicked(), this, clear() );
-    CONNECT( saveLogButton, clicked(), this, save() );
-    CONNECT( THEDP->fixed_timer, timeout(), this, updateLog() );
+    BUTTONACT( closeButton, close() );
+    BUTTONACT( clearButton, clear() );
+    BUTTONACT( saveLogButton, save() );
+    ON_TIMEOUT( updateLog() );
 }
 
 MessagesDialog::~MessagesDialog()
@@ -90,16 +90,6 @@ void MessagesDialog::updateLog()
                 i_start != i_stop;
                 i_start = (i_start+1) % VLC_MSG_QSIZE )
         {
-          // [FIXME] Does not work as the old one
-          // Outputs too much data ?
-          // if (p_sub->p_msg[i_start].i_type = VLC_MSG_ERR)
-          //          continue;
-          //  if( !b_verbose &&
-          //         VLC_MSG_ERR != p_sub->p_msg[i_start].i_type )
-          //                continue;
-
-            /* Append all messages to log window */
-
             if( p_sub->p_msg[i_start].i_type == VLC_MSG_INFO ||
                 p_sub->p_msg[i_start].i_type == VLC_MSG_ERR ||
                 p_sub->p_msg[i_start].i_type == VLC_MSG_WARN &&
index 4a0b57ee51bc42647b63c3d5e4fb55f07a17cb53..906af51ca8e7cba5c9b20e7254fbe13facea3cda 100644 (file)
@@ -42,8 +42,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     setWindowTitle( qtr( "Playlist" ) );
 
     SDMapper = new QSignalMapper();
-    connect( SDMapper, SIGNAL( mapped (QString)), this,
-             SLOT( SDMenuAction( QString ) ) );
+    CONNECT( SDMapper, mapped (QString), this, SDMenuAction( QString ) );
     createPlMenuBar( menuBar(), p_intf );
 
     selector = new PLSelector( centralWidget(), p_intf, THEPL );
@@ -54,8 +53,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     rightPanel = qobject_cast<PLPanel *>(new StandardPLPanel( centralWidget(),
                               p_intf, THEPL, p_root ) );
-    connect( selector, SIGNAL( activated( int ) ),
-             rightPanel, SLOT( setRoot( int ) ) );
+    CONNECT( selector, activated( int ), rightPanel, setRoot( int ) );
 
     QHBoxLayout *layout = new QHBoxLayout();
     layout->addWidget( selector, 0 );
@@ -126,7 +124,7 @@ QMenu *PlaylistDialog::SDMenu()
             {
                 a->setChecked( true );
             }
-            connect( a , SIGNAL( triggered() ), SDMapper, SLOT( map() ) );
+            CONNECT( a , trigerred(), SDMapper, map() );
             SDMapper->setMapping( a, i>=0? p_parser->pp_shortcuts[i] :
                                             p_parser->psz_object_name );
             menu->addAction( a );
index 67ed860724beeb7f3368696f62f65b8a54bfa907..a1466a1df546448cc658772a8572292826539dfb 100644 (file)
@@ -82,10 +82,10 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
      main_layout->addLayout( buttonsLayout, 2,0, 1 ,3 );
      setLayout( main_layout );
 
-     CONNECT( save, clicked(), this, save() );
-     CONNECT( cancel, clicked(), this, cancel() );
-     CONNECT( small, clicked(), this, setSmall() );
-     CONNECT( all, clicked(), this, setAll() );
+     BUTTONACT( save, save() );
+     BUTTONACT( cancel, cancel() );
+     BUTTONACT( small, setSmall() );
+     BUTTONACT( all, setAll() );
 
      for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
 }
@@ -101,9 +101,9 @@ void PrefsDialog::setAll()
     if( !advanced_tree )
     {
          advanced_tree = new PrefsTree( p_intf, tree_panel );
-         connect( advanced_tree,
-          SIGNAL( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem *) ),
-          this, SLOT( changePanel( QTreeWidgetItem * ) ) );
+         CONNECT( advanced_tree,
+                  currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem *),
+                  this, changePanel( QTreeWidgetItem * ) );
     }
     tree_panel_l->addWidget( advanced_tree );
     advanced_tree->show();
index d672d4bec49ca9bfddc6fc8a40f0185f73a8f7b4..799a572766218b7401dbd62cd0c8803cfa4eed52 100644 (file)
@@ -34,8 +34,7 @@ StreamInfoDialog::StreamInfoDialog( intf_thread_t *_p_intf, bool _main_input ) :
 {
     setWindowTitle( _("Stream information" ) );
     ISP = new InputStatsPanel( this, p_intf );
-    connect( DialogsProvider::getInstance(NULL)->fixed_timer,
-             SIGNAL( timeout() ), this, SLOT(update() ) );
+    ON_TIMEOUT( update() );
     p_input = NULL;
 }
 
index 32e418685022fbbcff506e30d3c32ecc3a3acf92..c4d5579607a763e6ba7363bc2c520267bc1b26ce 100644 (file)
@@ -41,7 +41,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
 {
     i_old_playing_status = END_S;
     p_input = NULL;
-    CONNECT( THEDP->fixed_timer, timeout(), this, update() );
+    ON_TIMEOUT( update() );
 }
 
 InputManager::~InputManager()
@@ -172,8 +172,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL),
 {
     p_input = NULL;
     im = new InputManager( this, p_intf );
-    /* Get timer updates */
-    CONNECT( THEDP->fixed_timer, timeout(), this, updateInput() );
+    ON_TIMEOUT( updateInput() );
     /* Warn our embedded IM about input changes */
     CONNECT( this, inputChanged( input_thread_t * ),
              im,   setInput( input_thread_t * ) );
index 7b270ab739c5ac678c5856c25cd129ddddb367cf..ffe5ee814e8218b6d07ff5db73808e1f8827ee28 100644 (file)
@@ -114,35 +114,26 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /* Init input manager */
     MainInputManager::getInstance( p_intf );
+    ON_TIMEOUT( updateOnTimer() );
 
     /* Volume control */
-    connect( ui.volumeSlider, SIGNAL( valueChanged(int) ),
-             this, SLOT( updateVolume(int) ) );
-
-    /* Get timer updates */
-    connect( THEDP->fixed_timer, SIGNAL( timeout() ),
-             this, SLOT(updateOnTimer() ) );
-
+    CONNECT( ui.volumeSlider, valueChanged(int), this, updateVolume(int) );
     /* Connect the input manager to the GUI elements it manages */
-    connect( THEMIM->getIM(),SIGNAL(positionUpdated( float, int, int ) ),
-             slider, SLOT( setPosition( float,int, int ) ) );
-    connect( THEMIM->getIM(), SIGNAL( positionUpdated( float, int, int ) ),
-             this, SLOT( setDisplay( float, int, int ) ) );
-    connect( THEMIM->getIM(), SIGNAL( nameChanged( QString ) ),
-             this, SLOT( setName( QString ) ) );
-    connect( THEMIM->getIM(), SIGNAL( statusChanged( int ) ),
-             this, SLOT( setStatus( int ) ) );
-    connect( slider, SIGNAL( sliderDragged( float ) ),
-             THEMIM->getIM(),SLOT( sliderUpdate( float ) ) );
+    CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
+             slider, setPosition( float,int, int ) );
+    CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
+             this, setDisplay( float, int, int ) );
+    CONNECT( THEMIM->getIM(), nameChanged( QString ), this,setName( QString ) );
+    CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
+    CONNECT( slider, sliderDragged( float ),
+             THEMIM->getIM(), sliderUpdate( float ) );
 
     /* Actions */
-    connect( ui.playButton, SIGNAL( clicked() ), this, SLOT( play() ) );
-    connect( ui.stopButton, SIGNAL( clicked() ), this, SLOT( stop() ) );
-    connect( ui.nextButton, SIGNAL( clicked() ), this, SLOT( next() ) );
-    connect( ui.prevButton, SIGNAL( clicked() ), this, SLOT( prev() ) );
-
-    connect( ui.playlistButton, SIGNAL(clicked()),
-             THEDP, SLOT( playlistDialog() ) );
+    BUTTONACT( ui.playButton, play() );
+    BUTTONACT( ui.stopButton, stop() );
+    BUTTONACT( ui.nextButton, next() );
+    BUTTONACT( ui.prevButton, prev() );
+    CONNECT( ui.playlistButton, clicked(), THEDP, playlistDialog() );
 
     var_Create( p_intf, "interaction", VLC_VAR_ADDRESS );
     var_AddCallback( p_intf, "interaction", InteractCallback, this );
index f055d9b4857131807d36471c1a7c438562832575..be3f2ecc8d3e0bb88da611b68652efa9967ce42b 100644 (file)
@@ -114,8 +114,7 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object,
 #define BAR_DADD( func, title, id ) { \
     QMenu *menu = func; menu->setTitle( title  ); bar->addMenu( menu ); \
     MenuFunc *f = new MenuFunc( menu, id ); \
-    connect( menu, SIGNAL( aboutToShow() ), \
-            THEDP->menusUpdateMapper, SLOT(map()) ); \
+    CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
     THEDP->menusUpdateMapper->setMapping( menu, f ); }
 
 void QVLCMenu::createMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
index cf84e50c15b930f09e60e9498f33a68770247fc3..aa8047068206382f2e2fc31369a1363ee57728c3 100644 (file)
@@ -56,6 +56,8 @@ struct intf_sys_t
 #define qta( i ) i.toAscii().data()
 
 #define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) )
+#define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
+#define ON_TIMEOUT( act ) CONNECT( THEDP->fixed_timer, timeout, this, act )
 
 static int DialogEvent_Type = QEvent::User + 1;
 
index 72bb55311c1983ceff5c470803df12f0fb995e25..f48474b9cf5b0409fecbdcdb08487cbaebb9c3a9 100644 (file)
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include "qt4.hpp"
 #include "util/input_slider.hpp"
 
 InputSlider::InputSlider( QWidget *_parent ) : DirectSlider( _parent )
@@ -37,7 +38,7 @@ InputSlider::InputSlider( Qt::Orientation q,QWidget *_parent ) :
     setSingleStep( 2 );
     setPageStep( 10 );
     setTracking( true );
-    connect( this, SIGNAL( valueChanged(int) ), this, SLOT( userDrag( int ) ) );
+    CONNECT( this, valueChanged(int), this, userDrag( int ) );
 }
 
 void InputSlider::setPosition( float pos, int a, int b )