Patch by Joerg Meyer,

- Add some icons for some devices depending on major class
- Same code will be placed later in the BluetoothDeviceView
- Styling



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29783 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2009-03-29 16:32:12 +00:00
parent 8e26769c8b
commit 12a1cc3b7e
3 changed files with 88 additions and 35 deletions
+2 -2
View File
@@ -47,10 +47,10 @@ BluetoothApplication::AboutRequested()
" - Fredrik Ekdahl\n" " - Fredrik Ekdahl\n"
" - Raynald Lesieur\n" " - Raynald Lesieur\n"
" - Andreas Färber\n\n" " - Andreas Färber\n\n"
" - Jörg Meyer\n"
"Testing:\n" "Testing:\n"
" - Petter H. Juliussen\n" " - Petter H. Juliussen\n"
" - Adrien Destugues\n" " - Adrien Destugues\n\n"
" - Jörg Meyer\n\n"
"Who gave me all the knowledge:\n" "Who gave me all the knowledge:\n"
" - the yellowTAB team", "OK"))->Go(); " - the yellowTAB team", "OK"))->Go();
+60 -7
View File
@@ -8,6 +8,7 @@
#include <bluetooth/bdaddrUtils.h> #include <bluetooth/bdaddrUtils.h>
#include <bluetooth/BluetoothDevice.h> #include <bluetooth/BluetoothDevice.h>
#include "../media/iconfile.h"
#include "DeviceListItem.h" #include "DeviceListItem.h"
@@ -55,9 +56,6 @@ DeviceListItem::~DeviceListItem()
} }
/***********************************************************
* DrawItem
***********************************************************/
void void
DeviceListItem::DrawItem(BView* owner, BRect itemRect, bool complete) DeviceListItem::DrawItem(BView* owner, BRect itemRect, bool complete)
{ {
@@ -83,7 +81,7 @@ DeviceListItem::DrawItem(BView *owner, BRect itemRect, bool complete)
font_height finfo; font_height finfo;
be_plain_font->GetHeight(&finfo); be_plain_font->GetHeight(&finfo);
BPoint point = BPoint(itemRect.left + PIXELS_FOR_ICON + INSETS, itemRect.bottom - finfo.descent + 1); BPoint point = BPoint(itemRect.left + PIXELS_FOR_ICON + 2*INSETS, itemRect.bottom - finfo.descent + 1);
owner->SetFont(be_fixed_font); owner->SetFont(be_fixed_font);
owner->SetHighColor(kBlack); owner->SetHighColor(kBlack);
owner->MovePenTo(point); owner->MovePenTo(point);
@@ -103,9 +101,64 @@ DeviceListItem::DrawItem(BView *owner, BRect itemRect, bool complete)
owner->MovePenTo(point); owner->MovePenTo(point);
owner->DrawString(fName.String()); owner->DrawString(fName.String());
// TODO: Stroke icon // TODO: Generalize this
owner->StrokeRect(BRect(itemRect.left + INSETS, itemRect.top + INSETS, switch (fClass.GetMajorDeviceClass()) {
itemRect.left + PIXELS_FOR_ICON, itemRect.top + PIXELS_FOR_ICON)); case 1:
{
BRect iconRect(0,0,15,15);
BBitmap *icon=new BBitmap(iconRect, B_CMAP8);
icon->SetBits(kTVBits, kTVWidth*kTVHeight, 0, kTVColorSpace);
owner->DrawBitmap(icon, iconRect,BRect(itemRect.left + INSETS, itemRect.top + INSETS,
itemRect.left + INSETS + PIXELS_FOR_ICON, itemRect.top + INSETS + PIXELS_FOR_ICON));
}
break;
case 4:
{
BRect iconRect(0,0,15,15);
BBitmap *icon=new BBitmap(iconRect, B_CMAP8);
icon->SetBits(kMixerBits, kMixerWidth*kMixerHeight, 0, kMixerColorSpace);
owner->DrawBitmap(icon, iconRect,BRect(itemRect.left + INSETS, itemRect.top + INSETS,
itemRect.left + INSETS + PIXELS_FOR_ICON, itemRect.top + INSETS + PIXELS_FOR_ICON));
}
break;
case 2: // phone
owner->StrokeRoundRect(BRect(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4),
itemRect.top + INSETS + 6,
itemRect.left + INSETS + uint(PIXELS_FOR_ICON*3/4),
itemRect.top + INSETS + PIXELS_FOR_ICON - 2), 2, 2);
owner->StrokeRect(BRect(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4) + 4,
itemRect.top + INSETS + 10,
itemRect.left + INSETS + uint(PIXELS_FOR_ICON*3/4) - 4,
itemRect.top + INSETS + uint(PIXELS_FOR_ICON*3/4)));
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4) + 4,
itemRect.top + INSETS + PIXELS_FOR_ICON - 6),
BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON*3/4) - 4,
itemRect.top + INSETS + PIXELS_FOR_ICON - 6));
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4) + 4,
itemRect.top + INSETS + PIXELS_FOR_ICON - 4),
BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON*3/4) - 4,
itemRect.top + INSETS + PIXELS_FOR_ICON - 4));
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4) + 4,
itemRect.top + INSETS + 2),
BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4) + 4,
itemRect.top + INSETS + 6));
break;
default: // Bluetooth Logo
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4),
itemRect.top + INSETS + uint(PIXELS_FOR_ICON*3/4)),
BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON*3/4),
itemRect.top + INSETS + uint(PIXELS_FOR_ICON/4)));
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/2),
itemRect.top + INSETS +2));
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/2),
itemRect.top + INSETS + PIXELS_FOR_ICON - 2));
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON*3/4),
itemRect.top + INSETS + uint(PIXELS_FOR_ICON*3/4)));
owner->StrokeLine(BPoint(itemRect.left + INSETS + uint(PIXELS_FOR_ICON/4),
itemRect.top + INSETS + uint(PIXELS_FOR_ICON/4)));
}
// TODO: Draw rssi // TODO: Draw rssi
} }