mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
edit ui
* remove margins * create more pretty toolbars * edit toolbar update action (s/setVisible/setEnabled/g)
This commit is contained in:
parent
275d71d75f
commit
02432be630
@ -8,7 +8,7 @@ ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
||||
Build Type=Debug
|
||||
Build Type=Release
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>76</height>
|
||||
<height>44</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_bridge">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_bridge">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_skip">
|
||||
<item>
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>275</height>
|
||||
<height>227</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_ethernet">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_ethernet">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_ethernetAdvanced">
|
||||
<item>
|
||||
@ -51,6 +54,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_ethernetAdvanced" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_skip">
|
||||
<item>
|
||||
@ -117,6 +123,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_wpa" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_wpaConfig">
|
||||
<item>
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>492</height>
|
||||
<height>452</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_general">
|
||||
<property name="sizePolicy">
|
||||
@ -30,6 +30,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_general">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_description">
|
||||
<item>
|
||||
@ -282,6 +285,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_generalAdvanced" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="layout_after">
|
||||
<item>
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>1286</height>
|
||||
<height>1154</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_ip">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_ip">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_ip">
|
||||
<item>
|
||||
@ -76,6 +79,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_ip" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="layout_ipAddress">
|
||||
<item>
|
||||
@ -238,6 +244,9 @@ Should be according to standards</string>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_ip6" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="layout_ipAddress6">
|
||||
<item>
|
||||
@ -371,9 +380,15 @@ Should be according to standards</string>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_ipAdvanced" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_ipRoutes" native="true">
|
||||
<layout class="QVBoxLayout" name="layout_ipRoutes">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_ipRoutesLine">
|
||||
<item>
|
||||
@ -478,6 +493,9 @@ Should be according to standards</string>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_ipRoutes6" native="true">
|
||||
<layout class="QVBoxLayout" name="layout_ipRoutes6">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_ipRoutes6Line">
|
||||
<item>
|
||||
@ -717,6 +735,9 @@ Should be according to standards</string>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_dhcp" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_dhcp">
|
||||
<item>
|
||||
@ -763,6 +784,9 @@ Should be according to standards</string>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_dhcpcdOpt" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_dhcpcdOpt">
|
||||
<property name="sizePolicy">
|
||||
@ -798,6 +822,9 @@ Should be according to standards</string>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_dhclientOpt" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_dhclientOpt">
|
||||
<item>
|
||||
@ -945,6 +972,9 @@ Should be according to standards</string>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_dns" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="layout_dns">
|
||||
<item>
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>103</height>
|
||||
<height>79</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_macvlan">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_macvlan">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="layout_mode">
|
||||
<item>
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QDBusMessage>
|
||||
#include <QDir>
|
||||
#include <QLibraryInfo>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTranslator>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
@ -130,6 +131,9 @@ int main(int argc, char *argv[])
|
||||
args[QString("error")] = true;
|
||||
}
|
||||
}
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
if (!args[QString("debug")].toBool()) args[QString("debug")] = (debugEnv == QString("yes"));
|
||||
if ((args[QString("debug")].toBool()) ||
|
||||
(args[QString("help")].toBool()) ||
|
||||
(args[QString("info")].toBool()) ||
|
||||
@ -143,6 +147,13 @@ int main(int argc, char *argv[])
|
||||
if (args[QString("select")].toString() != QString("PROFILE"))
|
||||
args[QString("tab")] = static_cast<int>(1);
|
||||
|
||||
// check
|
||||
QString robotEnv = environment.value(QString("SKYNET"), QString(""));
|
||||
if (!robotEnv.isEmpty()) {
|
||||
cout << "Sorry, this software is only for humans" << endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// detach from console
|
||||
if (args[QString("detached")].toBool())
|
||||
daemon(0, 0);
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
MainWidget::MainWidget(QWidget *parent, const QMap<QString, QString> settings, const bool debugCmd)
|
||||
: QWidget(parent),
|
||||
: QMainWindow(parent),
|
||||
debug(debugCmd),
|
||||
configuration(settings)
|
||||
{
|
||||
@ -39,7 +39,6 @@ MainWidget::MainWidget(QWidget *parent, const QMap<QString, QString> settings, c
|
||||
useHelper = (configuration[QString("USE_HELPER")] == QString("true"));
|
||||
|
||||
createObjects();
|
||||
createToolBars();
|
||||
createActions();
|
||||
}
|
||||
|
||||
@ -52,6 +51,20 @@ MainWidget::~MainWidget()
|
||||
}
|
||||
|
||||
|
||||
bool MainWidget::mainTabSelectProfileSlot(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||
|
||||
for (int i=0; i<ui->tableWidget_main->rowCount(); i++) {
|
||||
if (ui->tableWidget_main->item(i, 0)->text() != profile) continue;
|
||||
ui->tableWidget_main->setCurrentCell(i, 0);
|
||||
}
|
||||
|
||||
return (ui->tableWidget_main->currentItem() != nullptr);
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::showNetctlAutoWindow()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -74,33 +87,32 @@ void MainWidget::updateMenuMain()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool selected = (ui->tableWidget_main->currentItem() != nullptr);
|
||||
toolBarActions[QString("mainStart")]->setVisible(selected);
|
||||
toolBarActions[QString("mainEnable")]->setVisible(selected);
|
||||
toolBarActions[QString("mainEdit")]->setVisible(selected);
|
||||
toolBarActions[QString("mainRemove")]->setVisible(selected);
|
||||
toolBarActions[QString("mainStopAll")]->setVisible(!mainTabGetActiveProfiles().isEmpty());
|
||||
ui->actionStart->setEnabled(selected);
|
||||
ui->actionEnable->setEnabled(selected);
|
||||
ui->actionEdit->setEnabled(selected);
|
||||
ui->actionRemove->setEnabled(selected);
|
||||
|
||||
if (selected && !ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text().isEmpty()) {
|
||||
// visible
|
||||
toolBarActions[QString("mainRestart")]->setVisible(true);
|
||||
toolBarActions[QString("mainSwitch")]->setVisible(true);
|
||||
ui->actionRestart->setEnabled(true);
|
||||
ui->actionSwitch->setEnabled(false);
|
||||
// text
|
||||
toolBarActions[QString("mainStart")]->setText(QApplication::translate("MainWidget", "Stop"));
|
||||
toolBarActions[QString("mainStart")]->setIcon(QIcon::fromTheme("process-stop"));
|
||||
ui->actionStart->setText(QApplication::translate("MainWidget", "Stop"));
|
||||
ui->actionStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
} else {
|
||||
// visible
|
||||
toolBarActions[QString("mainRestart")]->setVisible(false);
|
||||
toolBarActions[QString("mainSwitch")]->setVisible(false);
|
||||
ui->actionRestart->setEnabled(false);
|
||||
ui->actionSwitch->setEnabled(selected);
|
||||
// text
|
||||
toolBarActions[QString("mainStart")]->setText(QApplication::translate("MainWidget", "Start"));
|
||||
toolBarActions[QString("mainStart")]->setIcon(QIcon::fromTheme("system-run"));
|
||||
ui->actionStart->setText(QApplication::translate("MainWidget", "Start"));
|
||||
ui->actionStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
}
|
||||
if (selected && !ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 3)->text().isEmpty()) {
|
||||
toolBarActions[QString("mainEnable")]->setText(QApplication::translate("MainWidget", "Disable"));
|
||||
toolBarActions[QString("mainEnable")]->setIcon(QIcon::fromTheme("edit-remove"));
|
||||
ui->actionEnable->setText(QApplication::translate("MainWidget", "Disable"));
|
||||
ui->actionEnable->setIcon(QIcon::fromTheme("edit-remove"));
|
||||
} else {
|
||||
toolBarActions[QString("mainEnable")]->setText(QApplication::translate("MainWidget", "Enable"));
|
||||
toolBarActions[QString("mainEnable")]->setIcon(QIcon::fromTheme("list-add"));
|
||||
ui->actionEnable->setText(QApplication::translate("MainWidget", "Enable"));
|
||||
ui->actionEnable->setIcon(QIcon::fromTheme("list-add"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,20 +298,6 @@ void MainWidget::mainTabEnableProfile()
|
||||
}
|
||||
|
||||
|
||||
QStringList MainWidget::mainTabGetActiveProfiles()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList profiles;
|
||||
for (int i=0; i<ui->tableWidget_main->rowCount(); i++) {
|
||||
if (ui->tableWidget_main->item(i, 2)->text().isEmpty()) continue;
|
||||
profiles.append(ui->tableWidget_main->item(i, 0)->text());
|
||||
}
|
||||
|
||||
return profiles;
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::mainTabRemoveProfile()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -411,6 +409,16 @@ void MainWidget::createActions()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// menu actions
|
||||
connect(ui->actionEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
||||
connect(ui->actionEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
||||
connect(ui->actionNetctl_auto, SIGNAL(triggered(bool)), this, SLOT(showNetctlAutoWindow()));
|
||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
||||
connect(ui->actionRemove, SIGNAL(triggered(bool)), this, SLOT(mainTabRemoveProfile()));
|
||||
connect(ui->actionRestart, SIGNAL(triggered(bool)), this, SLOT(mainTabRestartProfile()));
|
||||
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(mainTabStartProfile()));
|
||||
connect(ui->actionStop_all, SIGNAL(triggered(bool)), this, SLOT(mainTabStopAllProfiles()));
|
||||
connect(ui->actionSwitch, SIGNAL(triggered(bool)), this, SLOT(mainTabSwitchToProfile()));
|
||||
// main tab events
|
||||
connect(ui->pushButton_netctlAuto, SIGNAL(clicked(bool)), this, SLOT(showNetctlAutoWindow()));
|
||||
connect(ui->tableWidget_main, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(mainTabStartProfile()));
|
||||
@ -433,52 +441,13 @@ void MainWidget::createObjects()
|
||||
ui->tableWidget_main->setColumnHidden(2, true);
|
||||
ui->tableWidget_main->setColumnHidden(3, true);
|
||||
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::createToolBars()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
actionToolBar = new QToolBar(this);
|
||||
actionToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
toolBarActions[QString("netctlAuto")] = actionToolBar->addAction(QApplication::translate("MainWidget", "netctl-auto"),
|
||||
this, SLOT(showNetctlAutoWindow()));
|
||||
toolBarActions[QString("mainRefresh")] = actionToolBar->addAction(QIcon::fromTheme(QString("view-refresh")),
|
||||
QApplication::translate("MainWidget", "Refresh"),
|
||||
this, SLOT(updateMainTab()));
|
||||
|
||||
actionMenu = new QToolButton(this);
|
||||
actionMenu->setPopupMode(QToolButton::DelayedPopup);
|
||||
actionMenu->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
QMenu *menu = new QMenu(actionMenu);
|
||||
toolBarActions[QString("mainStart")] = menu->addAction(QIcon::fromTheme(QString("system-run")),
|
||||
QApplication::translate("MainWidget", "Start"),
|
||||
this, SLOT(mainTabStartProfile()));
|
||||
toolBarActions[QString("mainSwitch")] = menu->addAction(QIcon::fromTheme(QString("system-run")),
|
||||
QApplication::translate("MainWidget", "Switch"),
|
||||
this, SLOT(mainTabSwitchToProfile()));
|
||||
toolBarActions[QString("mainRestart")] = menu->addAction(QIcon::fromTheme(QString("view-refresh")),
|
||||
QApplication::translate("MainWidget", "Restart"),
|
||||
this, SLOT(mainTabRestartProfile()));
|
||||
toolBarActions[QString("mainEnable")] = menu->addAction(QIcon::fromTheme(QString("list-add")),
|
||||
QApplication::translate("MainWidget", "Enable"),
|
||||
this, SLOT(mainTabEnableProfile()));
|
||||
toolBarActions[QString("mainStopAll")] = menu->addAction(QIcon::fromTheme(QString("process-stop")),
|
||||
QApplication::translate("MainWidget", "Stop all"),
|
||||
this, SLOT(mainTabStopAllProfiles()));
|
||||
actionMenu->setMenu(menu);
|
||||
actionToolBar->addWidget(actionMenu);
|
||||
|
||||
toolBarActions[QString("mainEdit")] = actionToolBar->addAction(QIcon::fromTheme(QString("document-edit")),
|
||||
QApplication::translate("MainWidget", "Edit"),
|
||||
this, SLOT(mainTabEditProfile()));
|
||||
toolBarActions[QString("mainRemove")] = actionToolBar->addAction(QIcon::fromTheme(QString("edit-delete")),
|
||||
QApplication::translate("MainWidget", "Remove"),
|
||||
this, SLOT(mainTabRemoveProfile()));
|
||||
|
||||
actionMenu->setDefaultAction(toolBarActions[QString("mainStart")]);
|
||||
ui->verticalLayout->insertWidget(0, actionToolBar);
|
||||
// append toolbar
|
||||
QMenu *actionMenu = new QMenu(this);
|
||||
actionMenu->addAction(ui->actionSwitch);
|
||||
actionMenu->addAction(ui->actionRestart);
|
||||
actionMenu->addAction(ui->actionEnable);
|
||||
ui->actionStart->setMenu(actionMenu);
|
||||
}
|
||||
|
||||
|
||||
@ -490,13 +459,5 @@ void MainWidget::deleteObjects()
|
||||
if (netctlProfile != nullptr) delete netctlProfile;
|
||||
|
||||
if (netctlAutoWin != nullptr) delete netctlAutoWin;
|
||||
if (actionMenu != nullptr) {
|
||||
actionMenu->menu()->clear();
|
||||
delete actionMenu;
|
||||
}
|
||||
if (actionToolBar != nullptr) {
|
||||
actionToolBar->clear();
|
||||
delete actionToolBar;
|
||||
}
|
||||
if (ui != nullptr) delete ui;
|
||||
}
|
||||
|
@ -18,10 +18,8 @@
|
||||
#ifndef MAINWIDGET_H
|
||||
#define MAINWIDGET_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QWidget>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
@ -33,7 +31,7 @@ namespace Ui {
|
||||
class MainWidget;
|
||||
}
|
||||
|
||||
class MainWidget : public QWidget
|
||||
class MainWidget : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -44,6 +42,7 @@ public:
|
||||
~MainWidget();
|
||||
|
||||
public slots:
|
||||
bool mainTabSelectProfileSlot(const QString profile);
|
||||
void showNetctlAutoWindow();
|
||||
void update();
|
||||
|
||||
@ -55,7 +54,6 @@ private slots:
|
||||
void mainTabContextualMenu(const QPoint &pos);
|
||||
void mainTabEditProfile();
|
||||
void mainTabEnableProfile();
|
||||
QStringList mainTabGetActiveProfiles();
|
||||
void mainTabRemoveProfile();
|
||||
void mainTabRestartProfile();
|
||||
void mainTabStartProfile();
|
||||
@ -64,9 +62,6 @@ private slots:
|
||||
|
||||
private:
|
||||
// ui
|
||||
QMap<QString, QAction *> toolBarActions;
|
||||
QToolButton *actionMenu = nullptr;
|
||||
QToolBar *actionToolBar = nullptr;
|
||||
MainWindow *mainWindow = nullptr;
|
||||
Ui::MainWidget *ui = nullptr;
|
||||
NetctlAutoWindow *netctlAutoWin = nullptr;
|
||||
@ -75,7 +70,6 @@ private:
|
||||
NetctlProfile *netctlProfile = nullptr;
|
||||
void createActions();
|
||||
void createObjects();
|
||||
void createToolBars();
|
||||
void deleteObjects();
|
||||
QString configPath;
|
||||
bool debug = false;
|
||||
|
@ -1,92 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWidget</class>
|
||||
<widget class="QWidget" name="MainWidget">
|
||||
<widget class="QMainWindow" name="MainWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<width>515</width>
|
||||
<height>477</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_netctlAuto" native="true">
|
||||
<layout class="QHBoxLayout" name="layout_netctlAuto">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_netctlAuto">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>netctl-auto is running</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_netctlAuto">
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_main">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_netctlAuto" native="true">
|
||||
<layout class="QHBoxLayout" name="layout_netctlAuto">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_netctlAuto">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>netctl-auto is running</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_netctlAuto">
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_main">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</column>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>Main actions toolbar</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionNetctl_auto"/>
|
||||
<addaction name="actionRefresh"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionStart"/>
|
||||
<addaction name="actionStop_all"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEdit"/>
|
||||
<addaction name="actionRemove"/>
|
||||
</widget>
|
||||
<action name="actionNetctl_auto">
|
||||
<property name="text">
|
||||
<string>netctl-auto</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show netctl-auto window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRefresh">
|
||||
<property name="icon">
|
||||
<iconset theme="view-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Refresh table</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStart">
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start or stop selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSwitch">
|
||||
<property name="text">
|
||||
<string>Switch</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Switch to selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRestart">
|
||||
<property name="icon">
|
||||
<iconset theme="view-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restart</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Restart selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable">
|
||||
<property name="icon">
|
||||
<iconset theme="list-add">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enable or disable selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStop_all">
|
||||
<property name="icon">
|
||||
<iconset theme="process-stop">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stop all</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Stop all profiles</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit">
|
||||
<property name="icon">
|
||||
<iconset theme="document-edit">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Edit selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRemove">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-delete">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QLibraryInfo>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTranslator>
|
||||
#include <QUrl>
|
||||
|
||||
@ -73,22 +74,15 @@ MainWindow::MainWindow(QWidget *parent,
|
||||
updateConfiguration(args);
|
||||
|
||||
// main actions
|
||||
// if (args[QString("essid")].toString() != QString("ESSID")) {
|
||||
// for (int i=0; i<ui->tableWidget_wifi->rowCount(); i++)
|
||||
// if (ui->tableWidget_wifi->item(i, 0)->text() == args[QString("essid")].toString())
|
||||
// ui->tableWidget_wifi->setCurrentCell(i, 0);
|
||||
// if (ui->tableWidget_wifi->currentItem() == nullptr)
|
||||
// ErrorWindow::showWindow(18, QString(PDEBUG), debug);
|
||||
// } 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")) {
|
||||
// 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);
|
||||
// if (ui->tableWidget_main->currentItem() == nullptr)
|
||||
// ErrorWindow::showWindow(17, QString(PDEBUG), debug);
|
||||
// }
|
||||
if (args[QString("essid")].toString() != QString("ESSID")) {
|
||||
if (!wifiMenuWidget->wifiTabSelectEssidSlot(args[QString("essid")].toString()))
|
||||
ErrorWindow::showWindow(18, QString(PDEBUG), debug);
|
||||
} else if (args[QString("open")].toString() != QString("PROFILE")) {
|
||||
newProfileWidget->profileTabOpenProfileSlot(args[QString("open")].toString());
|
||||
} else if (args[QString("select")].toString() != QString("PROFILE")) {
|
||||
if (!mainWidget->mainTabSelectProfileSlot(args[QString("select")].toString()))
|
||||
ErrorWindow::showWindow(17, QString(PDEBUG), debug);
|
||||
}
|
||||
|
||||
// show windows
|
||||
if (args[QString("about")].toBool())
|
||||
@ -341,7 +335,7 @@ void MainWindow::openProfileSlot(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
newProfileWidget->profileTabOpenProfile(profile);
|
||||
newProfileWidget->profileTabOpenProfileSlot(profile);
|
||||
}
|
||||
|
||||
|
||||
@ -687,8 +681,8 @@ void MainWindow::createActions()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
connect(ui->actionConnect_to_profile, SIGNAL(triggered()), this, SLOT(setMainTab()));
|
||||
connect(ui->actionCreate_a_new_profile, SIGNAL(triggered()), this, SLOT(setProfileTab()));
|
||||
connect(ui->actionNetctl, SIGNAL(triggered()), this, SLOT(setMainTab()));
|
||||
connect(ui->actionProfiles, SIGNAL(triggered()), this, SLOT(setProfileTab()));
|
||||
connect(ui->actionWiFi_menu, SIGNAL(triggered()), this, SLOT(setWifiTab()));
|
||||
connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(setTab(int)));
|
||||
connect(this, SIGNAL(needToBeConfigured()), this, SLOT(showSettingsWindow()));
|
||||
@ -775,9 +769,9 @@ 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;
|
||||
settings[options.split(QChar(','))[i].split(QChar('='))[0]] =
|
||||
options.split(QChar(','))[i].split(QChar('='))[1];
|
||||
QStringList option = options.split(QChar(','))[i].split(QChar('='));
|
||||
if (option.count() != 2) continue;
|
||||
settings[option[0]] = option[1];
|
||||
}
|
||||
for (int i=0; i<settings.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << QString("%1=%2").arg(settings.keys()[i]).arg(settings[settings.keys()[i]]);
|
||||
|
@ -24,13 +24,25 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_main">
|
||||
<layout class="QVBoxLayout" name="layout_main"/>
|
||||
<layout class="QVBoxLayout" name="layout_main">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_new">
|
||||
<layout class="QVBoxLayout" name="layout_new"/>
|
||||
<layout class="QVBoxLayout" name="layout_new">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_wifi">
|
||||
<layout class="QVBoxLayout" name="layout_wifi"/>
|
||||
<layout class="QVBoxLayout" name="layout_wifi">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
@ -64,8 +76,8 @@
|
||||
<addaction name="menuMenu"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
<property name="windowTitle">
|
||||
<string>Toolbar</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
||||
@ -76,8 +88,8 @@
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionConnect_to_profile"/>
|
||||
<addaction name="actionCreate_a_new_profile"/>
|
||||
<addaction name="actionNetctl"/>
|
||||
<addaction name="actionProfiles"/>
|
||||
<addaction name="actionWiFi_menu"/>
|
||||
</widget>
|
||||
<action name="actionSecurity">
|
||||
@ -89,16 +101,25 @@
|
||||
<property name="text">
|
||||
<string>Security</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show security notes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDBus_API">
|
||||
<property name="text">
|
||||
<string>DBus API</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show DBus API</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLibrary">
|
||||
<property name="text">
|
||||
<string>Library</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show library docs</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReport_a_bug">
|
||||
<property name="icon">
|
||||
@ -119,6 +140,9 @@
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>About this application</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="icon">
|
||||
@ -146,32 +170,37 @@
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConnect_to_profile">
|
||||
<action name="actionNetctl">
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect to profile</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+P</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate_a_new_profile">
|
||||
<property name="icon">
|
||||
<iconset theme="document-new"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create a new profile</string>
|
||||
<string>netctl control</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create a new profile</string>
|
||||
<string>netctl control</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProfiles">
|
||||
<property name="icon">
|
||||
<iconset theme="document-new">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Profiles</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Profiles</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+P</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWiFi_menu">
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources/resources.qrc">
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>350</height>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_mobile">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_mobile">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_username">
|
||||
<item>
|
||||
@ -247,6 +250,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_mobileAdvanced" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_route">
|
||||
<item>
|
||||
|
@ -169,23 +169,19 @@ void NetctlAutoWindow::netctlAutoUpdateTable()
|
||||
enabled = netctlCommand->isNetctlAutoEnabled();
|
||||
running = netctlCommand->isNetctlAutoRunning();
|
||||
}
|
||||
ui->actionDisableAll->setEnabled(running);
|
||||
ui->actionEnableAll->setEnabled(running);
|
||||
ui->actionRestartService->setEnabled(running);
|
||||
if (enabled)
|
||||
ui->actionEnableService->setText(QApplication::translate("NetctlAutoWindow", "Disable service"));
|
||||
else
|
||||
ui->actionEnableService->setText(QApplication::translate("NetctlAutoWindow", "Enable service"));
|
||||
ui->actionEnableService->setVisible(true);
|
||||
if (running) {
|
||||
ui->label_info->setText(QApplication::translate("NetctlAutoWindow", "netctl-auto is running"));
|
||||
ui->actionStartService->setText(QApplication::translate("NetctlAutoWindow", "Stop service"));
|
||||
ui->actionDisableAll->setVisible(true);
|
||||
ui->actionEnableAll->setVisible(true);
|
||||
ui->actionRestartService->setVisible(true);
|
||||
} else {
|
||||
ui->label_info->setText(QApplication::translate("NetctlAutoWindow", "netctl-auto is not running"));
|
||||
ui->actionStartService->setText(QApplication::translate("NetctlAutoWindow", "Start service"));
|
||||
ui->actionDisableAll->setVisible(false);
|
||||
ui->actionEnableAll->setVisible(false);
|
||||
ui->actionRestartService->setVisible(false);
|
||||
netctlAutoRefreshButtons(nullptr, nullptr);
|
||||
return;
|
||||
}
|
||||
@ -441,15 +437,10 @@ void NetctlAutoWindow::netctlAutoRefreshButtons(QTableWidgetItem *current, QTabl
|
||||
Q_UNUSED(previous);
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (current == nullptr) {
|
||||
// menu
|
||||
ui->actionEnable->setEnabled(false);
|
||||
ui->actionSwitch->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
ui->actionSwitch->setEnabled(ui->tableWidget->item(current->row(), 2)->text().isEmpty());
|
||||
ui->actionEnable->setEnabled(true);
|
||||
if (!ui->tableWidget->item(current->row(), 3)->text().isEmpty()) {
|
||||
bool selected = (current != nullptr);
|
||||
ui->actionEnable->setEnabled(selected);
|
||||
ui->actionSwitch->setEnabled(selected && ui->tableWidget->item(current->row(), 2)->text().isEmpty());
|
||||
if (selected && !ui->tableWidget->item(current->row(), 3)->text().isEmpty()) {
|
||||
ui->actionEnable->setText(QApplication::translate("NetctlAutoWindow", "Enable"));
|
||||
ui->actionEnable->setIcon(QIcon::fromTheme("list-add"));
|
||||
} else {
|
||||
|
@ -66,8 +66,8 @@
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
<property name="windowTitle">
|
||||
<string>Toolbar</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
||||
@ -79,6 +79,7 @@
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionRefresh"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSwitch"/>
|
||||
<addaction name="actionEnable"/>
|
||||
</widget>
|
||||
@ -143,6 +144,9 @@
|
||||
<property name="text">
|
||||
<string>Start service</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start or stop service</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRestartService">
|
||||
<property name="text">
|
||||
@ -153,6 +157,9 @@
|
||||
<property name="text">
|
||||
<string>Enable service</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enable or disable service</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRefresh">
|
||||
<property name="icon">
|
||||
@ -163,6 +170,9 @@
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Refresh table</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
@ -176,6 +186,9 @@
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enable or disable profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSwitch">
|
||||
<property name="icon">
|
||||
@ -186,6 +199,9 @@
|
||||
<property name="text">
|
||||
<string>Switch</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Switch to profile</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
|
||||
NewProfileWidget::NewProfileWidget(QWidget *parent, const QMap<QString, QString> settings, const bool debugCmd)
|
||||
: QWidget(parent),
|
||||
: QMainWindow(parent),
|
||||
debug(debugCmd),
|
||||
configuration(settings)
|
||||
{
|
||||
@ -50,7 +50,6 @@ NewProfileWidget::NewProfileWidget(QWidget *parent, const QMap<QString, QString>
|
||||
useHelper = (configuration[QString("USE_HELPER")] == QString("true"));
|
||||
|
||||
createObjects();
|
||||
createToolBars();
|
||||
createActions();
|
||||
}
|
||||
|
||||
@ -63,7 +62,7 @@ NewProfileWidget::~NewProfileWidget()
|
||||
}
|
||||
|
||||
|
||||
void NewProfileWidget::profileTabOpenProfile(const QString profile)
|
||||
void NewProfileWidget::profileTabOpenProfileSlot(const QString profile)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -84,12 +83,11 @@ void NewProfileWidget::update()
|
||||
void NewProfileWidget::updateMenuProfile()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
actionMenu->setDefaultAction(toolBarActions[QString("profileSave")]);
|
||||
|
||||
bool selected = !ui->comboBox_profile->currentText().isEmpty();
|
||||
toolBarActions[QString("profileLoad")]->setVisible(selected);
|
||||
toolBarActions[QString("profileRemove")]->setVisible(selected);
|
||||
toolBarActions[QString("profileSave")]->setVisible(selected);
|
||||
ui->actionLoad->setEnabled(selected);
|
||||
ui->actionRemove->setEnabled(selected);
|
||||
ui->actionSave->setEnabled(selected);
|
||||
}
|
||||
|
||||
|
||||
@ -427,6 +425,11 @@ void NewProfileWidget::createActions()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// menu actions
|
||||
connect(ui->actionClear, SIGNAL(triggered(bool)), this, SLOT(profileTabClear()));
|
||||
connect(ui->actionLoad, SIGNAL(triggered(bool)), this, SLOT(profileTabLoadProfile()));
|
||||
connect(ui->actionRemove, SIGNAL(triggered(bool)), this, SLOT(profileTabRemoveProfile()));
|
||||
connect(ui->actionSave, SIGNAL(triggered(bool)), this, SLOT(profileTabCreateProfile()));
|
||||
// main tab events
|
||||
connect(ui->comboBox_profile, SIGNAL(currentIndexChanged(QString)), this, SLOT(profileTabLoadProfile()));
|
||||
connect(ui->comboBox_profile, SIGNAL(editTextChanged(QString)), this, SLOT(updateMenuProfile()));
|
||||
@ -471,38 +474,6 @@ void NewProfileWidget::createObjects()
|
||||
}
|
||||
|
||||
|
||||
void NewProfileWidget::createToolBars()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
actionToolBar = new QToolBar(this);
|
||||
actionToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
toolBarActions[QString("profileClear")] = actionToolBar->addAction(QIcon::fromTheme(QString("edit-clear")),
|
||||
QApplication::translate("NewProfileWidget", "Clear"),
|
||||
this, SLOT(profileTabClear()));
|
||||
|
||||
actionMenu = new QToolButton(this);
|
||||
actionMenu->setPopupMode(QToolButton::DelayedPopup);
|
||||
actionMenu->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
QMenu *menu = new QMenu(actionMenu);
|
||||
toolBarActions[QString("profileLoad")] = menu->addAction(QIcon::fromTheme(QString("document-open")),
|
||||
QApplication::translate("NewProfileWidget", "Load"),
|
||||
this, SLOT(profileTabLoadProfile()));
|
||||
toolBarActions[QString("profileSave")] = menu->addAction(QIcon::fromTheme(QString("document-save")),
|
||||
QApplication::translate("NewProfileWidget", "Save"),
|
||||
this, SLOT(profileTabCreateProfile()));
|
||||
actionMenu->setMenu(menu);
|
||||
actionToolBar->addWidget(actionMenu);
|
||||
|
||||
toolBarActions[QString("profileRemove")] = actionToolBar->addAction(QIcon::fromTheme(QString("edit-delete")),
|
||||
QApplication::translate("NewProfileWidget", "Remove"),
|
||||
this, SLOT(profileTabRemoveProfile()));
|
||||
|
||||
actionMenu->setDefaultAction(toolBarActions[QString("profileSave")]);
|
||||
ui->verticalLayout->insertWidget(0, actionToolBar);
|
||||
}
|
||||
|
||||
|
||||
void NewProfileWidget::deleteObjects()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -522,13 +493,5 @@ void NewProfileWidget::deleteObjects()
|
||||
if (vlanWid != nullptr) delete vlanWid;
|
||||
if (wirelessWid != nullptr) delete wirelessWid;
|
||||
|
||||
if (actionMenu != nullptr) {
|
||||
actionMenu->menu()->clear();
|
||||
delete actionMenu;
|
||||
}
|
||||
if (actionToolBar != nullptr) {
|
||||
actionToolBar->clear();
|
||||
delete actionToolBar;
|
||||
}
|
||||
if (ui != nullptr) delete ui;
|
||||
}
|
||||
|
@ -18,9 +18,7 @@
|
||||
#ifndef NEWPROFILEWIDGET_H
|
||||
#define NEWPROFILEWIDGET_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QWidget>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
@ -42,7 +40,7 @@ namespace Ui {
|
||||
class NewProfileWidget;
|
||||
}
|
||||
|
||||
class NewProfileWidget : public QWidget
|
||||
class NewProfileWidget : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -53,7 +51,7 @@ public:
|
||||
~NewProfileWidget();
|
||||
|
||||
public slots:
|
||||
void profileTabOpenProfile(const QString profile);
|
||||
void profileTabOpenProfileSlot(const QString profile);
|
||||
void update();
|
||||
|
||||
private slots:
|
||||
@ -69,9 +67,6 @@ private slots:
|
||||
|
||||
private:
|
||||
// ui
|
||||
QMap<QString, QAction *> toolBarActions;
|
||||
QToolButton *actionMenu = nullptr;
|
||||
QToolBar *actionToolBar = nullptr;
|
||||
MainWindow *mainWindow;
|
||||
Ui::NewProfileWidget *ui = nullptr;
|
||||
BridgeWidget *bridgeWid = nullptr;
|
||||
@ -90,7 +85,6 @@ private:
|
||||
NetctlProfile *netctlProfile = nullptr;
|
||||
void createActions();
|
||||
void createObjects();
|
||||
void createToolBars();
|
||||
void deleteObjects();
|
||||
bool debug = false;
|
||||
bool useHelper = true;
|
||||
|
@ -1,80 +1,164 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NewProfileWidget</class>
|
||||
<widget class="QWidget" name="NewProfileWidget">
|
||||
<widget class="QMainWindow" name="NewProfileWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>473</width>
|
||||
<height>410</height>
|
||||
<width>472</width>
|
||||
<height>409</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_profile">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_profile">
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_profile">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_profile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Profile</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_profile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>461</width>
|
||||
<height>342</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Profile</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="scrollArea_layout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_profile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>457</width>
|
||||
<height>363</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="scrollArea_layout"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>New profile toolbar</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionClear"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLoad"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionRemove"/>
|
||||
</widget>
|
||||
<action name="actionClear">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-clear">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear data</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoad">
|
||||
<property name="icon">
|
||||
<iconset theme="document-open">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Load selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset theme="document-save">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRemove">
|
||||
<property name="icon">
|
||||
<iconset theme="edit-delete">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove selected profile</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -16,9 +16,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="spacer2">
|
||||
|
@ -10,9 +10,6 @@
|
||||
<height>561</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_pppoe">
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>411</width>
|
||||
<height>146</height>
|
||||
<height>108</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_tunnel">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_tunnel">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_mode">
|
||||
<item>
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>146</height>
|
||||
<height>108</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_tuntap">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_tuntap">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_mode">
|
||||
<item>
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>393</width>
|
||||
<height>81</height>
|
||||
<height>46</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_vlan">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_vlan">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_vlan">
|
||||
<item>
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
WiFiMenuWidget::WiFiMenuWidget(QWidget *parent, const QMap<QString, QString> settings, const bool debugCmd)
|
||||
: QWidget(parent),
|
||||
: QMainWindow(parent),
|
||||
debug(debugCmd),
|
||||
configuration(settings)
|
||||
{
|
||||
@ -39,7 +39,6 @@ WiFiMenuWidget::WiFiMenuWidget(QWidget *parent, const QMap<QString, QString> set
|
||||
useHelper = (configuration[QString("USE_HELPER")] == QString("true"));
|
||||
|
||||
createObjects();
|
||||
createToolBars();
|
||||
createActions();
|
||||
}
|
||||
|
||||
@ -61,6 +60,19 @@ void WiFiMenuWidget::update()
|
||||
}
|
||||
|
||||
|
||||
bool WiFiMenuWidget::wifiTabSelectEssidSlot(const QString essid)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Essid" << essid;
|
||||
|
||||
for (int i=0; i<ui->tableWidget_wifi->rowCount(); i++) {
|
||||
if (ui->tableWidget_wifi->item(i, 0)->text() != essid) continue;
|
||||
ui->tableWidget_wifi->setCurrentCell(i, 0);
|
||||
}
|
||||
return (ui->tableWidget_wifi->currentItem() != nullptr);
|
||||
}
|
||||
|
||||
|
||||
void WiFiMenuWidget::connectToUnknownEssid(const QString passwd)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -155,13 +167,13 @@ void WiFiMenuWidget::updateMenuWifi()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool selected = (ui->tableWidget_wifi->currentItem() != nullptr);
|
||||
toolBarActions[QString("wifiStart")]->setVisible(selected);
|
||||
ui->actionStart->setEnabled(selected);
|
||||
if (selected && ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 5)->text().isEmpty()) {
|
||||
toolBarActions[QString("wifiStart")]->setText(QApplication::translate("WiFiMenuWidget", "Start"));
|
||||
toolBarActions[QString("wifiStart")]->setIcon(QIcon::fromTheme("system-run"));
|
||||
ui->actionStart->setText(QApplication::translate("WiFiMenuWidget", "Start"));
|
||||
ui->actionStart->setIcon(QIcon::fromTheme("system-run"));
|
||||
} else {
|
||||
toolBarActions[QString("wifiStart")]->setText(QApplication::translate("WiFiMenuWidget", "Stop"));
|
||||
toolBarActions[QString("wifiStart")]->setIcon(QIcon::fromTheme("process-stop"));
|
||||
ui->actionStart->setText(QApplication::translate("WiFiMenuWidget", "Stop"));
|
||||
ui->actionStart->setIcon(QIcon::fromTheme("process-stop"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,6 +406,9 @@ void WiFiMenuWidget::createActions()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// menu actions
|
||||
connect(ui->actionRefresh, SIGNAL(triggered(bool)), this, SLOT(updateWifiTab()));
|
||||
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(wifiTabStart()));
|
||||
// wifi tab events
|
||||
connect(ui->tableWidget_wifi, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(wifiTabStart()));
|
||||
connect(ui->tableWidget_wifi, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)),
|
||||
@ -418,23 +433,6 @@ void WiFiMenuWidget::createObjects()
|
||||
}
|
||||
|
||||
|
||||
void WiFiMenuWidget::createToolBars()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
actionToolBar = new QToolBar(this);
|
||||
actionToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
toolBarActions[QString("wifiRefresh")] = actionToolBar->addAction(QIcon::fromTheme(QString("view-refresh")),
|
||||
QApplication::translate("WiFiMenuWidget", "Refresh"),
|
||||
this, SLOT(updateWifiTab()));
|
||||
toolBarActions[QString("wifiStart")] = actionToolBar->addAction(QIcon::fromTheme(QString("system-run")),
|
||||
QApplication::translate("WiFiMenuWidget", "Start"),
|
||||
this, SLOT(wifiTabStart()));
|
||||
|
||||
ui->verticalLayout->insertWidget(0, actionToolBar);
|
||||
}
|
||||
|
||||
|
||||
void WiFiMenuWidget::deleteObjects()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -443,9 +441,5 @@ void WiFiMenuWidget::deleteObjects()
|
||||
if (netctlProfile != nullptr) delete netctlProfile;
|
||||
if (wpaCommand != nullptr) delete wpaCommand;
|
||||
|
||||
if (actionToolBar != nullptr) {
|
||||
actionToolBar->clear();
|
||||
delete actionToolBar;
|
||||
}
|
||||
if (ui != nullptr) delete ui;
|
||||
}
|
||||
|
@ -19,9 +19,7 @@
|
||||
#define WIFIMENUWIDGET_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QWidget>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
@ -33,7 +31,7 @@ namespace Ui {
|
||||
class WiFiMenuWidget;
|
||||
}
|
||||
|
||||
class WiFiMenuWidget : public QWidget
|
||||
class WiFiMenuWidget : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -45,6 +43,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
bool wifiTabSelectEssidSlot(const QString essid);
|
||||
// wifi tab slots
|
||||
void connectToUnknownEssid(const QString passwd);
|
||||
void setHiddenName(const QString name);
|
||||
@ -60,8 +59,6 @@ private slots:
|
||||
|
||||
private:
|
||||
// ui
|
||||
QMap<QString, QAction *> toolBarActions;
|
||||
QToolBar *actionToolBar = nullptr;
|
||||
MainWindow *mainWindow = nullptr;
|
||||
Ui::WiFiMenuWidget *ui = nullptr;
|
||||
PasswdWidget *passwdWid = nullptr;
|
||||
@ -71,7 +68,6 @@ private:
|
||||
WpaSup *wpaCommand = nullptr;
|
||||
void createActions();
|
||||
void createObjects();
|
||||
void createToolBars();
|
||||
void deleteObjects();
|
||||
bool debug = false;
|
||||
bool hiddenNetwork;
|
||||
|
@ -1,100 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WiFiMenuWidget</class>
|
||||
<widget class="QWidget" name="WiFiMenuWidget">
|
||||
<widget class="QMainWindow" name="WiFiMenuWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>571</width>
|
||||
<width>570</width>
|
||||
<height>467</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_wifi">
|
||||
<property name="text">
|
||||
<string>Please install 'wpa_supplicant' before using it</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_wifi">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_wifi">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
<string>Please install 'wpa_supplicant' before using it</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_wifi">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string># of points</string>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Signal</string>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
<property name="columnCount">
|
||||
<number>7</number>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Security</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string># of points</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Signal</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Security</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>WiFi menu toolbar</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonFollowStyle</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionRefresh"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionStart"/>
|
||||
</widget>
|
||||
<action name="actionRefresh">
|
||||
<property name="icon">
|
||||
<iconset theme="view-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Refresh table</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStart">
|
||||
<property name="icon">
|
||||
<iconset theme="system-run">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Connect or disconnect from selected ESSID</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -50,6 +50,7 @@ void WirelessWidget::clear()
|
||||
ui->listWidget_wpaConfigSection->setCurrentRow(-1);
|
||||
ui->listWidget_wpaConfigSection->clear();
|
||||
ui->lineEdit_wpaConfig->setText(QString("/etc/wpa_supplicant/wpa_supplicant.conf"));
|
||||
ui->checkBox_key->setCheckState(Qt::Unchecked);
|
||||
ui->lineEdit_key->clear();
|
||||
ui->checkBox_hidden->setCheckState(Qt::Unchecked);
|
||||
ui->checkBox_adhoc->setCheckState(Qt::Unchecked);
|
||||
@ -93,6 +94,7 @@ void WirelessWidget::createActions()
|
||||
connect(ui->lineEdit_wpaConfigSection, SIGNAL(returnPressed()), this, SLOT(addOption()));
|
||||
connect(ui->pushButton_wpaConfig, SIGNAL(clicked(bool)), this, SLOT(selectWpaConfig()));
|
||||
connect(ui->comboBox_security, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeSecurity(QString)));
|
||||
connect(ui->checkBox_key, SIGNAL(stateChanged(int)), this, SLOT(setKeyEchoMode(int)));
|
||||
}
|
||||
|
||||
|
||||
@ -157,6 +159,15 @@ void WirelessWidget::selectWpaConfig()
|
||||
}
|
||||
|
||||
|
||||
void WirelessWidget::setKeyEchoMode(const int mode)
|
||||
{
|
||||
if (mode == 0)
|
||||
ui->lineEdit_key->setEchoMode(QLineEdit::Password);
|
||||
else
|
||||
ui->lineEdit_key->setEchoMode(QLineEdit::Normal);
|
||||
}
|
||||
|
||||
|
||||
void WirelessWidget::showAdvanced()
|
||||
{
|
||||
if (ui->pushButton_wirelessAdvanced->isChecked()) {
|
||||
|
@ -47,6 +47,7 @@ private slots:
|
||||
void addFreq();
|
||||
void addOption();
|
||||
void changeSecurity(const QString currentText);
|
||||
void setKeyEchoMode(const int mode);
|
||||
void showAdvanced();
|
||||
void selectWpaConfig();
|
||||
|
||||
|
@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>584</width>
|
||||
<height>776</height>
|
||||
<height>697</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDockWidget" name="dockWidget_wireless">
|
||||
<property name="features">
|
||||
@ -24,6 +24,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents_wireless">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_security">
|
||||
<item>
|
||||
@ -82,6 +85,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_essid" native="true">
|
||||
<layout class="QHBoxLayout" name="layout_essid">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_essid">
|
||||
<property name="sizePolicy">
|
||||
@ -117,6 +123,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_wpaConfigSection" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_wpaConfigSection">
|
||||
<item>
|
||||
@ -179,6 +188,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_wpaConfig" native="true">
|
||||
<layout class="QHBoxLayout" name="layout_wpaConfigFile">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_wpaConfig">
|
||||
<property name="sizePolicy">
|
||||
@ -227,20 +239,23 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_key" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_key">
|
||||
<widget class="QCheckBox" name="checkBox_key">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Key</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -254,6 +269,9 @@
|
||||
<property name="toolTip">
|
||||
<string>The secret key to a WEP, or WPA encrypted network</string>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -292,6 +310,9 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_wirelessAdvanced" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_exclude">
|
||||
<item>
|
||||
|
@ -70,7 +70,7 @@ public slots:
|
||||
// wpaCommand
|
||||
QString CurrentWiFi();
|
||||
QStringList VerboseWiFi();
|
||||
QStringList WiFi();
|
||||
Q_DECL_DEPRECATED QStringList WiFi();
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QDBusMessage>
|
||||
#include <QDir>
|
||||
#include <QLibraryInfo>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTranslator>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
@ -87,6 +88,9 @@ int main(int argc, char *argv[])
|
||||
args[QString("error")] = true;
|
||||
}
|
||||
}
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
if (!args[QString("debug")].toBool()) args[QString("debug")] = (debugEnv == QString("yes"));
|
||||
if ((args[QString("debug")].toBool()) ||
|
||||
(args[QString("help")].toBool()) ||
|
||||
(args[QString("info")].toBool()) ||
|
||||
@ -102,6 +106,13 @@ int main(int argc, char *argv[])
|
||||
args[QString("session")] = true;
|
||||
}
|
||||
|
||||
// check
|
||||
QString robotEnv = environment.value(QString("SKYNET"), QString(""));
|
||||
if (!robotEnv.isEmpty()) {
|
||||
cout << "Sorry, this software is only for humans" << endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QCoreApplication::setSetuidAllowed(true);
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ public slots:
|
||||
QString netctlActiveProfile();
|
||||
QStringList netctlProfileList();
|
||||
QStringList netctlVerboseProfileList();
|
||||
QStringList ProfileList();
|
||||
Q_DECL_DEPRECATED QStringList ProfileList();
|
||||
QStringList VerboseProfileList();
|
||||
// netctlProfile
|
||||
QStringList Profile(const QString profile);
|
||||
|
Loading…
Reference in New Issue
Block a user