From b7b156ece9492401f7bfe7676e7521f4cdd32905 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Fri, 28 Jan 2022 17:02:52 -0500 Subject: Re-enable status bar Re-enable the status bar Bluetooth and Wifi status monitoring via the libqtappfw provided objects, and also hook up the currently stubbed weather support so it'll start working if it is updated in libqtappfw. Bug-AGL: SPEC-4182 Signed-off-by: Scott Murray Change-Id: I3aeb98dc01c0bc09550824f44bcb1d40f324e49e --- homescreen/homescreen.pro | 2 +- homescreen/qml/StatusArea.qml | 8 ++------ homescreen/src/main.cpp | 10 ++++------ homescreen/src/statusbarmodel.cpp | 19 +++---------------- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/homescreen/homescreen.pro b/homescreen/homescreen.pro index 80f0f49..fd53072 100644 --- a/homescreen/homescreen.pro +++ b/homescreen/homescreen.pro @@ -17,7 +17,7 @@ TEMPLATE = app TARGET = homescreen QT = qml quick gui-private dbus CONFIG += c++11 link_pkgconfig wayland-scanner -PKGCONFIG += wayland-client +PKGCONFIG += wayland-client qtappfw-weather qtappfw-network qtappfw-bt DBUS_INTERFACES = $$[QT_SYSROOT]/usr/share/dbus-1/interfaces/org.automotivelinux.AppLaunch.xml diff --git a/homescreen/qml/StatusArea.qml b/homescreen/qml/StatusArea.qml index 87b27ad..4a8fbc0 100644 --- a/homescreen/qml/StatusArea.qml +++ b/homescreen/qml/StatusArea.qml @@ -30,7 +30,7 @@ Item { interval: 100; running: true; repeat: true; onTriggered: root.now = new Date } -/* + Connections { target: weather @@ -54,7 +54,7 @@ Item { temperature_item.text = temperature.split(".")[0] + '°F' } } -*/ + RowLayout { anchors.fill: parent spacing: 0 @@ -126,7 +126,6 @@ Item { fillMode: Image.PreserveAspectFit property string deviceName: "none" property bool connStatus: false -/* Connections { target: bluetooth @@ -134,9 +133,7 @@ Item { bt_icon.connStatus = state } } -*/ } -/* Repeater { model: StatusBarModel { objectName: "statusBar" } delegate: Image { @@ -146,7 +143,6 @@ Item { fillMode: Image.PreserveAspectFit } } -*/ } } } diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index cf7f02e..4e3073f 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -26,10 +26,9 @@ #include #include -#if 0 #include #include -#endif + #include "applicationlauncher.h" #include "statusbarmodel.h" #include "mastervolume.h" @@ -299,10 +298,9 @@ int main(int argc, char *argv[]) context->setContextProperty("homescreenHandler", homescreenHandler); context->setContextProperty("launcher", launcher); -#if 0 - context->setContextProperty("weather", new Weather(bindingAddress)); - context->setContextProperty("bluetooth", new Bluetooth(bindingAddress, context)); -#endif + context->setContextProperty("weather", new Weather()); + context->setContextProperty("bluetooth", new Bluetooth(false, context)); + // we add it here even if we don't use it context->setContextProperty("shell", aglShell); diff --git a/homescreen/src/statusbarmodel.cpp b/homescreen/src/statusbarmodel.cpp index 8b46cd1..447466d 100644 --- a/homescreen/src/statusbarmodel.cpp +++ b/homescreen/src/statusbarmodel.cpp @@ -17,9 +17,8 @@ #include "statusbarmodel.h" #include "statusbarserver.h" -#if 0 -#include "network.h" -#endif +#include +#include class StatusBarModel::Private { @@ -31,10 +30,8 @@ private: public: StatusBarServer server; QString iconList[StatusBarServer::SupportedCount]; -#if 0 Network *network; WifiAdapter *wifi_a; -#endif }; StatusBarModel::Private::Private(StatusBarModel *parent) @@ -64,8 +61,7 @@ StatusBarModel::~StatusBarModel() void StatusBarModel::init(QQmlContext *context) { -#if 0 - d->network = new Network(url, context); + d->network = new Network(false, context); context->setContextProperty("network", d->network); d->wifi_a = static_cast(d->network->findAdapter("wifi")); Q_CHECK_PTR(d->wifi_a); @@ -78,12 +74,10 @@ void StatusBarModel::init(QQmlContext *context) this, &StatusBarModel::onWifiStrengthChanged); setWifiStatus(d->wifi_a->wifiConnected(), d->wifi_a->wifiEnabled(), d->wifi_a->wifiStrength()); -#endif } void StatusBarModel::setWifiStatus(bool connected, bool enabled, int strength) { -#if 0 if (enabled && connected) if (strength < 30) d->server.setStatusIcon(0, QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_1Bar-01.png")); @@ -95,29 +89,22 @@ void StatusBarModel::setWifiStatus(bool connected, bool enabled, int strength) d->server.setStatusIcon(0, QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_Full-01.png")); else d->server.setStatusIcon(0, QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_NoBars-01.png")); -#endif } void StatusBarModel::onWifiConnectedChanged(bool connected) { -#if 0 setWifiStatus(connected, d->wifi_a->wifiEnabled(), d->wifi_a->wifiStrength()); -#endif } void StatusBarModel::onWifiEnabledChanged(bool enabled) { -#if 0 setWifiStatus(d->wifi_a->wifiConnected(), enabled, d->wifi_a->wifiStrength()); -#endif } void StatusBarModel::onWifiStrengthChanged(int strength) { -#if 0 qInfo() << "Strength changed: " << strength; setWifiStatus(d->wifi_a->wifiConnected(), d->wifi_a->wifiEnabled(), strength); -#endif } int StatusBarModel::rowCount(const QModelIndex &parent) const -- cgit 1.2.3-korg