diff --git a/PKGBUILD b/PKGBUILD index 46f6a0a..6e96359 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -13,7 +13,7 @@ license=('GPL3') makedepends=('automoc4' 'cmake' 'kdelibs' 'qt5-base' 'qt5-tools') source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz") install="${pkgbase}.install" -md5sums=('9a47346e890e7c4458602d47751adf17') +md5sums=('d0a279f99cbb9a33b283def9fe053594') prepare() { diff --git a/README.md b/README.md index bcba4fe..cc21fbe 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,6 @@ Additional information TODO (wish list) ---------------- -* add support of **openvswitch** (netctl-auto-1.9) * plasmoid helper integration * remove suid from helper (polkit integration or run through sudo) * security notes / project architecture diff --git a/sources/gui/src/generalwidget.cpp b/sources/gui/src/generalwidget.cpp index b5e928a..9832702 100644 --- a/sources/gui/src/generalwidget.cpp +++ b/sources/gui/src/generalwidget.cpp @@ -162,7 +162,9 @@ int GeneralWidget::isOk() // bind interfaces is not set if ((ui->comboBox_connection->currentText() == QString("bond")) || (ui->comboBox_connection->currentText() == QString("bridge")) || - (ui->comboBox_connection->currentText() == QString("vlan"))) + (ui->comboBox_connection->currentText() == QString("vlan")) || + (ui->comboBox_connection->currentText() == QString("macvlan")) || + (ui->comboBox_connection->currentText() == QString("openvswitch"))) if (ui->listWidget_bindto->count() == 0) return 1; // empty description diff --git a/sources/gui/src/generalwidget.ui b/sources/gui/src/generalwidget.ui index 86c9c59..a2f16d0 100644 --- a/sources/gui/src/generalwidget.ui +++ b/sources/gui/src/generalwidget.ui @@ -6,8 +6,8 @@ 0 0 - 429 - 535 + 427 + 533 @@ -123,6 +123,11 @@ macvlan + + + openvswitch + + diff --git a/sources/gui/src/mainactions.cpp b/sources/gui/src/mainactions.cpp index 1468ca8..f229e68 100644 --- a/sources/gui/src/mainactions.cpp +++ b/sources/gui/src/mainactions.cpp @@ -36,6 +36,7 @@ #include "mobilewidget.h" #include "netctlautowindow.h" #include "netctlguiadaptor.h" +#include "openvswitchwidget.h" #include "passwdwidget.h" #include "pppoewidget.h" #include "settingswindow.h" @@ -645,6 +646,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(true); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -658,6 +660,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(false); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -672,6 +675,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(false); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -685,6 +689,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(false); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -698,6 +703,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(false); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(true); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -711,6 +717,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(false); macvlanWid->setShown(false); mobileWid->setShown(true); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -724,6 +731,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(false); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(true); tuntapWid->setShown(false); @@ -737,6 +745,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(false); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(true); @@ -750,6 +759,7 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(true); macvlanWid->setShown(false); mobileWid->setShown(false); + openvWid->setShown(false); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -763,6 +773,21 @@ void MainWindow::profileTabChangeState(const QString current) ethernetWid->setShown(true); macvlanWid->setShown(true); mobileWid->setShown(false); + openvWid->setShown(false); + pppoeWid->setShown(false); + tunnelWid->setShown(false); + tuntapWid->setShown(false); + vlanWid->setShown(false); + wirelessWid->setShown(false); + } + else if (current == QString("openvswitch")) { + generalWid->setShown(true); + ipWid->setShown(true); + bridgeWid->setShown(false); + ethernetWid->setShown(false); + macvlanWid->setShown(false); + mobileWid->setShown(false); + openvWid->setShown(true); pppoeWid->setShown(false); tunnelWid->setShown(false); tuntapWid->setShown(false); @@ -794,6 +819,7 @@ void MainWindow::profileTabClear() ethernetWid->clear(); macvlanWid->clear(); mobileWid->clear(); + openvWid->clear(); pppoeWid->clear(); tunnelWid->clear(); tuntapWid->clear(); @@ -879,6 +905,8 @@ void MainWindow::profileTabCreateProfile() if (ethernetWid->isOk() == 1) return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]")); } + else if (generalWid->connectionType->currentText() == QString("openvswitch")) { + } ui->tabWidget->setDisabled(true); // read settings @@ -963,6 +991,14 @@ void MainWindow::profileTabCreateProfile() for (int i=0; iconnectionType->currentText() == QString("openvswitch")) { + QMap addSettings = ipWid->getSettings(); + for (int i=0; igetSettings(); + for (int i=0; isetSettings(settings); macvlanWid->setSettings(settings); } + else if (generalWid->connectionType->currentText() == QString("openvswitch")) { + ipWid->setSettings(settings); + openvWid->setSettings(settings); + } } diff --git a/sources/gui/src/mainwindow.cpp b/sources/gui/src/mainwindow.cpp index 6cd1e4d..406400f 100644 --- a/sources/gui/src/mainwindow.cpp +++ b/sources/gui/src/mainwindow.cpp @@ -35,6 +35,7 @@ #include "mobilewidget.h" #include "netctlautowindow.h" #include "netctlguiadaptor.h" +#include "openvswitchwidget.h" #include "passwdwidget.h" #include "pppoewidget.h" #include "settingswindow.h" @@ -407,6 +408,8 @@ void MainWindow::createObjects() ui->scrollAreaWidgetContents->layout()->addWidget(macvlanWid); mobileWid = new MobileWidget(this); ui->scrollAreaWidgetContents->layout()->addWidget(mobileWid); + openvWid = new OpenvswitchWidget(this); + ui->scrollAreaWidgetContents->layout()->addWidget(openvWid); pppoeWid = new PppoeWidget(this); ui->scrollAreaWidgetContents->layout()->addWidget(pppoeWid); tunnelWid = new TunnelWidget(this); @@ -436,6 +439,7 @@ void MainWindow::deleteObjects() if (ipWid != nullptr) delete ipWid; if (macvlanWid != nullptr) delete macvlanWid; if (mobileWid != nullptr) delete mobileWid; + if (openvWid != nullptr) delete openvWid; if (pppoeWid != nullptr) delete pppoeWid; if (tunnelWid != nullptr) delete tunnelWid; if (tuntapWid != nullptr) delete tuntapWid; diff --git a/sources/gui/src/mainwindow.h b/sources/gui/src/mainwindow.h index 2156eb2..8d3c591 100644 --- a/sources/gui/src/mainwindow.h +++ b/sources/gui/src/mainwindow.h @@ -34,6 +34,7 @@ class IpWidget; class MacvlanWidget; class MobileWidget; class NetctlAutoWindow; +class OpenvswitchWidget; class PasswdWidget; class PppoeWidget; class SettingsWindow; @@ -140,6 +141,7 @@ private: IpWidget *ipWid = nullptr; MacvlanWidget *macvlanWid = nullptr; MobileWidget *mobileWid = nullptr; + OpenvswitchWidget *openvWid = nullptr; PppoeWidget *pppoeWid = nullptr; TunnelWidget *tunnelWid = nullptr; TuntapWidget *tuntapWid = nullptr; diff --git a/sources/gui/src/openvswitchwidget.cpp b/sources/gui/src/openvswitchwidget.cpp new file mode 100644 index 0000000..da1c7f4 --- /dev/null +++ b/sources/gui/src/openvswitchwidget.cpp @@ -0,0 +1,73 @@ +/*************************************************************************** + * 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 "openvswitchwidget.h" +#include "ui_openvswitchwidget.h" + + +OpenvswitchWidget::OpenvswitchWidget(QWidget *parent) + : QWidget(parent), + ui(new Ui::OpenvswitchWidget) +{ + ui->setupUi(this); + clear(); +} + + +OpenvswitchWidget::~OpenvswitchWidget() +{ + delete ui; +} + + +void OpenvswitchWidget::clear() +{ +} + + +void OpenvswitchWidget::setShown(const bool state) +{ + if (state) + show(); + else + hide(); +} + + +QMap OpenvswitchWidget::getSettings() +{ + QMap openvswitchSettings; + + if (isOk() != 0) + return openvswitchSettings; + + return openvswitchSettings; +} + + +int OpenvswitchWidget::isOk() +{ + // all fine + return 0; +} + + +void OpenvswitchWidget::setSettings(const QMap settings) +{ + clear(); + QMap OpenvswitchWidget = settings; +} diff --git a/sources/gui/src/openvswitchwidget.h b/sources/gui/src/openvswitchwidget.h new file mode 100644 index 0000000..5188d70 --- /dev/null +++ b/sources/gui/src/openvswitchwidget.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * 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 OPENVSWITCHWIDGET_H +#define OPENVSWITCHWIDGET_H + +#include + + +namespace Ui { +class OpenvswitchWidget; +} + +class OpenvswitchWidget : public QWidget +{ + Q_OBJECT + +public: + explicit OpenvswitchWidget(QWidget *parent = 0); + ~OpenvswitchWidget(); + QMap getSettings(); + int isOk(); + void setSettings(const QMap settings); + +public slots: + void clear(); + void setShown(const bool state); + +private: + Ui::OpenvswitchWidget *ui; +}; + + +#endif /* OPENVSWITCHWIDGET_H */ diff --git a/sources/gui/src/openvswitchwidget.ui b/sources/gui/src/openvswitchwidget.ui new file mode 100644 index 0000000..901d988 --- /dev/null +++ b/sources/gui/src/openvswitchwidget.ui @@ -0,0 +1,34 @@ + + + OpenvswitchWidget + + + + 0 + 0 + 391 + 79 + + + + Form + + + + + + QDockWidget::NoDockWidgetFeatures + + + openvswitch settings + + + + + + + + + + +