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