[vlc-commits] Qt4: select what columns to show as sorting selection

Ilkka Ollakka git at videolan.org
Wed Oct 12 22:47:06 CEST 2011


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Oct 12 23:46:20 2011 +0300| [ff1673525fe121ee207218b8d7b7b41e2b349eac] | committer: Ilkka Ollakka

Qt4: select what columns to show as sorting selection

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff1673525fe121ee207218b8d7b7b41e2b349eac
---

 .../gui/qt4/components/playlist/playlist_model.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 113f214..7200cff 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -961,13 +961,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() );
         }



More information about the vlc-commits mailing list