[vlc-devel] commit: qt4: access visible playlist column selector menu from general playlist popup menu (Jakob Leben )

git version control git at videolan.org
Sat Aug 29 10:30:47 CEST 2009


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Sat Aug 29 10:28:24 2009 +0200| [30d40eace3aed65e0bda0d0db21e7404c54f0572] | committer: Jakob Leben 

qt4: access visible playlist column selector menu from general playlist popup menu

This fixes the issue that it was not possible to get any column back once all had been hidden

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

 .../gui/qt4/components/playlist/playlist_model.cpp |   21 ++++++++++++++++++++
 .../gui/qt4/components/playlist/playlist_model.hpp |    2 +
 .../gui/qt4/components/playlist/standardpanel.cpp  |   15 +-------------
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 52cfc76..62704e7 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -102,11 +102,14 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
     ADD_ICON( NODE, ":/type/node" );
 #undef ADD_ICON
 
+    ContextUpdateMapper = new QSignalMapper(this);
+
     rebuild( p_root );
     CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
             this, processInputItemUpdate( input_item_t *) );
     CONNECT( THEMIM, inputChanged( input_thread_t * ),
             this, processInputItemUpdate( input_thread_t* ) );
+    CONNECT( ContextUpdateMapper, mapped( int ),  this, toggleColumnShown( int ) );
 }
 
 PLModel::~PLModel()
@@ -1041,9 +1044,27 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
         menu->addSeparator();
         menu->addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
     }
+    if( tree || i_popup_item > -1 )
+        menu->addSeparator();
+    QMenu *col_selector = menu->addMenu( qtr( "Visible columns" ) );
+    makeColumnSelectMenu( col_selector );
     menu->popup( point );
 }
 
+void PLModel::makeColumnSelectMenu( QMenu *menu )
+{
+    int i_column = 1;
+    for( i_column = 1; i_column != COLUMN_END; i_column<<=1 )
+    {
+        QAction* option = menu->addAction(
+            qfu( psz_column_title( i_column ) ) );
+        option->setCheckable( true );
+        option->setChecked( shownFlags() & i_column );
+        ContextUpdateMapper->setMapping( option, i_column );
+        CONNECT( option, triggered(), ContextUpdateMapper, map() );
+    }
+}
+
 void PLModel::toggleColumnShown( int meta )
 {
     assert( meta );
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index c8d5da0..a103116 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -128,6 +128,8 @@ public:
     void removeItem( int );
     void rebuild(); void rebuild( playlist_item_t * );
 
+    /* Helpers */
+    void makeColumnSelectMenu( QMenu *menu );
 private:
 
     /* General */
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 18d6886..770d0c4 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -308,22 +308,9 @@ void StandardPLPanel::checkSortingIndicator( int meta )
 
 void StandardPLPanel::popupSelectColumn( QPoint pos )
 {
-    ContextUpdateMapper = new QSignalMapper(this);
-
     QMenu selectColMenu;
 
-    int i_column = 1;
-    for( i_column = 1; i_column != COLUMN_END; i_column<<=1 )
-    {
-        QAction* option = selectColMenu.addAction(
-            qfu( psz_column_title( i_column ) ) );
-        option->setCheckable( true );
-        option->setChecked( model->shownFlags() & i_column );
-        ContextUpdateMapper->setMapping( option, i_column );
-        CONNECT( option, triggered(), ContextUpdateMapper, map() );
-    }
-
-    CONNECT( ContextUpdateMapper, mapped( int ),  model, toggleColumnShown( int ) );
+    model->makeColumnSelectMenu( &selectColMenu );
 
     selectColMenu.exec( QCursor::pos() );
 }




More information about the vlc-devel mailing list