delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / workspace / plasma / wallpapers / image / backgroundlistmodel.h
blob5200e6d13fdb32a5e567734f92467278bd3e9d30
1 /*
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.
8 */
10 #ifndef BACKGROUNDLISTMODEL_H
11 #define BACKGROUNDLISTMODEL_H
13 #include <QAbstractListModel>
14 #include <KDirWatch>
16 class Background;
18 class BackgroundContainer
20 public:
21 virtual ~BackgroundContainer() {};
22 virtual bool contains(const QString &path) const = 0;
25 class BackgroundListModel : public QAbstractListModel, public BackgroundContainer
27 public:
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;
35 void reload();
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);
45 private:
46 QObject *m_listener;
47 QList<Background*> m_packages;
48 float m_ratio;
49 KDirWatch m_dirwatch;
52 #endif // BACKGROUNDLISTMODEL_H