Qt: fix a warning in the playlist models
[vlc/vlc-skelet.git] / modules / gui / qt4 / components / playlist / vlc_model.hpp
blob450616927801746bbaf96fe1c3af8c6c87dfe40b
1 /*****************************************************************************
2 * vlc_model.hpp : base for playlist and ml model
3 ****************************************************************************
4 * Copyright (C) 2010 the VideoLAN team and AUTHORS
5 * $Id$
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 *****************************************************************************/
24 #ifndef _VLC_MODEL_H_
25 #define _VLC_MODEL_H_
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
31 #include "qt4.hpp"
32 #include "sorting.h"
34 #include <vlc_input.h>
36 #include <QModelIndex>
37 #include <QPixmapCache>
38 #include <QSize>
39 #include <QAbstractItemModel>
42 class VLCModel : public QAbstractItemModel
44 Q_OBJECT
45 public:
46 enum {
47 IsCurrentRole = Qt::UserRole,
48 IsLeafNodeRole,
49 IsCurrentsParentNodeRole
52 VLCModel( intf_thread_t *_p_intf, QObject *parent = 0 );
53 virtual int getId( QModelIndex index ) 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;
58 virtual ~VLCModel();
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;
65 int column = 0;
67 while( column != _column && meta != COLUMN_END )
69 meta <<= 1;
70 column++;
73 return meta;
76 static int columnFromMeta( int meta_col )
78 int meta = 1;
79 int column = 0;
81 while( meta != meta_col && meta != COLUMN_END )
83 meta <<= 1;
84 column++;
87 return column;
90 public slots:
91 virtual void activateItem( const QModelIndex &index ) = 0;
93 protected:
94 intf_thread_t *p_intf;
99 #endif