3
* Copyright (C) 2002 Karol Szwed <gallium@kde.org>
4
* Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org>
5
* Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
6
* Copyright (C) 2009 by Davide Bettio <davide.bettio@kdemail.net>
8
* Portions Copyright (C) 2007 Paolo Capriotti <p.capriotti@gmail.com>
9
* Portions Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
10
* Portions Copyright (C) 2008 by Petri Damsten <damu@iki.fi>
11
* Portions Copyright (C) 2000 TrollTech AS.
13
* This program is free software; you can redistribute it and/or
14
* modify it under the terms of the GNU General Public
15
* License version 2 as published by the Free Software Foundation.
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
* General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; see the file COPYING. If not, write to
24
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25
* Boston, MA 02110-1301, USA.
31
#include <QtGui/QAbstractItemView>
38
//Theme selector code by Andre Duffeck (modified to add package description)
43
Plasma::FrameSvg *svg;
50
class ThemeModel : public QAbstractListModel
53
enum { PackageNameRole = Qt::UserRole,
54
SvgRole = Qt::UserRole + 1,
55
PackageDescriptionRole = Qt::UserRole + 2,
56
PackageAuthorRole = Qt::UserRole + 3,
57
PackageVersionRole = Qt::UserRole + 4
60
ThemeModel(QObject *parent = 0);
61
virtual ~ThemeModel();
63
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
64
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
65
QModelIndex indexOf(const QString &path) const;
67
void clearThemeList();
69
QMap<QString, ThemeInfo> m_themes;
72
class ThemeDelegate : public QAbstractItemDelegate
75
ThemeDelegate(QObject * parent = 0);
77
virtual void paint(QPainter *painter,
78
const QStyleOptionViewItem &option,
79
const QModelIndex &index) const;
80
virtual QSize sizeHint(const QStyleOptionViewItem &option,
81
const QModelIndex &index) const;
83
static const int MARGIN = 10;