diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2017-07-13 12:16:43 +0200 |
---|---|---|
committer | Holger Freyther <holger+qt@freyther.de> | 2017-09-12 06:14:39 +0000 |
commit | df9402f361b521877fdc2b1ec23a1e205699224c (patch) | |
tree | 92d9fb35db9aba34f668ccae2a9eaf3d6ec8e8de /wayland/democompositor/apps/appparser.cpp | |
parent | c09aa96a136dd841e75b459d78ea27ad2bc4474c (diff) |
democompositor: Introduce an AppListModel to expose apps
Turn the AppEntry into a gadget and store the filename of where the
entry came from. Update the existing test to deal with it.
Introduce AppListModel as a QAbstractItemModel and expose the raw
AppEntry and its fields as role. Have some slow O(n) code to check
if an entry has already been added. The goal is to use a directory
watcher to automatically update this list.
Store the AppEntry as a pointer so we don't have to remove the
const from the field.
The next steps are to fully populate the AppListModel by scanning
and watching a directory and then replacing the LaunchButton code
with a Repeater on the application model. After starting of apps
will be done by passing the AppEntry to a launcher. Application
state should be stored outside the AppEntry and maybe in a different
model as well.
Change-Id: Ia933a09942ea8bb88eae5c101d13a30564d8c639
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'wayland/democompositor/apps/appparser.cpp')
-rw-r--r-- | wayland/democompositor/apps/appparser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wayland/democompositor/apps/appparser.cpp b/wayland/democompositor/apps/appparser.cpp index 18d2d22..2c373cc 100644 --- a/wayland/democompositor/apps/appparser.cpp +++ b/wayland/democompositor/apps/appparser.cpp @@ -94,7 +94,7 @@ static int readInt(const QJsonObject& object, const QString& key, bool *ok) return doReadInt(object.value(key), ok); } -AppEntry AppParser::parseData(const QByteArray& content, bool *ok) +AppEntry AppParser::parseData(const QByteArray& content, const QString& fileName, bool *ok) { *ok = true; QJsonParseError error; @@ -132,7 +132,7 @@ AppEntry AppParser::parseData(const QByteArray& content, bool *ok) if (!*ok) return AppEntry::empty(); - return AppEntry{iconName, appName, executableName, executablePath}; + return AppEntry{iconName, appName, executableName, executablePath, fileName}; } AppEntry AppParser::parseFile(const QString& fileName, bool *ok) @@ -146,7 +146,7 @@ AppEntry AppParser::parseFile(const QString& fileName, bool *ok) return AppEntry::empty(); } - auto entry = parseData(file.readAll(), ok); + auto entry = parseData(file.readAll(), fileName, ok); file.close(); if (!*ok) { qCWarning(apps) << "Failed to parse" << fileName; |