mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-10 04:15:52 +00:00
update to netctl 1.10 and 1.11 changes
This commit is contained in:
69
sources/gui/src/bondwidget.cpp
Normal file
69
sources/gui/src/bondwidget.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-gui is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* netctl-gui is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "bondwidget.h"
|
||||
#include "ui_bondwidget.h"
|
||||
|
||||
|
||||
BondWidget::BondWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::BondWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
BondWidget::~BondWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void BondWidget::clear()
|
||||
{
|
||||
ui->lineEdit_mode->setText(QString("balance-rr"));
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> BondWidget::getSettings()
|
||||
{
|
||||
QMap<QString, QString> settings;
|
||||
|
||||
if (isOk() != 0) return settings;
|
||||
|
||||
if (ui->lineEdit_mode->text() != QString("balance-rr"))
|
||||
settings[QString("Mode")] = ui->lineEdit_mode->text();
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
||||
int BondWidget::isOk()
|
||||
{
|
||||
// all fine
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void BondWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
|
||||
if (settings.contains(QString("Mode")))
|
||||
ui->lineEdit_mode->setText(settings[QString("Mode")]);
|
||||
}
|
47
sources/gui/src/bondwidget.h
Normal file
47
sources/gui/src/bondwidget.h
Normal file
@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-gui *
|
||||
* *
|
||||
* netctl-gui is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* netctl-gui is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef BONDWIDGET_H
|
||||
#define BONDWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class BondWidget;
|
||||
}
|
||||
|
||||
class BondWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BondWidget(QWidget *parent = 0);
|
||||
~BondWidget();
|
||||
QMap<QString, QString> getSettings();
|
||||
int isOk();
|
||||
void setSettings(const QMap<QString, QString> settings);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
private:
|
||||
Ui::BondWidget *ui;
|
||||
};
|
||||
|
||||
|
||||
#endif /* BONDWIDGET_H */
|
71
sources/gui/src/bondwidget.ui
Normal file
71
sources/gui/src/bondwidget.ui
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BondWidget</class>
|
||||
<widget class="QWidget" name="BondWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>46</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_bond">
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Bond settings</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_bond">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_mode">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The bonding policy. See the kernel documentation on bonding for details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -124,6 +124,10 @@ QStringList ErrorWindow::getMessage(const int mess)
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "IP address does not match the standard");
|
||||
break;
|
||||
case 21:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Key is required for 'gre' mode");
|
||||
break;
|
||||
default:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Unknown error");
|
||||
@ -164,6 +168,7 @@ QMessageBox::Icon ErrorWindow::getIcon(const int mess)
|
||||
case 18:
|
||||
case 19:
|
||||
case 20:
|
||||
case 21:
|
||||
icon = QMessageBox::Critical;
|
||||
break;
|
||||
default:
|
||||
|
@ -46,6 +46,7 @@ void EthernetWidget::clear()
|
||||
showWpa(ui->checkBox_8021x->checkState());
|
||||
ui->lineEdit_wpaConfig->clear();
|
||||
ui->comboBox_driver->setCurrentIndex(0);
|
||||
ui->spinBox_priority->setValue(1);
|
||||
ui->spinBox_timeoutCarrier->setValue(5);
|
||||
ui->spinBox_timeoutWpa->setValue(15);
|
||||
|
||||
@ -104,6 +105,8 @@ QMap<QString, QString> EthernetWidget::getSettings()
|
||||
settings[QString("WPAConfigFile")] = QString("'%1'").arg(ui->lineEdit_wpaConfig->text());
|
||||
settings[QString("WPADriver")] = ui->comboBox_driver->currentText();
|
||||
}
|
||||
if (ui->spinBox_priority->value() != 1)
|
||||
settings[QString("Priority")] = QString::number(ui->spinBox_priority->value());
|
||||
if (ui->spinBox_timeoutCarrier->value() != 5)
|
||||
settings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
|
||||
if (ui->spinBox_timeoutWpa->value() != 15)
|
||||
@ -139,6 +142,8 @@ void EthernetWidget::setSettings(const QMap<QString, QString> settings)
|
||||
int index = ui->comboBox_driver->findText(settings[QString("WPADriver")]);
|
||||
ui->comboBox_driver->setCurrentIndex(index);
|
||||
}
|
||||
if (settings.contains(QString("Priority")))
|
||||
ui->spinBox_priority->setValue(settings[QString("Priority")].toInt());
|
||||
if (settings.contains(QString("TimeoutCarrier")))
|
||||
ui->spinBox_timeoutCarrier->setValue(settings[QString("TimeoutCarrier")].toInt());
|
||||
if (settings.contains(QString("TimeoutWPA")))
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>227</height>
|
||||
<height>255</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -301,6 +301,45 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_priority">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_priority">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Priority</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_priority">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Priority level of the profile. In case of automatic profile selection, profiles are tried in decreasing order of priority</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -59,6 +59,7 @@ void GeneralWidget::clear()
|
||||
ui->listWidget_after->clear();
|
||||
ui->lineEdit_execUpPost->clear();
|
||||
ui->lineEdit_execDownPre->clear();
|
||||
ui->checkBox_exclude->setCheckState(Qt::Unchecked);
|
||||
ui->checkBox_forceConnect->setCheckState(Qt::Unchecked);
|
||||
ui->checkBox_debug->setCheckState(Qt::Unchecked);
|
||||
|
||||
@ -139,6 +140,8 @@ QMap<QString, QString> GeneralWidget::getSettings()
|
||||
settings[QString("ExecUpPost")] = QString("'%1'").arg(ui->lineEdit_execUpPost->text());
|
||||
if (!ui->lineEdit_execDownPre->text().isEmpty())
|
||||
settings[QString("ExecDownPre")] = QString("'%1'").arg(ui->lineEdit_execDownPre->text());
|
||||
if (ui->checkBox_exclude->checkState() == Qt::Checked)
|
||||
settings[QString("ExcludeAuto")] = QString("yes");
|
||||
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
||||
settings[QString("ForceConnect")] = QString("yes");
|
||||
if (ui->checkBox_debug->checkState() == Qt::Checked)
|
||||
@ -186,6 +189,9 @@ void GeneralWidget::setSettings(const QMap<QString, QString> settings)
|
||||
ui->lineEdit_execUpPost->setText(settings[QString("ExecUpPost")]);
|
||||
if (settings.contains(QString("ExecDownPre")))
|
||||
ui->lineEdit_execDownPre->setText(settings[QString("ExecDownPre")]);
|
||||
if (settings.contains(QString("ExcludeAuto")))
|
||||
if (settings[QString("ExcludeAuto")] == QString("yes"))
|
||||
ui->checkBox_exclude->setCheckState(Qt::Checked);
|
||||
if (settings.contains(QString("ForceConnect")))
|
||||
if (settings[QString("ForceConnect")] == QString("yes"))
|
||||
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>452</height>
|
||||
<height>479</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
@ -417,6 +417,36 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_exclude">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_exclude">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_exclude">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Whether or not to exclude this profile from automatic profile selection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exclude auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_forceConnect">
|
||||
<item>
|
||||
|
@ -46,9 +46,11 @@ void MobileWidget::clear()
|
||||
ui->lineEdit_apn->clear();
|
||||
ui->lineEdit_pin->clear();
|
||||
ui->comboBox_mode->setCurrentIndex(0);
|
||||
ui->spinBox_fail->setValue(5);
|
||||
ui->checkBox_route->setCheckState(Qt::Checked);
|
||||
ui->checkBox_dns->setCheckState(Qt::Checked);
|
||||
ui->lineEdit_init->setText(QString("ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"));
|
||||
ui->spinBox_fail->setValue(5);
|
||||
ui->lineEdit_chat->clear();
|
||||
ui->lineEdit_options->clear();
|
||||
|
||||
ui->pushButton_mobileAdvanced->setChecked(false);;
|
||||
@ -59,10 +61,22 @@ void MobileWidget::clear()
|
||||
void MobileWidget::createActions()
|
||||
{
|
||||
connect(ui->pushButton_mobileAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||
connect(ui->pushButton_chat, SIGNAL(clicked(bool)), this, SLOT(selectChatFile()));
|
||||
connect(ui->pushButton_options, SIGNAL(clicked(bool)), this, SLOT(selectOptionsFile()));
|
||||
}
|
||||
|
||||
|
||||
void MobileWidget::selectChatFile()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this,
|
||||
QApplication::translate("MobileWidget", "Select chat file"),
|
||||
QDir::currentPath(),
|
||||
QApplication::translate("MobileWidget", "All (*.*)"));
|
||||
if (!filename.isEmpty())
|
||||
ui->lineEdit_chat->setText(filename);
|
||||
}
|
||||
|
||||
|
||||
void MobileWidget::selectOptionsFile()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this,
|
||||
@ -102,12 +116,16 @@ QMap<QString, QString> MobileWidget::getSettings()
|
||||
else
|
||||
settings[QString("PIN")] = QString("None");
|
||||
settings[QString("Mode")] = ui->comboBox_mode->currentText();
|
||||
if (ui->spinBox_fail->value() != 5)
|
||||
settings[QString("MaxFail")] = QString::number(ui->spinBox_fail->value());
|
||||
if (ui->checkBox_route->checkState() == Qt::Unchecked)
|
||||
settings[QString("DefaultRoute")] = QString("false");
|
||||
if (ui->checkBox_dns->checkState() == Qt::Unchecked)
|
||||
settings[QString("UsePeerDNS")] = QString("false");
|
||||
if (ui->lineEdit_init->text() != QString("ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"))
|
||||
settings[QString("Init")] = QString("'%1'").arg(ui->lineEdit_init->text());
|
||||
if (ui->spinBox_fail->value() != 5)
|
||||
settings[QString("MaxFail")] = QString::number(ui->spinBox_fail->value());
|
||||
if (!ui->lineEdit_chat->text().isEmpty())
|
||||
settings[QString("ChatScript")] = QString("'%1'").arg(ui->lineEdit_chat->text());
|
||||
if (!ui->lineEdit_options->text().isEmpty())
|
||||
settings[QString("OptionsFile")] = QString("'%1'").arg(ui->lineEdit_options->text());
|
||||
|
||||
@ -143,14 +161,18 @@ void MobileWidget::setSettings(const QMap<QString, QString> settings)
|
||||
int index = ui->comboBox_mode->findText(settings[QString("Mode")]);
|
||||
ui->comboBox_mode->setCurrentIndex(index);
|
||||
}
|
||||
if (settings.contains(QString("MaxFail")))
|
||||
ui->spinBox_fail->setValue(settings[QString("MaxFail")].toInt());
|
||||
if (settings.contains(QString("DefaultRoute")))
|
||||
if (settings[QString("DefaultRoute")] == QString("false"))
|
||||
ui->checkBox_route->setCheckState(Qt::Unchecked);
|
||||
if (settings.contains(QString("UsePeerDNS")))
|
||||
if (settings[QString("UsePeerDNS")] == QString("false"))
|
||||
ui->checkBox_dns->setCheckState(Qt::Unchecked);
|
||||
if (settings.contains(QString("Init")))
|
||||
ui->lineEdit_init->setText(settings[QString("Init")]);
|
||||
if (settings.contains(QString("MaxFail")))
|
||||
ui->spinBox_fail->setValue(settings[QString("MaxFail")].toInt());
|
||||
if (settings.contains(QString("ChatScript")))
|
||||
ui->lineEdit_chat->setText(settings[QString("ChatScript")]);
|
||||
if (settings.contains(QString("OptionsFile")))
|
||||
ui->lineEdit_options->setText(settings[QString("OptionsFile")]);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public slots:
|
||||
void clear();
|
||||
|
||||
private slots:
|
||||
void selectChatFile();
|
||||
void selectOptionsFile();
|
||||
void showAdvanced();
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>314</height>
|
||||
<height>376</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -319,6 +319,39 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_init">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_init">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Init</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_init">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>An initialization string sent to the modem before dialing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_fail">
|
||||
<item>
|
||||
@ -358,6 +391,52 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_chat">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_chat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>7</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chat script</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_chat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>10</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Path to a chat file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_chat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>4</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_options">
|
||||
<item>
|
||||
|
@ -25,8 +25,9 @@
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
#include "calls.h"
|
||||
#include "bondwidget.h"
|
||||
#include "bridgewidget.h"
|
||||
#include "calls.h"
|
||||
#include "commonfunctions.h"
|
||||
#include "dbusoperation.h"
|
||||
#include "errorwindow.h"
|
||||
@ -60,6 +61,8 @@ NewProfileWidget::NewProfileWidget(QWidget *parent, const QMap<QString, QString>
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
||||
ipWid = new IpWidget(this);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(ipWid);
|
||||
bondWid = new BondWidget(this);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(bondWid);
|
||||
bridgeWid = new BridgeWidget(this);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(bridgeWid);
|
||||
ethernetWid = new EthernetWidget(this);
|
||||
@ -87,6 +90,7 @@ NewProfileWidget::~NewProfileWidget()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (bondWid != nullptr) delete bondWid;
|
||||
if (bridgeWid != nullptr) delete bridgeWid;
|
||||
if (ethernetWid != nullptr) delete ethernetWid;
|
||||
if (generalWid != nullptr) delete generalWid;
|
||||
@ -168,6 +172,7 @@ void NewProfileWidget::updateProfileTab()
|
||||
|
||||
generalWid->clear();
|
||||
ipWid->clear();
|
||||
bondWid->clear();
|
||||
bridgeWid->clear();
|
||||
ethernetWid->clear();
|
||||
macvlanWid->clear();
|
||||
@ -192,6 +197,7 @@ void NewProfileWidget::profileTabChangeState(const QString current)
|
||||
|
||||
generalWid->setVisible(true);
|
||||
ipWid->setVisible((current != QString("pppoe")) && (current != QString("mobile_ppp")));
|
||||
bondWid->setVisible(current == QString("bond"));
|
||||
bridgeWid->setVisible(current == QString("bridge"));
|
||||
ethernetWid->setVisible((current == QString("ethernet")) ||
|
||||
(current == QString("vlan")) ||
|
||||
@ -250,6 +256,7 @@ void NewProfileWidget::profileTabCreateProfile()
|
||||
return ErrorWindow::showWindow(7, QString(PDEBUG), debug);
|
||||
else if (wirelessWid->isOk() == 5)
|
||||
return ErrorWindow::showWindow(11, QString(PDEBUG), debug);
|
||||
} else if (generalWid->connectionType->currentText() == QString("bond")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
if (pppoeWid->isOk() == 1)
|
||||
@ -269,11 +276,13 @@ void NewProfileWidget::profileTabCreateProfile()
|
||||
else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||
if (tunnelWid->isOk() == 1)
|
||||
return ErrorWindow::showWindow(20, QString(PDEBUG), debug);
|
||||
else if (tunnelWid->isOk() == 2)
|
||||
return ErrorWindow::showWindow(21, QString(PDEBUG), debug);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||
if (tuntapWid->isOk() == 1)
|
||||
return ErrorWindow::showWindow(15, QString(PDEBUG), debug);
|
||||
if (tuntapWid->isOk() == 2)
|
||||
else if (tuntapWid->isOk() == 2)
|
||||
return ErrorWindow::showWindow(15, QString(PDEBUG), debug);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||
@ -304,17 +313,23 @@ void NewProfileWidget::profileTabCreateProfile()
|
||||
addSettings = wirelessWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
} else if ((generalWid->connectionType->currentText() == QString("bond")) ||
|
||||
(generalWid->connectionType->currentText() == QString("dummy")) ||
|
||||
} else if ((generalWid->connectionType->currentText() == QString("dummy")) ||
|
||||
(generalWid->connectionType->currentText() == QString("openvswitch"))) {
|
||||
QMap<QString, QString> addSettings = ipWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
} else if (generalWid->connectionType->currentText() == QString("bond")) {
|
||||
QMap<QString, QString> addSettings = ipWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
addSettings = bondWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
} else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||
QMap<QString, QString> addSettings = ipWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
addSettings = bridgeWid->getSettings();
|
||||
addSettings = bridgeWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
} else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
@ -388,13 +403,15 @@ void NewProfileWidget::profileTabLoadProfile()
|
||||
} else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||
ipWid->setSettings(settings);
|
||||
wirelessWid->setSettings(settings);
|
||||
} else if ((generalWid->connectionType->currentText() == QString("bond")) ||
|
||||
(generalWid->connectionType->currentText() == QString("dummy")) ||
|
||||
} else if ((generalWid->connectionType->currentText() == QString("dummy")) ||
|
||||
(generalWid->connectionType->currentText() == QString("openvswitch"))) {
|
||||
ipWid->setSettings(settings);
|
||||
} else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||
ipWid->setSettings(settings);
|
||||
bridgeWid->setSettings(settings);
|
||||
} else if (generalWid->connectionType->currentText() == QString("bond")) {
|
||||
ipWid->setSettings(settings);
|
||||
bondWid->setSettings(settings);
|
||||
} else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
pppoeWid->setSettings(settings);
|
||||
} else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
|
||||
class BondWidget;
|
||||
class BridgeWidget;
|
||||
class EthernetWidget;
|
||||
class GeneralWidget;
|
||||
@ -71,6 +72,7 @@ private:
|
||||
// ui
|
||||
MainWindow *mainWindow;
|
||||
Ui::NewProfileWidget *ui = nullptr;
|
||||
BondWidget *bondWid = nullptr;
|
||||
BridgeWidget *bridgeWid = nullptr;
|
||||
EthernetWidget *ethernetWid = nullptr;
|
||||
GeneralWidget *generalWid = nullptr;
|
||||
|
@ -42,6 +42,7 @@ void TunnelWidget::clear()
|
||||
ui->comboBox_mode->setCurrentIndex(0);
|
||||
ui->lineEdit_local->clear();
|
||||
ui->lineEdit_remote->clear();
|
||||
ui->lineEdit_key->clear();
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +63,8 @@ QMap<QString, QString> TunnelWidget::getSettings()
|
||||
if (!IpRegExp::checkString(ui->lineEdit_local->text(), IpRegExp::ip4Regex()))
|
||||
settings[QString("Local")] = QString("'%1'").arg(ui->lineEdit_local->text());
|
||||
settings[QString("Remote")] = QString("'%1'").arg(ui->lineEdit_remote->text());
|
||||
if (ui->comboBox_mode->currentText() == QString("gre"))
|
||||
settings[QString("Key")] = QString("'%1'").arg(ui->lineEdit_key->text());
|
||||
|
||||
return settings;
|
||||
}
|
||||
@ -71,6 +74,9 @@ int TunnelWidget::isOk()
|
||||
{
|
||||
// ip is not correct
|
||||
if (!IpRegExp::checkString(ui->lineEdit_remote->text(), IpRegExp::ip4Regex())) return 1;
|
||||
// key is empty
|
||||
if (ui->comboBox_mode->currentText() == QString("gre"))
|
||||
if (ui->lineEdit_key->text().isEmpty()) return 2;
|
||||
// all fine
|
||||
return 0;
|
||||
}
|
||||
@ -88,4 +94,6 @@ void TunnelWidget::setSettings(const QMap<QString, QString> settings)
|
||||
ui->lineEdit_local->setText(settings[QString("Local")]);
|
||||
if (settings.contains(QString("Remote")))
|
||||
ui->lineEdit_remote->setText(settings[QString("Remote")]);
|
||||
if (settings.contains(QString("Key")))
|
||||
ui->lineEdit_key->setText(settings[QString("Key")]);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>411</width>
|
||||
<height>108</height>
|
||||
<height>137</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -166,6 +166,39 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_key">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_key">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Key</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_key">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>A key identifying an individual traffic flow within a tunnel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -77,7 +77,6 @@ void WirelessWidget::clear()
|
||||
}
|
||||
ui->comboBox_rfkill->setCurrentIndex(0);
|
||||
ui->spinBox_timeoutWpa->setValue(15);
|
||||
ui->checkBox_exclude->setCheckState(Qt::Unchecked);
|
||||
|
||||
ui->pushButton_wirelessAdvanced->setChecked(false);
|
||||
showAdvanced();
|
||||
@ -231,8 +230,6 @@ QMap<QString, QString> WirelessWidget::getSettings()
|
||||
settings[QString("RFKill")] = ui->comboBox_rfkill->currentText();
|
||||
if (ui->spinBox_timeoutWpa->value() != 15)
|
||||
settings[QString("TimeoutWPA")] = QString::number(ui->spinBox_timeoutWpa->value());
|
||||
if (ui->checkBox_exclude->checkState() == Qt::Checked)
|
||||
settings[QString("ExcludeAuto")] = QString("yes");
|
||||
|
||||
return settings;
|
||||
}
|
||||
@ -310,9 +307,6 @@ void WirelessWidget::setSettings(const QMap<QString, QString> settings)
|
||||
}
|
||||
if (settings.contains(QString("TimeoutWPA")))
|
||||
ui->spinBox_timeoutWpa->setValue(settings[QString("TimeoutWPA")].toInt());
|
||||
if (settings.contains(QString("ExcludeAuto")))
|
||||
if (settings[QString("ExcludeAuto")] == QString("yes"))
|
||||
ui->checkBox_exclude->setCheckState(Qt::Checked);
|
||||
|
||||
changeSecurity(ui->comboBox_security->currentText());
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>584</width>
|
||||
<height>697</height>
|
||||
<height>670</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -280,17 +280,11 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_wirelessAdvanced">
|
||||
<item>
|
||||
<spacer name="spacer_wirelessAdvanced">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pushButton_wirelessAdvanced">
|
||||
@ -313,36 +307,6 @@
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_exclude">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_exclude">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_exclude">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Whether or not to exclude this profile from automatic profile selection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exclude auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_hidden">
|
||||
<item>
|
||||
|
Reference in New Issue
Block a user