on 337d819 help sign in
85 lines 2.6 kB history raw
1/*
2 * Copyright (C) 2014-2015 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
17#ifndef GENERICAPP_H
18#define GENERICAPP_H
20#include "MirSurfaceItemModel.h"
21#include "MirSurfaceItem.h"
23#include <QUrl>
25class GenericApp : public MirSurfaceItem
27 Q_OBJECT
29 Q_PROPERTY(int touchPressCount READ touchPressCount WRITE setTouchPressCount NOTIFY touchPressCountChanged
30 DESIGNABLE false)
31 Q_PROPERTY(int touchReleaseCount READ touchReleaseCount WRITE setTouchReleaseCount NOTIFY touchReleaseCountChanged
32 DESIGNABLE false)
34public:
35 ~GenericApp();
37 int touchPressCount() const { return m_touchPressCount; }
38 void setTouchPressCount(int count) { m_touchPressCount = count; Q_EMIT touchPressCountChanged(count); }
40 int touchReleaseCount() const { return m_touchReleaseCount; }
41 void setTouchReleaseCount(int count) { m_touchReleaseCount = count; Q_EMIT touchReleaseCountChanged(count); }
43Q_SIGNALS:
44 void touchPressCountChanged(int count);
45 void touchReleaseCountChanged(int count);
47 void inputMethodRequested();
48 void inputMethodDismissed();
50 // internal mock use
51 void deregister();
53protected:
54 void touchEvent(QTouchEvent * event) override;
56private Q_SLOTS:
57 void onActiveFocusChanged();
59private:
60 explicit GenericApp(const QString& name,
61 Type type,
62 State state,
63 const QUrl& screenshot,
64 const QString &qmlFilePath = QString(),
65 QQuickItem *parent = 0);
67 void createQmlContentItem();
68 void printComponentErrors();
70 int m_touchPressCount;
71 int m_touchReleaseCount;
73 QQmlComponent *m_qmlContentComponent;
74 QQuickItem *m_qmlItem;
75 QUrl m_screenshotUrl;
77 bool m_requestedInputMethod;
79 friend class SurfaceManager;
80};
82Q_DECLARE_METATYPE(GenericApp*)
83Q_DECLARE_METATYPE(QList<GenericApp*>)
85#endif // GENERICAPP_H