CheckStyled

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34775 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2009-12-25 18:09:17 +00:00
parent 17836d5ed0
commit 4b68462fe1
2 changed files with 64 additions and 56 deletions
@@ -20,12 +20,14 @@
#define TR_CONTEXT "Device View"
BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice, uint32 resizingMode, uint32 flags)
: BView(frame,"BluetoothDeviceView", resizingMode, flags | B_WILL_DRAW),
fDevice(bDevice)
BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
uint32 resizingMode, uint32 flags)
:
BView(frame,"BluetoothDeviceView", resizingMode, flags | B_WILL_DRAW),
fDevice(bDevice)
{
SetViewColor(B_TRANSPARENT_COLOR);
SetLowColor(0,0,0);
SetLowColor(0, 0, 0);
SetLayout(new BGroupLayout(B_VERTICAL));
@@ -33,28 +35,36 @@ BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
fName->SetFont(be_bold_font);
fName->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fBdaddr = new BStringView("bdaddr", bdaddrUtils::ToString(bdaddrUtils::NullAddress()));
fBdaddr = new BStringView("bdaddr",
bdaddrUtils::ToString(bdaddrUtils::NullAddress()));
fBdaddr->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fClassService = new BStringView("ServiceClass", TR("Service classes: "));
fClassService->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fClassService->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_MIDDLE));
fClass = new BStringView("class", "- / -");
fClass->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fHCIVersionProperties = new BStringView("hci", "");
fHCIVersionProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fHCIVersionProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_MIDDLE));
fLMPVersionProperties = new BStringView("lmp", "");
fLMPVersionProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fLMPVersionProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_MIDDLE));
fManufacturerProperties = new BStringView("manufacturer", "");
fManufacturerProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fManufacturerProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_MIDDLE));
fACLBuffersProperties = new BStringView("buffers acl", "");
fACLBuffersProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fACLBuffersProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_MIDDLE));
fSCOBuffersProperties = new BStringView("buffers sco", "");
fSCOBuffersProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fSCOBuffersProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_MIDDLE));
fIcon = new BView(BRect(0, 0, 32 - 1, 32 - 1),"Icon", B_FOLLOW_ALL, B_WILL_DRAW);
fIcon = new BView(BRect(0, 0, 32 - 1, 32 - 1), "Icon", B_FOLLOW_ALL,
B_WILL_DRAW);
fIcon->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetBluetoothDevice(bDevice);
@@ -105,80 +115,78 @@ BluetoothDeviceView::SetBluetoothDevice(BluetoothDevice* bDevice)
fName->SetText(bDevice->GetFriendlyName().String());
fBdaddr->SetText(bdaddrUtils::ToString(bDevice->GetBluetoothAddress()));
BString str(TR("Service classes: "));
bDevice->GetDeviceClass().GetServiceClass(str);
fClassService->SetText(str.String());
str = "";
bDevice->GetDeviceClass().GetMajorDeviceClass(str);
str << " / ";
bDevice->GetDeviceClass().GetMinorDeviceClass(str);
fClass->SetText(str.String());
BString string(TR("Service classes: "));
bDevice->GetDeviceClass().GetServiceClass(string);
fClassService->SetText(string.String());
string = "";
bDevice->GetDeviceClass().GetMajorDeviceClass(string);
string << " / ";
bDevice->GetDeviceClass().GetMinorDeviceClass(string);
fClass->SetText(string.String());
bDevice->GetDeviceClass().Draw(fIcon, BPoint(Bounds().left, Bounds().top));
uint32 value;
str = "";
string = "";
if (bDevice->GetProperty("hci_version", &value) == B_OK)
str << "HCI ver: " << BluetoothHciVersion(value);
string << "HCI ver: " << BluetoothHciVersion(value);
if (bDevice->GetProperty("hci_revision", &value) == B_OK)
str << " HCI rev: " << value ;
string << " HCI rev: " << value ;
fHCIVersionProperties->SetText(str.String());
fHCIVersionProperties->SetText(string.String());
str = "";
string = "";
if (bDevice->GetProperty("lmp_version", &value) == B_OK)
str << "LMP ver: " << BluetoothLmpVersion(value);
string << "LMP ver: " << BluetoothLmpVersion(value);
if (bDevice->GetProperty("lmp_subversion", &value) == B_OK)
str << " LMP subver: " << value;
fLMPVersionProperties->SetText(str.String());
string << " LMP subver: " << value;
fLMPVersionProperties->SetText(string.String());
str = "";
string = "";
if (bDevice->GetProperty("manufacturer", &value) == B_OK)
str << "Manufacturer: " << BluetoothManufacturer(value);
fManufacturerProperties->SetText(str.String());
string << "Manufacturer: " << BluetoothManufacturer(value);
fManufacturerProperties->SetText(string.String());
str = "";
string = "";
if (bDevice->GetProperty("acl_mtu", &value) == B_OK)
str << "ACL mtu: " << value;
string << "ACL mtu: " << value;
if (bDevice->GetProperty("acl_max_pkt", &value) == B_OK)
str << " packets: " << value;
fACLBuffersProperties->SetText(str.String());
string << " packets: " << value;
fACLBuffersProperties->SetText(string.String());
str = "";
string = "";
if (bDevice->GetProperty("sco_mtu", &value) == B_OK)
str << "SCO mtu: " << value;
string << "SCO mtu: " << value;
if (bDevice->GetProperty("sco_max_pkt", &value) == B_OK)
str << " packets: " << value;
fSCOBuffersProperties->SetText(str.String());
string << " packets: " << value;
fSCOBuffersProperties->SetText(string.String());
}
}
void
BluetoothDeviceView::SetTarget(BHandler *tgt)
BluetoothDeviceView::SetTarget(BHandler* target)
{
}
void
BluetoothDeviceView::MessageReceived(BMessage *msg)
BluetoothDeviceView::MessageReceived(BMessage* message)
{
// If we received a dropped message, try to see if it has color data
// in it
if(msg->WasDropped()) {
if (message->WasDropped()) {
}
// The default
BView::MessageReceived(msg);
BView::MessageReceived(message);
}
+10 -10
View File
@@ -34,19 +34,19 @@ public:
protected:
BluetoothDevice* fDevice;
BStringView* fName;
BStringView* fBdaddr;
BStringView* fClassService;
BStringView* fClass;
BStringView* fName;
BStringView* fBdaddr;
BStringView* fClassService;
BStringView* fClass;
BStringView* fHCIVersionProperties;
BStringView* fLMPVersionProperties;
BStringView* fManufacturerProperties;
BStringView* fHCIVersionProperties;
BStringView* fLMPVersionProperties;
BStringView* fManufacturerProperties;
BStringView* fACLBuffersProperties;
BStringView* fSCOBuffersProperties;
BStringView* fACLBuffersProperties;
BStringView* fSCOBuffersProperties;
BView* fIcon;
BView* fIcon;
};