From 4e53eaa1ea37cddf54d87acfe3bf5ef6ec998686 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 17 Feb 2014 22:11:37 +0400 Subject: [PATCH] edited ethernet widget --- sources/gui/src/ethernetwidget.cpp | 43 ++++++++++++++++ sources/gui/src/ethernetwidget.h | 8 +++ sources/gui/src/ethernetwidget.ui | 81 ++++++++++++------------------ 3 files changed, 83 insertions(+), 49 deletions(-) diff --git a/sources/gui/src/ethernetwidget.cpp b/sources/gui/src/ethernetwidget.cpp index e1d9bab..3948429 100644 --- a/sources/gui/src/ethernetwidget.cpp +++ b/sources/gui/src/ethernetwidget.cpp @@ -24,6 +24,8 @@ EthernetWidget::EthernetWidget(QWidget *parent) ui(new Ui::EthernetWidget) { ui->setupUi(this); + createActions(); + showAdvanced(); } @@ -31,3 +33,44 @@ EthernetWidget::~EthernetWidget() { 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); +} diff --git a/sources/gui/src/ethernetwidget.h b/sources/gui/src/ethernetwidget.h index c3cd322..8cc0220 100644 --- a/sources/gui/src/ethernetwidget.h +++ b/sources/gui/src/ethernetwidget.h @@ -33,8 +33,16 @@ public: explicit EthernetWidget(QWidget *parent = 0); ~EthernetWidget(); +public slots: + void clear(); + +private slots: + void showAdvanced(); + void showWpa(int state); + private: Ui::EthernetWidget *ui; + void createActions(); }; diff --git a/sources/gui/src/ethernetwidget.ui b/sources/gui/src/ethernetwidget.ui index 54a7024..9d4cabf 100644 --- a/sources/gui/src/ethernetwidget.ui +++ b/sources/gui/src/ethernetwidget.ui @@ -7,7 +7,7 @@ 0 0 431 - 275 + 296 @@ -15,19 +15,19 @@ - + QDockWidget::NoDockWidgetFeatures Ethernet options - + - + - + Qt::Horizontal @@ -40,19 +40,19 @@ - + - Show advanced + Hide advanced - + - + <html><head/><body><p>Whether or not the absence of a carrier is acceptable</p></body></html> @@ -62,7 +62,7 @@ - + Set to ‘yes’ to use 802.1x authentication @@ -75,12 +75,12 @@ - + - + - + 150 @@ -93,7 +93,7 @@ - + Path to a wpa_supplicant configuration file @@ -102,9 +102,9 @@ - + - + 150 @@ -117,7 +117,7 @@ - + The wpa_supplicant driver to use for 802.1x authentication @@ -144,9 +144,9 @@ - + - + 150 @@ -159,7 +159,7 @@ - + Maximum time, in seconds, to wait for a carrier @@ -174,9 +174,9 @@ - + - + 150 @@ -184,12 +184,12 @@ - Timeout carrier + Timeout WPA - + Maximum time, in seconds, to wait for 802.1x authentication to succeed @@ -213,31 +213,14 @@ - pushButton_advanced - checkBox - checkBox_2 - lineEdit - comboBox - spinBox - spinBox_2 + pushButton_ethernetAdvanced + checkBox_skip + checkBox_8021x + lineEdit_wpaConfig + comboBox_driver + spinBox_timeoutCarrier + spinBox_timeoutWpa - - - checkBox_2 - clicked(bool) - widget_2 - setShown(bool) - - - 70 - 112 - - - 125 - 130 - - - - +