Re-enable status bar 19/27119/2 12.92.0 marlin/12.92.0 marlin_12.92.0
authorScott Murray <scott.murray@konsulko.com>
Fri, 28 Jan 2022 22:02:52 +0000 (17:02 -0500)
committerScott Murray <scott.murray@konsulko.com>
Fri, 28 Jan 2022 22:09:11 +0000 (17:09 -0500)
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 <scott.murray@konsulko.com>
Change-Id: I3aeb98dc01c0bc09550824f44bcb1d40f324e49e

homescreen/homescreen.pro
homescreen/qml/StatusArea.qml
homescreen/src/main.cpp
homescreen/src/statusbarmodel.cpp

index 80f0f49..fd53072 100644 (file)
@@ -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
 
index 87b27ad..4a8fbc0 100644 (file)
@@ -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
                 }
             }
-*/
         }
     }
 }
index cf7f02e..4e3073f 100644 (file)
 #include <QQuickWindow>
 #include <QTimer>
 
-#if 0
 #include <weather.h>
 #include <bluetooth.h>
-#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);
 
index 8b46cd1..447466d 100644 (file)
@@ -17,9 +17,8 @@
 
 #include "statusbarmodel.h"
 #include "statusbarserver.h"
-#if 0
-#include "network.h"
-#endif
+#include <network.h>
+#include <wifiadapter.h>
 
 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<WifiAdapter*>(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