vlc | branch: master | Francois Cartegnie <[email protected]> | Sat Aug 18 21:52:08 2012 +0200| [5e674f08d6604c7c160f06c78efb705277668d13] | committer: Francois Cartegnie
Qt: BookMarks dialog: correctly handle deleting selection > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e674f08d6604c7c160f06c78efb705277668d13 --- modules/gui/qt4/dialogs/bookmarks.cpp | 22 ++++++++++++++++++---- modules/gui/qt4/dialogs/bookmarks.hpp | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/modules/gui/qt4/dialogs/bookmarks.cpp b/modules/gui/qt4/dialogs/bookmarks.cpp index 718a995..4867c88 100644 --- a/modules/gui/qt4/dialogs/bookmarks.cpp +++ b/modules/gui/qt4/dialogs/bookmarks.cpp @@ -31,9 +31,11 @@ #include <QSpacerItem> #include <QPushButton> #include <QDialogButtonBox> +#include <QModelIndexList> BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf ) { + b_ignore_updates = false; setWindowFlags( Qt::Tool ); setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) ); setWindowTitle( qtr( "Edit Bookmarks" ) ); @@ -118,6 +120,7 @@ void BookmarksDialog::updateButtons() void BookmarksDialog::update() { + if ( b_ignore_updates ) return; input_thread_t *p_input = THEMIM->getInput(); if( !p_input ) return; @@ -176,11 +179,22 @@ void BookmarksDialog::del() input_thread_t *p_input = THEMIM->getInput(); if( !p_input ) return; - int i_focused = bookmarksList->currentIndex().row(); - - if( i_focused >= 0 ) + QModelIndexList selected = bookmarksList->selectionModel()->selectedIndexes(); + if ( !selected.empty() ) { - input_Control( p_input, INPUT_DEL_BOOKMARK, i_focused ); + b_ignore_updates = true; + QModelIndexList::Iterator it = selected.end(); + for( --it; it != selected.begin(); it-- ) + { + /* FIXME: Find out why selectedIndexes() doesn't follow the + SelectRows selectionBehavior() and returns all columns */ + if ( (*it).column() == 0 ) + input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() ); + } + if ( (*it).column() == 0 ) + input_Control( p_input, INPUT_DEL_BOOKMARK, (*it).row() ); + b_ignore_updates = false; + update(); } } diff --git a/modules/gui/qt4/dialogs/bookmarks.hpp b/modules/gui/qt4/dialogs/bookmarks.hpp index db46e00..ad81bc2 100644 --- a/modules/gui/qt4/dialogs/bookmarks.hpp +++ b/modules/gui/qt4/dialogs/bookmarks.hpp @@ -42,6 +42,7 @@ private: QTreeWidget *bookmarksList; QPushButton *clearButton; QPushButton *delButton; + bool b_ignore_updates; private slots: void update(); _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
