1/*
2 * Copyright 2011 Marco Martin <mart@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef KDECLARATIVE_H
21#define KDECLARATIVE_H
22
23#include <kdeclarative_export.h>
24
25#include <QStringList>
26
27class QDeclarativeEngine;
28class QScriptEngine;
29
30class KDeclarativePrivate;
31
32class KDECLARATIVE_EXPORT KDeclarative
33{
34public:
35 explicit KDeclarative();
36 ~KDeclarative();
37
38 void initialize();
39 void setupBindings();
40
41 void setDeclarativeEngine(QDeclarativeEngine *engine);
42 QDeclarativeEngine *declarativeEngine() const;
43
44 QScriptEngine *scriptEngine() const;
45
46 /**
47 * This method must be called very early at startup time to ensure the
48 * QDeclarativeDebugger is enabled. Ideally it should be called in main(),
49 * after command-line options are defined.
50 */
51 static void setupQmlJsDebugger();
52
53 /**
54 * @return the runtime platform, e.g. "desktop" or "tablet, touch". The first entry/ies in
55 * the list relate to the platform formfactor and the last is the input method
56 * specialization. If the string is empty, there is no specified runtime platform
57 * and a traditional desktop environment may be assumed
58 * @since 4.10
59 */
60 static QStringList runtimePlatform();
61
62 /**
63 * @return the QML components target, based on the runtime platform. e.g. touch or desktop
64 * @since 4.10
65 */
66 static QString componentsTarget();
67
68 /**
69 * @return the default components target; can be used to compare against the returned value
70 * from @see componentsTarget()
71 * @since 4.10
72 */
73 static QString defaultComponentsTarget();
74
75private:
76 KDeclarativePrivate *const d;
77 friend class EngineAccess;
78};
79
80#endif
81