Changeset View
Changeset View
Standalone View
Standalone View
scripting/scripting.h
Show All 24 Lines | |||||
25 | #include <kwinglobals.h> | 25 | #include <kwinglobals.h> | ||
26 | 26 | | |||
27 | #include <QFile> | 27 | #include <QFile> | ||
28 | #include <QHash> | 28 | #include <QHash> | ||
29 | #include <QStringList> | 29 | #include <QStringList> | ||
30 | #include <QtScript/QScriptEngineAgent> | 30 | #include <QtScript/QScriptEngineAgent> | ||
31 | #include <QJSValue> | 31 | #include <QJSValue> | ||
32 | 32 | | |||
33 | #include <QDBusContext> | ||||
34 | #include <QDBusMessage> | ||||
35 | | ||||
33 | class QQmlComponent; | 36 | class QQmlComponent; | ||
34 | class QQmlContext; | 37 | class QQmlContext; | ||
35 | class QQmlEngine; | 38 | class QQmlEngine; | ||
36 | class QAction; | 39 | class QAction; | ||
37 | class QDBusPendingCallWatcher; | 40 | class QDBusPendingCallWatcher; | ||
38 | class QGraphicsScene; | 41 | class QGraphicsScene; | ||
39 | class QMenu; | 42 | class QMenu; | ||
40 | class QMutex; | 43 | class QMutex; | ||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Line(s) | 173 | private: | |||
209 | QHash<int, QScriptValue> m_callbacks; | 212 | QHash<int, QScriptValue> m_callbacks; | ||
210 | /** | 213 | /** | ||
211 | * @brief List of registered functions to call when the UserActionsMenu is about to show | 214 | * @brief List of registered functions to call when the UserActionsMenu is about to show | ||
212 | * to add further entries. | 215 | * to add further entries. | ||
213 | **/ | 216 | **/ | ||
214 | QList<QScriptValue> m_userActionsMenuCallbacks; | 217 | QList<QScriptValue> m_userActionsMenuCallbacks; | ||
215 | }; | 218 | }; | ||
216 | 219 | | |||
217 | class Script : public AbstractScript | 220 | class Script : public AbstractScript, QDBusContext | ||
218 | { | 221 | { | ||
219 | Q_OBJECT | 222 | Q_OBJECT | ||
220 | Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Scripting") | 223 | Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Scripting") | ||
221 | public: | 224 | public: | ||
222 | 225 | | |||
223 | Script(int id, QString scriptName, QString pluginName, QObject *parent = nullptr); | 226 | Script(int id, QString scriptName, QString pluginName, QObject *parent = nullptr); | ||
224 | virtual ~Script(); | 227 | virtual ~Script(); | ||
225 | QScriptEngine *engine() { | 228 | QScriptEngine *engine() { | ||
Show All 23 Lines | |||||
249 | private: | 252 | private: | ||
250 | void installScriptFunctions(QScriptEngine *engine); | 253 | void installScriptFunctions(QScriptEngine *engine); | ||
251 | /** | 254 | /** | ||
252 | * Read the script from file into a byte array. | 255 | * Read the script from file into a byte array. | ||
253 | * If file cannot be read an empty byte array is returned. | 256 | * If file cannot be read an empty byte array is returned. | ||
254 | **/ | 257 | **/ | ||
255 | QByteArray loadScriptFromFile(const QString &fileName); | 258 | QByteArray loadScriptFromFile(const QString &fileName); | ||
256 | QScriptEngine *m_engine; | 259 | QScriptEngine *m_engine; | ||
260 | QDBusMessage m_invocationContext; | ||||
257 | bool m_starting; | 261 | bool m_starting; | ||
258 | QScopedPointer<ScriptUnloaderAgent> m_agent; | 262 | QScopedPointer<ScriptUnloaderAgent> m_agent; | ||
259 | QHash<int, QAction*> m_touchScreenEdgeCallbacks; | 263 | QHash<int, QAction*> m_touchScreenEdgeCallbacks; | ||
260 | }; | 264 | }; | ||
261 | 265 | | |||
262 | class ScriptUnloaderAgent : public QScriptEngineAgent | 266 | class ScriptUnloaderAgent : public QScriptEngineAgent | ||
263 | { | 267 | { | ||
264 | public: | 268 | public: | ||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |