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,
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 );
......
......@@ -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 );
......
......@@ -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;
}
......
......@@ -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();
}
......
......@@ -52,8 +52,8 @@ private:
QCheckBox *stopShowing;
QTextEdit *messages;
public slots:
void onClose();
void onClear();
void close();
void clear();
void dontShow();
};
......
......@@ -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 ) );
}
......
......@@ -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 &&
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -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 * ) );
......
......@@ -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 );
......
......@@ -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 )
......
......@@ -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;
......
......@@ -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 )
......
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