Merge branch '1029' into 'dbus-interface'

bug#89592

See merge request kylin-desktop/kylin-nm!390
This commit is contained in:
ren peijia 2021-11-09 05:55:36 +00:00
commit e6421229a0
4 changed files with 25 additions and 8 deletions

View File

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

View File

@ -56,7 +56,7 @@ signals:
private:
void initWlanUI();
void refreshIcon();
void refreshIcon(bool isActivated);
private:
KyWirelessNetItem m_wirelessNetItem;

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

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