From 63e7ab867c75ac550b923815955e6dae3f0da984 Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Tue, 19 Jun 2018 15:05:20 +0900 Subject: Delete launcher icon area from HomeScreen Delete Home QML file from main.qml. Change Home shortcut icon to launcher. Change-Id: Id1b3ffbbd24ee587a1d3bab1f86c90809bfc1209 Task-AGL: SPEC-1518 Signed-off-by: zheng_wenlong --- homescreen/homescreen.pro | 5 - homescreen/qml/Home.qml | 94 ----- homescreen/qml/ShortcutArea.qml | 26 +- .../images/Home/AGL_HMI_Blue_Background_Car-01.png | Bin 1052322 -> 0 bytes homescreen/qml/images/Home/blank_active.svg | 133 ------- homescreen/qml/images/Home/blank_inactive.svg | 76 ---- homescreen/qml/images/Home/connectivity_active.svg | 231 ------------ .../qml/images/Home/connectivity_inactive.svg | 169 --------- homescreen/qml/images/Home/dashboard_active.svg | 174 --------- homescreen/qml/images/Home/dashboard_inactive.svg | 94 ----- homescreen/qml/images/Home/home.qrc | 31 -- homescreen/qml/images/Home/hvac_active.svg | 411 --------------------- homescreen/qml/images/Home/hvac_inactive.svg | 349 ----------------- homescreen/qml/images/Home/mediaplayer_active.svg | 172 --------- .../qml/images/Home/mediaplayer_inactive.svg | 111 ------ homescreen/qml/images/Home/mixer_active.svg | 370 ------------------- homescreen/qml/images/Home/mixer_inactive.svg | 308 --------------- homescreen/qml/images/Home/navigation_active.svg | 245 ------------ homescreen/qml/images/Home/navigation_inactive.svg | 183 --------- homescreen/qml/images/Home/phone_active.svg | 155 -------- homescreen/qml/images/Home/phone_inactive.svg | 93 ----- homescreen/qml/images/Home/poi_active.svg | 352 ------------------ homescreen/qml/images/Home/poi_inactive.svg | 314 ---------------- homescreen/qml/images/Home/radio_active.svg | 383 ------------------- homescreen/qml/images/Home/radio_inactive.svg | 321 ---------------- homescreen/qml/images/Home/settings_active.svg | 176 --------- homescreen/qml/images/Home/settings_inactive.svg | 114 ------ homescreen/qml/images/Home/video_active.svg | 177 --------- homescreen/qml/images/Home/video_inactive.svg | 111 ------ homescreen/qml/images/Home/webbrowser_active.svg | 231 ------------ homescreen/qml/images/Home/webbrowser_inactive.svg | 165 --------- homescreen/qml/images/Shortcut/home.svg | 73 ---- homescreen/qml/images/Shortcut/home_active.svg | 82 ---- homescreen/qml/images/Shortcut/launcher.svg | 73 ++++ homescreen/qml/images/Shortcut/launcher_active.svg | 82 ++++ homescreen/qml/images/Shortcut/shortcut.qrc | 4 +- homescreen/qml/main.qml | 9 - homescreen/qml/qml.qrc | 1 - homescreen/src/appinfo.cpp | 177 --------- homescreen/src/appinfo.h | 69 ---- homescreen/src/applicationmodel.cpp | 154 -------- homescreen/src/applicationmodel.h | 42 --- homescreen/src/main.cpp | 7 - 43 files changed, 164 insertions(+), 6383 deletions(-) delete mode 100644 homescreen/qml/Home.qml delete mode 100644 homescreen/qml/images/Home/AGL_HMI_Blue_Background_Car-01.png delete mode 100644 homescreen/qml/images/Home/blank_active.svg delete mode 100644 homescreen/qml/images/Home/blank_inactive.svg delete mode 100644 homescreen/qml/images/Home/connectivity_active.svg delete mode 100644 homescreen/qml/images/Home/connectivity_inactive.svg delete mode 100644 homescreen/qml/images/Home/dashboard_active.svg delete mode 100644 homescreen/qml/images/Home/dashboard_inactive.svg delete mode 100644 homescreen/qml/images/Home/home.qrc delete mode 100644 homescreen/qml/images/Home/hvac_active.svg delete mode 100644 homescreen/qml/images/Home/hvac_inactive.svg delete mode 100644 homescreen/qml/images/Home/mediaplayer_active.svg delete mode 100644 homescreen/qml/images/Home/mediaplayer_inactive.svg delete mode 100644 homescreen/qml/images/Home/mixer_active.svg delete mode 100644 homescreen/qml/images/Home/mixer_inactive.svg delete mode 100644 homescreen/qml/images/Home/navigation_active.svg delete mode 100644 homescreen/qml/images/Home/navigation_inactive.svg delete mode 100644 homescreen/qml/images/Home/phone_active.svg delete mode 100644 homescreen/qml/images/Home/phone_inactive.svg delete mode 100644 homescreen/qml/images/Home/poi_active.svg delete mode 100644 homescreen/qml/images/Home/poi_inactive.svg delete mode 100644 homescreen/qml/images/Home/radio_active.svg delete mode 100644 homescreen/qml/images/Home/radio_inactive.svg delete mode 100644 homescreen/qml/images/Home/settings_active.svg delete mode 100644 homescreen/qml/images/Home/settings_inactive.svg delete mode 100644 homescreen/qml/images/Home/video_active.svg delete mode 100644 homescreen/qml/images/Home/video_inactive.svg delete mode 100644 homescreen/qml/images/Home/webbrowser_active.svg delete mode 100644 homescreen/qml/images/Home/webbrowser_inactive.svg delete mode 100644 homescreen/qml/images/Shortcut/home.svg delete mode 100644 homescreen/qml/images/Shortcut/home_active.svg create mode 100644 homescreen/qml/images/Shortcut/launcher.svg create mode 100644 homescreen/qml/images/Shortcut/launcher_active.svg delete mode 100644 homescreen/src/appinfo.cpp delete mode 100644 homescreen/src/appinfo.h delete mode 100644 homescreen/src/applicationmodel.cpp delete mode 100644 homescreen/src/applicationmodel.h diff --git a/homescreen/homescreen.pro b/homescreen/homescreen.pro index 70f4ca7..0e5bb58 100644 --- a/homescreen/homescreen.pro +++ b/homescreen/homescreen.pro @@ -26,8 +26,6 @@ include(../interfaces/interfaces.pri) SOURCES += \ src/main.cpp \ - src/applicationmodel.cpp \ - src/appinfo.cpp \ src/statusbarmodel.cpp \ src/statusbarserver.cpp \ src/applicationlauncher.cpp \ @@ -38,8 +36,6 @@ HEADERS += \ src/statusbarmodel.h \ src/statusbarserver.h \ src/applicationlauncher.h \ - src/applicationmodel.h \ - src/appinfo.h \ src/mastervolume.h \ src/homescreenhandler.h @@ -47,7 +43,6 @@ OTHER_FILES += \ README.md RESOURCES += \ - qml/images/Home/home.qrc \ qml/images/MediaPlayer/mediaplayer.qrc \ qml/images/MediaMusic/mediamusic.qrc \ qml/images/Weather/weather.qrc \ diff --git a/homescreen/qml/Home.qml b/homescreen/qml/Home.qml deleted file mode 100644 index 5d54093..0000000 --- a/homescreen/qml/Home.qml +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2016 The Qt Company Ltd. - * Copyright (C) 2016, 2017 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. - */ - -import QtQuick 2.2 -import Home 1.0 - -Item { - id: root - - Image { - y: 0 - anchors.fill: parent - anchors.topMargin: -218 - anchors.bottomMargin: -215 - source: './images/AGL_HMI_Blue_Background_Car-01.png' - } - - property int pid: -1 - width: 1080 - height: 1487 - - GridView { - id: grid - x: 60 - y: 100 - width: 960 - height: 1280 - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - contentHeight: 320 - flickableDirection: Flickable.AutoFlickDirection - snapMode: GridView.SnapOneRow - visible: true - cellWidth: 320 - cellHeight: 320 - interactive: false - - model: ApplicationModel { id: applicationModel } - delegate: IconItem { - width: grid.cellWidth - height: grid.cellHeight - } - - MouseArea { - id: loc - anchors.fill: parent - property string currentId: '' - property int newIndex: -1 - property int index: grid.indexAt(loc.mouseX, loc.mouseY) - x: 62 - y: 264 - anchors.rightMargin: 0 - anchors.bottomMargin: 0 - anchors.leftMargin: 0 - anchors.topMargin: 0 - onPressAndHold: currentId = applicationModel.id(newIndex = index) - onReleased: { - if (currentId === '') { - pid = launcher.launch(applicationModel.id(loc.index)) - if (1 < pid) { - applicationArea.visible = true - appLauncherAreaLauncher.visible = false - } - else { - console.warn("app cannot be launched!") - } - } else { - currentId = '' - } - homescreenHandler.tapShortcut(applicationModel.name(loc.index)) - } - onPositionChanged: { - if (loc.currentId === '') return - if (index < 0) return - if (index === newIndex) return - applicationModel.move(newIndex, newIndex = index) - } - } - } -} diff --git a/homescreen/qml/ShortcutArea.qml b/homescreen/qml/ShortcutArea.qml index 150658c..e0c9182 100644 --- a/homescreen/qml/ShortcutArea.qml +++ b/homescreen/qml/ShortcutArea.qml @@ -28,8 +28,8 @@ Item { ListModel { id: applicationModel ListElement { - name: 'Home' - application: '' + name: 'launcher' + application: 'launcher@0.1' } ListElement { name: 'MediaPlayer' @@ -58,27 +58,15 @@ Item { name: model.name active: model.name === launcher.current onClicked: { - if (0 === model.index) { - appLauncherAreaLauncher.visible = true - applicationArea.visible = false - launcher.current = 'Home' + pid = launcher.launch(model.application) + if (1 < pid) { + applicationArea.visible = true } else { - pid = launcher.launch(model.application) - if (1 < pid) { - applicationArea.visible = true - appLauncherAreaLauncher.visible = false - } - else { - console.warn(model.application) - console.warn("app cannot be launched!") - } + console.warn(model.application) + console.warn("app cannot be launched!") } homescreenHandler.tapShortcut(model.name) - if(model.name == 'Home') - { - layoutHandler.activateSurface('HomeScreen'); - } } } } diff --git a/homescreen/qml/images/Home/AGL_HMI_Blue_Background_Car-01.png b/homescreen/qml/images/Home/AGL_HMI_Blue_Background_Car-01.png deleted file mode 100644 index ef0690b..0000000 Binary files a/homescreen/qml/images/Home/AGL_HMI_Blue_Background_Car-01.png and /dev/null differ diff --git a/homescreen/qml/images/Home/blank_active.svg b/homescreen/qml/images/Home/blank_active.svg deleted file mode 100644 index 10c0a89..0000000 --- a/homescreen/qml/images/Home/blank_active.svg +++ /dev/null @@ -1,133 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/blank_inactive.svg b/homescreen/qml/images/Home/blank_inactive.svg deleted file mode 100644 index 2e467a6..0000000 --- a/homescreen/qml/images/Home/blank_inactive.svg +++ /dev/null @@ -1,76 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/connectivity_active.svg b/homescreen/qml/images/Home/connectivity_active.svg deleted file mode 100644 index 39d8e50..0000000 --- a/homescreen/qml/images/Home/connectivity_active.svg +++ /dev/null @@ -1,231 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/connectivity_inactive.svg b/homescreen/qml/images/Home/connectivity_inactive.svg deleted file mode 100644 index 4cb1c45..0000000 --- a/homescreen/qml/images/Home/connectivity_inactive.svg +++ /dev/null @@ -1,169 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/dashboard_active.svg b/homescreen/qml/images/Home/dashboard_active.svg deleted file mode 100644 index a826c0c..0000000 --- a/homescreen/qml/images/Home/dashboard_active.svg +++ /dev/null @@ -1,174 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/dashboard_inactive.svg b/homescreen/qml/images/Home/dashboard_inactive.svg deleted file mode 100644 index 9c26fe3..0000000 --- a/homescreen/qml/images/Home/dashboard_inactive.svg +++ /dev/null @@ -1,94 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/home.qrc b/homescreen/qml/images/Home/home.qrc deleted file mode 100644 index 4c89fe9..0000000 --- a/homescreen/qml/images/Home/home.qrc +++ /dev/null @@ -1,31 +0,0 @@ - - - AGL_HMI_Blue_Background_Car-01.png - connectivity_active.svg - connectivity_inactive.svg - dashboard_active.svg - dashboard_inactive.svg - hvac_active.svg - hvac_inactive.svg - mixer_active.svg - mixer_inactive.svg - mediaplayer_active.svg - mediaplayer_inactive.svg - navigation_active.svg - navigation_inactive.svg - phone_active.svg - phone_inactive.svg - poi_active.svg - poi_inactive.svg - radio_active.svg - radio_inactive.svg - settings_active.svg - settings_inactive.svg - video_active.svg - video_inactive.svg - webbrowser_active.svg - webbrowser_inactive.svg - blank_active.svg - blank_inactive.svg - - diff --git a/homescreen/qml/images/Home/hvac_active.svg b/homescreen/qml/images/Home/hvac_active.svg deleted file mode 100644 index 44d3bd5..0000000 --- a/homescreen/qml/images/Home/hvac_active.svg +++ /dev/null @@ -1,411 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/hvac_inactive.svg b/homescreen/qml/images/Home/hvac_inactive.svg deleted file mode 100644 index 67918e6..0000000 --- a/homescreen/qml/images/Home/hvac_inactive.svg +++ /dev/null @@ -1,349 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/mediaplayer_active.svg b/homescreen/qml/images/Home/mediaplayer_active.svg deleted file mode 100644 index d560c3a..0000000 --- a/homescreen/qml/images/Home/mediaplayer_active.svg +++ /dev/null @@ -1,172 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/mediaplayer_inactive.svg b/homescreen/qml/images/Home/mediaplayer_inactive.svg deleted file mode 100644 index b6ec056..0000000 --- a/homescreen/qml/images/Home/mediaplayer_inactive.svg +++ /dev/null @@ -1,111 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/mixer_active.svg b/homescreen/qml/images/Home/mixer_active.svg deleted file mode 100644 index 2cb3c07..0000000 --- a/homescreen/qml/images/Home/mixer_active.svg +++ /dev/null @@ -1,370 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/mixer_inactive.svg b/homescreen/qml/images/Home/mixer_inactive.svg deleted file mode 100644 index 32e69f0..0000000 --- a/homescreen/qml/images/Home/mixer_inactive.svg +++ /dev/null @@ -1,308 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/navigation_active.svg b/homescreen/qml/images/Home/navigation_active.svg deleted file mode 100644 index dc1fcd3..0000000 --- a/homescreen/qml/images/Home/navigation_active.svg +++ /dev/null @@ -1,245 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/navigation_inactive.svg b/homescreen/qml/images/Home/navigation_inactive.svg deleted file mode 100644 index 97fcf31..0000000 --- a/homescreen/qml/images/Home/navigation_inactive.svg +++ /dev/null @@ -1,183 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/phone_active.svg b/homescreen/qml/images/Home/phone_active.svg deleted file mode 100644 index e184f26..0000000 --- a/homescreen/qml/images/Home/phone_active.svg +++ /dev/null @@ -1,155 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/phone_inactive.svg b/homescreen/qml/images/Home/phone_inactive.svg deleted file mode 100644 index 7f26834..0000000 --- a/homescreen/qml/images/Home/phone_inactive.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/poi_active.svg b/homescreen/qml/images/Home/poi_active.svg deleted file mode 100644 index cb4bc0e..0000000 --- a/homescreen/qml/images/Home/poi_active.svg +++ /dev/null @@ -1,352 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/poi_inactive.svg b/homescreen/qml/images/Home/poi_inactive.svg deleted file mode 100644 index 09c8890..0000000 --- a/homescreen/qml/images/Home/poi_inactive.svg +++ /dev/null @@ -1,314 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/radio_active.svg b/homescreen/qml/images/Home/radio_active.svg deleted file mode 100644 index 2d04d72..0000000 --- a/homescreen/qml/images/Home/radio_active.svg +++ /dev/null @@ -1,383 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/radio_inactive.svg b/homescreen/qml/images/Home/radio_inactive.svg deleted file mode 100644 index dcac8ee..0000000 --- a/homescreen/qml/images/Home/radio_inactive.svg +++ /dev/null @@ -1,321 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/settings_active.svg b/homescreen/qml/images/Home/settings_active.svg deleted file mode 100644 index 5391a08..0000000 --- a/homescreen/qml/images/Home/settings_active.svg +++ /dev/null @@ -1,176 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/settings_inactive.svg b/homescreen/qml/images/Home/settings_inactive.svg deleted file mode 100644 index 882e3c4..0000000 --- a/homescreen/qml/images/Home/settings_inactive.svg +++ /dev/null @@ -1,114 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/video_active.svg b/homescreen/qml/images/Home/video_active.svg deleted file mode 100644 index 794a441..0000000 --- a/homescreen/qml/images/Home/video_active.svg +++ /dev/null @@ -1,177 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/video_inactive.svg b/homescreen/qml/images/Home/video_inactive.svg deleted file mode 100644 index 905d46f..0000000 --- a/homescreen/qml/images/Home/video_inactive.svg +++ /dev/null @@ -1,111 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/webbrowser_active.svg b/homescreen/qml/images/Home/webbrowser_active.svg deleted file mode 100644 index 70b4617..0000000 --- a/homescreen/qml/images/Home/webbrowser_active.svg +++ /dev/null @@ -1,231 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Home/webbrowser_inactive.svg b/homescreen/qml/images/Home/webbrowser_inactive.svg deleted file mode 100644 index 09f34c9..0000000 --- a/homescreen/qml/images/Home/webbrowser_inactive.svg +++ /dev/null @@ -1,165 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/Shortcut/home.svg b/homescreen/qml/images/Shortcut/home.svg deleted file mode 100644 index b6eab24..0000000 --- a/homescreen/qml/images/Shortcut/home.svg +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/homescreen/qml/images/Shortcut/home_active.svg b/homescreen/qml/images/Shortcut/home_active.svg deleted file mode 100644 index e85c7d8..0000000 --- a/homescreen/qml/images/Shortcut/home_active.svg +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/homescreen/qml/images/Shortcut/launcher.svg b/homescreen/qml/images/Shortcut/launcher.svg new file mode 100644 index 0000000..b6eab24 --- /dev/null +++ b/homescreen/qml/images/Shortcut/launcher.svg @@ -0,0 +1,73 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/Shortcut/launcher_active.svg b/homescreen/qml/images/Shortcut/launcher_active.svg new file mode 100644 index 0000000..e85c7d8 --- /dev/null +++ b/homescreen/qml/images/Shortcut/launcher_active.svg @@ -0,0 +1,82 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/Shortcut/shortcut.qrc b/homescreen/qml/images/Shortcut/shortcut.qrc index 3c691ce..5d67341 100644 --- a/homescreen/qml/images/Shortcut/shortcut.qrc +++ b/homescreen/qml/images/Shortcut/shortcut.qrc @@ -1,7 +1,7 @@ - home.svg - home_active.svg + launcher.svg + launcher_active.svg hvac.svg hvac_active.svg mediaplayer.svg diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 8417de0..1312e87 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -50,16 +50,7 @@ Window { Layout.fillHeight: true Layout.preferredHeight: 1920 - 218 - 215 - visible: false - } - - Home { - id: appLauncherAreaLauncher - Layout.fillWidth: true - Layout.fillHeight: true - Layout.preferredHeight: 1920 - 218 - 215 visible: true - z: -1 } MediaArea { diff --git a/homescreen/qml/qml.qrc b/homescreen/qml/qml.qrc index c25e266..e60ea63 100644 --- a/homescreen/qml/qml.qrc +++ b/homescreen/qml/qml.qrc @@ -1,6 +1,5 @@ - Home.qml main.qml MediaArea.qml MediaAreaBlank.qml diff --git a/homescreen/src/appinfo.cpp b/homescreen/src/appinfo.cpp deleted file mode 100644 index 7159a0b..0000000 --- a/homescreen/src/appinfo.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH - * Copyright (C) 2016 The Qt Company Ltd. - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * 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 - -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/src/appinfo.h b/homescreen/src/appinfo.h deleted file mode 100644 index a5ecf90..0000000 --- a/homescreen/src/appinfo.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH - * Copyright (C) 2016 The Qt Company Ltd. - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * 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 -#include - -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 d; -}; - -Q_DECLARE_SHARED(AppInfo) -Q_DECLARE_METATYPE(AppInfo) -Q_DECLARE_METATYPE(QList) - -#endif // APPINFO_H diff --git a/homescreen/src/applicationmodel.cpp b/homescreen/src/applicationmodel.cpp deleted file mode 100644 index 5b4bb01..0000000 --- a/homescreen/src/applicationmodel.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2016 The Qt Company Ltd. - * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * 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 "hmi-debug.h" - -#include -#include - -#include "afm_user_daemon_proxy.h" - -extern org::AGL::afm::user *afm_user_daemon_proxy; - -class ApplicationModel::Private -{ -public: - Private(); - - QList data; -}; - -namespace { - QString get_icon_name(QJsonObject const &i) - { - QString icon = i["name"].toString().toLower(); - - if ( !QFile::exists(QString(":/images/%1_active.svg").arg(icon)) || - !QFile::exists(QString(":/images/%1_inactive.svg").arg(icon)) ) - { - icon = "blank"; - } - return icon; - } -} - -ApplicationModel::Private::Private() -{ - QString apps = afm_user_daemon_proxy->runnables(QStringLiteral("")); - QJsonDocument japps = QJsonDocument::fromJson(apps.toUtf8()); - for (auto const &app : japps.array()) { - QJsonObject const &jso = app.toObject(); - auto const name = jso["name"].toString(); - auto const id = jso["id"].toString(); - auto const icon = get_icon_name(jso); - - // Hide HomeScreen icon itself - if (name != "homescreen-2017" && name != "OnScreenApp") { - this->data.append(AppInfo(icon, name, id)); - } - - HMI_DEBUG("HomeScreen","name: %s icon: %s id: %s.", name.toStdString().c_str(), icon.toStdString().c_str(), id.toStdString().c_str()); - } -} - -ApplicationModel::ApplicationModel(QObject *parent) - : QAbstractListModel(parent) - , d(new Private()) -{ -} - -ApplicationModel::~ApplicationModel() -{ - delete this->d; -} - -int ApplicationModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - - return this->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 = this->d->data[index.row()].iconPath(); - break; - case Qt::DisplayRole: - ret = this->d->data[index.row()].name(); - break; - case Qt::UserRole: - ret = this->d->data[index.row()].id(); - break; - default: - break; - } - - return ret; -} - -QHash ApplicationModel::roleNames() const -{ - QHash roles; - roles[Qt::DecorationRole] = "icon"; - roles[Qt::DisplayRole] = "name"; - roles[Qt::UserRole] = "id"; - return roles; -} - -QString ApplicationModel::id(int i) const -{ - return data(index(i), Qt::UserRole).toString(); -} - -QString ApplicationModel::name(int i) const -{ - return data(index(i), Qt::DisplayRole).toString(); -} - -void ApplicationModel::move(int from, int to) -{ - QModelIndex parent; - if (to < 0 || to > rowCount()) return; - if (from < to) { - if (!beginMoveRows(parent, from, from, parent, to + 1)) { - HMI_NOTICE("HomeScreen","from : %d, to : %d. false.", from, to); - return; - } - d->data.move(from, to); - endMoveRows(); - } else if (from > to) { - if (!beginMoveRows(parent, from, from, parent, to)) { - HMI_NOTICE("HomeScreen","from : %d, to : %d. false.", from, to); - return; - } - d->data.move(from, to); - endMoveRows(); - } else { - HMI_NOTICE("HomeScreen","from : %d, to : %d. false.", from, to); - } -} diff --git a/homescreen/src/applicationmodel.h b/homescreen/src/applicationmodel.h deleted file mode 100644 index 64f9c53..0000000 --- a/homescreen/src/applicationmodel.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - -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 roleNames() const override; - Q_INVOKABLE QString id(int index) const; - Q_INVOKABLE QString name(int index) const; - Q_INVOKABLE void move(int from, int to); - -private: - class Private; - Private *d; -}; - -#endif // APPLICATIONMODEL_H diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 8845253..fbb430f 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -27,8 +27,6 @@ #include #include "applicationlauncher.h" #include "statusbarmodel.h" -#include "applicationmodel.h" -#include "appinfo.h" #include "afm_user_daemon_proxy.h" #include "mastervolume.h" #include "homescreenhandler.h" @@ -89,14 +87,9 @@ int main(int argc, char *argv[]) // import C++ class to QML // qmlRegisterType("HomeScreen", 1, 0, "ApplicationLauncher"); - qmlRegisterType("Home", 1, 0, "ApplicationModel"); qmlRegisterType("HomeScreen", 1, 0, "StatusBarModel"); qmlRegisterType("MasterVolume", 1, 0, "MasterVolume"); - // DBus - qDBusRegisterMetaType(); - qDBusRegisterMetaType >(); - ApplicationLauncher *launcher = new ApplicationLauncher(); QLibWindowmanager* layoutHandler = new QLibWindowmanager(); if(layoutHandler->init(port,token) != 0){ -- cgit 1.2.3-korg