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