Commit 465f5a01 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: fix the view checked() state in the ViewMenu

parent 6950dc05
...@@ -111,7 +111,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -111,7 +111,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) ); CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) );
QActionGroup *actionGroup = new QActionGroup( this ); QActionGroup *actionGroup = new QActionGroup( this );
QAction *viewActions[StandardPLPanel::VIEW_COUNT];
for( int i = 0; i < StandardPLPanel::VIEW_COUNT; i++ ) for( int i = 0; i < StandardPLPanel::VIEW_COUNT; i++ )
{ {
viewActions[i] = actionGroup->addAction( viewNames[i] ); viewActions[i] = actionGroup->addAction( viewNames[i] );
...@@ -119,6 +119,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -119,6 +119,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
viewSelectionMapper->setMapping( viewActions[i], i ); viewSelectionMapper->setMapping( viewActions[i], i );
CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() ); CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() );
} }
viewActions[0]->setChecked( true );
QMenu *viewMenu = new QMenu( viewButton ); QMenu *viewMenu = new QMenu( viewButton );
viewMenu->addActions( actionGroup->actions() ); viewMenu->addActions( actionGroup->actions() );
...@@ -223,9 +224,10 @@ void PlaylistWidget::changeView( const QModelIndex& index ) ...@@ -223,9 +224,10 @@ void PlaylistWidget::changeView( const QModelIndex& index )
{ {
searchEdit->clear(); searchEdit->clear();
locationBar->setIndex( index ); locationBar->setIndex( index );
int i = mainView->getViewNumber();
viewActions[i]->setChecked(true);
} }
#include <QSignalMapper> #include <QSignalMapper>
#include <QMenu> #include <QMenu>
#include <QPainter> #include <QPainter>
......
...@@ -57,6 +57,8 @@ private: ...@@ -57,6 +57,8 @@ private:
QSplitter *leftSplitter; QSplitter *leftSplitter;
StandardPLPanel *mainView; StandardPLPanel *mainView;
QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
LocationBar *locationBar; LocationBar *locationBar;
SearchLineEdit *searchEdit; SearchLineEdit *searchEdit;
......
...@@ -348,11 +348,20 @@ void StandardPLPanel::showView( int i_view ) ...@@ -348,11 +348,20 @@ void StandardPLPanel::showView( int i_view )
} }
viewStack->setCurrentWidget( currentView ); viewStack->setCurrentWidget( currentView );
//viewActions[i_view]->setChecked( true );
browseInto(); browseInto();
gotoPlayingItem(); 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() void StandardPLPanel::cycleViews()
{ {
if( currentView == iconView ) if( currentView == iconView )
......
...@@ -70,6 +70,8 @@ public: ...@@ -70,6 +70,8 @@ public:
LIST_VIEW, LIST_VIEW,
VIEW_COUNT }; VIEW_COUNT };
const int getViewNumber();
protected: protected:
PLModel *model; PLModel *model;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment