[vlc-commits] commit: Qt: fix the view checked() state in the ViewMenu ( Jean-Baptiste Kempf )
git at videolan.org
git at videolan.org
Thu Oct 28 14:32:22 CEST 2010
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Oct 28 03:59:02 2010 +0200| [465f5a018efce22bcae9b8c515a98232d8b69f5a] | committer: Jean-Baptiste Kempf
Qt: fix the view checked() state in the ViewMenu
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=465f5a018efce22bcae9b8c515a98232d8b69f5a
---
modules/gui/qt4/components/playlist/playlist.cpp | 6 ++++--
modules/gui/qt4/components/playlist/playlist.hpp | 2 ++
.../gui/qt4/components/playlist/standardpanel.cpp | 11 ++++++++++-
.../gui/qt4/components/playlist/standardpanel.hpp | 2 ++
4 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 5ba0aa7..aa17904 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -111,7 +111,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) );
QActionGroup *actionGroup = new QActionGroup( this );
- QAction *viewActions[StandardPLPanel::VIEW_COUNT];
+
for( int i = 0; i < StandardPLPanel::VIEW_COUNT; i++ )
{
viewActions[i] = actionGroup->addAction( viewNames[i] );
@@ -119,6 +119,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
viewSelectionMapper->setMapping( viewActions[i], i );
CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() );
}
+ viewActions[0]->setChecked( true );
QMenu *viewMenu = new QMenu( viewButton );
viewMenu->addActions( actionGroup->actions() );
@@ -223,9 +224,10 @@ void PlaylistWidget::changeView( const QModelIndex& index )
{
searchEdit->clear();
locationBar->setIndex( index );
+ int i = mainView->getViewNumber();
+ viewActions[i]->setChecked(true);
}
-
#include <QSignalMapper>
#include <QMenu>
#include <QPainter>
diff --git a/modules/gui/qt4/components/playlist/playlist.hpp b/modules/gui/qt4/components/playlist/playlist.hpp
index 45d4481..2b02388 100644
--- a/modules/gui/qt4/components/playlist/playlist.hpp
+++ b/modules/gui/qt4/components/playlist/playlist.hpp
@@ -57,6 +57,8 @@ private:
QSplitter *leftSplitter;
StandardPLPanel *mainView;
+ QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
+
LocationBar *locationBar;
SearchLineEdit *searchEdit;
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 57902f7..76af880 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -348,11 +348,20 @@ void StandardPLPanel::showView( int i_view )
}
viewStack->setCurrentWidget( currentView );
- //viewActions[i_view]->setChecked( true );
browseInto();
gotoPlayingItem();
}
+const int StandardPLPanel::getViewNumber()
+{
+ if( currentView == treeView )
+ return TREE_VIEW;
+ else if( currentView == iconView )
+ return ICON_VIEW;
+ else if( currentView == listView )
+ return LIST_VIEW;
+}
+
void StandardPLPanel::cycleViews()
{
if( currentView == iconView )
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index 12a3ba1..5ff4908 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -70,6 +70,8 @@ public:
LIST_VIEW,
VIEW_COUNT };
+ const int getViewNumber();
+
protected:
PLModel *model;
More information about the vlc-commits
mailing list