diff --git a/src/preferences/bluetooth/DeviceListItem.cpp b/src/preferences/bluetooth/DeviceListItem.cpp index b1a399b6e2..654c937d15 100644 --- a/src/preferences/bluetooth/DeviceListItem.cpp +++ b/src/preferences/bluetooth/DeviceListItem.cpp @@ -14,7 +14,7 @@ #define PIXELS_FOR_ICON 32 -#define INSETS 2 +#define INSETS 5 #define TEXT_ROWS 2 namespace Bluetooth { @@ -83,12 +83,19 @@ DeviceListItem::DrawItem(BView *owner, BRect itemRect, bool complete) font_height 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 + INSETS, itemRect.bottom - finfo.descent + 1); owner->SetFont(be_fixed_font); owner->SetHighColor(kBlack); owner->MovePenTo(point); - owner->DrawString(bdaddrUtils::ToString(fAddress)); + BString secondLine; + + secondLine << bdaddrUtils::ToString(fAddress) << " "; + fClass.GetMajorDeviceClass(secondLine); + secondLine << " / "; + fClass.GetMinorDeviceClass(secondLine); + + owner->DrawString(secondLine.String()); point -= BPoint(0, (finfo.ascent + finfo.descent + finfo.leading)); @@ -97,8 +104,10 @@ DeviceListItem::DrawItem(BView *owner, BRect itemRect, bool complete) owner->DrawString(fName.String()); // TODO: Stroke icon - + owner->StrokeRect(BRect(itemRect.left + INSETS, itemRect.top + INSETS, + itemRect.left + PIXELS_FOR_ICON, itemRect.top + PIXELS_FOR_ICON)); // TODO: Draw rssi + } @@ -109,7 +118,6 @@ DeviceListItem::Update(BView *owner, const BFont *font) font_height height; font->GetHeight(&height); - //SetHeight(finfo.leading*TEXT_ROWS + TEXT_ROWS*INSETS + 50); SetHeight((height.ascent + height.descent + height.leading) * TEXT_ROWS + TEXT_ROWS*INSETS); diff --git a/src/preferences/bluetooth/InquiryPanel.cpp b/src/preferences/bluetooth/InquiryPanel.cpp index e23e6ae5cc..256281b9cc 100644 --- a/src/preferences/bluetooth/InquiryPanel.cpp +++ b/src/preferences/bluetooth/InquiryPanel.cpp @@ -6,13 +6,14 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include #include #include @@ -82,7 +83,7 @@ private: InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice) : BWindow(frame, "Bluetooth", B_FLOATING_WINDOW, - B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS, + B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES ), fScanning(false) , fLocalDevice(lDevice) { @@ -111,6 +112,8 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice) fRemoteList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); + fScrollView = new BScrollView("ScrollView", fRemoteList, 0, false, true); + fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); if (fLocalDevice != NULL) { fMessage->SetText("Check that the bluetooth capabilities of your remote device" @@ -137,7 +140,7 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(fScanProgress) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) - .Add(fRemoteList) + .Add(fScrollView) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(fAddButton) @@ -185,6 +188,7 @@ InquiryPanel::MessageReceived(BMessage *message) message.AddPointer("device", item); be_app->PostMessage(&message); + // TODO: all others listitems can be deleted } break; diff --git a/src/preferences/bluetooth/InquiryPanel.h b/src/preferences/bluetooth/InquiryPanel.h index b6c081fa1f..70068db5e5 100644 --- a/src/preferences/bluetooth/InquiryPanel.h +++ b/src/preferences/bluetooth/InquiryPanel.h @@ -15,6 +15,7 @@ class BStatusBar; class BButton; class BTextView; class BListView; +class BScrollView; class LocalDevice; class DiscoveryAgent; class DiscoveryListener; @@ -32,6 +33,7 @@ private: BButton* fInquiryButton; BTextView* fMessage; BListView* fRemoteList; + BScrollView* fScrollView; BMessageRunner* fRunner; bool fScanning; diff --git a/src/preferences/bluetooth/RemoteDevicesView.cpp b/src/preferences/bluetooth/RemoteDevicesView.cpp index 126a4736a4..19a516faee 100644 --- a/src/preferences/bluetooth/RemoteDevicesView.cpp +++ b/src/preferences/bluetooth/RemoteDevicesView.cpp @@ -58,8 +58,7 @@ RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags) SetLayout(new BGroupLayout(B_VERTICAL)); - // TODO: Make list view and scroller use all the additional height - // available! + // TODO: use all the additional height AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(fScrollView) //.Add(BSpaceLayoutItem::CreateHorizontalStrut(5)) @@ -106,7 +105,7 @@ RemoteDevicesView::MessageReceived(BMessage *msg) switch(msg->what) { case kMsgAddDevices: { - InquiryPanel* iPanel = new InquiryPanel(BRect(100,100,400,400), ActiveLocalDevice); + InquiryPanel* iPanel = new InquiryPanel(BRect(100,100,450,450), ActiveLocalDevice); iPanel->Show(); } break;