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 = new BStringView("name", "");
fName->SetFont(be_bold_font); 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 = new BStringView("ServiceClass", TR("Service classes: "));
fClassService->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fClass = new BStringView("class", "- / -"); fClass = new BStringView("class", "- / -");
fClass->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fHCIVersionProperties = new BStringView("hci", ""); fHCIVersionProperties = new BStringView("hci", "");
fHCIVersionProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fLMPVersionProperties = new BStringView("lmp", ""); fLMPVersionProperties = new BStringView("lmp", "");
fLMPVersionProperties->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fManufacturerProperties = new BStringView("manufacturer", ""); 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 = new BView(BRect(0, 0, 32 - 1, 32 - 1),"Icon", B_FOLLOW_ALL, B_WILL_DRAW);
fIcon->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fIcon->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetBluetoothDevice(bDevice); SetBluetoothDevice(bDevice);
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10) AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 5)
.Add(fIcon) .Add(fIcon)
.AddGlue() .AddGlue()
.Add(BGroupLayoutBuilder(B_VERTICAL) .Add(BGroupLayoutBuilder(B_VERTICAL)
@@ -56,22 +67,24 @@ BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
.AddGlue() .AddGlue()
.Add(fBdaddr) .Add(fBdaddr)
.AddGlue() .AddGlue()
.AddGlue()
.Add(fClass) .Add(fClass)
.AddGlue() .AddGlue()
.Add(fClassService) .Add(fClassService)
.AddGlue() .AddGlue()
.AddGlue()
.Add(fHCIVersionProperties) .Add(fHCIVersionProperties)
.AddGlue() .AddGlue()
.Add(fLMPVersionProperties) .Add(fLMPVersionProperties)
.AddGlue() .AddGlue()
.Add(fManufacturerProperties) .Add(fManufacturerProperties)
.AddGlue() .AddGlue()
.Add(fBuffersProperties) .Add(fACLBuffersProperties)
.SetInsets(5, 25, 25, 25) .AddGlue()
.Add(fSCOBuffersProperties)
.SetInsets(5, 5, 5, 5)
) )
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10) // .Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
).SetInsets(20, 20, 20, 20) .SetInsets(10, 10, 10, 10)
); );
} }
@@ -92,7 +105,6 @@ BluetoothDeviceView::SetBluetoothDevice(BluetoothDevice* bDevice)
fName->SetText(bDevice->GetFriendlyName().String()); fName->SetText(bDevice->GetFriendlyName().String());
fBdaddr->SetText(bdaddrUtils::ToString(bDevice->GetBluetoothAddress())); fBdaddr->SetText(bdaddrUtils::ToString(bDevice->GetBluetoothAddress()));
BString str(TR("Service classes: ")); BString str(TR("Service classes: "));
bDevice->GetDeviceClass().GetServiceClass(str); bDevice->GetDeviceClass().GetServiceClass(str);
fClassService->SetText(str.String()); fClassService->SetText(str.String());
@@ -132,12 +144,14 @@ BluetoothDeviceView::SetBluetoothDevice(BluetoothDevice* bDevice)
str << "ACL mtu: " << value; str << "ACL mtu: " << value;
if (bDevice->GetProperty("acl_max_pkt", &value) == B_OK) if (bDevice->GetProperty("acl_max_pkt", &value) == B_OK)
str << " packets: " << value; str << " packets: " << value;
fACLBuffersProperties->SetText(str.String());
str = "";
if (bDevice->GetProperty("sco_mtu", &value) == B_OK) 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) if (bDevice->GetProperty("sco_max_pkt", &value) == B_OK)
str << " packets: " << value; str << " packets: " << value;
fSCOBuffersProperties->SetText(str.String());
fBuffersProperties->SetText(str.String());
@@ -25,10 +25,10 @@ public:
uint32 flags = B_WILL_DRAW); uint32 flags = B_WILL_DRAW);
~BluetoothDeviceView(void); ~BluetoothDeviceView(void);
void SetBluetoothDevice(BluetoothDevice* bdev); void SetBluetoothDevice(BluetoothDevice* bDevice);
virtual void MessageReceived(BMessage *msg); virtual void MessageReceived(BMessage* message);
virtual void SetTarget(BHandler *tgt); virtual void SetTarget(BHandler* target);
virtual void SetEnabled(bool value); virtual void SetEnabled(bool value);
protected: protected:
@@ -43,44 +43,10 @@ protected:
BStringView* fLMPVersionProperties; BStringView* fLMPVersionProperties;
BStringView* fManufacturerProperties; BStringView* fManufacturerProperties;
BStringView* fBuffersProperties; BStringView* fACLBuffersProperties;
BStringView* fSCOBuffersProperties;
BView* fIcon; 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;
}; };