2 * Copyright (C) 2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#ifndef MIRSURFACEITEM_H
18#define MIRSURFACEITEM_H
20#include "MirSurfaceItemModel.h"
27class MirSurfaceItem : public QQuickItem
32 Q_ENUMS(OrientationAngle)
34 Q_PROPERTY(Type type READ type NOTIFY typeChanged)
35 Q_PROPERTY(State state READ state NOTIFY stateChanged)
36 Q_PROPERTY(QString name READ name CONSTANT)
37 Q_PROPERTY(bool live READ live NOTIFY liveChanged)
38 Q_PROPERTY(OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
39 NOTIFY orientationAngleChanged DESIGNABLE false)
40 Q_PROPERTY(int touchPressCount READ touchPressCount WRITE setTouchPressCount
41 NOTIFY touchPressCountChanged DESIGNABLE false)
42 Q_PROPERTY(int touchReleaseCount READ touchReleaseCount WRITE setTouchReleaseCount
43 NOTIFY touchReleaseCountChanged DESIGNABLE false)
66 enum OrientationAngle {
76 Session* session() const { return m_session; }
77 Type type() const { return m_type; }
78 State state() const { return m_state; }
79 QString name() const { return m_name; }
80 bool live() const { return m_live; }
81 OrientationAngle orientationAngle() const { return m_orientationAngle; }
83 void setOrientationAngle(OrientationAngle angle);
85 void setSession(Session* item);
86 void setScreenshot(const QUrl& screenshot);
87 void setLive(bool live);
89 Q_INVOKABLE void setState(State newState);
90 Q_INVOKABLE void release();
92 int touchPressCount() const { return m_touchPressCount; }
93 void setTouchPressCount(int count) { m_touchPressCount = count; Q_EMIT touchPressCountChanged(count); }
95 int touchReleaseCount() const { return m_touchReleaseCount; }
96 void setTouchReleaseCount(int count) { m_touchReleaseCount = count; Q_EMIT touchReleaseCountChanged(count); }
99 void typeChanged(Type);
100 void stateChanged(State);
101 void liveChanged(bool live);
102 void orientationAngleChanged(OrientationAngle angle);
103 void touchPressCountChanged(int count);
104 void touchReleaseCountChanged(int count);
110 explicit MirSurfaceItem(const QString& name,
113 const QUrl& screenshot,
114 const QString &qmlFilePath = QString(),
115 QQuickItem *parent = 0);
117 void touchEvent(QTouchEvent * event) override;
120 void onComponentStatusChanged(QQmlComponent::Status status);
123 void createQmlContentItem();
124 void printComponentErrors();
127 const QString m_name;
131 OrientationAngle m_orientationAngle;
133 QQmlComponent *m_qmlContentComponent;
134 QQuickItem *m_qmlItem;
135 QUrl m_screenshotUrl;
137 int m_touchPressCount;
138 int m_touchReleaseCount;
140 friend class SurfaceManager;
143Q_DECLARE_METATYPE(MirSurfaceItem*)
144Q_DECLARE_METATYPE(QList<MirSurfaceItem*>)
145Q_DECLARE_METATYPE(MirSurfaceItem::OrientationAngle)
147#endif // MIRSURFACEITEM_H
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list