From 01ed3caba839ddfdeb337eca17e506abe7900e63 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Tue, 17 May 2022 10:16:16 +0800 Subject: [PATCH 1/5] =?UTF-8?q?netdetail=E9=A1=B6=E9=83=A8=E6=8C=89?= =?UTF-8?q?=E9=92=AE=20=E6=9B=BF=E6=8D=A2=E4=B8=BASDK=20KTabBar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/netdetails/netdetail.cpp | 62 +++++++++++++++++++++------ src/frontend/netdetails/netdetail.h | 17 ++++++-- 2 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 0458ca3a..74f3cf65 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -25,6 +25,8 @@ #define SECURITY_PAGE_NUM 3 #define CREATE_NET_PAGE_NUM 4 #define PAGE_MIN_HEIGHT 40 +#define LAN_TAB_WIDTH 300 +#define WLAN_TAB_WIDTH 400 //extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); @@ -162,6 +164,14 @@ void NetDetail::onPaletteChanged() delete styleGsettings; styleGsettings = nullptr; } + + QColor colorTabBar = pal.color(QPalette::Disabled, QPalette::Highlight); + m_netTabBar->setBackgroundColor(colorTabBar); +} + +void NetDetail::currentRowChangeSlot(int row) +{ + stackWidget->setCurrentIndex(row); } void NetDetail::paintEvent(QPaintEvent *event) @@ -217,10 +227,10 @@ void NetDetail::initUI() bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT); pageFrame = new QFrame(this); - QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame); pageLayout->setSpacing(PAGE_LAYOUT_SPACING); +#if 0 detailBtn = new QPushButton(this); detailBtn->setText(tr("Detail")); detailBtn->setCheckable(true); @@ -252,6 +262,27 @@ void NetDetail::initUI() pageLayout->addWidget(ipv6Btn); pageLayout->addWidget(securityBtn); pageLayout->addStretch(); +#endif + + // TabBar + m_netTabBar = new KTabBar(KTabBarStyle::SegmentDark, this); + m_netTabBar->addTab(tr("Detail")); //详情 + m_netTabBar->addTab(tr("Ipv4"));//Ipv4 + m_netTabBar->addTab(tr("Ipv6"));//Ipv6 + if (isWlan) { + m_netTabBar->addTab(tr("Security"));//安全 + m_netTabBar->setFixedWidth(WLAN_TAB_WIDTH); + } else { + m_netTabBar->setFixedWidth(LAN_TAB_WIDTH); + } + + pageLayout->addStretch(); + pageLayout->addWidget(m_netTabBar); + pageLayout->addStretch(); + + // TabBar关联选项卡页面 + connect(m_netTabBar, SIGNAL(currentChanged(int)), this, SLOT(currentRowChangeSlot(int))); + confimBtn = new QPushButton(this); confimBtn->setText(tr("Confirm")); @@ -294,6 +325,7 @@ void NetDetail::loadPage() } else { stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); this->setWindowTitle(m_name); +#if 0 if (!isWlan) { securityBtn->hide(); } else { @@ -302,6 +334,10 @@ void NetDetail::loadPage() this->setWindowTitle(tr("connect hiddin wlan")); } } +#endif + if (isWlan && m_name.isEmpty()) { + this->setWindowTitle(tr("connect hiddin wlan")); + } } } @@ -310,18 +346,18 @@ void NetDetail::initComponent() connect(cancelBtn, &QPushButton::clicked, this, [=] { close(); }); - connect(detailBtn, &QPushButton::clicked, this, [=] { - stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); - }); - connect(ipv4Btn, &QPushButton::clicked, this, [=] { - stackWidget->setCurrentIndex(IPV4_PAGE_NUM); - }); - connect(ipv6Btn, &QPushButton::clicked, this, [=] { - stackWidget->setCurrentIndex(IPV6_PAGE_NUM); - }); - connect(securityBtn, &QPushButton::clicked, this, [=] { - stackWidget->setCurrentIndex(SECURITY_PAGE_NUM); - }); +// connect(detailBtn, &QPushButton::clicked, this, [=] { +// stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); +// }); +// connect(ipv4Btn, &QPushButton::clicked, this, [=] { +// stackWidget->setCurrentIndex(IPV4_PAGE_NUM); +// }); +// connect(ipv6Btn, &QPushButton::clicked, this, [=] { +// stackWidget->setCurrentIndex(IPV6_PAGE_NUM); +// }); +// connect(securityBtn, &QPushButton::clicked, this, [=] { +// stackWidget->setCurrentIndex(SECURITY_PAGE_NUM); +// }); connect(confimBtn, SIGNAL(clicked()), this, SLOT(on_btnConfirm_clicked())); if (isWlan && !m_uuid.isEmpty()) { forgetBtn->show(); diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 7828f406..7e6fa2a4 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -28,6 +28,10 @@ #include "creatnetpage.h" #include "coninfo.h" #include "tab-pages/tabpage.h" +#include "kwidget.h" +#include "ktabbar.h" + +using namespace kdk; class NetDetail : public QWidget { @@ -100,11 +104,12 @@ private: QPushButton * forgetBtn; QPushButton * confimBtn; - QPushButton * detailBtn; - QPushButton * ipv4Btn; - QPushButton * ipv6Btn; - QPushButton * securityBtn; +// QPushButton * detailBtn; +// QPushButton * ipv4Btn; +// QPushButton * ipv6Btn; +// QPushButton * securityBtn; QFrame * pageFrame; + KTabBar *m_netTabBar = nullptr; QString m_name; QString m_uuid; @@ -131,9 +136,13 @@ private slots: void on_btnForget_clicked(); void onPaletteChanged(); +protected slots: + void currentRowChangeSlot(int row); + signals: void detailPageClose(bool on); void createPageClose(QString); + void currentChanged(int); }; From 7ee7420473c8bed13c6ace921fdab01c1731eadb Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Wed, 18 May 2022 14:01:51 +0800 Subject: [PATCH 2/5] =?UTF-8?q?SDK=E6=9B=BF=E6=8D=A2switchbutton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/netdetails/netdetail.h | 2 +- src/frontend/tab-pages/lanpage.cpp | 96 +++++++++++++++-------------- src/frontend/tab-pages/lanpage.h | 2 - src/frontend/tab-pages/tabpage.cpp | 2 +- src/frontend/tab-pages/tabpage.h | 6 +- src/frontend/tab-pages/wlanpage.cpp | 94 ++++++++++++---------------- src/frontend/tab-pages/wlanpage.h | 2 +- 7 files changed, 95 insertions(+), 109 deletions(-) diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 7e6fa2a4..7a194cfd 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -109,7 +109,7 @@ private: // QPushButton * ipv6Btn; // QPushButton * securityBtn; QFrame * pageFrame; - KTabBar *m_netTabBar = nullptr; + KTabBar *m_netTabBar = nullptr; QString m_name; QString m_uuid; diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index b35ceed6..e4438791 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -120,7 +120,7 @@ void LanPage::initLanDeviceState() } KyWiredConnectOperation wiredOperation; - if (m_wiredSwitch) { + if (m_netSwitch->isChecked()) { for (int index = 0; index < disableDeviceList.count(); ++index) { wiredOperation.closeWiredNetworkWithDevice(disableDeviceList.at(index)); } @@ -135,12 +135,12 @@ void LanPage::initLanDeviceState() void LanPage::initNetSwitch() { - m_wiredSwitch = true; + bool wiredSwitch = true; if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) { m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA); if (m_switchGsettings->keys().contains(WIRED_SWITCH)) { - m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); + wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); connect(m_switchGsettings, &QGSettings::changed, this, &LanPage::onSwithGsettingsChanged); } } else { @@ -149,16 +149,13 @@ void LanPage::initNetSwitch() if (m_devList.count() == 0) { qDebug() << "[wiredSwitch]:init not enable when no device"; - m_wiredSwitch = false; - m_netSwitch->setSwitchStatus(m_wiredSwitch); - m_netSwitch->setEnabled(false); + m_netSwitch->setChecked(false); + m_netSwitch->setCheckable(false); } - qDebug() << "[wiredSwitch]:init state:" << m_wiredSwitch; + qDebug() << "[wiredSwitch]:init state:" << wiredSwitch; - m_netSwitch->setSwitchStatus(m_wiredSwitch); - - connect(m_netSwitch, &SwitchButton::clicked, this, &LanPage::onLanSwitchClicked); + m_netSwitch->setChecked(wiredSwitch); return; } @@ -166,13 +163,16 @@ void LanPage::initNetSwitch() void LanPage::onSwithGsettingsChanged(const QString &key) { if (key == WIRED_SWITCH) { - m_netSwitch->blockSignals(true); - m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); - qDebug()<<"[LanPage] SwitchButton statue changed to:" << m_wiredSwitch; + bool wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); + qDebug()<<"[LanPage] SwitchButton statue changed to:" << wiredSwitch << m_netSwitch->isChecked(); + + if (wiredSwitch == m_netSwitch->isChecked()) { + return; + } KyWiredConnectOperation wiredOperation; - if (m_wiredSwitch) { + if (wiredSwitch) { for (int index = 0; index < m_enableDeviceList.size(); ++index) { qDebug()<<"[LanPage] open wired device "<< m_enableDeviceList.at(index); wiredOperation.openWiredNetworkWithDevice(m_enableDeviceList.at(index)); @@ -184,30 +184,10 @@ void LanPage::onSwithGsettingsChanged(const QString &key) } } + m_netSwitch->setChecked(wiredSwitch); + initDeviceCombox(); initLanArea(); - - m_netSwitch->setSwitchStatus(m_wiredSwitch); - - m_netSwitch->blockSignals(false); - } -} - -void LanPage::onLanSwitchClicked() -{ - qDebug()<<"[LanPage] On lan switch button clicked! Status:" <getSwitchStatus() - <<"devices count:"<showDesktopNotify(tr("No ethernet device avaliable"), "networkwrong"); - } else { - if (m_netSwitch->getSwitchStatus()) { - //qDebug() << "[wiredSwitch]set true after clicked"; - m_switchGsettings->set(WIRED_SWITCH, true); - } else { - //qDebug() << "[wiredSwitch]set false after clicked"; - m_switchGsettings->set(WIRED_SWITCH,false); - } } } @@ -266,7 +246,7 @@ void LanPage::initDeviceCombox() m_deviceComboBox->clear(); - if (m_wiredSwitch) { + if (m_netSwitch->isChecked()) { int enableDeviceCount = m_enableDeviceList.count(); if (enableDeviceCount > 1) { for (int index = 0; index < enableDeviceCount; ++index) { @@ -426,7 +406,7 @@ void LanPage::constructConnectionArea() void LanPage::initLanArea() { - if (!m_wiredSwitch || m_currentDeviceName.isEmpty()) { + if (!m_netSwitch->isChecked() || m_currentDeviceName.isEmpty()) { m_activatedNetDivider->hide(); m_activatedNetFrame->hide(); @@ -526,7 +506,7 @@ void LanPage::addDeviceForCombox(QString deviceName) disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &LanPage::onDeviceComboxIndexChanged); - if (m_wiredSwitch) { + if (m_netSwitch->isChecked()) { if (1 == m_enableDeviceList.count()) { //1、从无到有添加第一块有线网卡 //2、有多快网卡,但是没有使能 @@ -564,9 +544,9 @@ void LanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devic } if (m_devList.count() == 0) {// 有线网卡从无到有,打开开关 - m_netSwitch->setEnabled(true); - m_wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); - m_netSwitch->setSwitchStatus(m_wiredSwitch); + bool wiredSwitch = m_switchGsettings->get(WIRED_SWITCH).toBool(); + m_netSwitch->setCheckable(true); + m_netSwitch->setChecked(wiredSwitch); } qDebug() << "[LanPage] Begin add device:" << deviceName; @@ -590,7 +570,7 @@ void LanPage::deleteDeviceFromCombox(QString deviceName) disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &LanPage::onDeviceComboxIndexChanged); - if (m_wiredSwitch) { + if (m_netSwitch->isChecked()) { if (0 == m_enableDeviceList.count()) { //1、没有使能任何网卡 goto l_out; @@ -649,9 +629,8 @@ void LanPage::onDeviceRemove(QString deviceName) m_devList.removeOne(deviceName); if (m_devList.count() == 0) { - m_wiredSwitch = false; - m_netSwitch->setSwitchStatus(m_wiredSwitch); - m_netSwitch->setEnabled(false); + m_netSwitch->setCheckable(false); + m_netSwitch->setChecked(false); qDebug() << "[wiredSwitch]set not enable after device remove"; } @@ -727,7 +706,7 @@ void LanPage::onDeviceActiveChanage(QString deviceName, bool deviceActive) } if (deviceActive) { - if (!m_wiredSwitch || !m_enableDeviceList.contains(deviceName)) { + if (!m_netSwitch->isChecked() || !m_enableDeviceList.contains(deviceName)) { qDebug()<< LOG_FLAG << "close disabled device"; m_wiredConnectOperation->closeWiredNetworkWithDevice(deviceName); } @@ -781,6 +760,7 @@ void LanPage::initUI() m_inactivatedLanListWidget->setPalette(pal); m_settingsLabel->installEventFilter(this); + m_netSwitch->installEventFilter(this); } QListWidgetItem *LanPage::insertNewItem(KyConnectItem *itemData, QListWidget *listWidget) @@ -1196,6 +1176,28 @@ bool LanPage::eventFilter(QObject *watched, QEvent *event) if (event->type() == QEvent::MouseButtonRelease) { onShowControlCenter(); } + } else if(watched == m_netSwitch){ + if (event->type() == QEvent::MouseButtonRelease) { + qDebug()<<"[LanPage] On lan switch button clicked! Status:" <isChecked() + <<"devices count:"<showDesktopNotify(tr("No ethernet device avaliable"), "networkwrong"); + m_netSwitch->setCheckable(false); + m_netSwitch->setChecked(false); + } else { + m_netSwitch->setCheckable(true); + if (m_netSwitch->isChecked()) { +// qDebug() << "[wiredSwitch]set true after clicked"; + m_switchGsettings->set(WIRED_SWITCH, false); + } else { +// qDebug() << "[wiredSwitch]set false after clicked"; + m_switchGsettings->set(WIRED_SWITCH,true); + } + } + return true; + } + } return QWidget::eventFilter(watched, event); diff --git a/src/frontend/tab-pages/lanpage.h b/src/frontend/tab-pages/lanpage.h index ee2d6988..613be83a 100644 --- a/src/frontend/tab-pages/lanpage.h +++ b/src/frontend/tab-pages/lanpage.h @@ -98,7 +98,6 @@ private slots: void onUpdateConnection(QString uuid); void onSwithGsettingsChanged(const QString &key); - void onLanSwitchClicked(); void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType); void onDeviceRemove(QString deviceName); @@ -129,7 +128,6 @@ private: QGSettings *m_switchGsettings = nullptr; - bool m_wiredSwitch = true; }; #endif // LANPAGE_H diff --git a/src/frontend/tab-pages/tabpage.cpp b/src/frontend/tab-pages/tabpage.cpp index 6140352f..08f540d7 100644 --- a/src/frontend/tab-pages/tabpage.cpp +++ b/src/frontend/tab-pages/tabpage.cpp @@ -29,7 +29,7 @@ void TabPage::initUI() m_titleLayout = new QHBoxLayout(m_titleFrame); m_titleLayout->setContentsMargins(TITLE_LAYOUT_MARGINS); m_titleLabel = new QLabel(m_titleFrame); - m_netSwitch = new SwitchButton(m_titleFrame); + m_netSwitch = new KSwitchButton(m_titleFrame); m_titleLayout->addWidget(m_titleLabel); m_titleLayout->addStretch(); m_titleLayout->addWidget(m_netSwitch); diff --git a/src/frontend/tab-pages/tabpage.h b/src/frontend/tab-pages/tabpage.h index 599bfeb3..35d4fc3e 100644 --- a/src/frontend/tab-pages/tabpage.h +++ b/src/frontend/tab-pages/tabpage.h @@ -15,6 +15,10 @@ #include #include #include "kylinnetworkdeviceresource.h" +#include "kwidget.h" +#include "kswitchbutton.h" + +using namespace kdk; #define MAIN_LAYOUT_MARGINS 0,0,0,0 #define MAIN_LAYOUT_SPACING 0 @@ -93,7 +97,7 @@ protected: QFrame * m_titleFrame = nullptr; QHBoxLayout * m_titleLayout = nullptr; QLabel * m_titleLabel = nullptr; - SwitchButton * m_netSwitch = nullptr; + KSwitchButton * m_netSwitch = nullptr; Divider * m_titleDivider = nullptr; QFrame * m_activatedNetFrame = nullptr; diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 7b03dcaa..99be027d 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -63,6 +63,16 @@ bool WlanPage::eventFilter(QObject *w, QEvent *e) //ZJP_TODO 打开控制面板 qDebug() << LOG_FLAG <<"recive event show control center"; showControlCenter(); + } else if (w == m_netSwitch) { + if (m_devList.isEmpty()) { + showDesktopNotify(tr("No wireless network card detected"), "networkwrong"); + //检测不到无线网卡不再触发click信号 + m_netSwitch->setCheckable(false); + m_netSwitch->setChecked(false); + } else { + m_wirelessConnectOpreation->setWirelessEnabled(!m_netSwitch->isChecked()); + } + return true; } } @@ -102,6 +112,7 @@ void WlanPage::initWlanUI() m_inactivatedNetListWidget->setPalette(pal); m_settingsLabel->installEventFilter(this); + m_netSwitch->installEventFilter(this); } @@ -110,7 +121,9 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key) if (key == WIRELESS_SWITCH) { m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); qDebug() << LOG_FLAG << "wlan switch state" << m_wlanSwitchEnable; - m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); + + m_netSwitch->setChecked(m_wlanSwitchEnable); + initDeviceCombox(); initWlanArea(); } @@ -118,57 +131,26 @@ void WlanPage::onWlanSwithGsettingsChanged(const QString &key) return; } -/** - * @brief WlanPage::onWlanSwitchClicked 点击无线网开关 - */ -void WlanPage::onWlanSwitchClicked() -{ - if (m_devList.isEmpty()) { - showDesktopNotify(tr("No wireless network card detected"), "networkwrong"); - //检测不到无线网卡不再触发click信号 - m_netSwitch->setSwitchStatus(false); - m_netSwitch->setEnabled(false); - } else { - bool switchEnable = m_netSwitch->getSwitchStatus(); - if (m_wlanSwitchEnable != switchEnable) { - qDebug()<< LOG_FLAG << "wlan switch state " << switchEnable; - m_wirelessConnectOpreation->setWirelessEnabled(switchEnable); - if (!switchEnable) { - m_netSwitch->setEnabled(false); - m_activatedNetFrame->hide(); - m_activatedNetDivider->hide(); - m_inactivatedNetFrame->hide(); - m_deviceFrame->hide(); - } - } - } - - return; -} - void WlanPage::initWlanSwitchState() { - m_wlanSwitchEnable = m_wirelessConnectOpreation->getWirelessEnabled(); - if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA)) { m_switchGsettings = new QGSettings(GSETTINGS_SCHEMA); if (m_switchGsettings->keys().contains(WIRELESS_SWITCH)) { if (m_devList.isEmpty()) { - m_wlanSwitchEnable = false; - m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); - m_netSwitch->setEnabled(false); + m_netSwitch->setCheckable(false); + m_netSwitch->setChecked(false); } else { - m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); + bool wiredGsetting = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); + if (m_wirelessConnectOpreation->getWirelessEnabled() + != wiredGsetting) { + //以gsetting为准 + m_wirelessConnectOpreation->setWirelessEnabled(wiredGsetting); + } + m_netSwitch->setChecked(wiredGsetting); } connect(m_switchGsettings, &QGSettings::changed, this, &WlanPage::onWlanSwithGsettingsChanged); } } - m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); - - - connect(m_netSwitch, &SwitchButton::clicked, this, &WlanPage::onWlanSwitchClicked); - - return; } void WlanPage::initTimer() @@ -200,7 +182,7 @@ void WlanPage::initDeviceCombox() this, &WlanPage::onDeviceComboxIndexChanged); m_deviceComboBox->clear(); - if (m_wlanSwitchEnable) { + if (m_netSwitch->isChecked()) { if (0 == m_devList.count()) { m_deviceFrame->show(); m_tipsLabel->show(); @@ -472,7 +454,7 @@ void WlanPage::constructWirelessNetArea() void WlanPage::initWlanArea() { - if (m_wlanSwitchEnable) { + if (m_netSwitch->isChecked()) { m_activatedNetFrame->show(); m_activatedNetDivider->show(); constructActivateConnectionArea(); @@ -633,7 +615,7 @@ void WlanPage::addDeviceToCombox(QString deviceName) { disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &WlanPage::onDeviceComboxIndexChanged); - if (m_wlanSwitchEnable) { + if (m_netSwitch->isChecked()) { if (m_currentDevice.isEmpty()){ m_deviceFrame->hide(); m_currentDevice = deviceName; @@ -666,9 +648,9 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi } if (m_devList.isEmpty()) { - m_wlanSwitchEnable = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); - m_netSwitch->setEnabled(true); - m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); + bool wlanSwitch = m_switchGsettings->get(WIRELESS_SWITCH).toBool(); + m_netSwitch->setCheckable(true); + m_netSwitch->setChecked(wlanSwitch); } m_devList << deviceName; @@ -687,7 +669,7 @@ void WlanPage::deleteDeviceFromCombox(QString deviceName) disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &WlanPage::onDeviceComboxIndexChanged); - if (m_wlanSwitchEnable) { + if (m_netSwitch->isChecked()) { if (0 == m_devList.count()) { m_deviceFrame->hide(); //m_tipsLabel->show(); @@ -728,9 +710,8 @@ void WlanPage::onDeviceRemove(QString deviceName) deleteDeviceFromCombox(deviceName); if (m_devList.isEmpty()) { - m_wlanSwitchEnable = false; - m_netSwitch->setSwitchStatus(m_wlanSwitchEnable); - m_netSwitch->setEnabled(false); + m_netSwitch->setCheckable(false); + m_netSwitch->setChecked(false); } if (originalDeviceName == deviceName) { @@ -1042,8 +1023,8 @@ void WlanPage::onWifiEnabledChanged(bool isWifiOn) if (m_wlanSwitchEnable == isWifiOn) { return; } else { - if (!m_netSwitch->getEnabled()) { - m_netSwitch->setEnabled(true); + if (!m_netSwitch->isChecked()) { + m_netSwitch->setChecked(true); } m_switchGsettings->set(WIRELESS_SWITCH, isWifiOn); } @@ -1394,12 +1375,13 @@ void WlanPage::setWirelessSwitchEnable(bool enable) if (m_devList.isEmpty()) { qDebug() << "have no device to use " << Q_FUNC_INFO << __LINE__; //检测不到无线网卡不再触发click信号 - m_netSwitch->setSwitchStatus(false); - //m_netSwitch->setEnabled(false); +// m_netSwitch->setSwitchStatus(false); + m_netSwitch->setEnabled(false); }else{ m_wirelessConnectOpreation->setWirelessEnabled(enable); if (!enable) { - m_netSwitch->setEnabled(false); +// m_netSwitch->setEnabled(false); + m_netSwitch->setChecked(false); m_activatedNetFrame->hide(); m_activatedNetDivider->hide(); m_inactivatedNetFrame->hide(); diff --git a/src/frontend/tab-pages/wlanpage.h b/src/frontend/tab-pages/wlanpage.h index 270af216..7eea2d41 100644 --- a/src/frontend/tab-pages/wlanpage.h +++ b/src/frontend/tab-pages/wlanpage.h @@ -93,7 +93,7 @@ private slots: NetworkManager::ActiveConnection::Reason reason); void onItemHeightChanged(const bool isExpanded, const QString &ssid); - void onWlanSwitchClicked(); +// void onWlanSwitchClicked(); void onWlanSwithGsettingsChanged(const QString &key); void onDeviceComboxIndexChanged(int currentIndex); From 5c8ec0e2002fdadca6139c72cf4c1e2990a560f5 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Wed, 18 May 2022 16:19:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?tabpage=E7=BD=91=E7=BB=9C=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=8C=89=E9=92=AE=20=E6=9B=BF=E6=8D=A2=E4=B8=BASDK=20KBorderle?= =?UTF-8?q?ssButton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/tab-pages/lanpage.cpp | 4 ++-- src/frontend/tab-pages/tabpage.cpp | 15 ++++++++++----- src/frontend/tab-pages/tabpage.h | 4 +++- src/frontend/tab-pages/wlanpage.cpp | 4 ++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index e4438791..f8565cab 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -759,7 +759,7 @@ void LanPage::initUI() m_activatedLanListWidget->setPalette(pal); m_inactivatedLanListWidget->setPalette(pal); - m_settingsLabel->installEventFilter(this); + m_settingsBtn->installEventFilter(this); m_netSwitch->installEventFilter(this); } @@ -1172,7 +1172,7 @@ void LanPage::setWiredDeviceEnable(const QString& devName, bool enable) bool LanPage::eventFilter(QObject *watched, QEvent *event) { - if (watched == m_settingsLabel) { + if (watched == m_settingsBtn) { if (event->type() == QEvent::MouseButtonRelease) { onShowControlCenter(); } diff --git a/src/frontend/tab-pages/tabpage.cpp b/src/frontend/tab-pages/tabpage.cpp index 08f540d7..215bd1a0 100644 --- a/src/frontend/tab-pages/tabpage.cpp +++ b/src/frontend/tab-pages/tabpage.cpp @@ -94,12 +94,17 @@ void TabPage::initUI() m_settingsLayout = new QHBoxLayout(m_settingsFrame); m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS); - m_settingsLabel = new KyLable(m_settingsFrame); - m_settingsLabel->setCursor(Qt::PointingHandCursor); - m_settingsLabel->setText(tr("Settings")); - m_settingsLabel->setScaledContents(true); - m_settingsLayout->addWidget(m_settingsLabel); +// m_settingsLabel = new KyLable(m_settingsFrame); +// m_settingsLabel->setCursor(Qt::PointingHandCursor); +// m_settingsLabel->setText(tr("Settings")); +// m_settingsLabel->setScaledContents(true); +// m_settingsLayout->addWidget(m_settingsLabel); + + m_settingsBtn = new KBorderlessButton(m_settingsFrame); + m_settingsBtn->setText(tr("Settings")); + + m_settingsLayout->addWidget(m_settingsBtn); m_settingsLayout->addStretch(); m_settingsFrame->setLayout(m_settingsLayout); diff --git a/src/frontend/tab-pages/tabpage.h b/src/frontend/tab-pages/tabpage.h index 35d4fc3e..fae6f02d 100644 --- a/src/frontend/tab-pages/tabpage.h +++ b/src/frontend/tab-pages/tabpage.h @@ -17,6 +17,7 @@ #include "kylinnetworkdeviceresource.h" #include "kwidget.h" #include "kswitchbutton.h" +#include "kborderlessbutton.h" using namespace kdk; @@ -115,7 +116,8 @@ protected: QFrame * m_settingsFrame = nullptr; QHBoxLayout * m_settingsLayout = nullptr; - KyLable * m_settingsLabel = nullptr; +// KyLable * m_settingsLabel = nullptr; + KBorderlessButton *m_settingsBtn = nullptr; //临时增加的下拉框选择网卡区域 QFrame * m_deviceFrame = nullptr; diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 99be027d..d4559d36 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -59,7 +59,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent) bool WlanPage::eventFilter(QObject *w, QEvent *e) { if (e->type() == QEvent::MouseButtonRelease) { - if (w == m_settingsLabel) { + if (w == m_settingsBtn) { //ZJP_TODO 打开控制面板 qDebug() << LOG_FLAG <<"recive event show control center"; showControlCenter(); @@ -111,7 +111,7 @@ void WlanPage::initWlanUI() m_activatedNetListWidget->setPalette(pal); m_inactivatedNetListWidget->setPalette(pal); - m_settingsLabel->installEventFilter(this); + m_settingsBtn->installEventFilter(this); m_netSwitch->installEventFilter(this); } From 2d7da10991ba743acdef7693ce1c165bef9769a2 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Thu, 19 May 2022 14:58:15 +0800 Subject: [PATCH 4/5] =?UTF-8?q?securitypage/wlistitem=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E6=9B=BF=E6=8D=A2=E4=B8=BASDK=20KPa?= =?UTF-8?q?sswordEdit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/list-items/wlanlistitem.cpp | 65 ++++---- src/frontend/list-items/wlanlistitem.h | 15 +- src/frontend/netdetails/securitypage.cpp | 182 ++++++++++++----------- src/frontend/netdetails/securitypage.h | 25 ++-- src/frontend/tab-pages/lanpage.h | 2 +- src/frontend/tab-pages/tabpage.h | 4 +- 6 files changed, 159 insertions(+), 134 deletions(-) diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index ce6c5fa8..8a516717 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -173,7 +173,7 @@ void WlanListItem::leaveEvent(QEvent *event) bool WlanListItem::eventFilter(QObject *watched, QEvent *event) { - if (watched == m_showPwdButton || watched == m_autoConnectCheckBox) { + if (watched == m_autoConnectCheckBox) { if (event->type() == QEvent::FocusIn) { m_pwdLineEdit->setFocus(); } @@ -229,10 +229,11 @@ void WlanListItem::initWlanUI() m_pwdFrameLyt->setSpacing(FRAME_SPACING); m_pwdFrame->setLayout(m_pwdFrameLyt); - m_pwdLineEdit = new QLineEdit(m_pwdFrame); +// m_pwdLineEdit = new QLineEdit(m_pwdFrame); + m_pwdLineEdit = new KPasswordEdit(m_pwdFrame); m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH); // m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false); - m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu); +// m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu); QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$"); QRegExpValidator *latitude = new QRegExpValidator(rx, this); @@ -241,23 +242,23 @@ void WlanListItem::initWlanUI() m_pwdLineEdit->installEventFilter(this); connect(m_pwdLineEdit, &QLineEdit::textChanged, this, &WlanListItem::onPwdEditorTextChanged); m_pwdLineEdit->setFixedHeight(PWD_AREA_HEIGHT); - m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); - m_pwdLineEdit->setTextMargins(PWD_CONTENT_MARGINS); +// m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); +// m_pwdLineEdit->setTextMargins(PWD_CONTENT_MARGINS); m_pwdFrameLyt->addWidget(m_pwdLineEdit); - m_pwdLineEditLyt = new QHBoxLayout(m_pwdLineEdit); - m_pwdLineEditLyt->setContentsMargins(PWD_LAYOUT_MARGINS); - m_pwdLineEdit->setLayout(m_pwdLineEditLyt); +// m_pwdLineEditLyt = new QHBoxLayout(m_pwdLineEdit); +// m_pwdLineEditLyt->setContentsMargins(PWD_LAYOUT_MARGINS); +// m_pwdLineEdit->setLayout(m_pwdLineEditLyt); - m_showPwdButton = new QPushButton(m_pwdLineEdit); - m_showPwdButton->setFlat(true); //去除边框 - m_showPwdButton->installEventFilter(this); - m_showPwdButton->setFixedSize(SHOW_PWD_BUTTON_SIZE); - m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); - m_showPwdButton->setCursor(Qt::PointingHandCursor); - connect(m_showPwdButton, &QPushButton::clicked, this, &WlanListItem::onShowPwdButtonClicked); - m_pwdLineEditLyt->addStretch(); - m_pwdLineEditLyt->addWidget(m_showPwdButton); +// m_showPwdButton = new QPushButton(m_pwdLineEdit); +// m_showPwdButton->setFlat(true); //去除边框 +// m_showPwdButton->installEventFilter(this); +// m_showPwdButton->setFixedSize(SHOW_PWD_BUTTON_SIZE); +// m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); +// m_showPwdButton->setCursor(Qt::PointingHandCursor); +// connect(m_showPwdButton, &QPushButton::clicked, this, &WlanListItem::onShowPwdButtonClicked); +// m_pwdLineEditLyt->addStretch(); +// m_pwdLineEditLyt->addWidget(m_showPwdButton); m_connectButton = new QPushButton(m_pwdFrame); m_connectButton->setFixedSize(CONNECT_BUTTON_WIDTH, PWD_AREA_HEIGHT); @@ -477,23 +478,23 @@ void WlanListItem::onPwdEditorTextChanged() return; } -void WlanListItem::onShowPwdButtonClicked() -{ - qDebug()<< LOG_FLAG << "onShowPwdButtonClicked"; - if (!m_pwdLineEdit) { - return; - } +//void WlanListItem::onShowPwdButtonClicked() +//{ +// qDebug()<< LOG_FLAG << "onShowPwdButtonClicked"; +// if (!m_pwdLineEdit) { +// return; +// } - if (m_pwdLineEdit->echoMode() == QLineEdit::EchoMode::Password) { - m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic")); - m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Normal); - } else { - m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); - m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); - } +// if (m_pwdLineEdit->echoMode() == QLineEdit::EchoMode::Password) { +// m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic")); +// m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Normal); +// } else { +// m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); +// m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); +// } - return; -} +// return; +//} void WlanListItem::onConnectButtonClicked() { diff --git a/src/frontend/list-items/wlanlistitem.h b/src/frontend/list-items/wlanlistitem.h index 641af74e..4b35922d 100644 --- a/src/frontend/list-items/wlanlistitem.h +++ b/src/frontend/list-items/wlanlistitem.h @@ -12,6 +12,11 @@ #include +#include "kwidget.h" +#include "kpasswordedit.h" + +using namespace kdk; + #define PSK_SETTING_NAME "802-11-wireless-security" #define NORMAL_HEIGHT 48 @@ -74,10 +79,10 @@ private: //密码输入区域的UI QFrame *m_pwdFrame = nullptr; QHBoxLayout *m_pwdFrameLyt = nullptr; - - QLineEdit * m_pwdLineEdit = nullptr; - QHBoxLayout *m_pwdLineEditLyt = nullptr; - QPushButton *m_showPwdButton = nullptr; +// QLineEdit * m_pwdLineEdit = nullptr; + KPasswordEdit *m_pwdLineEdit = nullptr; +// QHBoxLayout *m_pwdLineEditLyt = nullptr; +// QPushButton *m_showPwdButton = nullptr; QPushButton *m_connectButton = nullptr; //自动连接选择区域UI @@ -98,7 +103,7 @@ protected slots: private slots: void onNetButtonClicked(); void onPwdEditorTextChanged(); - void onShowPwdButtonClicked(); +// void onShowPwdButtonClicked(); void onConnectButtonClicked(); void onMenuTriggered(QAction *action); void onEnterpriseWlanDialogClose(bool isShow); diff --git a/src/frontend/netdetails/securitypage.cpp b/src/frontend/netdetails/securitypage.cpp index 70845e28..fe0e6a26 100644 --- a/src/frontend/netdetails/securitypage.cpp +++ b/src/frontend/netdetails/securitypage.cpp @@ -33,7 +33,8 @@ void SecurityPage::initUI() userPwdFlagLabel = new QLabel(this); secuTypeCombox = new QComboBox(this); - pwdEdit = new LineEdit(this); +// pwdEdit = new LineEdit(this); + pwdEdit = new KPasswordEdit(this); eapTypeCombox = new QComboBox(this); //TLS identityEdit = new LineEdit(this); @@ -42,12 +43,14 @@ void SecurityPage::initUI() caNeedBox = new QCheckBox(this); clientCertPathCombox = new QComboBox(this); clientPrivateKeyCombox = new QComboBox(this); - clientPrivateKeyPwdEdit = new LineEdit(this); +// clientPrivateKeyPwdEdit = new LineEdit(this); + clientPrivateKeyPwdEdit = new KPasswordEdit(this); //PEAP && TTLS eapMethodCombox = new QComboBox(this); userNameEdit = new LineEdit(this); - userPwdEdit = new LineEdit(this); +// userPwdEdit = new LineEdit(this); + userPwdEdit = new KPasswordEdit(this); userPwdFlagBox = new QCheckBox(this); @@ -106,59 +109,68 @@ void SecurityPage::initUI() clientPrivateKeyCombox->addItem(tr("None"), QString(tr("None"))); //无 clientPrivateKeyCombox->addItem(tr("Choose from file..."), QString(tr("Choose from file..."))); //从文件中选择... - pwdBox = new QCheckBox(this); - pwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" - "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" - "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); - pwdBox->setCursor(Qt::PointingHandCursor); - pwdBox->setFixedSize(30, pwdEdit->height()); - //防止文本框输入内容位于按钮之下 - QMargins margins = pwdEdit->textMargins(); - pwdEdit->setTextMargins(margins.left(), margins.top(), pwdBox->width(), margins.bottom()); - QHBoxLayout *pPwdLayout = new QHBoxLayout(); - pPwdLayout->addStretch(); - pPwdLayout->addWidget(pwdBox); - pPwdLayout->setSpacing(0); - pPwdLayout->setContentsMargins(0, 0, 0, 0); - pwdEdit->setLayout(pPwdLayout); - pwdEdit->setEchoMode(QLineEdit::Password); + //禁用ClearBtn按钮 + pwdEdit->setClearButtonEnabled(false); + clientPrivateKeyPwdEdit->setClearButtonEnabled(false); + userPwdEdit->setClearButtonEnabled(false); +// pwdEdit->setClearBtnVisible(false); //隐藏ClearBtn按钮(启用但隐藏) +// clientPrivateKeyPwdEdit->setClearBtnVisible(false); +// userPwdEdit->setClearBtnVisible(false); - userPwdBox = new QCheckBox(this); - userPwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" - "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" - "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); - userPwdBox->setCursor(Qt::PointingHandCursor); - userPwdBox->setFixedSize(30, userPwdEdit->height()); - userPwdBox->setFocusPolicy(Qt::NoFocus); - //防止文本框输入内容位于按钮之下 - userPwdEdit->setTextMargins(margins.left(), margins.top(), userPwdBox->width(), margins.bottom()); - QHBoxLayout *puserPwdLayout = new QHBoxLayout(); - puserPwdLayout->addStretch(); - puserPwdLayout->addWidget(userPwdBox); - puserPwdLayout->setSpacing(0); - puserPwdLayout->setContentsMargins(0, 0, 0, 0); - userPwdEdit->setLayout(puserPwdLayout); - userPwdEdit->setEchoMode(QLineEdit::Password); +// pwdBox = new QCheckBox(this); +// pwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" +// "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" +// "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); +// pwdBox->setCursor(Qt::PointingHandCursor); +// pwdBox->setFixedSize(30, pwdEdit->height()); - privateKeyBox = new QCheckBox(this); - privateKeyBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" - "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" - "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); - privateKeyBox->setCursor(Qt::PointingHandCursor); - privateKeyBox->setFixedSize(30, clientPrivateKeyPwdEdit->height()); //防止文本框输入内容位于按钮之下 - clientPrivateKeyPwdEdit->setTextMargins(margins.left(), margins.top(), privateKeyBox->width(), margins.bottom()); - QHBoxLayout *pPrivateKeyPwdLayout = new QHBoxLayout(); - pPrivateKeyPwdLayout->addStretch(); - pPrivateKeyPwdLayout->addWidget(privateKeyBox); - pPrivateKeyPwdLayout->setSpacing(0); - pPrivateKeyPwdLayout->setContentsMargins(0, 0, 0, 0); - clientPrivateKeyPwdEdit->setLayout(pPrivateKeyPwdLayout); - clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); +// QMargins margins = pwdEdit->textMargins(); +// pwdEdit->setTextMargins(margins.left(), margins.top(), pwdBox->width(), margins.bottom()); +// QHBoxLayout *pPwdLayout = new QHBoxLayout(); +// pPwdLayout->addStretch(); +// pPwdLayout->addWidget(pwdBox); +// pPwdLayout->setSpacing(0); +// pPwdLayout->setContentsMargins(0, 0, 0, 0); +// pwdEdit->setLayout(pPwdLayout); +// pwdEdit->setEchoMode(QLineEdit::Password); - pwdEdit->setContextMenuPolicy(Qt::NoContextMenu); - clientPrivateKeyPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); - userPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); +// userPwdBox = new QCheckBox(this); +// userPwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" +// "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" +// "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); +// userPwdBox->setCursor(Qt::PointingHandCursor); +// userPwdBox->setFixedSize(30, userPwdEdit->height()); +// userPwdBox->setFocusPolicy(Qt::NoFocus); +// //防止文本框输入内容位于按钮之下 +// userPwdEdit->setTextMargins(margins.left(), margins.top(), userPwdBox->width(), margins.bottom()); +// QHBoxLayout *puserPwdLayout = new QHBoxLayout(); +// puserPwdLayout->addStretch(); +// puserPwdLayout->addWidget(userPwdBox); +// puserPwdLayout->setSpacing(0); +// puserPwdLayout->setContentsMargins(0, 0, 0, 0); +// userPwdEdit->setLayout(puserPwdLayout); +// userPwdEdit->setEchoMode(QLineEdit::Password); + +// privateKeyBox = new QCheckBox(this); +// privateKeyBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" +// "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" +// "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); +// privateKeyBox->setCursor(Qt::PointingHandCursor); +// privateKeyBox->setFixedSize(30, clientPrivateKeyPwdEdit->height()); + //防止文本框输入内容位于按钮之下 +// clientPrivateKeyPwdEdit->setTextMargins(margins.left(), margins.top(), privateKeyBox->width(), margins.bottom()); +// QHBoxLayout *pPrivateKeyPwdLayout = new QHBoxLayout(); +// pPrivateKeyPwdLayout->addStretch(); +// pPrivateKeyPwdLayout->addWidget(privateKeyBox); +// pPrivateKeyPwdLayout->setSpacing(0); +// pPrivateKeyPwdLayout->setContentsMargins(0, 0, 0, 0); +// clientPrivateKeyPwdEdit->setLayout(pPrivateKeyPwdLayout); +// clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); + +// pwdEdit->setContextMenuPolicy(Qt::NoContextMenu); +// clientPrivateKeyPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); +// userPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$"); QRegExpValidator *latitude = new QRegExpValidator(rx, this); @@ -180,9 +192,9 @@ void SecurityPage::initConnect() connect(caNeedBox, &QCheckBox::clicked, this, &SecurityPage::onCaNeedBoxClicked); - connect(pwdBox, &QCheckBox::clicked, this, &SecurityPage::onPwdBoxClicked); - connect(userPwdBox, &QCheckBox::clicked, this, &SecurityPage::onUserPwdBox); - connect(privateKeyBox, &QCheckBox::clicked, this, &SecurityPage::onPrivateKeyBoxClicked); +// connect(pwdBox, &QCheckBox::clicked, this, &SecurityPage::onPwdBoxClicked); +// connect(userPwdBox, &QCheckBox::clicked, this, &SecurityPage::onUserPwdBox); +// connect(privateKeyBox, &QCheckBox::clicked, this, &SecurityPage::onPrivateKeyBoxClicked); connect(caCertPathCombox, static_cast(&QComboBox::currentIndexChanged), this, &SecurityPage::onCaCertPathComboxIndexChanged); @@ -731,39 +743,39 @@ void SecurityPage::onCaNeedBoxClicked() } } -void SecurityPage::onPwdBoxClicked() -{ - if (pwdEdit->echoMode() == QLineEdit::Password) { - pwdBox->setChecked(true); - pwdEdit->setEchoMode(QLineEdit::Normal); - } else { - pwdBox->setChecked(false); - pwdEdit->setEchoMode(QLineEdit::Password); - } -} +//void SecurityPage::onPwdBoxClicked() +//{ +// if (pwdEdit->echoMode() == QLineEdit::Password) { +// pwdBox->setChecked(true); +// pwdEdit->setEchoMode(QLineEdit::Normal); +// } else { +// pwdBox->setChecked(false); +// pwdEdit->setEchoMode(QLineEdit::Password); +// } +//} -void SecurityPage::onUserPwdBox() -{ - if (userPwdEdit->echoMode() == QLineEdit::Password) { - userPwdBox->setChecked(true); - userPwdEdit->setEchoMode(QLineEdit::Normal); - } else { - userPwdBox->setChecked(false); - userPwdEdit->setEchoMode(QLineEdit::Password); - } +//void SecurityPage::onUserPwdBox() +//{ +// if (userPwdEdit->echoMode() == QLineEdit::Password) { +// userPwdBox->setChecked(true); +// userPwdEdit->setEchoMode(QLineEdit::Normal); +// } else { +// userPwdBox->setChecked(false); +// userPwdEdit->setEchoMode(QLineEdit::Password); +// } -} +//} -void SecurityPage::onPrivateKeyBoxClicked() -{ - if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) { - privateKeyBox->setChecked(true); - clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal); - } else { - privateKeyBox->setChecked(false); - clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); - } -} +//void SecurityPage::onPrivateKeyBoxClicked() +//{ +// if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) { +// privateKeyBox->setChecked(true); +// clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal); +// } else { +// privateKeyBox->setChecked(false); +// clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); +// } +//} void SecurityPage::onCaCertPathComboxIndexChanged(QString str) { diff --git a/src/frontend/netdetails/securitypage.h b/src/frontend/netdetails/securitypage.h index 462b920d..c14121cb 100644 --- a/src/frontend/netdetails/securitypage.h +++ b/src/frontend/netdetails/securitypage.h @@ -9,6 +9,10 @@ #include #include "coninfo.h" +#include "kwidget.h" +#include "kpasswordedit.h" + +using namespace kdk; class SecurityPage : public QFrame { @@ -56,7 +60,8 @@ private: QLabel *userPwdFlagLabel; QComboBox *secuTypeCombox; - LineEdit *pwdEdit; +// LineEdit *pwdEdit; + KPasswordEdit *pwdEdit = nullptr; QComboBox *eapTypeCombox; //TLS LineEdit *identityEdit; @@ -65,17 +70,19 @@ private: QCheckBox *caNeedBox; QComboBox *clientCertPathCombox; QComboBox *clientPrivateKeyCombox; - LineEdit *clientPrivateKeyPwdEdit; +// LineEdit *clientPrivateKeyPwdEdit; + KPasswordEdit *clientPrivateKeyPwdEdit = nullptr; //PEAP && TTLS QComboBox *eapMethodCombox; LineEdit *userNameEdit; - LineEdit *userPwdEdit; +// LineEdit *userPwdEdit; + KPasswordEdit *userPwdEdit = nullptr; QCheckBox *userPwdFlagBox; - QCheckBox *pwdBox; - QCheckBox *userPwdBox; - QCheckBox *privateKeyBox; +// QCheckBox *pwdBox; +// QCheckBox *userPwdBox; +// QCheckBox *privateKeyBox; void showNone(); void showPsk(); @@ -97,9 +104,9 @@ private slots: void setEnableOfSaveBtn(); void onCaNeedBoxClicked(); - void onPwdBoxClicked(); - void onUserPwdBox(); - void onPrivateKeyBoxClicked(); +// void onPwdBoxClicked(); +// void onUserPwdBox(); +// void onPrivateKeyBoxClicked(); void onCaCertPathComboxIndexChanged(QString str); void onClientCertPathComboxIndexChanged(QString str); diff --git a/src/frontend/tab-pages/lanpage.h b/src/frontend/tab-pages/lanpage.h index 613be83a..4c88ac59 100644 --- a/src/frontend/tab-pages/lanpage.h +++ b/src/frontend/tab-pages/lanpage.h @@ -2,7 +2,7 @@ #define LANPAGE_H #include "divider.h" -#include "switchbutton.h" +//#include "switchbutton.h" #include #include #include diff --git a/src/frontend/tab-pages/tabpage.h b/src/frontend/tab-pages/tabpage.h index fae6f02d..bb43da1a 100644 --- a/src/frontend/tab-pages/tabpage.h +++ b/src/frontend/tab-pages/tabpage.h @@ -2,8 +2,8 @@ #define TABPAGE_H #include "divider.h" -#include "switchbutton.h" -#include "kylable.h" +//#include "switchbutton.h" +//#include "kylable.h" #include #include #include From 1c83d0aea34261b3189748c481eebe120eb3c309 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Thu, 19 May 2022 15:39:04 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=B7=B2=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E7=BB=84=E4=BB=B6=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/list-items/wlanlistitem.cpp | 36 +-------- src/frontend/list-items/wlanlistitem.h | 4 - src/frontend/netdetails/netdetail.cpp | 59 +------------- src/frontend/netdetails/netdetail.h | 7 -- src/frontend/netdetails/securitypage.cpp | 99 ------------------------ src/frontend/netdetails/securitypage.h | 10 --- src/frontend/tab-pages/lanpage.cpp | 2 - src/frontend/tab-pages/lanpage.h | 1 - src/frontend/tab-pages/tabpage.cpp | 6 -- src/frontend/tab-pages/tabpage.h | 5 -- src/frontend/tab-pages/wlanpage.h | 1 - 11 files changed, 3 insertions(+), 227 deletions(-) diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 8a516717..ad98aeaf 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -229,9 +229,9 @@ void WlanListItem::initWlanUI() m_pwdFrameLyt->setSpacing(FRAME_SPACING); m_pwdFrame->setLayout(m_pwdFrameLyt); -// m_pwdLineEdit = new QLineEdit(m_pwdFrame); m_pwdLineEdit = new KPasswordEdit(m_pwdFrame); m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH); + m_pwdLineEdit->setClearButtonEnabled(false); //禁用ClearBtn按钮 // m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false); // m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu); @@ -242,24 +242,8 @@ void WlanListItem::initWlanUI() m_pwdLineEdit->installEventFilter(this); connect(m_pwdLineEdit, &QLineEdit::textChanged, this, &WlanListItem::onPwdEditorTextChanged); m_pwdLineEdit->setFixedHeight(PWD_AREA_HEIGHT); -// m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); -// m_pwdLineEdit->setTextMargins(PWD_CONTENT_MARGINS); m_pwdFrameLyt->addWidget(m_pwdLineEdit); -// m_pwdLineEditLyt = new QHBoxLayout(m_pwdLineEdit); -// m_pwdLineEditLyt->setContentsMargins(PWD_LAYOUT_MARGINS); -// m_pwdLineEdit->setLayout(m_pwdLineEditLyt); - -// m_showPwdButton = new QPushButton(m_pwdLineEdit); -// m_showPwdButton->setFlat(true); //去除边框 -// m_showPwdButton->installEventFilter(this); -// m_showPwdButton->setFixedSize(SHOW_PWD_BUTTON_SIZE); -// m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); -// m_showPwdButton->setCursor(Qt::PointingHandCursor); -// connect(m_showPwdButton, &QPushButton::clicked, this, &WlanListItem::onShowPwdButtonClicked); -// m_pwdLineEditLyt->addStretch(); -// m_pwdLineEditLyt->addWidget(m_showPwdButton); - m_connectButton = new QPushButton(m_pwdFrame); m_connectButton->setFixedSize(CONNECT_BUTTON_WIDTH, PWD_AREA_HEIGHT); m_connectButton->setText(tr("Connect")); @@ -478,24 +462,6 @@ void WlanListItem::onPwdEditorTextChanged() return; } -//void WlanListItem::onShowPwdButtonClicked() -//{ -// qDebug()<< LOG_FLAG << "onShowPwdButtonClicked"; -// if (!m_pwdLineEdit) { -// return; -// } - -// if (m_pwdLineEdit->echoMode() == QLineEdit::EchoMode::Password) { -// m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic")); -// m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Normal); -// } else { -// m_showPwdButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); -// m_pwdLineEdit->setEchoMode(QLineEdit::EchoMode::Password); -// } - -// return; -//} - void WlanListItem::onConnectButtonClicked() { qDebug()<< LOG_FLAG << "onConnectButtonClicked"; diff --git a/src/frontend/list-items/wlanlistitem.h b/src/frontend/list-items/wlanlistitem.h index 4b35922d..66113a71 100644 --- a/src/frontend/list-items/wlanlistitem.h +++ b/src/frontend/list-items/wlanlistitem.h @@ -79,10 +79,7 @@ private: //密码输入区域的UI QFrame *m_pwdFrame = nullptr; QHBoxLayout *m_pwdFrameLyt = nullptr; -// QLineEdit * m_pwdLineEdit = nullptr; KPasswordEdit *m_pwdLineEdit = nullptr; -// QHBoxLayout *m_pwdLineEditLyt = nullptr; -// QPushButton *m_showPwdButton = nullptr; QPushButton *m_connectButton = nullptr; //自动连接选择区域UI @@ -103,7 +100,6 @@ protected slots: private slots: void onNetButtonClicked(); void onPwdEditorTextChanged(); -// void onShowPwdButtonClicked(); void onConnectButtonClicked(); void onMenuTriggered(QAction *action); void onEnterpriseWlanDialogClose(bool isShow); diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 74f3cf65..58db2e0d 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -230,40 +230,6 @@ void NetDetail::initUI() QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame); pageLayout->setSpacing(PAGE_LAYOUT_SPACING); -#if 0 - detailBtn = new QPushButton(this); - detailBtn->setText(tr("Detail")); - detailBtn->setCheckable(true); - detailBtn->setChecked(true); - - ipv4Btn = new QPushButton(this); - ipv4Btn->setText(tr("Ipv4")); - ipv4Btn->setCheckable(true); - - ipv6Btn = new QPushButton(this); - ipv6Btn->setText(tr("Ipv6")); - ipv6Btn->setCheckable(true); - - securityBtn = new QPushButton(this); - securityBtn->setText(tr("Security")); - securityBtn->setCheckable(true); - - m_group = new QButtonGroup(this); - m_group->addButton(detailBtn); - m_group->addButton(ipv4Btn); - m_group->addButton(ipv6Btn); - if (isWlan) { - m_group->addButton(securityBtn); - } - - pageLayout->addStretch(); - pageLayout->addWidget(detailBtn); - pageLayout->addWidget(ipv4Btn); - pageLayout->addWidget(ipv6Btn); - pageLayout->addWidget(securityBtn); - pageLayout->addStretch(); -#endif - // TabBar m_netTabBar = new KTabBar(KTabBarStyle::SegmentDark, this); m_netTabBar->addTab(tr("Detail")); //详情 @@ -312,7 +278,7 @@ void NetDetail::initUI() // pal.setColor(QPalette::Background, qApp->palette().base().color()); this->setAutoFillBackground(true); // this->setPalette(pal); - onPaletteChanged(); + onPaletteChanged(); } void NetDetail::loadPage() @@ -325,16 +291,6 @@ void NetDetail::loadPage() } else { stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); this->setWindowTitle(m_name); -#if 0 - if (!isWlan) { - securityBtn->hide(); - } else { - securityBtn->show(); - if (m_name.isEmpty()) { - this->setWindowTitle(tr("connect hiddin wlan")); - } - } -#endif if (isWlan && m_name.isEmpty()) { this->setWindowTitle(tr("connect hiddin wlan")); } @@ -346,18 +302,7 @@ void NetDetail::initComponent() connect(cancelBtn, &QPushButton::clicked, this, [=] { close(); }); -// connect(detailBtn, &QPushButton::clicked, this, [=] { -// stackWidget->setCurrentIndex(DETAIL_PAGE_NUM); -// }); -// connect(ipv4Btn, &QPushButton::clicked, this, [=] { -// stackWidget->setCurrentIndex(IPV4_PAGE_NUM); -// }); -// connect(ipv6Btn, &QPushButton::clicked, this, [=] { -// stackWidget->setCurrentIndex(IPV6_PAGE_NUM); -// }); -// connect(securityBtn, &QPushButton::clicked, this, [=] { -// stackWidget->setCurrentIndex(SECURITY_PAGE_NUM); -// }); + connect(confimBtn, SIGNAL(clicked()), this, SLOT(on_btnConfirm_clicked())); if (isWlan && !m_uuid.isEmpty()) { forgetBtn->show(); diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 7a194cfd..5e99a72a 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include @@ -104,10 +103,6 @@ private: QPushButton * forgetBtn; QPushButton * confimBtn; -// QPushButton * detailBtn; -// QPushButton * ipv4Btn; -// QPushButton * ipv6Btn; -// QPushButton * securityBtn; QFrame * pageFrame; KTabBar *m_netTabBar = nullptr; @@ -129,8 +124,6 @@ private: ConInfo m_info; - QButtonGroup *m_group; - private slots: void on_btnConfirm_clicked(); void on_btnForget_clicked(); diff --git a/src/frontend/netdetails/securitypage.cpp b/src/frontend/netdetails/securitypage.cpp index fe0e6a26..7be9f4eb 100644 --- a/src/frontend/netdetails/securitypage.cpp +++ b/src/frontend/netdetails/securitypage.cpp @@ -33,7 +33,6 @@ void SecurityPage::initUI() userPwdFlagLabel = new QLabel(this); secuTypeCombox = new QComboBox(this); -// pwdEdit = new LineEdit(this); pwdEdit = new KPasswordEdit(this); eapTypeCombox = new QComboBox(this); //TLS @@ -43,13 +42,11 @@ void SecurityPage::initUI() caNeedBox = new QCheckBox(this); clientCertPathCombox = new QComboBox(this); clientPrivateKeyCombox = new QComboBox(this); -// clientPrivateKeyPwdEdit = new LineEdit(this); clientPrivateKeyPwdEdit = new KPasswordEdit(this); //PEAP && TTLS eapMethodCombox = new QComboBox(this); userNameEdit = new LineEdit(this); -// userPwdEdit = new LineEdit(this); userPwdEdit = new KPasswordEdit(this); userPwdFlagBox = new QCheckBox(this); @@ -113,64 +110,6 @@ void SecurityPage::initUI() pwdEdit->setClearButtonEnabled(false); clientPrivateKeyPwdEdit->setClearButtonEnabled(false); userPwdEdit->setClearButtonEnabled(false); -// pwdEdit->setClearBtnVisible(false); //隐藏ClearBtn按钮(启用但隐藏) -// clientPrivateKeyPwdEdit->setClearBtnVisible(false); -// userPwdEdit->setClearBtnVisible(false); - -// pwdBox = new QCheckBox(this); -// pwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" -// "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" -// "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); -// pwdBox->setCursor(Qt::PointingHandCursor); -// pwdBox->setFixedSize(30, pwdEdit->height()); - - //防止文本框输入内容位于按钮之下 -// QMargins margins = pwdEdit->textMargins(); -// pwdEdit->setTextMargins(margins.left(), margins.top(), pwdBox->width(), margins.bottom()); -// QHBoxLayout *pPwdLayout = new QHBoxLayout(); -// pPwdLayout->addStretch(); -// pPwdLayout->addWidget(pwdBox); -// pPwdLayout->setSpacing(0); -// pPwdLayout->setContentsMargins(0, 0, 0, 0); -// pwdEdit->setLayout(pPwdLayout); -// pwdEdit->setEchoMode(QLineEdit::Password); - -// userPwdBox = new QCheckBox(this); -// userPwdBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" -// "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" -// "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); -// userPwdBox->setCursor(Qt::PointingHandCursor); -// userPwdBox->setFixedSize(30, userPwdEdit->height()); -// userPwdBox->setFocusPolicy(Qt::NoFocus); -// //防止文本框输入内容位于按钮之下 -// userPwdEdit->setTextMargins(margins.left(), margins.top(), userPwdBox->width(), margins.bottom()); -// QHBoxLayout *puserPwdLayout = new QHBoxLayout(); -// puserPwdLayout->addStretch(); -// puserPwdLayout->addWidget(userPwdBox); -// puserPwdLayout->setSpacing(0); -// puserPwdLayout->setContentsMargins(0, 0, 0, 0); -// userPwdEdit->setLayout(puserPwdLayout); -// userPwdEdit->setEchoMode(QLineEdit::Password); - -// privateKeyBox = new QCheckBox(this); -// privateKeyBox->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}" -// "QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}" -// "QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}"); -// privateKeyBox->setCursor(Qt::PointingHandCursor); -// privateKeyBox->setFixedSize(30, clientPrivateKeyPwdEdit->height()); - //防止文本框输入内容位于按钮之下 -// clientPrivateKeyPwdEdit->setTextMargins(margins.left(), margins.top(), privateKeyBox->width(), margins.bottom()); -// QHBoxLayout *pPrivateKeyPwdLayout = new QHBoxLayout(); -// pPrivateKeyPwdLayout->addStretch(); -// pPrivateKeyPwdLayout->addWidget(privateKeyBox); -// pPrivateKeyPwdLayout->setSpacing(0); -// pPrivateKeyPwdLayout->setContentsMargins(0, 0, 0, 0); -// clientPrivateKeyPwdEdit->setLayout(pPrivateKeyPwdLayout); -// clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); - -// pwdEdit->setContextMenuPolicy(Qt::NoContextMenu); -// clientPrivateKeyPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); -// userPwdEdit->setContextMenuPolicy(Qt::NoContextMenu); QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$"); QRegExpValidator *latitude = new QRegExpValidator(rx, this); @@ -192,10 +131,6 @@ void SecurityPage::initConnect() connect(caNeedBox, &QCheckBox::clicked, this, &SecurityPage::onCaNeedBoxClicked); -// connect(pwdBox, &QCheckBox::clicked, this, &SecurityPage::onPwdBoxClicked); -// connect(userPwdBox, &QCheckBox::clicked, this, &SecurityPage::onUserPwdBox); -// connect(privateKeyBox, &QCheckBox::clicked, this, &SecurityPage::onPrivateKeyBoxClicked); - connect(caCertPathCombox, static_cast(&QComboBox::currentIndexChanged), this, &SecurityPage::onCaCertPathComboxIndexChanged); @@ -743,40 +678,6 @@ void SecurityPage::onCaNeedBoxClicked() } } -//void SecurityPage::onPwdBoxClicked() -//{ -// if (pwdEdit->echoMode() == QLineEdit::Password) { -// pwdBox->setChecked(true); -// pwdEdit->setEchoMode(QLineEdit::Normal); -// } else { -// pwdBox->setChecked(false); -// pwdEdit->setEchoMode(QLineEdit::Password); -// } -//} - -//void SecurityPage::onUserPwdBox() -//{ -// if (userPwdEdit->echoMode() == QLineEdit::Password) { -// userPwdBox->setChecked(true); -// userPwdEdit->setEchoMode(QLineEdit::Normal); -// } else { -// userPwdBox->setChecked(false); -// userPwdEdit->setEchoMode(QLineEdit::Password); -// } - -//} - -//void SecurityPage::onPrivateKeyBoxClicked() -//{ -// if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) { -// privateKeyBox->setChecked(true); -// clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal); -// } else { -// privateKeyBox->setChecked(false); -// clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password); -// } -//} - void SecurityPage::onCaCertPathComboxIndexChanged(QString str) { if (str.contains("Choose from file...") || str.contains("从文件选择...")) diff --git a/src/frontend/netdetails/securitypage.h b/src/frontend/netdetails/securitypage.h index c14121cb..e3aaee4a 100644 --- a/src/frontend/netdetails/securitypage.h +++ b/src/frontend/netdetails/securitypage.h @@ -60,7 +60,6 @@ private: QLabel *userPwdFlagLabel; QComboBox *secuTypeCombox; -// LineEdit *pwdEdit; KPasswordEdit *pwdEdit = nullptr; QComboBox *eapTypeCombox; //TLS @@ -70,20 +69,14 @@ private: QCheckBox *caNeedBox; QComboBox *clientCertPathCombox; QComboBox *clientPrivateKeyCombox; -// LineEdit *clientPrivateKeyPwdEdit; KPasswordEdit *clientPrivateKeyPwdEdit = nullptr; //PEAP && TTLS QComboBox *eapMethodCombox; LineEdit *userNameEdit; -// LineEdit *userPwdEdit; KPasswordEdit *userPwdEdit = nullptr; QCheckBox *userPwdFlagBox; -// QCheckBox *pwdBox; -// QCheckBox *userPwdBox; -// QCheckBox *privateKeyBox; - void showNone(); void showPsk(); void showTls(); @@ -104,9 +97,6 @@ private slots: void setEnableOfSaveBtn(); void onCaNeedBoxClicked(); -// void onPwdBoxClicked(); -// void onUserPwdBox(); -// void onPrivateKeyBoxClicked(); void onCaCertPathComboxIndexChanged(QString str); void onClientCertPathComboxIndexChanged(QString str); diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index f8565cab..ea206b3b 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -1188,10 +1188,8 @@ bool LanPage::eventFilter(QObject *watched, QEvent *event) } else { m_netSwitch->setCheckable(true); if (m_netSwitch->isChecked()) { -// qDebug() << "[wiredSwitch]set true after clicked"; m_switchGsettings->set(WIRED_SWITCH, false); } else { -// qDebug() << "[wiredSwitch]set false after clicked"; m_switchGsettings->set(WIRED_SWITCH,true); } } diff --git a/src/frontend/tab-pages/lanpage.h b/src/frontend/tab-pages/lanpage.h index 4c88ac59..928a823e 100644 --- a/src/frontend/tab-pages/lanpage.h +++ b/src/frontend/tab-pages/lanpage.h @@ -2,7 +2,6 @@ #define LANPAGE_H #include "divider.h" -//#include "switchbutton.h" #include #include #include diff --git a/src/frontend/tab-pages/tabpage.cpp b/src/frontend/tab-pages/tabpage.cpp index 215bd1a0..e32f3fb9 100644 --- a/src/frontend/tab-pages/tabpage.cpp +++ b/src/frontend/tab-pages/tabpage.cpp @@ -95,12 +95,6 @@ void TabPage::initUI() m_settingsLayout = new QHBoxLayout(m_settingsFrame); m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS); -// m_settingsLabel = new KyLable(m_settingsFrame); -// m_settingsLabel->setCursor(Qt::PointingHandCursor); -// m_settingsLabel->setText(tr("Settings")); -// m_settingsLabel->setScaledContents(true); -// m_settingsLayout->addWidget(m_settingsLabel); - m_settingsBtn = new KBorderlessButton(m_settingsFrame); m_settingsBtn->setText(tr("Settings")); diff --git a/src/frontend/tab-pages/tabpage.h b/src/frontend/tab-pages/tabpage.h index bb43da1a..60d6319f 100644 --- a/src/frontend/tab-pages/tabpage.h +++ b/src/frontend/tab-pages/tabpage.h @@ -2,8 +2,6 @@ #define TABPAGE_H #include "divider.h" -//#include "switchbutton.h" -//#include "kylable.h" #include #include #include @@ -116,7 +114,6 @@ protected: QFrame * m_settingsFrame = nullptr; QHBoxLayout * m_settingsLayout = nullptr; -// KyLable * m_settingsLabel = nullptr; KBorderlessButton *m_settingsBtn = nullptr; //临时增加的下拉框选择网卡区域 @@ -126,8 +123,6 @@ protected: QComboBox * m_deviceComboBox = nullptr; QLabel * m_tipsLabel = nullptr; - - public slots: virtual void onDeviceComboxIndexChanged(int currentIndex) = 0; void onPaletteChanged(); diff --git a/src/frontend/tab-pages/wlanpage.h b/src/frontend/tab-pages/wlanpage.h index 7eea2d41..b4cf4f88 100644 --- a/src/frontend/tab-pages/wlanpage.h +++ b/src/frontend/tab-pages/wlanpage.h @@ -93,7 +93,6 @@ private slots: NetworkManager::ActiveConnection::Reason reason); void onItemHeightChanged(const bool isExpanded, const QString &ssid); -// void onWlanSwitchClicked(); void onWlanSwithGsettingsChanged(const QString &key); void onDeviceComboxIndexChanged(int currentIndex);