-rw-r--r-- | noncore/net/networksetup/interfaces/interfaceinformationimp.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp | 7 |
2 files changed, 2 insertions, 12 deletions
diff --git a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp index 39575c4..cf3dba1 100644 --- a/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp +++ b/noncore/net/networksetup/interfaces/interfaceinformationimp.cpp | |||
@@ -1,81 +1,76 @@ | |||
1 | #include "interfaceinformationimp.h" | 1 | #include "interfaceinformationimp.h" |
2 | #include "interfaceadvanced.h" | 2 | #include "interfaceadvanced.h" |
3 | 3 | ||
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | 8 | ||
9 | #include <assert.h> | ||
10 | |||
11 | /** | 9 | /** |
12 | * Constructor for the InterfaceInformationImp class. This class pretty much | 10 | * Constructor for the InterfaceInformationImp class. This class pretty much |
13 | * just display's information about the interface that is passed to it. | 11 | * just display's information about the interface that is passed to it. |
14 | */ | 12 | */ |
15 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ | 13 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ |
16 | assert(i); | ||
17 | |||
18 | interface = i; | ||
19 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 14 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
20 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); | 15 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); |
21 | updateInterface(interface); | 16 | updateInterface(interface); |
22 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); | 17 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); |
23 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); | 18 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); |
24 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); | 19 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); |
25 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); | 20 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); |
26 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); | 21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); |
27 | } | 22 | } |
28 | 23 | ||
29 | /** | 24 | /** |
30 | * Update the interface information and buttons. | 25 | * Update the interface information and buttons. |
31 | * @param Intarface *i the interface to update (should be the one we already | 26 | * @param Intarface *i the interface to update (should be the one we already |
32 | * know about). | 27 | * know about). |
33 | */ | 28 | */ |
34 | void InterfaceInformationImp::updateInterface(Interface *i){ | 29 | void InterfaceInformationImp::updateInterface(Interface *i){ |
35 | if(interface->getStatus()){ | 30 | if(interface->getStatus()){ |
36 | startButton->setEnabled(false); | 31 | startButton->setEnabled(false); |
37 | stopButton->setEnabled(true); | 32 | stopButton->setEnabled(true); |
38 | restartButton->setEnabled(true); | 33 | restartButton->setEnabled(true); |
39 | } | 34 | } |
40 | else{ | 35 | else{ |
41 | startButton->setEnabled(true); | 36 | startButton->setEnabled(true); |
42 | stopButton->setEnabled(false); | 37 | stopButton->setEnabled(false); |
43 | restartButton->setEnabled(false); | 38 | restartButton->setEnabled(false); |
44 | } | 39 | } |
45 | macAddressLabel->setText(interface->getMacAddress()); | 40 | macAddressLabel->setText(interface->getMacAddress()); |
46 | ipAddressLabel->setText(interface->getIp()); | 41 | ipAddressLabel->setText(interface->getIp()); |
47 | subnetMaskLabel->setText(interface->getSubnetMask()); | 42 | subnetMaskLabel->setText(interface->getSubnetMask()); |
48 | broadcastLabel->setText(interface->getBroadcast()); | 43 | broadcastLabel->setText(interface->getBroadcast()); |
49 | } | 44 | } |
50 | 45 | ||
51 | /** | 46 | /** |
52 | * Create the advanced widget. Fill it with the current interface's information. | 47 | * Create the advanced widget. Fill it with the current interface's information. |
53 | * Display it. | 48 | * Display it. |
54 | */ | 49 | */ |
55 | void InterfaceInformationImp::advanced(){ | 50 | void InterfaceInformationImp::advanced(){ |
56 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); | 51 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); |
57 | a->interfaceName->setText(interface->getInterfaceName()); | 52 | a->interfaceName->setText(interface->getInterfaceName()); |
58 | a->macAddressLabel->setText(interface->getMacAddress()); | 53 | a->macAddressLabel->setText(interface->getMacAddress()); |
59 | a->ipAddressLabel->setText(interface->getIp()); | 54 | a->ipAddressLabel->setText(interface->getIp()); |
60 | a->subnetMaskLabel->setText(interface->getSubnetMask()); | 55 | a->subnetMaskLabel->setText(interface->getSubnetMask()); |
61 | a->broadcastLabel->setText(interface->getBroadcast()); | 56 | a->broadcastLabel->setText(interface->getBroadcast()); |
62 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); | 57 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); |
63 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); | 58 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); |
64 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); | 59 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); |
65 | a->dhcpInformation->setEnabled(interface->isDhcp()); | 60 | a->dhcpInformation->setEnabled(interface->isDhcp()); |
66 | 61 | ||
67 | a->showMaximized(); | 62 | a->showMaximized(); |
68 | a->show(); | 63 | a->show(); |
69 | } | 64 | } |
70 | 65 | ||
71 | /** | 66 | /** |
72 | * Messages from the interface if start/stop went as planned. | 67 | * Messages from the interface if start/stop went as planned. |
73 | * Purly for user feedback. | 68 | * Purly for user feedback. |
74 | * @param message the message to display. | 69 | * @param message the message to display. |
75 | */ | 70 | */ |
76 | void InterfaceInformationImp::showMessage(const QString &message){ | 71 | void InterfaceInformationImp::showMessage(const QString &message){ |
77 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); | 72 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); |
78 | } | 73 | } |
79 | 74 | ||
80 | // infoimp.cpp | 75 | // infoimp.cpp |
81 | 76 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp index 39575c4..cf3dba1 100644 --- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp | |||
@@ -1,81 +1,76 @@ | |||
1 | #include "interfaceinformationimp.h" | 1 | #include "interfaceinformationimp.h" |
2 | #include "interfaceadvanced.h" | 2 | #include "interfaceadvanced.h" |
3 | 3 | ||
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | 8 | ||
9 | #include <assert.h> | ||
10 | |||
11 | /** | 9 | /** |
12 | * Constructor for the InterfaceInformationImp class. This class pretty much | 10 | * Constructor for the InterfaceInformationImp class. This class pretty much |
13 | * just display's information about the interface that is passed to it. | 11 | * just display's information about the interface that is passed to it. |
14 | */ | 12 | */ |
15 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ | 13 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ |
16 | assert(i); | ||
17 | |||
18 | interface = i; | ||
19 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 14 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
20 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); | 15 | connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); |
21 | updateInterface(interface); | 16 | updateInterface(interface); |
22 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); | 17 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); |
23 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); | 18 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); |
24 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); | 19 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); |
25 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); | 20 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); |
26 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); | 21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); |
27 | } | 22 | } |
28 | 23 | ||
29 | /** | 24 | /** |
30 | * Update the interface information and buttons. | 25 | * Update the interface information and buttons. |
31 | * @param Intarface *i the interface to update (should be the one we already | 26 | * @param Intarface *i the interface to update (should be the one we already |
32 | * know about). | 27 | * know about). |
33 | */ | 28 | */ |
34 | void InterfaceInformationImp::updateInterface(Interface *i){ | 29 | void InterfaceInformationImp::updateInterface(Interface *i){ |
35 | if(interface->getStatus()){ | 30 | if(interface->getStatus()){ |
36 | startButton->setEnabled(false); | 31 | startButton->setEnabled(false); |
37 | stopButton->setEnabled(true); | 32 | stopButton->setEnabled(true); |
38 | restartButton->setEnabled(true); | 33 | restartButton->setEnabled(true); |
39 | } | 34 | } |
40 | else{ | 35 | else{ |
41 | startButton->setEnabled(true); | 36 | startButton->setEnabled(true); |
42 | stopButton->setEnabled(false); | 37 | stopButton->setEnabled(false); |
43 | restartButton->setEnabled(false); | 38 | restartButton->setEnabled(false); |
44 | } | 39 | } |
45 | macAddressLabel->setText(interface->getMacAddress()); | 40 | macAddressLabel->setText(interface->getMacAddress()); |
46 | ipAddressLabel->setText(interface->getIp()); | 41 | ipAddressLabel->setText(interface->getIp()); |
47 | subnetMaskLabel->setText(interface->getSubnetMask()); | 42 | subnetMaskLabel->setText(interface->getSubnetMask()); |
48 | broadcastLabel->setText(interface->getBroadcast()); | 43 | broadcastLabel->setText(interface->getBroadcast()); |
49 | } | 44 | } |
50 | 45 | ||
51 | /** | 46 | /** |
52 | * Create the advanced widget. Fill it with the current interface's information. | 47 | * Create the advanced widget. Fill it with the current interface's information. |
53 | * Display it. | 48 | * Display it. |
54 | */ | 49 | */ |
55 | void InterfaceInformationImp::advanced(){ | 50 | void InterfaceInformationImp::advanced(){ |
56 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); | 51 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); |
57 | a->interfaceName->setText(interface->getInterfaceName()); | 52 | a->interfaceName->setText(interface->getInterfaceName()); |
58 | a->macAddressLabel->setText(interface->getMacAddress()); | 53 | a->macAddressLabel->setText(interface->getMacAddress()); |
59 | a->ipAddressLabel->setText(interface->getIp()); | 54 | a->ipAddressLabel->setText(interface->getIp()); |
60 | a->subnetMaskLabel->setText(interface->getSubnetMask()); | 55 | a->subnetMaskLabel->setText(interface->getSubnetMask()); |
61 | a->broadcastLabel->setText(interface->getBroadcast()); | 56 | a->broadcastLabel->setText(interface->getBroadcast()); |
62 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); | 57 | a->dhcpServerLabel->setText(interface->getDhcpServerIp()); |
63 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); | 58 | a->leaseObtainedLabel->setText(interface->getLeaseObtained()); |
64 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); | 59 | a->leaseExpiresLabel->setText(interface->getLeaseExpires()); |
65 | a->dhcpInformation->setEnabled(interface->isDhcp()); | 60 | a->dhcpInformation->setEnabled(interface->isDhcp()); |
66 | 61 | ||
67 | a->showMaximized(); | 62 | a->showMaximized(); |
68 | a->show(); | 63 | a->show(); |
69 | } | 64 | } |
70 | 65 | ||
71 | /** | 66 | /** |
72 | * Messages from the interface if start/stop went as planned. | 67 | * Messages from the interface if start/stop went as planned. |
73 | * Purly for user feedback. | 68 | * Purly for user feedback. |
74 | * @param message the message to display. | 69 | * @param message the message to display. |
75 | */ | 70 | */ |
76 | void InterfaceInformationImp::showMessage(const QString &message){ | 71 | void InterfaceInformationImp::showMessage(const QString &message){ |
77 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); | 72 | QMessageBox::information(this, "Message", message, QMessageBox::Ok); |
78 | } | 73 | } |
79 | 74 | ||
80 | // infoimp.cpp | 75 | // infoimp.cpp |
81 | 76 | ||