From 26e3a508eb0bec7a59dbcef0251233df42781963 Mon Sep 17 00:00:00 2001 From: tiansen Date: Fri, 2 Nov 2018 20:40:38 +0800 Subject: vertical --- README.md | 6 +- homescreen/homescreen.pro | 6 +- homescreen/qml/MediaAreaBlank.qml | 2 +- homescreen/qml/ShortcutArea.qml | 15 ++- homescreen/qml/ShortcutIcon.qml | 2 +- homescreen/qml/StatusArea.qml | 34 +++--- homescreen/qml/TopArea.qml | 2 +- .../images/AGL_HMI_Blue_Background_NoCar-01.png | Bin 949053 -> 951359 bytes homescreen/qml/images/AGL_HMI_Full_Background.png | Bin 0 -> 8306 bytes .../qml/images/AGL_HMI_Normal_Background.png | Bin 0 -> 10012 bytes homescreen/qml/images/Shortcut/shortcut.qrc | 2 + homescreen/qml/images/Shortcut/video.svg | 109 ++++++++++++++++++ homescreen/qml/images/Shortcut/video_active.svg | 126 +++++++++++++++++++++ .../qml/images/TopSection_NoText_NoIcons-01.png | Bin 0 -> 2097 bytes .../qml/images/TopSection_NoText_NoIcons-01.svg | 55 --------- .../qml/images/Utility_Logo_Background-01.png | Bin 0 -> 1150 bytes .../qml/images/Utility_Logo_Background-01.svg | 53 --------- homescreen/qml/images/fullscreen.png | Bin 0 -> 1230 bytes homescreen/qml/images/images.qrc | 8 +- homescreen/qml/images/normal.png | Bin 0 -> 1157 bytes homescreen/qml/main.qml | 93 ++++++++++++++- homescreen/src/homescreenhandler.cpp | 30 ++++- homescreen/src/homescreenhandler.h | 10 +- homescreen/src/main.cpp | 32 ++++-- homescreen/src/mastervolume.cpp | 2 +- homescreen/src/mastervolume.h | 4 +- homescreen/src/statusbarmodel.cpp | 11 +- homescreen/src/toucharea.cpp | 36 ++++++ homescreen/src/toucharea.h | 30 +++++ 29 files changed, 506 insertions(+), 162 deletions(-) create mode 100644 homescreen/qml/images/AGL_HMI_Full_Background.png create mode 100644 homescreen/qml/images/AGL_HMI_Normal_Background.png create mode 100644 homescreen/qml/images/Shortcut/video.svg create mode 100644 homescreen/qml/images/Shortcut/video_active.svg create mode 100644 homescreen/qml/images/TopSection_NoText_NoIcons-01.png delete mode 100644 homescreen/qml/images/TopSection_NoText_NoIcons-01.svg create mode 100644 homescreen/qml/images/Utility_Logo_Background-01.png delete mode 100644 homescreen/qml/images/Utility_Logo_Background-01.svg create mode 100644 homescreen/qml/images/fullscreen.png create mode 100644 homescreen/qml/images/normal.png create mode 100644 homescreen/src/toucharea.cpp create mode 100644 homescreen/src/toucharea.h diff --git a/README.md b/README.md index 2c04a91..610164d 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,14 @@ $ git clone git clone https://gerrit.automotivelinux.org/gerrit/staging/meta-hmi Then you can get the following recipe. -* `meta-agl-demo/recipes-demo-hmi/homescreen` +* `meta-hmi-framework/homescreen-2017` **Bitbake** ``` $ source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo agl-devel agl-appfw-smack agl-hmi-framework -$ bitbake homescreen +$ bitbake homescreen-2017 ``` Instructions for building HomeScreen app @@ -54,5 +54,5 @@ Launch HomeScreen App: Usage: ``` -afm-util start homescreen +afm-util start homescreen-2017 ``` diff --git a/homescreen/homescreen.pro b/homescreen/homescreen.pro index 0e5bb58..9c36660 100644 --- a/homescreen/homescreen.pro +++ b/homescreen/homescreen.pro @@ -30,14 +30,16 @@ SOURCES += \ src/statusbarserver.cpp \ src/applicationlauncher.cpp \ src/mastervolume.cpp \ - src/homescreenhandler.cpp + src/homescreenhandler.cpp \ + src/toucharea.cpp HEADERS += \ src/statusbarmodel.h \ src/statusbarserver.h \ src/applicationlauncher.h \ src/mastervolume.h \ - src/homescreenhandler.h + src/homescreenhandler.h \ + src/toucharea.h OTHER_FILES += \ README.md diff --git a/homescreen/qml/MediaAreaBlank.qml b/homescreen/qml/MediaAreaBlank.qml index c3a5f89..2b888c8 100644 --- a/homescreen/qml/MediaAreaBlank.qml +++ b/homescreen/qml/MediaAreaBlank.qml @@ -24,7 +24,7 @@ import MasterVolume 1.0 Image { width: 1080 height: 215 - source: './images/Utility_Logo_Background-01.svg' + source: './images/Utility_Logo_Background-01.png' property bool displayVolume: false; MouseArea { diff --git a/homescreen/qml/ShortcutArea.qml b/homescreen/qml/ShortcutArea.qml index e0c9182..a2d98c8 100644 --- a/homescreen/qml/ShortcutArea.qml +++ b/homescreen/qml/ShortcutArea.qml @@ -24,6 +24,13 @@ Item { width: 785 height: 218 + Timer { + id:notificationTimer + interval: 3000 + running: false + repeat: true + onTriggered: notificationItem.visible = false + } ListModel { id: applicationModel @@ -36,11 +43,11 @@ Item { application: 'mediaplayer@0.1' } ListElement { - name: 'HVAC' - application: 'hvac@0.1' + name: 'Video' + application: 'video@0.1' } ListElement { - name: 'Navigation' + name: 'navigation' application: 'navigation@0.1' } } @@ -66,7 +73,7 @@ Item { console.warn(model.application) console.warn("app cannot be launched!") } - homescreenHandler.tapShortcut(model.name) + homescreenHandler.tapShortcut(model.name, false) } } } diff --git a/homescreen/qml/ShortcutIcon.qml b/homescreen/qml/ShortcutIcon.qml index 1100a7c..8dfee26 100644 --- a/homescreen/qml/ShortcutIcon.qml +++ b/homescreen/qml/ShortcutIcon.qml @@ -32,7 +32,7 @@ MouseArea { Image { id: inactiveIcon anchors.fill: parent - source: './images/Shortcut/%1.svg'.arg(root.name.toLowerCase()) + source: './images/Shortcut/%1.svg'.arg(root.name.toLowerCase()) } Image { id: activeIcon diff --git a/homescreen/qml/StatusArea.qml b/homescreen/qml/StatusArea.qml index 3f2b280..fb37ca0 100644 --- a/homescreen/qml/StatusArea.qml +++ b/homescreen/qml/StatusArea.qml @@ -1,7 +1,6 @@ /* * Copyright (C) 2016 The Qt Company Ltd. * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH - * Copyright (c) 2017, 2018 TOYOTA MOTOR CORPORATION * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,38 +116,36 @@ Item { Layout.fillHeight: true Layout.preferredWidth: 76 spacing: -10 - + Rectangle { + Layout.preferredWidth: 77 + Layout.preferredHeight: 55 + opacity: 0 + } Image { id: bt_icon Layout.preferredWidth: 77 - Layout.preferredHeight: 73 + Layout.preferredHeight: 55 source: connStatus ? './images/Status/HMI_Status_Bluetooth_On-01.png' : './images/Status/HMI_Status_Bluetooth_Inactive-01.png' fillMode: Image.PreserveAspectFit property string deviceName: "none" property bool connStatus: false Connections { target: bluetooth - - //{"event":"Bluetooth-Manager\/connection","data":{"Status":"connected","Address":"88:BD:45:EC:3A:E6"},"jtype":"afb-event"} - //{"event":"Bluetooth-Manager\/connection","data":{"Status":"disconnected","Address":"88:BD:45:EC:3A:E6"},"jtype":"afb-event"} onConnectionEvent: { - // console.log("bluetooth connection is:", data.Status) - // console.log("onConnectionEvent bt_icon.deviceName:",bt_icon.deviceName, "bt_icon.connStatus:", bt_icon.connStatus) - if (data.Status == "connected"){ + console.log("onConnectionEvent", data.Status) + if (data.Status === "connected") { bt_icon.connStatus = true - } else if (data.Status == "disconnected"){ + } else if (data.Status === "disconnected") { bt_icon.connStatus = false } } - //{"event":"Bluetooth-Manager\/device_updated","data":{"Address":"88:BD:45:EC:3A:E6","Name":"SG02","Paired":"True","Connected":"True","AVPConnected":"True","Metadata":{"Title":"","Artist":"","Status":"stop} - onDeviceUpdatedEvent: { - // console.log("bluetooth onDeviceUpdatedEvent date is:", data.Name, "Paired: ", data.Paired, "Connected: ", data.Connected) - // console.log("onDeviceUpdatedEvent bt_icon.deviceName:",bt_icon.deviceName, "bt_icon.connStatus:", bt_icon.connStatus) - if ( data.Paired == "True" && data.Connected == "True" ){ - bt_icon.deviceName = data.Name + onDeviceUpdateEvent: { + console.log("onConnectionEvent", data.Paired) + if (data.Paired === "True" && data.Connected === "True") { + bt_icon.deviceName = data.name bt_icon.connStatus = true } else { - if(bt_icon.deviceName == data.Name) + if(bt_icon.deviceName === data.Name) { bt_icon.connStatus = false } @@ -156,11 +153,12 @@ Item { } } } + Repeater { model: StatusBarModel { objectName: "statusBar" } delegate: Image { Layout.preferredWidth: 77 - Layout.preferredHeight: 73 + Layout.preferredHeight: 55 source: model.modelData fillMode: Image.PreserveAspectFit } diff --git a/homescreen/qml/TopArea.qml b/homescreen/qml/TopArea.qml index 2a75cf8..9cff3ed 100644 --- a/homescreen/qml/TopArea.qml +++ b/homescreen/qml/TopArea.qml @@ -22,7 +22,7 @@ import QtQuick.Controls 2.0 Image { width: 1920 height: 218 - source: './images/TopSection_NoText_NoIcons-01.svg' + source: './images/TopSection_NoText_NoIcons-01.png' fillMode: Image.PreserveAspectCrop RowLayout { diff --git a/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png b/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png index 357c204..a4e026c 100644 Binary files a/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png and b/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png differ diff --git a/homescreen/qml/images/AGL_HMI_Full_Background.png b/homescreen/qml/images/AGL_HMI_Full_Background.png new file mode 100644 index 0000000..8b11e20 Binary files /dev/null and b/homescreen/qml/images/AGL_HMI_Full_Background.png differ diff --git a/homescreen/qml/images/AGL_HMI_Normal_Background.png b/homescreen/qml/images/AGL_HMI_Normal_Background.png new file mode 100644 index 0000000..c686067 Binary files /dev/null and b/homescreen/qml/images/AGL_HMI_Normal_Background.png differ diff --git a/homescreen/qml/images/Shortcut/shortcut.qrc b/homescreen/qml/images/Shortcut/shortcut.qrc index 5d67341..f5b3bca 100644 --- a/homescreen/qml/images/Shortcut/shortcut.qrc +++ b/homescreen/qml/images/Shortcut/shortcut.qrc @@ -8,5 +8,7 @@ mediaplayer_active.svg navigation.svg navigation_active.svg + video.svg + video_active.svg diff --git a/homescreen/qml/images/Shortcut/video.svg b/homescreen/qml/images/Shortcut/video.svg new file mode 100644 index 0000000..e368922 --- /dev/null +++ b/homescreen/qml/images/Shortcut/video.svg @@ -0,0 +1,109 @@ + + + + + + image/svg+xml + + + + + + + diff --git a/homescreen/qml/images/Shortcut/video_active.svg b/homescreen/qml/images/Shortcut/video_active.svg new file mode 100644 index 0000000..344385f --- /dev/null +++ b/homescreen/qml/images/Shortcut/video_active.svg @@ -0,0 +1,126 @@ + + + + + + image/svg+xml + + + + + + + diff --git a/homescreen/qml/images/TopSection_NoText_NoIcons-01.png b/homescreen/qml/images/TopSection_NoText_NoIcons-01.png new file mode 100644 index 0000000..cf9ec4e Binary files /dev/null and b/homescreen/qml/images/TopSection_NoText_NoIcons-01.png differ diff --git a/homescreen/qml/images/TopSection_NoText_NoIcons-01.svg b/homescreen/qml/images/TopSection_NoText_NoIcons-01.svg deleted file mode 100644 index 6841001..0000000 --- a/homescreen/qml/images/TopSection_NoText_NoIcons-01.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/homescreen/qml/images/Utility_Logo_Background-01.png b/homescreen/qml/images/Utility_Logo_Background-01.png new file mode 100644 index 0000000..21a602d Binary files /dev/null and b/homescreen/qml/images/Utility_Logo_Background-01.png differ diff --git a/homescreen/qml/images/Utility_Logo_Background-01.svg b/homescreen/qml/images/Utility_Logo_Background-01.svg deleted file mode 100644 index c289805..0000000 --- a/homescreen/qml/images/Utility_Logo_Background-01.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/homescreen/qml/images/fullscreen.png b/homescreen/qml/images/fullscreen.png new file mode 100644 index 0000000..3bb9ef0 Binary files /dev/null and b/homescreen/qml/images/fullscreen.png differ diff --git a/homescreen/qml/images/images.qrc b/homescreen/qml/images/images.qrc index 37ad676..593167c 100644 --- a/homescreen/qml/images/images.qrc +++ b/homescreen/qml/images/images.qrc @@ -1,10 +1,14 @@ - TopSection_NoText_NoIcons-01.svg - Utility_Logo_Background-01.svg + TopSection_NoText_NoIcons-01.png + Utility_Logo_Background-01.png Utility_Logo_Grey-01.svg Utility_Music_Background-01.png Utility_Radio_Background-01.png AGL_HMI_Blue_Background_NoCar-01.png + AGL_HMI_Full_Background.png + AGL_HMI_Normal_Background.png + fullscreen.png + normal.png diff --git a/homescreen/qml/images/normal.png b/homescreen/qml/images/normal.png new file mode 100644 index 0000000..34a9c65 Binary files /dev/null and b/homescreen/qml/images/normal.png differ diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 96a1950..c218057 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -26,13 +26,14 @@ Window { width: container.width * container.scale height: container.height * container.scale title: 'HomeScreen' + color: "#00000000" Image { id: container anchors.centerIn: parent width: 1080 height: 1920 - scale: screenInfo.scale_factor() + scale: 1.0 source: './images/AGL_HMI_Blue_Background_NoCar-01.png' ColumnLayout { @@ -60,5 +61,95 @@ Window { Layout.preferredHeight: 215 } } + + states: [ + State { + name: "normal" + PropertyChanges { + target: topArea + y: 0 + } + PropertyChanges { + target: applicationArea + y: 218 + } + PropertyChanges { + target: mediaArea + y: 1705 + } + }, + State { + name: "fullscreen" + PropertyChanges { + target: topArea + y: -220 + } + PropertyChanges { + target: applicationArea + y: -1490 + } + PropertyChanges { + target: mediaArea + y: 2135 + } + } + ] + transitions: Transition { + NumberAnimation { + target: topArea + property: "y" + easing.type: "OutQuad" + duration: 250 + } + NumberAnimation { + target: mediaArea + property: "y" + easing.type: "OutQuad" + duration: 250 + } + } + + } + Item { + id: switchBtn + anchors.right: parent.right + anchors.rightMargin: 20 + anchors.top: parent.top + anchors.topMargin: 25 + width: 35 + height: 35 + z: 1 + + MouseArea { + anchors.fill: parent + property string btnState: 'normal' + Image { + id: image + anchors.fill: parent + source: './images/normal.png' + } + onClicked: { + var appName = homescreenHandler.getCurrentApplication() + if (btnState === 'normal') { + image.source = './images/fullscreen.png' + btnState = 'fullscreen' + container.state = 'fullscreen' + touchArea.switchArea(1) + homescreenHandler.tapShortcut(appName, true) + if (appName === 'navigation' || appName === 'browser') { + container.opacity = 0.0 + } + } else { + image.source = './images/normal.png' + btnState = 'normal' + container.state = 'normal' + touchArea.switchArea(0) + homescreenHandler.tapShortcut(appName, false) + if (appName === 'navigation' || appName === 'browser') { + container.opacity = 1.0 + } + } + } + } } } diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp index 5da8b9e..ac50451 100644 --- a/homescreen/src/homescreenhandler.cpp +++ b/homescreen/src/homescreenhandler.cpp @@ -22,7 +22,8 @@ void* HomescreenHandler::myThis = 0; HomescreenHandler::HomescreenHandler(QObject *parent) : QObject(parent), - mp_hs(NULL) + mp_hs(NULL), + current_applciation("launcher") { } @@ -48,13 +49,34 @@ void HomescreenHandler::init(int port, const char *token) json_object_object_get(object, "display_message")); HMI_DEBUG("HomeScreen","set_event_handler Event_OnScreenMessage display_message = %s", display_message); }); +} +void HomescreenHandler::tapShortcut(QString application_name, bool is_full) +{ + HMI_DEBUG("HomeScreen","tapShortcut %s", application_name.toStdString().c_str()); + struct json_object* j_json = json_object_new_object(); + struct json_object* value; + if(is_full) { + value = json_object_new_string("fullscreen"); + HMI_DEBUG("HomeScreen","tapShortcut fullscreen"); + } else { + value = json_object_new_string("normal"); + HMI_DEBUG("HomeScreen","tapShortcut normal"); + } + json_object_object_add(j_json, "area", value); + mp_hs->showWindow(application_name.toStdString().c_str(), j_json); } -void HomescreenHandler::tapShortcut(QString application_name) +void HomescreenHandler::setCurrentApplication(QString application_name) { - HMI_DEBUG("HomeScreen","tapShortcut %s", application_name.toStdString().c_str()); - mp_hs->tapShortcut(application_name.toStdString().c_str()); + HMI_DEBUG("HomeScreen","setCurrentApplication %s", application_name.toStdString().c_str()); + current_applciation = application_name; +} + +QString HomescreenHandler::getCurrentApplication() +{ + HMI_DEBUG("HomeScreen","getCurrentApplication %s", current_applciation.toStdString().c_str()); + return current_applciation; } void HomescreenHandler::onRep_static(struct json_object* reply_contents) diff --git a/homescreen/src/homescreenhandler.h b/homescreen/src/homescreenhandler.h index c18d7a0..539d380 100644 --- a/homescreen/src/homescreenhandler.h +++ b/homescreen/src/homescreenhandler.h @@ -32,7 +32,9 @@ public: void init(int port, const char* token); - Q_INVOKABLE void tapShortcut(QString application_name); + Q_INVOKABLE void tapShortcut(QString application_name, bool is_full); + Q_INVOKABLE QString getCurrentApplication(); + void setCurrentApplication(QString application_name); void onRep(struct json_object* reply_contents); void onEv(const string& event, struct json_object* event_contents); @@ -40,8 +42,14 @@ public: static void* myThis; static void onRep_static(struct json_object* reply_contents); static void onEv_static(const string& event, struct json_object* event_contents); + +signals: + void notification(QString id, QString icon, QString text); + void information(QString text); + private: LibHomeScreen *mp_hs; + QString current_applciation; }; #endif // HOMESCREENHANDLER_H diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 620c869..ff30e15 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH - * Copyright (c) 2017, 2018 TOYOTA MOTOR CORPORATION + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,7 @@ #include "mastervolume.h" #include "homescreenhandler.h" #include "hmi-debug.h" +#include "toucharea.h" // XXX: We want this DBus connection to be shared across the different // QML objects, is there another way to do this, a nice way, perhaps? @@ -75,7 +77,7 @@ int main(int argc, char *argv[]) parser.addVersionOption(); parser.process(a); QStringList positionalArguments = parser.positionalArguments(); - + int port = 1700; QString token = "wm"; @@ -93,12 +95,11 @@ int main(int argc, char *argv[]) ApplicationLauncher *launcher = new ApplicationLauncher(); QLibWindowmanager* layoutHandler = new QLibWindowmanager(); + HomescreenHandler* homescreenHandler = new HomescreenHandler(); if(layoutHandler->init(port,token) != 0){ exit(EXIT_FAILURE); } - AGLScreenInfo screenInfo(layoutHandler->get_scale_factor()); - if (layoutHandler->requestSurface(QString("HomeScreen")) != 0) { exit(EXIT_FAILURE); } @@ -107,19 +108,18 @@ int main(int argc, char *argv[]) layoutHandler->endDraw(QString("HomeScreen")); }); - layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher](json_object *object) { + layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher, homescreenHandler](json_object *object) { json_object *jarray = json_object_object_get(object, "ids"); int arrLen = json_object_array_length(jarray); for( int idx = 0; idx < arrLen; idx++) { QString label = QString(json_object_get_string( json_object_array_get_idx(jarray, idx) )); - HMI_DEBUG("HomeScreen","Event_ScreenUpdated application: %s.", label.toStdString().c_str()); + HMI_DEBUG("HomeScreen","Event_ScreenUpdated application11: %s.", label.toStdString().c_str()); + homescreenHandler->setCurrentApplication(label); QMetaObject::invokeMethod(launcher, "setCurrent", Qt::QueuedConnection, Q_ARG(QString, label)); } }); - HomescreenHandler* homescreenHandler = new HomescreenHandler(); - homescreenHandler->init(port, token.toStdString().c_str()); QUrl bindingAddress; bindingAddress.setScheme(QStringLiteral("ws")); @@ -131,23 +131,35 @@ int main(int argc, char *argv[]) query.addQueryItem(QStringLiteral("token"), token); bindingAddress.setQuery(query); + TouchArea* touchArea = new TouchArea(); + // mail.qml loading QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("layoutHandler", layoutHandler); engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler); + engine.rootContext()->setContextProperty("touchArea", touchArea); engine.rootContext()->setContextProperty("launcher", launcher); engine.rootContext()->setContextProperty("weather", new Weather(bindingAddress)); engine.rootContext()->setContextProperty("bluetooth", new Bluetooth(bindingAddress)); - engine.rootContext()->setContextProperty("screenInfo", &screenInfo); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); QObject *root = engine.rootObjects().first(); QQuickWindow *window = qobject_cast(root); - QObject::connect(window, SIGNAL(frameSwapped()), layoutHandler, SLOT(slotActivateSurface())); + + touchArea->setWindow(window); + QThread* thread = new QThread; + touchArea->moveToThread(thread); + QObject::connect(thread, &QThread::started, touchArea, &TouchArea::init); + + thread->start(); QList sobjs = engine.rootObjects(); StatusBarModel *statusBar = sobjs.first()->findChild("statusBar"); statusBar->init(bindingAddress, engine.rootContext()); + QObject::connect(window, SIGNAL(frameSwapped()), layoutHandler, SLOT(slotActivateSurface())); + + homescreenHandler->init(port, token.toStdString().c_str()); + return a.exec(); } diff --git a/homescreen/src/mastervolume.cpp b/homescreen/src/mastervolume.cpp index 9fb92a9..5e1e450 100644 --- a/homescreen/src/mastervolume.cpp +++ b/homescreen/src/mastervolume.cpp @@ -16,7 +16,7 @@ #include "mastervolume.h" -void MasterVolume::setVolume(int volume) +void MasterVolume::setVolume(pa_volume_t volume) { int volume_delta = volume - m_volume; m_volume = volume; diff --git a/homescreen/src/mastervolume.h b/homescreen/src/mastervolume.h index bca6356..645968a 100644 --- a/homescreen/src/mastervolume.h +++ b/homescreen/src/mastervolume.h @@ -17,6 +17,8 @@ #include #include +#include + class MasterVolume : public QObject { Q_OBJECT @@ -31,7 +33,7 @@ class MasterVolume : public QObject ~MasterVolume() {} uint32_t getVolume() const { return m_volume; } - void setVolume(int volume); + void setVolume(pa_volume_t volume); public slots: void changeExternalVolume(int volume); diff --git a/homescreen/src/statusbarmodel.cpp b/homescreen/src/statusbarmodel.cpp index 5e63b7d..c093ceb 100644 --- a/homescreen/src/statusbarmodel.cpp +++ b/homescreen/src/statusbarmodel.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2016 The Qt Company Ltd. - * Copyright (C) 2017, 2018 TOYOTA MOTOR CORPORATION * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +16,14 @@ #include "statusbarmodel.h" #include "statusbarserver.h" +#include +#include "hmi-debug.h" #include #include "network.h" + class StatusBarModel::Private { public: @@ -65,6 +67,7 @@ StatusBarModel::~StatusBarModel() void StatusBarModel::init(QUrl &url, QQmlContext *context) { + HMI_DEBUG("HomeScreen", "StatusBarModel::init"); d->network = new Network(url, context); context->setContextProperty("network", d->network); @@ -77,6 +80,7 @@ void StatusBarModel::init(QUrl &url, QQmlContext *context) void StatusBarModel::setWifiStatus(bool connected, bool enabled, int strength) { + HMI_DEBUG("HomeScreen", "StatusBarModel::setWifiStatus"); if (enabled && connected) if (strength < 30) d->server.setStatusIcon(0, QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_1Bar-01.png")); @@ -111,7 +115,6 @@ int StatusBarModel::rowCount(const QModelIndex &parent) const if (parent.isValid()) return 0; - // Delete bluetooth because use agl-service-bluetooth. return StatusBarServer::SupportedCount - 1; } @@ -123,9 +126,9 @@ QVariant StatusBarModel::data(const QModelIndex &index, int role) const switch (role) { case Qt::DisplayRole: - if (index.row() == 0){ + if (index.row() == 0) { ret = d->iconList[StatusBarServer::StatusWifi]; - }else if (index.row() == 1){ + } else if (index.row() == 1) { ret = d->iconList[StatusBarServer::StatusCellular]; } break; diff --git a/homescreen/src/toucharea.cpp b/homescreen/src/toucharea.cpp new file mode 100644 index 0000000..1cf4384 --- /dev/null +++ b/homescreen/src/toucharea.cpp @@ -0,0 +1,36 @@ +#include "toucharea.h" +#include "hmi-debug.h" + +TouchArea::TouchArea() +{ +} + +TouchArea::~TouchArea() +{ + +} + +void TouchArea::setWindow(QQuickWindow *window) +{ + myWindow = window; +} + +void TouchArea::init() +{ + bitmapNormal = QPixmap(":/images/AGL_HMI_Normal_Background.png").createHeuristicMask(); + bitmapFullscreen = QPixmap(":/images/AGL_HMI_Full_Background.png").createHeuristicMask(); + myWindow->setMask(QRegion(bitmapNormal)); +} + +void TouchArea::switchArea(int areaType) +{ + if(areaType == NORMAL) { + myWindow->setMask(QRegion(bitmapNormal)); + HMI_DEBUG("HomeScreen","TouchArea switchArea: %d.", areaType); + } else if (areaType == FULLSCREEN) { + HMI_DEBUG("HomeScreen","TouchArea switchArea: %d.", areaType); + myWindow->setMask(QRegion(bitmapFullscreen)); + } +} + + diff --git a/homescreen/src/toucharea.h b/homescreen/src/toucharea.h new file mode 100644 index 0000000..69c6872 --- /dev/null +++ b/homescreen/src/toucharea.h @@ -0,0 +1,30 @@ +#ifndef TOUCHAREA_H +#define TOUCHAREA_H + +#include +#include + +enum { + NORMAL=0, + FULLSCREEN +}; + +class TouchArea : public QObject +{ + Q_OBJECT +public: + explicit TouchArea(); + ~TouchArea(); + + Q_INVOKABLE void switchArea(int areaType); + void setWindow(QQuickWindow* window); + +public slots: + void init(); + +private: + QBitmap bitmapNormal, bitmapFullscreen; + QQuickWindow* myWindow; +}; + +#endif // TOUCHAREA_H -- cgit 1.2.3-korg