You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.0 KiB

#include "ethernetsettings.h"
#include "ui_genericsettings.h"
EthernetSettings::EthernetSettings(QString connUuidStr, QWidget *parent) :
QDialog(parent),
ui(new Ui::GenericSettings)
{
targetConnUuidStr = connUuidStr;
ui->setupUi(this);
QVariantMap connSettings = ConnectionSettingsEngine::readConnectionSettings(connUuidStr);
this->setWindowTitle(connSettings["connName"].toString());
ui->connectionNameLineEdit->setText(connSettings["connName"].toString());
generalSettingsTab = new GeneralSettingsTab();
ethernetSettingsTab = new EthernetSettingsTab();
security802_1xSettingsTab = new Security802_1xTab();
ipv4SettingsTab = new Ipv4SettingsTab();
ui->tabWidget->addTab(generalSettingsTab, tr("General"));
ui->tabWidget->addTab(ethernetSettingsTab, tr("Ethernet"));
ui->tabWidget->addTab(security802_1xSettingsTab, tr("802.1x Security"));
ui->tabWidget->addTab(ipv4SettingsTab, tr("IPv4"));
generalSettingsTab->loadSettings(connSettings);
ethernetSettingsTab->loadSettings(connSettings);
security802_1xSettingsTab->loadSettings(connSettings);
ipv4SettingsTab->loadSettings(connSettings);
connect(ui->cancelButton, &QPushButton::clicked, this, &EthernetSettings::onCancelButtonClicked);
connect(ui->saveButton, &QPushButton::clicked, this, &EthernetSettings::onSaveButtonClicked);
}
EthernetSettings::~EthernetSettings()
{
delete ui;
delete generalSettingsTab;
delete ethernetSettingsTab;
delete security802_1xSettingsTab;
delete ipv4SettingsTab;
}
void EthernetSettings::onCancelButtonClicked()
{
this->done(0);
}
void EthernetSettings::onSaveButtonClicked()
{
QVariantMap settings = generalSettingsTab->readSettings();
settings.insert(ethernetSettingsTab->readSettings());
settings.insert(security802_1xSettingsTab->readSettings());
settings.insert(ipv4SettingsTab->readSettings());
settings.insert("connName", ui->connectionNameLineEdit->text());
ConnectionSettingsEngine::modifyConnectionSettings(targetConnUuidStr, settings);
this->done(0);
}