added ethernet widget

This commit is contained in:
arcan1s 2014-02-10 10:58:29 +04:00
parent b81bd78327
commit ec27411b1d
10 changed files with 549 additions and 158 deletions

View File

@ -0,0 +1,33 @@
/***************************************************************************
* This file is part of netctl-plasmoid *
* *
* netctl-plasmoid is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-plasmoid is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-plasmoid. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "ethernetwidget.h"
#include "ui_ethernetwidget.h"
EthernetWidget::EthernetWidget(QWidget *parent)
: QWidget(parent),
ui(new Ui::EthernetWidget)
{
ui->setupUi(this);
}
EthernetWidget::~EthernetWidget()
{
delete ui;
}

View File

@ -0,0 +1,41 @@
/***************************************************************************
* This file is part of netctl-plasmoid *
* *
* netctl-plasmoid is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-plasmoid is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-plasmoid. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef ETHERNETWIDGET_H
#define ETHERNETWIDGET_H
#include <QWidget>
namespace Ui {
class EthernetWidget;
}
class EthernetWidget : public QWidget
{
Q_OBJECT
public:
explicit EthernetWidget(QWidget *parent = 0);
~EthernetWidget();
private:
Ui::EthernetWidget *ui;
};
#endif /* ETHERNETWIDGET_H */

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EthernetWidget</class>
<widget class="QWidget" name="EthernetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>431</width>
<height>275</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QDockWidget" name="dockWidget">
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Ethernet options</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="layout_advanced">
<item>
<spacer name="spacer_advanced">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_advanced">
<property name="text">
<string>Show advanced</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the absence of a carrier is acceptable&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Skip no carrier</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="toolTip">
<string>Set to yes to use 802.1x authentication</string>
</property>
<property name="text">
<string>802.1x authentication</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>WPA config file</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="toolTip">
<string>Path to a wpa_supplicant configuration file</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>WPA driver</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="toolTip">
<string>The wpa_supplicant driver to use for 802.1x authentication</string>
</property>
<item>
<property name="text">
<string>wired</string>
</property>
</item>
<item>
<property name="text">
<string>nl80211</string>
</property>
</item>
<item>
<property name="text">
<string>wext</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Timeout carrier</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="toolTip">
<string>Maximum time, in seconds, to wait for a carrier</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Timeout carrier</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_2">
<property name="toolTip">
<string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>pushButton_advanced</tabstop>
<tabstop>checkBox</tabstop>
<tabstop>checkBox_2</tabstop>
<tabstop>lineEdit</tabstop>
<tabstop>comboBox</tabstop>
<tabstop>spinBox</tabstop>
<tabstop>spinBox_2</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>checkBox_2</sender>
<signal>clicked(bool)</signal>
<receiver>widget_2</receiver>
<slot>setShown(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>70</x>
<y>112</y>
</hint>
<hint type="destinationlabel">
<x>125</x>
<y>130</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -26,6 +26,7 @@ GeneralWidget::GeneralWidget(QWidget *parent)
ui->setupUi(this);
}
GeneralWidget::~GeneralWidget()
{
delete ui;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>587</width>
<height>473</height>
<width>431</width>
<height>498</height>
</rect>
</property>
<property name="windowTitle">
@ -150,9 +150,9 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_bindto">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="layout_bindtoLabel">
<layout class="QHBoxLayout" name="layout_bindtoButton">
<item>
<widget class="QLabel" name="label_bindto">
<property name="text">
@ -161,41 +161,24 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_bindtoButton">
<item>
<widget class="QComboBox" name="comboBox_bindto">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_bindto">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spacer_bindto">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QComboBox" name="comboBox_bindto">
<property name="minimumSize">
<size>
<width>20</width>
<height>40</height>
<width>150</width>
<height>0</height>
</size>
</property>
</spacer>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_bindto">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
@ -242,9 +225,9 @@
<widget class="QWidget" name="widget_generalAdvanced" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="layout_after">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="layout_afterLabel">
<layout class="QHBoxLayout" name="layout_afterButton">
<item>
<widget class="QLabel" name="label_after">
<property name="text">
@ -253,41 +236,24 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_afterButton">
<item>
<widget class="QComboBox" name="comboBox_after">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_after">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spacer_after">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QComboBox" name="comboBox_after">
<property name="minimumSize">
<size>
<width>20</width>
<height>40</height>
<width>150</width>
<height>0</height>
</size>
</property>
</spacer>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_after">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -26,6 +26,7 @@ IpWidget::IpWidget(QWidget *parent)
ui->setupUi(this);
}
IpWidget::~IpWidget()
{
delete ui;

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IpWdiget</class>
<widget class="QWidget" name="IpWdiget">
<class>IpWidget</class>
<widget class="QWidget" name="IpWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>478</width>
<height>1254</height>
<width>431</width>
<height>1287</height>
</rect>
</property>
<property name="windowTitle">
@ -99,7 +99,7 @@
</size>
</property>
<property name="toolTip">
<string>An array of physical network interfaces that this profile needs before it can be started</string>
<string>An array of IP addresses suffixed with /&lt;netmask&gt;</string>
</property>
</widget>
</item>
@ -121,7 +121,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_gateway"/>
<widget class="QLineEdit" name="lineEdit_gateway">
<property name="toolTip">
<string>An IP routing gateway address</string>
</property>
</widget>
</item>
</layout>
</item>
@ -143,7 +147,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_ipRoutes"/>
<widget class="QLineEdit" name="lineEdit_ipRoutes">
<property name="toolTip">
<string>An array of custom routes</string>
</property>
</widget>
</item>
</layout>
</item>
@ -283,7 +291,7 @@
</size>
</property>
<property name="toolTip">
<string>An array of physical network interfaces that this profile needs before it can be started</string>
<string>An array of IPv6 addresses</string>
</property>
</widget>
</item>
@ -305,7 +313,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_gateway6"/>
<widget class="QLineEdit" name="lineEdit_gateway6">
<property name="toolTip">
<string>An IPv6 routing gateway address</string>
</property>
</widget>
</item>
</layout>
</item>
@ -327,7 +339,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_ipRoutes6"/>
<widget class="QLineEdit" name="lineEdit_ipRoutes6">
<property name="toolTip">
<string>An array of custom routes</string>
</property>
</widget>
</item>
</layout>
</item>
@ -457,7 +473,7 @@
</size>
</property>
<property name="toolTip">
<string>An array of physical network interfaces that this profile needs before it can be started</string>
<string>An array of argument lines to pass to ip</string>
</property>
</widget>
</item>
@ -473,7 +489,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_hostname"/>
<widget class="QLineEdit" name="lineEdit_hostname">
<property name="toolTip">
<string>A system hostname</string>
</property>
</widget>
</item>
</layout>
</item>
@ -481,6 +501,12 @@
<layout class="QHBoxLayout" name="layout_timeoutDad">
<item>
<widget class="QLabel" name="label_timeoutDad">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Timeout DAD</string>
</property>
@ -488,6 +514,9 @@
</item>
<item>
<widget class="QSpinBox" name="spinBox_timeoutDad">
<property name="toolTip">
<string>Set to yes to release the DHCP lease when the profile is stopped</string>
</property>
<property name="minimum">
<number>1</number>
</property>
@ -521,6 +550,9 @@
</item>
<item>
<widget class="QComboBox" name="comboBox_dhcp">
<property name="toolTip">
<string>The name of the preferred DHCP client</string>
</property>
<item>
<property name="text">
<string>dhcpcd</string>
@ -533,13 +565,6 @@
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_dhcp">
<property name="text">
<string>DHCP release on stop</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -558,7 +583,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dhcpcdOpt"/>
<widget class="QLineEdit" name="lineEdit_dhcpcdOpt">
<property name="toolTip">
<string>Additional options to be passed to the DHCP client</string>
</property>
</widget>
</item>
</layout>
</item>
@ -578,7 +607,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dhclientOpt"/>
<widget class="QLineEdit" name="lineEdit_dhclientOpt">
<property name="toolTip">
<string>Additional options to be passed to the DHCP client</string>
</property>
</widget>
</item>
</layout>
</item>
@ -598,7 +631,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dhclientOpt6"/>
<widget class="QLineEdit" name="lineEdit_dhclientOpt6">
<property name="toolTip">
<string>Additional options to be passed to the DHCP client</string>
</property>
</widget>
</item>
</layout>
</item>
@ -619,6 +656,9 @@
</item>
<item>
<widget class="QSpinBox" name="spinBox_timeoutDhcp">
<property name="toolTip">
<string>Maximum time, in seconds, to wait for DHCP to be successful</string>
</property>
<property name="minimum">
<number>1</number>
</property>
@ -632,6 +672,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox_dhcp">
<property name="toolTip">
<string>Set to yes to release the DHCP lease when the profile is stopped</string>
</property>
<property name="text">
<string>DHCP release on stop</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -676,7 +726,7 @@
</size>
</property>
<property name="toolTip">
<string>An array of physical network interfaces that this profile needs before it can be started</string>
<string>An array of DNS nameservers</string>
</property>
</widget>
</item>
@ -698,7 +748,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dnsDomain"/>
<widget class="QLineEdit" name="lineEdit_dnsDomain">
<property name="toolTip">
<string>A domain line for /etc/resolv.conf</string>
</property>
</widget>
</item>
</layout>
</item>
@ -718,7 +772,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dnsSearch_2"/>
<widget class="QLineEdit" name="lineEdit_dnsSearch_2">
<property name="toolTip">
<string>A search line for /etc/resolv.conf</string>
</property>
</widget>
</item>
</layout>
</item>
@ -760,7 +818,7 @@
</size>
</property>
<property name="toolTip">
<string>An array of physical network interfaces that this profile needs before it can be started</string>
<string>An array of options lines for /etc/resolv.conf</string>
</property>
</widget>
</item>
@ -777,23 +835,49 @@
</widget>
</item>
</layout>
<zorder>label</zorder>
<zorder>comboBox_ip</zorder>
<zorder>spinBox</zorder>
<zorder>label_2</zorder>
<zorder>spinBox_2</zorder>
<zorder>spinBox_3</zorder>
<zorder>label_3</zorder>
<zorder>label_4</zorder>
<zorder>spinBox_4</zorder>
<zorder>pushButton_bindto</zorder>
<zorder>label_5</zorder>
<zorder>spinBox_5</zorder>
<zorder>label_15</zorder>
<zorder>label_timeoutDhcp</zorder>
<zorder>spinBox_timeoutDhcp</zorder>
<zorder>dockWidget_ip</zorder>
</widget>
<tabstops>
<tabstop>checkBox_ip</tabstop>
<tabstop>comboBox_ip</tabstop>
<tabstop>lineEdit_ipAddress</tabstop>
<tabstop>pushButton_ipAddress</tabstop>
<tabstop>listWidget_ipAddress</tabstop>
<tabstop>lineEdit_gateway</tabstop>
<tabstop>lineEdit_ipRoutes</tabstop>
<tabstop>lineEdit_ipRoutes2</tabstop>
<tabstop>pushButton_ipRoutes</tabstop>
<tabstop>listWidget_ipRoutes</tabstop>
<tabstop>checkBox_ip6</tabstop>
<tabstop>comboBox_ip6</tabstop>
<tabstop>lineEdit_ipAddress6</tabstop>
<tabstop>pushButton_ipAddress6</tabstop>
<tabstop>listWidget_ipAddress6</tabstop>
<tabstop>lineEdit_gateway6</tabstop>
<tabstop>lineEdit_ipRoutes6</tabstop>
<tabstop>lineEdit_ipRoutes62</tabstop>
<tabstop>pushButton_ipRoutes6</tabstop>
<tabstop>listWidget_ipRoutes6</tabstop>
<tabstop>pushButton_ipAdvanced</tabstop>
<tabstop>lineEdit_custom</tabstop>
<tabstop>pushButton_custom</tabstop>
<tabstop>listWidget_custom</tabstop>
<tabstop>lineEdit_hostname</tabstop>
<tabstop>spinBox_timeoutDad</tabstop>
<tabstop>comboBox_dhcp</tabstop>
<tabstop>lineEdit_dhcpcdOpt</tabstop>
<tabstop>lineEdit_dhclientOpt</tabstop>
<tabstop>lineEdit_dhclientOpt6</tabstop>
<tabstop>spinBox_timeoutDhcp</tabstop>
<tabstop>checkBox_dhcp</tabstop>
<tabstop>lineEdit_dns</tabstop>
<tabstop>pushButton_dns</tabstop>
<tabstop>listWidget_dns</tabstop>
<tabstop>lineEdit_dnsDomain</tabstop>
<tabstop>lineEdit_dnsSearch_2</tabstop>
<tabstop>lineEdit_dnsSearch</tabstop>
<tabstop>pushButton_dnsSearch</tabstop>
<tabstop>listWidget_dnsSearch</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
@ -803,12 +887,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>23</x>
<y>19</y>
<x>33</x>
<y>49</y>
</hint>
<hint type="destinationlabel">
<x>225</x>
<y>24</y>
<x>458</x>
<y>53</y>
</hint>
</hints>
</connection>
@ -819,12 +903,12 @@
<slot>setShown(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>23</x>
<y>24</y>
<x>33</x>
<y>54</y>
</hint>
<hint type="destinationlabel">
<x>19</x>
<y>46</y>
<x>28</x>
<y>101</y>
</hint>
</hints>
</connection>
@ -835,12 +919,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>117</x>
<y>291</y>
<x>127</x>
<y>348</y>
</hint>
<hint type="destinationlabel">
<x>264</x>
<y>302</y>
<x>458</x>
<y>349</y>
</hint>
</hints>
</connection>
@ -851,12 +935,12 @@
<slot>setShown(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>96</x>
<y>291</y>
<x>106</x>
<y>348</y>
</hint>
<hint type="destinationlabel">
<x>47</x>
<y>315</y>
<x>56</x>
<y>608</y>
</hint>
</hints>
</connection>

View File

@ -22,6 +22,9 @@
#include <QProcess>
#include "errorwindow.h"
#include "ethernetwidget.h"
#include "generalwidget.h"
#include "ipwidget.h"
#include "netctlinteract.h"
#include "netctlprofile.h"
#include "passwdwidget.h"
@ -54,6 +57,14 @@ MainWindow::MainWindow(QWidget *parent)
wpaConfig.append(QString("/run/wpa_supplicant_netctl-gui"));
wpaConfig.append(QString("users"));
// gui
generalWid = new GeneralWidget(this);
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
ipWid = new IpWidget(this);
ui->scrollAreaWidgetContents->layout()->addWidget(ipWid);
ethernetWid = new EthernetWidget(this);
ui->scrollAreaWidgetContents->layout()->addWidget(ethernetWid);
// backend
netctlCommand = new Netctl(this, netctlPath, profileDir, sudoPath);
netctlProfile = new NetctlProfile(this, profileDir, sudoPath);
wpaCommand = new WpaSup(this, wpaConfig, sudoPath, ifaceDir, preferedInterface);
@ -65,6 +76,9 @@ MainWindow::MainWindow(QWidget *parent)
MainWindow::~MainWindow()
{
delete ethernetWid;
delete generalWid;
delete ipWid;
delete netctlCommand;
delete netctlProfile;
delete wpaCommand;
@ -140,8 +154,8 @@ void MainWindow::updateTabs(const int tab)
void MainWindow::updateMainTab()
{
if (!checkExternalApps(QString("netctl"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
@ -189,8 +203,8 @@ void MainWindow::updateWifiTab()
{
wifiTabSetEnabled(checkExternalApps(QString("wpasup")));
if (!checkExternalApps(QString("wpasup"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
@ -235,8 +249,8 @@ void MainWindow::updateWifiTab()
void MainWindow::mainTabEnableProfile()
{
if (!checkExternalApps(QString("netctl"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
if (ui->tableWidget_main->currentItem() == 0)
@ -264,8 +278,8 @@ void MainWindow::mainTabEnableProfile()
void MainWindow::mainTabRestartProfile()
{
if (!checkExternalApps(QString("netctl"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
if (ui->tableWidget_main->currentItem() == 0)
@ -285,8 +299,8 @@ void MainWindow::mainTabRestartProfile()
void MainWindow::mainTabStartProfile()
{
if (!checkExternalApps(QString("netctl"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
if (ui->tableWidget_main->currentItem() == 0)
@ -315,8 +329,8 @@ void MainWindow::mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetIt
{
Q_UNUSED(previous);
if (!checkExternalApps(QString("netctl"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
if (current == 0) {
@ -365,7 +379,7 @@ void MainWindow::wifiTabSetEnabled(bool state)
void MainWindow::connectToUnknownEssid(QString passwd)
{
if (!passwd.isEmpty())
delete passwdwid;
delete passwdWid;
QStringList profileInfo;
profileInfo.append(QString("Automatically generated profile by Netctl GUI"));
profileInfo.append(wpaCommand->getInterfaceList()[0]);
@ -390,16 +404,16 @@ void MainWindow::connectToUnknownEssid(QString passwd)
void MainWindow::wifiTabStart()
{
if (!checkExternalApps(QString("wpasup"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
if (ui->tableWidget_wifi->currentItem() == 0)
return;
if (ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text() == QString("<hidden>")) {
ui->pushButton_wifiStart->setDisabled(true);
errorwin = new ErrorWindow(this, 2);
errorwin->show();
errorWin = new ErrorWindow(this, 2);
errorWin->show();
return;
}
@ -427,14 +441,14 @@ void MainWindow::wifiTabStart()
if (checkState(QString("none"), security))
return connectToUnknownEssid(QString(""));
else {
passwdwid = new PasswdWidget(this);
passwdWid = new PasswdWidget(this);
int widgetWidth = 270;
int widgetHeight = 86;
int x = (width() - widgetWidth) / 2;
int y = (height() - widgetHeight) / 2;
passwdwid->setGeometry(x, y, widgetWidth, widgetHeight);
passwdwid->show();
passwdwid->setFocusToLineEdit();
passwdWid->setGeometry(x, y, widgetWidth, widgetHeight);
passwdWid->show();
passwdWid->setFocusToLineEdit();
return;
}
}
@ -446,8 +460,8 @@ void MainWindow::wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetIt
{
Q_UNUSED(previous);
if (!checkExternalApps(QString("wpasup"))) {
errorwin = new ErrorWindow(this, 1);
errorwin->show();
errorWin = new ErrorWindow(this, 1);
errorWin->show();
return;
}
if (current == 0) {

View File

@ -25,6 +25,9 @@
class ErrorWindow;
class EthernetWidget;
class GeneralWidget;
class IpWidget;
class Netctl;
class NetctlProfile;
class PasswdWidget;
@ -73,9 +76,14 @@ private slots:
void wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetItem *previous);
private:
// ui
Ui::MainWindow *ui;
ErrorWindow *errorwin;
PasswdWidget *passwdwid;
EthernetWidget *ethernetWid;
GeneralWidget *generalWid;
IpWidget *ipWid;
// backend
ErrorWindow *errorWin;
PasswdWidget *passwdWid;
bool checkExternalApps(QString apps);
bool checkState(QString state, QString item);
void createActions();

View File

@ -18,7 +18,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_main">
<attribute name="title">
@ -163,8 +163,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>439</width>
<height>421</height>
<width>429</width>
<height>410</height>
</rect>
</property>
<property name="sizePolicy">
@ -173,7 +173,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7"/>
<layout class="QVBoxLayout" name="scrollArea_layout"/>
</widget>
</widget>
</item>
@ -291,7 +291,7 @@
<x>0</x>
<y>0</y>
<width>471</width>
<height>23</height>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuMenu">