4 * This file is part of CameraPlus.
6 * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef POST_CAPTURE_MODEL_H
24 #define POST_CAPTURE_MODEL_H
26 #include <QSortFilterProxyModel>
27 #include <QStringList>
33 class PostCaptureModel : public QSortFilterProxyModel {
36 Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged);
37 Q_PROPERTY(QString videoPath READ videoPath WRITE setVideoPath NOTIFY videoPathChanged);
40 UrlRole = Qt::UserRole + 1,
41 TitleRole = Qt::UserRole + 2,
42 MimeTypeRole = Qt::UserRole + 3,
43 CreatedRole = Qt::UserRole + 4,
44 FileNameRole = Qt::UserRole + 5,
48 PostCaptureModel(QObject *parent = 0);
51 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
53 QString imagePath() const;
54 void setImagePath(const QString& path);
56 QString videoPath() const;
57 void setVideoPath(const QString& path);
62 void remove(const QUrl& file);
65 void imagePathChanged();
66 void videoPathChanged();
69 bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
72 QFileInfo info(const QString& path) const;
77 FileInfoModel *m_model;
79 QStringList loadDir(QDir& dir);
81 mutable QHash<QString, QFileInfo> m_data;
84 QHash<int, QByteArray> roleNames() const;
85 void setRoleNames(const QHash<int, QByteArray>& roles);
86 QHash<int, QByteArray> m_roles;
90 #endif /* POST_CAPTURE_MODEL_H */