diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2017-07-17 18:01:37 +0200 |
---|---|---|
committer | Holger Freyther <holger+qt@freyther.de> | 2017-09-12 06:16:36 +0000 |
commit | 5b64a6d44215a22ffa9a4d7b64b695ffe9dfa858 (patch) | |
tree | 1cc0d17de900f6e9aad37602d2dc9f858f0be353 /wayland/democompositor | |
parent | 335968b70379b2d02bc0ce5e3b66d40666cde460 (diff) |
democompositor: Expose the AppListModel and use to display apps
Replace the static configuration of the launch buttons with a Repeater
and the instantiated appModel. Use Component.onCompleted to parse the
app files. Maybe we can make this a property to ease starting it?
It is hardcoding the install directory for the *.app files but I am
not sure how to do it differently.
Change-Id: I5ef1d78a472f6e0f1dc1c0a3b050179949e6d818
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'wayland/democompositor')
-rw-r--r-- | wayland/democompositor/main.cpp | 3 | ||||
-rw-r--r-- | wayland/democompositor/qml/Screen.qml | 60 |
2 files changed, 24 insertions, 39 deletions
diff --git a/wayland/democompositor/main.cpp b/wayland/democompositor/main.cpp index c10e9c2..ac25eaf 100644 --- a/wayland/democompositor/main.cpp +++ b/wayland/democompositor/main.cpp @@ -55,11 +55,14 @@ #include <QtGui/QFont> #include <QtQml/qqml.h> #include <QtQml/QQmlApplicationEngine> + +#include "apps/applistmodel.h" #include "processlauncher.h" static void registerTypes() { qmlRegisterType<WaylandProcessLauncher>("com.theqtcompany.wlprocesslauncher", 1, 0, "ProcessLauncher"); + qmlRegisterType<AppListModel>("com.theqtcompany.wlapplistmodel", 1, 0, "AppListModel"); } diff --git a/wayland/democompositor/qml/Screen.qml b/wayland/democompositor/qml/Screen.qml index 34fd090..b609ca2 100644 --- a/wayland/democompositor/qml/Screen.qml +++ b/wayland/democompositor/qml/Screen.qml @@ -53,6 +53,7 @@ import QtQuick.Window 2.2 import QtWayland.Compositor 1.0 import com.theqtcompany.wlprocesslauncher 1.0 +import com.theqtcompany.wlapplistmodel 1.0 WaylandOutput { @@ -85,6 +86,13 @@ WaylandOutput { id: launcher } + AppListModel { + id: apps + } + + Component.onCompleted: { + apps.addAndWatchDir("/data/user/democompositor/apps/") + } Rectangle { id: curtain @@ -252,46 +260,20 @@ WaylandOutput { height: 5 width: 1 } - LaunchButton { - height: 60 - width: sidebar.width - 10 - buttonColor: backgroundCol - pressedColor: pressedCol - textColor: textCol - text.text: "Clocks" - executable: "./clocks" - icon.source: "qrc:/images/Icon_Clocks.png" - } - LaunchButton { - height: 60 - width: sidebar.width - 10 - buttonColor: backgroundCol - pressedColor: pressedCol - textColor: textCol - text.text: "RSS News" - executable: "./rssnews" - icon.source: "qrc:/images/Icon_RSS.png" - } - LaunchButton { - height: 60 - width: sidebar.width - 10 - buttonColor: backgroundCol - pressedColor: pressedCol - textColor: textCol - text.text: "StoQt" - executable: "./stocqt" - icon.source: "qrc:/images/Icon_StocQt.png" - } - LaunchButton { - height: 60 - width: sidebar.width - 10 - buttonColor: backgroundCol - pressedColor: pressedCol - textColor: textCol - text.text: "Maps" - executable: "./qml_location_mapviewer" - icon.source: "qrc:/images/Icon_Maps.png" + Repeater { + model: apps + + LaunchButton { + height: 60 + width: sidebar.width - 10 + buttonColor: backgroundCol + pressedColor: pressedCol + textColor: textCol + text.text: model.applicationName + executable: model.executableName + icon.source: model.iconName + } } TimedButton { |