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.

48 lines
1.8 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();
ui->tabWidget->addTab(generalSettingsTab, "General");
ui->tabWidget->addTab(ethernetSettingsTab, "Ethernet");
ui->tabWidget->addTab(security802_1xSettingsTab, "802.1x Security");
generalSettingsTab->loadSettings(connSettings);
ethernetSettingsTab->loadSettings(connSettings);
security802_1xSettingsTab->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;
}
void EthernetSettings::onCancelButtonClicked()
{
this->done(0);
}
void EthernetSettings::onSaveButtonClicked()
{
QVariantMap settings = generalSettingsTab->readSettings();
settings.insert(ethernetSettingsTab->readSettings());
settings.insert(security802_1xSettingsTab->readSettings());
settings.insert("connName", ui->connectionNameLineEdit->text());
ConnectionSettingsEngine::modifyConnectionSettings(targetConnUuidStr, settings);
this->done(0);
}