Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/declarative/IndoorLevelsBackend.h
- This file was added.
1 | // | ||||
---|---|---|---|---|---|
2 | // This file is part of the Marble Virtual Globe. | ||||
3 | // | ||||
4 | // This program is free software licensed under the GNU LGPL. You can | ||||
5 | // find a copy of this license in LICENSE.txt in the top directory of | ||||
6 | // the source code. | ||||
7 | // | ||||
8 | // Copyright 2017 Mohammed Nafees <nafees.technocool@gmail.com> | ||||
9 | // | ||||
10 | | ||||
11 | #ifndef MARBLE_INDOORLEVELSBACKEND_H | ||||
12 | #define MARBLE_INDOORLEVELSBACKEND_H | ||||
13 | | ||||
14 | #include <QObject> | ||||
15 | #include <QList> | ||||
16 | | ||||
17 | namespace Marble { | ||||
18 | class MarbleQuickItem; | ||||
19 | | ||||
20 | class IndoorLevelsBackend : public QObject | ||||
21 | { | ||||
22 | Q_OBJECT | ||||
23 | | ||||
24 | Q_PROPERTY(Marble::MarbleQuickItem* marbleQuickItem READ marbleQuickItem WRITE setMarbleQuickItem NOTIFY marbleQuickItemChanged) | ||||
25 | | ||||
26 | public: | ||||
27 | explicit IndoorLevelsBackend(QObject* parent = nullptr); | ||||
28 | | ||||
29 | Q_INVOKABLE int currentLevel() const; | ||||
30 | Q_INVOKABLE void setCurrentLevel(int level); | ||||
31 | | ||||
32 | MarbleQuickItem* marbleQuickItem() const; | ||||
33 | void setMarbleQuickItem(MarbleQuickItem* marbleQuickItem); | ||||
34 | | ||||
35 | Q_INVOKABLE QList<QObject*> levels(); | ||||
36 | void setLevels(const QList<QObject*>& levels); | ||||
37 | | ||||
38 | Q_SIGNALS: | ||||
39 | void marbleQuickItemChanged(MarbleQuickItem* marbleQuickItem); | ||||
40 | void currentLevelChanged(int level); | ||||
41 | void levelsChanged(); | ||||
42 | | ||||
43 | private Q_SLOTS: | ||||
44 | void refreshIndoorLevels(); | ||||
45 | | ||||
46 | private: | ||||
47 | int m_currentLevel; | ||||
48 | QList<QObject*> m_levels; | ||||
49 | MarbleQuickItem* m_marbleQuickItem; | ||||
50 | }; | ||||
51 | | ||||
52 | class Level : public QObject | ||||
53 | { | ||||
54 | Q_OBJECT | ||||
55 | | ||||
56 | Q_PROPERTY(QString level READ level WRITE setLevel) | ||||
57 | Q_PROPERTY(int value READ value WRITE setValue) | ||||
58 | | ||||
59 | public: | ||||
60 | Level(QObject* parent = nullptr); | ||||
61 | Level(const QString& level, int value, QObject* parent = nullptr); | ||||
62 | | ||||
63 | QString level() const; | ||||
64 | void setLevel(const QString& level); | ||||
65 | | ||||
66 | int value() const; | ||||
67 | void setValue(int value); | ||||
68 | | ||||
69 | private: | ||||
70 | QString m_level; | ||||
71 | int m_value; | ||||
72 | }; | ||||
73 | | ||||
74 | } | ||||
75 | | ||||
76 | | ||||
77 | #endif |