1 /*****************************************************************************
2 * vlc_model.hpp : base for playlist and ml model
3 ****************************************************************************
4 * Copyright (C) 2010 the VideoLAN team and AUTHORS
7 * Authors: Srikanth Raju <srikiraju#gmail#com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
34 #include <vlc_input.h>
36 #include <QModelIndex>
37 #include <QPixmapCache>
39 #include <QAbstractItemModel>
42 class VLCModel : public QAbstractItemModel
47 IsCurrentRole = Qt::UserRole,
49 IsCurrentsParentNodeRole
52 VLCModel( intf_thread_t *_p_intf, QObject *parent = 0 );
53 virtual int itemId( const QModelIndex & ) const = 0;
54 virtual QModelIndex currentIndex() const = 0;
55 virtual bool popup( const QModelIndex & index,
56 const QPoint &point, const QModelIndexList &list ) = 0;
57 virtual void doDelete( QModelIndexList ) = 0;
59 static QString getMeta( const QModelIndex & index, int meta );
60 static QPixmap getArtPixmap( const QModelIndex & index, const QSize & size );
62 static int columnToMeta( int _column )
64 int meta = 1, column = 0;
66 while( column != _column && meta != COLUMN_END )
75 static int columnFromMeta( int meta_col )
77 int meta = 1, column = 0;
79 while( meta != meta_col && meta != COLUMN_END )
89 virtual void activateItem( const QModelIndex &index ) = 0;
92 intf_thread_t *p_intf;