Diffstat (limited to 'noncore/settings/networksettings/interfaceinformationimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaceinformationimp.cpp | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/noncore/settings/networksettings/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaceinformationimp.cpp index e37e0f8..59a6400 100644 --- a/noncore/settings/networksettings/interfaceinformationimp.cpp +++ b/noncore/settings/networksettings/interfaceinformationimp.cpp | |||
@@ -10,22 +10,28 @@ | |||
10 | * just display's information about the interface that is passed to it. | 10 | * just display's information about the interface that is passed to it. |
11 | */ | 11 | */ |
12 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ | 12 | InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f){ |
13 | assert(i); | 13 | assert(i); |
14 | 14 | ||
15 | interface = i; | 15 | interface = i; |
16 | updateInterface(); | 16 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
17 | connect(startButton, SIGNAL(clicked()), this, SLOT(start())); | 17 | updateInterface(interface); |
18 | connect(stopButton, SIGNAL(clicked()), this, SLOT(stop())); | 18 | connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); |
19 | connect(restartButton, SIGNAL(clicked()), this, SLOT(restart())); | 19 | connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); |
20 | connect(refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); | 20 | connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); |
21 | connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); | ||
21 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); | 22 | connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); |
22 | 23 | ||
23 | } | 24 | } |
24 | 25 | ||
25 | void InterfaceInformationImp::updateInterface(){ | 26 | /** |
27 | * Update the interface information and buttons. | ||
28 | * @param Intarface *i the interface to update (should be the one we already | ||
29 | * know about). | ||
30 | */ | ||
31 | void InterfaceInformationImp::updateInterface(Interface *i){ | ||
26 | if(interface->getStatus()){ | 32 | if(interface->getStatus()){ |
27 | startButton->setEnabled(false); | 33 | startButton->setEnabled(false); |
28 | stopButton->setEnabled(true); | 34 | stopButton->setEnabled(true); |
29 | restartButton->setEnabled(true); | 35 | restartButton->setEnabled(true); |
30 | } | 36 | } |
31 | else{ | 37 | else{ |
@@ -37,45 +43,12 @@ void InterfaceInformationImp::updateInterface(){ | |||
37 | ipAddressLabel->setText(interface->getIp()); | 43 | ipAddressLabel->setText(interface->getIp()); |
38 | subnetMaskLabel->setText(interface->getSubnetMask()); | 44 | subnetMaskLabel->setText(interface->getSubnetMask()); |
39 | broadcastLabel->setText(interface->getBroadcast()); | 45 | broadcastLabel->setText(interface->getBroadcast()); |
40 | } | 46 | } |
41 | 47 | ||
42 | /** | 48 | /** |
43 | * Start the interface. Update the information if successfull | ||
44 | */ | ||
45 | void InterfaceInformationImp::start(){ | ||
46 | if(interface->start()){ | ||
47 | updateInterface(); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * Stop the interface. | ||
53 | */ | ||
54 | void InterfaceInformationImp::stop(){ | ||
55 | if(interface->stop()){ | ||
56 | updateInterface(); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | /*** | ||
61 | * Tell the interface to refresh its information. | ||
62 | **/ | ||
63 | void InterfaceInformationImp::refresh(){ | ||
64 | if(interface->refresh()) | ||
65 | updateInterface(); | ||
66 | } | ||
67 | |||
68 | void InterfaceInformationImp::restart(){ | ||
69 | if(interface->restart()){ | ||
70 | updateInterface(); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Create the advanced widget. Fill it with the current interface's information. | 49 | * Create the advanced widget. Fill it with the current interface's information. |
77 | * Display it. | 50 | * Display it. |
78 | */ | 51 | */ |
79 | void InterfaceInformationImp::advanced(){ | 52 | void InterfaceInformationImp::advanced(){ |
80 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); | 53 | InterfaceAdvanced *a = new InterfaceAdvanced(0, "InterfaceAdvanced"); |
81 | a->interfaceName->setText(interface->getInterfaceName()); | 54 | a->interfaceName->setText(interface->getInterfaceName()); |