/*
Copyright (c) 2007 Paolo Capriotti
Copyright 2011 Reza Fatahilah Shah
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#ifndef BACKGROUNDLISTMODEL_H
#define BACKGROUNDLISTMODEL_H
#include
#include
#include
#include
#include
#include
#include
#include
class KProgressDialog;
namespace Plasma
{
class Package;
} // namespace Plasma
class PatternWallpaper;
class BackgroundListModel : public QAbstractListModel
{
Q_OBJECT
public:
BackgroundListModel(PatternWallpaper *listener, QObject *parent);
virtual ~BackgroundListModel();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
KConfig *kconfig(int index) const;
void reload(const QStringList &selected);
QModelIndex indexOf(const QString &path) const;
virtual bool contains(const QString &bg) const;
void setWallpaperSize(const QSize& size);
void setResizeMethod(Plasma::Wallpaper::ResizeMethod resizeMethod);
public Q_SLOTS:
void reload();
protected Q_SLOTS:
void showPreview(const KFileItem &item, const QPixmap &preview);
void previewFailed(const KFileItem &item);
void processPaths(const QStringList &paths);
private:
QWeakPointer m_structureParent;
QList m_kconfigs;
QHash m_previews;
QHash m_previewJobs;
KDirWatch m_dirwatch;
QPixmap m_previewUnavailablePix;
QSize m_size;
};
#endif // BACKGROUNDLISTMODEL_H