Commit 64119e13 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: MLModel creation and assignation

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 9a68967d
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "components/playlist/standardpanel.hpp" /* MainView */ #include "components/playlist/standardpanel.hpp" /* MainView */
#include "components/playlist/selector.hpp" /* PLSelector */ #include "components/playlist/selector.hpp" /* PLSelector */
#include "components/playlist/playlist_model.hpp" /* PLModel */ #include "components/playlist/playlist_model.hpp" /* PLModel */
#include "components/playlist/ml_model.hpp" /* MLModel */
#include "components/interface_widgets.hpp" /* CoverArtLabel */ #include "components/interface_widgets.hpp" /* CoverArtLabel */
#include "util/searchlineedit.hpp" #include "util/searchlineedit.hpp"
...@@ -93,7 +94,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -93,7 +94,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
setMinimumWidth( 400 ); setMinimumWidth( 400 );
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, p_root, selector, model ); MLModel *mlmodel = new MLModel( p_intf, this );
mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel );
/* Location Bar */ /* Location Bar */
locationBar = new LocationBar( model ); locationBar = new LocationBar( model );
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "components/playlist/standardpanel.hpp" #include "components/playlist/standardpanel.hpp"
#include "components/playlist/playlist_model.hpp" /* PLModel */ #include "components/playlist/playlist_model.hpp" /* PLModel */
#include "components/playlist/ml_model.hpp" /* MLModel */
#include "components/playlist/views.hpp" /* 3 views */ #include "components/playlist/views.hpp" /* 3 views */
#include "components/playlist/selector.hpp" /* PLSelector */ #include "components/playlist/selector.hpp" /* PLSelector */
#include "menus.hpp" /* Popup */ #include "menus.hpp" /* Popup */
...@@ -53,9 +54,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -53,9 +54,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
intf_thread_t *_p_intf, intf_thread_t *_p_intf,
playlist_item_t *p_root, playlist_item_t *p_root,
PLSelector *_p_selector, PLSelector *_p_selector,
PLModel *_p_model ) PLModel *_p_model,
MLModel *_p_plmodel)
: QWidget( _parent ), p_intf( _p_intf ), : QWidget( _parent ), p_intf( _p_intf ),
p_selector( _p_selector ), model( _p_model ) p_selector( _p_selector ), model( _p_model ),
mlmodel( _p_plmodel)
{ {
viewStack = new QStackedLayout( this ); viewStack = new QStackedLayout( this );
viewStack->setSpacing( 0 ); viewStack->setMargin( 0 ); viewStack->setSpacing( 0 ); viewStack->setMargin( 0 );
...@@ -191,10 +194,18 @@ void StandardPLPanel::searchDelayed( const QString& searchText ) ...@@ -191,10 +194,18 @@ void StandardPLPanel::searchDelayed( const QString& searchText )
/* This activated by the selector selection */ /* This activated by the selector selection */
void StandardPLPanel::setRoot( playlist_item_t *p_item, bool b ) void StandardPLPanel::setRoot( playlist_item_t *p_item, bool b )
{ {
if( b ) //SQLML if( b )
return; {
msg_Dbg( p_intf, "Setting the SQL ML" );
currentView->setModel( mlmodel );
}
else
{
msg_Dbg( p_intf, "Normal PL/ML or SD" );
if( currentView->model() != model )
currentView->setModel( model );
model->rebuild( p_item ); model->rebuild( p_item );
}
} }
void StandardPLPanel::browseInto( const QModelIndex &index ) void StandardPLPanel::browseInto( const QModelIndex &index )
...@@ -409,6 +420,8 @@ void StandardPLPanel::cycleViews() ...@@ -409,6 +420,8 @@ void StandardPLPanel::cycleViews()
void StandardPLPanel::activate( const QModelIndex &index ) void StandardPLPanel::activate( const QModelIndex &index )
{ {
if( currentView->model() == model )
{
/* If we are not a leaf node */ /* If we are not a leaf node */
if( !index.data( PLModel::IsLeafNodeRole ).toBool() ) if( !index.data( PLModel::IsLeafNodeRole ).toBool() )
{ {
...@@ -424,6 +437,7 @@ void StandardPLPanel::activate( const QModelIndex &index ) ...@@ -424,6 +437,7 @@ void StandardPLPanel::activate( const QModelIndex &index )
playlist_Unlock( THEPL ); playlist_Unlock( THEPL );
model->activateItem( index ); model->activateItem( index );
} }
}
} }
void StandardPLPanel::browseInto( input_item_t *p_input ) void StandardPLPanel::browseInto( input_item_t *p_input )
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
class QSignalMapper; class QSignalMapper;
class PLModel; class PLModel;
class MLModel;
class QKeyEvent; class QKeyEvent;
class QWheelEvent; class QWheelEvent;
class QStackedLayout; class QStackedLayout;
...@@ -58,7 +59,7 @@ class StandardPLPanel: public QWidget ...@@ -58,7 +59,7 @@ class StandardPLPanel: public QWidget
public: public:
StandardPLPanel( PlaylistWidget *, intf_thread_t *, StandardPLPanel( PlaylistWidget *, intf_thread_t *,
playlist_item_t *, PLSelector *, PLModel * ); playlist_item_t *, PLSelector *, PLModel *, MLModel * );
virtual ~StandardPLPanel(); virtual ~StandardPLPanel();
enum { ICON_VIEW = 0, enum { ICON_VIEW = 0,
...@@ -72,6 +73,7 @@ public: ...@@ -72,6 +73,7 @@ public:
protected: protected:
PLModel *model; PLModel *model;
MLModel *mlmodel;
virtual void wheelEvent( QWheelEvent *e ); virtual void wheelEvent( QWheelEvent *e );
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
......
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