打开移动热点崩溃问题和无线开关初始化

This commit is contained in:
zhangyuanyuan1 2022-06-21 17:24:43 +08:00
parent 050b18ec58
commit 30d9871aa7
3 changed files with 13 additions and 20 deletions

View File

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

View File

@ -49,9 +49,6 @@ private:
QLabel *m_freqBandLabel;
QLabel *m_interfaceLabel;
QPushButton *m_pwdShowBox;
QFrame *switchAndApNameLine;
QFrame *apNameAndPwdLine;
QFrame *pwdAndfreqBandLine;

View File

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