Commit e51eb917 authored by Srikanth Raju's avatar Srikanth Raju

Qt/ML: VLC Model

Base parent model for playlist
parent 0dff66f4
...@@ -59,6 +59,7 @@ nodist_SOURCES_qt4 = \ ...@@ -59,6 +59,7 @@ nodist_SOURCES_qt4 = \
components/epg/EPGView.moc.cpp \ components/epg/EPGView.moc.cpp \
components/epg/EPGWidget.moc.cpp \ components/epg/EPGWidget.moc.cpp \
components/playlist/views.moc.cpp \ components/playlist/views.moc.cpp \
components/playlist/vlc_model.moc.cpp \
components/playlist/playlist_model.moc.cpp \ components/playlist/playlist_model.moc.cpp \
components/playlist/playlist.moc.cpp \ components/playlist/playlist.moc.cpp \
components/playlist/standardpanel.moc.cpp \ components/playlist/standardpanel.moc.cpp \
...@@ -275,6 +276,7 @@ SOURCES_qt4 = qt4.cpp \ ...@@ -275,6 +276,7 @@ SOURCES_qt4 = qt4.cpp \
components/epg/EPGView.cpp \ components/epg/EPGView.cpp \
components/epg/EPGWidget.cpp \ components/epg/EPGWidget.cpp \
components/playlist/views.cpp \ components/playlist/views.cpp \
components/playlist/vlc_model.cpp \
components/playlist/playlist_model.cpp \ components/playlist/playlist_model.cpp \
components/playlist/playlist_item.cpp \ components/playlist/playlist_item.cpp \
components/playlist/standardpanel.cpp \ components/playlist/standardpanel.cpp \
...@@ -341,6 +343,7 @@ noinst_HEADERS = \ ...@@ -341,6 +343,7 @@ noinst_HEADERS = \
components/epg/EPGView.hpp \ components/epg/EPGView.hpp \
components/epg/EPGWidget.hpp \ components/epg/EPGWidget.hpp \
components/playlist/views.hpp \ components/playlist/views.hpp \
components/playlist/vlc_model.hpp \
components/playlist/playlist_model.hpp \ components/playlist/playlist_model.hpp \
components/playlist/playlist_item.hpp \ components/playlist/playlist_item.hpp \
components/playlist/standardpanel.hpp \ components/playlist/standardpanel.hpp \
......
/*****************************************************************************
* vlc_model.cpp : base for playlist and ml model
****************************************************************************
* Copyright (C) 2010 the VideoLAN team and AUTHORS
* $Id$
*
* Authors: Srikanth Raju <srikiraju#gmail#com>
*
* 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.
*****************************************************************************/
#include "vlc_model.hpp"
VLCModel::VLCModel( intf_thread_t *_p_intf, QObject *parent )
: p_intf(_p_intf), QAbstractItemModel( parent )
{
}
VLCModel::~VLCModel()
{
}
/*****************************************************************************
* vlc_model.hpp : base for playlist and ml model
****************************************************************************
* Copyright (C) 2010 the VideoLAN team and AUTHORS
* $Id$
*
* Authors: Srikanth Raju <srikiraju#gmail#com>
*
* 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 _VLC_MODEL_H_
#define _VLC_MODEL_H_
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "qt4.hpp"
#include "sorting.h"
#include <vlc_input.h>
#include <QModelIndex>
#include <QAbstractItemModel>
class VLCModel : public QAbstractItemModel
{
Q_OBJECT
public:
enum {
IsCurrentRole = Qt::UserRole,
IsLeafNodeRole,
IsCurrentsParentNodeRole
};
VLCModel( intf_thread_t *_p_intf, QObject *parent = 0 );
virtual int getId( QModelIndex index ) const = 0;
virtual QModelIndex currentIndex() const = 0;
virtual bool popup( const QModelIndex & index,
const QPoint &point, const QModelIndexList &list ) = 0;
virtual ~VLCModel();
public slots:
virtual void activateItem( const QModelIndex &index ) = 0;
protected:
intf_thread_t *p_intf;
};
static int columnToMeta( int _column )
{
int meta = 1;
int column = 0;
while( column != _column && meta != COLUMN_END )
{
meta <<= 1;
column++;
}
return meta;
}
static int columnFromMeta( int meta_col )
{
int meta = 1;
int column = 0;
while( meta != meta_col && meta != COLUMN_END )
{
meta <<= 1;
column++;
}
return column;
}
#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