From 30d9871aa7890754ae50a3f128eb91b1fc9c7327 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Tue, 21 Jun 2022 17:24:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=BC=80=E7=A7=BB=E5=8A=A8=E7=83=AD?= =?UTF-8?q?=E7=82=B9=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98=E5=92=8C=E6=97=A0?= =?UTF-8?q?=E7=BA=BF=E5=BC=80=E5=85=B3=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/mobilehotspot/mobilehotspotwidget.cpp | 9 -------- plugins/mobilehotspot/mobilehotspotwidget.h | 3 --- src/frontend/tab-pages/wlanpage.cpp | 21 ++++++++++++------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index 6d6162fe..0b3fc081 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -71,15 +71,6 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent) m_interfaceName = m_interfaceComboBox->currentText(); updateBandCombox(); }); - connect(m_pwdShowBox, &QCheckBox::clicked, this, [=]() { - if (m_pwdNameLine->echoMode() == QLineEdit::Password) { - m_pwdShowBox->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic")); - m_pwdNameLine->setEchoMode(QLineEdit::Normal); - } else { - m_pwdNameLine->setEchoMode(QLineEdit::Password); - m_pwdShowBox->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); - } - }); } MobileHotspotWidget::~MobileHotspotWidget() diff --git a/plugins/mobilehotspot/mobilehotspotwidget.h b/plugins/mobilehotspot/mobilehotspotwidget.h index b755b6b1..8116811d 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.h +++ b/plugins/mobilehotspot/mobilehotspotwidget.h @@ -49,9 +49,6 @@ private: QLabel *m_freqBandLabel; QLabel *m_interfaceLabel; - - QPushButton *m_pwdShowBox; - QFrame *switchAndApNameLine; QFrame *apNameAndPwdLine; QFrame *pwdAndfreqBandLine; diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 8c8b6889..82ff0500 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -58,12 +58,14 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent) bool WlanPage::eventFilter(QObject *w, QEvent *e) { - if (e->type() == QEvent::MouseButtonRelease) { - if (w == m_settingsBtn) { + if (w == m_settingsBtn) { + if (e->type() == QEvent::MouseButtonRelease) { //ZJP_TODO 打开控制面板 qDebug() << LOG_FLAG <<"recive event show control center"; showControlCenter(); - } else if (w == m_netSwitch) { + } + } else if (w == m_netSwitch) { + if (e->type() == QEvent::MouseButtonRelease) { if (m_devList.isEmpty()) { showDesktopNotify(tr("No wireless network card detected"), "networkwrong"); //检测不到无线网卡不再触发click信号 @@ -75,7 +77,6 @@ bool WlanPage::eventFilter(QObject *w, QEvent *e) return true; } } - return QWidget::eventFilter(w,e); } @@ -133,6 +134,7 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key) void WlanPage::initWlanSwitchState() { + bool wirelessGsetting = true; if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) { m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA); if (m_switchGsettings->keys().contains(WIRELESS_SWITCH)) { @@ -140,17 +142,20 @@ void WlanPage::initWlanSwitchState() m_netSwitch->setCheckable(false); m_netSwitch->setChecked(false); } else { - bool wiredGsetting = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); + wirelessGsetting = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); if (m_wirelessConnectOpreation->getWirelessEnabled() - != wiredGsetting) { + != wirelessGsetting) { //以gsetting为准 - m_wirelessConnectOpreation->setWirelessEnabled(wiredGsetting); + m_wirelessConnectOpreation->setWirelessEnabled(wirelessGsetting); } - m_netSwitch->setChecked(wiredGsetting); + m_netSwitch->setChecked(wirelessGsetting); } connect(m_switchGsettings, &QGSettings::changed, this, &WlanPage::onWlanSwithGsettingsChanged); } } + m_netSwitch->setChecked(wirelessGsetting); + m_wlanSwitchEnable = wirelessGsetting; + return; } void WlanPage::initTimer()