aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBocklage, Jens <Jens_Bocklage@mentor.com>2016-12-09 12:14:02 +0100
committerBocklage, Jens <Jens_Bocklage@mentor.com>2016-12-09 12:14:02 +0100
commitf2b8bddb94a451c4bd822ef723a8b739236f4b4f (patch)
treeed256a1c68b063b999b62cd0664c3dbdcb0fbc85
parentb6d6fdc6384e686c8d866212b2f5d63ca884b3c5 (diff)
Integrate Home app into HomeScreen
Home is located in ces2017 repo. But since it has to use HomeScreen internal components (layermanager and applauncher), I had to move it to main HomeScreen app. Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
-rw-r--r--HomeScreen/HomeScreen.pro14
-rw-r--r--HomeScreen/qml/Home.qml60
-rw-r--r--HomeScreen/qml/ShortcutArea.qml24
-rw-r--r--HomeScreen/qml/images/Home/AGL_HMI_Background_Car-01.pngbin0 -> 216666 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Active-01.pngbin0 -> 34136 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Inactive-01.pngbin0 -> 26878 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Active-01.pngbin0 -> 32014 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Inactive-01.pngbin0 -> 25298 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Active-01.pngbin0 -> 31650 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Inactive-01.pngbin0 -> 24398 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Active-01.pngbin0 -> 29605 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Inactive-01.pngbin0 -> 23307 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Active-01.pngbin0 -> 38244 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Inactive-01.pngbin0 -> 33027 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Active-01.pngbin0 -> 33356 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Inactive-01.pngbin0 -> 26924 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Active-01.pngbin0 -> 30830 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Inactive-01.pngbin0 -> 23978 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Active-01.pngbin0 -> 29028 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Inactive-01.pngbin0 -> 21186 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Active-01.pngbin0 -> 33558 bytes
-rw-r--r--HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Inactive-01.pngbin0 -> 26571 bytes
-rw-r--r--HomeScreen/qml/images/Home/home.qrc23
-rw-r--r--HomeScreen/qml/main.qml19
-rw-r--r--HomeScreen/qml/qml.qrc1
-rw-r--r--HomeScreen/src/main.cpp3
-rw-r--r--HomeScreen/src2/appinfo.cpp176
-rw-r--r--HomeScreen/src2/appinfo.h68
-rw-r--r--HomeScreen/src2/applicationmodel.cpp105
-rw-r--r--HomeScreen/src2/applicationmodel.h39
30 files changed, 512 insertions, 20 deletions
diff --git a/HomeScreen/HomeScreen.pro b/HomeScreen/HomeScreen.pro
index 1ad42bf..d48b6e5 100644
--- a/HomeScreen/HomeScreen.pro
+++ b/HomeScreen/HomeScreen.pro
@@ -61,9 +61,13 @@ OTHER_FILES += \
HEADERS += \
src2/statusbarmodel.h \
src2/statusbarserver.h \
- src2/applicationlauncher.h
+ src2/applicationlauncher.h \
+ src2/applicationmodel.h \
+ src2/appinfo.h
SOURCES += \
+ src2/applicationmodel.cpp \
+ src2/appinfo.cpp \
src2/statusbarmodel.cpp \
src2/statusbarserver.cpp \
src2/applicationlauncher.cpp
@@ -72,6 +76,7 @@ RESOURCES += \
resources/homescreen.qrc
RESOURCES += \
+ qml/images/Home/home.qrc \
qml/images/MediaPlayer/mediaplayer.qrc \
qml/images/MediaMusic/mediamusic.qrc \
qml/images/Weather/weather.qrc \
@@ -79,10 +84,3 @@ RESOURCES += \
qml/images/Status/status.qrc \
qml/images/images.qrc \
qml/qml.qrc
-
-
-copydata.commands = $(COPY_DIR) $$PWD/resources/colorschemes $$OUT_PWD
-HomeScreen.depends = $(HomeScreen) copydata
-export(HomeScreen.depends)
-export(copydata.commands)
-QMAKE_EXTRA_TARGETS += HomeScreen copydata
diff --git a/HomeScreen/qml/Home.qml b/HomeScreen/qml/Home.qml
new file mode 100644
index 0000000..cfcd1c8
--- /dev/null
+++ b/HomeScreen/qml/Home.qml
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2016 The Qt Company Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import QtQuick 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.0
+import Home 1.0
+
+Item {
+ id: root
+
+ Image {
+ anchors.fill: parent
+ anchors.topMargin: -218
+ anchors.bottomMargin: -215
+ source: './images/AGL_HMI_Background_Car-01.png'
+ }
+
+ property int pid: -1
+
+ GridView {
+ anchors.centerIn: parent
+ width: cellHeight * 3
+ height: cellHeight * 3
+ cellWidth: 320
+ cellHeight: 320
+
+ model: ApplicationModel {}
+ delegate: MouseArea {
+ width: 320
+ height: 320
+ Image {
+ anchors.fill: parent
+ source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(pressed ? 'Active' : 'Inactive')
+ }
+ onClicked: {
+ console.log("app is ", model.id)
+ pid = launcher.launch(model.id)
+ layoutHandler.makeMeVisible(pid)
+
+ applicationArea.visible = true
+ appLauncherAreaLauncher.visible = false
+ layoutHandler.showAppLayer()
+ }
+ }
+ }
+}
diff --git a/HomeScreen/qml/ShortcutArea.qml b/HomeScreen/qml/ShortcutArea.qml
index 9ef8701..d9931cb 100644
--- a/HomeScreen/qml/ShortcutArea.qml
+++ b/HomeScreen/qml/ShortcutArea.qml
@@ -17,20 +17,12 @@
import QtQuick 2.2
import QtQuick.Layouts 1.1
-import HomeScreen 1.0
Item {
id: root
width: 785
height: 218
- ApplicationLauncher {
- id: launcher
- }
-
- LayoutHandler {
- id: layoutHandler
- }
ListModel {
id: applicationModel
@@ -40,7 +32,7 @@ Item {
}
ListElement {
name: 'Multimedia'
- application: 'radio@0.1'
+ application: 'mediaplayer@0.1'
}
ListElement {
name: 'HVAC'
@@ -67,8 +59,18 @@ Item {
active: model.index === root.currentIndex
onClicked: {
root.currentIndex = active ? -1 : model.index
- pid = launcher.launch(model.application)
- layoutHandler.makeMeVisible(pid)
+ if (0 === model.index) {
+ appLauncherAreaLauncher.visible = true
+ applicationArea.visible = false
+ layoutHandler.hideAppLayer()
+ }
+ else {
+ applicationArea.visible = true
+ appLauncherAreaLauncher.visible = false
+ pid = launcher.launch(model.application)
+ layoutHandler.makeMeVisible(pid)
+ layoutHandler.showAppLayer()
+ }
}
}
}
diff --git a/HomeScreen/qml/images/Home/AGL_HMI_Background_Car-01.png b/HomeScreen/qml/images/Home/AGL_HMI_Background_Car-01.png
new file mode 100644
index 0000000..b0072d8
--- /dev/null
+++ b/HomeScreen/qml/images/Home/AGL_HMI_Background_Car-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Active-01.png
new file mode 100644
index 0000000..888d0bd
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Inactive-01.png
new file mode 100644
index 0000000..ab83b0e
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Connectivity_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Active-01.png
new file mode 100644
index 0000000..11d39e5
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Inactive-01.png
new file mode 100644
index 0000000..6c0b914
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Dashboard_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Active-01.png
new file mode 100644
index 0000000..efc11e9
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Inactive-01.png
new file mode 100644
index 0000000..b528376
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_HVAC_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Active-01.png
new file mode 100644
index 0000000..1c99ac4
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Inactive-01.png
new file mode 100644
index 0000000..0bed61d
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Multimedia_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Active-01.png
new file mode 100644
index 0000000..e7ad085
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Inactive-01.png
new file mode 100644
index 0000000..dd40750
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Navigation_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Active-01.png
new file mode 100644
index 0000000..2df01d3
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Inactive-01.png
new file mode 100644
index 0000000..ec62b87
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_POI_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Active-01.png
new file mode 100644
index 0000000..2150581
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Inactive-01.png
new file mode 100644
index 0000000..61dcedc
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Phone_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Active-01.png
new file mode 100644
index 0000000..1aa5a01
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Inactive-01.png
new file mode 100644
index 0000000..616983e
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Radio_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Active-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Active-01.png
new file mode 100644
index 0000000..1d13fd6
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Active-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Inactive-01.png b/HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Inactive-01.png
new file mode 100644
index 0000000..027f1fe
--- /dev/null
+++ b/HomeScreen/qml/images/Home/HMI_AppLauncher_Settings_Inactive-01.png
Binary files differ
diff --git a/HomeScreen/qml/images/Home/home.qrc b/HomeScreen/qml/images/Home/home.qrc
new file mode 100644
index 0000000..7dde212
--- /dev/null
+++ b/HomeScreen/qml/images/Home/home.qrc
@@ -0,0 +1,23 @@
+<RCC>
+ <qresource prefix="/images">
+ <file>AGL_HMI_Background_Car-01.png</file>
+ <file>HMI_AppLauncher_Connectivity_Active-01.png</file>
+ <file>HMI_AppLauncher_Connectivity_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Dashboard_Active-01.png</file>
+ <file>HMI_AppLauncher_Dashboard_Inactive-01.png</file>
+ <file>HMI_AppLauncher_HVAC_Active-01.png</file>
+ <file>HMI_AppLauncher_HVAC_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Multimedia_Active-01.png</file>
+ <file>HMI_AppLauncher_Multimedia_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Navigation_Active-01.png</file>
+ <file>HMI_AppLauncher_Navigation_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Phone_Active-01.png</file>
+ <file>HMI_AppLauncher_Phone_Inactive-01.png</file>
+ <file>HMI_AppLauncher_POI_Active-01.png</file>
+ <file>HMI_AppLauncher_POI_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Radio_Active-01.png</file>
+ <file>HMI_AppLauncher_Radio_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Settings_Active-01.png</file>
+ <file>HMI_AppLauncher_Settings_Inactive-01.png</file>
+ </qresource>
+</RCC>
diff --git a/HomeScreen/qml/main.qml b/HomeScreen/qml/main.qml
index 542f395..143d649 100644
--- a/HomeScreen/qml/main.qml
+++ b/HomeScreen/qml/main.qml
@@ -18,6 +18,7 @@
import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
+import HomeScreen 1.0
Window {
visible: true
@@ -26,6 +27,14 @@ Window {
height: container.height * container.scale
title: 'HomeScreen'
+ ApplicationLauncher {
+ id: launcher
+ }
+
+ LayoutHandler {
+ id: layoutHandler
+ }
+
Image {
id: container
anchors.centerIn: parent
@@ -48,6 +57,16 @@ Window {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.preferredHeight: 1920 - 218 - 215
+
+ visible: true
+ }
+
+ Home {
+ id: appLauncherAreaLauncher
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredHeight: 1920 - 218 - 215
+ visible: false
}
MediaArea {
diff --git a/HomeScreen/qml/qml.qrc b/HomeScreen/qml/qml.qrc
index a916b03..3d699e0 100644
--- a/HomeScreen/qml/qml.qrc
+++ b/HomeScreen/qml/qml.qrc
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
+ <file>Home.qml</file>
<file>main.qml</file>
<file>MediaArea.qml</file>
<file>MediaAreaBlank.qml</file>
diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp
index 99f98c9..ac798a9 100644
--- a/HomeScreen/src/main.cpp
+++ b/HomeScreen/src/main.cpp
@@ -23,7 +23,7 @@
#include "../src2/applicationlauncher.h"
#include "../src2/statusbarmodel.h"
#include "layouthandler.h"
-
+#include "../src2/applicationmodel.h"
int main(int argc, char *argv[])
{
@@ -41,6 +41,7 @@ int main(int argc, char *argv[])
qDBusRegisterMetaType<QList<AppInfo> >();
qmlRegisterType<ApplicationLauncher>("HomeScreen", 1, 0, "ApplicationLauncher");
+ qmlRegisterType<ApplicationModel>("Home", 1, 0, "ApplicationModel");
qmlRegisterType<StatusBarModel>("HomeScreen", 1, 0, "StatusBarModel");
qmlRegisterType<LayoutHandler>("HomeScreen", 1, 0, "LayoutHandler");
diff --git a/HomeScreen/src2/appinfo.cpp b/HomeScreen/src2/appinfo.cpp
new file mode 100644
index 0000000..6b61632
--- /dev/null
+++ b/HomeScreen/src2/appinfo.cpp
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
+ * Copyright (C) 2016 The Qt Company Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "appinfo.h"
+
+#include <QtCore/QJsonObject>
+
+class AppInfo::Private : public QSharedData
+{
+public:
+ Private();
+ Private(const Private &other);
+
+ QString id;
+ QString version;
+ int width;
+ int height;
+ QString name;
+ QString description;
+ QString shortname;
+ QString author;
+ QString iconPath;
+};
+
+AppInfo::Private::Private()
+ : width(-1)
+ , height(-1)
+{
+}
+
+AppInfo::Private::Private(const Private &other)
+ : QSharedData(other)
+ , id(other.id)
+ , version(other.version)
+ , width(other.width)
+ , height(other.height)
+ , name(other.name)
+ , description(other.description)
+ , shortname(other.shortname)
+ , author(other.author)
+ , iconPath(other.iconPath)
+{
+}
+
+AppInfo::AppInfo()
+ : d(new Private)
+{
+}
+
+AppInfo::AppInfo(const QString &icon, const QString &name, const QString &id)
+ : d(new Private)
+{
+ d->iconPath = icon;
+ d->name = name;
+ d->id = id;
+}
+
+AppInfo::AppInfo(const AppInfo &other)
+ : d(other.d)
+{
+}
+
+AppInfo::~AppInfo()
+{
+}
+
+AppInfo &AppInfo::operator =(const AppInfo &other)
+{
+ d = other.d;
+ return *this;
+}
+
+QString AppInfo::id() const
+{
+ return d->id;
+}
+
+QString AppInfo::version() const
+{
+ return d->version;
+}
+
+int AppInfo::width() const
+{
+ return d->width;
+}
+
+int AppInfo::height() const
+{
+ return d->height;
+}
+
+QString AppInfo::name() const
+{
+ return d->name;
+}
+
+QString AppInfo::description() const
+{
+ return d->description;
+}
+
+QString AppInfo::shortname() const
+{
+ return d->shortname;
+}
+
+QString AppInfo::author() const
+{
+ return d->author;
+}
+
+QString AppInfo::iconPath() const
+{
+ return d->iconPath;
+}
+
+void AppInfo::read(const QJsonObject &json)
+{
+ d->id = json["id"].toString();
+ d->version = json["version"].toString();
+ d->width = json["width"].toInt();
+ d->height = json["height"].toInt();
+ d->name = json["name"].toString();
+ d->description = json["description"].toString();
+ d->shortname = json["shortname"].toString();
+ d->author = json["author"].toString();
+ d->iconPath = json["iconPath"].toString();
+}
+
+QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo)
+{
+ argument.beginStructure();
+ argument << appInfo.d->id;
+ argument << appInfo.d->version;
+ argument << appInfo.d->width;
+ argument << appInfo.d->height;
+ argument << appInfo.d->name;
+ argument << appInfo.d->description;
+ argument << appInfo.d->shortname;
+ argument << appInfo.d->author;
+ argument << appInfo.d->iconPath;
+ argument.endStructure();
+
+ return argument;
+}
+
+const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo)
+{
+ argument.beginStructure();
+ argument >> appInfo.d->id;
+ argument >> appInfo.d->version;
+ argument >> appInfo.d->width;
+ argument >> appInfo.d->height;
+ argument >> appInfo.d->name;
+ argument >> appInfo.d->description;
+ argument >> appInfo.d->shortname;
+ argument >> appInfo.d->author;
+ argument >> appInfo.d->iconPath;
+ argument.endStructure();
+ return argument;
+}
diff --git a/HomeScreen/src2/appinfo.h b/HomeScreen/src2/appinfo.h
new file mode 100644
index 0000000..a800a80
--- /dev/null
+++ b/HomeScreen/src2/appinfo.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
+ * Copyright (C) 2016 The Qt Company Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APPINFO_H
+#define APPINFO_H
+
+#include <QtCore/QSharedDataPointer>
+#include <QtDBus/QDBusArgument>
+
+class AppInfo
+{
+ Q_GADGET
+ Q_PROPERTY(QString id READ id)
+ Q_PROPERTY(QString version READ version)
+ Q_PROPERTY(int width READ width)
+ Q_PROPERTY(int height READ height)
+ Q_PROPERTY(QString name READ name)
+ Q_PROPERTY(QString description READ description)
+ Q_PROPERTY(QString shortname READ shortname)
+ Q_PROPERTY(QString author READ author)
+ Q_PROPERTY(QString iconPath READ iconPath)
+public:
+ AppInfo();
+ AppInfo(const QString &icon, const QString &name, const QString &id);
+ AppInfo(const AppInfo &other);
+ virtual ~AppInfo();
+ AppInfo &operator =(const AppInfo &other);
+ void swap(AppInfo &other) { qSwap(d, other.d); }
+
+ QString id() const;
+ QString version() const;
+ int width() const;
+ int height() const;
+ QString name() const;
+ QString description() const;
+ QString shortname() const;
+ QString author() const;
+ QString iconPath() const;
+
+ void read(const QJsonObject &json);
+
+ friend QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo);
+ friend const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo);
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+Q_DECLARE_SHARED(AppInfo)
+Q_DECLARE_METATYPE(AppInfo)
+Q_DECLARE_METATYPE(QList<AppInfo>)
+
+#endif // APPINFO_H
diff --git a/HomeScreen/src2/applicationmodel.cpp b/HomeScreen/src2/applicationmodel.cpp
new file mode 100644
index 0000000..b8bbb38
--- /dev/null
+++ b/HomeScreen/src2/applicationmodel.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2016 The Qt Company Ltd.
+ * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "applicationmodel.h"
+#include "appinfo.h"
+
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusReply>
+
+class ApplicationModel::Private
+{
+public:
+ Private(ApplicationModel *parent);
+
+private:
+ ApplicationModel *q;
+public:
+ QDBusInterface proxy;
+ QList<AppInfo> data;
+};
+
+ApplicationModel::Private::Private(ApplicationModel *parent)
+ : q(parent)
+ , proxy(QStringLiteral("org.agl.homescreenappframeworkbinder"), QStringLiteral("/AppFramework"), QStringLiteral("org.agl.appframework"), QDBusConnection::sessionBus())
+{
+ QDBusReply<QList<AppInfo>> reply = proxy.call("getAvailableApps");
+ if (false)/*reply.isValid()) TODO: test for CES! */ {
+ data = reply.value();
+ } else {
+ data.append(AppInfo(QStringLiteral("HVAC"), QStringLiteral("HVAC"), QStringLiteral("hvac@0.1")));
+ data.append(AppInfo(QStringLiteral("Navigation"), QStringLiteral("NAVIGATION"), QStringLiteral("navigation@0.1")));
+ data.append(AppInfo(QStringLiteral("Phone"), QStringLiteral("PHONE"), QStringLiteral("phone@0.1")));
+ data.append(AppInfo(QStringLiteral("Radio"), QStringLiteral("RADIO"), QStringLiteral("radio@0.1")));
+ data.append(AppInfo(QStringLiteral("Multimedia"), QStringLiteral("MULTIMEDIA"), QStringLiteral("multimedia@0.1")));
+ data.append(AppInfo(QStringLiteral("Connectivity"), QStringLiteral("CONNECTIVITY"), QStringLiteral("connectivity@0.1")));
+ data.append(AppInfo(QStringLiteral("Dashboard"), QStringLiteral("DASHBOARD"), QStringLiteral("dashboard@0.1")));
+ data.append(AppInfo(QStringLiteral("Settings"), QStringLiteral("SETTINGS"), QStringLiteral("settings@0.1")));
+ data.append(AppInfo(QStringLiteral("POI"), QStringLiteral("POINT OF\nINTEREST"), QStringLiteral("poi@0.1")));
+ }
+}
+
+ApplicationModel::ApplicationModel(QObject *parent)
+ : QAbstractListModel(parent)
+ , d(new Private(this))
+{
+}
+
+ApplicationModel::~ApplicationModel()
+{
+ delete d;
+}
+
+int ApplicationModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+
+ return d->data.count();
+}
+
+QVariant ApplicationModel::data(const QModelIndex &index, int role) const
+{
+ QVariant ret;
+ if (!index.isValid())
+ return ret;
+
+ switch (role) {
+ case Qt::DecorationRole:
+ ret = d->data[index.row()].iconPath();
+ break;
+ case Qt::DisplayRole:
+ ret = d->data[index.row()].name();
+ break;
+ case Qt::UserRole:
+ ret = d->data[index.row()].id();
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+QHash<int, QByteArray> ApplicationModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[Qt::DecorationRole] = "icon";
+ roles[Qt::DisplayRole] = "name";
+ roles[Qt::UserRole] = "id";
+ return roles;
+}
diff --git a/HomeScreen/src2/applicationmodel.h b/HomeScreen/src2/applicationmodel.h
new file mode 100644
index 0000000..bffc4c9
--- /dev/null
+++ b/HomeScreen/src2/applicationmodel.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 The Qt Company Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APPLICATIONMODEL_H
+#define APPLICATIONMODEL_H
+
+#include <QtCore/QAbstractListModel>
+
+class ApplicationModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit ApplicationModel(QObject *parent = nullptr);
+ ~ApplicationModel();
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QHash<int, QByteArray> roleNames() const override;
+
+private:
+ class Private;
+ Private *d;
+};
+
+#endif // APPLICATIONMODEL_H