Merge branch 'dbus-interface' of http://gitlab2.kylin.com/kylin-desktop/kylin-nm into optimize-notification

This commit is contained in:
zhangyuanyuan1 2022-08-09 15:12:51 +08:00
commit 9b1d007ea0
9 changed files with 107 additions and 31 deletions

View File

@ -24,8 +24,9 @@
#define ITEM_HEIGHT 36
#define ITEM_MARGINS 18,0,16,0
#define MAX_LABEL_WIDTH 138
#define MIN_LABEL_WIDTH 150
#define MAX_LABEL_WIDTH 154
#define MAX_WIDGET_WIDTH 270
FixLabel::FixLabel(QWidget *parent) :
QLabel(parent)
@ -83,6 +84,7 @@ void DetailWidget::initUI()
m_mainLayout->setContentsMargins(ITEM_MARGINS);
m_keyLabel = new FixLabel(this);
m_keyLabel->setMinimumWidth(MIN_LABEL_WIDTH);
m_keyLabel->setMaximumWidth(MAX_LABEL_WIDTH);
m_keyLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
@ -94,13 +96,10 @@ void DetailWidget::initUI()
m_mainLayout->addWidget(m_copyButton);
}
m_mainLayout->addWidget(m_valueWidget);
m_valueWidget->setMaximumWidth(100000000000);
m_valueWidget->setMaximumWidth(MAX_WIDGET_WIDTH);
}
void DetailWidget::setKey(const QString &keyLabel)
{
m_keyLabel->setText(keyLabel);
m_keyLabel->setLabelText(keyLabel);
}

View File

@ -69,7 +69,8 @@ void JoinHiddenWiFiPage::initUI()
m_secuWidget->setSecurity(KySecuType::WPA_AND_WPA2_PERSONAL);
m_descriptionLabel = new QLabel(this);
m_nameLabel = new QLabel(this);
m_nameLabel = new FixLabel(this);
m_nameLabel->setFixedWidth(LABEL_MIN_WIDTH);
m_nameEdit =new LineEdit(this);
m_emptyLabel = new QLabel(this);
@ -143,7 +144,7 @@ void JoinHiddenWiFiPage::initUI()
QFont font = m_descriptionLabel->font();
font.setWeight(75);
m_descriptionLabel->setFont(font);
m_nameLabel->setText(tr("Network name(SSID)")); //网络名(SSID)
m_nameLabel->setLabelText(tr("Network name(SSID)")); //网络名(SSID)
m_checkLabel->setText(tr("Remember the Network")); //记住该网络
m_showListBtn->setText(tr("Show Network List")); //显示网络列表
m_cancelBtn->setText(tr("Cancel"));

View File

@ -62,7 +62,7 @@ private:
SecurityPage *m_secuWidget;
QLabel *m_descriptionLabel;
QLabel *m_nameLabel;
FixLabel *m_nameLabel;
LineEdit *m_nameEdit;
QLabel *m_emptyLabel;

View File

