diff options
author | Akio Fukubayashi <fukubayashi.akio@genetec.co.jp> | 2019-09-04 17:17:22 +0900 |
---|---|---|
committer | Akio Fukubayashi <fukubayashi.akio@genetec.co.jp> | 2019-09-04 17:17:22 +0900 |
commit | 48c977cc5c5e58ad03564e9f567345cb2c6edb93 (patch) | |
tree | e8f50a8b78bb50f3e5c8e077043ff58d154d110d | |
parent | f266dcd35564ea649ed1435a3ab7a3abbef900d9 (diff) |
Fix wifi for 8.0.0
-rw-r--r-- | homescreen/src/statusbarmodel.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/homescreen/src/statusbarmodel.cpp b/homescreen/src/statusbarmodel.cpp index 5e63b7d..f54a5f4 100644 --- a/homescreen/src/statusbarmodel.cpp +++ b/homescreen/src/statusbarmodel.cpp @@ -33,6 +33,7 @@ public: StatusBarServer server; QString iconList[StatusBarServer::SupportedCount]; Network *network; + WifiAdapter *wifi_a; }; StatusBarModel::Private::Private(StatusBarModel *parent) @@ -67,12 +68,17 @@ void StatusBarModel::init(QUrl &url, QQmlContext *context) { d->network = new Network(url, context); context->setContextProperty("network", d->network); + d->wifi_a = static_cast<WifiAdapter*>(d->network->findAdapter("wifi")); + Q_CHECK_PTR(d->wifi_a); - QObject::connect(d->network, &Network::wifiConnectedChanged, this, &StatusBarModel::onWifiConnectedChanged); - QObject::connect(d->network, &Network::wifiEnabledChanged, this, &StatusBarModel::onWifiEnabledChanged); - QObject::connect(d->network, &Network::wifiStrengthChanged, this, &StatusBarModel::onWifiStrengthChanged); + QObject::connect(d->wifi_a, &WifiAdapter::wifiConnectedChanged, + this, &StatusBarModel::onWifiConnectedChanged); + QObject::connect(d->wifi_a, &WifiAdapter::wifiEnabledChanged, + this, &StatusBarModel::onWifiEnabledChanged); + QObject::connect(d->wifi_a, &WifiAdapter::wifiStrengthChanged, + this, &StatusBarModel::onWifiStrengthChanged); - setWifiStatus(d->network->wifiConnected(), d->network->wifiEnabled(), d->network->wifiStrength()); + setWifiStatus(d->wifi_a->wifiConnected(), d->wifi_a->wifiEnabled(), d->wifi_a->wifiStrength()); } void StatusBarModel::setWifiStatus(bool connected, bool enabled, int strength) @@ -92,18 +98,18 @@ void StatusBarModel::setWifiStatus(bool connected, bool enabled, int strength) void StatusBarModel::onWifiConnectedChanged(bool connected) { - setWifiStatus(connected, d->network->wifiEnabled(), d->network->wifiStrength()); + setWifiStatus(connected, d->wifi_a->wifiEnabled(), d->wifi_a->wifiStrength()); } void StatusBarModel::onWifiEnabledChanged(bool enabled) { - setWifiStatus(d->network->wifiConnected(), enabled, d->network->wifiStrength()); + setWifiStatus(d->wifi_a->wifiConnected(), enabled, d->wifi_a->wifiStrength()); } void StatusBarModel::onWifiStrengthChanged(int strength) { qInfo() << "Strength changed: " << strength; - setWifiStatus(d->network->wifiConnected(), d->network->wifiEnabled(), strength); + setWifiStatus(d->wifi_a->wifiConnected(), d->wifi_a->wifiEnabled(), strength); } int StatusBarModel::rowCount(const QModelIndex &parent) const |