edited ethernet widget

This commit is contained in:
arcan1s 2014-02-17 22:11:37 +04:00
parent 6b9f9beabc
commit 4e53eaa1ea
3 changed files with 83 additions and 49 deletions

View File

@ -24,6 +24,8 @@ EthernetWidget::EthernetWidget(QWidget *parent)
ui(new Ui::EthernetWidget) ui(new Ui::EthernetWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
createActions();
showAdvanced();
} }
@ -31,3 +33,44 @@ EthernetWidget::~EthernetWidget()
{ {
delete ui; delete ui;
} }
void EthernetWidget::clear()
{
ui->checkBox_skip->setCheckState(Qt::Unchecked);
ui->checkBox_8021x->setCheckState(Qt::Unchecked);
ui->lineEdit_wpaConfig->clear();
ui->comboBox_driver->setCurrentIndex(0);
ui->spinBox_timeoutCarrier->setValue(5);
ui->spinBox_timeoutWpa->setValue(15);
}
void EthernetWidget::createActions()
{
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
connect(ui->checkBox_8021x, SIGNAL(stateChanged(int)), this, SLOT(showWpa(int)));
}
void EthernetWidget::showAdvanced()
{
if (ui->pushButton_ethernetAdvanced->text().indexOf(QString("Show")) > -1) {
ui->widget_ethernetAdvanced->setShown(true);
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Hide advanced"));
}
else {
ui->widget_ethernetAdvanced->setHidden(true);
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Show advanced"));
}
clear();
}
void EthernetWidget::showWpa(int state)
{
if (state == 0)
ui->widget_wpa->setHidden(true);
else
ui->widget_wpa->setShown(true);
}

View File

@ -33,8 +33,16 @@ public:
explicit EthernetWidget(QWidget *parent = 0); explicit EthernetWidget(QWidget *parent = 0);
~EthernetWidget(); ~EthernetWidget();
public slots:
void clear();
private slots:
void showAdvanced();
void showWpa(int state);
private: private:
Ui::EthernetWidget *ui; Ui::EthernetWidget *ui;
void createActions();
}; };

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>431</width> <width>431</width>
<height>275</height> <height>296</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -15,19 +15,19 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QDockWidget" name="dockWidget"> <widget class="QDockWidget" name="dockWidget_ethernet">
<property name="features"> <property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set> <set>QDockWidget::NoDockWidgetFeatures</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Ethernet options</string> <string>Ethernet options</string>
</property> </property>
<widget class="QWidget" name="dockWidgetContents"> <widget class="QWidget" name="dockWidgetContents_ethernet">
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<layout class="QHBoxLayout" name="layout_advanced"> <layout class="QHBoxLayout" name="layout_ethernetAdvanced">
<item> <item>
<spacer name="spacer_advanced"> <spacer name="spacer_ethernetAdvanced">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -40,19 +40,19 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_advanced"> <widget class="QPushButton" name="pushButton_ethernetAdvanced">
<property name="text"> <property name="text">
<string>Show advanced</string> <string>Hide advanced</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget_ethernetAdvanced" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QCheckBox" name="checkBox"> <widget class="QCheckBox" name="checkBox_skip">
<property name="toolTip"> <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> <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>
@ -62,7 +62,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkBox_2"> <widget class="QCheckBox" name="checkBox_8021x">
<property name="toolTip"> <property name="toolTip">
<string>Set to yes to use 802.1x authentication</string> <string>Set to yes to use 802.1x authentication</string>
</property> </property>
@ -75,12 +75,12 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget_2" native="true"> <widget class="QWidget" name="widget_wpa" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="layout_wpaConfig">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label_wpaConfig">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>150</width>
@ -93,7 +93,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit"> <widget class="QLineEdit" name="lineEdit_wpaConfig">
<property name="toolTip"> <property name="toolTip">
<string>Path to a wpa_supplicant configuration file</string> <string>Path to a wpa_supplicant configuration file</string>
</property> </property>
@ -102,9 +102,9 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="layout_driver">
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_driver">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>150</width>
@ -117,7 +117,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBox"> <widget class="QComboBox" name="comboBox_driver">
<property name="toolTip"> <property name="toolTip">
<string>The wpa_supplicant driver to use for 802.1x authentication</string> <string>The wpa_supplicant driver to use for 802.1x authentication</string>
</property> </property>
@ -144,9 +144,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="layout_timeoutCarrier">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_timeoutCarrier">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>150</width>
@ -159,7 +159,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSpinBox" name="spinBox"> <widget class="QSpinBox" name="spinBox_timeoutCarrier">
<property name="toolTip"> <property name="toolTip">
<string>Maximum time, in seconds, to wait for a carrier</string> <string>Maximum time, in seconds, to wait for a carrier</string>
</property> </property>
@ -174,9 +174,9 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="layout_timeoutWpa">
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_timeoutWpa">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>150</width>
@ -184,12 +184,12 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Timeout carrier</string> <string>Timeout WPA</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSpinBox" name="spinBox_2"> <widget class="QSpinBox" name="spinBox_timeoutWpa">
<property name="toolTip"> <property name="toolTip">
<string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string> <string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string>
</property> </property>
@ -213,31 +213,14 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>pushButton_advanced</tabstop> <tabstop>pushButton_ethernetAdvanced</tabstop>
<tabstop>checkBox</tabstop> <tabstop>checkBox_skip</tabstop>
<tabstop>checkBox_2</tabstop> <tabstop>checkBox_8021x</tabstop>
<tabstop>lineEdit</tabstop> <tabstop>lineEdit_wpaConfig</tabstop>
<tabstop>comboBox</tabstop> <tabstop>comboBox_driver</tabstop>
<tabstop>spinBox</tabstop> <tabstop>spinBox_timeoutCarrier</tabstop>
<tabstop>spinBox_2</tabstop> <tabstop>spinBox_timeoutWpa</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <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> </ui>