Commit 6523dc21 authored by Clément Stenac's avatar Clément Stenac

Some more cleanup and macros

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