From 6d2f420dc38d4cedfb246f0982a5baf34cf9f7a9 Mon Sep 17 00:00:00 2001 From: kangshuning Date: Mon, 8 Nov 2021 14:48:34 +0800 Subject: [PATCH 1/2] bug#89592 --- src/frontend/list-items/wlanlistitem.cpp | 18 +++++++++++------- src/frontend/list-items/wlanlistitem.h | 2 +- src/frontend/tab-pages/wlanpage.cpp | 9 +++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 8d050712..58048d5d 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -50,8 +50,12 @@ QString WlanListItem::getSsid() void WlanListItem::setSignalStrength(const int &signal) { m_wirelessNetItem.m_signalStrength = signal; - - refreshIcon(); + if (Activated == m_connectState) { + refreshIcon(true); + } + else if (Deactivated == m_connectState) { + refreshIcon(false); + } return; } @@ -69,7 +73,7 @@ bool WlanListItem::isConfigured() void WlanListItem::setWlanState(const int &state) { // m_wirelessNetItem.m_state = state; //ZJP_TODO 后端接口待补全 - refreshIcon(); + refreshIcon(false); } void WlanListItem::setExpanded(const bool &expanded) @@ -187,7 +191,7 @@ void WlanListItem::initWlanUI() // this->setName((m_wirelessNetItem.m_connName != "") ? m_wirelessNetItem.m_connName : m_wirelessNetItem.m_NetSsid); this->setName(m_wirelessNetItem.m_NetSsid); //刷新左侧按钮图标 - refreshIcon(); + refreshIcon(false); #define PWD_AREA_HEIGHT 36 #define CONNECT_BUTTON_WIDTH 96 @@ -256,7 +260,7 @@ void WlanListItem::initWlanUI() m_autoConnectFrame->hide(); } -void WlanListItem::refreshIcon() +void WlanListItem::refreshIcon(bool isActivated) { #define FULL_SIGNAL 5 #define EXCELLENT_SIGNAL 4 @@ -315,7 +319,7 @@ void WlanListItem::refreshIcon() break; } } - m_netButton->setActive(false); + m_netButton->setActive(isActivated); } void WlanListItem::onInfoButtonClicked() @@ -393,7 +397,7 @@ void WlanListItem::updateWirelessNetSecurity(QString ssid, QString securityType) bool newSecu = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true; if (m_hasPwd^newSecu) { m_hasPwd = newSecu; - refreshIcon(); + refreshIcon(false); } return; diff --git a/src/frontend/list-items/wlanlistitem.h b/src/frontend/list-items/wlanlistitem.h index c26200a7..de81c35d 100644 --- a/src/frontend/list-items/wlanlistitem.h +++ b/src/frontend/list-items/wlanlistitem.h @@ -56,7 +56,7 @@ signals: private: void initWlanUI(); - void refreshIcon(); + void refreshIcon(bool isActivated); private: KyWirelessNetItem m_wirelessNetItem; diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index b533a18c..abce7c85 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -1027,6 +1027,15 @@ void WlanPage::onRefreshIconTimer() QString sortSsid = sortItem.m_NetSsid; //应该在第currentRow行的新的WiFi名称 //qDebug()<< LOG_FLAG << "sort ssid"<< sortSsid << "active ssid" << activateSsid << "sort row"<< sortRow; if (sortSsid == activateSsid) { //排除已连接WiFi + QListWidgetItem *p_listWidgetItem = m_activateConnectionItemMap.value(activateSsid); + if (p_listWidgetItem) { + WlanListItem *p_wlanItem = (WlanListItem *)m_activatedNetListWidget->itemWidget(p_listWidgetItem); + if (nullptr != p_wlanItem) { + p_wlanItem->setSignalStrength(sortItem.m_signalStrength); + continue; + } + continue; + } continue; } From 2b4ef7e1fc3fa1ceb729aeaaf7d743441a060c3c Mon Sep 17 00:00:00 2001 From: kangshuning Date: Tue, 9 Nov 2021 10:31:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8A=BD=E5=8F=96=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/list-items/wlanlistitem.cpp | 3 +-- src/frontend/tab-pages/wlanpage.cpp | 22 +++++++++++++--------- src/frontend/tab-pages/wlanpage.h | 1 + 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 58048d5d..fdc416ff 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -52,8 +52,7 @@ void WlanListItem::setSignalStrength(const int &signal) m_wirelessNetItem.m_signalStrength = signal; if (Activated == m_connectState) { refreshIcon(true); - } - else if (Deactivated == m_connectState) { + } else if (Deactivated == m_connectState) { refreshIcon(false); } diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index abce7c85..4c6b6563 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -996,6 +996,18 @@ void WlanPage::onWifiEnabledChanged(bool isWifiOn) return; } +void WlanPage::refreshActiveConnectionIcon(QString ssid, const int &signal) +{ + QListWidgetItem *p_listWidgetItem = m_activateConnectionItemMap.value(ssid); + if (p_listWidgetItem) { + WlanListItem *p_wlanItem = (WlanListItem *)m_activatedNetListWidget->itemWidget(p_listWidgetItem); + if (nullptr != p_wlanItem) { + p_wlanItem->setSignalStrength(signal); + return; + } + } +} + void WlanPage::onRefreshIconTimer() { if (!m_updateStrength) { @@ -1027,15 +1039,7 @@ void WlanPage::onRefreshIconTimer() QString sortSsid = sortItem.m_NetSsid; //应该在第currentRow行的新的WiFi名称 //qDebug()<< LOG_FLAG << "sort ssid"<< sortSsid << "active ssid" << activateSsid << "sort row"<< sortRow; if (sortSsid == activateSsid) { //排除已连接WiFi - QListWidgetItem *p_listWidgetItem = m_activateConnectionItemMap.value(activateSsid); - if (p_listWidgetItem) { - WlanListItem *p_wlanItem = (WlanListItem *)m_activatedNetListWidget->itemWidget(p_listWidgetItem); - if (nullptr != p_wlanItem) { - p_wlanItem->setSignalStrength(sortItem.m_signalStrength); - continue; - } - continue; - } + refreshActiveConnectionIcon(activateSsid, sortItem.m_signalStrength); continue; } diff --git a/src/frontend/tab-pages/wlanpage.h b/src/frontend/tab-pages/wlanpage.h index c0fddc7e..e277cde2 100644 --- a/src/frontend/tab-pages/wlanpage.h +++ b/src/frontend/tab-pages/wlanpage.h @@ -129,6 +129,7 @@ private: QListWidgetItem *p_listWidgetItem, ConnectState state); void updateWlanListItem(QString ssid); + void refreshActiveConnectionIcon(QString ssid, const int &signal); void constructWirelessNetArea(); void constructActivateConnectionArea();