From 85392e71f90a0322fdc08359ef1d829cdcf67381 Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Tue, 10 Jul 2018 18:11:51 +0900 Subject: Copy source code from homescreen-2017 We decide to use homescreen instead of homescreen-2017. Copy the source code from homescreen-2017 and delete word "-2017". Revision: b4db06287bc997ded71deab50ff0ff5889b09e1f Bug-AGL: SPEC-1549 Change-Id: Id77226b7ce35bbc29c868281c37b76ea3f930ad5 Signed-off-by: zheng_wenlong --- .gitignore | 2 + .mailmap | 1 + README.md | 41 +- homescreen.pro | 8 +- homescreen/conf/HomeScreen.service | 17 - homescreen/homescreen.pro | 21 +- homescreen/qml/Home.qml | 80 --- homescreen/qml/IconItem.qml | 83 ++- homescreen/qml/MediaArea.qml | 2 +- homescreen/qml/MediaAreaBlank.qml | 18 +- homescreen/qml/MediaAreaMusic.qml | 2 +- homescreen/qml/ShortcutArea.qml | 30 +- homescreen/qml/ShortcutIcon.qml | 60 +- homescreen/qml/StatusArea.qml | 27 +- homescreen/qml/TopArea.qml | 16 + .../qml/images/AGL_HMI_Background_NoCar-01.png | Bin 944767 -> 0 bytes .../images/AGL_HMI_Blue_Background_NoCar-01.png | Bin 0 -> 949053 bytes .../qml/images/Home/AGL_HMI_Background_Car-01.png | Bin 216666 -> 0 bytes .../HMI_AppLauncher_Connectivity_Active-01.png | Bin 34136 -> 0 bytes .../HMI_AppLauncher_Connectivity_Inactive-01.png | Bin 26878 -> 0 bytes .../Home/HMI_AppLauncher_Dashboard_Active-01.png | Bin 32014 -> 0 bytes .../Home/HMI_AppLauncher_Dashboard_Inactive-01.png | Bin 25298 -> 0 bytes .../images/Home/HMI_AppLauncher_HVAC_Active-01.png | Bin 31650 -> 0 bytes .../Home/HMI_AppLauncher_HVAC_Inactive-01.png | Bin 24398 -> 0 bytes .../Home/HMI_AppLauncher_Mixer_Active-01.png | Bin 29104 -> 0 bytes .../Home/HMI_AppLauncher_Mixer_Inactive-01.png | Bin 21878 -> 0 bytes .../Home/HMI_AppLauncher_Multimedia_Active-01.png | Bin 29605 -> 0 bytes .../HMI_AppLauncher_Multimedia_Inactive-01.png | Bin 23307 -> 0 bytes .../Home/HMI_AppLauncher_Navigation_Active-01.png | Bin 38244 -> 0 bytes .../HMI_AppLauncher_Navigation_Inactive-01.png | Bin 33027 -> 0 bytes .../images/Home/HMI_AppLauncher_POI_Active-01.png | Bin 33356 -> 0 bytes .../Home/HMI_AppLauncher_POI_Inactive-01.png | Bin 26924 -> 0 bytes .../Home/HMI_AppLauncher_Phone_Active-01.png | Bin 30830 -> 0 bytes .../Home/HMI_AppLauncher_Phone_Inactive-01.png | Bin 23978 -> 0 bytes .../Home/HMI_AppLauncher_Radio_Active-01.png | Bin 29028 -> 0 bytes .../Home/HMI_AppLauncher_Radio_Inactive-01.png | Bin 21186 -> 0 bytes .../Home/HMI_AppLauncher_Settings_Active-01.png | Bin 33558 -> 0 bytes .../Home/HMI_AppLauncher_Settings_Inactive-01.png | Bin 26571 -> 0 bytes homescreen/qml/images/Home/home.qrc | 25 - .../qml/images/Shortcut/HMI_Shortcut_HVAC-01.png | Bin 4108 -> 0 bytes .../Shortcut/HMI_Shortcut_HVAC_Active-01.png | Bin 5908 -> 0 bytes .../qml/images/Shortcut/HMI_Shortcut_Home-01.png | Bin 3435 -> 0 bytes .../Shortcut/HMI_Shortcut_Home_Active-01.png | Bin 4924 -> 0 bytes .../images/Shortcut/HMI_Shortcut_Multimedia-01.png | Bin 4114 -> 0 bytes .../Shortcut/HMI_Shortcut_Multimedia_Active-01.png | Bin 5973 -> 0 bytes .../images/Shortcut/HMI_Shortcut_Navigation-01.png | Bin 7122 -> 0 bytes .../Shortcut/HMI_Shortcut_Navigation_Active-01.png | Bin 9799 -> 0 bytes homescreen/qml/images/Shortcut/hvac.svg | 600 ++++++++++++++++++++ homescreen/qml/images/Shortcut/hvac_active.svg | 614 +++++++++++++++++++++ homescreen/qml/images/Shortcut/launcher.svg | 73 +++ homescreen/qml/images/Shortcut/launcher_active.svg | 82 +++ homescreen/qml/images/Shortcut/mediaplayer.svg | 50 ++ .../qml/images/Shortcut/mediaplayer_active.svg | 63 +++ homescreen/qml/images/Shortcut/navigation.svg | 77 +++ .../qml/images/Shortcut/navigation_active.svg | 90 +++ homescreen/qml/images/Shortcut/shortcut.qrc | 16 +- homescreen/qml/images/Utility_Logo_Colour-01.png | Bin 8638 -> 0 bytes homescreen/qml/images/Utility_Logo_Grey-01.svg | 84 +++ homescreen/qml/images/images.qrc | 4 +- homescreen/qml/main.qml | 14 +- homescreen/qml/qml.qrc | 1 - homescreen/src/appinfo.cpp | 176 ------ homescreen/src/appinfo.h | 68 --- homescreen/src/applicationlauncher.cpp | 37 +- homescreen/src/applicationlauncher.h | 11 + homescreen/src/applicationmodel.cpp | 144 ----- homescreen/src/applicationmodel.h | 41 -- homescreen/src/hmi-debug.h | 70 +++ homescreen/src/homescreencontrolinterface.cpp | 86 --- homescreen/src/homescreencontrolinterface.h | 52 -- homescreen/src/homescreenhandler.cpp | 88 +++ homescreen/src/homescreenhandler.h | 47 ++ homescreen/src/layouthandler.cpp | 279 ---------- homescreen/src/layouthandler.h | 65 --- homescreen/src/main.cpp | 107 ++-- homescreen/src/mainwindow.cpp | 186 ------- homescreen/src/mainwindow.h | 83 --- homescreen/src/mastervolume.cpp | 2 - homescreen/src/mastervolume.h | 1 - homescreen/src/paclient.cpp | 240 -------- homescreen/src/paclient.h | 64 --- homescreen/src/popupwidget.cpp | 92 --- homescreen/src/popupwidget.h | 58 -- homescreen/src/settingswidget.cpp | 103 ---- homescreen/src/settingswidget.h | 53 -- homescreensimulator/LICENSE | 54 -- homescreensimulator/README.md | 11 - homescreensimulator/homescreensimulator.pro | 32 -- homescreensimulator/resources/mainwindow.ui | 375 ------------- homescreensimulator/src/main.cpp | 54 -- homescreensimulator/src/mainwindow.cpp | 179 ------ homescreensimulator/src/mainwindow.h | 75 --- interfaces/daynightmode.xml | 21 - interfaces/homescreen.xml | 106 ---- interfaces/include/daynightmode.hpp | 29 - interfaces/include/homescreen.hpp | 23 - interfaces/include/inputevent.hpp | 30 - interfaces/include/popup.hpp | 31 -- interfaces/include/proximity.hpp | 22 - interfaces/include/windowmanager.hpp | 82 --- interfaces/inputevent.xml | 22 - interfaces/interfaces.pro | 15 +- interfaces/popup.xml | 26 - interfaces/proximity.xml | 21 - interfaces/src/windowmanager.cpp | 116 ---- interfaces/windowmanager.xml | 209 ------- package/config.xml | 19 + package/icon.svg | 279 ++++++++++ package/package.pro | 22 + sampleapptimedate/LICENSE | 54 -- sampleapptimedate/README.md | 11 - sampleapptimedate/sampleapptimedate.pro | 28 - sampleapptimedate/src/main.cpp | 36 -- sampleapptimedate/src/timedateprovider.cpp | 76 --- sampleapptimedate/src/timedateprovider.hpp | 27 - test/commandlinetests.txt | 150 ----- 116 files changed, 2611 insertions(+), 3978 deletions(-) delete mode 100644 homescreen/conf/HomeScreen.service delete mode 100644 homescreen/qml/Home.qml delete mode 100644 homescreen/qml/images/AGL_HMI_Background_NoCar-01.png create mode 100644 homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png delete mode 100644 homescreen/qml/images/Home/AGL_HMI_Background_Car-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Connectivity_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Connectivity_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Dashboard_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Dashboard_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_HVAC_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_HVAC_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Multimedia_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Multimedia_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Navigation_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Navigation_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_POI_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_POI_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Phone_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Phone_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Radio_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Radio_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Settings_Active-01.png delete mode 100644 homescreen/qml/images/Home/HMI_AppLauncher_Settings_Inactive-01.png delete mode 100644 homescreen/qml/images/Home/home.qrc delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC-01.png delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC_Active-01.png delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_Home-01.png delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_Home_Active-01.png delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia-01.png delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia_Active-01.png delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation-01.png delete mode 100644 homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation_Active-01.png create mode 100644 homescreen/qml/images/Shortcut/hvac.svg create mode 100644 homescreen/qml/images/Shortcut/hvac_active.svg create mode 100644 homescreen/qml/images/Shortcut/launcher.svg create mode 100644 homescreen/qml/images/Shortcut/launcher_active.svg create mode 100644 homescreen/qml/images/Shortcut/mediaplayer.svg create mode 100644 homescreen/qml/images/Shortcut/mediaplayer_active.svg create mode 100644 homescreen/qml/images/Shortcut/navigation.svg create mode 100644 homescreen/qml/images/Shortcut/navigation_active.svg delete mode 100644 homescreen/qml/images/Utility_Logo_Colour-01.png create mode 100644 homescreen/qml/images/Utility_Logo_Grey-01.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 create mode 100644 homescreen/src/hmi-debug.h delete mode 100644 homescreen/src/homescreencontrolinterface.cpp delete mode 100644 homescreen/src/homescreencontrolinterface.h create mode 100644 homescreen/src/homescreenhandler.cpp create mode 100644 homescreen/src/homescreenhandler.h delete mode 100644 homescreen/src/layouthandler.cpp delete mode 100644 homescreen/src/layouthandler.h delete mode 100644 homescreen/src/mainwindow.cpp delete mode 100644 homescreen/src/mainwindow.h delete mode 100644 homescreen/src/paclient.cpp delete mode 100644 homescreen/src/paclient.h delete mode 100644 homescreen/src/popupwidget.cpp delete mode 100644 homescreen/src/popupwidget.h delete mode 100644 homescreen/src/settingswidget.cpp delete mode 100644 homescreen/src/settingswidget.h delete mode 100644 homescreensimulator/LICENSE delete mode 100644 homescreensimulator/README.md delete mode 100644 homescreensimulator/homescreensimulator.pro delete mode 100644 homescreensimulator/resources/mainwindow.ui delete mode 100644 homescreensimulator/src/main.cpp delete mode 100644 homescreensimulator/src/mainwindow.cpp delete mode 100644 homescreensimulator/src/mainwindow.h delete mode 100644 interfaces/daynightmode.xml delete mode 100644 interfaces/homescreen.xml delete mode 100644 interfaces/include/daynightmode.hpp delete mode 100644 interfaces/include/homescreen.hpp delete mode 100644 interfaces/include/inputevent.hpp delete mode 100644 interfaces/include/popup.hpp delete mode 100644 interfaces/include/proximity.hpp delete mode 100644 interfaces/include/windowmanager.hpp delete mode 100644 interfaces/inputevent.xml delete mode 100644 interfaces/popup.xml delete mode 100644 interfaces/proximity.xml delete mode 100644 interfaces/src/windowmanager.cpp delete mode 100644 interfaces/windowmanager.xml create mode 100644 package/config.xml create mode 100644 package/icon.svg create mode 100644 package/package.pro delete mode 100644 sampleapptimedate/LICENSE delete mode 100644 sampleapptimedate/README.md delete mode 100644 sampleapptimedate/sampleapptimedate.pro delete mode 100644 sampleapptimedate/src/main.cpp delete mode 100644 sampleapptimedate/src/timedateprovider.cpp delete mode 100644 sampleapptimedate/src/timedateprovider.hpp delete mode 100644 test/commandlinetests.txt diff --git a/.gitignore b/.gitignore index 051f2d5..121b920 100644 --- a/.gitignore +++ b/.gitignore @@ -122,4 +122,6 @@ CMakeLists.txt.user *.out *.app +build/ + diff --git a/.mailmap b/.mailmap index 3847d76..92a6805 100644 --- a/.mailmap +++ b/.mailmap @@ -1,3 +1,4 @@ Jens Bocklage Jan-Simon Möller +Zheng Wenlong diff --git a/README.md b/README.md index 2a60758..2c04a91 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,44 @@ This project contains: HomeScreen: AGL Home Screen reference implementation -HomeScreenSimulator: AGL Home Screen Simulator for development -SampleAppTimeDate: AGL Sample Application for Home Screen Statusbar -AGL repo for source code: -https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2FHomeScreen.git +**AGL repo for source code** -AGL repo for bitbake recipe: -https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl-demo.git;a=blob;f=recipes-demo-hmi/homescreen/homescreen_git.bb +``` +$ mkdir WORK +$ cd WORK +$ repo init -b dab -m dab_4.0.0_xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo +$ repo sync +$ git clone git clone https://gerrit.automotivelinux.org/gerrit/staging/meta-hmi-framework +``` +Then you can get the following recipe. +* `meta-agl-demo/recipes-demo-hmi/homescreen` -Quickstart: + +**Bitbake** + +``` +$ source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo agl-devel agl-appfw-smack agl-hmi-framework +$ bitbake homescreen +``` Instructions for building HomeScreen app ---------------------------------------- -The HomeScreen app is part of the +The HomeScreen app is part of the packagegroup-agl-demo-platform packagegroup. This also includes the following apps: -- HomeScreenAppFrameworkBinderAGL -- InputEventManager -- SampleHomeScreenInterfaceApp - WindowManager - +- HomeScreen Binder And the library - libhomescreen +- libwindowmanager To build all the above, follow the instrucions on the AGL @@ -39,3 +47,12 @@ http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/source-cod Please activate the "agl-demo" feature when running the aglsetup script: http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/source-code.html#features-supported-by-aglsetup + + +Launch HomeScreen App: + +Usage: + +``` +afm-util start homescreen +``` diff --git a/homescreen.pro b/homescreen.pro index ef4d449..7c49383 100644 --- a/homescreen.pro +++ b/homescreen.pro @@ -1,4 +1,4 @@ -# 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. @@ -18,9 +18,7 @@ load(configure) SUBDIRS = interfaces \ homescreen \ - homescreensimulator \ - sampleapptimedate + package homescreen.depends = interfaces -homescreensimulator.depends = interfaces -sampleapptimedate.depends = interfaces +package.depends += homescreen diff --git a/homescreen/conf/HomeScreen.service b/homescreen/conf/HomeScreen.service deleted file mode 100644 index 3a89242..0000000 --- a/homescreen/conf/HomeScreen.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=AGL reference HomeScreen -Requires=dbus.service afm-user-daemon.service InputEventManager.service HomeScreenAppFrameworkBinderAGL.service -After=dbus.service afm-user-daemon.service InputEventManager.service HomeScreenAppFrameworkBinderAGL.service WindowManager.service -ConditionKernelCommandLine=!agl.nogfx - -[Service] -Type=dbus -BusName=org.agl.homescreen -ExecStart=/usr/AGL/homescreen/HomeScreen -# 4194304(= 1 << 22) is special surface id for HomeScreen -Environment=QT_IVI_SURFACE_ID=4194304 QT_WAYLAND_SHELL_INTEGRATION=ivi-shell LD_PRELOAD=/usr/lib/libEGL.so.1 -Restart=on-failure -RestartSec=5 - -[Install] -WantedBy=default.target diff --git a/homescreen/homescreen.pro b/homescreen/homescreen.pro index 061d2fb..0e5bb58 100644 --- a/homescreen/homescreen.pro +++ b/homescreen/homescreen.pro @@ -1,4 +1,5 @@ # 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. @@ -14,40 +15,34 @@ TEMPLATE = app TARGET = HomeScreen -QT = qml quick dbus +QT = qml quick dbus websockets CONFIG += c++11 link_pkgconfig -PKGCONFIG += libpulse +DESTDIR = $${OUT_PWD}/../package/root/bin +PKGCONFIG += qlibwindowmanager qtappfw + +LIBS += -lhomescreen include(../interfaces/interfaces.pri) SOURCES += \ src/main.cpp \ - src/homescreencontrolinterface.cpp \ - src/layouthandler.cpp \ - src/applicationmodel.cpp \ - src/appinfo.cpp \ src/statusbarmodel.cpp \ src/statusbarserver.cpp \ src/applicationlauncher.cpp \ src/mastervolume.cpp \ - src/paclient.cpp + src/homescreenhandler.cpp HEADERS += \ - src/homescreencontrolinterface.h \ - src/layouthandler.h \ src/statusbarmodel.h \ src/statusbarserver.h \ src/applicationlauncher.h \ - src/applicationmodel.h \ - src/appinfo.h \ src/mastervolume.h \ - src/paclient.h + src/homescreenhandler.h 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 de8b9bb..0000000 --- a/homescreen/qml/Home.qml +++ /dev/null @@ -1,80 +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 { - anchors.fill: parent - anchors.topMargin: -218 - anchors.bottomMargin: -215 - source: './images/AGL_HMI_Background_Car-01.png' - } - - property int pid: -1 - - GridView { - id: grid - anchors.centerIn: parent - width: cellHeight * 3 - height: cellHeight * 3 - 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) - onPressAndHold: currentId = applicationModel.id(newIndex = index) - onReleased: { - if (currentId === '') { - pid = launcher.launch(applicationModel.id(loc.index)) - if (1 < pid) { - layoutHandler.makeMeVisible(pid) - - applicationArea.visible = true - appLauncherAreaLauncher.visible = false - layoutHandler.showAppLayer(applicationModel.id(loc.index), pid) - } - else { - console.warn("app cannot be launched!") - } - } else { - currentId = '' - } - } - onPositionChanged: { - if (loc.currentId === '') return - if (index < 0) return - if (index === newIndex) return - applicationModel.move(newIndex, newIndex = index) - } - } - } -} diff --git a/homescreen/qml/IconItem.qml b/homescreen/qml/IconItem.qml index 59131c0..a5c032e 100644 --- a/homescreen/qml/IconItem.qml +++ b/homescreen/qml/IconItem.qml @@ -1,13 +1,74 @@ import QtQuick 2.0 +import QtQuick.Controls 2.0 +import QtGraphicalEffects 1.0 Item { id: main - Image { - id: item; parent: loc - x: main.x + 5; y: main.y + 5 - width: main.width - 10; height: main.height - 10; - source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(loc.pressed && (loc.index === model.index || loc.currentId === model.id) ? 'Active' : 'Inactive') - antialiasing: item.state !== '' + width: 320 + height: 320 + property string icon: model.icon + + Item { + id: container + parent: loc + x: main.x + y: main.y + width: main.width + height: main.height + + Image { + id: item + anchors.top: parent.top + anchors.topMargin: 20 + anchors.horizontalCenter: parent.horizontalCenter + width: 220 + height: width + source: './images/%1_%2.svg'.arg(model.icon).arg(loc.pressed && (loc.index === model.index || loc.currentId === model.id) ? 'active' : 'inactive') + antialiasing: item.state !== '' + + property string initial: model.name.substring(0,1).toUpperCase() + + Item { + id: title + width: 125 + height: 125 + anchors.centerIn: parent + Repeater { + delegate: Label { + style: Text.Outline + styleColor: 'red' + color: 'transparent' + font.pixelSize: 125 + anchors.centerIn: parent + anchors.horizontalCenterOffset: model.index / 3 - 1 + anchors.verticalCenterOffset: model.index % 3 - 1 + text: item.initial + } + model: main.icon === 'blank' ? 9 : 0 + } + layer.enabled: true + layer.effect: LinearGradient { + gradient: Gradient { + GradientStop { position: -0.5; color: "#6BFBFF" } + GradientStop { position: +1.5; color: "#00ADDC" } + } + } + } + } + Label { + id: name + anchors.top: item.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 20 + font.pixelSize: 25 + font.letterSpacing: 5 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + color: "white" + text: qsTr(model.name.toUpperCase()) + } + Behavior on x { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } } Behavior on y { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } } SequentialAnimation on rotation { @@ -21,12 +82,18 @@ Item { State { name: 'active' when: loc.currentId == model.id - PropertyChanges { target: item; x: loc.mouseX - width/2; y: loc.mouseY - height/2; scale: 1.15; z: 10 } + PropertyChanges { + target: container + x: loc.mouseX - width/2 + y: loc.mouseY - height/2 + scale: 1.15 + z: 10 + } }, State { when: loc.currentId !== '' PropertyChanges { - target: item + target: container scale: 0.85 opacity: 0.75 } diff --git a/homescreen/qml/MediaArea.qml b/homescreen/qml/MediaArea.qml index d7159d2..0447589 100644 --- a/homescreen/qml/MediaArea.qml +++ b/homescreen/qml/MediaArea.qml @@ -16,7 +16,7 @@ */ import QtQuick 2.2 -import QtQuick.Controls 1.0 +import QtQuick.Controls 2.0 StackView { id: root diff --git a/homescreen/qml/MediaAreaBlank.qml b/homescreen/qml/MediaAreaBlank.qml index 51fa657..2b888c8 100644 --- a/homescreen/qml/MediaAreaBlank.qml +++ b/homescreen/qml/MediaAreaBlank.qml @@ -42,7 +42,7 @@ Image { Image { id: logo_image anchors.centerIn: parent - source: './images/Utility_Logo_Colour-01.png' + source: './images/Utility_Logo_Grey-01.svg' } Timer { @@ -84,7 +84,7 @@ Image { font.pixelSize: 36 anchors.horizontalCenter: parent.horizontalCenter color: "white" - text: "Master Volume" + text: qsTr("Master Volume") } RowLayout { @@ -110,20 +110,6 @@ Image { if (pressed) {volume_timer.stop()} else {volume_timer.restart()} } - background: Rectangle { - id: slider_bg - height: 16 - color: "#59FF7F" - } - handle: Rectangle { - anchors.verticalCenter: slider_bg.verticalCenter - width: 48 - height: 48 - radius: 24 - x: slider.leftPadding + slider.visualPosition * (slider.availableWidth - width) - y: slider.topPadding + slider.availableHeight / 2 - height / 2 - color: "white" - } } Label { font.pixelSize: 36 diff --git a/homescreen/qml/MediaAreaMusic.qml b/homescreen/qml/MediaAreaMusic.qml index 927e82c..c0408e6 100644 --- a/homescreen/qml/MediaAreaMusic.qml +++ b/homescreen/qml/MediaAreaMusic.qml @@ -17,7 +17,7 @@ import QtQuick 2.2 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.0 +import QtQuick.Controls 2.0 Image { width: 1080 diff --git a/homescreen/qml/ShortcutArea.qml b/homescreen/qml/ShortcutArea.qml index 9be3fd0..e0c9182 100644 --- a/homescreen/qml/ShortcutArea.qml +++ b/homescreen/qml/ShortcutArea.qml @@ -1,6 +1,7 @@ /* * 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. @@ -27,11 +28,11 @@ Item { ListModel { id: applicationModel ListElement { - name: 'Home' - application: '' + name: 'launcher' + application: 'launcher@0.1' } ListElement { - name: 'Multimedia' + name: 'MediaPlayer' application: 'mediaplayer@0.1' } ListElement { @@ -55,26 +56,17 @@ Item { Layout.fillWidth: true Layout.fillHeight: true name: model.name - active: model.application === launcher.current + active: model.name === launcher.current onClicked: { - if (0 === model.index) { - appLauncherAreaLauncher.visible = true - applicationArea.visible = false - layoutHandler.hideAppLayer() - launcher.current = '' + 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 - layoutHandler.makeMeVisible(pid) - layoutHandler.showAppLayer(model.application, pid) - } - else { - console.warn("app cannot be launched!") - } + console.warn(model.application) + console.warn("app cannot be launched!") } + homescreenHandler.tapShortcut(model.name) } } } diff --git a/homescreen/qml/ShortcutIcon.qml b/homescreen/qml/ShortcutIcon.qml index 6f8e05e..1100a7c 100644 --- a/homescreen/qml/ShortcutIcon.qml +++ b/homescreen/qml/ShortcutIcon.qml @@ -16,6 +16,8 @@ */ import QtQuick 2.2 +import QtQuick.Controls 2.0 +import QtGraphicalEffects 1.0 MouseArea { id: root @@ -23,23 +25,62 @@ MouseArea { height: 216.8 property string name: 'Home' property bool active: false - Image { + Item { id: icon + property real desaturation: 0 anchors.fill: parent - source: './images/Shortcut/HMI_Shortcut_%1-01.png'.arg(root.name) + Image { + id: inactiveIcon + anchors.fill: parent + source: './images/Shortcut/%1.svg'.arg(root.name.toLowerCase()) + } + Image { + id: activeIcon + anchors.fill: parent + source: './images/Shortcut/%1_active.svg'.arg(root.name.toLowerCase()) + opacity: 0.0 + } + layer.enabled: true + layer.effect: Desaturate { + id: desaturate + desaturation: icon.desaturation + cached: true + } } - Image { - anchors.fill: parent - source: './images/Shortcut/HMI_Shortcut_%1_Active-01.png'.arg(root.name) - opacity: 1.0 - icon.opacity + Label { + id: name + y: 160 + width: root.width - 10 + font.pixelSize: 15 + font.letterSpacing: 5 + // wrapMode: Text.WordWrap + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + color: "white" + text: qsTr(model.name.toUpperCase()) } states: [ State { - when: root.active + when: launcher.launching + PropertyChanges { + target: root + enabled: false + } PropertyChanges { target: icon + desaturation: 1.0 + } + }, + State { + when: root.active + PropertyChanges { + target: inactiveIcon opacity: 0.0 } + PropertyChanges { + target: activeIcon + opacity: 1.0 + } } ] @@ -47,8 +88,13 @@ MouseArea { Transition { NumberAnimation { properties: 'opacity' + duration: 500 easing.type: Easing.OutExpo } + NumberAnimation { + properties: 'desaturation' + duration: 250 + } } ] } diff --git a/homescreen/qml/StatusArea.qml b/homescreen/qml/StatusArea.qml index 3fc3079..ab14a23 100644 --- a/homescreen/qml/StatusArea.qml +++ b/homescreen/qml/StatusArea.qml @@ -17,7 +17,6 @@ import QtQuick 2.2 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.0 import HomeScreen 1.0 Item { @@ -31,6 +30,30 @@ Item { onTriggered: root.now = new Date } + Connections { + target: weather + + onConditionChanged: { + var icon = '' + + if (condition.indexOf("clouds") != -1) { + icon = "WeatherIcons_Cloudy-01.png" + } else if (condition.indexOf("thunderstorm") != -1) { + icon = "WeatherIcons_Thunderstorm-01.png" + } else if (condition.indexOf("snow") != -1) { + icon = "WeatherIcons_Snow-01.png" + } else if (condition.indexOf("rain") != -1) { + icon = "WeatherIcons_Rain-01.png" + } + + condition_item.source = icon ? './images/Weather/' + icon : '' + } + + onTemperatureChanged: { + temperature_item.text = temperature.split(".")[0] + '°F' + } + } + RowLayout { anchors.fill: parent spacing: 0 @@ -74,9 +97,11 @@ Item { Layout.fillHeight: true Layout.preferredHeight: 20 Image { + id: condition_item source: './images/Weather/WeatherIcons_Rain-01.png' } Text { + id: temperature_item text: '64°F' color: 'white' font.family: 'Helvetica' diff --git a/homescreen/qml/TopArea.qml b/homescreen/qml/TopArea.qml index 922742d..9cff3ed 100644 --- a/homescreen/qml/TopArea.qml +++ b/homescreen/qml/TopArea.qml @@ -17,6 +17,7 @@ import QtQuick 2.2 import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 Image { width: 1920 @@ -40,4 +41,19 @@ Image { Layout.preferredWidth: 295 } } + + Timer { + id: launching + interval: 500 + running: launcher.launching + } + + ProgressBar { + id: progressBar + anchors.verticalCenter: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + indeterminate: visible + visible: launcher.launching && !launching.running + } } diff --git a/homescreen/qml/images/AGL_HMI_Background_NoCar-01.png b/homescreen/qml/images/AGL_HMI_Background_NoCar-01.png deleted file mode 100644 index 595f742..0000000 Binary files a/homescreen/qml/images/AGL_HMI_Background_NoCar-01.png and /dev/null differ diff --git a/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png b/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png new file mode 100644 index 0000000..357c204 Binary files /dev/null and b/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png differ diff --git a/homescreen/qml/images/Home/AGL_HMI_Background_Car-01.png b/homescreen/qml/images/Home/AGL_HMI_Background_Car-01.png deleted file mode 100644 index b0072d8..0000000 Binary files a/homescreen/qml/images/Home/AGL_HMI_Background_Car-01.png and /dev/null 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 deleted file mode 100644 index 888d0bd..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Connectivity_Active-01.png and /dev/null 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 deleted file mode 100644 index ab83b0e..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Connectivity_Inactive-01.png and /dev/null 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 deleted file mode 100644 index 11d39e5..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Dashboard_Active-01.png and /dev/null 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 deleted file mode 100644 index 6c0b914..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Dashboard_Inactive-01.png and /dev/null 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 deleted file mode 100644 index efc11e9..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_HVAC_Active-01.png and /dev/null 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 deleted file mode 100644 index b528376..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_HVAC_Inactive-01.png and /dev/null differ diff --git a/homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Active-01.png b/homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Active-01.png deleted file mode 100644 index 41c499d..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Active-01.png and /dev/null differ diff --git a/homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Inactive-01.png b/homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Inactive-01.png deleted file mode 100644 index 93f81af..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Mixer_Inactive-01.png and /dev/null 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 deleted file mode 100644 index 1c99ac4..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Multimedia_Active-01.png and /dev/null 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 deleted file mode 100644 index 0bed61d..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Multimedia_Inactive-01.png and /dev/null 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 deleted file mode 100644 index e7ad085..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Navigation_Active-01.png and /dev/null 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 deleted file mode 100644 index dd40750..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Navigation_Inactive-01.png and /dev/null 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 deleted file mode 100644 index 2df01d3..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_POI_Active-01.png and /dev/null 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 deleted file mode 100644 index ec62b87..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_POI_Inactive-01.png and /dev/null 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 deleted file mode 100644 index 2150581..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Phone_Active-01.png and /dev/null 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 deleted file mode 100644 index 61dcedc..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Phone_Inactive-01.png and /dev/null 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 deleted file mode 100644 index 1aa5a01..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Radio_Active-01.png and /dev/null 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 deleted file mode 100644 index 616983e..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Radio_Inactive-01.png and /dev/null 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 deleted file mode 100644 index 1d13fd6..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Settings_Active-01.png and /dev/null 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 deleted file mode 100644 index 027f1fe..0000000 Binary files a/homescreen/qml/images/Home/HMI_AppLauncher_Settings_Inactive-01.png and /dev/null differ diff --git a/homescreen/qml/images/Home/home.qrc b/homescreen/qml/images/Home/home.qrc deleted file mode 100644 index e73633e..0000000 --- a/homescreen/qml/images/Home/home.qrc +++ /dev/null @@ -1,25 +0,0 @@ - - - AGL_HMI_Background_Car-01.png - HMI_AppLauncher_Connectivity_Active-01.png - HMI_AppLauncher_Connectivity_Inactive-01.png - HMI_AppLauncher_Dashboard_Active-01.png - HMI_AppLauncher_Dashboard_Inactive-01.png - HMI_AppLauncher_HVAC_Active-01.png - HMI_AppLauncher_HVAC_Inactive-01.png - HMI_AppLauncher_Mixer_Active-01.png - HMI_AppLauncher_Mixer_Inactive-01.png - HMI_AppLauncher_Multimedia_Active-01.png - HMI_AppLauncher_Multimedia_Inactive-01.png - HMI_AppLauncher_Navigation_Active-01.png - HMI_AppLauncher_Navigation_Inactive-01.png - HMI_AppLauncher_Phone_Active-01.png - HMI_AppLauncher_Phone_Inactive-01.png - HMI_AppLauncher_POI_Active-01.png - HMI_AppLauncher_POI_Inactive-01.png - HMI_AppLauncher_Radio_Active-01.png - HMI_AppLauncher_Radio_Inactive-01.png - HMI_AppLauncher_Settings_Active-01.png - HMI_AppLauncher_Settings_Inactive-01.png - - diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC-01.png deleted file mode 100644 index f5188f5..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC_Active-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC_Active-01.png deleted file mode 100644 index abe92d2..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_HVAC_Active-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_Home-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_Home-01.png deleted file mode 100644 index 9aca151..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_Home-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_Home_Active-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_Home_Active-01.png deleted file mode 100644 index 696168f..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_Home_Active-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia-01.png deleted file mode 100644 index 229860c..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia_Active-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia_Active-01.png deleted file mode 100644 index b0a023c..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_Multimedia_Active-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation-01.png deleted file mode 100644 index 34b0671..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation_Active-01.png b/homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation_Active-01.png deleted file mode 100644 index 98e6146..0000000 Binary files a/homescreen/qml/images/Shortcut/HMI_Shortcut_Navigation_Active-01.png and /dev/null differ diff --git a/homescreen/qml/images/Shortcut/hvac.svg b/homescreen/qml/images/Shortcut/hvac.svg new file mode 100644 index 0000000..5c76e85 --- /dev/null +++ b/homescreen/qml/images/Shortcut/hvac.svg @@ -0,0 +1,600 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/Shortcut/hvac_active.svg b/homescreen/qml/images/Shortcut/hvac_active.svg new file mode 100644 index 0000000..46be46b --- /dev/null +++ b/homescreen/qml/images/Shortcut/hvac_active.svg @@ -0,0 +1,614 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/mediaplayer.svg b/homescreen/qml/images/Shortcut/mediaplayer.svg new file mode 100644 index 0000000..de7448d --- /dev/null +++ b/homescreen/qml/images/Shortcut/mediaplayer.svg @@ -0,0 +1,50 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/Shortcut/mediaplayer_active.svg b/homescreen/qml/images/Shortcut/mediaplayer_active.svg new file mode 100644 index 0000000..16e3af5 --- /dev/null +++ b/homescreen/qml/images/Shortcut/mediaplayer_active.svg @@ -0,0 +1,63 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/Shortcut/navigation.svg b/homescreen/qml/images/Shortcut/navigation.svg new file mode 100644 index 0000000..6f6f1e0 --- /dev/null +++ b/homescreen/qml/images/Shortcut/navigation.svg @@ -0,0 +1,77 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/Shortcut/navigation_active.svg b/homescreen/qml/images/Shortcut/navigation_active.svg new file mode 100644 index 0000000..9076934 --- /dev/null +++ b/homescreen/qml/images/Shortcut/navigation_active.svg @@ -0,0 +1,90 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/Shortcut/shortcut.qrc b/homescreen/qml/images/Shortcut/shortcut.qrc index fe31006..5d67341 100644 --- a/homescreen/qml/images/Shortcut/shortcut.qrc +++ b/homescreen/qml/images/Shortcut/shortcut.qrc @@ -1,12 +1,12 @@ - HMI_Shortcut_Home_Active-01.png - HMI_Shortcut_Home-01.png - HMI_Shortcut_HVAC_Active-01.png - HMI_Shortcut_HVAC-01.png - HMI_Shortcut_Multimedia_Active-01.png - HMI_Shortcut_Multimedia-01.png - HMI_Shortcut_Navigation_Active-01.png - HMI_Shortcut_Navigation-01.png + launcher.svg + launcher_active.svg + hvac.svg + hvac_active.svg + mediaplayer.svg + mediaplayer_active.svg + navigation.svg + navigation_active.svg diff --git a/homescreen/qml/images/Utility_Logo_Colour-01.png b/homescreen/qml/images/Utility_Logo_Colour-01.png deleted file mode 100644 index 6519a2d..0000000 Binary files a/homescreen/qml/images/Utility_Logo_Colour-01.png and /dev/null differ diff --git a/homescreen/qml/images/Utility_Logo_Grey-01.svg b/homescreen/qml/images/Utility_Logo_Grey-01.svg new file mode 100644 index 0000000..16ac88c --- /dev/null +++ b/homescreen/qml/images/Utility_Logo_Grey-01.svg @@ -0,0 +1,84 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/homescreen/qml/images/images.qrc b/homescreen/qml/images/images.qrc index 2d8e902..fb991aa 100644 --- a/homescreen/qml/images/images.qrc +++ b/homescreen/qml/images/images.qrc @@ -2,9 +2,9 @@ TopSection_NoText_NoIcons-01.png Utility_Logo_Background-01.png - Utility_Logo_Colour-01.png + Utility_Logo_Grey-01.svg Utility_Music_Background-01.png Utility_Radio_Background-01.png - AGL_HMI_Background_NoCar-01.png + AGL_HMI_Blue_Background_NoCar-01.png diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 11bd9d5..1312e87 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -27,17 +27,13 @@ Window { height: container.height * container.scale title: 'HomeScreen' - ApplicationLauncher { - id: launcher - } - Image { id: container anchors.centerIn: parent width: 1080 height: 1920 scale: 1.0 - source: './images/AGL_HMI_Background_NoCar-01.png' + source: './images/AGL_HMI_Blue_Background_NoCar-01.png' ColumnLayout { anchors.fill: parent @@ -54,14 +50,6 @@ 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 } 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 fd9a585..0000000 --- a/homescreen/src/appinfo.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2016, 2017 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 - -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 0d98b10..0000000 --- a/homescreen/src/appinfo.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2016, 2017 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 -#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/applicationlauncher.cpp b/homescreen/src/applicationlauncher.cpp index 559a93c..5a1e2d6 100644 --- a/homescreen/src/applicationlauncher.cpp +++ b/homescreen/src/applicationlauncher.cpp @@ -1,6 +1,7 @@ /* * 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. @@ -19,30 +20,58 @@ #include "afm_user_daemon_proxy.h" -#include +#include "hmi-debug.h" extern org::AGL::afm::user *afm_user_daemon_proxy; ApplicationLauncher::ApplicationLauncher(QObject *parent) : QObject(parent) + , m_launching(false) + , m_timeout(new QTimer(this)) { + m_timeout->setInterval(3000); + m_timeout->setSingleShot(true); + connect(m_timeout, &QTimer::timeout, [&]() { + setLaunching(false); + }); + connect(this, &ApplicationLauncher::launchingChanged, [&](bool launching) { + if (launching) + m_timeout->start(); + else + m_timeout->stop(); + }); + connect(this, &ApplicationLauncher::currentChanged, [&]() { + setLaunching(false); + }); } int ApplicationLauncher::launch(const QString &application) { int result = -1; - qDebug() << "launch" << application; + HMI_DEBUG("HomeScreen","ApplicationLauncher launch %s.", application.toStdString().c_str()); result = afm_user_daemon_proxy->start(application).value().toInt(); - qDebug() << "pid:" << result; + HMI_DEBUG("HomeScreen","ApplicationLauncher pid: %d.", result); if (result > 1) { - setCurrent(application); + setLaunching(true); } return result; } +bool ApplicationLauncher::isLaunching() const +{ + return m_launching; +} + +void ApplicationLauncher::setLaunching(bool launching) +{ + if (m_launching == launching) return; + m_launching = launching; + launchingChanged(launching); +} + QString ApplicationLauncher::current() const { return m_current; diff --git a/homescreen/src/applicationlauncher.h b/homescreen/src/applicationlauncher.h index a31e663..dfa5846 100644 --- a/homescreen/src/applicationlauncher.h +++ b/homescreen/src/applicationlauncher.h @@ -1,6 +1,7 @@ /* * 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. @@ -20,17 +21,22 @@ #include +class QTimer; + class ApplicationLauncher : public QObject { Q_OBJECT + Q_PROPERTY(bool launching READ isLaunching NOTIFY launchingChanged) Q_PROPERTY(QString current READ current WRITE setCurrent NOTIFY currentChanged) public: explicit ApplicationLauncher(QObject *parent = NULL); + bool isLaunching() const; QString current() const; signals: void newAppRequestsToBeVisible(int pid); + void launchingChanged(bool launching); void currentChanged(const QString ¤t); public slots: @@ -38,7 +44,12 @@ public slots: void setCurrent(const QString ¤t); private: + void setLaunching(bool launching); + +private: + bool m_launching; QString m_current; + QTimer *m_timeout; }; #endif // APPLICATIONLAUNCHER_H diff --git a/homescreen/src/applicationmodel.cpp b/homescreen/src/applicationmodel.cpp deleted file mode 100644 index 417bc4c..0000000 --- a/homescreen/src/applicationmodel.cpp +++ /dev/null @@ -1,144 +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. - */ - -#include "applicationmodel.h" -#include "appinfo.h" - -#include - -#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["id"].toString().split("@").front(); - if (icon == "hvac" || icon == "poi") { - icon = icon.toUpper(); - } else if (icon == "mediaplayer") { - icon = "Multimedia"; - } else { - icon[0] = icon[0].toUpper(); - } - 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); - this->data.append(AppInfo(icon, name, id)); - qDebug() << "name:" << name << "icon:" << icon << "id:" << id; - } -} - -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(); -} - -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)) { - qDebug() << from << to << false; - return; - } - d->data.move(from, to); - endMoveRows(); - } else if (from > to) { - if (!beginMoveRows(parent, from, from, parent, to)) { - qDebug() << from << to << false; - return; - } - d->data.move(from, to); - endMoveRows(); - } else { - qDebug() << from << to << false; - } -} diff --git a/homescreen/src/applicationmodel.h b/homescreen/src/applicationmodel.h deleted file mode 100644 index 2414b7e..0000000 --- a/homescreen/src/applicationmodel.h +++ /dev/null @@ -1,41 +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 void move(int from, int to); - -private: - class Private; - Private *d; -}; - -#endif // APPLICATIONMODEL_H diff --git a/homescreen/src/hmi-debug.h b/homescreen/src/hmi-debug.h new file mode 100644 index 0000000..28705f5 --- /dev/null +++ b/homescreen/src/hmi-debug.h @@ -0,0 +1,70 @@ +/* + * 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 __HMI_DEBUG_H__ +#define __HMI_DEBUG_H__ + +#include +#include +#include +#include +#include + +enum LOG_LEVEL{ + LOG_LEVEL_NONE = 0, + LOG_LEVEL_ERROR, + LOG_LEVEL_WARNING, + LOG_LEVEL_NOTICE, + LOG_LEVEL_INFO, + LOG_LEVEL_DEBUG, + LOG_LEVEL_MAX = LOG_LEVEL_DEBUG +}; + +#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) + +#define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__) +#define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__) +#define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__) +#define HMI_INFO(prefix, args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__) +#define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__) + +static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}; + +static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...) +{ + const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG")); + if(log_level < level) + { + return; + } + + char *message; + struct timespec tp; + unsigned int time; + + clock_gettime(CLOCK_REALTIME, &tp); + time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000); + + va_list args; + va_start(args, log); + if (log == NULL || vasprintf(&message, log, args) < 0) + message = NULL; + fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message); + va_end(args); + free(message); +} + +#endif //__HMI_DEBUG_H__ diff --git a/homescreen/src/homescreencontrolinterface.cpp b/homescreen/src/homescreencontrolinterface.cpp deleted file mode 100644 index ecbe8e4..0000000 --- a/homescreen/src/homescreencontrolinterface.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "afm_user_daemon_proxy.h" -#include "homescreencontrolinterface.h" - -extern org::AGL::afm::user *afm_user_daemon_proxy; - -HomeScreenControlInterface::HomeScreenControlInterface(QObject *parent) : - QObject(parent), - mp_homeScreenAdaptor(0) -{ - // publish dbus homescreen interface - mp_homeScreenAdaptor = new HomescreenAdaptor((QObject*)this); - - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/HomeScreen", this); - dbus.registerService("org.agl.homescreen"); -} - -QList HomeScreenControlInterface::getAllSurfacesOfProcess(int pid) -{ - qDebug("getAllSurfacesOfProcess %d", pid); - return newRequestGetAllSurfacesOfProcess(pid); -} - -int HomeScreenControlInterface::getSurfaceStatus(int surfaceId) -{ - qDebug("getSurfaceStatus %d", surfaceId); - return newRequestGetSurfaceStatus(surfaceId); -} - -void HomeScreenControlInterface::hardKeyPressed(int key) -{ - int pid = -1; - - switch (key) - { - case InputEvent::HARDKEY_NAV: - qDebug("hardKeyPressed NAV key pressed!"); - pid = afm_user_daemon_proxy->start("navigation@0.1").value().toInt(); - qDebug("pid: %d", pid); - emit newRequestsToBeVisibleApp(pid); - break; - case InputEvent::HARDKEY_MEDIA: - qDebug("hardKeyPressed MEDIA key pressed!"); - pid = afm_user_daemon_proxy->start("media@0.1").value().toInt(); - qDebug("pid: %d", pid); - emit newRequestsToBeVisibleApp(pid); - break; - default: - qDebug("hardKeyPressed %d", key); - break; - } -} - -void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, int layoutArea) -{ - qDebug("renderSurfaceToArea %d %d", surfaceId, layoutArea); - emit newRequestRenderSurfaceToArea(surfaceId, layoutArea); -} - -bool HomeScreenControlInterface::renderAppToAreaAllowed(int appCategory, int layoutArea) -{ - qDebug("renderAppToAreaAllowed %d %d", appCategory, layoutArea); - return true; //TODO: ask policy manager -} - -void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId) -{ - qDebug("requestSurfaceIdToFullScreen %d", surfaceId); - emit newRequestSurfaceIdToFullScreen(surfaceId); -} diff --git a/homescreen/src/homescreencontrolinterface.h b/homescreen/src/homescreencontrolinterface.h deleted file mode 100644 index b68a2b2..0000000 --- a/homescreen/src/homescreencontrolinterface.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -#ifndef HOMESCREENCONTROLINTERFACE_H -#define HOMESCREENCONTROLINTERFACE_H - -#include -#include "include/homescreen.hpp" -#include "homescreen_adaptor.h" - -class HomeScreenControlInterface : public QObject -{ - Q_OBJECT -public: - explicit HomeScreenControlInterface(QObject *parent = 0); - -signals: - void newRequestsToBeVisibleApp(int pid); - - QList newRequestGetAllSurfacesOfProcess(int pid); - int newRequestGetSurfaceStatus(int surfaceId); - void newRequestRenderSurfaceToArea(int surfaceId, int layoutArea); - bool newRequestRenderSurfaceToAreaAllowed(int surfaceId, int layoutArea); - void newRequestSurfaceIdToFullScreen(int surfaceId); - -//from homescreen_adaptor.h -public Q_SLOTS: // METHODS - QList getAllSurfacesOfProcess(int pid); - int getSurfaceStatus(int surfaceId); - void hardKeyPressed(int key); - void renderSurfaceToArea(int surfaceId, int layoutArea); - bool renderAppToAreaAllowed(int appCategory, int layoutArea); - void requestSurfaceIdToFullScreen(int surfaceId); - -private: - HomescreenAdaptor *mp_homeScreenAdaptor; -}; - -#endif // HOMESCREENCONTROLINTERFACE_H diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp new file mode 100644 index 0000000..5da8b9e --- /dev/null +++ b/homescreen/src/homescreenhandler.cpp @@ -0,0 +1,88 @@ +/* + * 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 "homescreenhandler.h" +#include +#include "hmi-debug.h" + +void* HomescreenHandler::myThis = 0; + +HomescreenHandler::HomescreenHandler(QObject *parent) : + QObject(parent), + mp_hs(NULL) +{ + +} + +HomescreenHandler::~HomescreenHandler() +{ + if (mp_hs != NULL) { + delete mp_hs; + } +} + +void HomescreenHandler::init(int port, const char *token) +{ + mp_hs = new LibHomeScreen(); + mp_hs->init(port, token); + + myThis = this; + + mp_hs->registerCallback(nullptr, HomescreenHandler::onRep_static); + + mp_hs->set_event_handler(LibHomeScreen::Event_OnScreenMessage, [this](json_object *object){ + const char *display_message = json_object_get_string( + json_object_object_get(object, "display_message")); + HMI_DEBUG("HomeScreen","set_event_handler Event_OnScreenMessage display_message = %s", display_message); + }); + +} + +void HomescreenHandler::tapShortcut(QString application_name) +{ + HMI_DEBUG("HomeScreen","tapShortcut %s", application_name.toStdString().c_str()); + mp_hs->tapShortcut(application_name.toStdString().c_str()); +} + +void HomescreenHandler::onRep_static(struct json_object* reply_contents) +{ + static_cast(HomescreenHandler::myThis)->onRep(reply_contents); +} + +void HomescreenHandler::onEv_static(const string& event, struct json_object* event_contents) +{ + static_cast(HomescreenHandler::myThis)->onEv(event, event_contents); +} + +void HomescreenHandler::onRep(struct json_object* reply_contents) +{ + const char* str = json_object_to_json_string(reply_contents); + HMI_DEBUG("HomeScreen","HomeScreen onReply %s", str); +} + +void HomescreenHandler::onEv(const string& event, struct json_object* event_contents) +{ + const char* str = json_object_to_json_string(event_contents); + HMI_DEBUG("HomeScreen","HomeScreen onEv %s, contents: %s", event.c_str(), str); + + if (event.compare("homescreen/on_screen_message") == 0) { + struct json_object *json_data = json_object_object_get(event_contents, "data"); + struct json_object *json_display_message = json_object_object_get(json_data, "display_message"); + const char* display_message = json_object_get_string(json_display_message); + + HMI_DEBUG("HomeScreen","display_message = %s", display_message); + } +} diff --git a/homescreen/src/homescreenhandler.h b/homescreen/src/homescreenhandler.h new file mode 100644 index 0000000..c18d7a0 --- /dev/null +++ b/homescreen/src/homescreenhandler.h @@ -0,0 +1,47 @@ +/* + * 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 HOMESCREENHANDLER_H +#define HOMESCREENHANDLER_H + +#include +#include +#include + +using namespace std; + +class HomescreenHandler : public QObject +{ + Q_OBJECT +public: + explicit HomescreenHandler(QObject *parent = 0); + ~HomescreenHandler(); + + void init(int port, const char* token); + + Q_INVOKABLE void tapShortcut(QString application_name); + + void onRep(struct json_object* reply_contents); + void onEv(const string& event, struct json_object* event_contents); + + static void* myThis; + static void onRep_static(struct json_object* reply_contents); + static void onEv_static(const string& event, struct json_object* event_contents); +private: + LibHomeScreen *mp_hs; +}; + +#endif // HOMESCREENHANDLER_H diff --git a/homescreen/src/layouthandler.cpp b/homescreen/src/layouthandler.cpp deleted file mode 100644 index 6f5ba01..0000000 --- a/homescreen/src/layouthandler.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * 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. - */ - -#include "layouthandler.h" -#include - -LayoutHandler::LayoutHandler(QObject *parent) : - QObject(parent), - m_secondsTimerId(-1), - mp_dBusWindowManagerProxy(0), - mp_dBusPopupProxy(0), - m_visibleSurfaces(), - m_invisibleSurfaces(), - m_requestsToBeVisibleSurfaces() -{ - qDBusRegisterMetaType(); - qDBusRegisterMetaType >(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType >(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType >(); - - qDebug("D-Bus: connect to org.agl.windowmanager /windowmanager"); - mp_dBusWindowManagerProxy = new org::agl::windowmanager("org.agl.windowmanager", - "/windowmanager", - QDBusConnection::sessionBus(), - 0); - qDebug("D-Bus: connect to org.agl.homescreen /Popup"); - mp_dBusPopupProxy = new org::agl::popup("org.agl.homescreen", - "/Popup", - QDBusConnection::sessionBus(), - 0); - - QDBusConnection::sessionBus().connect("org.agl.windowmanager", - "/windowmanager", - "org.agl.windowmanager", - "surfaceVisibilityChanged", - this, - SIGNAL(surfaceVisibilityChanged(int,bool))); - - QList surfaceAreas; - LayoutArea surfaceArea; - - const int SCREEN_WIDTH = 1080; - const int SCREEN_HEIGHT = 1920; - - const int TOPAREA_HEIGHT = 218; - const int TOPAREA_WIDTH = SCREEN_WIDTH; - const int TOPAREA_X = 0; - const int TOPAREA_Y = 0; - const int MEDIAAREA_HEIGHT = 215; - const int MEDIAAREA_WIDTH = SCREEN_WIDTH; - const int MEDIAAREA_X = 0; - const int MEDIAAREA_Y = SCREEN_HEIGHT - MEDIAAREA_HEIGHT; - - - // only one Layout for CES2017 needed - // layout 1: - // one app surface, statusbar, control bar - surfaceArea.x = 0; - surfaceArea.y = TOPAREA_HEIGHT; - surfaceArea.width = SCREEN_WIDTH; - surfaceArea.height = SCREEN_HEIGHT - TOPAREA_HEIGHT - MEDIAAREA_HEIGHT; - - surfaceAreas.append(surfaceArea); - - mp_dBusWindowManagerProxy->addLayout(1, "one app", surfaceAreas); -} - -LayoutHandler::~LayoutHandler() -{ - delete mp_dBusPopupProxy; - delete mp_dBusWindowManagerProxy; -} - -void LayoutHandler::showAppLayer(const QString &app_id, int pid) -{ - mp_dBusWindowManagerProxy->showAppLayer(app_id, pid); -} - -void LayoutHandler::hideAppLayer() -{ - // POPUP=0, HOMESCREEN_OVERLAY=1, APPS=2, HOMESCREEN=3 - mp_dBusWindowManagerProxy->hideLayer(2); // TODO: enum -} - -void LayoutHandler::makeMeVisible(int pid) -{ - qDebug("makeMeVisible %d", pid); - -#if 0 - // if app does not request to be visible - if (-1 == m_requestsToBeVisiblePids.indexOf(pid)) - { - m_requestsToBeVisiblePids.append(pid); - - // callback every second - if (-1 != m_secondsTimerId) - { - killTimer(m_secondsTimerId); - m_secondsTimerId = -1; - } - m_secondsTimerId = startTimer(1000); - } - else - { - checkToDoQueue(); - } -#endif -} - -void LayoutHandler::checkToDoQueue() -{ -#if 0 - if ((-1 != m_secondsTimerId) && (0 == m_requestsToBeVisiblePids.size())) - { - killTimer(m_secondsTimerId); - m_secondsTimerId = -1; - } - - if (0 != m_requestsToBeVisiblePids.size()) - { - int pid = m_requestsToBeVisiblePids.at(0); - qDebug("pid %d wants to be visible", pid); - - QList allSurfaces; - allSurfaces = mp_dBusWindowManagerProxy->getAllSurfacesOfProcess(pid); - if (0 == allSurfaces.size()) - { - qDebug("no surfaces for pid %d. retrying!", pid); - } - else - { - m_requestsToBeVisiblePids.removeAt(0); - qSort(allSurfaces); - - if (0 != allSurfaces.size()) - { - int firstSurface = allSurfaces.at(0); - - if (-1 != m_visibleSurfaces.indexOf(firstSurface)) - { - qDebug("already visible"); - } - else - { - if (-1 != m_invisibleSurfaces.indexOf(firstSurface)) - { - m_invisibleSurfaces.removeAt(m_invisibleSurfaces.indexOf(firstSurface)); - } - if (-1 == m_requestsToBeVisibleSurfaces.indexOf(firstSurface)) - { - m_requestsToBeVisibleSurfaces.append(firstSurface); - } - - qDebug("before"); - qDebug(" m_visibleSurfaces %d", m_visibleSurfaces.size()); - qDebug(" m_invisibleSurfaces %d", m_invisibleSurfaces.size()); - qDebug(" m_requestsToBeVisibleSurfaces %d", m_requestsToBeVisibleSurfaces.size()); - - QList availableLayouts = mp_dBusWindowManagerProxy->getAvailableLayouts(1); // one app only for CES2017 - if (1 == availableLayouts.size()) - { - qDebug("active layout: %d", availableLayouts.at(0)); - m_invisibleSurfaces.append(m_visibleSurfaces); - m_visibleSurfaces.clear(); - m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces); - m_requestsToBeVisibleSurfaces.clear(); - - mp_dBusWindowManagerProxy->setLayoutById(availableLayouts.at(0)); - for (int i = 0; i < m_visibleSurfaces.size(); ++i) - { - mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i); - } - - qDebug("after"); - qDebug(" m_visibleSurfaces %d", m_visibleSurfaces.size()); - qDebug(" m_invisibleSurfaces %d", m_invisibleSurfaces.size()); - qDebug(" m_requestsToBeVisibleSurfaces %d", m_requestsToBeVisibleSurfaces.size()); - } - else - { - qDebug("this should not happen!?"); - } - } - } - } - } -#endif -} - -#if 0 -QList LayoutHandler::requestGetAllSurfacesOfProcess(int pid) -{ - qDebug("requestGetAllSurfacesOfProcess %d", pid); - - return mp_dBusWindowManagerProxy->getAllSurfacesOfProcess(pid); -} -#endif - -int LayoutHandler::requestGetSurfaceStatus(int surfaceId) -{ - int result = -1; - - if (-1 != m_visibleSurfaces.indexOf(surfaceId)) - { - result = 0; - } - if (-1 != m_invisibleSurfaces.indexOf(surfaceId)) - { - result = 1; - } - if (-1 != m_requestsToBeVisibleSurfaces.indexOf(surfaceId)) - { - result = 1; - } - - return result; -} - -void LayoutHandler::requestRenderSurfaceToArea(int surfaceId, int layoutArea) -{ - qDebug("requestRenderSurfaceToArea %d %d", surfaceId, layoutArea); - mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(surfaceId, layoutArea); -} - -bool LayoutHandler::requestRenderSurfaceToAreaAllowed(int surfaceId, int layoutArea) -{ - qDebug("requestRenderSurfaceToAreaAllowed %d %d", surfaceId, layoutArea); - bool result = true; - return result; -} - -void LayoutHandler::requestSurfaceIdToFullScreen(int surfaceId) -{ - qDebug("requestSurfaceIdToFullScreen %d", surfaceId); -} - -void LayoutHandler::setLayoutByName(QString layoutName) -{ - // switch to new layout - qDebug("setLayout: switch to new layout %s", layoutName.toStdString().c_str()); - m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces); - m_requestsToBeVisibleSurfaces.clear(); - - mp_dBusWindowManagerProxy->setLayoutByName(layoutName); - for (int i = 0; i < m_visibleSurfaces.size(); ++i) - { - mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(i, i); - } -} - -void LayoutHandler::requestSurfaceVisibilityChanged(int surfaceId, bool visible) -{ - qDebug("requestSurfaceVisibilityChanged %d %s", surfaceId, visible ? "true" : "false"); - emit surfaceVisibilityChanged(surfaceId, visible); -} - -void LayoutHandler::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == m_secondsTimerId) - { - checkToDoQueue(); - } -} - diff --git a/homescreen/src/layouthandler.h b/homescreen/src/layouthandler.h deleted file mode 100644 index 007f1ad..0000000 --- a/homescreen/src/layouthandler.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#ifndef LAYOUTHANDLER_H -#define LAYOUTHANDLER_H - -#include -#include "windowmanager_proxy.h" -#include "popup_proxy.h" - -class LayoutHandler : public QObject -{ - Q_OBJECT -public: - explicit LayoutHandler(QObject *parent = 0); - ~LayoutHandler(); - -signals: - -public slots: - void showAppLayer(const QString &app_id, int pid); - void hideAppLayer(); - void makeMeVisible(int pid); -private: - void checkToDoQueue(); -public slots: - int requestGetSurfaceStatus(int surfaceId); - void requestRenderSurfaceToArea(int surfaceId, int layoutArea); - bool requestRenderSurfaceToAreaAllowed(int surfaceId, int layoutArea); - void requestSurfaceIdToFullScreen(int surfaceId); - void setLayoutByName(QString layoutName); - - // this will receive the surfaceVisibilityChanged signal of the windowmanager - void requestSurfaceVisibilityChanged(int surfaceId, bool visible); - -Q_SIGNALS: // SIGNALS - void surfaceVisibilityChanged(int surfaceId, bool visible); - -protected: - void timerEvent(QTimerEvent *e); -private: - int m_secondsTimerId; - org::agl::windowmanager *mp_dBusWindowManagerProxy; - org::agl::popup *mp_dBusPopupProxy; - - QList m_requestsToBeVisiblePids; - QList m_visibleSurfaces; - QList m_invisibleSurfaces; - QList m_requestsToBeVisibleSurfaces; -}; - -#endif // LAYOUTHANDLER_H diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 215e7c6..63edd54 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -1,5 +1,6 @@ /* * 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. @@ -20,16 +21,16 @@ #include #include #include +#include -#include "layouthandler.h" -#include "homescreencontrolinterface.h" +#include +#include #include "applicationlauncher.h" #include "statusbarmodel.h" -#include "applicationmodel.h" -#include "appinfo.h" #include "afm_user_daemon_proxy.h" #include "mastervolume.h" -#include "paclient.h" +#include "homescreenhandler.h" +#include "hmi-debug.h" // XXX: We want this DBus connection to be shared across the different // QML objects, is there another way to do this, a nice way, perhaps? @@ -54,6 +55,7 @@ int main(int argc, char *argv[]) { QGuiApplication a(argc, argv); + // use launch process QScopedPointer afm_user_daemon_proxy(new org::AGL::afm::user("org.AGL.afm.user", "/org/AGL/afm/user", QDBusConnection::sessionBus(), @@ -66,57 +68,80 @@ int main(int argc, char *argv[]) QCoreApplication::setApplicationVersion("0.7.0"); QCommandLineParser parser; - parser.setApplicationDescription("AGL HomeScreen - see wwww... for more details"); + parser.addPositionalArgument("port", a.translate("main", "port for binding")); + parser.addPositionalArgument("secret", a.translate("main", "secret for binding")); parser.addHelpOption(); parser.addVersionOption(); - QCommandLineOption quietOption(QStringList() << "q" << "quiet", - QCoreApplication::translate("main", "Be quiet. No outputs.")); - parser.addOption(quietOption); parser.process(a); - - if (parser.isSet(quietOption)) - { - qInstallMessageHandler(noOutput); + QStringList positionalArguments = parser.positionalArguments(); + + int port = 1700; + QString token = "wm"; + + if (positionalArguments.length() == 2) { + port = positionalArguments.takeFirst().toInt(); + token = positionalArguments.takeFirst(); } - // Fire up PA client QThread - QThread* pat = new QThread; - PaClient* client = new PaClient(); - client->moveToThread(pat); - pat->start(); - - qDBusRegisterMetaType(); - qDBusRegisterMetaType >(); + HMI_DEBUG("HomeScreen","port = %d, token = %s", port, token.toStdString().c_str()); - qmlRegisterType("HomeScreen", 1, 0, "ApplicationLauncher"); - qmlRegisterType("Home", 1, 0, "ApplicationModel"); + // import C++ class to QML + // qmlRegisterType("HomeScreen", 1, 0, "ApplicationLauncher"); qmlRegisterType("HomeScreen", 1, 0, "StatusBarModel"); qmlRegisterType("MasterVolume", 1, 0, "MasterVolume"); - QQmlApplicationEngine engine; - - LayoutHandler* layoutHandler = new LayoutHandler(); - - HomeScreenControlInterface* hsci = new HomeScreenControlInterface(); + ApplicationLauncher *launcher = new ApplicationLauncher(); + QLibWindowmanager* layoutHandler = new QLibWindowmanager(); + if(layoutHandler->init(port,token) != 0){ + exit(EXIT_FAILURE); + } - QObject::connect(hsci, SIGNAL(newRequestGetSurfaceStatus(int)), layoutHandler, SLOT(requestGetSurfaceStatus(int))); - QObject::connect(hsci, SIGNAL(newRequestsToBeVisibleApp(int)), layoutHandler, SLOT(makeMeVisible(int))); - QObject::connect(hsci, SIGNAL(newRequestRenderSurfaceToArea(int, int)), layoutHandler, SLOT(requestRenderSurfaceToArea(int,int))); - QObject::connect(hsci, SIGNAL(newRequestRenderSurfaceToAreaAllowed(int, int)), layoutHandler, SLOT(requestRenderSurfaceToAreaAllowed(int,int))); - QObject::connect(hsci, SIGNAL(newRequestSurfaceIdToFullScreen(int)), layoutHandler, SLOT(requestSurfaceIdToFullScreen(int))); + if (layoutHandler->requestSurface(QString("HomeScreen")) != 0) { + exit(EXIT_FAILURE); + } + layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler](json_object *object) { + layoutHandler->endDraw(QString("HomeScreen")); + }); + + layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher](json_object *object) { + json_object *jarray = json_object_object_get(object, "ids"); + int arrLen = json_object_array_length(jarray); + for( int idx = 0; idx < arrLen; idx++) + { + QString label = QString(json_object_get_string( json_object_array_get_idx(jarray, idx) )); + HMI_DEBUG("HomeScreen","Event_ScreenUpdated application: %s.", label.toStdString().c_str()); + QMetaObject::invokeMethod(launcher, "setCurrent", Qt::QueuedConnection, Q_ARG(QString, label)); + } + }); + + HomescreenHandler* homescreenHandler = new HomescreenHandler(); + homescreenHandler->init(port, token.toStdString().c_str()); + + QUrl bindingAddress; + bindingAddress.setScheme(QStringLiteral("ws")); + bindingAddress.setHost(QStringLiteral("localhost")); + bindingAddress.setPort(port); + bindingAddress.setPath(QStringLiteral("/api")); + + QUrlQuery query; + query.addQueryItem(QStringLiteral("token"), token); + bindingAddress.setQuery(query); + + // mail.qml loading + QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("layoutHandler", layoutHandler); - + engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler); + engine.rootContext()->setContextProperty("launcher", launcher); + engine.rootContext()->setContextProperty("weather", new Weather(bindingAddress)); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - QList mobjs = engine.rootObjects(); - MasterVolume *mv = mobjs.first()->findChild("mv"); - engine.rootContext()->setContextProperty("MasterVolume", mv); - QObject::connect(mv, SIGNAL(sliderVolumeChanged(int)), client, SLOT(incDecVolume(int))); - QObject::connect(client, SIGNAL(volumeExternallyChanged(int)), mv, SLOT(changeExternalVolume(int))); + QObject *root = engine.rootObjects().first(); + QQuickWindow *window = qobject_cast(root); + QObject::connect(window, SIGNAL(frameSwapped()), layoutHandler, SLOT(slotActivateSurface())); - // Initalize PA client - client->init(); + // start homescreen appplications + launcher->launch("launcher@0.1"); //Launcher return a.exec(); } diff --git a/homescreen/src/mainwindow.cpp b/homescreen/src/mainwindow.cpp deleted file mode 100644 index 7a0d743..0000000 --- a/homescreen/src/mainwindow.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * 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. - */ - -#include "mainwindow.h" -#include "ui_mainwindow.h" -#include - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - mp_ui(new Ui::MainWindow), - mp_statusBarWidget(0), - mp_controlBarWidget(0), - mp_settingsWidget(0), - //mp_applauncherwidget(0), - mp_popupWidget(0), - mp_layoutHandler(new LayoutHandler()), - mp_dBusDayNightModeProxy(0), - mp_proximityAdaptor(0), - mp_homeScreenControlInterface(0) -{ - // this has to be adopted to the system setup - mp_dBusDayNightModeProxy = new org::agl::daynightmode("org.agl.homescreen.simulator", //"org.agl.systeminfoprovider" - "/", - QDBusConnection::sessionBus(), - 0); - QObject::connect(mp_dBusDayNightModeProxy, SIGNAL(dayNightMode(int)), this, SLOT(dayNightModeSlot(int))); - - mp_proximityAdaptor = new ProximityAdaptor((QObject*)this); - - // dbus setup - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/Proximity", this); - dbus.registerService("org.agl.homescreen"); - - // no window decoration - setWindowFlags(Qt::FramelessWindowHint); - - mp_ui->setupUi(this); - - mp_statusBarWidget = new StatusBarWidget(this); - mp_statusBarWidget->raise(); - // apply layout - mp_statusBarWidget->move(0, 0); - - mp_controlBarWidget = new ControlBarWidget(this); - mp_controlBarWidget->raise(); - // apply layout - mp_controlBarWidget->move(0, 1920-60); - - mp_settingsWidget = new SettingsWidget(this); - mp_settingsWidget->raise(); - // apply layout - mp_settingsWidget->move(0, 60); - //mp_settingsWidget->hide(); - - /*mp_applauncherwidget = new AppLauncherWidget(this); - mp_applauncherwidget->raise(); - // apply layout - mp_applauncherwidget->move(0, 60);*/ - - - mp_popupWidget = new PopupWidget(); - mp_controlBarWidget->raise(); - // apply layout - mp_popupWidget->move(0, 0); - - - QObject::connect(mp_settingsWidget, SIGNAL(colorSchemeChanged()), this, SLOT(updateColorScheme())); - QObject::connect(mp_settingsWidget, SIGNAL(colorSchemeChanged()), mp_statusBarWidget, SLOT(updateColorScheme())); - QObject::connect(mp_settingsWidget, SIGNAL(colorSchemeChanged()), mp_controlBarWidget, SLOT(updateColorScheme())); - QObject::connect(mp_settingsWidget, SIGNAL(colorSchemeChanged()), mp_settingsWidget, SLOT(updateColorScheme())); - QObject::connect(mp_settingsWidget, SIGNAL(colorSchemeChanged()), mp_popupWidget, SLOT(updateColorScheme())); - - QObject::connect(mp_controlBarWidget, SIGNAL(settingsButtonPressed()), mp_settingsWidget, SLOT(raise())); - //QObject::connect(mp_controlBarWidget, SIGNAL(homeButtonPressed()), mp_applauncherwidget, SLOT(raise())); - QObject::connect(mp_controlBarWidget, SIGNAL(hideAppLayer()), mp_layoutHandler, SLOT(hideAppLayer())); - - //QObject::connect(mp_applauncherwidget, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int))); - //QObject::connect(mp_applauncherwidget, SIGNAL(showAppLayer()), mp_layoutHandler, SLOT(showAppLayer())); - - - // apply color scheme - updateColorScheme(); - - // this is only useful during development and will be removed later - setWindowIcon(QIcon(":/icons/home_day.png")); - - // mp_applauncherwidget->populateAppList(); - //mp_layoutHandler->setUpLayouts(); - - mp_homeScreenControlInterface = new HomeScreenControlInterface(this); - // QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestGetAllSurfacesOfProcess(int)), mp_layoutHandler, SLOT(requestGetAllSurfacesOfProcess(int))); - QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestGetSurfaceStatus(int)), mp_layoutHandler, SLOT(requestGetSurfaceStatus(int))); - QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int))); - QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestRenderSurfaceToArea(int, int)), mp_layoutHandler, SLOT(requestRenderSurfaceToArea(int,int))); - QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestRenderSurfaceToAreaAllowed(int, int)), mp_layoutHandler, SLOT(requestRenderSurfaceToAreaAllowed(int,int))); - QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestSurfaceIdToFullScreen(int)), mp_layoutHandler, SLOT(requestSurfaceIdToFullScreen(int))); - - QObject::connect(mp_popupWidget, SIGNAL(comboBoxResult(QString)), mp_layoutHandler, SLOT(setLayoutByName(QString))); -} - -MainWindow::~MainWindow() -{ - delete mp_homeScreenControlInterface; - - delete mp_dBusDayNightModeProxy; - - delete mp_layoutHandler; - - delete mp_popupWidget; - //delete mp_applauncherwidget; - delete mp_settingsWidget; - delete mp_controlBarWidget; - delete mp_statusBarWidget; - delete mp_proximityAdaptor; - delete mp_ui; -} - -void MainWindow::dayNightModeSlot(int mode) -{ - QSettings settings; - settings.setValue("systemsettings/daynightmode", mode); - // make sure that everything is written to the settings file before continuing - settings.sync(); - - updateColorScheme(); -} - -void MainWindow::setObjectDetected(bool detected) -{ - qDebug("setObjectDetected %s", detected ? "true" : "false"); - QSettings settings; - settings.setValue("systemsettings/proximityobjectdetected", detected); - // make sure that everything is written to the settings file before continuing - settings.sync(); - - updateColorScheme(); -} - -void MainWindow::updateColorScheme() -{ - QSettings settings; - QSettings settings_cs(QApplication::applicationDirPath() + - "/colorschemes/" + - settings.value("systemsettings/colorscheme", "default").toString() + - "/" + - QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) + - "/" + - QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) + - ".ini", - QSettings::IniFormat); - - mp_ui->widget_background->setStyleSheet(settings_cs.value("MainWindow/widget_background_css").toString()); - mp_ui->widget_homeIcon->setStyleSheet(settings_cs.value("MainWindow/widget_homeIcon_css").toString()); - - // update children - mp_statusBarWidget->updateColorScheme(); - mp_controlBarWidget->updateColorScheme(); - mp_settingsWidget->updateColorScheme(); - //mp_applauncherwidget->updateColorScheme(); - mp_popupWidget->updateColorScheme(); -} - -void MainWindow::changeEvent(QEvent* event) -{ - if (QEvent::LanguageChange == event->type()) - { - mp_ui->retranslateUi(this); - } - - QMainWindow::changeEvent(event); -} - diff --git a/homescreen/src/mainwindow.h b/homescreen/src/mainwindow.h deleted file mode 100644 index ebcfea2..0000000 --- a/homescreen/src/mainwindow.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include -#include "daynightmode_proxy.h" -#include "proximity_adaptor.h" - -#include "homescreencontrolinterface.h" - -#include "statusbarwidget.h" -#include "controlbarwidget.h" -#include "settingswidget.h" -//#include "applauncher.h" -#include "popupwidget.h" - -#include "layouthandler.h" - - -namespace Ui { -class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -// day/night mode -public Q_SLOTS: - void dayNightModeSlot(int mode); - -// from proximity_adaptor.h -public Q_SLOTS: - void setObjectDetected(bool detected); - -public slots: - void updateColorScheme(); - -protected: - // called when the translator loaded a new language set - void changeEvent(QEvent* event); - - -private: - Ui::MainWindow *mp_ui; - - StatusBarWidget *mp_statusBarWidget; - org::agl::daynightmode *mp_dBusDayNightMode_StatusBarWidget; - ControlBarWidget *mp_controlBarWidget; - org::agl::daynightmode *mp_dBusDayNightMode_ControlBarWidget; - SettingsWidget *mp_settingsWidget; - //AppLauncherWidget *mp_applauncherwidget; - PopupWidget *mp_popupWidget; - - LayoutHandler *mp_layoutHandler; - - org::agl::daynightmode *mp_dBusDayNightModeProxy; - - ProximityAdaptor *mp_proximityAdaptor; - - HomeScreenControlInterface *mp_homeScreenControlInterface; -}; - -#endif // MAINWINDOW_H diff --git a/homescreen/src/mastervolume.cpp b/homescreen/src/mastervolume.cpp index 46985ee..5e1e450 100644 --- a/homescreen/src/mastervolume.cpp +++ b/homescreen/src/mastervolume.cpp @@ -16,8 +16,6 @@ #include "mastervolume.h" -#include - void MasterVolume::setVolume(pa_volume_t volume) { int volume_delta = volume - m_volume; diff --git a/homescreen/src/mastervolume.h b/homescreen/src/mastervolume.h index edcdd8c..645968a 100644 --- a/homescreen/src/mastervolume.h +++ b/homescreen/src/mastervolume.h @@ -16,7 +16,6 @@ #include #include -#include #include diff --git a/homescreen/src/paclient.cpp b/homescreen/src/paclient.cpp deleted file mode 100644 index 59a3742..0000000 --- a/homescreen/src/paclient.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (C) 2016,2017 Konsulko Group - * - * 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 "paclient.h" - -#include - -PaClient::PaClient() - : m_init(false), m_ml(nullptr), m_mlapi(nullptr), m_ctx(nullptr) -{ -} - -PaClient::~PaClient() -{ - if (m_init) - close(); -} - -void PaClient::close() -{ - if (!m_init) return; - pa_threaded_mainloop_stop(m_ml); - pa_threaded_mainloop_free(m_ml); - m_init = false; -} - -static void set_sink_volume_cb(pa_context *c, int success, void *data) -{ - Q_UNUSED(data); - - if (!success) - qWarning() << "PaClient: set sink volume: " << - pa_strerror(pa_context_errno(c)); -} - -void PaClient::incDecVolume(const int volume_delta) -{ - pa_operation *o; - pa_context *c = context(); - pa_sink_info *i = getDefaultSinkInfo(); - - if (volume_delta > 0) - pa_cvolume_inc_clamp(&i->volume, volume_delta, 65536); - else - pa_cvolume_dec(&i->volume, abs(volume_delta)); - - o = pa_context_set_sink_volume_by_index(c, i->index, &i->volume, set_sink_volume_cb, NULL); - if (!o) { - qWarning() << "PaClient: set sink #" << i->index << - " volume: " << pa_strerror(pa_context_errno(c)); - return; - } - pa_operation_unref(o); -} - -void get_sink_info_change_cb(pa_context *c, - const pa_sink_info *i, - int eol, - void *data) -{ - Q_UNUSED(c); - Q_ASSERT(i); - Q_ASSERT(data); - - if (eol) return; - - PaClient *self = reinterpret_cast(data); - pa_sink_info *si = self->getDefaultSinkInfo(); - if (i->index == si->index) { - self->setDefaultSinkInfo(i); - pa_cvolume *cvolume = &self->getDefaultSinkInfo()->volume; - emit self->volumeExternallyChanged(pa_cvolume_avg(cvolume)); - } -} - -void get_default_sink_info_cb(pa_context *c, - const pa_sink_info *i, - int eol, - void *data) -{ - Q_UNUSED(c); - Q_ASSERT(i); - Q_ASSERT(data); - - if (eol) return; - - PaClient *self = reinterpret_cast(data); - self->setDefaultSinkInfo(i); -} - -pa_sink_info *PaClient::getDefaultSinkInfo(void) -{ - return &m_default_sink_info; -} - -void PaClient::setDefaultSinkInfo(const pa_sink_info *i) -{ - m_default_sink_info.index = i->index; - m_default_sink_info.channel_map.channels = i->channel_map.channels; - pa_cvolume *cvolume = &m_default_sink_info.volume; - cvolume->channels = i->volume.channels; - for (int chan = 0; chan < i->channel_map.channels; chan++) { - cvolume->values[chan] = i->volume.values[chan]; - } -} - -void get_server_info_cb(pa_context *c, - const pa_server_info *i, - void *data) -{ - pa_operation *o; - o = pa_context_get_sink_info_by_name(c, i->default_sink_name, get_default_sink_info_cb, data); - if (!o) { - qWarning() << "PaClient: get sink info by name: " << - pa_strerror(pa_context_errno(c)); - return; - } -} - -void subscribe_cb(pa_context *c, - pa_subscription_event_type_t type, - uint32_t index, - void *data) -{ - pa_operation *o; - - if ((type & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_CHANGE) { - qWarning("PaClient: unhandled subscribe event operation"); - return; - } - - switch (type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) { - case PA_SUBSCRIPTION_EVENT_SINK: - o = pa_context_get_sink_info_by_index(c, index, get_sink_info_change_cb, data); - if (!o) { - qWarning() << "PaClient: get sink info by index: " << - pa_strerror(pa_context_errno(c)); - return; - } - break; - default: - qWarning("PaClient: unhandled subscribe event facility"); - } -} - -void context_state_cb(pa_context *c, void *data) -{ - pa_operation *o; - PaClient *self = reinterpret_cast(data); - - switch (pa_context_get_state(c)) { - case PA_CONTEXT_CONNECTING: - case PA_CONTEXT_AUTHORIZING: - case PA_CONTEXT_SETTING_NAME: - break; - case PA_CONTEXT_READY: - o = pa_context_get_server_info(c, get_server_info_cb, data); - if (!o) { - qWarning() << "PaClient: get server info: " << - pa_strerror(pa_context_errno(c)); - return; - } - pa_operation_unref(o); - pa_context_set_subscribe_callback(c, subscribe_cb, data); - o = pa_context_subscribe(c, (pa_subscription_mask_t)(PA_SUBSCRIPTION_MASK_SINK), NULL, NULL); - if (!o) { - qWarning() << "PaClient: subscribe: " << - pa_strerror(pa_context_errno(c)); - return; - } - break; - case PA_CONTEXT_TERMINATED: - self->close(); - break; - - case PA_CONTEXT_FAILED: - default: - qCritical() << "PaClient: connection failed: " << - pa_strerror(pa_context_errno(c)); - self->close(); - break; - } -} - -void PaClient::init() -{ - m_ml = pa_threaded_mainloop_new(); - if (!m_ml) { - qCritical("PaClient: failed to create mainloop"); - return; - } - - pa_threaded_mainloop_set_name(m_ml, "PaClient mainloop"); - - m_mlapi = pa_threaded_mainloop_get_api(m_ml); - - lock(); - - m_ctx = pa_context_new(m_mlapi, "HomeScreen"); - if (!m_ctx) { - qCritical("PaClient: failed to create context"); - unlock(); - pa_threaded_mainloop_free(m_ml); - return; - } - pa_context_set_state_callback(m_ctx, context_state_cb, this); - - if (pa_context_connect(m_ctx, 0, (pa_context_flags_t)0, 0) < 0) { - qCritical("PaClient: failed to connect"); - pa_context_unref(m_ctx); - unlock(); - pa_threaded_mainloop_free(m_ml); - return; - } - - if (pa_threaded_mainloop_start(m_ml) != 0) { - qCritical("PaClient: failed to start mainloop"); - pa_context_unref(m_ctx); - unlock(); - pa_threaded_mainloop_free(m_ml); - return; - } - - unlock(); - - m_init = true; -} diff --git a/homescreen/src/paclient.h b/homescreen/src/paclient.h deleted file mode 100644 index abf178b..0000000 --- a/homescreen/src/paclient.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2016,2017 Konsulko Group - * - * 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 - -#include -#include - -class PaClient : public QObject -{ - Q_OBJECT - public: - PaClient(); - ~PaClient(); - - void init(); - void close(); - - inline pa_context *context() const - { - return m_ctx; - } - - inline void lock() - { - pa_threaded_mainloop_lock(m_ml); - } - - inline void unlock() - { - pa_threaded_mainloop_unlock(m_ml); - } - - pa_sink_info * getDefaultSinkInfo(void); - void setDefaultSinkInfo(const pa_sink_info *i); - void setMasterVolume(const pa_cvolume *); - - public slots: - void incDecVolume(const int volume_delta); - - signals: - void volumeExternallyChanged(int volume); - - private: - bool m_init; - pa_threaded_mainloop *m_ml; - pa_mainloop_api *m_mlapi; - pa_context *m_ctx; - pa_cvolume m_master_cvolume; - pa_sink_info m_default_sink_info; -}; diff --git a/homescreen/src/popupwidget.cpp b/homescreen/src/popupwidget.cpp deleted file mode 100644 index 1f062f1..0000000 --- a/homescreen/src/popupwidget.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -#include "popupwidget.h" -#include "ui_popupwidget.h" -#include - -PopupWidget::PopupWidget(QWidget *parent) : - QWidget(parent), - mp_ui(new Ui::PopupWidget), - mp_popupAdaptor(0), - m_sendComboBoxChoice(false) -{ - // publish dbus popup interface - mp_popupAdaptor = new PopupAdaptor((QObject*)this); - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/Popup", this); - dbus.registerService("org.agl.homescreen"); - - // no window decoration - setWindowFlags(Qt::FramelessWindowHint); - - mp_ui->setupUi(this); - - this->close(); -} - -PopupWidget::~PopupWidget() -{ - delete mp_popupAdaptor; - delete mp_ui; -} - -void PopupWidget::updateColorScheme() -{ - QSettings settings; - QSettings settings_cs(QApplication::applicationDirPath() + - "/colorschemes/" + - settings.value("systemsettings/colorscheme", "default").toString() + - "/" + - QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) + - "/" + - QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) + - ".ini", - QSettings::IniFormat); - - mp_ui->widget_popup->setStyleSheet(settings_cs.value(QString("PopupWidget/widget_popup_css")).toString()); - mp_ui->label_text->setStyleSheet(settings_cs.value(QString("PopupWidget/label_text_css")).toString()); -} - -void PopupWidget::showPopup(int /*type*/, const QString &text) -{ - m_sendComboBoxChoice = false; - mp_ui->comboBox_choice->hide(); - this->show(); - this->raise(); - mp_ui->label_text->setText(text); -} - -void PopupWidget::showPopupComboBox(const QString &text, const QStringList &choices) -{ - mp_ui->comboBox_choice->clear(); - m_sendComboBoxChoice = true; - mp_ui->comboBox_choice->addItems(choices); - mp_ui->comboBox_choice->show(); - this->show(); - this->raise(); - mp_ui->label_text->setText(text); -} - -void PopupWidget::on_pushButton_OK_clicked() -{ - if (m_sendComboBoxChoice) - { - emit comboBoxResult(mp_ui->comboBox_choice->currentText()); - m_sendComboBoxChoice = false; - } - this->close(); -} diff --git a/homescreen/src/popupwidget.h b/homescreen/src/popupwidget.h deleted file mode 100644 index 7f3aaa8..0000000 --- a/homescreen/src/popupwidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#ifndef POPUPWIDGET_H -#define POPUPWIDGET_H - -#include -#include -#include "popup_adaptor.h" - -namespace Ui { -class PopupWidget; -} - -class PopupWidget : public QWidget -{ - Q_OBJECT - -public: - explicit PopupWidget(QWidget *parent = 0); - ~PopupWidget(); -public slots: - void updateColorScheme(); - - // from popup_adaptor.h -public Q_SLOTS: // METHODS - void showPopup(int /*type*/, const QString &text); - void showPopupComboBox(const QString &text, const QStringList &choices); - -private slots: - void on_pushButton_OK_clicked(); - -signals: - void comboBoxResult(QString choice); - -private: - Ui::PopupWidget *mp_ui; - - PopupAdaptor *mp_popupAdaptor; - bool m_sendComboBoxChoice; - // for showPupupFor LayoutSelection - //QList m_pushButtons; -}; - -#endif // POPUPWIDGET_H diff --git a/homescreen/src/settingswidget.cpp b/homescreen/src/settingswidget.cpp deleted file mode 100644 index 1629bf0..0000000 --- a/homescreen/src/settingswidget.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -#include "settingswidget.h" -#include "ui_settingswidget.h" -#include -#include - -SettingsWidget::SettingsWidget(QWidget *parent) : - QWidget(parent), - mp_ui(new Ui::SettingsWidget), - mp_translator(0) -{ - // no window decoration - setWindowFlags(Qt::FramelessWindowHint); - - // multi-language support - mp_translator = new QTranslator(); - mp_translator->load("homescreen_en_US.qm", ":/translations"); // TODO: read from system - QApplication::instance()->installTranslator(mp_translator); - - mp_ui->setupUi(this); - - mp_ui->comboBox_language->addItem(QString("English"), QVariant("homescreen_en_US.qm")); // TODO: make this configurable - mp_ui->comboBox_language->addItem(QString("Deutsch"), QVariant("homescreen_de_DE.qm")); - mp_ui->comboBox_language->addItem(QString("日本語"), QVariant("homescreen_ja_JP.qm")); - - mp_ui->comboBox_colorScheme->addItem(QString("Default"), QVariant("default")); // TODO: make this configurable - mp_ui->comboBox_colorScheme->addItem(QString("Demo 1"), QVariant("demo1")); - mp_ui->comboBox_colorScheme->addItem(QString("Demo 2"), QVariant("demo2")); - - QSettings settings; - mp_ui->comboBox_language->setCurrentIndex(settings.value("systemsettings/language", 0).toInt()); - mp_ui->comboBox_colorScheme->setCurrentIndex(settings.value("systemsettings/colorschemeindex", 0).toInt()); -} - -SettingsWidget::~SettingsWidget() -{ - delete mp_translator; - delete mp_ui; -} - -void SettingsWidget::updateColorScheme() -{ - QSettings settings; - QSettings settings_cs(QApplication::applicationDirPath() + - "/colorschemes/" + - settings.value("systemsettings/colorscheme", "default").toString() + - "/" + - QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) + - "/" + - QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) + - ".ini", - QSettings::IniFormat); - - mp_ui->widget_background->setStyleSheet(settings_cs.value("SettingsWidget/widget_background_css").toString()); - mp_ui->comboBox_language->setStyleSheet(settings_cs.value("SettingsWidget/comboBox_language_css").toString()); - mp_ui->comboBox_colorScheme->setStyleSheet(settings_cs.value("SettingsWidget/comboBox_colorScheme_css").toString()); - mp_ui->widget_settingsIcon->setStyleSheet(settings_cs.value("SettingsWidget/widget_settingsIcon_css").toString()); -} - -void SettingsWidget::changeEvent(QEvent* event) -{ - if (QEvent::LanguageChange == event->type()) - { - mp_ui->retranslateUi(this); - } - - QWidget::changeEvent(event); -} - -void SettingsWidget::on_comboBox_language_currentIndexChanged(const QString &) -{ - if (0 != mp_translator) - mp_translator->load(mp_ui->comboBox_language->currentData().toString(), ":/translations"); - - QSettings settings; - settings.setValue("systemsettings/language", mp_ui->comboBox_language->currentIndex()); -} - -void SettingsWidget::on_comboBox_colorScheme_currentIndexChanged(const QString &) -{ - QSettings settings; - settings.setValue("systemsettings/colorscheme", mp_ui->comboBox_colorScheme->currentData().toString()); - settings.setValue("systemsettings/colorschemeindex", mp_ui->comboBox_colorScheme->currentIndex()); - // make sure that everything is written to the settings file before continuing - settings.sync(); - - emit colorSchemeChanged(); -} diff --git a/homescreen/src/settingswidget.h b/homescreen/src/settingswidget.h deleted file mode 100644 index 75bb383..0000000 --- a/homescreen/src/settingswidget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ - -#ifndef SETTINGSWIDGET_H -#define SETTINGSWIDGET_H - -#include -#include - -namespace Ui { -class SettingsWidget; -} - -class SettingsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit SettingsWidget(QWidget *parent = 0); - ~SettingsWidget(); -public slots: - void updateColorScheme(); - -protected: - // called when the translator loaded a new language set - void changeEvent(QEvent* event); - -private slots: - void on_comboBox_language_currentIndexChanged(const QString &); - void on_comboBox_colorScheme_currentIndexChanged(const QString &); - -signals: - void colorSchemeChanged(void); - -private: - Ui::SettingsWidget *mp_ui; - QTranslator *mp_translator; -}; - -#endif // SETTINGSWIDGET_H diff --git a/homescreensimulator/LICENSE b/homescreensimulator/LICENSE deleted file mode 100644 index 31c692a..0000000 --- a/homescreensimulator/LICENSE +++ /dev/null @@ -1,54 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - You must give any other recipients of the Work or Derivative Works a copy of this License; and - You must cause any modified files to carry prominent notices stating that You changed the files; and - You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS diff --git a/homescreensimulator/README.md b/homescreensimulator/README.md deleted file mode 100644 index 78838a3..0000000 --- a/homescreensimulator/README.md +++ /dev/null @@ -1,11 +0,0 @@ -AGL Home Screen Simulator for development - - -Build with QtCreator 3.0.1 - -AGL repo for source code: -https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen - -AGL repo for bitbake recipe: -https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb - diff --git a/homescreensimulator/homescreensimulator.pro b/homescreensimulator/homescreensimulator.pro deleted file mode 100644 index 3b2bcb2..0000000 --- a/homescreensimulator/homescreensimulator.pro +++ /dev/null @@ -1,32 +0,0 @@ -# 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. - -TEMPLATE = app -TARGET = HomeScreenSimulator -QT = widgets dbus - -include(../interfaces/interfaces.pri) - -SOURCES += \ - src/main.cpp \ - src/mainwindow.cpp - -HEADERS += \ - src/mainwindow.h - -FORMS += \ - resources/mainwindow.ui - -OTHER_FILES += \ - README.md diff --git a/homescreensimulator/resources/mainwindow.ui b/homescreensimulator/resources/mainwindow.ui deleted file mode 100644 index 4f7ccf8..0000000 --- a/homescreensimulator/resources/mainwindow.ui +++ /dev/null @@ -1,375 +0,0 @@ - - - MainWindow - - - - 0 - 0 - 731 - 507 - - - - Qt::NoFocus - - - - - - - - - - - - 10 - 10 - 711 - 451 - - - - 0 - - - - Status Bar - - - - - 30 - 380 - 211 - 27 - - - - Read from Home Screen App - - - - - - 30 - 20 - 681 - 341 - - - - - - - 550 - 380 - 141 - 27 - - - - Icon-Example - - - - - - Popup - - - - - 600 - 380 - 99 - 27 - - - - Send - - - - - - 10 - 10 - 681 - 361 - - - - - - - 428 - 380 - 171 - 27 - - - - "Hello World" Example - - - - - - 230 - 380 - 191 - 27 - - - - ComboBox Example - - - - - - Day/Night Mode - - - - - 30 - 30 - 161 - 91 - - - - Day/Night Mode - - - - - 10 - 50 - 117 - 22 - - - - Qt::NoFocus - - - Night Mode - - - - - - 10 - 30 - 117 - 22 - - - - Qt::NoFocus - - - Day Mode - - - true - - - - - - - Proximity - - - - - 20 - 20 - 301 - 231 - - - - <html><head/><body><p>Wikipedia:</p><p>A proximity sensor is a sensor able to detect the presence of nearby objects without any physical contact.</p><p><br/></p><p>This info can be used to detect the hand of the user that wants to use the touch screen. So the HMI can change its look to provide for example larger push buttons.</p></body></html> - - - true - - - - - - 100 - 300 - 151 - 22 - - - - object detected - - - - - - Future features - - - - false - - - - 250 - 160 - 71 - 71 - - - - Qt::NoFocus - - - Right - - - - - false - - - - 170 - 160 - 71 - 71 - - - - Qt::NoFocus - - - OK - - - - - false - - - - 90 - 160 - 71 - 71 - - - - Qt::NoFocus - - - Left - - - - - false - - - - 170 - 240 - 71 - 71 - - - - Qt::NoFocus - - - Down - - - - - false - - - - 170 - 80 - 71 - 71 - - - - Qt::NoFocus - - - Up - - - - - - 120 - 20 - 181 - 51 - - - - under development -not functional right now - - - - - false - - - - 90 - 240 - 71 - 71 - - - - Qt::NoFocus - - - Cancel/ -Back? - - - - - - - - 620 - 470 - 99 - 27 - - - - Exit - - - - - - About - - - - - - - diff --git a/homescreensimulator/src/main.cpp b/homescreensimulator/src/main.cpp deleted file mode 100644 index 33b9fc2..0000000 --- a/homescreensimulator/src/main.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include "mainwindow.h" -#include -#include -#include - -int main(int argc, char *argv[]) -{ - // allow only one instance of this application - /*QSharedMemory appInstance; - appInstance.setKey("AGLHomeScreenApp"); - if (!appInstance.create(1)) - { - qDebug("Only one instance of the Home Screen App allowed!"); - exit(-1); - }*/ - - QApplication a(argc, argv); - - // used for application settings (QSettings) - QCoreApplication::setOrganizationDomain("LinuxFoundation"); - QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); - QCoreApplication::setApplicationName("HomeScreenSimulator"); - QCoreApplication::setApplicationVersion("0.4.0"); - - qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); - - MainWindow w; - w.show(); - -#ifdef __arm__ - qDebug("Running on ARM architecture"); -#endif -#ifdef __i386__ - qDebug("Running on x86 architecture"); -#endif - - return a.exec(); -} diff --git a/homescreensimulator/src/mainwindow.cpp b/homescreensimulator/src/mainwindow.cpp deleted file mode 100644 index ffc44fe..0000000 --- a/homescreensimulator/src/mainwindow.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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. - */ - -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - mp_ui(new Ui::MainWindow), - mp_dBusDayNightModeAdaptor(0), - mp_dBusStatusBarProxy(0), - mp_dBusPopupProxy(0), - mp_dBusProximityProxy(0), - mp_dBusHomeScreenProxy(0) -{ - mp_ui->setupUi(this); - - // dbus setup - QDBusConnection dbus = QDBusConnection::sessionBus(); - - // publish dbus day night mode interface - mp_dBusDayNightModeAdaptor = new DaynightmodeAdaptor((QObject*)this); - - dbus.registerService("org.agl.homescreen.simulator"); - dbus.registerObject("/", this); - - mp_dBusStatusBarProxy = new org::agl::statusbar("org.agl.homescreen", - "/StatusBar", - QDBusConnection::sessionBus(), - 0); - mp_dBusPopupProxy = new org::agl::popup("org.agl.homescreen", - "/Popup", - QDBusConnection::sessionBus(), - 0); - mp_dBusProximityProxy = new org::agl::proximity("org.agl.homescreen", - "/Proximity", - QDBusConnection::sessionBus(), - 0); - mp_dBusHomeScreenProxy = new org::agl::homescreen("org.agl.homescreen", - "/HomeScreen", - QDBusConnection::sessionBus(), - 0); - - QSettings settings; - this->move(settings.value("homescreensimulator/pos").toPoint()); - mp_ui->radioButton_DayMode->setChecked(settings.value("homescreensimulator/daymode", true).toBool()); // if nothing is stored, use "true" - mp_ui->radioButton_NightMode->setChecked(settings.value("homescreensimulator/nightmode", false).toBool()); // if nothing is stored, use "false" -} - -MainWindow::~MainWindow() -{ - QSettings settings; - settings.setValue("homescreensimulator/pos", this->pos()); - settings.setValue("homescreensimulator/daymode", mp_ui->radioButton_DayMode->isChecked()); - settings.setValue("homescreensimulator/nightmode", mp_ui->radioButton_NightMode->isChecked()); - - delete mp_dBusHomeScreenProxy; - delete mp_dBusProximityProxy; - delete mp_dBusPopupProxy; - delete mp_dBusStatusBarProxy; - - if (0 == mp_dBusDayNightModeAdaptor) - { - delete mp_dBusDayNightModeAdaptor; - } - delete mp_ui; -} - -void MainWindow::on_radioButton_DayMode_toggled(bool checked) -{ - if (checked) - { - emit(dayNightMode(SystemDayNight::DAYNIGHTMODE_DAY)); - } -} - -void MainWindow::on_radioButton_NightMode_toggled(bool checked) -{ - if (checked) - { - emit(dayNightMode(SystemDayNight::DAYNIGHTMODE_NIGHT)); - } -} - -void MainWindow::on_pushButton_Update_clicked() -{ - QList availablePlaceholders = mp_dBusStatusBarProxy->getAvailablePlaceholders(); - mp_ui->tableWidget_Status->verticalHeader()->setVisible(false); - mp_ui->tableWidget_Status->clear(); - mp_ui->tableWidget_Status->setRowCount(availablePlaceholders.size()); - mp_ui->tableWidget_Status->setColumnCount(3); - - QList horizontalHeaderLabels; - horizontalHeaderLabels.append("Placeholder #"); - horizontalHeaderLabels.append("Text"); - horizontalHeaderLabels.append("iconURI"); - mp_ui->tableWidget_Status->setHorizontalHeaderLabels(horizontalHeaderLabels); - - // disable trigger for the update - mp_ui->tableWidget_Status->blockSignals(true); - - for (int i = 0; i < availablePlaceholders.size(); ++i) - { - mp_ui->tableWidget_Status->setItem(i, 0, new QTableWidgetItem(QString::number(availablePlaceholders[i]))); - mp_ui->tableWidget_Status->item(i, 0)->setFlags(Qt::ItemIsSelectable); - mp_ui->tableWidget_Status->setItem(i, 1, new QTableWidgetItem(mp_dBusStatusBarProxy->getStatusText(availablePlaceholders[i]))); - mp_ui->tableWidget_Status->setItem(i, 2, new QTableWidgetItem(mp_dBusStatusBarProxy->getStatusIcon(availablePlaceholders[i]))); - } - - // enable trigger again - mp_ui->tableWidget_Status->blockSignals(false); -} - -void MainWindow::on_pushButton_Exit_clicked() -{ - QApplication::exit(); -} - -void MainWindow::on_tableWidget_Status_cellChanged(int row, int column) -{ - // text - if (1 == column) - { - mp_dBusStatusBarProxy->setStatusText(mp_ui->tableWidget_Status->item(row, 0)->text().toInt(), mp_ui->tableWidget_Status->item(row, 1)->text()); - } - - // icon - if (2 == column) - { - mp_dBusStatusBarProxy->setStatusIcon(mp_ui->tableWidget_Status->item(row, 0)->text().toInt(), mp_ui->tableWidget_Status->item(row, 2)->text()); - } -} - -void MainWindow::on_pushButton_Send_clicked() -{ - mp_dBusPopupProxy->showPopup(0, mp_ui->plainTextEdit_Popup->toPlainText()); -} - -void MainWindow::on_pushButton_IconExample_clicked() -{ - on_pushButton_Update_clicked(); - - // THIS IS JUST AN EXAMPLE!!! It only works, because the alias for the pic is defined in the - // Home Screen app resources... - mp_ui->tableWidget_Status->setItem(0, 2, new QTableWidgetItem(":/icons/home_day.png")); -} - -void MainWindow::on_pushButton_PopupExample_clicked() -{ - mp_dBusPopupProxy->showPopup(0, "Hello Popup!\nNice to see you!"); -} - -void MainWindow::on_pushButton_comboBoxExample_clicked() -{ - QStringList choices; - choices.append("Item1"); - choices.append("Item2"); - choices.append("Item3"); - choices.append("Item4"); - mp_dBusPopupProxy->showPopupComboBox("Make your choice!", choices); -} - -void MainWindow::on_checkBox_ObjectDetected_clicked() -{ - mp_dBusProximityProxy->setObjectDetected(Qt::Checked == mp_ui->checkBox_ObjectDetected->checkState()); -} diff --git a/homescreensimulator/src/mainwindow.h b/homescreensimulator/src/mainwindow.h deleted file mode 100644 index 581e4be..0000000 --- a/homescreensimulator/src/mainwindow.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include -#include -#include "daynightmode_adaptor.h" - -#include "statusbar_proxy.h" -#include "popup_proxy.h" -#include "proximity_proxy.h" -#include "homescreen_proxy.h" - -namespace Ui { -class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -// day/night mode -Q_SIGNALS: - void dayNightMode(int mode); - -private slots: - void on_radioButton_DayMode_toggled(bool checked); - - void on_radioButton_NightMode_toggled(bool checked); - - void on_pushButton_Update_clicked(); - - void on_pushButton_Exit_clicked(); - - void on_tableWidget_Status_cellChanged(int row, int column); - - void on_pushButton_Send_clicked(); - - void on_pushButton_IconExample_clicked(); - - void on_pushButton_PopupExample_clicked(); - - void on_pushButton_comboBoxExample_clicked(); - - void on_checkBox_ObjectDetected_clicked(); - -private: - Ui::MainWindow *mp_ui; - DaynightmodeAdaptor *mp_dBusDayNightModeAdaptor; - org::agl::statusbar *mp_dBusStatusBarProxy; - org::agl::popup *mp_dBusPopupProxy; - org::agl::proximity *mp_dBusProximityProxy; - org::agl::homescreen *mp_dBusHomeScreenProxy; -}; - -#endif // MAINWINDOW_H diff --git a/interfaces/daynightmode.xml b/interfaces/daynightmode.xml deleted file mode 100644 index fb77045..0000000 --- a/interfaces/daynightmode.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/interfaces/homescreen.xml b/interfaces/homescreen.xml deleted file mode 100644 index 378ff54..0000000 --- a/interfaces/homescreen.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/interfaces/include/daynightmode.hpp b/interfaces/include/daynightmode.hpp deleted file mode 100644 index 2d858bb..0000000 --- a/interfaces/include/daynightmode.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ - -#ifndef DAYNIGHTMODE_H -#define DAYNIGHTMODE_H - -namespace SystemDayNight { - typedef enum DayNightMode - { - DAYNIGHTMODE_UNDEFINED = -1, - DAYNIGHTMODE_DAY = 0, - DAYNIGHTMODE_NIGHT = 1 - } eDayNightMode; -} - -#endif // DAYNIGHTMODE_H diff --git a/interfaces/include/homescreen.hpp b/interfaces/include/homescreen.hpp deleted file mode 100644 index 728962b..0000000 --- a/interfaces/include/homescreen.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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. - */ - -#ifndef HOMESCREEN_H -#define HOMESCREEN_H - -#include "inputevent.hpp" - -#endif // HOMESCREEN_H - diff --git a/interfaces/include/inputevent.hpp b/interfaces/include/inputevent.hpp deleted file mode 100644 index 8c6bf58..0000000 --- a/interfaces/include/inputevent.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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. - */ - -#ifndef INPUTEVENT_H -#define INPUTEVENT_H - -namespace InputEvent { - typedef enum HardKey - { - HARDKEY_UNDEFINED, - HARDKEY_NAV, - HARDKEY_MEDIA - } eHardKey; -} - -#endif // INPUTEVENT_H - diff --git a/interfaces/include/popup.hpp b/interfaces/include/popup.hpp deleted file mode 100644 index 9caa837..0000000 --- a/interfaces/include/popup.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -#ifndef POPUP_H -#define POPUP_H - -namespace SystemPopup { - typedef enum PopupType - { - POPUPTYPE_UNDEFINED, - POPUPTYPE_INFO, - POPUPTYPE_WARNING, - POPUPTYPE_ERROR - } ePopupType; -} - -#endif // POPUP_H - diff --git a/interfaces/include/proximity.hpp b/interfaces/include/proximity.hpp deleted file mode 100644 index 898217f..0000000 --- a/interfaces/include/proximity.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ - -#ifndef PROXIMITY_H -#define PROXIMITY_H - - -#endif // PROXIMITY_H - diff --git a/interfaces/include/windowmanager.hpp b/interfaces/include/windowmanager.hpp deleted file mode 100644 index dd268dd..0000000 --- a/interfaces/include/windowmanager.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#ifndef WINDOWMANAGER_H -#define WINDOWMANAGER_H - -#include - -#define WINDOWMANAGER_NO_ERROR 0 -#define WINDOWMANAGER_ERROR_ID_ALREADY_DEFINED 1 -#define WINDOWMANAGER_ERROR_NAME_ALREADY_DEFINED 2 -#define WINDOWMANAGER_ERROR_ID_NOT_FOUND 3 -#define WINDOWMANAGER_ERROR_NAME_NOT_FOUND 4 -#define WINDOWMANAGER_ERROR_ID_IN_USE 5 - -class SimplePoint -{ -public: - SimplePoint(); - virtual ~SimplePoint(); - - int x; - int y; - - friend QDBusArgument &operator <<(QDBusArgument &argument, const SimplePoint &mSimplePoint); - friend const QDBusArgument &operator >>(const QDBusArgument &argument, SimplePoint &mSimplePoint); -}; - - -class LayoutArea -{ -public: - LayoutArea(); - virtual ~LayoutArea(); - - int x; - int y; - int width; - int height; - - friend QDBusArgument &operator <<(QDBusArgument &argument, const LayoutArea &mLayoutArea); - friend const QDBusArgument &operator >>(const QDBusArgument &argument, LayoutArea &mLayoutArea); -}; - -class Layout -{ -public: - Layout(); - Layout(int layoutId, const QString &layoutName, const QList &surfaceAreas); - virtual ~Layout(); - - int id; - QString name; - QList layoutAreas; - - friend QDBusArgument &operator <<(QDBusArgument &argument, const Layout &mLayout); - friend const QDBusArgument &operator >>(const QDBusArgument &argument, Layout &mLayout); -}; - -Q_DECLARE_METATYPE(SimplePoint) -Q_DECLARE_METATYPE(QList) - -Q_DECLARE_METATYPE(LayoutArea) -Q_DECLARE_METATYPE(QList) - -Q_DECLARE_METATYPE(Layout) -Q_DECLARE_METATYPE(QList) - -#endif // WINDOWMANAGER_H diff --git a/interfaces/inputevent.xml b/interfaces/inputevent.xml deleted file mode 100644 index 74c698e..0000000 --- a/interfaces/inputevent.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - diff --git a/interfaces/interfaces.pro b/interfaces/interfaces.pro index 53324b2..1e30bdd 100644 --- a/interfaces/interfaces.pro +++ b/interfaces/interfaces.pro @@ -18,22 +18,15 @@ QT = dbus CONFIG += staticlib HEADERS += \ - include/appframework.hpp \ - include/windowmanager.hpp + include/appframework.hpp -SOURCES += src/appframework.cpp \ - src/windowmanager.cpp +SOURCES += \ + src/appframework.cpp XMLSOURCES = \ afm_user_daemon.xml \ appframework.xml \ - daynightmode.xml \ - homescreen.xml \ - inputevent.xml \ - popup.xml \ - proximity.xml \ - statusbar.xml \ - windowmanager.xml + statusbar.xml gen_adaptor_cpp.input = XMLSOURCES gen_adaptor_cpp.commands = \ diff --git a/interfaces/popup.xml b/interfaces/popup.xml deleted file mode 100644 index 113ced9..0000000 --- a/interfaces/popup.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - diff --git a/interfaces/proximity.xml b/interfaces/proximity.xml deleted file mode 100644 index c581254..0000000 --- a/interfaces/proximity.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - diff --git a/interfaces/src/windowmanager.cpp b/interfaces/src/windowmanager.cpp deleted file mode 100644 index 0811a57..0000000 --- a/interfaces/src/windowmanager.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ - -#include "include/windowmanager.hpp" - -SimplePoint::SimplePoint() -{ -} - -SimplePoint::~SimplePoint() -{ -} - - -LayoutArea::LayoutArea() -{ -} - -LayoutArea::~LayoutArea() -{ -} - - -Layout::Layout(): - id(-1), - name("N/A"), - layoutAreas() -{ -} - -Layout::Layout(int layoutId, const QString &layoutName, const QList &surfaceAreas): - id(layoutId), - name(layoutName), - layoutAreas(surfaceAreas) -{ -} - -Layout::~Layout() -{ -} - -QDBusArgument &operator <<(QDBusArgument &argument, const SimplePoint &mSimplePoint) -{ - argument.beginStructure(); - argument << mSimplePoint.x; - argument << mSimplePoint.y; - argument.endStructure(); - - return argument; -} - -const QDBusArgument &operator >>(const QDBusArgument &argument, SimplePoint &mSimplePoint) -{ - argument.beginStructure(); - argument >> mSimplePoint.x; - argument >> mSimplePoint.y; - argument.endStructure(); - return argument; -} - -QDBusArgument &operator <<(QDBusArgument &argument, const LayoutArea &mLayoutArea) -{ - argument.beginStructure(); - argument << mLayoutArea.x; - argument << mLayoutArea.y; - argument << mLayoutArea.width; - argument << mLayoutArea.height; - argument.endStructure(); - - return argument; -} - -const QDBusArgument &operator >>(const QDBusArgument &argument, LayoutArea &mLayoutArea) -{ - argument.beginStructure(); - argument >> mLayoutArea.x; - argument >> mLayoutArea.y; - argument >> mLayoutArea.width; - argument >> mLayoutArea.height; - argument.endStructure(); - return argument; -} - -QDBusArgument &operator <<(QDBusArgument &argument, const Layout &mLayout) -{ - argument.beginStructure(); - argument << mLayout.id; - argument << mLayout.name; - argument << mLayout.layoutAreas; - argument.endStructure(); - - return argument; -} - -const QDBusArgument &operator >>(const QDBusArgument &argument, Layout &mLayout) -{ - argument.beginStructure(); - argument >> mLayout.id; - argument >> mLayout.name; - argument >> mLayout.layoutAreas; - argument.endStructure(); - return argument; -} diff --git a/interfaces/windowmanager.xml b/interfaces/windowmanager.xml deleted file mode 100644 index f288b32..0000000 --- a/interfaces/windowmanager.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/package/config.xml b/package/config.xml new file mode 100644 index 0000000..1cd5438 --- /dev/null +++ b/package/config.xml @@ -0,0 +1,19 @@ + + + homescreen + + + This is a demo application for homescreen + TOYOTA + APL 2.0 + + + + + + + + + + + diff --git a/package/icon.svg b/package/icon.svg new file mode 100644 index 0000000..91661a7 --- /dev/null +++ b/package/icon.svg @@ -0,0 +1,279 @@ + + + +image/svg+xmlMULTIMEDIA + \ No newline at end of file diff --git a/package/package.pro b/package/package.pro new file mode 100644 index 0000000..09c7a01 --- /dev/null +++ b/package/package.pro @@ -0,0 +1,22 @@ +DISTFILES = icon.svg config.xml + +copy_icon.target = $$OUT_PWD/root/icon.svg +copy_icon.depends = $$_PRO_FILE_PWD_/icon.svg +copy_icon.commands = $(COPY_FILE) \"$$replace(copy_icon.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_icon.target, /, $$QMAKE_DIR_SEP)\" +QMAKE_EXTRA_TARGETS += copy_icon +PRE_TARGETDEPS += $$copy_icon.target + +copy_config.target = $$OUT_PWD/root/config.xml +copy_config.depends = $$_PRO_FILE_PWD_/config.xml +copy_config.commands = $(COPY_FILE) \"$$replace(copy_config.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_config.target, /, $$QMAKE_DIR_SEP)\" +QMAKE_EXTRA_TARGETS += copy_config +PRE_TARGETDEPS += $$copy_config.target + +wgt.target = package +wgt.commands = wgtpkg-pack -f -o homescreen.wgt root + +QMAKE_EXTRA_TARGETS += wgt + +deploy.files = homescreen.wgt +deploy.path = /usr/AGL/apps/autoinstall +INSTALLS += deploy diff --git a/sampleapptimedate/LICENSE b/sampleapptimedate/LICENSE deleted file mode 100644 index 31c692a..0000000 --- a/sampleapptimedate/LICENSE +++ /dev/null @@ -1,54 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - You must give any other recipients of the Work or Derivative Works a copy of this License; and - You must cause any modified files to carry prominent notices stating that You changed the files; and - You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS diff --git a/sampleapptimedate/README.md b/sampleapptimedate/README.md deleted file mode 100644 index 6d322b8..0000000 --- a/sampleapptimedate/README.md +++ /dev/null @@ -1,11 +0,0 @@ -AGL Sample Application for Home Screen Statusbar -This application simply shows the current time in the home screen status bar - -Build with QtCreator 3.0.1 - -AGL repo for source code: -https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen - -AGL repo for bitbake recipe: -https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb - diff --git a/sampleapptimedate/sampleapptimedate.pro b/sampleapptimedate/sampleapptimedate.pro deleted file mode 100644 index bcbe095..0000000 --- a/sampleapptimedate/sampleapptimedate.pro +++ /dev/null @@ -1,28 +0,0 @@ -# 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. - -TEMPLATE = app -TARGET = SampleAppTimeDate -QT = dbus - -include(../interfaces/interfaces.pri) - -SOURCES += src/main.cpp \ - src/timedateprovider.cpp - -HEADERS += \ - src/timedateprovider.hpp - -OTHER_FILES += \ - README.md diff --git a/sampleapptimedate/src/main.cpp b/sampleapptimedate/src/main.cpp deleted file mode 100644 index 5140b48..0000000 --- a/sampleapptimedate/src/main.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include "timedateprovider.hpp" - -void noOutput(QtMsgType, const QMessageLogContext &, const QString &) -{ -} - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - - QCoreApplication::setOrganizationDomain("LinuxFoundation"); - QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); - QCoreApplication::setApplicationName("SampleAppTimeDate"); - QCoreApplication::setApplicationVersion("0.7.0"); - - QCommandLineParser parser; - parser.setApplicationDescription("AGL Sample app for StatusBar interface - see wwww... for more details"); - parser.addHelpOption(); - parser.addVersionOption(); - QCommandLineOption quietOption(QStringList() << "q" << "quiet", - QCoreApplication::translate("main", "Be quiet. No outputs.")); - parser.addOption(quietOption); - parser.process(a); - - if (parser.isSet(quietOption)) - { - qInstallMessageHandler(noOutput); - } - - TimeDateProvider *tdp = new TimeDateProvider(); - tdp->start(); - - return a.exec(); -} diff --git a/sampleapptimedate/src/timedateprovider.cpp b/sampleapptimedate/src/timedateprovider.cpp deleted file mode 100644 index 2511432..0000000 --- a/sampleapptimedate/src/timedateprovider.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "timedateprovider.hpp" -#include - -TimeDateProvider::TimeDateProvider(QObject *parent) : - QObject(parent), - m_secondsTimerId(-1), - mp_dBusStatusBarProxy(0), - m_statusBarPlaceholder(-1) -{ - qDebug("D-Bus: register as org.agl.SampleAppTimeDate"); - // dbus setup - QDBusConnection dbus = QDBusConnection::sessionBus(); - - dbus.registerObject("/", this); - dbus.registerService("org.agl.sampleapptimedate"); - - - qDebug("D-Bus: connect to org.agl.homescreen /StatusBar"); - mp_dBusStatusBarProxy = new org::agl::statusbar("org.agl.homescreen", - "/StatusBar", - QDBusConnection::sessionBus(), - 0); -} - -TimeDateProvider::~TimeDateProvider() -{ - stop(); - - if (0 != mp_dBusStatusBarProxy) - { - mp_dBusStatusBarProxy->setStatusText(1, ""); - delete mp_dBusStatusBarProxy; - } -} - -void TimeDateProvider::start() -{ - qDebug("trying to start timer (if this lasts long, maybe the Home Screen Application is not launched."); - if ((-1 == m_statusBarPlaceholder) && (0 != mp_dBusStatusBarProxy)) - { - QList availablePlaceholder = mp_dBusStatusBarProxy->getAvailablePlaceholders(); - if (availablePlaceholder.size() > 0) - { - // just take the first available placeholder - m_statusBarPlaceholder = availablePlaceholder[0]; - qDebug("- using statusbar placeholder %d", m_statusBarPlaceholder); - - qDebug("- timer started"); - // callback every second - m_secondsTimerId = startTimer(1000); - } - } -} - -void TimeDateProvider::stop() -{ - if (-1 != m_secondsTimerId) - { - killTimer(m_secondsTimerId); - m_secondsTimerId = -1; - m_statusBarPlaceholder = -1; - } -} - -void TimeDateProvider::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == m_secondsTimerId) - { - if (0 != mp_dBusStatusBarProxy) - { - QString toDisplay = QDateTime::currentDateTime().toString("hh:mm"); - qDebug("%s", toDisplay.toStdString().c_str()); - mp_dBusStatusBarProxy->setStatusText(m_statusBarPlaceholder, toDisplay); - } - } -} diff --git a/sampleapptimedate/src/timedateprovider.hpp b/sampleapptimedate/src/timedateprovider.hpp deleted file mode 100644 index 5ff663f..0000000 --- a/sampleapptimedate/src/timedateprovider.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef TIMEDATEPROVIDER_HPP -#define TIMEDATEPROVIDER_HPP - -#include -#include "statusbar_proxy.h" - -class TimeDateProvider : public QObject -{ - Q_OBJECT -public: - explicit TimeDateProvider(QObject *parent = 0); - ~TimeDateProvider(); - void start(); - void stop(); -protected: - void timerEvent(QTimerEvent *e); -private: - int m_secondsTimerId; - org::agl::statusbar *mp_dBusStatusBarProxy; - int m_statusBarPlaceholder; -signals: - -public slots: - -}; - -#endif // TIMEDATEPROVIDER_HPP diff --git a/test/commandlinetests.txt b/test/commandlinetests.txt deleted file mode 100644 index 428b1ca..0000000 --- a/test/commandlinetests.txt +++ /dev/null @@ -1,150 +0,0 @@ -Command line tests - -Precondition for all test is, that the D-Bus session is launched: -$export `dbus-launch` - ---------------------------------------------------------------------------------------------------------------------- -Interface: -org.agl.daynightmode - -Signal: - - - - -Preconditions: -- HomeScreen app is running - -Test: -no command line test available right now - ---------------------------------------------------------------------------------------------------------------------- -Interface: -org.agl.homescreen - -Method: - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --print-reply --dest=org.agl.homescreen /HomeScreen org.agl.homescreen.hardKeyPressed int32:0 - -Method: - - - - -$dbus-send --session --type=method_call --print-reply --dest=org.agl.homescreen /HomeScreen org.agl.homescreen.setToFullscreen int32:0 - ---------------------------------------------------------------------------------------------------------------------- -Interface: -org.agl.popup - -Method: - - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --dest=org.agl.homescreen /Popup org.agl.popup.showPopup int32:1 string:"TEST" - -Method: - - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --dest=org.agl.homescreen /Popup org.agl.popup.showPopupComboBox string:"TEST" array:string:"test1","test2" - ---------------------------------------------------------------------------------------------------------------------- -Interface: -org.agl.proximity - -Method: - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --dest=org.agl.homescreen /Proximity org.agl.proximity.setObjectDetected boolean:true - ---------------------------------------------------------------------------------------------------------------------- -Interface: -org.agl.statusbar - -Method: - - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --print-reply --dest=org.agl.homescreen /StatusBar org.agl.statusbar.getAvailablePlaceholders - -Method: - - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --print-reply --dest=org.agl.homescreen /StatusBar org.agl.statusbar.getStatusText int32:1 - -Method: - - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --print-reply --dest=org.agl.homescreen /StatusBar org.agl.statusbar.getStatusIcon int32:1 - -Method: - - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --print-reply --dest=org.agl.homescreen /StatusBar org.agl.statusbar.setStatusText int32:1 string:"Test1" - -Method: - - - - - -Preconditions: -- HomeScreen app is running - -Test: -$dbus-send --session --type=method_call --print-reply --dest=org.agl.homescreen /StatusBar org.agl.statusbar.setStatusIcon int32:1 string:"" - - -- cgit 1.2.3-korg