mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 23:47:21 +00:00
added several function to profile tab
This commit is contained in:
parent
4dd6a8276d
commit
76877f737e
@ -40,6 +40,15 @@ void BridgeWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BridgeWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
BridgeWidget::show();
|
||||||
|
else
|
||||||
|
BridgeWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, QString> BridgeWidget::getSettings()
|
QHash<QString, QString> BridgeWidget::getSettings()
|
||||||
{
|
{
|
||||||
QHash<QString, QString> bridgeSettings;
|
QHash<QString, QString> bridgeSettings;
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BridgeWidget *ui;
|
Ui::BridgeWidget *ui;
|
||||||
|
@ -54,6 +54,15 @@ void EthernetWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EthernetWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
EthernetWidget::show();
|
||||||
|
else
|
||||||
|
EthernetWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EthernetWidget::createActions()
|
void EthernetWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void selectWpaConfig();
|
void selectWpaConfig();
|
||||||
|
@ -28,6 +28,7 @@ GeneralWidget::GeneralWidget(QWidget *parent, QString ifaceDir, QString profileD
|
|||||||
ui(new Ui::GeneralWidget)
|
ui(new Ui::GeneralWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
connectionType = ui->comboBox_connection;
|
||||||
createActions();
|
createActions();
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
@ -35,6 +36,7 @@ GeneralWidget::GeneralWidget(QWidget *parent, QString ifaceDir, QString profileD
|
|||||||
|
|
||||||
GeneralWidget::~GeneralWidget()
|
GeneralWidget::~GeneralWidget()
|
||||||
{
|
{
|
||||||
|
delete connectionType;
|
||||||
delete ifaceDirectory;
|
delete ifaceDirectory;
|
||||||
delete profileDirectory;
|
delete profileDirectory;
|
||||||
delete ui;
|
delete ui;
|
||||||
@ -64,6 +66,15 @@ void GeneralWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GeneralWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
GeneralWidget::show();
|
||||||
|
else
|
||||||
|
GeneralWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GeneralWidget::createActions()
|
void GeneralWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_generalAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_generalAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#ifndef GENERALWIDGET_H
|
#ifndef GENERALWIDGET_H
|
||||||
#define GENERALWIDGET_H
|
#define GENERALWIDGET_H
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@ -36,12 +37,14 @@ public:
|
|||||||
QString ifaceDir = QString(""),
|
QString ifaceDir = QString(""),
|
||||||
QString profileDir = QString(""));
|
QString profileDir = QString(""));
|
||||||
~GeneralWidget();
|
~GeneralWidget();
|
||||||
|
QComboBox *connectionType;
|
||||||
QHash<QString, QString> getSettings();
|
QHash<QString, QString> getSettings();
|
||||||
int isOk();
|
int isOk();
|
||||||
void setSettings(QHash<QString, QString> settings);
|
void setSettings(QHash<QString, QString> settings);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addAfter();
|
void addAfter();
|
||||||
|
@ -89,6 +89,15 @@ void IpWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void IpWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
IpWidget::show();
|
||||||
|
else
|
||||||
|
IpWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::createActions()
|
void IpWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_ipAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_ipAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// buttons
|
// buttons
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QFileDialog>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
#include "bridgewidget.h"
|
#include "bridgewidget.h"
|
||||||
@ -45,12 +45,11 @@ MainWindow::MainWindow(QWidget *parent, bool defaultSettings, int tabNum)
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tabWidget->setCurrentIndex(tabNum-1);
|
ui->tabWidget->setCurrentIndex(tabNum-1);
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready"));
|
|
||||||
|
|
||||||
// SettingsWindow *settingsWindow;
|
// SettingsWindow *settingsWindow;
|
||||||
// settingsWindow = new SettingsWindow(this);
|
// settingsWindow = new SettingsWindow(this);
|
||||||
// if (defaultSettings)
|
// if (defaultSettings)
|
||||||
// тандартные настройки
|
// стандартные настройки
|
||||||
// delete settingsWindow;
|
// delete settingsWindow;
|
||||||
|
|
||||||
// temporary block
|
// temporary block
|
||||||
@ -68,7 +67,6 @@ MainWindow::MainWindow(QWidget *parent, bool defaultSettings, int tabNum)
|
|||||||
wpaConfig.append(QString("/run/wpa_supplicant_netctl-gui"));
|
wpaConfig.append(QString("/run/wpa_supplicant_netctl-gui"));
|
||||||
wpaConfig.append(QString("users"));
|
wpaConfig.append(QString("users"));
|
||||||
|
|
||||||
|
|
||||||
// gui
|
// gui
|
||||||
generalWid = new GeneralWidget(this, ifaceDir, profileDir);
|
generalWid = new GeneralWidget(this, ifaceDir, profileDir);
|
||||||
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
||||||
@ -97,6 +95,7 @@ MainWindow::MainWindow(QWidget *parent, bool defaultSettings, int tabNum)
|
|||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
updateTabs(ui->tabWidget->currentIndex());
|
updateTabs(ui->tabWidget->currentIndex());
|
||||||
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -165,6 +164,13 @@ void MainWindow::createActions()
|
|||||||
connect(ui->tableWidget_main, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(mainTabStartProfile()));
|
connect(ui->tableWidget_main, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(mainTabStartProfile()));
|
||||||
connect(ui->tableWidget_main, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(mainTabRefreshButtons(QTableWidgetItem *, QTableWidgetItem *)));
|
connect(ui->tableWidget_main, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(mainTabRefreshButtons(QTableWidgetItem *, QTableWidgetItem *)));
|
||||||
|
|
||||||
|
// profile tab events
|
||||||
|
connect(ui->lineEdit_profile, SIGNAL(returnPressed()), this, SLOT(profileTabLoadProfile()));
|
||||||
|
connect(ui->pushButton_profile, SIGNAL(clicked(bool)), this, SLOT(profileTabBrowseProfile()));
|
||||||
|
connect(ui->pushButton_profileClear, SIGNAL(clicked(bool)), this, SLOT(profileTabClear()));
|
||||||
|
connect(ui->pushButton_profileLoad, SIGNAL(clicked(bool)), this, SLOT(profileTabLoadProfile()));
|
||||||
|
connect(generalWid->connectionType, SIGNAL(currentIndexChanged(QString)), this, SLOT(profileTabChangeState(QString)));
|
||||||
|
|
||||||
// wifi page events
|
// wifi page events
|
||||||
connect(ui->pushButton_wifiRefresh, SIGNAL(clicked(bool)), this, SLOT(updateWifiTab()));
|
connect(ui->pushButton_wifiRefresh, SIGNAL(clicked(bool)), this, SLOT(updateWifiTab()));
|
||||||
connect(ui->pushButton_wifiStart, SIGNAL(clicked(bool)), this, SLOT(wifiTabStart()));
|
connect(ui->pushButton_wifiStart, SIGNAL(clicked(bool)), this, SLOT(wifiTabStart()));
|
||||||
@ -229,7 +235,7 @@ void MainWindow::updateMainTab()
|
|||||||
|
|
||||||
void MainWindow::updateProfileTab()
|
void MainWindow::updateProfileTab()
|
||||||
{
|
{
|
||||||
|
profileTabClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -393,6 +399,197 @@ void MainWindow::mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// profile tab slots
|
||||||
|
void MainWindow::profileTabBrowseProfile()
|
||||||
|
{
|
||||||
|
QString filename = QFileDialog::getSaveFileName(
|
||||||
|
this,
|
||||||
|
QApplication::translate("MainWindow", "Save profile as..."),
|
||||||
|
QString("/etc/netctl/"),
|
||||||
|
QApplication::translate("MainWindow", "Profile (*)"));
|
||||||
|
if (!filename.isEmpty())
|
||||||
|
ui->lineEdit_profile->setText(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::profileTabClear()
|
||||||
|
{
|
||||||
|
ui->lineEdit_profile->clear();
|
||||||
|
|
||||||
|
generalWid->clear();
|
||||||
|
ipWid->clear();
|
||||||
|
bridgeWid->clear();
|
||||||
|
ethernetWid->clear();
|
||||||
|
mobileWid->clear();
|
||||||
|
pppoeWid->clear();
|
||||||
|
tunnelWid->clear();
|
||||||
|
tuntapWid->clear();
|
||||||
|
vlanWid->clear();
|
||||||
|
wirelessWid->clear();
|
||||||
|
|
||||||
|
profileTabChangeState(generalWid->connectionType->currentText());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::profileTabChangeState(QString current)
|
||||||
|
{
|
||||||
|
if (current == QString("ethernet")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(true);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(true);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
else if (current == QString("wireless")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(true);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(false);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(true);
|
||||||
|
}
|
||||||
|
else if ((current == QString("bond")) ||
|
||||||
|
(current == QString("dummy"))) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(true);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(false);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
else if (current == QString("bridge")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(true);
|
||||||
|
bridgeWid->setShown(true);
|
||||||
|
ethernetWid->setShown(false);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
else if (current == QString("pppoe")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(false);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(false);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(true);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
else if (current == QString("mobile_ppp")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(false);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(false);
|
||||||
|
mobileWid->setShown(true);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
else if (current == QString("tunnel")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(true);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(false);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(true);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
else if (current == QString("tuntap")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(true);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(false);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(true);
|
||||||
|
vlanWid->setShown(false);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
else if (current == QString("vlan")) {
|
||||||
|
generalWid->setShown(true);
|
||||||
|
ipWid->setShown(true);
|
||||||
|
bridgeWid->setShown(false);
|
||||||
|
ethernetWid->setShown(true);
|
||||||
|
mobileWid->setShown(false);
|
||||||
|
pppoeWid->setShown(false);
|
||||||
|
tunnelWid->setShown(false);
|
||||||
|
tuntapWid->setShown(false);
|
||||||
|
vlanWid->setShown(true);
|
||||||
|
wirelessWid->setShown(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::profileTabLoadProfile()
|
||||||
|
{
|
||||||
|
QString profile = ui->lineEdit_profile->text();
|
||||||
|
QHash<QString, QString> settings = netctlProfile->getSettingsFromProfile(profile);
|
||||||
|
printf("%i\n", settings.count());
|
||||||
|
|
||||||
|
generalWid->setSettings(settings);
|
||||||
|
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||||
|
ipWid->setSettings(settings);
|
||||||
|
ethernetWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||||
|
ipWid->setSettings(settings);
|
||||||
|
wirelessWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if ((generalWid->connectionType->currentText() == QString("bond")) ||
|
||||||
|
(generalWid->connectionType->currentText() == QString("dummy"))) {
|
||||||
|
ipWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||||
|
ipWid->setSettings(settings);
|
||||||
|
bridgeWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||||
|
pppoeWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||||
|
mobileWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||||
|
ipWid->setSettings(settings);
|
||||||
|
tunnelWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||||
|
ipWid->setSettings(settings);
|
||||||
|
tuntapWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||||
|
ipWid->setSettings(settings);
|
||||||
|
ethernetWid->setSettings(settings);
|
||||||
|
vlanWid->setSettings(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// wifi tab slots
|
// wifi tab slots
|
||||||
void MainWindow::wifiTabSetEnabled(bool state)
|
void MainWindow::wifiTabSetEnabled(bool state)
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QItemSelection>
|
|
||||||
#include <QTableWidgetItem>
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QTableWidgetItem>
|
||||||
|
|
||||||
|
|
||||||
class BridgeWidget;
|
class BridgeWidget;
|
||||||
@ -79,6 +78,11 @@ private slots:
|
|||||||
void mainTabRestartProfile();
|
void mainTabRestartProfile();
|
||||||
void mainTabStartProfile();
|
void mainTabStartProfile();
|
||||||
void mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
void mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
|
||||||
|
// profile tab slots
|
||||||
|
void profileTabBrowseProfile();
|
||||||
|
void profileTabChangeState(QString current);
|
||||||
|
void profileTabClear();
|
||||||
|
void profileTabLoadProfile();
|
||||||
// wifi tab slots
|
// wifi tab slots
|
||||||
void wifiTabSetEnabled(bool state);
|
void wifiTabSetEnabled(bool state);
|
||||||
void wifiTabStart();
|
void wifiTabStart();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_main">
|
<widget class="QWidget" name="tab_main">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -190,8 +190,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>429</width>
|
<width>439</width>
|
||||||
<height>348</height>
|
<height>357</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -213,6 +213,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_profileLoad">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_newProfileButtons">
|
<spacer name="spacer_newProfileButtons">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -349,7 +356,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>471</width>
|
<width>471</width>
|
||||||
<height>20</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuMenu">
|
<widget class="QMenu" name="menuMenu">
|
||||||
|
@ -56,6 +56,15 @@ void MobileWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MobileWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
MobileWidget::show();
|
||||||
|
else
|
||||||
|
MobileWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MobileWidget::createActions()
|
void MobileWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_mobileAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_mobileAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void selectOptionsFile();
|
void selectOptionsFile();
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include "netctlprofile.h"
|
#include "netctlprofile.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
|
||||||
@ -33,3 +35,33 @@ NetctlProfile::~NetctlProfile()
|
|||||||
{
|
{
|
||||||
delete profileDirectory;
|
delete profileDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QHash<QString, QString> NetctlProfile::getSettingsFromProfile(QString profile)
|
||||||
|
{
|
||||||
|
QHash<QString, QString> settings;
|
||||||
|
QFile profileFile;
|
||||||
|
QString fileStr;
|
||||||
|
|
||||||
|
if (profile[0] == QDir::separator())
|
||||||
|
profileFile.setFileName(profile);
|
||||||
|
else
|
||||||
|
profileFile.setFileName(profileDirectory->absolutePath() + QDir::separator() + profile);
|
||||||
|
if (!profileFile.open(QIODevice::ReadOnly))
|
||||||
|
return settings;
|
||||||
|
while (true) {
|
||||||
|
fileStr = QString(profileFile.readLine());
|
||||||
|
if (profileFile.atEnd())
|
||||||
|
break;
|
||||||
|
else if (fileStr[0] != '#') {
|
||||||
|
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
||||||
|
settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||||
|
.remove(QString("("))
|
||||||
|
.remove(QString(")"))
|
||||||
|
.remove(QString("\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
profileFile.close();
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
@ -33,6 +33,7 @@ public:
|
|||||||
QString profileDir = QString(""),
|
QString profileDir = QString(""),
|
||||||
QString sudoPath = QString(""));
|
QString sudoPath = QString(""));
|
||||||
~NetctlProfile();
|
~NetctlProfile();
|
||||||
|
QHash<QString, QString> getSettingsFromProfile(QString profile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow *parent;
|
MainWindow *parent;
|
||||||
|
@ -65,6 +65,15 @@ void PppoeWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PppoeWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
PppoeWidget::show();
|
||||||
|
else
|
||||||
|
PppoeWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PppoeWidget::createFilter()
|
void PppoeWidget::createFilter()
|
||||||
{
|
{
|
||||||
// session mac
|
// session mac
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void changeMode(int index);
|
void changeMode(int index);
|
||||||
|
@ -26,7 +26,8 @@ class SleepThread : public QThread
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// private run
|
// private run
|
||||||
void run () {}
|
void run()
|
||||||
|
{}
|
||||||
|
|
||||||
public :
|
public :
|
||||||
static void usleep(long iSleepTime)
|
static void usleep(long iSleepTime)
|
||||||
|
@ -43,6 +43,15 @@ void TunnelWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TunnelWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
TunnelWidget::show();
|
||||||
|
else
|
||||||
|
TunnelWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TunnelWidget::createFilter()
|
void TunnelWidget::createFilter()
|
||||||
{
|
{
|
||||||
// using input mask because validators is not comfortable
|
// using input mask because validators is not comfortable
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TunnelWidget *ui;
|
Ui::TunnelWidget *ui;
|
||||||
|
@ -42,6 +42,15 @@ void TuntapWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TuntapWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
TuntapWidget::show();
|
||||||
|
else
|
||||||
|
TuntapWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, QString> TuntapWidget::getSettings()
|
QHash<QString, QString> TuntapWidget::getSettings()
|
||||||
{
|
{
|
||||||
QHash<QString, QString> tuntapSettings;
|
QHash<QString, QString> tuntapSettings;
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TuntapWidget *ui;
|
Ui::TuntapWidget *ui;
|
||||||
|
@ -40,6 +40,15 @@ void VlanWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VlanWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
VlanWidget::show();
|
||||||
|
else
|
||||||
|
VlanWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, QString> VlanWidget::getSettings()
|
QHash<QString, QString> VlanWidget::getSettings()
|
||||||
{
|
{
|
||||||
QHash<QString, QString> vlanSettings;
|
QHash<QString, QString> vlanSettings;
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::VlanWidget *ui;
|
Ui::VlanWidget *ui;
|
||||||
|
@ -83,6 +83,15 @@ void WirelessWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WirelessWidget::setShown(bool state)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
WirelessWidget::show();
|
||||||
|
else
|
||||||
|
WirelessWidget::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WirelessWidget::createActions()
|
void WirelessWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_wirelessAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_wirelessAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
|
@ -40,6 +40,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
|
void setShown(bool state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addDriver();
|
void addDriver();
|
||||||
|
Loading…
Reference in New Issue
Block a user