]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/standardpanel.cpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / qt4 / components / playlist / standardpanel.cpp
index a9f7aa092cde0b3c209a6ea163df6db1669a0c4a..d80f965e61e96044725792ebccfb708dd44e4c84 100644 (file)
@@ -50,33 +50,33 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
                                   PLPanel( _parent, _p_intf )
 {
     model = new PLModel( p_playlist, p_intf, p_root, -1, this );
-    
     /* Create and configure the QTreeView */
     view = new QVLCTreeView( 0 );
     view->setModel(model);
     view->setIconSize( QSize(20,20) );
     view->setAlternatingRowColors( true );
-    view->setAnimated( true ); 
-    view->setSortingEnabled( true );   
+    view->setAnimated( true );
+    view->setSortingEnabled( true );    
     view->setSelectionMode( QAbstractItemView::ExtendedSelection );
     view->setDragEnabled( true );
     view->setAcceptDrops( true );
     view->setDropIndicatorShown( true );
     view->setAutoScroll( true );
-    
     view->header()->resizeSection( 0, 230 );
     view->header()->resizeSection( 1, 170 );
     view->header()->setSortIndicatorShown( true );
     view->header()->setClickable( true );
-       view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
-        
+    view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
     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& ) );
-       CONNECT( view->header(), customContextMenuRequested( const QPoint & ),
+    CONNECT( view->header(), customContextMenuRequested( const QPoint & ),
              this, popupSelectColumn( QPoint ) );
 
     currentRootId = -1;
@@ -87,22 +87,26 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
 
     /* Buttons configuration */
     QHBoxLayout *buttons = new QHBoxLayout();
-    
-    addButton = new QPushButton( "+", this );
+    addButton = new QPushButton( QIcon( ":/pixmaps/vlc_playlist_add.png" ), "", this );
     addButton->setMaximumWidth( 25 );
-    BUTTONACT( addButton, add() );
+    BUTTONACT( addButton, popupAdd() );
     buttons->addWidget( addButton );
 
-    repeatButton = new QPushButton( this ); 
-    if( model->hasRepeat() ) repeatButton->setText( qtr( I_PL_REPEAT ) );
-    else if( model->hasLoop() ) repeatButton->setText( qtr( I_PL_LOOP ) );
-    else repeatButton->setText( qtr( I_PL_NOREPEAT ) );
+    repeatButton = new QPushButton( this );
+    if( model->hasRepeat() ) repeatButton->setIcon(
+                        QIcon( ":/pixmaps/vlc_playlist_repeat_one.png" ) );
+    else if( model->hasLoop() ) repeatButton->setIcon(
+                        QIcon( ":/pixmaps/vlc_playlist_repeat_all.png" ) );
+    else repeatButton->setIcon(
+                        QIcon( ":/pixmaps/vlc_playlist_repeat_off.png" ) );
     BUTTONACT( repeatButton, toggleRepeat() );
     buttons->addWidget( repeatButton );
 
-    randomButton = new QPushButton( this ); 
-    randomButton->setText( model->hasRandom() ? qtr( I_PL_RANDOM )
-                                              : qtr( I_PL_NORANDOM) );
+    randomButton = new QPushButton( this );
+    randomButton->setIcon( model->hasRandom() ?
+                            QIcon( ":/pixmaps/vlc_playlist_shuffle_on.png" ) :
+                            QIcon( ":/pixmaps/vlc_playlist_shuffle_off.png" ) );
     BUTTONACT( randomButton, toggleRandom() );
     buttons->addWidget( randomButton );
 
@@ -131,17 +135,17 @@ void StandardPLPanel::toggleRepeat()
     if( model->hasRepeat() )
     {
         model->setRepeat( false ); model->setLoop( true );
-        repeatButton->setText( qtr(I_PL_LOOP) );
+        repeatButton->setIcon( QIcon( ":/pixmaps/vlc_playlist_repeat_all.png" ) );
     }
     else if( model->hasLoop() )
     {
         model->setRepeat( false ) ; model->setLoop( false );
-        repeatButton->setText( qtr(I_PL_NOREPEAT) );
+        repeatButton->setIcon( QIcon( ":/pixmaps/vlc_playlist_repeat_off.png" ) );
     }
     else
     {
         model->setRepeat( true );
-        repeatButton->setText( qtr(I_PL_REPEAT) );
+        repeatButton->setIcon( QIcon( ":/pixmaps/vlc_playlist_repeat_one.png" ) );
     }
 }
 
