2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
10 #ifndef BACKGROUNDLISTMODEL_H
11 #define BACKGROUNDLISTMODEL_H
13 #include <QAbstractListModel>
18 class BackgroundContainer
21 virtual ~BackgroundContainer() {};
22 virtual bool contains(const QString
&path
) const = 0;
25 class BackgroundListModel
: public QAbstractListModel
, public BackgroundContainer
28 BackgroundListModel(float ratio
, QObject
*listener
);
29 virtual ~BackgroundListModel();
31 virtual int rowCount(const QModelIndex
&parent
= QModelIndex()) const;
32 virtual QVariant
data(const QModelIndex
&index
, int role
= Qt::DisplayRole
) const;
33 Background
* package(int index
) const;
36 void reload(const QStringList
&selected
);
37 void addBackground(const QString
&path
);
38 int indexOf(const QString
&path
) const;
39 void removeBackground(const QString
&path
);
40 virtual bool contains(const QString
&bg
) const;
42 static QList
<Background
*> findAllBackgrounds(const BackgroundContainer
*container
,
43 const QString
&path
, float ratio
);
47 QList
<Background
*> m_packages
;
52 #endif // BACKGROUNDLISTMODEL_H