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) void WlanListItem::setSignalStrength(const int &signal)
{ {
m_wirelessNetItem.m_signalStrength = signal; m_wirelessNetItem.m_signalStrength = signal;
if (Activated == m_connectState) {
refreshIcon(); refreshIcon(true);
} else if (Deactivated == m_connectState) {
refreshIcon(false);
}
return; return;
} }
@ -69,7 +72,7 @@ bool WlanListItem::isConfigured()
void WlanListItem::setWlanState(const int &state) void WlanListItem::setWlanState(const int &state)
{ {
// m_wirelessNetItem.m_state = state; //ZJP_TODO 后端接口待补全 // m_wirelessNetItem.m_state = state; //ZJP_TODO 后端接口待补全
refreshIcon(); refreshIcon(false);
} }
void WlanListItem::setExpanded(const bool &expanded) 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_connName != "") ? m_wirelessNetItem.m_connName : m_wirelessNetItem.m_NetSsid);
this->setName(m_wirelessNetItem.m_NetSsid); this->setName(m_wirelessNetItem.m_NetSsid);
//刷新左侧按钮图标 //刷新左侧按钮图标
refreshIcon(); refreshIcon(false);
#define PWD_AREA_HEIGHT 36 #define PWD_AREA_HEIGHT 36
#define CONNECT_BUTTON_WIDTH 96 #define CONNECT_BUTTON_WIDTH 96
@ -256,7 +259,7 @@ void WlanListItem::initWlanUI()
m_autoConnectFrame->hide(); m_autoConnectFrame->hide();
} }
void WlanListItem::refreshIcon() void WlanListItem::refreshIcon(bool isActivated)
{ {
#define FULL_SIGNAL 5 #define FULL_SIGNAL 5
#define EXCELLENT_SIGNAL 4 #define EXCELLENT_SIGNAL 4
@ -315,7 +318,7 @@ void WlanListItem::refreshIcon()
break; break;
} }
} }
m_netButton->setActive(false); m_netButton->setActive(isActivated);
} }
void WlanListItem::onInfoButtonClicked() 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; bool newSecu = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true;
if (m_hasPwd^newSecu) { if (m_hasPwd^newSecu) {
m_hasPwd = newSecu; m_hasPwd = newSecu;
refreshIcon(); refreshIcon(false);
} }
return; return;

View File

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

View File

@ -996,6 +996,18 @@ void WlanPage::onWifiEnabledChanged(bool isWifiOn)
return; 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() void WlanPage::onRefreshIconTimer()
{ {
if (!m_updateStrength) { if (!m_updateStrength) {
@ -1027,6 +1039,7 @@ void WlanPage::onRefreshIconTimer()
QString sortSsid = sortItem.m_NetSsid; //应该在第currentRow行的新的WiFi名称 QString sortSsid = sortItem.m_NetSsid; //应该在第currentRow行的新的WiFi名称
//qDebug()<< LOG_FLAG << "sort ssid"<< sortSsid << "active ssid" << activateSsid << "sort row"<< sortRow; //qDebug()<< LOG_FLAG << "sort ssid"<< sortSsid << "active ssid" << activateSsid << "sort row"<< sortRow;
if (sortSsid == activateSsid) { //排除已连接WiFi if (sortSsid == activateSsid) { //排除已连接WiFi
refreshActiveConnectionIcon(activateSsid, sortItem.m_signalStrength);
continue; continue;
} }

View File

@ -129,6 +129,7 @@ private:
QListWidgetItem *p_listWidgetItem, QListWidgetItem *p_listWidgetItem,
ConnectState state); ConnectState state);
void updateWlanListItem(QString ssid); void updateWlanListItem(QString ssid);
void refreshActiveConnectionIcon(QString ssid, const int &signal);
void constructWirelessNetArea(); void constructWirelessNetArea();
void constructActivateConnectionArea(); void constructActivateConnectionArea();