@@ -149,7 +153,9 @@ void StandardPLPanel::toggleRandom()
 {
     bool prev = model->hasRandom();
     model->setRandom( !prev );
-    randomButton->setText( prev ? qtr(I_PL_NORANDOM) : qtr(I_PL_RANDOM) );
+    randomButton->setIcon( prev ?
+                QIcon( ":/pixmaps/vlc_playlist_shuffle_off.png" ) :
+                QIcon( ":/pixmaps/vlc_playlist_shuffle_on.png" ) );
 }
 
 void StandardPLPanel::handleExpansion( const QModelIndex &index )
@@ -186,34 +192,34 @@ void StandardPLPanel::setCurrentRootId( int _new )
         addButton->setEnabled( false );
 }
 
-void StandardPLPanel::add()
+void StandardPLPanel::popupAdd()
 {
-    QMenu *popup = new QMenu();
+    QMenu popup;
     if( currentRootId == THEPL->p_local_category->i_id ||
         currentRootId == THEPL->p_local_onelevel->i_id )
     {
-        popup->addAction( qtr(I_PL_ADDF), THEDP, SLOT(simplePLAppendDialog()));
-        popup->addAction( qtr(I_PL_ADVADD), THEDP, SLOT(PLAppendDialog()) );
-        popup->addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( PLAppendDir()) );
+        popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(simplePLAppendDialog()));
+        popup.addAction( qtr(I_PL_ADVADD), THEDP, SLOT(PLAppendDialog()) );
+        popup.addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( PLAppendDir()) );
     }
     else if( currentRootId == THEPL->p_ml_category->i_id ||
              currentRootId == THEPL->p_ml_onelevel->i_id )
     {
-        popup->addAction( qtr(I_PL_ADDF), THEDP, SLOT(simpleMLAppendDialog()));
-        popup->addAction( qtr(I_PL_ADVADD), THEDP, SLOT( MLAppendDialog() ) );
-        popup->addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( MLAppendDir() ) );
+        popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(simpleMLAppendDialog()));
+        popup.addAction( qtr(I_PL_ADVADD), THEDP, SLOT( MLAppendDialog() ) );
+        popup.addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( MLAppendDir() ) );
     }
-    popup->popup( QCursor::pos() );
+    popup.exec( QCursor::pos() );
 }
 
 void StandardPLPanel::popupSelectColumn( QPoint )
-{     
+{
     ContextUpdateMapper = new QSignalMapper(this);
 
-    QMenu *selectColMenu = new QMenu( qtr("Show columns") );
+    QMenu selectColMenu;
 
 #define ADD_META_ACTION( meta ) { \
-   QAction* option = selectColMenu->addAction( qfu(VLC_META_##meta) );     \
+   QAction* option = selectColMenu.addAction( qfu(VLC_META_##meta) );     \
    option->setCheckable( true );                                           \
    option->setChecked( model->shownFlags() & VLC_META_ENGINE_##meta );   \
    ContextUpdateMapper->setMapping( option, VLC_META_ENGINE_##meta );      \
@@ -231,8 +237,8 @@ void StandardPLPanel::popupSelectColumn( QPoint )
     ADD_META_ACTION( DESCRIPTION );
 
 #undef ADD_META_ACTION
-    
-    selectColMenu->popup( QCursor::pos() );
+    selectColMenu.exec( QCursor::pos() );
  }
 
 void StandardPLPanel::clearFilter()