Kill CameraButtonRow and use the QtQuick Row component
[harmattan/cameraplus] / src / postcapturemodel.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #ifndef POST_CAPTURE_MODEL_H
24 #define POST_CAPTURE_MODEL_H
25
26 #include <QStandardItemModel>
27
28 class QDir;
29
30 class PostCaptureModel : public QStandardItemModel {
31   Q_OBJECT
32
33   Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged);
34   Q_PROPERTY(QString videoPath READ videoPath WRITE setVideoPath NOTIFY videoPathChanged);
35
36 public:
37   PostCaptureModel(QObject *parent = 0);
38   ~PostCaptureModel();
39
40   typedef enum {
41     UrlRole = Qt::UserRole + 1,
42     TitleRole = Qt::UserRole + 2,
43     MimeTypeRole = Qt::UserRole + 3,
44     CreatedRole = Qt::UserRole + 4,
45     FileNameRole = Qt::UserRole + 5,
46   } Roles;
47
48   QString imagePath() const;
49   void setImagePath(const QString& path);
50
51   QString videoPath() const;
52   void setVideoPath(const QString& path);
53
54 public slots:
55   void reload();
56   void clear();
57   void remove(const QUrl& file);
58
59 signals:
60   void imagePathChanged();
61   void videoPathChanged();
62
63 private:
64   QString m_imagePath;
65   QString m_videoPath;
66
67   void loadDir(const QDir& dir, QList<QStandardItem *>& out);
68
69 #if defined(QT5)
70   QHash<int, QByteArray> roleNames() const;
71   void setRoleNames(const QHash<int, QByteArray>& roles);
72   QHash<int, QByteArray> m_roles;
73 #endif
74 };
75
76 #endif /* POST_CAPTURE_MODEL_H */