多DNS按钮逻辑调整 删除无效代码
This commit is contained in:
parent
1cf2aeb8ca
commit
76db59ecef
|
@ -36,16 +36,12 @@ void CreatNetPage::initUI()
|
||||||
ipv4addressEdit = new LineEdit(this);
|
ipv4addressEdit = new LineEdit(this);
|
||||||
netMaskEdit = new LineEdit(this);
|
netMaskEdit = new LineEdit(this);
|
||||||
gateWayEdit = new LineEdit(this);
|
gateWayEdit = new LineEdit(this);
|
||||||
// firstDnsEdit = new LineEdit(this);
|
|
||||||
// secondDnsEdit = new LineEdit(this);
|
|
||||||
|
|
||||||
m_connNameLabel = new QLabel(this);
|
m_connNameLabel = new QLabel(this);
|
||||||
m_configLabel = new QLabel(this);
|
m_configLabel = new QLabel(this);
|
||||||
m_addressLabel = new QLabel(this);
|
m_addressLabel = new QLabel(this);
|
||||||
m_maskLabel = new QLabel(this);
|
m_maskLabel = new QLabel(this);
|
||||||
m_gateWayLabel = new QLabel(this);
|
m_gateWayLabel = new QLabel(this);
|
||||||
// m_dnsLabel = new QLabel(this);
|
|
||||||
// m_secDnsLabel = new QLabel(this);
|
|
||||||
|
|
||||||
// IP的正则格式限制
|
// IP的正则格式限制
|
||||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||||
|
@ -56,8 +52,6 @@ void CreatNetPage::initUI()
|
||||||
m_addressLabel->setText(tr("Address"));
|
m_addressLabel->setText(tr("Address"));
|
||||||
m_maskLabel->setText(tr("Netmask"));
|
m_maskLabel->setText(tr("Netmask"));
|
||||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||||
// m_dnsLabel->setText(tr("Prefs DNS"));
|
|
||||||
// m_secDnsLabel->setText(tr("Alternative DNS"));
|
|
||||||
|
|
||||||
m_detailLayout = new QFormLayout(this);
|
m_detailLayout = new QFormLayout(this);
|
||||||
m_detailLayout->setContentsMargins(0, 0, 0, 0);
|
m_detailLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
@ -67,8 +61,6 @@ void CreatNetPage::initUI()
|
||||||
m_detailLayout->addRow(m_addressLabel,ipv4addressEdit);
|
m_detailLayout->addRow(m_addressLabel,ipv4addressEdit);
|
||||||
m_detailLayout->addRow(m_maskLabel,netMaskEdit);
|
m_detailLayout->addRow(m_maskLabel,netMaskEdit);
|
||||||
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
||||||
// m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
|
||||||
// m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
|
||||||
m_detailLayout->addRow(m_dnsWidget);
|
m_detailLayout->addRow(m_dnsWidget);
|
||||||
|
|
||||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)"
|
ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)"
|
||||||
|
@ -77,8 +69,6 @@ void CreatNetPage::initUI()
|
||||||
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
||||||
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
||||||
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
||||||
// firstDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
|
||||||
// secondDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatNetPage::initComponent() {
|
void CreatNetPage::initComponent() {
|
||||||
|
@ -93,14 +83,6 @@ void CreatNetPage::initComponent() {
|
||||||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
// connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
|
||||||
// connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
|
||||||
connect(m_dnsWidget, &MultipleDnsWidget::dnsTextChanged, this, [=]() {
|
|
||||||
setCreatePageState(false);
|
|
||||||
});
|
|
||||||
connect(m_dnsWidget, &MultipleDnsWidget::dnsEditingFinished, this, [=]() {
|
|
||||||
setCreatePageState(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreatNetPage::checkConnectBtnIsEnabled()
|
bool CreatNetPage::checkConnectBtnIsEnabled()
|
||||||
|
@ -122,28 +104,6 @@ bool CreatNetPage::checkConnectBtnIsEnabled()
|
||||||
qDebug() << "create ipv4 netMask empty or invalid";
|
qDebug() << "create ipv4 netMask empty or invalid";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) {
|
|
||||||
qDebug() << "create ipv4 gateway empty or invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
|
||||||
qDebug() << "create ipv4 dns sort invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getTextEditState(firstDnsEdit->text())) {
|
|
||||||
qDebug() << "create ipv4 first dns invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getTextEditState(secondDnsEdit->text())) {
|
|
||||||
qDebug() << "create ipv4 second dns invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -162,16 +122,12 @@ void CreatNetPage::setLineEnabled(bool check) {
|
||||||
ipv4addressEdit->setEnabled(check);
|
ipv4addressEdit->setEnabled(check);
|
||||||
netMaskEdit->setEnabled(check);
|
netMaskEdit->setEnabled(check);
|
||||||
gateWayEdit->setEnabled(check);
|
gateWayEdit->setEnabled(check);
|
||||||
// firstDnsEdit->setEnabled(check);
|
|
||||||
// secondDnsEdit->setEnabled(check);
|
|
||||||
m_dnsWidget->setEditEnabled(check);
|
m_dnsWidget->setEditEnabled(check);
|
||||||
|
|
||||||
if (!check) {
|
if (!check) {
|
||||||
ipv4addressEdit->clear();
|
ipv4addressEdit->clear();
|
||||||
netMaskEdit->clear();
|
netMaskEdit->clear();
|
||||||
gateWayEdit->clear();
|
gateWayEdit->clear();
|
||||||
// firstDnsEdit->clear();
|
|
||||||
// secondDnsEdit->clear();
|
|
||||||
|
|
||||||
ipv4addressEdit->setPlaceholderText(" ");
|
ipv4addressEdit->setPlaceholderText(" ");
|
||||||
netMaskEdit->setPlaceholderText(" ");
|
netMaskEdit->setPlaceholderText(" ");
|
||||||
|
@ -210,20 +166,14 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting)
|
||||||
|
|
||||||
QStringList dnsList;
|
QStringList dnsList;
|
||||||
dnsList.clear();
|
dnsList.clear();
|
||||||
#if 0
|
|
||||||
if (!firstDnsEdit->text().isEmpty()) {
|
|
||||||
dnsList << firstDnsEdit->text();
|
|
||||||
if (!secondDnsEdit->text().isEmpty()) {
|
|
||||||
dnsList << secondDnsEdit->text();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QList<QHostAddress> ipv4dnsList;
|
QList<QHostAddress> ipv4dnsList;
|
||||||
ipv4dnsList.clear();
|
ipv4dnsList.clear();
|
||||||
ipv4dnsList = m_dnsWidget->getDns();
|
ipv4dnsList = m_dnsWidget->getDns();
|
||||||
for (QHostAddress str: ipv4dnsList) {
|
for (QHostAddress str: ipv4dnsList) {
|
||||||
dnsList << str.toString();
|
if (!dnsList.contains(str.toString())) {
|
||||||
|
dnsList << str.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ipv4ConfigCombox->currentData() == AUTO_CONFIG) {
|
if (ipv4ConfigCombox->currentData() == AUTO_CONFIG) {
|
||||||
|
|
|
@ -47,8 +47,6 @@ private:
|
||||||
LineEdit *ipv4addressEdit;
|
LineEdit *ipv4addressEdit;
|
||||||
LineEdit *netMaskEdit;
|
LineEdit *netMaskEdit;
|
||||||
LineEdit *gateWayEdit;
|
LineEdit *gateWayEdit;
|
||||||
// LineEdit *firstDnsEdit;
|
|
||||||
// LineEdit *secondDnsEdit;
|
|
||||||
|
|
||||||
QFormLayout *m_detailLayout;
|
QFormLayout *m_detailLayout;
|
||||||
QVBoxLayout *mvBoxLayout;
|
QVBoxLayout *mvBoxLayout;
|
||||||
|
@ -57,8 +55,6 @@ private:
|
||||||
QLabel *m_addressLabel;
|
QLabel *m_addressLabel;
|
||||||
QLabel *m_maskLabel;
|
QLabel *m_maskLabel;
|
||||||
QLabel *m_gateWayLabel;
|
QLabel *m_gateWayLabel;
|
||||||
// QLabel *m_dnsLabel;
|
|
||||||
// QLabel *m_secDnsLabel;
|
|
||||||
MultipleDnsWidget *m_dnsWidget = nullptr;
|
MultipleDnsWidget *m_dnsWidget = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -39,15 +39,11 @@ void Ipv4Page::initUI() {
|
||||||
ipv4addressEdit = new LineEdit(this);
|
ipv4addressEdit = new LineEdit(this);
|
||||||
netMaskEdit = new LineEdit(this);
|
netMaskEdit = new LineEdit(this);
|
||||||
gateWayEdit = new LineEdit(this);
|
gateWayEdit = new LineEdit(this);
|
||||||
// firstDnsEdit = new LineEdit(this);
|
|
||||||
// secondDnsEdit = new LineEdit(this);
|
|
||||||
|
|
||||||
m_configLabel = new QLabel(this);
|
m_configLabel = new QLabel(this);
|
||||||
m_addressLabel = new QLabel(this);
|
m_addressLabel = new QLabel(this);
|
||||||
m_maskLabel = new QLabel(this);
|
m_maskLabel = new QLabel(this);
|
||||||
m_gateWayLabel = new QLabel(this);
|
m_gateWayLabel = new QLabel(this);
|
||||||
// m_dnsLabel = new QLabel(this);
|
|
||||||
// m_secDnsLabel = new QLabel(this);
|
|
||||||
|
|
||||||
m_configEmptyLabel = new QLabel(this);
|
m_configEmptyLabel = new QLabel(this);
|
||||||
m_configEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
m_configEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||||
|
@ -68,8 +64,6 @@ void Ipv4Page::initUI() {
|
||||||
m_addressLabel->setText(tr("Address"));
|
m_addressLabel->setText(tr("Address"));
|
||||||
m_maskLabel->setText(tr("Netmask"));
|
m_maskLabel->setText(tr("Netmask"));
|
||||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||||
// m_dnsLabel->setText(tr("Prefs DNS"));
|
|
||||||
// m_secDnsLabel->setText(tr("Alternative DNS"));
|
|
||||||
|
|
||||||
m_statusLabel = new QLabel(this);
|
m_statusLabel = new QLabel(this);
|
||||||
m_statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
m_statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
@ -109,8 +103,6 @@ void Ipv4Page::initUI() {
|
||||||
m_detailLayout->addRow(m_maskLabel,maskWidget);
|
m_detailLayout->addRow(m_maskLabel,maskWidget);
|
||||||
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
m_detailLayout->addRow(m_gateWayLabel,gateWayEdit);
|
||||||
m_detailLayout->addRow(m_gateWayEmptyLabel);
|
m_detailLayout->addRow(m_gateWayEmptyLabel);
|
||||||
// m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
|
||||||
// m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
|
||||||
m_detailLayout->addRow(m_dnsWidget);
|
m_detailLayout->addRow(m_dnsWidget);
|
||||||
|
|
||||||
ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
||||||
|
@ -127,8 +119,6 @@ void Ipv4Page::initUI() {
|
||||||
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
ipv4addressEdit->setValidator(new QRegExpValidator(rx, this));
|
||||||
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
gateWayEdit->setValidator(new QRegExpValidator(rx, this));
|
||||||
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
netMaskEdit->setValidator(new QRegExpValidator(rx, this));
|
||||||
// firstDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
|
||||||
// secondDnsEdit->setValidator(new QRegExpValidator(rx, this));
|
|
||||||
|
|
||||||
initLoadingIcon();
|
initLoadingIcon();
|
||||||
}
|
}
|
||||||
|
@ -149,14 +139,6 @@ void Ipv4Page::initComponent() {
|
||||||
connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
// connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
|
||||||
// connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
|
||||||
connect(m_dnsWidget, &MultipleDnsWidget::dnsTextChanged, this, [=]() {
|
|
||||||
setIpv4PageState(false);
|
|
||||||
});
|
|
||||||
connect(m_dnsWidget, &MultipleDnsWidget::dnsEditingFinished, this, [=]() {
|
|
||||||
setIpv4PageState(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config)
|
void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config)
|
||||||
|
@ -183,18 +165,6 @@ void Ipv4Page::setMulDns(const QList<QHostAddress> &dns)
|
||||||
m_dnsWidget->setDnsListText(dns);
|
m_dnsWidget->setDnsListText(dns);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void Ipv4Page::setIpv4FirDns(const QString &ipv4FirDns)
|
|
||||||
{
|
|
||||||
firstDnsEdit->setText(ipv4FirDns);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ipv4Page::setIpv4SecDns(const QString &ipv4SecDns)
|
|
||||||
{
|
|
||||||
secondDnsEdit->setText(ipv4SecDns);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Ipv4Page::setGateWay(const QString &gateWay)
|
void Ipv4Page::setGateWay(const QString &gateWay)
|
||||||
{
|
{
|
||||||
gateWayEdit->setText(gateWay);
|
gateWayEdit->setText(gateWay);
|
||||||
|
@ -231,24 +201,17 @@ bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
|
||||||
if(info.strIPV4Address != ipv4addressEdit->text()
|
if(info.strIPV4Address != ipv4addressEdit->text()
|
||||||
|| info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text())
|
|| info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text())
|
||||||
|| info.strIPV4GateWay != gateWayEdit->text()
|
|| info.strIPV4GateWay != gateWayEdit->text()
|
||||||
// || info.strIPV4FirDns != firstDnsEdit->text()
|
|
||||||
// || info.strIPV4SecDns != secondDnsEdit->text()
|
|
||||||
|| info.ipv4DnsList != ipv4dnsList) {
|
|| info.ipv4DnsList != ipv4dnsList) {
|
||||||
|
|
||||||
qDebug() << "ipv4 info changed";
|
qDebug() << "ipv4 info changed";
|
||||||
QStringList dnsList;
|
QStringList dnsList;
|
||||||
dnsList.clear();
|
dnsList.clear();
|
||||||
for (QHostAddress str: ipv4dnsList) {
|
for (QHostAddress str: ipv4dnsList) {
|
||||||
dnsList << str.toString();
|
if (!dnsList.contains(str.toString())) {
|
||||||
}
|
dnsList << str.toString();
|
||||||
#if 0
|
|
||||||
if (!firstDnsEdit->text().isEmpty()) {
|
|
||||||
dnsList << firstDnsEdit->text();
|
|
||||||
if (!secondDnsEdit->text().isEmpty()) {
|
|
||||||
dnsList << secondDnsEdit->text();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
QString ipv4address =ipv4addressEdit->text();
|
QString ipv4address =ipv4addressEdit->text();
|
||||||
QString netMask = getNetMaskText(netMaskEdit->text());
|
QString netMask = getNetMaskText(netMaskEdit->text());
|
||||||
QString gateWay = gateWayEdit->text();
|
QString gateWay = gateWayEdit->text();
|
||||||
|
@ -276,28 +239,6 @@ bool Ipv4Page::checkConnectBtnIsEnabled()
|
||||||
qDebug() << "ipv4 netMask empty or invalid";
|
qDebug() << "ipv4 netMask empty or invalid";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (gateWayEdit->text().isEmpty() || !getTextEditState(gateWayEdit->text())) {
|
|
||||||
// qDebug() << "ipv4 gateway empty or invalid";
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
#if 0
|
|
||||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
|
||||||
qDebug() << "ipv4 dns sort invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getTextEditState(firstDnsEdit->text())) {
|
|
||||||
qDebug() << "ipv4 first dns invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getTextEditState(secondDnsEdit->text())) {
|
|
||||||
qDebug() << "ipv4 second dns invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -347,8 +288,6 @@ void Ipv4Page::setLineEnabled(bool check) {
|
||||||
ipv4addressEdit->clear();
|
ipv4addressEdit->clear();
|
||||||
netMaskEdit->clear();
|
netMaskEdit->clear();
|
||||||
gateWayEdit->clear();
|
gateWayEdit->clear();
|
||||||
// firstDnsEdit->clear();
|
|
||||||
// secondDnsEdit->clear();
|
|
||||||
|
|
||||||
ipv4addressEdit->setPlaceholderText(" ");
|
ipv4addressEdit->setPlaceholderText(" ");
|
||||||
netMaskEdit->setPlaceholderText(" ");
|
netMaskEdit->setPlaceholderText(" ");
|
||||||
|
@ -361,8 +300,6 @@ void Ipv4Page::setLineEnabled(bool check) {
|
||||||
ipv4addressEdit->setEnabled(check);
|
ipv4addressEdit->setEnabled(check);
|
||||||
netMaskEdit->setEnabled(check);
|
netMaskEdit->setEnabled(check);
|
||||||
gateWayEdit->setEnabled(check);
|
gateWayEdit->setEnabled(check);
|
||||||
// firstDnsEdit->setEnabled(check);
|
|
||||||
// secondDnsEdit->setEnabled(check);
|
|
||||||
m_dnsWidget->setEditEnabled(check);
|
m_dnsWidget->setEditEnabled(check);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,6 @@ public:
|
||||||
void setIpv4Config(KyIpConfigType ipv4Config);
|
void setIpv4Config(KyIpConfigType ipv4Config);
|
||||||
void setIpv4(const QString &ipv4);
|
void setIpv4(const QString &ipv4);
|
||||||
void setNetMask(const QString &netMask);
|
void setNetMask(const QString &netMask);
|
||||||
// void setIpv4FirDns(const QString &ipv4FirDns);
|
|
||||||
// void setIpv4SecDns(const QString &ipv4SecDns);
|
|
||||||
void setMulDns(const QList<QHostAddress> &dns);
|
void setMulDns(const QList<QHostAddress> &dns);
|
||||||
void setGateWay(const QString &gateWay);
|
void setGateWay(const QString &gateWay);
|
||||||
|
|
||||||
|
@ -59,8 +57,6 @@ private:
|
||||||
LineEdit *ipv4addressEdit;
|
LineEdit *ipv4addressEdit;
|
||||||
LineEdit *netMaskEdit;
|
LineEdit *netMaskEdit;
|
||||||
LineEdit *gateWayEdit;
|
LineEdit *gateWayEdit;
|
||||||
// LineEdit *firstDnsEdit;
|
|
||||||
// LineEdit *secondDnsEdit;
|
|
||||||
|
|
||||||
QFormLayout *m_detailLayout;
|
QFormLayout *m_detailLayout;
|
||||||
QVBoxLayout *mvBoxLayout;
|
QVBoxLayout *mvBoxLayout;
|
||||||
|
@ -68,8 +64,6 @@ private:
|
||||||
QLabel *m_addressLabel;
|
QLabel *m_addressLabel;
|
||||||
QLabel *m_maskLabel;
|
QLabel *m_maskLabel;
|
||||||
QLabel *m_gateWayLabel;
|
QLabel *m_gateWayLabel;
|
||||||
// QLabel *m_dnsLabel;
|
|
||||||
// QLabel *m_secDnsLabel;
|
|
||||||
|
|
||||||
QLabel *m_configEmptyLabel;
|
QLabel *m_configEmptyLabel;
|
||||||
QLabel *m_addressHintLabel;
|
QLabel *m_addressHintLabel;
|
||||||
|
|
|
@ -57,18 +57,6 @@ void Ipv6Page::setMulDns(const QList<QHostAddress> &dns)
|
||||||
m_dnsWidget->setDnsListText(dns);
|
m_dnsWidget->setDnsListText(dns);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void Ipv6Page::setIpv6FirDns(const QString &ipv6FirDns)
|
|
||||||
{
|
|
||||||
firstDnsEdit->setText(ipv6FirDns);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ipv6Page::setIpv6SecDns(const QString &ipv6SecDns)
|
|
||||||
{
|
|
||||||
secondDnsEdit->setText(ipv6SecDns);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Ipv6Page::setGateWay(const QString &gateWay)
|
void Ipv6Page::setGateWay(const QString &gateWay)
|
||||||
{
|
{
|
||||||
gateWayEdit->setText(gateWay);
|
gateWayEdit->setText(gateWay);
|
||||||
|
@ -102,24 +90,17 @@ bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting)
|
||||||
if(info.strIPV6Address != ipv6AddressEdit->text()
|
if(info.strIPV6Address != ipv6AddressEdit->text()
|
||||||
|| info.iIPV6Prefix != lengthEdit->text().toInt()
|
|| info.iIPV6Prefix != lengthEdit->text().toInt()
|
||||||
|| info.strIPV6GateWay != gateWayEdit->text()
|
|| info.strIPV6GateWay != gateWayEdit->text()
|
||||||
// || info.strIPV6FirDns != firstDnsEdit->text()
|
|
||||||
// || info.strIPV6SecDns != secondDnsEdit->text()
|
|
||||||
|| info.ipv6DnsList != ipv6dnsList) {
|
|| info.ipv6DnsList != ipv6dnsList) {
|
||||||
|
|
||||||
qDebug() << "ipv6 info changed";
|
qDebug() << "ipv6 info changed";
|
||||||
QStringList dnsList;
|
QStringList dnsList;
|
||||||
dnsList.clear();
|
dnsList.clear();
|
||||||
for (QHostAddress str: ipv6dnsList) {
|
for (QHostAddress str: ipv6dnsList) {
|
||||||
dnsList << str.toString();
|
if (!dnsList.contains(str.toString())) {
|
||||||
}
|
dnsList << str.toString();
|
||||||
#if 0
|
|
||||||
if (!firstDnsEdit->text().isEmpty()) {
|
|
||||||
dnsList << firstDnsEdit->text();
|
|
||||||
if (!secondDnsEdit->text().isEmpty()) {
|
|
||||||
dnsList << secondDnsEdit->text();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
QString ipv6address =ipv6AddressEdit->text();
|
QString ipv6address =ipv6AddressEdit->text();
|
||||||
QString prefix = lengthEdit->text();
|
QString prefix = lengthEdit->text();
|
||||||
QString gateWay = gateWayEdit->text();
|
QString gateWay = gateWayEdit->text();
|
||||||
|
@ -136,15 +117,11 @@ void Ipv6Page::initUI() {
|
||||||
ipv6AddressEdit = new LineEdit(this);
|
ipv6AddressEdit = new LineEdit(this);
|
||||||
lengthEdit = new LineEdit(this);
|
lengthEdit = new LineEdit(this);
|
||||||
gateWayEdit = new LineEdit(this);
|
gateWayEdit = new LineEdit(this);
|
||||||
// firstDnsEdit = new LineEdit(this);
|
|
||||||
// secondDnsEdit = new LineEdit(this);
|
|
||||||
|
|
||||||
m_configLabel = new QLabel(this);
|
m_configLabel = new QLabel(this);
|
||||||
m_addressLabel = new QLabel(this);
|
m_addressLabel = new QLabel(this);
|
||||||
m_subnetLabel = new QLabel(this);
|
m_subnetLabel = new QLabel(this);
|
||||||
m_gateWayLabel = new QLabel(this);
|
m_gateWayLabel = new QLabel(this);
|
||||||
// m_dnsLabel = new QLabel(this);
|
|
||||||
// m_secDnsLabel = new QLabel(this);
|
|
||||||
|
|
||||||
m_configEmptyLabel = new QLabel(this);
|
m_configEmptyLabel = new QLabel(this);
|
||||||
m_configEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
m_configEmptyLabel->setFixedHeight(LABEL_HEIGHT);
|
||||||
|
@ -165,8 +142,6 @@ void Ipv6Page::initUI() {
|
||||||
m_addressLabel->setText(tr("Address"));
|
m_addressLabel->setText(tr("Address"));
|
||||||
m_subnetLabel->setText(tr("Subnet prefix Length"));
|
m_subnetLabel->setText(tr("Subnet prefix Length"));
|
||||||
m_gateWayLabel->setText(tr("Default Gateway"));
|
m_gateWayLabel->setText(tr("Default Gateway"));
|
||||||
// m_dnsLabel->setText(tr("Prefs DNS"));
|
|
||||||
// m_secDnsLabel->setText(tr("Alternative DNS"));
|
|
||||||
|
|
||||||
m_statusLabel = new QLabel(this);
|
m_statusLabel = new QLabel(this);
|
||||||
m_statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
m_statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
@ -205,8 +180,6 @@ void Ipv6Page::initUI() {
|
||||||
m_detailLayout->addRow(m_subnetLabel,lengthEdit);
|
m_detailLayout->addRow(m_subnetLabel,lengthEdit);
|
||||||
m_detailLayout->addRow(m_subnetEmptyLabel);
|
m_detailLayout->addRow(m_subnetEmptyLabel);
|
||||||
m_detailLayout->addRow(m_gateWayLabel,gateWayWidget);
|
m_detailLayout->addRow(m_gateWayLabel,gateWayWidget);
|
||||||
// m_detailLayout->addRow(m_dnsLabel,firstDnsEdit);
|
|
||||||
// m_detailLayout->addRow(m_secDnsLabel,secondDnsEdit);
|
|
||||||
m_detailLayout->addRow(m_dnsWidget);
|
m_detailLayout->addRow(m_dnsWidget);
|
||||||
|
|
||||||
ipv6ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
ipv6ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)"
|
||||||
|
@ -214,8 +187,6 @@ void Ipv6Page::initUI() {
|
||||||
|
|
||||||
ipv6AddressEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
ipv6AddressEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||||
gateWayEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
gateWayEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
||||||
// firstDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
|
||||||
// secondDnsEdit->setValidator(new QRegExpValidator(ipv6_rx, this));
|
|
||||||
|
|
||||||
QRegExp prefix_rx("\\b(?:(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\.){3}(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\b");
|
QRegExp prefix_rx("\\b(?:(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\.){3}(?:12[0-8]|1[0-1][0-9]|^[1-9][0-9]?$)\\b");
|
||||||
lengthEdit->setValidator(new QRegExpValidator(prefix_rx,this));
|
lengthEdit->setValidator(new QRegExpValidator(prefix_rx,this));
|
||||||
|
@ -239,14 +210,6 @@ void Ipv6Page::initComponent() {
|
||||||
connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
// connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
|
||||||
// connect(secondDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
|
||||||
connect(m_dnsWidget, &MultipleDnsWidget::dnsTextChanged, this, [=]() {
|
|
||||||
setIpv6PageState(false);
|
|
||||||
});
|
|
||||||
connect(m_dnsWidget, &MultipleDnsWidget::dnsEditingFinished, this, [=]() {
|
|
||||||
setIpv6PageState(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ipv6Page::configChanged(int index) {
|
void Ipv6Page::configChanged(int index) {
|
||||||
|
@ -264,8 +227,6 @@ void Ipv6Page::setControlEnabled(bool check)
|
||||||
ipv6AddressEdit->clear();
|
ipv6AddressEdit->clear();
|
||||||
lengthEdit->clear();
|
lengthEdit->clear();
|
||||||
gateWayEdit->clear();
|
gateWayEdit->clear();
|
||||||
// firstDnsEdit->clear();
|
|
||||||
// secondDnsEdit->clear();
|
|
||||||
|
|
||||||
ipv6AddressEdit->setPlaceholderText(" ");
|
ipv6AddressEdit->setPlaceholderText(" ");
|
||||||
lengthEdit->setPlaceholderText(" ");
|
lengthEdit->setPlaceholderText(" ");
|
||||||
|
@ -279,8 +240,6 @@ void Ipv6Page::setControlEnabled(bool check)
|
||||||
ipv6AddressEdit->setEnabled(check);
|
ipv6AddressEdit->setEnabled(check);
|
||||||
lengthEdit->setEnabled(check);
|
lengthEdit->setEnabled(check);
|
||||||
gateWayEdit->setEnabled(check);
|
gateWayEdit->setEnabled(check);
|
||||||
// firstDnsEdit->setEnabled(check);
|
|
||||||
// secondDnsEdit->setEnabled(check);
|
|
||||||
m_dnsWidget->setEditEnabled(check);
|
m_dnsWidget->setEditEnabled(check);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,22 +297,6 @@ bool Ipv6Page::checkConnectBtnIsEnabled()
|
||||||
qDebug() << "ipv6 gateway empty or invalid";
|
qDebug() << "ipv6 gateway empty or invalid";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (firstDnsEdit->text().isEmpty() && !secondDnsEdit->text().isEmpty()) {
|
|
||||||
qDebug() << "ipv6 dns sort invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getIpv6EditState(firstDnsEdit->text())) {
|
|
||||||
qDebug() << "ipv6 first dns invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getIpv6EditState(secondDnsEdit->text())) {
|
|
||||||
qDebug() << "ipv6 second dns invalid";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,8 +86,6 @@ void MultipleDnsWidget::initComponent()
|
||||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp);
|
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp);
|
||||||
m_dnsListWidget ->setItemDelegateForRow(m_dnsListWidget->currentIndex().row(), dnsListItemEdit);
|
m_dnsListWidget ->setItemDelegateForRow(m_dnsListWidget->currentIndex().row(), dnsListItemEdit);
|
||||||
connect(dnsListItemEdit, SIGNAL(textChanged(QString)), this, SIGNAL(dnsTextChanged(QString)));
|
|
||||||
connect(dnsListItemEdit, SIGNAL(editingFinished()), this, SIGNAL(dnsEditingFinished()));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +108,7 @@ QList<QHostAddress> MultipleDnsWidget::getDns() const
|
||||||
QString aDns;
|
QString aDns;
|
||||||
while (m_dnsListWidget->count() > row) {
|
while (m_dnsListWidget->count() > row) {
|
||||||
aDns = m_dnsListWidget->item(row)->text();
|
aDns = m_dnsListWidget->item(row)->text();
|
||||||
if (!dnsList.contains(aDns)) {
|
if (!dnsList.contains(aDns) && !aDns.isEmpty()) {
|
||||||
dnsList << aDns;
|
dnsList << aDns;
|
||||||
ipv4dnsList << QHostAddress(aDns);
|
ipv4dnsList << QHostAddress(aDns);
|
||||||
}
|
}
|
||||||
|
@ -140,9 +138,6 @@ void MultipleDnsWidget::AddOneDnsItem(QListWidget *listWidget)
|
||||||
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp);
|
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp);
|
||||||
listWidget->setItemDelegateForRow(listWidget->currentIndex().row() , dnsListItemEdit);
|
listWidget->setItemDelegateForRow(listWidget->currentIndex().row() , dnsListItemEdit);
|
||||||
listWidget->editItem(dnsListWidgetItem);
|
listWidget->editItem(dnsListWidgetItem);
|
||||||
|
|
||||||
connect(dnsListItemEdit, SIGNAL(textChanged(QString)), this, SIGNAL(dnsTextChanged(QString)));
|
|
||||||
connect(dnsListItemEdit, SIGNAL(editingFinished()), this, SIGNAL(dnsEditingFinished()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultipleDnsWidget::RemoveOneDnsItem(QListWidgetItem *aItem, QListWidget *listWidget)
|
void MultipleDnsWidget::RemoveOneDnsItem(QListWidgetItem *aItem, QListWidget *listWidget)
|
||||||
|
@ -164,15 +159,19 @@ void MultipleDnsWidget::setDnsListWidgetStyle()
|
||||||
|
|
||||||
void MultipleDnsWidget::onAddBtnClicked()
|
void MultipleDnsWidget::onAddBtnClicked()
|
||||||
{
|
{
|
||||||
|
AddOneDnsItem(m_dnsListWidget);
|
||||||
|
|
||||||
//避免重复添加空白项
|
//避免重复添加空白项
|
||||||
if (m_dnsListWidget->currentItem()) {
|
int row = m_dnsListWidget->count() - 1;
|
||||||
if (m_dnsListWidget->currentItem()->text().isEmpty()) {
|
while (row >= 0) {
|
||||||
m_dnsListWidget->removeItemWidget(m_dnsListWidget->currentItem());
|
if (!m_dnsListWidget->item(row)->isSelected()
|
||||||
delete m_dnsListWidget->currentItem();
|
&& m_dnsListWidget->item(row)->text().isEmpty()) {
|
||||||
|
m_dnsListWidget->removeItemWidget(m_dnsListWidget->item(row));
|
||||||
|
delete m_dnsListWidget->item(row);
|
||||||
}
|
}
|
||||||
|
row --;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddOneDnsItem(m_dnsListWidget);
|
|
||||||
m_removeDnsBtn->setEnabled(true);
|
m_removeDnsBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,6 @@ private Q_SLOTS:
|
||||||
void setDnsListWidgetStyle();
|
void setDnsListWidgetStyle();
|
||||||
void onAddBtnClicked();
|
void onAddBtnClicked();
|
||||||
void onRemoveBtnClicked();
|
void onRemoveBtnClicked();
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void dnsTextChanged(const QString &);
|
|
||||||
void dnsEditingFinished();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MULTIPLEDNSWIDGET_H
|
#endif // MULTIPLEDNSWIDGET_H
|
||||||
|
|
|
@ -30,8 +30,6 @@ QWidget *ListItemEdit::createEditor(QWidget *parent, const QStyleOptionViewItem
|
||||||
{
|
{
|
||||||
QLineEdit *editor = new QLineEdit(parent);
|
QLineEdit *editor = new QLineEdit(parent);
|
||||||
editor->setValidator(new QRegExpValidator(m_regExp, parent));
|
editor->setValidator(new QRegExpValidator(m_regExp, parent));
|
||||||
connect(editor, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString)));
|
|
||||||
connect(editor, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
|
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,6 @@ public:
|
||||||
private:
|
private:
|
||||||
QRegExp m_regExp;
|
QRegExp m_regExp;
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void textChanged(const QString &);
|
|
||||||
void editingFinished();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LISTITEMEDIT_H
|
#endif // LISTITEMEDIT_H
|
||||||
|
|
Loading…
Reference in New Issue