diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 8d050712..fdc416ff 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -50,8 +50,11 @@ 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 +72,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 +190,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 +259,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 +318,7 @@ void WlanListItem::refreshIcon() break; } } - m_netButton->setActive(false); + m_netButton->setActive(isActivated); } void WlanListItem::onInfoButtonClicked() @@ -393,7 +396,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..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,6 +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 + 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();