Changeset View
Changeset View
Standalone View
Standalone View
src/imagetimemodel.h
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef IMAGETIMEMODEL_H | 21 | #ifndef IMAGETIMEMODEL_H | ||
22 | #define IMAGETIMEMODEL_H | 22 | #define IMAGETIMEMODEL_H | ||
23 | 23 | | |||
24 | #include <QAbstractListModel> | 24 | #include <QAbstractListModel> | ||
25 | #include <QStringList> | 25 | #include <QStringList> | ||
26 | 26 | | |||
27 | #include "types.h" | ||||
28 | | ||||
27 | class ImageTimeModel : public QAbstractListModel | 29 | class ImageTimeModel : public QAbstractListModel | ||
28 | { | 30 | { | ||
29 | Q_OBJECT | 31 | Q_OBJECT | ||
30 | Q_PROPERTY(TimeGroup group READ group WRITE setGroup NOTIFY groupChanged) | 32 | Q_PROPERTY(Types::TimeGroup group READ group WRITE setGroup NOTIFY groupChanged) | ||
31 | public: | 33 | public: | ||
32 | explicit ImageTimeModel(QObject* parent = 0); | 34 | explicit ImageTimeModel(QObject* parent = 0); | ||
33 | 35 | | |||
34 | virtual QHash< int, QByteArray > roleNames() const; | 36 | virtual QHash< int, QByteArray > roleNames() const; | ||
35 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; | 37 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; | ||
36 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; | 38 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; | ||
37 | 39 | | |||
38 | enum TimeGroup { | 40 | Types::TimeGroup group() const; | ||
39 | Year, | 41 | void setGroup(Types::TimeGroup group); | ||
40 | Month, | | |||
41 | Week, | | |||
42 | Day | | |||
43 | }; | | |||
44 | Q_ENUMS(TimeGroup) | | |||
45 | | ||||
46 | TimeGroup group() const; | | |||
47 | void setGroup(TimeGroup group); | | |||
48 | 42 | | |||
49 | signals: | 43 | signals: | ||
50 | void groupChanged(); | 44 | void groupChanged(); | ||
51 | 45 | | |||
52 | private slots: | 46 | private slots: | ||
53 | void slotPopulate(); | 47 | void slotPopulate(); | ||
54 | 48 | | |||
55 | private: | 49 | private: | ||
56 | TimeGroup m_group; | 50 | Types::TimeGroup m_group; | ||
57 | QList< QPair<QByteArray, QString> > m_times; | 51 | QList< QPair<QByteArray, QString> > m_times; | ||
58 | }; | 52 | }; | ||
59 | 53 | | |||
60 | #endif | 54 | #endif |