From 6c90b69e51fe6d492f1d0bd448fa457f9079f0b9 Mon Sep 17 00:00:00 2001 From: zhaikangning Date: Thu, 18 Nov 2021 11:51:54 +0800 Subject: [PATCH] =?UTF-8?q?use=20the=20hotspot=20icon=20when=20the=20conne?= =?UTF-8?q?ction=20is=20a=20hotspot=20=E5=BD=93=E8=BF=9E=E6=8E=A5=E7=83=AD?= =?UTF-8?q?=E7=82=B9=E6=97=B6=E4=BD=BF=E7=94=A8=E7=83=AD=E7=82=B9=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=20BugId=2086306(=E8=AF=A5commit=E4=BB=85=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=BB=E5=8A=A1=E6=A0=8F=E7=BD=91=E7=BB=9C=E9=83=A8?= =?UTF-8?q?=E5=88=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/list-items/wlanlistitem.cpp | 13 +++++++++++++ src/frontend/list-items/wlanlistitem.h | 2 ++ src/frontend/tab-pages/wlanpage.cpp | 5 ++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 338d4d70..60f854ae 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -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) { diff --git a/src/frontend/list-items/wlanlistitem.h b/src/frontend/list-items/wlanlistitem.h index 3d0570bd..2926c8e7 100644 --- a/src/frontend/list-items/wlanlistitem.h +++ b/src/frontend/list-items/wlanlistitem.h @@ -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(); diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 105eaaf5..6c54b1f4 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -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();