summaryrefslogtreecommitdiffstats
path: root/wayland/democompositor/processlauncher.h
diff options
context:
space:
mode:
Diffstat (limited to 'wayland/democompositor/processlauncher.h')
-rw-r--r--wayland/democompositor/processlauncher.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/wayland/democompositor/processlauncher.h b/wayland/democompositor/processlauncher.h
index 261da6d..ae847e2 100644
--- a/wayland/democompositor/processlauncher.h
+++ b/wayland/democompositor/processlauncher.h
@@ -51,7 +51,29 @@
#ifndef PROCESSLAUNCHER_H
#define PROCESSLAUNCHER_H
+#include "apps/appentry.h"
+
#include <QObject>
+#include <QProcess>
+#include <QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(procs)
+
+/**
+ * Transient class. Do not keep AppState beyond the
+ * finished signal.
+ */
+class AppState {
+ Q_GADGET
+ Q_PROPERTY(QProcess *process MEMBER process CONSTANT)
+ Q_PROPERTY(AppEntry appEntry MEMBER appEntry CONSTANT)
+public:
+ QProcess *process;
+ AppEntry appEntry;
+ QMetaObject::Connection finishedConn;
+ QMetaObject::Connection errorOccurredConn;
+ QMetaObject::Connection startedConn;
+};
class WaylandProcessLauncher : public QObject
{
@@ -60,7 +82,22 @@ class WaylandProcessLauncher : public QObject
public:
explicit WaylandProcessLauncher(QObject *parent = 0);
~WaylandProcessLauncher();
- Q_INVOKABLE void launch(const QString &program);
+ Q_INVOKABLE void launch(const AppEntry &entry);
+
+ Q_INVOKABLE QVariant appStateForPid(int pid) const;
+ Q_INVOKABLE bool isRunning(const AppEntry& entry) const;
+ Q_INVOKABLE void kill(const AppEntry& entry);
+ Q_INVOKABLE void stop(const AppEntry& entry, int timeout_ms);
+
+Q_SIGNALS:
+ void appStarted(const AppState &appState);
+ void appFinished(const AppState &appState, int exitCode, QProcess::ExitStatus exitStatus);
+ void appNotStarted(const AppState& appState);
+
+private:
+ QVector<AppState> m_appStates;
};
+Q_DECLARE_METATYPE(AppState)
+
#endif // PROCESSLAUNCHER_H