mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 23:47:21 +00:00
now general widget has been completed
This commit is contained in:
parent
a20cac49aa
commit
49fcfafc9e
33
sources/gui/src/bridgewidget.cpp
Normal file
33
sources/gui/src/bridgewidget.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* *
|
||||
* netctl-plasmoid 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-plasmoid 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "bridgewidget.h"
|
||||
#include "ui_bridgewidget.h"
|
||||
|
||||
|
||||
BridgeWidget::BridgeWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::BridgeWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
BridgeWidget::~BridgeWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
41
sources/gui/src/bridgewidget.h
Normal file
41
sources/gui/src/bridgewidget.h
Normal file
@ -0,0 +1,41 @@
|
||||
/***************************************************************************
|
||||
* This file is part of netctl-plasmoid *
|
||||
* *
|
||||
* netctl-plasmoid 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-plasmoid 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-plasmoid. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef BRIDGEWIDGET_H
|
||||
#define BRIDGEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class BridgeWidget;
|
||||
}
|
||||
|
||||
class BridgeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BridgeWidget(QWidget *parent = 0);
|
||||
~BridgeWidget();
|
||||
|
||||
private:
|
||||
Ui::BridgeWidget *ui;
|
||||
};
|
||||
|
||||
|
||||
#endif /* BRIDGEWIDGET_H */
|
45
sources/gui/src/bridgewidget.ui
Normal file
45
sources/gui/src/bridgewidget.ui
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BridgeWidget</class>
|
||||
<widget class="QWidget" name="BridgeWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_bridge">
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Bridge settings</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_bridge">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_skip">
|
||||
<property name="toolTip">
|
||||
<string>Skip (R)STP and immediately activate all bridge members</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Skip forwarding delay</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -44,7 +44,7 @@ GeneralWidget::~GeneralWidget()
|
||||
|
||||
void GeneralWidget::clear()
|
||||
{
|
||||
ui->lineEdit_description->clear();
|
||||
ui->lineEdit_description->setText(QString("Generated from Netctl GUI"));
|
||||
ui->comboBox_connection->setCurrentIndex(0);
|
||||
ui->comboBox_interface->clear();
|
||||
ui->comboBox_interface->addItems(ifaceDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot));
|
||||
@ -108,11 +108,46 @@ void GeneralWidget::showAdvanced()
|
||||
|
||||
QHash<QString, QString> GeneralWidget::getSettings()
|
||||
{
|
||||
QHash<QString, QString> generalSettings;
|
||||
|
||||
if (isOk() == 0) {
|
||||
generalSettings[QString("Description")] = ui->lineEdit_description->text();
|
||||
generalSettings[QString("Connection")] = ui->comboBox_connection->currentText();
|
||||
generalSettings[QString("Interface")] = ui->comboBox_interface->currentText();
|
||||
if (ui->listWidget_bindto->count() != 0) {
|
||||
QStringList interfaces;
|
||||
for (int i=0; i<ui->listWidget_bindto->count(); i++)
|
||||
interfaces.append(ui->listWidget_bindto->item(i)->text());
|
||||
generalSettings[QString("BindsToInterfaces")] = interfaces.join(QString(" "));
|
||||
}
|
||||
if (ui->listWidget_after->count() != 0) {
|
||||
QStringList profiles;
|
||||
for (int i=0; i<ui->listWidget_after->count(); i++)
|
||||
profiles.append(ui->listWidget_after->item(i)->text());
|
||||
generalSettings[QString("After")] = profiles.join(QString(" "));
|
||||
}
|
||||
if (!ui->lineEdit_execUpPost->text().isEmpty())
|
||||
generalSettings[QString("ExecUpPost")] = ui->lineEdit_execUpPost->text();
|
||||
if (!ui->lineEdit_execDownPre->text().isEmpty())
|
||||
generalSettings[QString("ExecDownPre")] = ui->lineEdit_execDownPre->text();
|
||||
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
||||
generalSettings[QString("ForceConnect")] = QString("yes");
|
||||
}
|
||||
|
||||
return generalSettings;
|
||||
}
|
||||
|
||||
|
||||
int GeneralWidget::isOk()
|
||||
{
|
||||
// bind interfaces is not set
|
||||
if ((ui->comboBox_connection->currentText() == QString("bond")) ||
|
||||
(ui->comboBox_connection->currentText() == QString("bridge")))
|
||||
if (ui->listWidget_bindto->count() == 0)
|
||||
return 1;
|
||||
// empty description
|
||||
if (ui->lineEdit_description->text().isEmpty())
|
||||
return 2;
|
||||
// all fine
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>431</width>
|
||||
<height>498</height>
|
||||
<height>537</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -150,7 +150,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="layout_bindto">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_bindtoButton">
|
||||
<item>
|
||||
@ -225,7 +225,7 @@
|
||||
<widget class="QWidget" name="widget_generalAdvanced" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="layout_after">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_afterButton">
|
||||
<item>
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QMimeData>
|
||||
#include <QProcess>
|
||||
|
||||
#include "bridgewidget.h"
|
||||
#include "errorwindow.h"
|
||||
#include "ethernetwidget.h"
|
||||
#include "generalwidget.h"
|
||||
@ -68,6 +69,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
||||
ipWid = new IpWidget(this);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(ipWid);
|
||||
bridgeWid = new BridgeWidget(this);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(bridgeWid);
|
||||
ethernetWid = new EthernetWidget(this);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(ethernetWid);
|
||||
mobileWid = new MobilePpp(this);
|
||||
@ -94,19 +97,21 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete netctlCommand;
|
||||
delete netctlProfile;
|
||||
delete wpaCommand;
|
||||
|
||||
delete bridgeWid;
|
||||
delete ethernetWid;
|
||||
delete generalWid;
|
||||
delete ipWid;
|
||||
delete mobileWid;
|
||||
delete netctlCommand;
|
||||
delete netctlProfile;
|
||||
delete pppoeWid;
|
||||
delete tunnelWid;
|
||||
delete tuntapWid;
|
||||
delete ui;
|
||||
delete vlanWid;
|
||||
delete wpaCommand;
|
||||
delete wirelessWid;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QMainWindow>
|
||||
|
||||
|
||||
class BridgeWidget;
|
||||
class ErrorWindow;
|
||||
class EthernetWidget;
|
||||
class GeneralWidget;
|
||||
@ -84,6 +85,7 @@ private slots:
|
||||
private:
|
||||
// ui
|
||||
Ui::MainWindow *ui;
|
||||
BridgeWidget *bridgeWid;
|
||||
EthernetWidget *ethernetWid;
|
||||
GeneralWidget *generalWid;
|
||||
IpWidget *ipWid;
|
||||
|
@ -20,7 +20,7 @@
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Tunnel settings</string>
|
||||
<string>Tuntap settings</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_tuntap">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
Loading…
Reference in New Issue
Block a user