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:
@@ -21,7 +21,7 @@
|
|||||||
#define TR_CONTEXT "Device View"
|
#define TR_CONTEXT "Device View"
|
||||||
|
|
||||||
BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice, uint32 resizingMode, uint32 flags)
|
BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice, uint32 resizingMode, uint32 flags)
|
||||||
: BView(frame,"BluetoothDeviceView", resizingMode, flags | B_WILL_DRAW),
|
: BView(frame,"BluetoothDeviceView", resizingMode, flags | B_WILL_DRAW),
|
||||||
fDevice(bDevice)
|
fDevice(bDevice)
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
@@ -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)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -87,63 +100,64 @@ void
|
|||||||
BluetoothDeviceView::SetBluetoothDevice(BluetoothDevice* bDevice)
|
BluetoothDeviceView::SetBluetoothDevice(BluetoothDevice* bDevice)
|
||||||
{
|
{
|
||||||
if (bDevice != NULL) {
|
if (bDevice != NULL) {
|
||||||
|
|
||||||
SetName(bDevice->GetFriendlyName().String());
|
SetName(bDevice->GetFriendlyName().String());
|
||||||
|
|
||||||
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());
|
||||||
|
|
||||||
str = "";
|
str = "";
|
||||||
bDevice->GetDeviceClass().GetMajorDeviceClass(str);
|
bDevice->GetDeviceClass().GetMajorDeviceClass(str);
|
||||||
str << " / ";
|
str << " / ";
|
||||||
bDevice->GetDeviceClass().GetMinorDeviceClass(str);
|
bDevice->GetDeviceClass().GetMinorDeviceClass(str);
|
||||||
fClass->SetText(str.String());
|
fClass->SetText(str.String());
|
||||||
|
|
||||||
bDevice->GetDeviceClass().Draw(fIcon, BPoint(Bounds().left, Bounds().top));
|
bDevice->GetDeviceClass().Draw(fIcon, BPoint(Bounds().left, Bounds().top));
|
||||||
|
|
||||||
uint32 value;
|
uint32 value;
|
||||||
|
|
||||||
str = "";
|
str = "";
|
||||||
if (bDevice->GetProperty("hci_version", &value) == B_OK)
|
if (bDevice->GetProperty("hci_version", &value) == B_OK)
|
||||||
str << "HCI ver: " << BluetoothHciVersion(value);
|
str << "HCI ver: " << BluetoothHciVersion(value);
|
||||||
if (bDevice->GetProperty("hci_revision", &value) == B_OK)
|
if (bDevice->GetProperty("hci_revision", &value) == B_OK)
|
||||||
str << " HCI rev: " << value ;
|
str << " HCI rev: " << value ;
|
||||||
|
|
||||||
fHCIVersionProperties->SetText(str.String());
|
fHCIVersionProperties->SetText(str.String());
|
||||||
|
|
||||||
str = "";
|
str = "";
|
||||||
if (bDevice->GetProperty("lmp_version", &value) == B_OK)
|
if (bDevice->GetProperty("lmp_version", &value) == B_OK)
|
||||||
str << "LMP ver: " << BluetoothLmpVersion(value);
|
str << "LMP ver: " << BluetoothLmpVersion(value);
|
||||||
if (bDevice->GetProperty("lmp_subversion", &value) == B_OK)
|
if (bDevice->GetProperty("lmp_subversion", &value) == B_OK)
|
||||||
str << " LMP subver: " << value;
|
str << " LMP subver: " << value;
|
||||||
fLMPVersionProperties->SetText(str.String());
|
fLMPVersionProperties->SetText(str.String());
|
||||||
|
|
||||||
str = "";
|
str = "";
|
||||||
if (bDevice->GetProperty("manufacturer", &value) == B_OK)
|
if (bDevice->GetProperty("manufacturer", &value) == B_OK)
|
||||||
str << "Manufacturer: " << BluetoothManufacturer(value);
|
str << "Manufacturer: " << BluetoothManufacturer(value);
|
||||||
fManufacturerProperties->SetText(str.String());
|
fManufacturerProperties->SetText(str.String());
|
||||||
|
|
||||||
str = "";
|
str = "";
|
||||||
if (bDevice->GetProperty("acl_mtu", &value) == B_OK)
|
if (bDevice->GetProperty("acl_mtu", &value) == B_OK)
|
||||||
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;
|
||||||
if (bDevice->GetProperty("sco_mtu", &value) == B_OK)
|
fACLBuffersProperties->SetText(str.String());
|
||||||
str << " SCO mtu: " << value;
|
|
||||||
if (bDevice->GetProperty("sco_max_pkt", &value) == B_OK)
|
str = "";
|
||||||
str << " packets: " << value;
|
if (bDevice->GetProperty("sco_mtu", &value) == B_OK)
|
||||||
|
str << "SCO mtu: " << value;
|
||||||
fBuffersProperties->SetText(str.String());
|
if (bDevice->GetProperty("sco_max_pkt", &value) == B_OK)
|
||||||
|
str << " packets: " << value;
|
||||||
|
fSCOBuffersProperties->SetText(str.String());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,67 +20,33 @@ class BitmapView;
|
|||||||
class BluetoothDeviceView : public BView
|
class BluetoothDeviceView : public BView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
|
BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
|
||||||
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
uint32 flags = B_WILL_DRAW);
|
uint32 flags = B_WILL_DRAW);
|
||||||
~BluetoothDeviceView(void);
|
~BluetoothDeviceView(void);
|
||||||
|
|
||||||
void SetBluetoothDevice(BluetoothDevice* bdev);
|
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *msg);
|
void SetBluetoothDevice(BluetoothDevice* bDevice);
|
||||||
virtual void SetTarget(BHandler *tgt);
|
|
||||||
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
virtual void SetTarget(BHandler* target);
|
||||||
virtual void SetEnabled(bool value);
|
virtual void SetEnabled(bool value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BluetoothDevice* fDevice;
|
BluetoothDevice* fDevice;
|
||||||
|
|
||||||
BStringView* fName;
|
BStringView* fName;
|
||||||
BStringView* fBdaddr;
|
BStringView* fBdaddr;
|
||||||
BStringView* fClassService;
|
BStringView* fClassService;
|
||||||
BStringView* fClass;
|
BStringView* fClass;
|
||||||
|
|
||||||
BStringView* fHCIVersionProperties;
|
BStringView* fHCIVersionProperties;
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user