[vlc-devel] commit: Qt4: playlist popup menu enhancement (Jakob Leben )
git version control
git at videolan.org
Tue Nov 3 11:44:42 CET 2009
vlc | branch: master | Jakob Leben <jleben at videolan.org> | Tue Nov 3 11:44:10 2009 +0100| [22da0747adfc2a20fb224d93b38f3ad1a1c97e5b] | committer: Jakob Leben
Qt4: playlist popup menu enhancement
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=22da0747adfc2a20fb224d93b38f3ad1a1c97e5b
---
.../gui/qt4/components/playlist/playlist_model.cpp | 31 ++++++++++---------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index b991e46..1cf0c87 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -959,32 +959,33 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
PL_UNLOCK;
current_selection = list;
- QMenu *menu = new QMenu;
+
+ QMenu menu;
if( i_popup_item > -1 )
{
- menu->addAction( qtr(I_POP_PLAY), this, SLOT( popupPlay() ) );
- menu->addAction( qtr(I_POP_DEL), this, SLOT( popupDel() ) );
- menu->addSeparator();
- menu->addAction( qtr(I_POP_STREAM), this, SLOT( popupStream() ) );
- menu->addAction( qtr(I_POP_SAVE), this, SLOT( popupSave() ) );
- menu->addSeparator();
- menu->addAction( qtr(I_POP_INFO), this, SLOT( popupInfo() ) );
- menu->addSeparator();
- QMenu *sort_menu = menu->addMenu( qtr( "Sort by ") +
+ menu.addAction( qtr(I_POP_PLAY), this, SLOT( popupPlay() ) );
+ menu.addAction( qtr(I_POP_DEL), this, SLOT( popupDel() ) );
+ menu.addSeparator();
+ menu.addAction( qtr(I_POP_STREAM), this, SLOT( popupStream() ) );
+ menu.addAction( qtr(I_POP_SAVE), this, SLOT( popupSave() ) );
+ menu.addSeparator();
+ menu.addAction( qtr(I_POP_INFO), this, SLOT( popupInfo() ) );
+ menu.addSeparator();
+ QMenu *sort_menu = menu.addMenu( qtr( "Sort by ") +
qfu( psz_column_title( columnToMeta( index.column() ) ) ) );
sort_menu->addAction( qtr( "Ascending" ),
this, SLOT( popupSortAsc() ) );
sort_menu->addAction( qtr( "Descending" ),
this, SLOT( popupSortDesc() ) );
}
- if( tree )
- menu->addAction( qtr(I_POP_ADD), this, SLOT( popupAddNode() ) );
+ if( tree && canEdit() )
+ menu.addAction( qtr(I_POP_ADD), this, SLOT( popupAddNode() ) );
if( i_popup_item > -1 )
{
- menu->addSeparator();
- menu->addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
+ menu.addSeparator();
+ menu.addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
}
- menu->popup( point );
+ if( !menu.isEmpty() ) menu.exec( point );
}
void PLModel::popupDel()
More information about the vlc-devel
mailing list