Commit 507cfc27 authored by Clément Stenac's avatar Clément Stenac

Playlist model

parent 1b87dba7
...@@ -17,6 +17,7 @@ UIH = $(TOUI:%=%.h) ...@@ -17,6 +17,7 @@ UIH = $(TOUI:%=%.h)
TOMOC = main_interface \ TOMOC = main_interface \
dialogs_provider \ dialogs_provider \
input_manager \ input_manager \
playlist_model
dialogs/playlist \ dialogs/playlist \
dialogs/prefs_dialog \ dialogs/prefs_dialog \
dialogs/streaminfo \ dialogs/streaminfo \
...@@ -31,6 +32,7 @@ nodist_SOURCES_qt4 = \ ...@@ -31,6 +32,7 @@ nodist_SOURCES_qt4 = \
main_interface.moc.cpp \ main_interface.moc.cpp \
dialogs_provider.moc.cpp \ dialogs_provider.moc.cpp \
input_manager.moc.cpp \ input_manager.moc.cpp \
playlist_model.moc.cpp \
dialogs/playlist.moc.cpp \ dialogs/playlist.moc.cpp \
dialogs/streaminfo.moc.cpp \ dialogs/streaminfo.moc.cpp \
dialogs/prefs_dialog.moc.cpp \ dialogs/prefs_dialog.moc.cpp \
...@@ -61,6 +63,7 @@ SOURCES_qt4 = qt4.cpp \ ...@@ -61,6 +63,7 @@ SOURCES_qt4 = qt4.cpp \
main_interface.cpp \ main_interface.cpp \
dialogs_provider.cpp \ dialogs_provider.cpp \
input_manager.cpp \ input_manager.cpp \
playlist_model.cpp \
dialogs/playlist.cpp \ dialogs/playlist.cpp \
dialogs/prefs_dialog.cpp \ dialogs/prefs_dialog.cpp \
dialogs/streaminfo.cpp \ dialogs/streaminfo.cpp \
...@@ -76,6 +79,7 @@ EXTRA_DIST += \ ...@@ -76,6 +79,7 @@ EXTRA_DIST += \
main_interface.hpp \ main_interface.hpp \
dialogs_provider.hpp \ dialogs_provider.hpp \
input_manager.hpp \ input_manager.hpp \
playlist_model.hpp \
dialogs/playlist.hpp \ dialogs/playlist.hpp \
dialogs/streaminfo.hpp \ dialogs/streaminfo.hpp \
dialogs/prefs_dialog.hpp \ dialogs/prefs_dialog.hpp \
......
...@@ -43,8 +43,6 @@ private: ...@@ -43,8 +43,6 @@ private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
public slots: public slots:
virtual void sendUpdate() = 0; virtual void sendUpdate() = 0;
signals:
virtual void dataUpdated( QString, QString ) = 0;
}; };
class FileOpenPanel: public OpenPanel class FileOpenPanel: public OpenPanel
...@@ -59,7 +57,7 @@ private: ...@@ -59,7 +57,7 @@ private:
public slots: public slots:
virtual void sendUpdate() ; virtual void sendUpdate() ;
signals: signals:
virtual void dataUpdated( QString, QString ) ; void dataUpdated( QString, QString ) ;
}; };
......
This diff is collapsed.
/*****************************************************************************
* playlist_model.hpp : Model for a playlist tree
****************************************************************************
* Copyright (C) 2000-2005 the VideoLAN team
* $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _PLAYLIST_MODEL_H_
#define _PLAYLIST_MODEL_H_
#include <QObject>
#include <QEvent>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc_playlist.h>
class PLModel;
class PLItem
{
public:
PLItem( int, int, PLItem *parent , PLModel *);
PLItem( playlist_item_t *, PLItem *parent, PLModel *);
~PLItem();
int row() const;
void insertChild( PLItem *, int );
void appendChild( PLItem *item ) { insertChild( item, children.count() ); };
PLItem *child( int row ) { return children.value( row ); };
int childCount() const { return children.count(); };
QString columnString( int col ) { return strings.value( col ); };
PLItem *parent() { return parentItem; };
protected:
QList<PLItem*> children;
int i_id;
int i_input_id;
friend class PLModel;
private:
QList<QString> strings;
PLItem *parentItem;
PLModel *model;
};
static int ItemUpdate_Type = QEvent::User + 2;
static int ItemDelete_Type = QEvent::User + 3;
static int ItemAppend_Type = QEvent::User + 4;
class PLEvent : public QEvent
{
public:
PLEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
{ i_id = id; p_add = NULL; };
PLEvent( playlist_add_t *a ) : QEvent( (QEvent::Type)(ItemAppend_Type) )
{ p_add = a; };
virtual ~PLEvent() {};
int i_id;
playlist_add_t *p_add;
};
#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>
class PLModel : public QAbstractItemModel
{
Q_OBJECT
public:
PLModel( playlist_item_t *, int, QObject *parent = 0);
~PLModel();
void customEvent( QEvent * );
/* QModel stuff */
QVariant data( const QModelIndex &index, int role) const;
Qt::ItemFlags flags( const QModelIndex &index) const;
QVariant headerData( int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index( int r, int c, const QModelIndex &parent ) const;
QModelIndex index( PLItem *, int c ) const;
QModelIndex parent( const QModelIndex &index) const;
int childrenCount( const QModelIndex &parent = QModelIndex() ) const;
bool b_need_update;
int i_items_to_append;
private:
PLItem *rootItem;
playlist_t *p_playlist;
/* Update processing */
void ProcessInputItemUpdate( int i_input_id );
void ProcessItemRemoval( int i_id );
void ProcessItemAppend( playlist_add_t *p_add );
/* Lookups */
PLItem *FindById( PLItem *, int );
PLItem *FindByInput( PLItem *, int );
PLItem *FindInner( PLItem *, int , bool );
PLItem *p_cached_item;
PLItem *p_cached_item_bi;
int i_cached_id;
int i_cached_input_id;
friend class PLItem;
};
#endif
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