summaryrefslogtreecommitdiffstats
path: root/wayland
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-08-13 08:54:51 +0200
committerHolger Freyther <holger+qt@freyther.de>2017-09-12 06:16:43 +0000
commite1c257c3330057d7df70d3a1e92361afcdd06579 (patch)
tree35edb25fd5acfb9e93ee017142cacffcd6999e27 /wayland
parent5b64a6d44215a22ffa9a4d7b64b695ffe9dfa858 (diff)
democompositor: Move to start by AppEntry
The AppEntry contains the executable name and the $PATH to use. Store a copy of the AppEntry and pass it to the processlauncher. Change-Id: I15792cc7ce651beed2006841c100b31d3252d9d1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'wayland')
-rw-r--r--wayland/democompositor/processlauncher.cpp17
-rw-r--r--wayland/democompositor/processlauncher.h7
-rw-r--r--wayland/democompositor/qml/LaunchButton.qml4
-rw-r--r--wayland/democompositor/qml/Screen.qml2
4 files changed, 22 insertions, 8 deletions
diff --git a/wayland/democompositor/processlauncher.cpp b/wayland/democompositor/processlauncher.cpp
index a25fbd5..f0e465e 100644
--- a/wayland/democompositor/processlauncher.cpp
+++ b/wayland/democompositor/processlauncher.cpp
@@ -49,9 +49,12 @@
****************************************************************************/
#include "processlauncher.h"
+#include "apps/appentry.h"
#include <QProcess>
+Q_LOGGING_CATEGORY(procs, "launcher.procs")
+
WaylandProcessLauncher::WaylandProcessLauncher(QObject *parent)
: QObject(parent)
{
@@ -61,16 +64,22 @@ WaylandProcessLauncher::~WaylandProcessLauncher()
{
}
-void WaylandProcessLauncher::launch(const QString &program)
+void WaylandProcessLauncher::launch(const AppEntry &entry)
{
+ qCDebug(procs) << "Launching" << entry.executableName;
+
QProcess *process = new QProcess(this);
connect(process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
process, &QProcess::deleteLater);
connect(process, &QProcess::errorOccurred, &QProcess::deleteLater);
+ if (!entry.executablePath.isNull()) {
+ auto env = QProcessEnvironment::systemEnvironment();
+ env.insert(QStringLiteral("PATH"), entry.executablePath);
+ process->setProcessEnvironment(env);
+ }
+
QStringList arguments;
arguments << "-platform" << "wayland";
- process->start(program, arguments);
-
+ process->start(entry.executableName, arguments);
}
-
diff --git a/wayland/democompositor/processlauncher.h b/wayland/democompositor/processlauncher.h
index 261da6d..092c0a3 100644
--- a/wayland/democompositor/processlauncher.h
+++ b/wayland/democompositor/processlauncher.h
@@ -52,6 +52,11 @@
#define PROCESSLAUNCHER_H
#include <QObject>
+#include <QLoggingCategory>
+
+class AppEntry;
+
+Q_DECLARE_LOGGING_CATEGORY(procs)
class WaylandProcessLauncher : public QObject
{
@@ -60,7 +65,7 @@ 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);
};
#endif // PROCESSLAUNCHER_H
diff --git a/wayland/democompositor/qml/LaunchButton.qml b/wayland/democompositor/qml/LaunchButton.qml
index deb462c..2d3801a 100644
--- a/wayland/democompositor/qml/LaunchButton.qml
+++ b/wayland/democompositor/qml/LaunchButton.qml
@@ -51,11 +51,11 @@
import QtQuick 2.6
MyButton {
- property string executable
+ property var appEntry
text.text: "Uninitialized"
text.elide: Text.ElideRight
text.maximumLineCount: 1
iconSize: 32
- onTriggered: launcher.launch(executable)
+ onTriggered: launcher.launch(appEntry)
}
diff --git a/wayland/democompositor/qml/Screen.qml b/wayland/democompositor/qml/Screen.qml
index b609ca2..fb8d4ea 100644
--- a/wayland/democompositor/qml/Screen.qml
+++ b/wayland/democompositor/qml/Screen.qml
@@ -271,7 +271,7 @@ WaylandOutput {
pressedColor: pressedCol
textColor: textCol
text.text: model.applicationName
- executable: model.executableName
+ appEntry: model.appEntry
icon.source: model.iconName
}
}