equal
deleted
inserted
replaced
23 */ |
23 */ |
24 |
24 |
25 #ifndef HEDGEWARS_MAPMODEL_H |
25 #ifndef HEDGEWARS_MAPMODEL_H |
26 #define HEDGEWARS_MAPMODEL_H |
26 #define HEDGEWARS_MAPMODEL_H |
27 |
27 |
28 #include <QAbstractListModel> |
28 #include <QStandardItemModel> |
29 #include <QStringList> |
29 #include <QStringList> |
30 #include <QTextStream> |
30 #include <QTextStream> |
31 #include <QMap> |
31 #include <QMap> |
32 #include <QIcon> |
32 #include <QIcon> |
33 #include <QComboBox> |
33 #include <QComboBox> |
38 * @brief A model listing available themes |
38 * @brief A model listing available themes |
39 * |
39 * |
40 * @author sheepluva |
40 * @author sheepluva |
41 * @since 0.9.18 |
41 * @since 0.9.18 |
42 */ |
42 */ |
43 class MapModel : public QAbstractListModel |
43 class MapModel : public QStandardItemModel |
44 { |
44 { |
45 Q_OBJECT |
45 Q_OBJECT |
46 |
46 |
47 public: |
47 public: |
48 enum MapType { |
48 enum MapType { |
62 quint32 limit; |
62 quint32 limit; |
63 QString scheme; |
63 QString scheme; |
64 QString weapons; |
64 QString weapons; |
65 }; |
65 }; |
66 |
66 |
67 static MapInfo mapInfoFromData(const QVariant data); |
|
68 |
|
69 explicit MapModel(QObject *parent = 0); |
|
70 |
|
71 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
72 QVariant data(const QModelIndex &index, int role) const; |
|
73 int generatorCount() const; |
|
74 int missionCount() const; |
67 int missionCount() const; |
75 |
68 |
76 |
69 |
77 public slots: |
70 public slots: |
78 /// reloads the maps from the DataManager |
71 /// reloads the maps from the DataManager |
79 void loadMaps(); |
72 void loadMaps(); |
80 |
73 |
81 |
74 |
82 private: |
75 private: |
83 QList<QMap<int, QVariant> > m_data; |
|
84 int m_nGenerators; |
|
85 int m_nMissions; |
76 int m_nMissions; |
|
77 |
|
78 QStandardItem * infoToItem( |
|
79 const QIcon & icon, |
|
80 const QString caption, |
|
81 MapType type = Invalid, |
|
82 QString name = "", |
|
83 QString theme = "", |
|
84 quint32 limit = 0, |
|
85 QString scheme = "", |
|
86 QString weapons = "") const; |
86 }; |
87 }; |
87 |
88 |
|
89 Q_DECLARE_METATYPE(MapModel::MapInfo) |
|
90 |
88 #endif // HEDGEWARS_MAPMODEL_H |
91 #endif // HEDGEWARS_MAPMODEL_H |