Place all Device's feature strings left aligned

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34774 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2009-12-25 17:51:37 +00:00
parent f627a56a9b
commit 17836d5ed0
2 changed files with 68 additions and 88 deletions
@@ -31,24 +31,35 @@ BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
fName = new BStringView("name", "");
fName->SetFont(be_bold_font);
fName->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
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 = new BStringView("ServiceClass", TR("Service classes: "));
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));
fLMPVersionProperties = new BStringView("lmp", "");
fLMPVersionProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fManufacturerProperties = new BStringView("manufacturer", "");
fBuffersProperties = new BStringView("buffers", "");
fManufacturerProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fACLBuffersProperties = new BStringView("buffers acl", "");
fACLBuffersProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fSCOBuffersProperties = new BStringView("buffers sco", "");
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->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetBluetoothDevice(bDevice);
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10)
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 5)
.Add(fIcon)
.AddGlue()
.Add(BGroupLayoutBuilder(B_VERTICAL)
@@ -56,22 +67,24 @@ BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
.AddGlue()
.Add(fBdaddr)
.AddGlue()
.AddGlue()
.Add(fClass)
.AddGlue()
.Add(fClassService)
.AddGlue()
.AddGlue()
.Add(fHCIVersionProperties)
.AddGlue()
.Add(fLMPVersionProperties)
.AddGlue()
.Add(fManufacturerProperties)
.AddGlue()
.Add(fBuffersProperties)
.SetInsets(5, 25, 25, 25)
.Add(fACLBuffersProperties)
.AddGlue()
.Add(fSCOBuffersProperties)
.SetInsets(5, 5, 5, 5)
)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10)
).SetInsets(20, 20, 20, 20)
// .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
.SetInsets(10, 10, 10, 10)
);
}
@@ -92,7 +105,6 @@ 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());
@@ -132,12 +144,14 @@ BluetoothDeviceView::SetBluetoothDevice(BluetoothDevice* bDevice)
str << "ACL mtu: " << value;
if (bDevice->GetProperty("acl_max_pkt", &value) == B_OK)
str << " packets: " << value;
fACLBuffersProperties->SetText(str.String());
str = "";
if (bDevice->GetProperty("sco_mtu", &value) == B_OK)
str << " SCO mtu: " << value;
str << "SCO mtu: " << value;
if (bDevice->GetProperty("sco_max_pkt", &value) == B_OK)
str << " packets: " << value;
fBuffersProperties->SetText(str.String());
fSCOBuffersProperties->SetText(str.String());
@@ -25,10 +25,10 @@ public:
uint32 flags = B_WILL_DRAW);
~BluetoothDeviceView(void);
void SetBluetoothDevice(BluetoothDevice* bdev);
void SetBluetoothDevice(BluetoothDevice* bDevice);
virtual void MessageReceived(BMessage *msg);
virtual void SetTarget(BHandler *tgt);
virtual void MessageReceived(BMessage* message);
virtual void SetTarget(BHandler* target);
virtual void SetEnabled(bool value);
protected:
@@ -43,44 +43,10 @@ protected:
BStringView* fLMPVersionProperties;
BStringView* fManufacturerProperties;
BStringView* fBuffersProperties;
BStringView* fACLBuffersProperties;
BStringView* fSCOBuffersProperties;
BView* fIcon;
};
class BitmapView : public BView
{
public:
BitmapView(BBitmap *bitmap) : BView(bitmap->Bounds(), NULL,
B_FOLLOW_NONE, B_WILL_DRAW)
{
fBitmap = bitmap;
SetDrawingMode(B_OP_ALPHA);
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
}
~BitmapView()
{
delete fBitmap;
}
virtual void AttachedToWindow()
{
//SetViewColor(Parent()->ViewColor());
//MoveTo((Parent()->Bounds().Width() - Bounds().Width()) / 2, Frame().top);
}
virtual void Draw(BRect updateRect)
{
DrawBitmap(fBitmap, updateRect, updateRect);
}
private:
BBitmap *fBitmap;
};