summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2019-05-16 22:09:22 +0300
committerRaquel Medina <raquel.medina@konsulko.com>2019-05-29 21:23:21 +0200
commit5eaddb43b21fb2d6c28fdb22381f3556e27d6fba (patch)
tree5226c42bb9cd4dbc725e982491aeb8f86bb32177
parent75623ace444c05953c9bfb608b400c5cfc721f7c (diff)
homescreen: network: use new WifiAdapter classhalibut_7.99.1halibut/7.99.17.99.1
-Apply new network class interfaces from libqtappfw to retrieve wifi status data for the status bar. -remove helpers from git index to allow cloning without errors. Bug-AGL: SPEC-2293 Change-Id: I77dc0b9ac33c97b963b0533d7071868c96f58b87 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com>
m---------homescreen/helpers0
-rw-r--r--homescreen/src/statusbarmodel.cpp20
2 files changed, 13 insertions, 7 deletions
diff --git a/homescreen/helpers b/homescreen/helpers
deleted file mode 160000
-Subproject b3a54dd8653fa672650229dd2498308ffcc3e94
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