抽取函数

This commit is contained in:
kangshuning 2021-11-09 10:31:29 +08:00
parent 6d2f420dc3
commit 2b4ef7e1fc
3 changed files with 15 additions and 11 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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();