diff --git a/src/backend/dbus-interface/kywirelessnetresource.cpp b/src/backend/dbus-interface/kywirelessnetresource.cpp index 6d920703..66c1f9b2 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.cpp +++ b/src/backend/dbus-interface/kywirelessnetresource.cpp @@ -516,5 +516,5 @@ void KyWirelessNetResource::onConnectionUpdate(QString uuid) } m_WifiNetworkList.clear(); kyWirelessNetItemListInit(); - emit wifiNetworkUpadte(); + emit wifiNetworkUpdate(); } diff --git a/src/backend/dbus-interface/kywirelessnetresource.h b/src/backend/dbus-interface/kywirelessnetresource.h index 62c0ed97..1da8b1bd 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.h +++ b/src/backend/dbus-interface/kywirelessnetresource.h @@ -50,7 +50,7 @@ signals: void secuTypeChange(QString, QString, QString); void connectionRemove(QString, QString); void connectionAdd(QString, QString); - void wifiNetworkUpadte(); + void wifiNetworkUpdate(); void wifiNetworkAdd(QString, KyWirelessNetItem&); void wifiNetworkRemove(QString, QString); diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 7af2bdba..910d1cf0 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -48,43 +48,51 @@ void WlanListItem::initWlanConnection() void WlanListItem::refreshIcon() { +#define FULL_SIGNAL 5 +#define EXCELLENT_SIGNAL 4 +#define GOOD_SIGNAL 3 +#define OK_SIGNAL 2 +#define LOW_SIGNAL 1 +#define STEP 25 // if (m_data->m_state) //ZJP_TODO 连接中、已连接、未连接的处理,要单独写逻辑,后端接口待补全 if (!m_hasPwd) { //ZJP_TODO 无加密 注意信号格数计算方式,可能需要修改 - switch (m_data->m_signalStrength / 25 + 1) { - case 5: - case 4: + switch (m_data->m_signalStrength / STEP + 1) { + case FULL_SIGNAL: + case EXCELLENT_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic", QIcon(":/res/w/wifi-full.png"))); break; - case 3: + case GOOD_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-good-symbolic", QIcon(":/res/w/wifi-high.png"))); break; - case 2: + case OK_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-ok", QIcon(":/res/w/wifi-medium.png"))); break; - case 1: + case LOW_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-low", QIcon(":/res/w/wifi-low.png"))); break; default: + qDebug() << "Set wlan(without passwd) icon failed, signal = " << m_data->m_signalStrength << Q_FUNC_INFO << __LINE__; break; } } else { //ZJP_TODO 有加密 - switch (m_data->m_signalStrength / 25 + 1) { - case 5: - case 4: + switch (m_data->m_signalStrength / STEP + 1) { + case FULL_SIGNAL: + case EXCELLENT_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-secure-symbolic", QIcon(":/res/w/wifi-full-pwd.png"))); break; - case 3: + case GOOD_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic", QIcon(":/res/w/wifi-high-pwd.png"))); break; - case 2: + case OK_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-ok-secure-symbolic", QIcon(":/res/w/wifi-medium-pwd.png"))); break; - case 1: + case LOW_SIGNAL: m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-low-secure-symbolic", QIcon(":/res/w/wifi-low-pwd.png"))); break; default: + qDebug() << "Set wlan(with passwd) icon failed, signal = " << m_data->m_signalStrength << Q_FUNC_INFO << __LINE__; break; } } diff --git a/src/frontend/nmdemo.cpp b/src/frontend/nmdemo.cpp index 503137f8..1ad36969 100644 --- a/src/frontend/nmdemo.cpp +++ b/src/frontend/nmdemo.cpp @@ -158,7 +158,7 @@ void NmDemo::initConnect() connect(m_wnr, &KyWirelessNetResource::connectionRemove, this ,&NmDemo::onConnectionRemove); connect(m_wnr, &KyWirelessNetResource::connectionAdd, this ,&NmDemo::onConnectionAdd); - connect(m_wnr, &KyWirelessNetResource::wifiNetworkUpadte, this ,&NmDemo::onWifiNetworkUpdate); + connect(m_wnr, &KyWirelessNetResource::wifiNetworkUpdate, this ,&NmDemo::onWifiNetworkUpdate); connect(m_wnr, &KyWirelessNetResource::wifiNetworkAdd, this ,&NmDemo::onWifiNetworkAdd); connect(m_wnr, &KyWirelessNetResource::wifiNetworkRemove, this ,&NmDemo::onWifiNetworkRemove); diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 6945a775..126f444a 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -72,7 +72,7 @@ void WlanPage::initConnections() { connect(m_resource, &KyWirelessNetResource::wifiNetworkAdd, this, &WlanPage::onWlanAdded); connect(m_resource, &KyWirelessNetResource::wifiNetworkRemove, this, &WlanPage::onWlanRemoved); - connect(m_resource, &KyWirelessNetResource::wifiNetworkUpadte, this, &WlanPage::onWlanUpdated); + connect(m_resource, &KyWirelessNetResource::wifiNetworkUpdate, this, &WlanPage::onWlanUpdated); } /** @@ -130,7 +130,9 @@ void WlanPage::getAllWlan() } int height = 0; foreach (auto itemData, wlanList) { - if (itemData.m_NetSsid == this->m_activatedWlanSSid) { continue; } + if (itemData.m_NetSsid == this->m_activatedWlanSSid) { + continue; + } KyWirelessNetItem *data = new KyWirelessNetItem(itemData); WlanListItem *wlanItemWidget = new WlanListItem(m_resource, data); @@ -139,7 +141,9 @@ void WlanPage::getAllWlan() wlanItem->setSizeHint(QSize(m_inactivatedNetListWidget->width(), wlanItemWidget->height())); m_inactivatedNetListWidget->addItem(wlanItem); m_inactivatedNetListWidget->setItemWidget(wlanItem, wlanItemWidget); - if (height == 0) height += wlanItemWidget->height(); + if (height == 0) { + height += wlanItemWidget->height(); + } height += wlanItemWidget->height() + NET_LIST_SPACING; } m_inactivatedNetListWidget->setFixedHeight(height);