Merge branch 'dev3.1' into 'dbus-interface'

use the hotspot icon when the connection is a hotspot

See merge request kylin-desktop/kylin-nm!416
This commit is contained in:
Zhai Kangning 2021-11-19 07:49:21 +00:00
commit 54be5c3ff4
3 changed files with 19 additions and 1 deletions

View File

@ -6,6 +6,13 @@
#define LOG_FLAG "[WlanListItem]"
#define WAIT_US 10*1000
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent)
: WlanListItem(wirelessNetItem, device, parent)
{
m_isApMode = isApMode;
refreshIcon(false); // 额外刷新一次图标因为WlanListItem执行时m_isApMode尚未赋值
}
WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent) : ListItem(parent)
{
m_wlanDevice = device;
@ -285,6 +292,12 @@ void WlanListItem::refreshIcon(bool isActivated)
#define OK_SIGNAL 2
#define LOW_SIGNAL 1
#define STEP 25
if (m_isApMode) {
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-hotspot-symbolic", QIcon(":/res/w/wifi-full.png")));
m_netButton->setActive(isActivated);
return;
}
if (!m_hasPwd) {
//ZJP_TODO 无加密 注意信号格数计算方式,可能需要修改
switch (m_wirelessNetItem.m_signalStrength / STEP + 1) {

View File

@ -21,6 +21,7 @@ class WlanListItem : public ListItem
{
Q_OBJECT
public:
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent = nullptr);
WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent = nullptr);
WlanListItem(QWidget *parent = nullptr);
~WlanListItem();
@ -85,6 +86,7 @@ private:
bool m_mouseIsOut = true;
bool m_forgetConnection = false;
bool m_isApMode = false;
protected slots:
void onInfoButtonClicked();

View File

@ -241,7 +241,10 @@ QListWidgetItem *WlanPage::addEmptyItem(QListWidget *wirelessListWidget)
QListWidgetItem *WlanPage::addNewItem(KyWirelessNetItem &wirelessNetItem,
QListWidget *wirelessListWidget)
{
WlanListItem *p_wlanItem = new WlanListItem(wirelessNetItem, m_currentDevice);
WlanListItem *p_wlanItem = new WlanListItem(
wirelessNetItem,
m_currentDevice,
m_connectResource->isApConnection(wirelessNetItem.m_connectUuid));
connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
QListWidgetItem *p_listWidgetItem = new QListWidgetItem();