@ -37,7 +37,8 @@
#define WINDOW_HEIGHT 602
#define ICON_SIZE 22,22
#define TITLE_LAYOUT_MARGINS 9,9,0,0
#define LAYOUT_MARGINS 0,0,0,0
#define CENTER_LAYOUT_MARGINS 24,0,0,0
#define BOTTOM_LAYOUT_MARGINS 24,0,24,0
#define BOTTOM_LAYOUT_SPACING 16
#define PAGE_LAYOUT_SPACING 1
#define DETAIL_PAGE_NUM 0
@ -49,6 +50,9 @@
#define PAGE_MIN_HEIGHT 40
#define LAN_TAB_WIDTH 180
#define WLAN_TAB_WIDTH 240
#define SCRO_WIDTH 472
#define PEAP_SCRO_HEIGHT 300
#define TLS_SCRO_HEIGHT 480
//extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
@ -163,7 +167,7 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
getConInfo(m_info);
startObjectThread();
pagePadding(name,isWlan);
setSecuPageHeight();
connect(qApp, &QApplication::paletteChanged, this, &NetDetail::onPaletteChanged);
isCreateOk = !(m_isCreateNet && !isWlan);
@ -279,7 +283,8 @@ void NetDetail::centerToScreen()
void NetDetail::initUI()
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(24,9,24,24);
mainLayout->setContentsMargins(0,9,0,24);
mainLayout->setSpacing(24);
detailPage = new DetailPage(isWlan, m_name.isEmpty(), this);
@ -294,11 +299,25 @@ void NetDetail::initUI()
centerWidget = new QWidget(this);
bottomWidget = new QWidget(this);
m_secuPageScrollArea = new QScrollArea(this);
m_secuPageScrollArea->setFrameShape(QFrame::NoFrame);
m_secuPageScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_secuPageScrollArea->setWidget(securityPage);
QPalette pal = m_secuPageScrollArea->palette();
pal.setBrush(QPalette::Window, Qt::transparent);
m_secuPageScrollArea->setPalette(pal);
detailPage->setFixedWidth(SCRO_WIDTH);
ipv4Page->setFixedWidth(SCRO_WIDTH);
ipv6Page->setFixedWidth(SCRO_WIDTH);
createNetPage->setFixedWidth(SCRO_WIDTH);
configPage->setFixedWidth(SCRO_WIDTH);
stackWidget = new QStackedWidget(centerWidget);
stackWidget->addWidget(detailPage);
stackWidget->addWidget(ipv4Page);
stackWidget->addWidget(ipv6Page);
stackWidget->addWidget(securityPage);
stackWidget->addWidget(m_secuPageScrollArea);
stackWidget->addWidget(configPage);
stackWidget->addWidget(createNetPage);
@ -355,13 +374,13 @@ void NetDetail::initUI()
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
QVBoxLayout *centerlayout = new QVBoxLayout(centerWidget);
centerlayout->setContentsMargins(LAYOUT_MARGINS);
centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS);
centerlayout->addWidget(pageFrame);
centerlayout->addSpacing(4);
centerlayout->addWidget(stackWidget);
QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget);
bottomLayout->setContentsMargins(LAYOUT_MARGINS);
bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS);
bottomLayout->setSpacing(BOTTOM_LAYOUT_SPACING);
bottomLayout->addWidget(forgetBtn);
bottomLayout->addStretch();
@ -429,6 +448,13 @@ void NetDetail::initComponent()
isSecuOk = status;
setConfirmEnable();
});
connect(securityPage, &SecurityPage::secuTypeChanged, this, [=]() {
setSecuPageHeight();
});
connect(securityPage, &SecurityPage::eapTypeChanged, this, [=]() {
setSecuPageHeight();
});
}
void NetDetail::pagePadding(QString netName, bool isWlan)
@ -697,6 +723,22 @@ void NetDetail::initSecuData()
}
}
void NetDetail::setSecuPageHeight()
{
KySecuType secuType;
KyEapMethodType eapType;
securityPage->getSecuType(secuType, eapType);
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
if (eapType == TLS) {
securityPage->setFixedSize(SCRO_WIDTH, TLS_SCRO_HEIGHT);
} else {
securityPage->setFixedSize(SCRO_WIDTH, PEAP_SCRO_HEIGHT);
}
} else {
securityPage->setFixedSize(SCRO_WIDTH, PEAP_SCRO_HEIGHT);
}
}
void NetDetail::initTlsInfo(ConInfo &conInfo)
{
m_resource->getEnterPriseInfoTls(m_uuid, conInfo.tlsInfo);

View File

@ -106,6 +106,7 @@ private:
void loadPage();
void pagePadding(QString netName, bool isWlan);
void initSecuData();
void setSecuPageHeight();
void initTlsInfo(ConInfo &conInfo);
void initPeapInfo(ConInfo &conInfo);
@ -155,6 +156,7 @@ private:
QWidget * centerWidget;
QWidget * bottomWidget;
QScrollArea * m_secuPageScrollArea;
QPushButton * cancelBtn;
QPushButton * forgetBtn;

View File

@ -44,13 +44,18 @@ void SecurityPage::initUI()
domainLable = new QLabel(this);
caCertPathLabel = new QLabel(this);
caNeedFlagLabel = new QLabel(this);
clientCertPathLabel = new QLabel(this);
clientPrivateKeyLabel = new QLabel(this);
clientPrivateKeyPwdLabel = new QLabel(this);
pwdOptionLabel = new QLabel(this);
clientCertPathLabel = new FixLabel(this);
clientCertPathLabel->setFixedWidth(MIN_LABEL_WIDTH);
clientPrivateKeyLabel = new FixLabel(this);
clientPrivateKeyLabel->setFixedWidth(MIN_LABEL_WIDTH);
clientPrivateKeyPwdLabel = new FixLabel(this);
clientPrivateKeyPwdLabel->setFixedWidth(MIN_LABEL_WIDTH);
pwdOptionLabel = new FixLabel(this);
pwdOptionLabel->setFixedWidth(MIN_LABEL_WIDTH);
//PEAP TTLS共有
eapMethodLabel = new QLabel(this);
eapMethodLabel = new FixLabel(this);
eapMethodLabel->setFixedWidth(MIN_LABEL_WIDTH);
userNameLabel = new QLabel(this);
userPwdLabel = new QLabel(this);
userPwdFlagLabel = new QLabel(this);
@ -183,15 +188,15 @@ void SecurityPage::initUI()
domainLable->setText(tr("Domain"));
caCertPathLabel->setText(tr("CA certficate"));
caNeedFlagLabel->setText(tr("no need for CA certificate"));
clientCertPathLabel->setText(tr("User certificate"));
clientPrivateKeyLabel->setText(tr("User private key"));
clientPrivateKeyPwdLabel->setText(tr("User key password"));
pwdOptionLabel->setText(tr("Password options"));
clientCertPathLabel->setLabelText(tr("User certificate"));
clientPrivateKeyLabel->setLabelText(tr("User private key"));
clientPrivateKeyPwdLabel->setLabelText(tr("User key password"));
pwdOptionLabel->setLabelText(tr("Password options"));
identityEdit->setPlaceholderText(tr("Required"));
clientPrivateKeyPwdEdit->setPlaceholderText(hintRequired);
//PEAP TTLS共有
eapMethodLabel->setText(tr("Ineer authentication"));
eapMethodLabel->setLabelText(tr("Ineer authentication"));
userNameLabel->setText(tr("Usename"));
userPwdLabel->setText(tr("Password"));
userPwdFlagLabel->setText(tr("Ask pwd each query"));

View File

@ -28,6 +28,7 @@
#include <QCheckBox>
#include "coninfo.h"
#include "detailwidget.h"
#include "kwidget.h"
#include "kpasswordedit.h"
@ -69,13 +70,13 @@ private:
QLabel *domainLable;
QLabel *caCertPathLabel;
QLabel *caNeedFlagLabel;
QLabel *clientCertPathLabel;
QLabel *clientPrivateKeyLabel;
QLabel *clientPrivateKeyPwdLabel;
QLabel *pwdOptionLabel;
FixLabel *clientCertPathLabel;
FixLabel *clientPrivateKeyLabel;
FixLabel *clientPrivateKeyPwdLabel;
FixLabel *pwdOptionLabel;
//PEAP TTLS共有
QLabel *eapMethodLabel;
FixLabel *eapMethodLabel;
QLabel *userNameLabel;
QLabel *userPwdLabel;
QLabel *userPwdFlagLabel;

View File

@ -381,6 +381,19 @@ void LanPage::constructActiveConnectionArea()
QListWidgetItem *p_listWidgetItem = addNewItem(p_activeConnectionItem, m_activatedLanListWidget);
m_activeConnectionMap.insert(p_activeConnectionItem->m_connectUuid, p_listWidgetItem);
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(p_activeConnectionItem->m_connectUuid);
if (configType == -1) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(p_activeConnectionItem->m_connectUuid,
m_currentDeviceName,
p_activeConnectionItem->m_connectName,
KSC_FIREWALL_PUBLIC);
} else {
NetworkModeConfig::getInstance()->setNetworkModeConfig(p_activeConnectionItem->m_connectUuid,
m_currentDeviceName,
p_activeConnectionItem->m_connectName,
configType);
}
delete p_activeConnectionItem;
p_activeConnectionItem = nullptr;
}

View File

@ -425,6 +425,19 @@ void WlanPage::constructActivateConnectionArea()
m_activateConnectionItemMap.insert(wirelessNetItem.m_NetSsid, p_listWidgetItem);
updateWlanItemState(m_activatedNetListWidget, p_listWidgetItem, Activated);
int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(wirelessNetItem.m_connectUuid);
if (configType == -1) {
NetworkModeConfig::getInstance()->setNetworkModeConfig(wirelessNetItem.m_connectUuid,
m_currentDevice,
wirelessNetItem.m_connName,
KSC_FIREWALL_PUBLIC);
} else {
NetworkModeConfig::getInstance()->setNetworkModeConfig(wirelessNetItem.m_connectUuid,
m_currentDevice,
wirelessNetItem.m_connName,
configType);
}
height += p_listWidgetItem->sizeHint().height();
}
}