mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
rewrite mainwindow class
This commit is contained in:
parent
f0adbb60e5
commit
4785e358ec
@ -64,8 +64,7 @@ Additional information
|
||||
TODO (wish list)
|
||||
----------------
|
||||
|
||||
* refactoring (I think that classes with more than 1k lines is not good :/)
|
||||
* remove suid from helper (polkit integration or run through sudo)
|
||||
* add helper polkit-qt integration
|
||||
* security notes / project architecture
|
||||
* autotests
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "ipwidget.h"
|
||||
#include "macvlanwidget.h"
|
||||
#include "mobilewidget.h"
|
||||
#include "openvswitchwidget.h"
|
||||
#include "passwdwidget.h"
|
||||
#include "pppoewidget.h"
|
||||
#include "tunnelwidget.h"
|
||||
@ -96,14 +95,12 @@ void MainWindow::updateMenuMain()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[updateMenuMain]";
|
||||
|
||||
ui->actionMainRefresh->setVisible(true);
|
||||
if (ui->tableWidget_main->currentItem() == 0)
|
||||
return;
|
||||
if (ui->tableWidget_main->currentItem() == 0) return;
|
||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text().isEmpty()) {
|
||||
ui->actionMainRestart->setVisible(true);
|
||||
ui->actionMainStart->setText(QApplication::translate("MainWindow", "Stop profile"));
|
||||
ui->actionMainStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->actionMainRestart->setVisible(false);
|
||||
ui->actionMainStart->setText(QApplication::translate("MainWindow", "Start profile"));
|
||||
ui->actionMainStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
@ -112,8 +109,7 @@ void MainWindow::updateMenuMain()
|
||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
ui->actionMainEnable->setText(QApplication::translate("MainWindow", "Disable profile"));
|
||||
ui->actionMainEnable->setIcon(QIcon::fromTheme("edit-remove"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->actionMainEnable->setText(QApplication::translate("MainWindow", "Enable profile"));
|
||||
ui->actionMainEnable->setIcon(QIcon::fromTheme("edit-add"));
|
||||
}
|
||||
@ -132,8 +128,7 @@ void MainWindow::updateMenuProfile()
|
||||
ui->actionProfileLoad->setVisible(false);
|
||||
ui->actionProfileRemove->setVisible(false);
|
||||
ui->actionProfileSave->setVisible(false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->actionProfileLoad->setVisible(true);
|
||||
ui->actionProfileRemove->setVisible(true);
|
||||
ui->actionProfileSave->setVisible(true);
|
||||
@ -146,19 +141,16 @@ void MainWindow::updateMenuWifi()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[updateMenuWifi]";
|
||||
|
||||
ui->actionWifiRefresh->setVisible(true);
|
||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||
return;
|
||||
if (ui->tableWidget_wifi->currentItem() == 0) return;
|
||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 4)->text().isEmpty()) {
|
||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
ui->actionWifiStart->setText(QApplication::translate("MainWindow", "Stop WiFi"));
|
||||
ui->actionWifiStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->actionWifiStart->setText(QApplication::translate("MainWindow", "Start WiFi"));
|
||||
ui->actionWifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->actionWifiStart->setText(QApplication::translate("MainWindow", "Start WiFi"));
|
||||
ui->actionWifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
@ -183,8 +175,7 @@ void MainWindow::updateMainTab()
|
||||
profiles = parseOutputNetctl(sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("ProfileList"),
|
||||
QList<QVariant>(), true, debug), debug);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
netctlAutoStatus = netctlCommand->isNetctlAutoRunning();
|
||||
profiles = netctlCommand->getProfileList();
|
||||
}
|
||||
@ -369,8 +360,7 @@ void MainWindow::mainTabContextualMenu(const QPoint &pos)
|
||||
restartProfile->setVisible(true);
|
||||
startProfile->setText(QApplication::translate("MainWindow", "Stop profile"));
|
||||
startProfile->setIcon(QIcon::fromTheme("process-stop"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
restartProfile->setVisible(false);
|
||||
startProfile->setText(QApplication::translate("MainWindow", "Start profile"));
|
||||
startProfile->setIcon(QIcon::fromTheme("system-run"));
|
||||
@ -378,8 +368,7 @@ void MainWindow::mainTabContextualMenu(const QPoint &pos)
|
||||
if (!ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
enableProfile->setText(QApplication::translate("MainWindow", "Disable profile"));
|
||||
enableProfile->setIcon(QIcon::fromTheme("edit-remove"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
enableProfile->setText(QApplication::translate("MainWindow", "Enable profile"));
|
||||
enableProfile->setIcon(QIcon::fromTheme("edit-add"));
|
||||
}
|
||||
@ -389,24 +378,19 @@ void MainWindow::mainTabContextualMenu(const QPoint &pos)
|
||||
if (action == refreshTable) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Refresh table";
|
||||
updateMainTab();
|
||||
}
|
||||
else if (action == startProfile) {
|
||||
} else if (action == startProfile) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Start profile";
|
||||
mainTabStartProfile();
|
||||
}
|
||||
else if (action == restartProfile) {
|
||||
} else if (action == restartProfile) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Restart profile";
|
||||
mainTabRestartProfile();
|
||||
}
|
||||
else if (action == enableProfile) {
|
||||
} else if (action == enableProfile) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Enable profile";
|
||||
mainTabEnableProfile();
|
||||
}
|
||||
else if (action == editProfile) {
|
||||
} else if (action == editProfile) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Edit profile";
|
||||
mainTabEditProfile();
|
||||
}
|
||||
else if (action == removeProfile) {
|
||||
} else if (action == removeProfile) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Remove profile";
|
||||
mainTabRemoveProfile();
|
||||
}
|
||||
@ -430,8 +414,7 @@ void MainWindow::mainTabEnableProfile()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabEnableProfile]";
|
||||
if (!checkExternalApps(QString("netctl")))
|
||||
return errorWin->showWindow(1, QString("[MainWindow] : [mainTabEnableProfile]"));
|
||||
if (ui->tableWidget_main->currentItem() == 0)
|
||||
return;
|
||||
if (ui->tableWidget_main->currentItem() == 0) return;
|
||||
|
||||
ui->tabWidget->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
@ -460,8 +443,7 @@ void MainWindow::mainTabRemoveProfile()
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Remove"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else
|
||||
} else
|
||||
status = netctlProfile->removeProfile(profile);
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||
@ -477,8 +459,7 @@ void MainWindow::mainTabRestartProfile()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabRestartProfile]";
|
||||
if (!checkExternalApps(QString("netctl")))
|
||||
return errorWin->showWindow(1, QString("[MainWindow] : [mainTabRestartProfile]"));
|
||||
if (ui->tableWidget_main->currentItem() == 0)
|
||||
return;
|
||||
if (ui->tableWidget_main->currentItem() == 0) return;
|
||||
|
||||
ui->tabWidget->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
@ -497,8 +478,7 @@ void MainWindow::mainTabStartProfile()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabStartProfile]";
|
||||
if (!checkExternalApps(QString("netctl")))
|
||||
return errorWin->showWindow(1, QString("[MainWindow] : [mainTabStartProfile]"));
|
||||
if (ui->tableWidget_main->currentItem() == 0)
|
||||
return;
|
||||
if (ui->tableWidget_main->currentItem() == 0) return;
|
||||
|
||||
ui->tabWidget->setDisabled(true);
|
||||
QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text();
|
||||
@ -531,8 +511,7 @@ void MainWindow::mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetIt
|
||||
ui->pushButton_mainRestart->setEnabled(true);
|
||||
ui->pushButton_mainStart->setText(QApplication::translate("MainWindow", "Stop"));
|
||||
ui->pushButton_mainStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->pushButton_mainRestart->setDisabled(true);
|
||||
ui->pushButton_mainStart->setText(QApplication::translate("MainWindow", "Start"));
|
||||
ui->pushButton_mainStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
@ -553,148 +532,116 @@ 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);
|
||||
vlanWid->setShown(false);
|
||||
wirelessWid->setShown(false);
|
||||
}
|
||||
else if (current == QString("wireless")) {
|
||||
} else if (current == QString("wireless")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(true);
|
||||
bridgeWid->setShown(false);
|
||||
ethernetWid->setShown(false);
|
||||
macvlanWid->setShown(false);
|
||||
mobileWid->setShown(false);
|
||||
openvWid->setShown(false);
|
||||
pppoeWid->setShown(false);
|
||||
tunnelWid->setShown(false);
|
||||
tuntapWid->setShown(false);
|
||||
vlanWid->setShown(false);
|
||||
wirelessWid->setShown(true);
|
||||
}
|
||||
else if ((current == QString("bond")) ||
|
||||
(current == QString("dummy"))) {
|
||||
} else if ((current == QString("bond")) ||
|
||||
(current == QString("dummy")) ||
|
||||
(current == QString("openvswitch"))) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(true);
|
||||
bridgeWid->setShown(false);
|
||||
ethernetWid->setShown(false);
|
||||
macvlanWid->setShown(false);
|
||||
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("bridge")) {
|
||||
} else if (current == QString("bridge")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(true);
|
||||
bridgeWid->setShown(true);
|
||||
ethernetWid->setShown(false);
|
||||
macvlanWid->setShown(false);
|
||||
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("pppoe")) {
|
||||
} else if (current == QString("pppoe")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(false);
|
||||
bridgeWid->setShown(false);
|
||||
ethernetWid->setShown(false);
|
||||
macvlanWid->setShown(false);
|
||||
mobileWid->setShown(false);
|
||||
openvWid->setShown(false);
|
||||
pppoeWid->setShown(true);
|
||||
tunnelWid->setShown(false);
|
||||
tuntapWid->setShown(false);
|
||||
vlanWid->setShown(false);
|
||||
wirelessWid->setShown(false);
|
||||
}
|
||||
else if (current == QString("mobile_ppp")) {
|
||||
} else if (current == QString("mobile_ppp")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(false);
|
||||
bridgeWid->setShown(false);
|
||||
ethernetWid->setShown(false);
|
||||
macvlanWid->setShown(false);
|
||||
mobileWid->setShown(true);
|
||||
openvWid->setShown(false);
|
||||
pppoeWid->setShown(false);
|
||||
tunnelWid->setShown(false);
|
||||
tuntapWid->setShown(false);
|
||||
vlanWid->setShown(false);
|
||||
wirelessWid->setShown(false);
|
||||
}
|
||||
else if (current == QString("tunnel")) {
|
||||
} else if (current == QString("tunnel")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(true);
|
||||
bridgeWid->setShown(false);
|
||||
ethernetWid->setShown(false);
|
||||
macvlanWid->setShown(false);
|
||||
mobileWid->setShown(false);
|
||||
openvWid->setShown(false);
|
||||
pppoeWid->setShown(false);
|
||||
tunnelWid->setShown(true);
|
||||
tuntapWid->setShown(false);
|
||||
vlanWid->setShown(false);
|
||||
wirelessWid->setShown(false);
|
||||
}
|
||||
else if (current == QString("tuntap")) {
|
||||
} else if (current == QString("tuntap")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(true);
|
||||
bridgeWid->setShown(false);
|
||||
ethernetWid->setShown(false);
|
||||
macvlanWid->setShown(false);
|
||||
mobileWid->setShown(false);
|
||||
openvWid->setShown(false);
|
||||
pppoeWid->setShown(false);
|
||||
tunnelWid->setShown(false);
|
||||
tuntapWid->setShown(true);
|
||||
vlanWid->setShown(false);
|
||||
wirelessWid->setShown(false);
|
||||
}
|
||||
else if (current == QString("vlan")) {
|
||||
} else if (current == QString("vlan")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(true);
|
||||
bridgeWid->setShown(false);
|
||||
ethernetWid->setShown(true);
|
||||
macvlanWid->setShown(false);
|
||||
mobileWid->setShown(false);
|
||||
openvWid->setShown(false);
|
||||
pppoeWid->setShown(false);
|
||||
tunnelWid->setShown(false);
|
||||
tuntapWid->setShown(false);
|
||||
vlanWid->setShown(true);
|
||||
wirelessWid->setShown(false);
|
||||
}
|
||||
else if (current == QString("macvlan")) {
|
||||
} else if (current == QString("macvlan")) {
|
||||
generalWid->setShown(true);
|
||||
ipWid->setShown(true);
|
||||
bridgeWid->setShown(false);
|
||||
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);
|
||||
@ -726,7 +673,6 @@ void MainWindow::profileTabClear()
|
||||
ethernetWid->clear();
|
||||
macvlanWid->clear();
|
||||
mobileWid->clear();
|
||||
openvWid->clear();
|
||||
pppoeWid->clear();
|
||||
tunnelWid->clear();
|
||||
tuntapWid->clear();
|
||||
@ -756,7 +702,8 @@ void MainWindow::profileTabCreateProfile()
|
||||
(generalWid->connectionType->currentText() == QString("tunnel")) ||
|
||||
(generalWid->connectionType->currentText() == QString("tuntap")) ||
|
||||
(generalWid->connectionType->currentText() == QString("vlan")) ||
|
||||
(generalWid->connectionType->currentText() == QString("macvlan"))) {
|
||||
(generalWid->connectionType->currentText() == QString("macvlan")) ||
|
||||
(generalWid->connectionType->currentText() == QString("openvswitch"))) {
|
||||
if (ipWid->isOk() == 1)
|
||||
return errorWin->showWindow(6, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
else if (ipWid->isOk() == 2)
|
||||
@ -765,8 +712,7 @@ void MainWindow::profileTabCreateProfile()
|
||||
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||
if (ethernetWid->isOk() == 1)
|
||||
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||
if (wirelessWid->isOk() == 1)
|
||||
return errorWin->showWindow(8, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
else if (wirelessWid->isOk() == 2)
|
||||
@ -777,10 +723,8 @@ void MainWindow::profileTabCreateProfile()
|
||||
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
else if (wirelessWid->isOk() == 5)
|
||||
return errorWin->showWindow(11, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
if (pppoeWid->isOk() == 1)
|
||||
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
else if (pppoeWid->isOk() == 2)
|
||||
@ -789,8 +733,7 @@ void MainWindow::profileTabCreateProfile()
|
||||
return errorWin->showWindow(13, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
else if (pppoeWid->isOk() == 4)
|
||||
return errorWin->showWindow(12, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||
if (mobileWid->isOk() == 1)
|
||||
return errorWin->showWindow(14, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||
if (mobileWid->isOk() == 2)
|
||||
@ -812,8 +755,6 @@ 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
|
||||
@ -827,56 +768,49 @@ void MainWindow::profileTabCreateProfile()
|
||||
addSettings = ethernetWid->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("wireless")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||
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 = 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("bond")) ||
|
||||
(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("bridge")) {
|
||||
} 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();
|
||||
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")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
QMap<QString, QString> addSettings = pppoeWid->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("mobile_ppp")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||
QMap<QString, QString> addSettings = mobileWid->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("tunnel")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||
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 = tunnelWid->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("tuntap")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||
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 = tuntapWid->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("vlan")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||
QMap<QString, QString> addSettings = ipWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
@ -886,8 +820,7 @@ void MainWindow::profileTabCreateProfile()
|
||||
addSettings = vlanWid->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("macvlan")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("macvlan")) {
|
||||
QMap<QString, QString> addSettings = ipWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
@ -898,14 +831,6 @@ void MainWindow::profileTabCreateProfile()
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
}
|
||||
else if (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]]);
|
||||
addSettings = openvWid->getSettings();
|
||||
for (int i=0; i<addSettings.keys().count(); i++)
|
||||
settings.insert(addSettings.keys()[i], addSettings[addSettings.keys()[i]]);
|
||||
}
|
||||
|
||||
// call netctlprofile
|
||||
bool status = false;
|
||||
@ -919,8 +844,7 @@ void MainWindow::profileTabCreateProfile()
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Create"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
||||
status = netctlProfile->copyProfile(profileTempName);
|
||||
}
|
||||
@ -953,8 +877,7 @@ void MainWindow::profileTabLoadProfile()
|
||||
QString value = settingsList[i].split(QString("=="))[1];
|
||||
settings[key] = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
settings = netctlProfile->getSettingsFromProfile(profile);
|
||||
|
||||
|
||||
@ -966,47 +889,35 @@ void MainWindow::profileTabLoadProfile()
|
||||
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||
ipWid->setSettings(settings);
|
||||
ethernetWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||
} 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("bond")) ||
|
||||
(generalWid->connectionType->currentText() == QString("dummy")) ||
|
||||
(generalWid->connectionType->currentText() == QString("openvswitch"))) {
|
||||
ipWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||
ipWid->setSettings(settings);
|
||||
bridgeWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||
pppoeWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||
mobileWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||
ipWid->setSettings(settings);
|
||||
tunnelWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||
ipWid->setSettings(settings);
|
||||
tuntapWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||
ipWid->setSettings(settings);
|
||||
ethernetWid->setSettings(settings);
|
||||
vlanWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("macvlan")) {
|
||||
} else if (generalWid->connectionType->currentText() == QString("macvlan")) {
|
||||
ipWid->setSettings(settings);
|
||||
ethernetWid->setSettings(settings);
|
||||
macvlanWid->setSettings(settings);
|
||||
}
|
||||
else if (generalWid->connectionType->currentText() == QString("openvswitch")) {
|
||||
ipWid->setSettings(settings);
|
||||
openvWid->setSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1024,8 +935,7 @@ void MainWindow::profileTabRemoveProfile()
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("Remove"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else
|
||||
} else
|
||||
status = netctlProfile->removeProfile(profile);
|
||||
if (status)
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||
@ -1040,8 +950,7 @@ void MainWindow::profileTabRemoveProfile()
|
||||
void MainWindow::wifiTabContextualMenu(const QPoint &pos)
|
||||
{
|
||||
if (debug) qDebug() << "[MainWindow]" << "[wifiTabContextualMenu]";
|
||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||
return;
|
||||
if (ui->tableWidget_wifi->currentItem() == 0) return;
|
||||
|
||||
// create menu
|
||||
QMenu menu(this);
|
||||
@ -1055,13 +964,11 @@ void MainWindow::wifiTabContextualMenu(const QPoint &pos)
|
||||
if (!ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
startWifi->setText(QApplication::translate("MainWindow", "Stop WiFi"));
|
||||
startWifi->setIcon(QIcon::fromTheme("process-stop"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
startWifi->setText(QApplication::translate("MainWindow", "Start WiFi"));
|
||||
startWifi->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
startWifi->setText(QApplication::translate("MainWindow", "Start WiFi"));
|
||||
startWifi->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
@ -1071,8 +978,7 @@ void MainWindow::wifiTabContextualMenu(const QPoint &pos)
|
||||
if (action == refreshTable) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[wifiTabContextualMenu]" << "Refresh WiFi";
|
||||
updateWifiTab();
|
||||
}
|
||||
else if (action == startWifi) {
|
||||
} else if (action == startWifi) {
|
||||
if (debug) qDebug() << "[MainWindow]" << "[wifiTabContextualMenu]" << "Start WiFi";
|
||||
wifiTabStart();
|
||||
}
|
||||
@ -1088,8 +994,7 @@ void MainWindow::wifiTabSetEnabled(const bool state)
|
||||
ui->tableWidget_wifi->show();
|
||||
ui->pushButton_wifiRefresh->setEnabled(true);
|
||||
ui->label_wifi->hide();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->tableWidget_wifi->hide();
|
||||
ui->pushButton_wifiRefresh->setDisabled(true);
|
||||
ui->pushButton_wifiStart->setDisabled(true);
|
||||
@ -1103,8 +1008,7 @@ void MainWindow::wifiTabStart()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[wifiTabStart]";
|
||||
if (!checkExternalApps(QString("wpasup")))
|
||||
return errorWin->showWindow(1, QString("[MainWindow] : [wifiTabStart]"));
|
||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||
return;
|
||||
if (ui->tableWidget_wifi->currentItem() == 0) return;
|
||||
|
||||
ui->tabWidget->setDisabled(true);
|
||||
// name is hidden
|
||||
@ -1142,8 +1046,7 @@ void MainWindow::wifiTabStart()
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QString profileName = wpaCommand->existentProfile(profile);
|
||||
netctlCommand->startProfile(profileName);
|
||||
current = netctlCommand->isProfileActive(profileName);
|
||||
@ -1152,8 +1055,7 @@ void MainWindow::wifiTabStart()
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
|
||||
else
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 1)->text();
|
||||
if (security.contains(QString("none")))
|
||||
return connectToUnknownEssid(QString(""));
|
||||
@ -1195,13 +1097,11 @@ void MainWindow::wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetIt
|
||||
if (!ui->tableWidget_wifi->item(current->row(), 3)->text().isEmpty()) {
|
||||
ui->pushButton_wifiStart->setText(QApplication::translate("MainWindow", "Stop"));
|
||||
ui->pushButton_wifiStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->pushButton_wifiStart->setText(QApplication::translate("MainWindow", "Start"));
|
||||
ui->pushButton_wifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui->pushButton_wifiStart->setText(QApplication::translate("MainWindow", "Start"));
|
||||
ui->pushButton_wifiStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "aboutwindow.h"
|
||||
#include "dbusoperation.h"
|
||||
#include "errorwindow.h"
|
||||
#include "ethernetwidget.h"
|
||||
#include "language.h"
|
||||
#include "netctlautowindow.h"
|
||||
#include "passwdwidget.h"
|
||||
@ -60,8 +59,7 @@ void MainWindow::showMainWindow()
|
||||
if (isHidden()) {
|
||||
updateTabs(ui->tabWidget->currentIndex());
|
||||
show();
|
||||
}
|
||||
else
|
||||
} else
|
||||
hide();
|
||||
}
|
||||
|
||||
@ -97,8 +95,7 @@ bool MainWindow::enableProfileSlot(const QString profile)
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileEnabled"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
netctlCommand->enableProfile(profile);
|
||||
current = netctlCommand->isProfileEnabled(profile);
|
||||
}
|
||||
@ -122,8 +119,7 @@ bool MainWindow::restartProfileSlot(const QString profile)
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
netctlCommand->restartProfile(profile);
|
||||
current = netctlCommand->isProfileActive(profile);
|
||||
}
|
||||
@ -147,8 +143,7 @@ bool MainWindow::startProfileSlot(const QString profile)
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
netctlCommand->startProfile(profile);
|
||||
current = netctlCommand->isProfileActive(profile);
|
||||
}
|
||||
@ -181,13 +176,11 @@ bool MainWindow::switchToProfileSlot(const QString profile)
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("autoIsProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
netctlCommand->autoStartProfile(profile);
|
||||
current = netctlCommand->autoIsProfileActive(profile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (useHelper) {
|
||||
QList<QVariant> args;
|
||||
args.append(profile);
|
||||
@ -197,8 +190,7 @@ bool MainWindow::switchToProfileSlot(const QString profile)
|
||||
current = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
netctlCommand->switchToProfile(profile);
|
||||
current = netctlCommand->isProfileActive(profile);
|
||||
}
|
||||
@ -409,8 +401,7 @@ void MainWindow::connectToUnknownEssid(const QString passwd)
|
||||
QList<QVariant>(), true, debug)[0].toStringList();
|
||||
else
|
||||
interfaces = netctlCommand->getWirelessInterfaceList();
|
||||
if (interfaces.isEmpty())
|
||||
return;
|
||||
if (interfaces.isEmpty()) return;
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
settings[QString("Description")] = QString("'Automatically generated profile by Netctl GUI'");
|
||||
@ -453,8 +444,7 @@ void MainWindow::connectToUnknownEssid(const QString passwd)
|
||||
status = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileActive"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
||||
netctlProfile->copyProfile(profileTempName);
|
||||
netctlCommand->startProfile(profile);
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "mobilewidget.h"
|
||||
#include "netctlautowindow.h"
|
||||
#include "netctlguiadaptor.h"
|
||||
#include "openvswitchwidget.h"
|
||||
#include "passwdwidget.h"
|
||||
#include "pppoewidget.h"
|
||||
#include "settingswindow.h"
|
||||
@ -80,12 +79,10 @@ MainWindow::MainWindow(QWidget *parent,
|
||||
ui->tableWidget_wifi->setCurrentCell(i, 0);
|
||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||
errorWin->showWindow(18, QString("[MainWindow] : [MainWindow]"));
|
||||
}
|
||||
else if (args[QString("open")].toString() != QString("PROFILE")) {
|
||||
} else if (args[QString("open")].toString() != QString("PROFILE")) {
|
||||
ui->comboBox_profile->addItem(args[QString("open")].toString());
|
||||
ui->comboBox_profile->setCurrentIndex(ui->comboBox_profile->count()-1);
|
||||
}
|
||||
else if (args[QString("select")].toString() != QString("PROFILE")) {
|
||||
} else if (args[QString("select")].toString() != QString("PROFILE")) {
|
||||
for (int i=0; i<ui->tableWidget_main->rowCount(); i++)
|
||||
if (ui->tableWidget_main->item(i, 0)->text() == args[QString("select")].toString())
|
||||
ui->tableWidget_main->setCurrentCell(i, 0);
|
||||
@ -127,13 +124,11 @@ QStringList MainWindow::printInformation()
|
||||
QList<QVariant>(), true, debug)[0].toStringList();
|
||||
profile = request[0];
|
||||
status = request[1];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (netctlCommand->isNetctlAutoRunning()) {
|
||||
profile = netctlCommand->autoGetActiveProfile();
|
||||
status = QString("netctl-auto");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
profile = netctlCommand->getActiveProfile();
|
||||
status = netctlCommand->getProfileStatus(profile);
|
||||
}
|
||||
@ -188,15 +183,13 @@ QStringList MainWindow::printTrayInformation()
|
||||
enabled = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
|
||||
DBUS_HELPER_INTERFACE, QString("isProfileEnabled"),
|
||||
args, true, debug)[0].toBool();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
netctlAutoStatus = netctlCommand->isNetctlAutoRunning();
|
||||
if (netctlAutoStatus) {
|
||||
current = netctlCommand->autoGetActiveProfile();
|
||||
enabled = netctlCommand->autoIsProfileEnabled(current);
|
||||
profiles = netctlCommand->getProfileListFromNetctlAuto();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
current = netctlCommand->getActiveProfile();
|
||||
enabled = netctlCommand->isProfileEnabled(current);
|
||||
profiles = netctlCommand->getProfileList();
|
||||
@ -252,8 +245,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
(configuration[QString("SYSTRAY")] == QString("true"))) {
|
||||
hide();
|
||||
event->ignore();
|
||||
}
|
||||
else
|
||||
} else
|
||||
closeMainWindow();
|
||||
}
|
||||
|
||||
@ -420,8 +412,6 @@ 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);
|
||||
@ -451,7 +441,6 @@ 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;
|
||||
@ -483,8 +472,7 @@ QMap<QString, QString> MainWindow::parseOptions(const QString options)
|
||||
|
||||
QMap<QString, QString> settings;
|
||||
for (int i=0; i<options.split(QChar(',')).count(); i++) {
|
||||
if (options.split(QChar(','))[i].split(QChar('=')).count() < 2)
|
||||
continue;
|
||||
if (options.split(QChar(','))[i].split(QChar('=')).count() < 2) continue;
|
||||
settings[options.split(QChar(','))[i].split(QChar('='))[0]] =
|
||||
options.split(QChar(','))[i].split(QChar('='))[1];
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ class IpWidget;
|
||||
class MacvlanWidget;
|
||||
class MobileWidget;
|
||||
class NetctlAutoWindow;
|
||||
class OpenvswitchWidget;
|
||||
class PasswdWidget;
|
||||
class PppoeWidget;
|
||||
class SettingsWindow;
|
||||
@ -142,7 +141,6 @@ private:
|
||||
IpWidget *ipWid = nullptr;
|
||||
MacvlanWidget *macvlanWid = nullptr;
|
||||
MobileWidget *mobileWid = nullptr;
|
||||
OpenvswitchWidget *openvWid = nullptr;
|
||||
PppoeWidget *pppoeWid = nullptr;
|
||||
TunnelWidget *tunnelWid = nullptr;
|
||||
TuntapWidget *tuntapWid = nullptr;
|
||||
|
@ -1,73 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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<QString, QString> OpenvswitchWidget::getSettings()
|
||||
{
|
||||
QMap<QString, QString> openvswitchSettings;
|
||||
|
||||
if (isOk() != 0)
|
||||
return openvswitchSettings;
|
||||
|
||||
return openvswitchSettings;
|
||||
}
|
||||
|
||||
|
||||
int OpenvswitchWidget::isOk()
|
||||
{
|
||||
// all fine
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void OpenvswitchWidget::setSettings(const QMap<QString, QString> settings)
|
||||
{
|
||||
clear();
|
||||
QMap<QString, QString> OpenvswitchWidget = settings;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 <QWidget>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class OpenvswitchWidget;
|
||||
}
|
||||
|
||||
class OpenvswitchWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenvswitchWidget(QWidget *parent = 0);
|
||||
~OpenvswitchWidget();
|
||||
QMap<QString, QString> getSettings();
|
||||
int isOk();
|
||||
void setSettings(const QMap<QString, QString> settings);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
void setShown(const bool state);
|
||||
|
||||
private:
|
||||
Ui::OpenvswitchWidget *ui;
|
||||
};
|
||||
|
||||
|
||||
#endif /* OPENVSWITCHWIDGET_H */
|
@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenvswitchWidget</class>
|
||||
<widget class="QWidget" name="OpenvswitchWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>391</width>
|
||||
<height>79</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_openvswitch">
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>openvswitch settings</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_openvswitch">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>684</width>
|
||||
<height>401</height>
|
||||
<width>682</width>
|
||||
<height>399</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -136,8 +136,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>468</width>
|
||||
<height>340</height>
|
||||
<width>466</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@ -211,8 +211,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>468</width>
|
||||
<height>340</height>
|
||||
<width>466</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
@ -296,6 +296,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_helperPathInfo">
|
||||
<property name="text">
|
||||
<string>There are too binaries. `netctlgui-helper` should be running as root (for example from systemd), otherwise interface `/ctrl` will not be available. `netctlgui-helper-suid` may be running as normal user, but you should keep it in mind that it has SUID bit.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_helperPath">
|
||||
<item>
|
||||
@ -381,8 +391,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>468</width>
|
||||
<height>340</height>
|
||||
<width>436</width>
|
||||
<height>165</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@ -568,8 +578,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>468</width>
|
||||
<height>340</height>
|
||||
<width>436</width>
|
||||
<height>43</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@ -638,8 +648,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>468</width>
|
||||
<height>340</height>
|
||||
<width>277</width>
|
||||
<height>190</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
@ -835,8 +845,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>468</width>
|
||||
<height>340</height>
|
||||
<width>466</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
|
@ -55,5 +55,6 @@ endif()
|
||||
add_executable (${SUBPROJECT} ${SOURCES} ${HEADERS} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
||||
# install properties
|
||||
install (TARGETS ${SUBPROJECT} DESTINATION bin
|
||||
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
||||
install (TARGETS ${SUBPROJECT} DESTINATION bin RENAME ${SUBPROJECT}-suid
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID)
|
||||
|
Loading…
Reference in New Issue
Block a user