Commit 6950dc05 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: further playlistPanel simplifications

This should help a lot the future work.
parent 45202fbe
...@@ -90,7 +90,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -90,7 +90,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
setMinimumWidth( 300 ); setMinimumWidth( 300 );
PLModel *model = new PLModel( p_playlist, p_intf, p_root, this ); PLModel *model = new PLModel( p_playlist, p_intf, p_root, this );
mainView = new StandardPLPanel( this, p_intf, THEPL, p_root, selector, model ); mainView = new StandardPLPanel( this, p_intf, p_root, selector, model );
/* Location Bar */ /* Location Bar */
locationBar = new LocationBar( model ); locationBar = new LocationBar( model );
......
/***************************************************************************** /*****************************************************************************
* standardpanel.cpp : The "standard" playlist panel : just a treeview * standardpanel.cpp : The "standard" playlist panel : just a treeview
**************************************************************************** ****************************************************************************
* Copyright (C) 2000-2009 VideoLAN * Copyright © 2000-2010 VideoLAN
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* JB Kempf <jb@videolan.org> * Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
#include "menus.hpp" /* Popup */ #include "menus.hpp" /* Popup */
#include "input_manager.hpp" /* THEMIM */ #include "input_manager.hpp" /* THEMIM */
#include <vlc_services_discovery.h> /* SD_CMD_SEARCH */ #include "sorting.h" /* Columns order */
#include <vlc_services_discovery.h> /* SD_CMD_SEARCH */
#include <QHeaderView> #include <QHeaderView>
#include <QModelIndexList> #include <QModelIndexList>
...@@ -47,38 +49,28 @@ ...@@ -47,38 +49,28 @@
#include <assert.h> #include <assert.h>
#include "sorting.h"
StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
intf_thread_t *_p_intf, intf_thread_t *_p_intf,
playlist_t *p_playlist,
playlist_item_t *p_root, playlist_item_t *p_root,
PLSelector *_p_selector, PLSelector *_p_selector,
PLModel *_p_model PLModel *_p_model )
): : QWidget( _parent ), p_intf( _p_intf ),
QWidget( _parent ), p_intf( _p_intf ), p_selector( _p_selector ), model( _p_model )
p_selector( _p_selector )
{ {
QGridLayout *layout = new QGridLayout( this ); viewStack = new QStackedLayout( this );
layout->setSpacing( 0 ); layout->setMargin( 0 ); viewStack->setSpacing( 0 ); viewStack->setMargin( 0 );
setMinimumWidth( 300 ); setMinimumWidth( 300 );
iconView = NULL; iconView = NULL;
treeView = NULL; treeView = NULL;
listView = NULL; listView = NULL;
viewStack = new QStackedLayout();
layout->addLayout( viewStack, 1, 0, 1, -1 );
model = _p_model; currentRootIndexId = -1;
currentRootId = -1; lastActivatedId = -1;
currentRootIndexId = -1;
lastActivatedId = -1;
/* Saved Settings */ /* Saved Settings */
getSettings()->beginGroup("Playlist"); getSettings()->beginGroup("Playlist");
int i_viewMode = getSettings()->value( "view-mode", TREE_VIEW ).toInt(); int i_viewMode = getSettings()->value( "view-mode", TREE_VIEW ).toInt();
getSettings()->endGroup(); getSettings()->endGroup();
showView( i_viewMode ); showView( i_viewMode );
...@@ -147,8 +139,7 @@ void StandardPLPanel::popupSelectColumn( QPoint pos ) ...@@ -147,8 +139,7 @@ void StandardPLPanel::popupSelectColumn( QPoint pos )
int i, j; int i, j;
for( i = 1 << 1, j = 1; i < COLUMN_END; i <<= 1, j++ ) for( i = 1 << 1, j = 1; i < COLUMN_END; i <<= 1, j++ )
{ {
QAction* option = menu.addAction( QAction* option = menu.addAction( qfu( psz_column_title( i ) ) );
qfu( psz_column_title( i ) ) );
option->setCheckable( true ); option->setCheckable( true );
option->setChecked( !treeView->isColumnHidden( j ) ); option->setChecked( !treeView->isColumnHidden( j ) );
selectColumnsSigMapper->setMapping( option, j ); selectColumnsSigMapper->setMapping( option, j );
...@@ -267,7 +258,6 @@ void StandardPLPanel::createListView() ...@@ -267,7 +258,6 @@ void StandardPLPanel::createListView()
viewStack->addWidget( listView ); viewStack->addWidget( listView );
} }
void StandardPLPanel::createTreeView() void StandardPLPanel::createTreeView()
{ {
/* Create and configure the QTreeView */ /* Create and configure the QTreeView */
...@@ -326,7 +316,6 @@ void StandardPLPanel::createTreeView() ...@@ -326,7 +316,6 @@ void StandardPLPanel::createTreeView()
CONNECT( selectColumnsSigMapper, mapped( int ), CONNECT( selectColumnsSigMapper, mapped( int ),
this, toggleColumnShown( int ) ); this, toggleColumnShown( int ) );
/* Finish the layout */
viewStack->addWidget( treeView ); viewStack->addWidget( treeView );
} }
...@@ -396,7 +385,6 @@ void StandardPLPanel::activate( const QModelIndex &index ) ...@@ -396,7 +385,6 @@ void StandardPLPanel::activate( const QModelIndex &index )
void StandardPLPanel::browseInto( input_item_t *p_input ) void StandardPLPanel::browseInto( input_item_t *p_input )
{ {
if( p_input->i_id != lastActivatedId ) return; if( p_input->i_id != lastActivatedId ) return;
playlist_Lock( THEPL ); playlist_Lock( THEPL );
...@@ -418,5 +406,4 @@ void StandardPLPanel::browseInto( input_item_t *p_input ) ...@@ -418,5 +406,4 @@ void StandardPLPanel::browseInto( input_item_t *p_input )
browseInto( index ); browseInto( index );
lastActivatedId = -1; lastActivatedId = -1;
} }
...@@ -62,7 +62,7 @@ class StandardPLPanel: public QWidget ...@@ -62,7 +62,7 @@ class StandardPLPanel: public QWidget
public: public:
StandardPLPanel( PlaylistWidget *, intf_thread_t *, StandardPLPanel( PlaylistWidget *, intf_thread_t *,
playlist_t *, playlist_item_t *, PLSelector *, PLModel * ); playlist_item_t *, PLSelector *, PLModel * );
virtual ~StandardPLPanel(); virtual ~StandardPLPanel();
enum { TREE_VIEW = 0, enum { TREE_VIEW = 0,
...@@ -86,7 +86,6 @@ private: ...@@ -86,7 +86,6 @@ private:
QStackedLayout *viewStack; QStackedLayout *viewStack;
int currentRootId;
QSignalMapper *selectColumnsSigMapper; QSignalMapper *selectColumnsSigMapper;
int lastActivatedId; int lastActivatedId;
......
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