parent
b9139483e1
commit
24d16bdf2d
@ -0,0 +1,80 @@
|
||||
#include "wifisettingstab.h"
|
||||
#include "ui_wifisettingstab.h"
|
||||
|
||||
WifiSettingsTab::WifiSettingsTab(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::WifiSettingsTab)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->modeComboBox->addItems(QStringList() << tr("Infrastructure") << tr("Adhoc") << tr("Access Point"));
|
||||
}
|
||||
|
||||
WifiSettingsTab::~WifiSettingsTab()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QVariantMap WifiSettingsTab::readSettings()
|
||||
{
|
||||
QVariantMap output;
|
||||
output.insert("device", QVariant(ui->deviceComboBox->currentText()));
|
||||
output.insert("clonedMacAddress", QVariant(ui->clonedMacAddressLineEdit->text()));
|
||||
output.insert("ssid", ui->ssidComboBox->currentText());
|
||||
switch (ui->modeComboBox->currentIndex()) {
|
||||
case 0: // Infrastructure
|
||||
output.insert("wifiMode", ConnectionSettingsEngine::WifiModeInfrastructure);
|
||||
break;
|
||||
case 1: // Adhoc
|
||||
output.insert("wifiMode", ConnectionSettingsEngine::WifiModeAdhoc);
|
||||
break;
|
||||
case 2: // Access Point
|
||||
output.insert("wifiMode", ConnectionSettingsEngine::WifiModeAccessPoint);
|
||||
break;
|
||||
}
|
||||
output.insert("bssid", ui->bssidComboBox->currentText());
|
||||
output.insert("clonedMacAddress", QVariant(ui->clonedMacAddressLineEdit->text()));
|
||||
output.insert("mtu", QVariant(ui->mtuSpinBox->value()));
|
||||
output.insert("isWifiHidden", ui->hiddenNetworkCheckbox->isChecked());
|
||||
return output;
|
||||
}
|
||||
|
||||
void WifiSettingsTab::loadSettings(QVariantMap settings)
|
||||
{
|
||||
if (settings["device"].isValid()) {
|
||||
ui->deviceComboBox->setCurrentText(settings["device"].toString());
|
||||
}
|
||||
|
||||
if (settings["ssid"].isValid()) {
|
||||
ui->ssidComboBox->setCurrentText(settings["ssid"].toString());
|
||||
}
|
||||
|
||||
if (settings["wifiMode"].isValid()) {
|
||||
switch (settings["wifiMode"].toInt()) {
|
||||
case ConnectionSettingsEngine::WifiModeInfrastructure:
|
||||
ui->modeComboBox->setCurrentIndex(0);
|
||||
break;
|
||||
case ConnectionSettingsEngine::WifiModeAdhoc:
|
||||
ui->modeComboBox->setCurrentIndex(1);
|
||||
break;
|
||||
case ConnectionSettingsEngine::WifiModeAccessPoint:
|
||||
ui->modeComboBox->setCurrentIndex(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings["bssid"].isValid()) {
|
||||
ui->bssidComboBox->setCurrentText(settings["bssid"].toString());
|
||||
}
|
||||
|
||||
if (settings["clonedMacAddress"].isValid()) {
|
||||
ui->clonedMacAddressLineEdit->setText(settings["clonedMacAddress"].toString());
|
||||
}
|
||||
|
||||
if (settings["mtu"].isValid()) {
|
||||
ui->mtuSpinBox->setValue(settings["mtu"].toInt());
|
||||
}
|
||||
|
||||
if (settings["isWifiHidden"].isValid()) {
|
||||
ui->hiddenNetworkCheckbox->setChecked(settings["isWifiHidden"].toBool());
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
#ifndef WIFISETTINGSTAB_H
|
||||
#define WIFISETTINGSTAB_H
|
||||
|
||||
#include "connectionsettingsengine.h"
|
||||
#include <QWidget>
|
||||
#include <NetworkManagerQt/Utils>
|
||||
|
||||
namespace Ui {
|
||||
class WifiSettingsTab;
|
||||
}
|
||||
|
||||
class WifiSettingsTab : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WifiSettingsTab(QWidget *parent = nullptr);
|
||||
~WifiSettingsTab();
|
||||
|
||||
QVariantMap readSettings();
|
||||
void loadSettings(QVariantMap settings);
|
||||
|
||||
private:
|
||||
Ui::WifiSettingsTab *ui;
|
||||
};
|
||||
|
||||
#endif // WIFISETTINGSTAB_H
|
@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WifiSettingsTab</class>
|
||||
<widget class="QWidget" name="WifiSettingsTab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="modeComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Cloned MAC address</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>BSSID</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Visibility</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="clonedMacAddressLineEdit"/>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QCheckBox" name="hiddenNetworkCheckbox">
|
||||
<property name="text">
|
||||
<string>Hidden network</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>SSID</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="ssidComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>MTU</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="bssidComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Device</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="mtuSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>bytes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="deviceComboBox">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in new issue