--- /dev/null
+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 bitbake recipe:
+https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl-demo.git;a=blob;f=recipes-demo-hmi/homescreen/homescreen_git.bb
+
+
+
+
+Quickstart:
+
+Instructions for building HomeScreen app
+----------------------------------------
+
+The HomeScreen app is part of the
+packagegroup-agl-demo-platform
+packagegroup.
+
+This also includes the following apps:
+- HomeScreenAppFrameworkBinderAGL
+- InputEventManager
+- SampleHomeScreenInterfaceApp
+- WindowManager
+
+
+And the library
+- libhomescreen
+
+
+To build all the above, follow the instrucions on the AGL
+documentation website:
+http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/source-code.html#features-supported-by-aglsetup
+
+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
--- /dev/null
+# 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 = subdirs
+
+load(configure)
+
+SUBDIRS = interfaces \
+ homescreen \
+ homescreensimulator \
+ sampleapptimedate
+
+homescreen.depends = interfaces
+homescreensimulator.depends = interfaces
+sampleapptimedate.depends = interfaces
--- /dev/null
+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
--- /dev/null
+AGL Home Screen reference implementation
+
+
+Build with QtCreator 3.5.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_git.bb
--- /dev/null
+[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
+ConditionKernelCommandLine=!agl.nogfx
+
+[Service]
+User=root
+Type=dbus
+BusName=org.agl.homescreen
+ExecStartPre=/bin/systemctl --user is-active WindowManager
+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=1
+
+[Install]
+WantedBy=default.target
--- /dev/null
+# Welcome to your AGL system!
+When booting up an AGL system, the first thing that your eyes will spot is this:
+
+![AGL HomeScreen Application Launcher](pictures/homescreen_applauncher.png)
+
+**The AGL HomeScreen!**
+
+Intended to be used with touch presses, the reference HMI provides access to all pre-installed AGL demo applications as well as in the future access to user installed apps. The list of demo apps contains some automotive applications like HVAC-control, Navigation or Dashboard, as well as some infotainment apps. Radio, Multimedia, Phone...
+This applications are already available and were presented at CES 2017.
+
+## Here are some screenshots of the pre-installed demo applications:
+
+## HVAC
+
+![AGL HVAC](pictures/hvac.png)
+
+## Phone
+
+![AGL Phone](pictures/phone.png)
+
+## Dashboard
+
+![AGL Dashboard](pictures/dashboard.png)
+
+## Settings
+
+![AGL Settings](pictures/settings.png)
+
+#### Note:
+* All current demos (including HomeScreen) are optimized for landscape full HD resolution (1080x1920).
+
--- /dev/null
+# 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 = HomeScreen
+QT = qml quick dbus
+CONFIG += c++11
+
+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
+
+HEADERS += \
+ src/homescreencontrolinterface.h \
+ src/layouthandler.h \
+ src/statusbarmodel.h \
+ src/statusbarserver.h \
+ src/applicationlauncher.h \
+ src/applicationmodel.h \
+ src/appinfo.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 \
+ qml/images/Shortcut/shortcut.qrc \
+ qml/images/Status/status.qrc \
+ qml/images/images.qrc \
+ qml/qml.qrc
--- /dev/null
+/*
+ * 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 {
+ anchors.centerIn: parent
+ width: cellHeight * 3
+ height: cellHeight * 3
+ cellWidth: 320
+ cellHeight: 320
+ interactive: false
+
+ model: ApplicationModel {}
+ delegate: MouseArea {
+ width: 320
+ height: 320
+ Image {
+ anchors.fill: parent
+ source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(pressed ? 'Active' : 'Inactive')
+ }
+ onClicked: {
+ console.log("app is ", model.id)
+ pid = launcher.launch(model.id)
+ if (1 < pid) {
+ layoutHandler.makeMeVisible(pid)
+
+ applicationArea.visible = true
+ appLauncherAreaLauncher.visible = false
+ layoutHandler.showAppLayer(pid)
+ }
+ else {
+ console.warn("app cannot be launched!")
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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 QtQuick.Controls 1.0
+
+StackView {
+ id: root
+ width: 1080
+ height: 215
+
+ initialItem: blank
+
+ Component {
+ id: blank
+ MediaAreaBlank {
+// MouseArea {
+// anchors.fill: parent
+// onClicked: root.push(mouse.x < 540 ? music : radio)
+// }
+ }
+ }
+
+ Component {
+ id: music
+ MediaAreaMusic {
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.pop()
+ }
+ }
+ }
+
+ Component {
+ id: radio
+ MediaAreaRadio {
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.pop()
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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
+
+Image {
+ width: 1080
+ height: 215
+ source: './images/Utility_Logo_Background-01.png'
+
+ Image {
+ anchors.centerIn: parent
+ source: './images/Utility_Logo_Colour-01.png'
+ }
+}
--- /dev/null
+/*
+ * 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 QtQuick.Layouts 1.1
+import QtQuick.Controls 1.0
+
+Image {
+ width: 1080
+ height: 215
+ source: './images/Utility_Music_Background-01.png'
+
+ ColumnLayout {
+ anchors.fill: parent
+ spacing: 1
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredHeight: 107
+ spacing: 10
+ Image {
+ source: './images/MediaMusic/AlbumArtwork.png'
+ width: 105.298
+ height: 110.179
+ fillMode: Image.PreserveAspectFit
+ }
+ Label {
+ text: 'Come Together - The Beatles'
+ font.family: 'Roboto'
+ font.pixelSize: 32
+ color: 'white'
+ }
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredHeight: 107
+ Image {
+ source: './images/MediaPlayer/AGL_MediaPlayer_BackArrow.png'
+ }
+ Image {
+ source: './images/MediaPlayer/AGL_MediaPlayer_Player_Pause.png'
+ }
+ Image {
+ source: './images/MediaPlayer/AGL_MediaPlayer_ForwardArrow.png'
+ }
+
+ ProgressBar {
+ Layout.fillWidth: true
+ Layout.preferredWidth: 2
+ }
+
+ Label {
+ text: '2:12/4:19'
+ font.family: 'Roboto'
+ font.pixelSize: 20
+ }
+ Image {
+ source: './images/MediaPlayer/AGL_MediaPlayer_Shuffle_Active.png'
+ }
+ Image {
+ source: './images/MediaPlayer/AGL_MediaPlayer_Shuffle_Active.png'
+ }
+ ProgressBar {
+ Layout.fillWidth: true
+ Layout.preferredWidth: 1
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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
+
+Image {
+ width: 1080
+ height: 215
+ source: './images/Utility_Radio_Background-01.png'
+}
--- /dev/null
+/*
+ * 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 QtQuick.Layouts 1.1
+
+Item {
+ id: root
+ width: 785
+ height: 218
+
+
+ ListModel {
+ id: applicationModel
+ ListElement {
+ name: 'Home'
+ application: ''
+ }
+ ListElement {
+ name: 'Multimedia'
+ application: 'mediaplayer@0.1'
+ }
+ ListElement {
+ name: 'HVAC'
+ application: 'hvac@0.1'
+ }
+ ListElement {
+ name: 'Navigation'
+ application: 'navigation@0.1'
+ }
+ }
+
+ property int pid: -1
+
+ RowLayout {
+ anchors.fill: parent
+ spacing: 2
+ Repeater {
+ model: applicationModel
+ delegate: ShortcutIcon {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ name: model.name
+ active: model.application === launcher.current
+ onClicked: {
+ if (0 === model.index) {
+ appLauncherAreaLauncher.visible = true
+ applicationArea.visible = false
+ layoutHandler.hideAppLayer()
+ launcher.current = ''
+ }
+ else {
+ pid = launcher.launch(model.application)
+ if (1 < pid) {
+ applicationArea.visible = true
+ appLauncherAreaLauncher.visible = false
+ layoutHandler.makeMeVisible(pid)
+ layoutHandler.showAppLayer(pid)
+ }
+ else {
+ console.warn("app cannot be launched!")
+ }
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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
+
+MouseArea {
+ id: root
+ width: 195
+ height: 216.8
+ property string name: 'Home'
+ property bool active: false
+ Image {
+ id: icon
+ anchors.fill: parent
+ source: './images/Shortcut/HMI_Shortcut_%1-01.png'.arg(root.name)
+ }
+ Image {
+ anchors.fill: parent
+ source: './images/Shortcut/HMI_Shortcut_%1_Active-01.png'.arg(root.name)
+ opacity: 1.0 - icon.opacity
+ }
+ states: [
+ State {
+ when: root.active
+ PropertyChanges {
+ target: icon
+ opacity: 0.0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ NumberAnimation {
+ properties: 'opacity'
+ easing.type: Easing.OutExpo
+ }
+ }
+ ]
+}
--- /dev/null
+/*
+ * 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 QtQuick.Layouts 1.1
+import QtQuick.Controls 1.0
+import HomeScreen 1.0
+
+Item {
+ id: root
+ width: 295
+ height: 218
+
+ property date now: new Date
+ Timer {
+ interval: 100; running: true; repeat: true;
+ onTriggered: root.now = new Date
+ }
+
+ RowLayout {
+ anchors.fill: parent
+ spacing: 0
+ Item {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredWidth: 295 - 76
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 40
+ spacing: 0
+ Text {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ text: Qt.formatDate(now, 'dddd').toUpperCase()
+ font.family: 'Roboto'
+ font.pixelSize: 13
+ color: 'white'
+ verticalAlignment: Text.AlignVCenter
+// Rectangle {
+// anchors.fill: parent
+// anchors.margins: 5
+// color: 'red'
+// border.color: 'blue'
+// border.width: 1
+// z: -1
+// }
+ }
+ Text {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ text: Qt.formatTime(now, 'h:mm ap').toUpperCase()
+ font.family: 'Roboto'
+ font.pixelSize: 40
+ color: 'white'
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredHeight: 20
+ Image {
+ source: './images/Weather/WeatherIcons_Rain-01.png'
+ }
+ Text {
+ text: '64°F'
+ color: 'white'
+ font.family: 'Helvetica'
+ font.pixelSize: 32
+ }
+ }
+ }
+ }
+ ColumnLayout {
+ id: icons
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredWidth: 76
+ spacing: -10
+ Repeater {
+ model: StatusBarModel {}
+ delegate: Image {
+ Layout.preferredWidth: 77
+ Layout.preferredHeight: 73
+ source: model.modelData
+ fillMode: Image.PreserveAspectFit
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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 QtQuick.Layouts 1.1
+
+Image {
+ width: 1920
+ height: 218
+ source: './images/TopSection_NoText_NoIcons-01.png'
+ fillMode: Image.PreserveAspectCrop
+
+ RowLayout {
+ anchors.fill: parent
+ spacing: 0
+ ShortcutArea {
+ id: shortcutArea
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredWidth: 785
+ }
+ StatusArea {
+ id: statusArea
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredWidth: 295
+ }
+ }
+}
--- /dev/null
+<RCC>
+ <qresource prefix="/images">
+ <file>AGL_HMI_Background_Car-01.png</file>
+ <file>HMI_AppLauncher_Connectivity_Active-01.png</file>
+ <file>HMI_AppLauncher_Connectivity_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Dashboard_Active-01.png</file>
+ <file>HMI_AppLauncher_Dashboard_Inactive-01.png</file>
+ <file>HMI_AppLauncher_HVAC_Active-01.png</file>
+ <file>HMI_AppLauncher_HVAC_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Mixer_Active-01.png</file>
+ <file>HMI_AppLauncher_Mixer_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Multimedia_Active-01.png</file>
+ <file>HMI_AppLauncher_Multimedia_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Navigation_Active-01.png</file>
+ <file>HMI_AppLauncher_Navigation_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Phone_Active-01.png</file>
+ <file>HMI_AppLauncher_Phone_Inactive-01.png</file>
+ <file>HMI_AppLauncher_POI_Active-01.png</file>
+ <file>HMI_AppLauncher_POI_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Radio_Active-01.png</file>
+ <file>HMI_AppLauncher_Radio_Inactive-01.png</file>
+ <file>HMI_AppLauncher_Settings_Active-01.png</file>
+ <file>HMI_AppLauncher_Settings_Inactive-01.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+<RCC>
+ <qresource prefix="/images/MediaMusic">
+ <file>AlbumArtwork.png</file>
+ <file>BackArrow.png</file>
+ <file>ForwardArrow.png</file>
+ <file>ShuffleIcon.png</file>
+ <file>Volume_Loud.png</file>
+ <file>Volume_Medium.png</file>
+ <file>Volume_Off.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+<RCC>
+ <qresource prefix="/images/MediaPlayer">
+ <file>AGL_MediaPlayer_AlbumArtwork.png</file>
+ <file>AGL_MediaPlayer_BackArrow.png</file>
+ <file>AGL_MediaPlayer_Bluetooth_Active.png</file>
+ <file>AGL_MediaPlayer_Bluetooth_Inactive.png</file>
+ <file>AGL_MediaPlayer_CD_Active.png</file>
+ <file>AGL_MediaPlayer_CD_Inactive.png</file>
+ <file>AGL_MediaPlayer_DividingLine.png</file>
+ <file>AGL_MediaPlayer_ForwardArrow.png</file>
+ <file>AGL_MediaPlayer_Loop_Active.png</file>
+ <file>AGL_MediaPlayer_Loop_Inactive.png</file>
+ <file>AGL_MediaPlayer_Player_Pause.png</file>
+ <file>AGL_MediaPlayer_Player_Play.png</file>
+ <file>AGL_MediaPlayer_Playlist_Active.png</file>
+ <file>AGL_MediaPlayer_Playlist_Inactive.png</file>
+ <file>AGL_MediaPlayer_PlaylistToggle_Active.png</file>
+ <file>AGL_MediaPlayer_PlaylistToggle_Inactive.png</file>
+ <file>AGL_MediaPlayer_Radio_Active.png</file>
+ <file>AGL_MediaPlayer_Radio_Inactive.png</file>
+ <file>AGL_MediaPlayer_Shuffle_Active.png</file>
+ <file>AGL_MediaPlayer_Shuffle_Inactive.png</file>
+ <file>Albums_Active.png</file>
+ <file>Albums_Inactive.png</file>
+ <file>DividingLine.png</file>
+ <file>GreenLine.png</file>
+ <file>Music_Active.png</file>
+ <file>Music_Inactive.png</file>
+ <file>Podcasts_Active.png</file>
+ <file>Podcasts_Inactive.png</file>
+ <file>Popup_Highlight.png</file>
+ <file>Popup_PauseIcon.png</file>
+ <file>Popup_PlayIcon.png</file>
+ <file>Popup_VerticalLine.png</file>
+ <file>X.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+<RCC>
+ <qresource prefix="/images/Shortcut">
+ <file>HMI_Shortcut_Home_Active-01.png</file>
+ <file>HMI_Shortcut_Home-01.png</file>
+ <file>HMI_Shortcut_HVAC_Active-01.png</file>
+ <file>HMI_Shortcut_HVAC-01.png</file>
+ <file>HMI_Shortcut_Multimedia_Active-01.png</file>
+ <file>HMI_Shortcut_Multimedia-01.png</file>
+ <file>HMI_Shortcut_Navigation_Active-01.png</file>
+ <file>HMI_Shortcut_Navigation-01.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+<RCC>
+ <qresource prefix="/images/Status">
+ <file>HMI_Status_Wifi_NoBars-01.png</file>
+ <file>HMI_Status_Bluetooth_Inactive-01.png</file>
+ <file>HMI_Status_Bluetooth_On-01.png</file>
+ <file>HMI_Status_Signal_1Bars-01.png</file>
+ <file>HMI_Status_Signal_2Bars-01.png</file>
+ <file>HMI_Status_Signal_3Bars-01.png</file>
+ <file>HMI_Status_Signal_4Bars-01.png</file>
+ <file>HMI_Status_Signal_Full-01.png</file>
+ <file>HMI_Status_Signal_NoBars-01.png</file>
+ <file>HMI_Status_Wifi_1Bar-01.png</file>
+ <file>HMI_Status_Wifi_2Bars-01.png</file>
+ <file>HMI_Status_Wifi_3Bars-01.png</file>
+ <file>HMI_Status_Wifi_Full-01.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+<RCC>
+ <qresource prefix="/images/Weather">
+ <file>WeatherIcons_ALL-01.png</file>
+ <file>WeatherIcons_Cloudy-01.png</file>
+ <file>WeatherIcons_Moon-01.png</file>
+ <file>WeatherIcons_PartiallyCloudy-01.png</file>
+ <file>WeatherIcons_Rain-01.png</file>
+ <file>WeatherIcons_Snow-01.png</file>
+ <file>WeatherIcons_Sun-01.png</file>
+ <file>WeatherIcons_Thunderstorm-01.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+<RCC>
+ <qresource prefix="/images">
+ <file>TopSection_NoText_NoIcons-01.png</file>
+ <file>Utility_Logo_Background-01.png</file>
+ <file>Utility_Logo_Colour-01.png</file>
+ <file>Utility_Music_Background-01.png</file>
+ <file>Utility_Radio_Background-01.png</file>
+ <file>AGL_HMI_Background_NoCar-01.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+/*
+ * 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 QtQuick.Window 2.1
+import QtQuick.Layouts 1.1
+import HomeScreen 1.0
+
+Window {
+ visible: true
+ flags: Qt.FramelessWindowHint
+ width: container.width * container.scale
+ 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'
+
+ ColumnLayout {
+ anchors.fill: parent
+ spacing: 0
+ TopArea {
+ id: topArea
+ Layout.fillWidth: true
+ Layout.preferredHeight: 218
+ }
+
+ Item {
+ id: applicationArea
+ Layout.fillWidth: true
+ 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
+ }
+
+ MediaArea {
+ id: mediaArea
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredHeight: 215
+ }
+ }
+ }
+}
--- /dev/null
+<RCC>
+ <qresource prefix="/">
+ <file>Home.qml</file>
+ <file>main.qml</file>
+ <file>MediaArea.qml</file>
+ <file>MediaAreaBlank.qml</file>
+ <file>MediaAreaMusic.qml</file>
+ <file>MediaAreaRadio.qml</file>
+ <file>ShortcutArea.qml</file>
+ <file>ShortcutIcon.qml</file>
+ <file>StatusArea.qml</file>
+ <file>TopArea.qml</file>
+ </qresource>
+</RCC>
--- /dev/null
+/*
+ * 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 <QtCore/QJsonObject>
+
+class AppInfo::Private : public QSharedData
+{
+public:
+ Private();
+ Private(const Private &other);
+
+ QString id;
+ QString version;
+ int width;
+ int height;
+ QString name;
+ QString description;
+ QString shortname;
+ QString author;
+ QString iconPath;
+};
+
+AppInfo::Private::Private()
+ : width(-1)
+ , height(-1)
+{
+}
+
+AppInfo::Private::Private(const Private &other)
+ : QSharedData(other)
+ , id(other.id)
+ , version(other.version)
+ , width(other.width)
+ , height(other.height)
+ , name(other.name)
+ , description(other.description)
+ , shortname(other.shortname)
+ , author(other.author)
+ , iconPath(other.iconPath)
+{
+}
+
+AppInfo::AppInfo()
+ : d(new Private)
+{
+}
+
+AppInfo::AppInfo(const QString &icon, const QString &name, const QString &id)
+ : d(new Private)
+{
+ d->iconPath = icon;
+ d->name = name;
+ d->id = id;
+}
+
+AppInfo::AppInfo(const AppInfo &other)
+ : d(other.d)
+{
+}
+
+AppInfo::~AppInfo()
+{
+}
+
+AppInfo &AppInfo::operator =(const AppInfo &other)
+{
+ d = other.d;
+ return *this;
+}
+
+QString AppInfo::id() const
+{
+ return d->id;
+}
+
+QString AppInfo::version() const
+{
+ return d->version;
+}
+
+int AppInfo::width() const
+{
+ return d->width;
+}
+
+int AppInfo::height() const
+{
+ return d->height;
+}
+
+QString AppInfo::name() const
+{
+ return d->name;
+}
+
+QString AppInfo::description() const
+{
+ return d->description;
+}
+
+QString AppInfo::shortname() const
+{
+ return d->shortname;
+}
+
+QString AppInfo::author() const
+{
+ return d->author;
+}
+
+QString AppInfo::iconPath() const
+{
+ return d->iconPath;
+}
+
+void AppInfo::read(const QJsonObject &json)
+{
+ d->id = json["id"].toString();
+ d->version = json["version"].toString();
+ d->width = json["width"].toInt();
+ d->height = json["height"].toInt();
+ d->name = json["name"].toString();
+ d->description = json["description"].toString();
+ d->shortname = json["shortname"].toString();
+ d->author = json["author"].toString();
+ d->iconPath = json["iconPath"].toString();
+}
+
+QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo)
+{
+ argument.beginStructure();
+ argument << appInfo.d->id;
+ argument << appInfo.d->version;
+ argument << appInfo.d->width;
+ argument << appInfo.d->height;
+ argument << appInfo.d->name;
+ argument << appInfo.d->description;
+ argument << appInfo.d->shortname;
+ argument << appInfo.d->author;
+ argument << appInfo.d->iconPath;
+ argument.endStructure();
+
+ return argument;
+}
+
+const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo)
+{
+ argument.beginStructure();
+ argument >> appInfo.d->id;
+ argument >> appInfo.d->version;
+ argument >> appInfo.d->width;
+ argument >> appInfo.d->height;
+ argument >> appInfo.d->name;
+ argument >> appInfo.d->description;
+ argument >> appInfo.d->shortname;
+ argument >> appInfo.d->author;
+ argument >> appInfo.d->iconPath;
+ argument.endStructure();
+ return argument;
+}
--- /dev/null
+/*
+ * 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 <QtCore/QSharedDataPointer>
+#include <QtDBus/QDBusArgument>
+
+class AppInfo
+{
+ Q_GADGET
+ Q_PROPERTY(QString id READ id)
+ Q_PROPERTY(QString version READ version)
+ Q_PROPERTY(int width READ width)
+ Q_PROPERTY(int height READ height)
+ Q_PROPERTY(QString name READ name)
+ Q_PROPERTY(QString description READ description)
+ Q_PROPERTY(QString shortname READ shortname)
+ Q_PROPERTY(QString author READ author)
+ Q_PROPERTY(QString iconPath READ iconPath)
+public:
+ AppInfo();
+ AppInfo(const QString &icon, const QString &name, const QString &id);
+ AppInfo(const AppInfo &other);
+ virtual ~AppInfo();
+ AppInfo &operator =(const AppInfo &other);
+ void swap(AppInfo &other) { qSwap(d, other.d); }
+
+ QString id() const;
+ QString version() const;
+ int width() const;
+ int height() const;
+ QString name() const;
+ QString description() const;
+ QString shortname() const;
+ QString author() const;
+ QString iconPath() const;
+
+ void read(const QJsonObject &json);
+
+ friend QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo);
+ friend const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo);
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+Q_DECLARE_SHARED(AppInfo)
+Q_DECLARE_METATYPE(AppInfo)
+Q_DECLARE_METATYPE(QList<AppInfo>)
+
+#endif // APPINFO_H
--- /dev/null
+/*
+ * 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 "applicationlauncher.h"
+
+#include <QtCore/QDebug>
+
+ApplicationLauncher::ApplicationLauncher(QObject *parent)
+ : QObject(parent),
+ mp_dBusAppFrameworkProxy()
+{
+ qDebug("D-Bus: connect to org.agl.homescreenappframeworkbinder /AppFramework");
+ mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbinder",
+ "/AppFramework",
+ QDBusConnection::sessionBus(),
+ 0);
+}
+
+ApplicationLauncher::~ApplicationLauncher()
+{
+ delete mp_dBusAppFrameworkProxy;
+}
+
+int ApplicationLauncher::launch(const QString &application)
+{
+ int result = -1;
+ qDebug() << "launch" << application;
+
+ result = mp_dBusAppFrameworkProxy->launchApp(application);
+ qDebug() << "pid:" << result;
+
+ if (result > 1) {
+ setCurrent(application);
+ }
+ return result;
+}
+
+QString ApplicationLauncher::current() const
+{
+ return m_current;
+}
+
+void ApplicationLauncher::setCurrent(const QString ¤t)
+{
+ if (m_current == current) return;
+ m_current = current;
+ emit currentChanged(current);
+}
--- /dev/null
+/*
+ * 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.
+ */
+
+#ifndef APPLICATIONLAUNCHER_H
+#define APPLICATIONLAUNCHER_H
+
+#include <QtCore/QObject>
+#include <include/appframework.hpp>
+#include <appframework_proxy.h>
+
+class ApplicationLauncher : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString current READ current WRITE setCurrent NOTIFY currentChanged)
+public:
+ explicit ApplicationLauncher(QObject *parent = NULL);
+ ~ApplicationLauncher();
+
+ QString current() const;
+
+signals:
+ void newAppRequestsToBeVisible(int pid);
+ void currentChanged(const QString ¤t);
+
+public slots:
+ int launch(const QString &application);
+ void setCurrent(const QString ¤t);
+
+private:
+ org::agl::appframework *mp_dBusAppFrameworkProxy;
+ QString m_current;
+};
+
+#endif // APPLICATIONLAUNCHER_H
--- /dev/null
+/*
+ * 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 <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusReply>
+
+class ApplicationModel::Private
+{
+public:
+ Private(ApplicationModel *parent);
+
+private:
+ ApplicationModel *q;
+public:
+ QDBusInterface proxy;
+ QList<AppInfo> data;
+};
+
+ApplicationModel::Private::Private(ApplicationModel *parent)
+ : q(parent)
+ , proxy(QStringLiteral("org.agl.homescreenappframeworkbinder"), QStringLiteral("/AppFramework"), QStringLiteral("org.agl.appframework"), QDBusConnection::sessionBus())
+{
+ QDBusReply<QList<AppInfo>> reply = proxy.call("getAvailableApps");
+ if (false)/*reply.isValid()) TODO: test for CES! */ {
+ data = reply.value();
+ } else {
+ data.append(AppInfo(QStringLiteral("HVAC"), QStringLiteral("HVAC"), QStringLiteral("hvac@0.1")));
+ data.append(AppInfo(QStringLiteral("Navigation"), QStringLiteral("NAVIGATION"), QStringLiteral("navigation@0.1")));
+ data.append(AppInfo(QStringLiteral("Phone"), QStringLiteral("PHONE"), QStringLiteral("phone@0.1")));
+ data.append(AppInfo(QStringLiteral("Radio"), QStringLiteral("RADIO"), QStringLiteral("radio@0.1")));
+ data.append(AppInfo(QStringLiteral("Multimedia"), QStringLiteral("MULTIMEDIA"), QStringLiteral("mediaplayer@0.1")));
+ data.append(AppInfo(QStringLiteral("Mixer"), QStringLiteral("MIXER"), QStringLiteral("mixer@0.1")));
+ data.append(AppInfo(QStringLiteral("Dashboard"), QStringLiteral("DASHBOARD"), QStringLiteral("dashboard@0.1")));
+ data.append(AppInfo(QStringLiteral("Settings"), QStringLiteral("SETTINGS"), QStringLiteral("settings@0.1")));
+ data.append(AppInfo(QStringLiteral("POI"), QStringLiteral("POINT OF\nINTEREST"), QStringLiteral("poi@0.1")));
+ }
+}
+
+ApplicationModel::ApplicationModel(QObject *parent)
+ : QAbstractListModel(parent)
+ , d(new Private(this))
+{
+}
+
+ApplicationModel::~ApplicationModel()
+{
+ delete d;
+}
+
+int ApplicationModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+
+ return d->data.count();
+}
+
+QVariant ApplicationModel::data(const QModelIndex &index, int role) const
+{
+ QVariant ret;
+ if (!index.isValid())
+ return ret;
+
+ switch (role) {
+ case Qt::DecorationRole:
+ ret = d->data[index.row()].iconPath();
+ break;
+ case Qt::DisplayRole:
+ ret = d->data[index.row()].name();
+ break;
+ case Qt::UserRole:
+ ret = d->data[index.row()].id();
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+QHash<int, QByteArray> ApplicationModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[Qt::DecorationRole] = "icon";
+ roles[Qt::DisplayRole] = "name";
+ roles[Qt::UserRole] = "id";
+ return roles;
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 The Qt Company Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APPLICATIONMODEL_H
+#define APPLICATIONMODEL_H
+
+#include <QtCore/QAbstractListModel>
+
+class ApplicationModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit ApplicationModel(QObject *parent = nullptr);
+ ~ApplicationModel();
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QHash<int, QByteArray> roleNames() const override;
+
+private:
+ class Private;
+ Private *d;
+};
+
+#endif // APPLICATIONMODEL_H
--- /dev/null
+/*
+ * 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 "homescreencontrolinterface.h"
+
+HomeScreenControlInterface::HomeScreenControlInterface(QObject *parent) :
+ QObject(parent),
+ mp_homeScreenAdaptor(0),
+ mp_dBusAppFrameworkProxy()
+{
+ // publish dbus homescreen interface
+ mp_homeScreenAdaptor = new HomescreenAdaptor((QObject*)this);
+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ dbus.registerObject("/HomeScreen", this);
+ dbus.registerService("org.agl.homescreen");
+
+ qDebug("D-Bus: connect to org.agl.homescreenappframeworkbindertizen /AppFramework");
+ mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbindertizen",
+ "/AppFramework",
+ QDBusConnection::sessionBus(),
+ 0);
+}
+
+HomeScreenControlInterface::~HomeScreenControlInterface()
+{
+ delete mp_dBusAppFrameworkProxy;
+ delete mp_homeScreenAdaptor;
+}
+
+QList<int> 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 = mp_dBusAppFrameworkProxy->launchApp("navigation@0.1");
+ qDebug("pid: %d", pid);
+ emit newRequestsToBeVisibleApp(pid);
+ break;
+ case InputEvent::HARDKEY_MEDIA:
+ qDebug("hardKeyPressed MEDIA key pressed!");
+ pid = mp_dBusAppFrameworkProxy->launchApp("media@0.1");
+ 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);
+}
--- /dev/null
+/*
+ * 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 <QObject>
+#include "include/homescreen.hpp"
+#include "homescreen_adaptor.h"
+#include <include/appframework.hpp>
+#include <appframework_proxy.h>
+
+class HomeScreenControlInterface : public QObject
+{
+ Q_OBJECT
+public:
+ explicit HomeScreenControlInterface(QObject *parent = 0);
+ ~HomeScreenControlInterface();
+
+signals:
+ void newRequestsToBeVisibleApp(int pid);
+
+ QList<int> 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<int> 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;
+ org::agl::appframework *mp_dBusAppFrameworkProxy;
+};
+
+#endif // HOMESCREENCONTROLINTERFACE_H
--- /dev/null
+/*
+ * 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 <QTimerEvent>
+
+LayoutHandler::LayoutHandler(QObject *parent) :
+ QObject(parent),
+ m_secondsTimerId(-1),
+ mp_dBusWindowManagerProxy(0),
+ mp_dBusPopupProxy(0),
+ m_visibleSurfaces(),
+ m_invisibleSurfaces(),
+ m_requestsToBeVisibleSurfaces()
+{
+ qDBusRegisterMetaType<SimplePoint>();
+ qDBusRegisterMetaType<QList<SimplePoint> >();
+ qDBusRegisterMetaType<LayoutArea>();
+ qDBusRegisterMetaType<QList<LayoutArea> >();
+ qDBusRegisterMetaType<Layout>();
+ qDBusRegisterMetaType<QList<Layout> >();
+
+ 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<LayoutArea> 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(int pid)
+{
+ mp_dBusWindowManagerProxy->showAppLayer(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<int> 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<int> 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<int> 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);
+}
+
+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();
+ }
+}
+
--- /dev/null
+/*
+ * 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 <QObject>
+#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(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<int> m_requestsToBeVisiblePids;
+ QList<int> m_visibleSurfaces;
+ QList<int> m_invisibleSurfaces;
+ QList<int> m_requestsToBeVisibleSurfaces;
+};
+
+#endif // LAYOUTHANDLER_H
--- /dev/null
+/*
+ * 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 <QGuiApplication>
+#include <QCommandLineParser>
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
+#include <QtQml/qqml.h>
+
+#include "layouthandler.h"
+#include "homescreencontrolinterface.h"
+#include "applicationlauncher.h"
+#include "statusbarmodel.h"
+#include "applicationmodel.h"
+
+void noOutput(QtMsgType, const QMessageLogContext &, const QString &)
+{
+}
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication a(argc, argv);
+
+ QCoreApplication::setOrganizationDomain("LinuxFoundation");
+ QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
+ QCoreApplication::setApplicationName("HomeScreen");
+ QCoreApplication::setApplicationVersion("0.7.0");
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription("AGL HomeScreen - 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);
+ }
+
+ qDBusRegisterMetaType<AppInfo>();
+ qDBusRegisterMetaType<QList<AppInfo> >();
+
+ qmlRegisterType<ApplicationLauncher>("HomeScreen", 1, 0, "ApplicationLauncher");
+ qmlRegisterType<ApplicationModel>("Home", 1, 0, "ApplicationModel");
+ qmlRegisterType<StatusBarModel>("HomeScreen", 1, 0, "StatusBarModel");
+
+ QQmlApplicationEngine engine;
+
+ LayoutHandler* layoutHandler = new LayoutHandler();
+
+ HomeScreenControlInterface* hsci = new HomeScreenControlInterface();
+ 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)));
+
+ engine.rootContext()->setContextProperty("layoutHandler", layoutHandler);
+
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return a.exec();
+}
--- /dev/null
+/*
+ * 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 <include/daynightmode.hpp>
+
+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);
+}
+
--- /dev/null
+/*
+ * 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 <QMainWindow>
+#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
--- /dev/null
+/*
+ * 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 <include/daynightmode.hpp>
+
+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();
+}
--- /dev/null
+/*
+ * 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 <QWidget>
+#include <include/popup.hpp>
+#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<QPushButton> m_pushButtons;
+};
+
+#endif // POPUPWIDGET_H
--- /dev/null
+/*
+ * 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 <QSettings>
+#include <include/daynightmode.hpp>
+
+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();
+}
--- /dev/null
+/*
+ * 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 <QWidget>
+#include <QTranslator>
+
+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
--- /dev/null
+/*
+ * 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 "statusbarmodel.h"
+#include "statusbarserver.h"
+
+#include <QtDBus/QDBusConnection>
+
+class StatusBarModel::Private
+{
+public:
+ Private(StatusBarModel *parent);
+
+private:
+ StatusBarModel *q;
+public:
+ StatusBarServer server;
+ QString iconList[StatusBarServer::SupportedCount];
+};
+
+StatusBarModel::Private::Private(StatusBarModel *parent)
+ : q(parent)
+{
+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ dbus.registerObject("/StatusBar", &server);
+ dbus.registerService("org.agl.homescreen");
+ connect(&server, &StatusBarServer::statusIconChanged, [&](int placeholderIndex, const QString &icon) {
+ if (placeholderIndex < 0 || StatusBarServer::SupportedCount <= placeholderIndex) return;
+ if (iconList[placeholderIndex] == icon) return;
+ iconList[placeholderIndex] = icon;
+ emit q->dataChanged(q->index(placeholderIndex), q->index(placeholderIndex));
+ });
+ for (int i = 0; i < StatusBarServer::SupportedCount; i++) {
+ iconList[i] = server.getStatusIcon(i);
+ }
+}
+
+StatusBarModel::StatusBarModel(QObject *parent)
+ : QAbstractListModel(parent)
+ , d(new Private(this))
+{
+}
+
+StatusBarModel::~StatusBarModel()
+{
+ delete d;
+}
+
+int StatusBarModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+
+ return StatusBarServer::SupportedCount;
+}
+
+QVariant StatusBarModel::data(const QModelIndex &index, int role) const
+{
+ QVariant ret;
+ if (!index.isValid())
+ return ret;
+
+ switch (role) {
+ case Qt::DisplayRole:
+ ret = d->iconList[index.row()];
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+QHash<int, QByteArray> StatusBarModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[Qt::DisplayRole] = "icon";
+ return roles;
+}
--- /dev/null
+/*
+ * 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 STATUSBARMODEL_H
+#define STATUSBARMODEL_H
+
+#include <QtCore/QAbstractListModel>
+
+class StatusBarModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit StatusBarModel(QObject *parent = NULL);
+ ~StatusBarModel();
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QHash<int, QByteArray> roleNames() const override;
+
+private:
+ class Private;
+ Private *d;
+};
+
+#endif // STATUSBARMODEL_H
--- /dev/null
+/*
+ * 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 "statusbarserver.h"
+#include "statusbar_adaptor.h"
+
+class StatusBarServer::Private
+{
+public:
+ Private(StatusBarServer *parent);
+ QString texts[SupportedCount];
+ QString icons[SupportedCount];
+ StatusbarAdaptor adaptor;
+};
+
+StatusBarServer::Private::Private(StatusBarServer *parent)
+ : adaptor(parent)
+{
+ icons[0] = QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_NoBars-01.png");
+ icons[1] = QStringLiteral("qrc:/images/Status/HMI_Status_Bluetooth_Inactive-01.png");
+ icons[2] = QStringLiteral("qrc:/images/Status/HMI_Status_Signal_NoBars-01.png");
+}
+
+StatusBarServer::StatusBarServer(QObject *parent)
+ : QObject(parent)
+ , d(new Private(this))
+{
+}
+
+StatusBarServer::~StatusBarServer()
+{
+ delete d;
+}
+
+QList<int> StatusBarServer::getAvailablePlaceholders() const
+{
+ QList<int> ret;
+ for (int i = 0; i < SupportedCount; ++i) {
+ ret.append(i);
+ }
+ return ret;
+}
+
+QString StatusBarServer::getStatusIcon(int placeholderIndex) const
+{
+ QString ret;
+ if (-1 < placeholderIndex && placeholderIndex < SupportedCount)
+ ret = d->icons[placeholderIndex];
+ return ret;
+}
+
+void StatusBarServer::setStatusIcon(int placeholderIndex, const QString &icon)
+{
+ if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
+ if (d->icons[placeholderIndex] == icon) return;
+ d->icons[placeholderIndex] = icon;
+ emit statusIconChanged(placeholderIndex, icon);
+ }
+}
+
+QString StatusBarServer::getStatusText(int placeholderIndex) const
+{
+ QString ret;
+ if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
+ ret = d->texts[placeholderIndex];
+ }
+ return ret;
+}
+
+void StatusBarServer::setStatusText(int placeholderIndex, const QString &text)
+{
+ if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
+ if (d->texts[placeholderIndex] == text) return;
+ d->texts[placeholderIndex] = text;
+ emit statusTextChanged(placeholderIndex, text);
+ }
+}
--- /dev/null
+/*
+ * 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 STATUSBARSERVER_H
+#define STATUSBARSERVER_H
+
+#include <QtCore/QObject>
+
+class StatusBarServer : public QObject
+{
+ Q_OBJECT
+public:
+ enum {
+ SupportedCount = 3,
+ };
+ explicit StatusBarServer(QObject *parent = NULL);
+ ~StatusBarServer();
+
+ Q_INVOKABLE QList<int> getAvailablePlaceholders() const;
+ Q_INVOKABLE QString getStatusIcon(int placeholderIndex) const;
+ Q_INVOKABLE QString getStatusText(int placeholderIndex) const;
+
+public slots:
+ void setStatusIcon(int placeholderIndex, const QString &icon);
+ void setStatusText(int placeholderIndex, const QString &text);
+
+signals:
+ void statusIconChanged(int placeholderIndex, const QString &icon);
+ void statusTextChanged(int placeholderIndex, const QString &text);
+
+private:
+ class Private;
+ Private *d;
+};
+
+#endif // STATUSBARSERVER_H
--- /dev/null
+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
--- /dev/null
+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
+
--- /dev/null
+# 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
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>731</width>
+ <height>507</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="windowTitle">
+ <string/>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>711</width>
+ <height>451</height>
+ </rect>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Status Bar</string>
+ </attribute>
+ <widget class="QPushButton" name="pushButton_Update">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>380</y>
+ <width>211</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Read from Home Screen App</string>
+ </property>
+ </widget>
+ <widget class="QTableWidget" name="tableWidget_Status">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>20</y>
+ <width>681</width>
+ <height>341</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_IconExample">
+ <property name="geometry">
+ <rect>
+ <x>550</x>
+ <y>380</y>
+ <width>141</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Icon-Example</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="tab_Popup">
+ <attribute name="title">
+ <string>Popup</string>
+ </attribute>
+ <widget class="QPushButton" name="pushButton_Send">
+ <property name="geometry">
+ <rect>
+ <x>600</x>
+ <y>380</y>
+ <width>99</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Send</string>
+ </property>
+ </widget>
+ <widget class="QPlainTextEdit" name="plainTextEdit_Popup">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>681</width>
+ <height>361</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_PopupExample">
+ <property name="geometry">
+ <rect>
+ <x>428</x>
+ <y>380</y>
+ <width>171</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>"Hello World" Example</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_comboBoxExample">
+ <property name="geometry">
+ <rect>
+ <x>230</x>
+ <y>380</y>
+ <width>191</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>ComboBox Example</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="tab_DayNightMode">
+ <attribute name="title">
+ <string>Day/Night Mode</string>
+ </attribute>
+ <widget class="QGroupBox" name="groupBox_DayNightMode">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>30</y>
+ <width>161</width>
+ <height>91</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Day/Night Mode</string>
+ </property>
+ <widget class="QRadioButton" name="radioButton_NightMode">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>50</y>
+ <width>117</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Night Mode</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="radioButton_DayMode">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>117</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Day Mode</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="tab_Proximity">
+ <attribute name="title">
+ <string>Proximity</string>
+ </attribute>
+ <widget class="QLabel" name="label_explanation">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>301</width>
+ <height>231</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string><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></string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" name="checkBox_ObjectDetected">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>300</y>
+ <width>151</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>object detected</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="tab_FutureFeatures">
+ <attribute name="title">
+ <string>Future features</string>
+ </attribute>
+ <widget class="QPushButton" name="pushButton_Right">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>250</x>
+ <y>160</y>
+ <width>71</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Right</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_OK">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>170</x>
+ <y>160</y>
+ <width>71</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_Left">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>160</y>
+ <width>71</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Left</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_Down">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>170</x>
+ <y>240</y>
+ <width>71</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Down</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_Up">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>170</x>
+ <y>80</y>
+ <width>71</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Up</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>20</y>
+ <width>181</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>under development
+not functional right now</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_Cancel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>240</y>
+ <width>71</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Cancel/
+Back?</string>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="QPushButton" name="pushButton_Exit">
+ <property name="geometry">
+ <rect>
+ <x>620</x>
+ <y>470</y>
+ <width>99</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ </widget>
+ </widget>
+ <action name="actionAbout">
+ <property name="text">
+ <string>About</string>
+ </property>
+ </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+/*
+ * 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 <QApplication>
+#include <QSysInfo>
+#include <QSharedMemory>
+
+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();
+}
--- /dev/null
+/*
+ * 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<int> 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<QString> 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());
+}
--- /dev/null
+/*
+ * 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 <QMainWindow>
+#include <include/daynightmode.hpp>
+#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
--- /dev/null
+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
--- /dev/null
+AGL Home Screen reference implementation
+This lib provides the needed D-Bus interfaces
+
+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
+
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+ <!--
+ org.agl.appframework:
+ @short_description: The interface of the app framework binder.
+
+ The app framework has to provide some basic functionality like
+ getting a list of applications and start them. In further versions,
+ also pausing or stopping, .
+ -->
+ <interface name="org.agl.appframework">
+ <!--
+ getAvailableApps:
+ @apps: A list of applications that can be launched.
+
+ The application info consists of:
+ string id;
+ string version;
+ int width;
+ int height;
+ string name;
+ string description;
+ string shortname;
+ string author;
+ string iconPath;
+ -->
+ <method name="getAvailableApps">
+ <arg name="apps" type="{ssiisssss}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<AppInfo>"/>
+ </method>
+ <!--
+ launchApp:
+ @name: The name of the application that shall be launched.
+ @pid: Returns the pid of the process.
+
+ Use the id of the application info to launch the app.
+ -->
+ <method name="launchApp">
+ <arg name="name" type="s" direction="in"/>
+ <arg name="pid" type="i" direction="out"/>
+ </method>
+ </interface>
+</node>
+
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+ <interface name="org.agl.daynightmode">
+ <signal name="dayNightMode">
+ <arg name="mode" type="i" direction="out"/>
+ </signal>
+ </interface>
+</node>
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+<!--
+ org.agl.homescreen:
+ @short_description: A generic interface for the HomeScreen app.
+
+ This interface is a collection of methods from different functional areas to control the HomeScreen app.
+-->
+ <interface name="org.agl.homescreen">
+ <!--
+ hardKeyPressed:
+ @key: The key that was pressed using the inputevent.hpp InputEvent::HardKey type.
+
+ This is used to inject hard keys into the HomeScreen app.
+ -->
+ <method name="hardKeyPressed">
+ <arg name="key" type="i" direction="in"/>
+ </method>
+ <!--
+ getSurfaceStatus:
+ @surfaceId: The given surface.
+ @status: The status can be unknown (-1), visible (0), invisible (1)
+
+ A surface can have three states. It can be visible, then it is shown on the screen.
+ It can be invisible, then it is not shown on the screen. Or the state is unknown.
+ -->
+ <method name="getSurfaceStatus">
+ <arg name="surfaceId" type="i" direction="in"/>
+ <arg name="status" type="i" direction="out"/>
+ </method>
+ <!--
+ requestSurfaceIdToFullScreen:
+ @surfaceId: The surface that request to be shown fullscreen.
+
+ This allows an application to set a surface to full screen.
+ -->
+ <method name="requestSurfaceIdToFullScreen">
+ <arg name="surfaceId" type="i" direction="in"/>
+ </method>
+ <!--
+ getAllSurfacesOfProcess:
+ @pid: The PID of the process.
+ @surfaceIds: A list of surfaces that were created by the process.
+
+ The surface IDs can for example be used to assign them to a layout render area.
+ -->
+ <method name="getAllSurfacesOfProcess">
+ <arg name="pid" type="i" direction="in"/>
+ <arg name="surfaceIds" type="ai" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/>
+ </method>
+ <!--
+ renderAppToAreaAllowed:
+ @appCategory: The application category that is requested. Use enum AppCategory for this!
+ @layoutArea: The layout area where the application shall be rendered. Find the layoutArea ids in the layout definition!
+ @allowed: Returns true, if the application is allowed to be rendered in the area
+
+ This function can be used to request, if it is allowed to render an application of a specific category
+ in a layout area. The idea is to decide from an application point of view to allocate recources or not.
+ Example: an application will decide to render video based on this call. This call will not change anything, it is only a request.
+ -->
+ <method name="renderAppToAreaAllowed">
+ <arg name="appCategory" type="i" direction="in"/>
+ <arg name="layoutArea" type="i" direction="in"/>
+ <arg name="allowed" type="b" direction="out"/>
+ </method>
+ <!--
+ renderSurfaceToArea:
+ @surfaceId: The surface that is requested.
+ @layoutArea: The layout area where the surface shall be rendered. Find the layoutArea ids in the layout definition!
+
+ This is a special case. In the normal use case, one layout area is always filled completely
+ with the first surface, that the process creates (more precise: the surface with the lowest id).
+ By using this function, an app can request to position a different surface in the layout area.
+ -->
+ <method name="renderSurfaceToArea">
+ <arg name="surfaceId" type="i" direction="in"/>
+ <arg name="layoutArea" type="i" direction="in"/>
+ </method>
+ <!--
+ surfaceVisibilityChanged:
+ @surfaceId: The surface that changed.
+ @visible: True, if the surface is visible.
+
+ This is emitted when the visible property of the surfaces changes.
+ -->
+ <signal name="surfaceVisibilityChanged">
+ <arg name="surfaceId" type="i"/>
+ <arg name="visible" type="b"/>
+ </signal>
+ </interface>
+</node>
+
--- /dev/null
+/*
+ * 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 APPFRAMEWORK_HPP
+#define APPFRAMEWORK_HPP
+
+#include <QtCore/QSharedDataPointer>
+#include <QtDBus/QDBusArgument>
+
+class AppInfo
+{
+ Q_GADGET
+ Q_PROPERTY(QString id READ id)
+ Q_PROPERTY(QString version READ version)
+ Q_PROPERTY(int width READ width)
+ Q_PROPERTY(int height READ height)
+ Q_PROPERTY(QString name READ name)
+ Q_PROPERTY(QString description READ description)
+ Q_PROPERTY(QString shortname READ shortname)
+ Q_PROPERTY(QString author READ author)
+ Q_PROPERTY(QString iconPath READ iconPath)
+public:
+ AppInfo();
+ AppInfo(const AppInfo &other);
+ virtual ~AppInfo();
+ AppInfo &operator =(const AppInfo &other);
+ void swap(AppInfo &other) { qSwap(d, other.d); }
+
+ QString id() const;
+ QString version() const;
+ int width() const;
+ int height() const;
+ QString name() const;
+ QString description() const;
+ QString shortname() const;
+ QString author() const;
+ QString iconPath() const;
+
+ void read(const QJsonObject &json);
+
+ friend QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo);
+ friend const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo);
+
+private:
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+Q_DECLARE_SHARED(AppInfo)
+Q_DECLARE_METATYPE(AppInfo)
+Q_DECLARE_METATYPE(QList<AppInfo>)
+
+#endif // APPFRAMEWORK_HPP
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
+
--- /dev/null
+/*
+ * 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
+
--- /dev/null
+/*
+ * 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
+
--- /dev/null
+/*
+ * 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
+
--- /dev/null
+/*
+ * 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 STATUSBAR_H
+#define STATUSBAR_H
+
+
+
+#endif // STATUSBAR_H
--- /dev/null
+/*
+ * 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 <QtDBus>
+
+#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<LayoutArea> &surfaceAreas);
+ virtual ~Layout();
+
+ int id;
+ QString name;
+ QList<LayoutArea> 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<SimplePoint>)
+
+Q_DECLARE_METATYPE(LayoutArea)
+Q_DECLARE_METATYPE(QList<LayoutArea>)
+
+Q_DECLARE_METATYPE(Layout)
+Q_DECLARE_METATYPE(QList<Layout>)
+
+#endif // WINDOWMANAGER_H
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+ <interface name="org.agl.inputevent">
+ <method name="hardKeyPressed">
+ <arg name="key" type="i" direction="in"/>
+ </method>
+ </interface>
+</node>
+
--- /dev/null
+# 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.
+
+INCLUDEPATH += $$PWD $$OUT_PWD/../interfaces/
+
+LIBS += -L$$OUT_PWD/../interfaces/ -linterfaces
--- /dev/null
+# 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 = lib
+TARGET = interfaces
+QT = dbus
+CONFIG += staticlib
+
+HEADERS += \
+ include/appframework.hpp \
+ include/windowmanager.hpp
+
+SOURCES += src/appframework.cpp \
+ src/windowmanager.cpp
+
+XMLSOURCES = \
+ appframework.xml \
+ daynightmode.xml \
+ homescreen.xml \
+ inputevent.xml \
+ popup.xml \
+ proximity.xml \
+ statusbar.xml \
+ windowmanager.xml
+
+gen_adaptor_cpp.input = XMLSOURCES
+gen_adaptor_cpp.commands = \
+ qdbusxml2cpp -i include/${QMAKE_FILE_IN_BASE}.hpp -m -a ${QMAKE_FILE_IN_BASE}_adaptor ${QMAKE_FILE_IN}; \
+ moc $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adaptor.h -o $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adaptor.moc
+gen_adaptor_cpp.output = ${QMAKE_FILE_IN_BASE}_adaptor.cpp
+gen_adaptor_cpp.variable_out = SOURCES
+gen_adaptor_cpp.clean = ${QMAKE_FILE_IN_BASE}_adaptor.cpp
+
+gen_proxy_cpp.input = XMLSOURCES
+gen_proxy_cpp.commands = \
+ qdbusxml2cpp -i include/${QMAKE_FILE_IN_BASE}.hpp -m -p ${QMAKE_FILE_IN_BASE}_proxy ${QMAKE_FILE_IN}; \
+ moc $$OUT_PWD/${QMAKE_FILE_IN_BASE}_proxy.h -o $$OUT_PWD/${QMAKE_FILE_IN_BASE}_proxy.moc
+gen_proxy_cpp.output = ${QMAKE_FILE_IN_BASE}_proxy.cpp
+gen_proxy_cpp.variable_out = SOURCES
+gen_proxy_cpp.clean = ${QMAKE_FILE_IN_BASE}_proxy.cpp
+
+gen_adaptor_h.input = XMLSOURCES
+gen_adaptor_h.commands = @echo Fake making the header for ${QMAKE_FILE_IN}
+gen_adaptor_h.depends = ${QMAKE_FILE_IN_BASE}_adaptor.cpp
+gen_adaptor_h.output = ${QMAKE_FILE_IN_BASE}_adaptor.h
+gen_adaptor_h.clean = ${QMAKE_FILE_IN_BASE}_adaptor.h
+
+gen_proxy_h.input = XMLSOURCES
+gen_proxy_h.commands = @echo Fake making the header for ${QMAKE_FILE_IN}
+gen_proxy_h.depends = ${QMAKE_FILE_IN_BASE}_proxy.cpp
+gen_proxy_h.output = ${QMAKE_FILE_IN_BASE}_proxy.h
+gen_proxy_h.clean = ${QMAKE_FILE_IN_BASE}_proxy.h
+
+QMAKE_EXTRA_COMPILERS += gen_adaptor_cpp gen_proxy_cpp gen_adaptor_h gen_proxy_h
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+ <interface name="org.agl.popup">
+ <method name="showPopup">
+ <arg name="type" type="i" direction="in"/>
+ <arg name="text" type="s" direction="in"/>
+ </method>
+ <method name="showPopupComboBox">
+ <arg name="text" type="s" direction="in"/>
+ <arg name="choices" type="as" direction="in"/>
+ </method>
+ </interface>
+</node>
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+ <interface name="org.agl.proximity">
+ <method name="setObjectDetected">
+ <arg name="detected" type="b" direction="in"/>
+ </method>
+ </interface>
+</node>
--- /dev/null
+/*
+ * 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/appframework.hpp"
+
+#include <QtCore/QJsonObject>
+
+class AppInfo::Private : public QSharedData
+{
+public:
+ Private();
+ Private(const Private &other);
+
+ QString id;
+ QString version;
+ int width;
+ int height;
+ QString name;
+ QString description;
+ QString shortname;
+ QString author;
+ QString iconPath;
+};
+
+AppInfo::Private::Private()
+ : width(-1)
+ , height(-1)
+{
+}
+
+AppInfo::Private::Private(const Private &other)
+ : QSharedData(other)
+ , id(other.id)
+ , version(other.version)
+ , width(other.width)
+ , height(other.height)
+ , name(other.name)
+ , description(other.description)
+ , shortname(other.shortname)
+ , author(other.author)
+ , iconPath(other.iconPath)
+{
+}
+
+AppInfo::AppInfo()
+ : d(new Private)
+{
+}
+
+AppInfo::AppInfo(const 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;
+}
--- /dev/null
+/*
+ * 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<LayoutArea> &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;
+}
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+ <interface name="org.agl.statusbar">
+ <method name="getAvailablePlaceholders">
+ <arg name="placeholderIndexes" type="ai" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/>
+ </method>
+ <method name="getStatusText">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="text" type="s" direction="out"/>
+ </method>
+ <method name="getStatusIcon">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="iconURI" type="s" direction="out"/>
+ </method>
+ <method name="setStatusText">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="text" type="s" direction="in"/>
+ </method>
+ <method name="setStatusIcon">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="iconURI" type="s" direction="in"/>
+ </method>
+ </interface>
+</node>
--- /dev/null
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+ <!--
+ org.agl.windowmanager:
+ @short_description: A Layout-based interface for the WindowManager.
+
+ A Layout defines a list of surfaces areas.
+ -->
+ <interface name="org.agl.windowmanager">
+ <!--
+ addLayout:
+ @layoutId: A unique ID that represents this layout. If the ID is already in use WINDOWMANAGER_ERROR_ID_ALREADY_DEFINED will be returned.
+ @layoutName: A user readable string for the layout. If the string is already in use WINDOWMANAGER_ERROR_NAME_ALREADY_DEFINED will be returned.
+ @surfaceAreas: A list of surface areas.
+ @error: WINDOWMANAGER_NO_ERROR or the first error that occurred.
+
+ Add a layout definition to the WindowManayer layout database.
+ The layout database is temoprary and not stored persistently. It has to be recreated by the client after
+ a WindowManager restart.
+ -->
+ <method name="addLayout">
+ <arg name="layoutId" type="i" direction="in"/>
+ <arg name="layoutName" type="s" direction="in"/>
+ <arg name="surfaceAreas" type="a(iiii)" direction="in"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QList<LayoutArea>"/>
+ <arg name="error" type="i" direction="out"/>
+ </method>
+
+ <!--
+ deleteLayoutById:
+ @layoutId: The ID of the layout to delete.
+ @error: WINDOWMANAGER_NO_ERROR or the first error that occurred.
+
+ Deletes the layout with the given ID. This cannot be the current active layout!
+ -->
+ <method name="deleteLayoutById">
+ <arg name="layoutId" type="i" direction="in"/>
+ <arg name="error" type="i" direction="out"/>
+ </method>
+
+ <!--
+ setLayoutById:
+ @layoutId: The ID of the layout to activate.
+ @error: WINDOWMANAGER_NO_ERROR or the first error that occurred.
+
+ Switch to the layout with the given ID.
+ -->
+ <method name="setLayoutById">
+ <arg name="layoutId" type="i" direction="in"/>
+ <arg name="error" type="i" direction="out"/>
+ </method>
+ <!--
+ setLayoutByName:
+ @layoutName: The name of the layout to activate.
+ @error: WINDOWMANAGER_NO_ERROR or the first error that occurred.
+
+ Switch to the layout with the given name.
+ -->
+ <method name="setLayoutByName">
+ <arg name="layoutName" type="s" direction="in"/>
+ <arg name="error" type="i" direction="out"/>
+ </method>
+
+ <!--
+ getLayoutName:
+ @layoutId: The ID of the requested layout name.
+ @layoutName: The name of the layout with the given ID.
+
+ Request the name of the layout with the given ID. This does not set or activate a layout.
+ It is just returning the name of the given layout.
+ -->
+ <method name="getLayoutName">
+ <arg name="layoutId" type="i" direction="in"/>
+ <arg name="layoutName" type="s" direction="out"/>
+ </method>
+
+ <!--
+ layout:
+ The current active layout with all its information.
+ -->
+ <property>
+ <arg name="layout" type="(isa(iiii))" access="read"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="Layout"/>
+ </property>
+ <!--
+ layoutId:
+ The current active layout id. This property is redundant, since its info is already available
+ in the property layout. But this property is more lightweight.
+ -->
+ <property name="layoutId" type="i" access="read"/>
+ <!--
+ layoutName:
+ The name of the current active layout. This property is redundant, since its info is already available
+ in the property layout. But this property is more lightweight.
+ -->
+ <property name="layoutName" type="s" access="read"/>
+
+ <!--
+ getAllLayouts:
+ @layouts: A list of all layouts.
+
+ Returns a list of all layouts that were added to the WindowManager.
+ -->
+ <method name="getAllLayouts">
+ <arg name="layoutIds" type="a(isa(iiii))" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<Layout>"/>
+ </method>
+
+ <!--
+ getAvailableLayouts:
+ @numberOfAppSurfaces: The ID of the requested layout name.
+ @layoutIds: A list of layouts that offer the exact requested ammount of surface render areas.
+
+ Returns a list of layouts that offer the exact requested ammount of surface render areas.
+ If the list is empty, no layout fits the exact ammount.
+ -->
+
+ <method name="getAvailableLayouts">
+ <arg name="numberOfAppSurfaces" type="i" direction="in"/>
+ <arg name="layoutIds" type="ai" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/>
+ </method>
+
+ <!--
+ setSurfaceToLayoutArea:
+ @surfaceId: The ID of the surface that shall be positioned.
+ @layoutAreaId: The ID of the layout area where the surface shall be rendered.
+ @error: WINDOWMANAGER_NO_ERROR or the first error that occurred.
+
+ The surface will be scaled to the size of the layout area.
+ The surface will be made visible with this call.
+ -->
+ <method name="setSurfaceToLayoutArea">
+ <arg name="surfaceId" type="i" direction="in"/>
+ <arg name="layoutAreaId" type="i" direction="in"/>
+ <arg name="error" type="i" direction="out"/>
+ </method>
+
+ <!--
+ getAvailableSurfaces:
+ @surfaceIds: A list of all known surfaceIds except for the surfaces created by the Home Screen app.
+
+ If no surfaces are available, the returned list is empty.
+ -->
+ <method name="getAvailableSurfaces">
+ <arg name="surfaceIds" type="a(i)" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/>
+ </method>
+
+ <!--
+ surfaceVisibilityChanged:
+ @surfaceId: The surface that changed.
+ @visible: True, if the surface is visible.
+
+ This is emitted when the visible property of the surfaces changes.
+ -->
+ <signal name="surfaceVisibilityChanged">
+ <arg name="surfaceId" type="i"/>
+ <arg name="visible" type="b"/>
+ </signal>
+
+ <!--
+ showLayer:
+ @layer: The ID of the layer to show. POPUP=0, HOMESCREEN_OVERLAY=1, APPS=2, HOMESCREEN=3
+ @pid: The PID of the app to show. (used only when layer is APPS=2)
+
+ Show complete layers.
+ By default, all layers are shown.
+ -->
+ <method name="showLayer">
+ <arg name="layer" type="i" direction="in"/>
+ <arg name="pid" type="i" direction="in"/>
+ </method>
+ <!--
+ showAppLayer:
+ @pid: The PID of the app to show.
+
+ Show layer for application .
+ -->
+ <method name="showAppLayer">
+ <arg name="pid" type="i" direction="in"/>
+ </method>
+ <!--
+ hideLayer:
+ @layer: The ID of the layer to hide. POPUP=0, HOMESCREEN_OVERLAY=1, APPS=2, HOMESCREEN=3
+
+ Hide complete layers.
+ By default, all layers are shown.
+ -->
+ <method name="hideLayer">
+ <arg name="layer" type="i" direction="in"/>
+ </method>
+ </interface>
+</node>
+
--- /dev/null
+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
--- /dev/null
+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
+
--- /dev/null
+# 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
--- /dev/null
+#include <QCoreApplication>
+#include <QCommandLineParser>
+#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();
+}
--- /dev/null
+#include "timedateprovider.hpp"
+#include <QTimerEvent>
+
+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<int> 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);
+ }
+ }
+}
--- /dev/null
+#ifndef TIMEDATEPROVIDER_HPP
+#define TIMEDATEPROVIDER_HPP
+
+#include <QObject>
+#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
--- /dev/null
+Command line tests
+
+Precondition for all test is, that the D-Bus session is launched:
+$export `dbus-launch`
+
+---------------------------------------------------------------------------------------------------------------------
+Interface:
+org.agl.daynightmode
+
+Signal:
+ <signal name="dayNightMode">
+ <arg name="mode" type="i" direction="out"/>
+ </signal>
+
+Preconditions:
+- HomeScreen app is running
+
+Test:
+no command line test available right now
+
+---------------------------------------------------------------------------------------------------------------------
+Interface:
+org.agl.homescreen
+
+Method:
+ <method name="hardKeyPressed">
+ <arg name="key" type="i" direction="in"/> <!-- using the inputevent.hpp InputEvent::HardKey type -->
+ </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:
+ <method name="setToFullscreen">
+ <arg name="pid" type="i" direction="in"/>
+ </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:
+ <method name="showPopup">
+ <arg name="type" type="i" direction="in"/>
+ <arg name="text" type="s" direction="in"/>
+ </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:
+ <method name="showPopupComboBox">
+ <arg name="text" type="s" direction="in"/>
+ <arg name="choices" type="as" direction="in"/>
+ </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:
+ <method name="setObjectDetected">
+ <arg name="detected" type="b" direction="in"/>
+ </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:
+ <method name="getAvailablePlaceholders">
+ <arg name="placeholderIndexes" type="ai" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/>
+ </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:
+ <method name="getStatusText">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="text" type="s" direction="out"/>
+ </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:
+ <method name="getStatusIcon">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="iconURI" type="s" direction="out"/>
+ </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:
+ <method name="setStatusText">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="text" type="s" direction="in"/>
+ </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:
+ <method name="setStatusIcon">
+ <arg name="placeholderIndex" type="i" direction="in"/>
+ <arg name="iconURI" type="s" direction="in"/>
+ </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:"<path to png file here>"
+
+