radeon_hd: small style header style fixes as per axel-- networkSetup: prevented enable/disable button from hiding; disable configure button if interface is disabled; add configuration mode dropdown (auto(dhcp)/static); make address fields disable (with curent settings shown) if auto-config is selected; style cleanup
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40520 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
cefe2a40f7
commit
e7e0c4a4bf
@ -8,6 +8,7 @@
|
||||
* Clemens Zeidler, <haiku@clemens-zeidler.de>
|
||||
*/
|
||||
|
||||
|
||||
#include "driver.h"
|
||||
#include "device.h"
|
||||
#include "lock.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
|
||||
#include "radeon_hd.h"
|
||||
|
||||
#include "AreaKeeper.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
* Clemens Zeidler, haiku@clemens-zeidler.de
|
||||
*/
|
||||
|
||||
#ifndef RADEON_RD_PRIVATE_H
|
||||
#define RADEON_RD_PRIVATE_H
|
||||
|
||||
|
@ -6,11 +6,13 @@
|
||||
* Alexander von Gluck, kallisti5@unixzen.com
|
||||
*/
|
||||
|
||||
|
||||
#include "InterfaceAddressView.h"
|
||||
#include "NetworkSettings.h"
|
||||
|
||||
#include <GroupLayout.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <MenuItem.h>
|
||||
#include <StringView.h>
|
||||
|
||||
|
||||
@ -27,6 +29,16 @@ InterfaceAddressView::InterfaceAddressView(BRect frame, const char* name,
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
// Create our controls
|
||||
fModePopUpMenu = new BPopUpMenu("modes");
|
||||
|
||||
fModePopUpMenu->AddItem(new BMenuItem("Automatic",
|
||||
new BMessage(AUTOSEL_MSG)));
|
||||
fModePopUpMenu->AddItem(new BMenuItem("Static",
|
||||
new BMessage(STATICSEL_MSG)));
|
||||
|
||||
fModeField = new BMenuField(frame, "mode", "Mode:",
|
||||
fModePopUpMenu, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
|
||||
fAddressField = new BTextControl(frame, "address", "IP Address:",
|
||||
NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
fNetmaskField = new BTextControl(frame, "netmask", "Netmask:",
|
||||
@ -41,11 +53,13 @@ InterfaceAddressView::InterfaceAddressView(BRect frame, const char* name,
|
||||
RevertFields();
|
||||
// Do the initial field population
|
||||
|
||||
fModeField->SetDivider(labelSize);
|
||||
fAddressField->SetDivider(labelSize);
|
||||
fNetmaskField->SetDivider(labelSize);
|
||||
fGatewayField->SetDivider(labelSize);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||
.Add(fModeField)
|
||||
.Add(fAddressField)
|
||||
.Add(fNetmaskField)
|
||||
.Add(fGatewayField)
|
||||
@ -61,10 +75,50 @@ InterfaceAddressView::~InterfaceAddressView()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InterfaceAddressView::AttachedToWindow()
|
||||
{
|
||||
fModePopUpMenu->SetTargetForItems(this);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InterfaceAddressView::MessageReceived(BMessage* message)
|
||||
{
|
||||
switch (message->what) {
|
||||
case AUTOSEL_MSG:
|
||||
_EnableFields(false);
|
||||
break;
|
||||
case STATICSEL_MSG:
|
||||
_EnableFields(true);
|
||||
break;
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InterfaceAddressView::_EnableFields(bool enabled)
|
||||
{
|
||||
fAddressField->SetEnabled(enabled);
|
||||
fNetmaskField->SetEnabled(enabled);
|
||||
fGatewayField->SetEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
InterfaceAddressView::RevertFields()
|
||||
{
|
||||
// Populate address fields with current settings
|
||||
const char* currMode = fSettings->AutoConfigure() ? "Automatic" : "Static";
|
||||
BMenuItem* item = fModePopUpMenu->FindItem(currMode);
|
||||
if (item)
|
||||
item->SetMarked(true);
|
||||
|
||||
_EnableFields(!fSettings->AutoConfigure());
|
||||
// if Autoconfigured, disable address fields until changed
|
||||
|
||||
fAddressField->SetText(fSettings->IP(fFamily));
|
||||
fNetmaskField->SetText(fSettings->Netmask(fFamily));
|
||||
fGatewayField->SetText(fSettings->Gateway(fFamily));
|
||||
|
@ -5,15 +5,23 @@
|
||||
* Authors:
|
||||
* Alexander von Gluck, kallisti5@unixzen.com
|
||||
*/
|
||||
|
||||
#ifndef INTERFACE_ADDRESS_VIEW_H
|
||||
#define INTERFACE_ADDRESS_VIEW_H
|
||||
|
||||
|
||||
#include "NetworkSettings.h"
|
||||
|
||||
#include <MenuField.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Screen.h>
|
||||
#include <View.h>
|
||||
#include <TextControl.h>
|
||||
#include <View.h>
|
||||
|
||||
|
||||
enum {
|
||||
AUTOSEL_MSG = 'iato',
|
||||
STATICSEL_MSG = 'istc'
|
||||
};
|
||||
|
||||
|
||||
class InterfaceAddressView : public BView {
|
||||
@ -22,12 +30,19 @@ public:
|
||||
const char* name, int family,
|
||||
NetworkSettings* settings);
|
||||
virtual ~InterfaceAddressView();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
status_t RevertFields();
|
||||
|
||||
|
||||
private:
|
||||
void _EnableFields(bool enabled);
|
||||
|
||||
NetworkSettings* fSettings;
|
||||
int fFamily;
|
||||
|
||||
BPopUpMenu* fModePopUpMenu;
|
||||
BMenuField* fModeField;
|
||||
BTextControl* fAddressField;
|
||||
BTextControl* fNetmaskField;
|
||||
BTextControl* fGatewayField;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "NetworkSetupWindow"
|
||||
|
||||
|
@ -5,11 +5,10 @@
|
||||
* Authors:
|
||||
* Alexander von Gluck, kallisti5@unixzen.com
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACE_WINDOW_H
|
||||
#define INTERFACE_WINDOW_H
|
||||
|
||||
|
||||
#include "NetworkSettings.h"
|
||||
#include "InterfaceAddressView.h"
|
||||
|
||||
|
@ -81,7 +81,7 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
||||
fOnOff = new BButton(intViewRect, "onoff", "Disable",
|
||||
new BMessage(ONOFF_INTERFACE_MSG));
|
||||
|
||||
fOnOff->Hide();
|
||||
fOnOff->SetEnabled(false);
|
||||
|
||||
// Build the layout
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
@ -107,7 +107,6 @@ InterfacesAddOn::AttachedToWindow()
|
||||
fListview->SetTarget(this);
|
||||
fConfigure->SetTarget(this);
|
||||
fOnOff->SetTarget(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -122,14 +121,12 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
||||
|
||||
switch (msg->what) {
|
||||
case INTERFACE_SELECTED_MSG: {
|
||||
fConfigure->SetEnabled(item != NULL);
|
||||
fOnOff->SetEnabled(item != NULL);
|
||||
if (item == NULL) {
|
||||
fOnOff->Hide();
|
||||
fConfigure->SetEnabled(item != NULL);
|
||||
if (!item)
|
||||
break;
|
||||
}
|
||||
fConfigure->SetEnabled(!item->IsDisabled());
|
||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||
fOnOff->Show();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -148,6 +145,7 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
||||
|
||||
item->SetDisabled(!item->IsDisabled());
|
||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||
fConfigure->SetEnabled(!item->IsDisabled());
|
||||
fListview->Invalidate();
|
||||
break;
|
||||
|
||||
|
@ -6,17 +6,17 @@
|
||||
* Philippe Houdoin
|
||||
* Fredrik Modéen
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_ADDON_H
|
||||
#define INTERFACES_ADDON_H
|
||||
|
||||
|
||||
#include <Box.h>
|
||||
#include <ListView.h>
|
||||
#include <Button.h>
|
||||
|
||||
#include "NetworkSetupAddOn.h"
|
||||
|
||||
|
||||
class InterfacesAddOn : public NetworkSetupAddOn, public BBox
|
||||
{
|
||||
public:
|
||||
@ -41,4 +41,6 @@ private:
|
||||
BButton* fOnOff;
|
||||
};
|
||||
|
||||
|
||||
#endif /*INTERFACES_ADDON_H*/
|
||||
|
||||
|
@ -7,11 +7,10 @@
|
||||
* Fredrik Modéen
|
||||
* Alexander von Gluck, kallisti5@unixzen.com
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERFACES_LIST_VIEW_H
|
||||
#define INTERFACES_LIST_VIEW_H
|
||||
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
|
@ -4,22 +4,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "NetworkSetupAddOn.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
class StatusAddOn : public NetworkSetupAddOn {
|
||||
public:
|
||||
const char * Name();
|
||||
};
|
||||
|
||||
|
||||
|
||||
const char * StatusAddOn::Name()
|
||||
{
|
||||
return "Status";
|
||||
}
|
||||
|
||||
|
||||
NetworkSetupAddOn * get_addon()
|
||||
{
|
||||
return new StatusAddOn();
|
||||
|
Loading…
Reference in New Issue
Block a user