#include "wifisettings.h" #include "ui_genericsettings.h" WifiSettings::WifiSettings(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(); wifiSettingsTab = new WifiSettingsTab(); ipv4SettingsTab = new Ipv4SettingsTab(); ipv6SettingsTab = new Ipv6SettingsTab(); ui->tabWidget->addTab(generalSettingsTab, tr("General")); ui->tabWidget->addTab(wifiSettingsTab, tr("WiFi")); ui->tabWidget->addTab(ipv4SettingsTab, tr("IPv4")); ui->tabWidget->addTab(ipv6SettingsTab, tr("IPv6")); generalSettingsTab->loadSettings(connSettings); wifiSettingsTab->loadSettings(connSettings); ipv4SettingsTab->loadSettings(connSettings); ipv6SettingsTab->loadSettings(connSettings); connect(ui->cancelButton, &QPushButton::clicked, this, &WifiSettings::onCancelButtonClicked); connect(ui->saveButton, &QPushButton::clicked, this, &WifiSettings::onSaveButtonClicked); } WifiSettings::~WifiSettings() { delete ui; delete generalSettingsTab; delete wifiSettingsTab; delete ipv4SettingsTab; delete ipv6SettingsTab; } void WifiSettings::onCancelButtonClicked() { this->done(0); } void WifiSettings::onSaveButtonClicked() { QVariantMap settings = generalSettingsTab->readSettings(); settings.insert(wifiSettingsTab->readSettings()); settings.insert(ipv4SettingsTab->readSettings()); settings.insert(ipv6SettingsTab->readSettings()); settings.insert("connName", ui->connectionNameLineEdit->text()); ConnectionSettingsEngine::modifyConnectionSettings(targetConnUuidStr, settings); this->done(0); }