]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist_model.cpp
Qt: remove the zoom slider and put it on the menu
[vlc] / modules / gui / qt4 / components / playlist / playlist_model.cpp
index 113f214ec5e493c3606162030d8928bfe924a3f1..8f5da1847e55040f8cb488d10fa31d28dc263f61 100644 (file)
@@ -380,7 +380,10 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
     {
         return QVariant( QBrush( Qt::gray ) );
     }
-    else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) );
+    else if( role == IsCurrentRole )
+    {
+        return QVariant( isCurrent( index ) );
+    }
     else if( role == IsLeafNodeRole )
     {
         QVariant isLeaf;
@@ -961,13 +964,15 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
     {
         sortingMenu = new QMenu( qtr( "Sort by" ) );
         sortingMapper = new QSignalMapper( this );
-        for( int i = 1, j = 1; i < COLUMN_ALBUM; i <<= 1, j++ )
+        /* Choose what columns to show in sorting menu, not sure if this should be configurable*/
+        QList<int> sortingColumns;
+        sortingColumns << COLUMN_TITLE << COLUMN_ARTIST << COLUMN_ALBUM << COLUMN_TRACK_NUMBER << COLUMN_URI;
+        foreach( int Column, sortingColumns )
         {
-            if( i == COLUMN_NUMBER ) continue;
-            QAction *asc  = sortingMenu->addAction( qfu( psz_column_title( i ) ) + " " + qtr("Ascending") );
-            QAction *desc = sortingMenu->addAction( qfu( psz_column_title( i ) ) + " " + qtr("Descending") );
-            sortingMapper->setMapping( asc, j );
-            sortingMapper->setMapping( desc, -j );
+            QAction *asc  = sortingMenu->addAction( qfu( psz_column_title( Column ) ) + " " + qtr("Ascending") );
+            QAction *desc = sortingMenu->addAction( qfu( psz_column_title( Column ) ) + " " + qtr("Descending") );
+            sortingMapper->setMapping( asc, columnFromMeta(Column) + 1 );
+            sortingMapper->setMapping( desc, -1 * (columnFromMeta(Column)+1) );
             CONNECT( asc, triggered(), sortingMapper, map() );
             CONNECT( desc, triggered(), sortingMapper, map() );
         }
@@ -975,6 +980,12 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
     }
     menu.addMenu( sortingMenu );
 
+    /* Zoom */
+    QMenu *zoomMenu = new QMenu( qtr( "Display size" ) );
+    zoomMenu->addAction( qtr( "Increase" ), this, SLOT( increaseZoom() ) );
+    zoomMenu->addAction( qtr( "Decrease" ), this, SLOT( decreaseZoom() ) );
+    menu.addMenu( zoomMenu );
+
     /* Store the current selected item for popup*() methods */
     current_selection = list;
 
@@ -1101,6 +1112,19 @@ void PLModel::popupSort( int column )
           column > 0 ? Qt::AscendingOrder : Qt::DescendingOrder );
 }
 
+/* */
+void PLModel::increaseZoom()
+{
+    i_zoom++;
+    emit layoutChanged();
+}
+
+void PLModel::decreaseZoom()
+{
+    i_zoom--;
+    emit layoutChanged();
+}
+
 /******************* Drag and Drop helper class ******************/
 PlMimeData::~PlMimeData()
 {