2 * Copyright (C) 2014-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 "MirSurface.h"
26#include <unity/shell/application/MirSurfaceItemInterface.h>
28class MirSurfaceItem : public unity::shell::application::MirSurfaceItemInterface
33 // for use in qml tests
34 Q_PROPERTY(int touchPressCount READ touchPressCount WRITE setTouchPressCount
35 NOTIFY touchPressCountChanged DESIGNABLE false)
36 Q_PROPERTY(int touchReleaseCount READ touchReleaseCount WRITE setTouchReleaseCount
37 NOTIFY touchReleaseCountChanged DESIGNABLE false)
40 explicit MirSurfaceItem(QQuickItem *parent = 0);
43 Mir::Type type() const override;
44 QString name() const override;
45 bool live() const override;
47 Mir::State surfaceState() const override;
48 void setSurfaceState(Mir::State) override {}
50 Mir::OrientationAngle orientationAngle() const override;
51 void setOrientationAngle(Mir::OrientationAngle angle) override;
53 unity::shell::application::MirSurfaceInterface* surface() const override { return m_qmlSurface; }
54 void setSurface(unity::shell::application::MirSurfaceInterface*) override;
56 bool consumesInput() const override { return m_consumesInput; }
57 void setConsumesInput(bool value) override;
59 int surfaceWidth() const override;
60 void setSurfaceWidth(int value) override;
62 int surfaceHeight() const override;
63 void setSurfaceHeight(int value) override;
66 // For use in qml tests
68 void setLive(bool live);
70 int touchPressCount() const { return m_touchPressCount; }
71 void setTouchPressCount(int count) { m_touchPressCount = count; Q_EMIT touchPressCountChanged(count); }
73 int touchReleaseCount() const { return m_touchReleaseCount; }
74 void setTouchReleaseCount(int count) { m_touchReleaseCount = count; Q_EMIT touchReleaseCountChanged(count); }
77 void touchPressCountChanged(int count);
78 void touchReleaseCountChanged(int count);
81 void touchEvent(QTouchEvent * event) override;
82 void mousePressEvent(QMouseEvent * event) override;
83 void mouseMoveEvent(QMouseEvent * event) override;
84 void mouseReleaseEvent(QMouseEvent * event) override;
85 void itemChange(ItemChange change, const ItemChangeData & value) override;
88 void onComponentStatusChanged(QQmlComponent::Status status);
89 void updateScreenshot(QUrl screenshot);
92 void createQmlContentItem();
93 void printComponentErrors();
94 void updateSurfaceSize();
96 MirSurface* m_qmlSurface;
98 QQmlComponent *m_qmlContentComponent;
99 QQuickItem *m_qmlItem;
101 bool m_consumesInput;
106 int m_touchPressCount;
107 int m_touchReleaseCount;
109 friend class SurfaceManager;
112Q_DECLARE_METATYPE(MirSurfaceItem*)
113Q_DECLARE_METATYPE(QList<MirSurfaceItem*>)
115#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