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