diff --git a/src/preferences/bluetooth/InquiryPanel.cpp b/src/preferences/bluetooth/InquiryPanel.cpp index 1f9d10148b..7bdab0d515 100644 --- a/src/preferences/bluetooth/InquiryPanel.cpp +++ b/src/preferences/bluetooth/InquiryPanel.cpp @@ -2,22 +2,19 @@ * Copyright 2008-09, Oliver Ruiz Dorantes, * All rights reserved. Distributed under the terms of the MIT License. */ -#include "BluetoothWindow.h" #include #include #include -#include +#include #include +#include #include - -#include "RemoteDevicesView.h" - -//#include "ConnChanView.h" +#include #include "defs.h" -static const uint32 kMsgSetDefaults = 'dflt'; +static const uint32 kMsgUpdate = 'dflt'; static const uint32 kMsgRevert = 'rvrt'; static const uint32 kMsgStartServices = 'SrSR'; @@ -25,61 +22,43 @@ static const uint32 kMsgStopServices = 'StST'; static const uint32 kMsgShowDebug = 'ShDG'; -BluetoothWindow::BluetoothWindow(BRect frame) +InquiryPanel::InquiryPanel(BRect frame) : BWindow(frame, "Bluetooth", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES) { + BRect iDontCare(0,0,0,0); + BRect iDontCareToo(0,0,5,5); + SetLayout(new BGroupLayout(B_HORIZONTAL)); - fDefaultsButton = new BButton("defaults", "Defaults", - new BMessage(kMsgSetDefaults), B_WILL_DRAW); + fScanProgress = new BStatusBar(iDontCare, "status", "Scanning", "Scan time"); + fScanProgress->SetMaxValue(52); - fRevertButton = new BButton("revert", "Revert", + fMessage = new BTextView(iDontCare, "description", + iDontCare2, B_FOLLOW_LEFT_RIGHT, + B_WILL_DRAW | B_FRAME_EVENTS); + fMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fMessage->SetLowColor(fMessage->ViewColor()); + fMessage->MakeEditable(false); + fMessage->SetText("asdfdasas asdfas asdfasd a dfad asdf dfasdf a"); + + fInquiryButton = new BButton("Inquiry", "Inquiry", new BMessage(kMsgRevert), B_WILL_DRAW); + + fAddButton = new BButton("ad", "Add device to list", + new BMessage(kMsgRevert), B_WILL_DRAW); - // Add the menu bar - fMenubar = new BMenuBar(Bounds(), "menu_bar"); - - // Add File menu to menu bar - BMenu *menu = new BMenu("Server"); - menu->AddItem(new BMenuItem("Start Bluetooth Services" B_UTF8_ELLIPSIS, new BMessage(kMsgStartServices), 0)); - menu->AddItem(new BMenuItem("Stop Bluetooth Services" B_UTF8_ELLIPSIS, new BMessage(kMsgStopServices), 0)); - menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Show Bluetooth console" B_UTF8_ELLIPSIS, new BMessage(kMsgStartServices), 0)); - fMenubar->AddItem(menu); - - menu = new BMenu("View"); - menu->AddItem(new BMenuItem("Connections & Channels list" B_UTF8_ELLIPSIS, NULL, 0)); - menu->AddItem(new BMenuItem("Remote Devices List" B_UTF8_ELLIPSIS, NULL, 0)); - fMenubar->AddItem(menu); - - menu = new BMenu("Help"); - menu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED), 0)); - fMenubar->AddItem(menu); - - BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); - - fSettingsView = new BluetoothSettingsView("Settings"); -// fConnChan = new ConnChanView("Connections & Channels", B_WILL_DRAW); - fRemoteDevices = new RemoteDevicesView("Remote Devices", B_WILL_DRAW); - - tabView->AddTab(fRemoteDevices); -// tabView->AddTab(fConnChan); - tabView->AddTab(fSettingsView); - - - fRevertButton->SetEnabled(false); AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) - .Add(fMenubar) + .Add(fScanProgress) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) - .Add(tabView) + .Add(fMessage) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) - .Add(fRevertButton) + .Add(fAddButton) .AddGlue() - .Add(fDefaultsButton) + .Add(fInquiryButton) ) .SetInsets(5, 5, 5, 5) ); @@ -87,7 +66,7 @@ BluetoothWindow::BluetoothWindow(BRect frame) void -BluetoothWindow::MessageReceived(BMessage *message) +InquiryPanel::MessageReceived(BMessage *message) { switch (message->what) { case kMsgUpdate: @@ -96,76 +75,30 @@ BluetoothWindow::MessageReceived(BMessage *message) fRevertButton->SetEnabled(true);*/ break; - case kMsgSetDefaults: -/* fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS)); +/* case kMsgSetDefaults: + fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS)); fAntialiasingSettings->SetDefaults(); fDefaultsButton->SetEnabled(false); fRevertButton->SetEnabled(true); -*/ break; + break; case kMsgRevert: -/* fColorsView -> MessageReceived(new BMessage(REVERT_SETTINGS)); + fColorsView -> MessageReceived(new BMessage(REVERT_SETTINGS)); fAntialiasingSettings->Revert(); fDefaultsButton->SetEnabled(fColorsView->IsDefaultable() || fAntialiasingSettings->IsDefaultable()); fRevertButton->SetEnabled(false); -*/ break; - case B_ABOUT_REQUESTED: - AboutRequested(); - break; - default: + break; +*/ default: BWindow::MessageReceived(message); break; } } -void -BluetoothWindow::AboutRequested() -{ - - (new BAlert("about", "Haiku Bluetooth System, (ARCE) - -Created by Oliver Ruiz Dorantes - -With support of: - - Mika Lindqvist - - Maksym Yevmenkin - -Thanks to the individuals who helped... - -Shipping/donating hardware: - - Henry Jair Abril Florez(el Colombian) - & Stefanie Bartolich - - Dennis d'Entremont - - Luroh - - Pieter Panman - -Economically: - - Karl von Dorf, Andrea Bernardi (OSDrawer), - - Matt M, Doug F, Hubert H, - - Sebastian B, Andrew M, Jared E, - - Frederik H, Tom S, Ferry B, - - Greg G, David F, Richard S, Martin W: - -With patches: - - Fredrik Ekdahl - - Andreas Färber - -Testing: - - Petter H. Juliussen - - Raynald Lesieur - - Adrien Destugues - - Jörg Meyer - -Who gave me all the knowledge: - - the yellowTAB team", "OK"))->Go(); - -} - bool -BluetoothWindow::QuitRequested(void) +InquiryPanel::QuitRequested(void) { - be_app->PostMessage(B_QUIT_REQUESTED); + return true; } diff --git a/src/preferences/bluetooth/InquiryPanel.h b/src/preferences/bluetooth/InquiryPanel.h index d78993ddf0..bd913fd421 100644 --- a/src/preferences/bluetooth/InquiryPanel.h +++ b/src/preferences/bluetooth/InquiryPanel.h @@ -11,28 +11,23 @@ #include #include +class BStatusBar; +class BButton; +class BTextView; -#include "InquirySettingsView.h" - -class RemoteDevicesView; -class ConnChanView; - -class InquiryWindow : public BWindow +class InquiryPanel : public BWindow { public: - InquiryWindow(BRect frame); + InquiryPanel(BRect frame); bool QuitRequested(void); void MessageReceived(BMessage *message); -private: - RemoteDevicesView* fRemoteDevices; - ConnChanView* fConnChan; - BButton* fDefaultsButton; - BButton* fRevertButton; - BMenuBar* fMenubar; +private: + BStatusBar* fScanProgress; + BButton* fAddButton; + BButton* fInquiryButton; + BTextView* fMessage; }; - - #endif diff --git a/src/preferences/bluetooth/RemoteDevicesView.cpp b/src/preferences/bluetooth/RemoteDevicesView.cpp index 6ac9453d75..75f685e96d 100644 --- a/src/preferences/bluetooth/RemoteDevicesView.cpp +++ b/src/preferences/bluetooth/RemoteDevicesView.cpp @@ -15,6 +15,7 @@ #include +#include "InquiryPanel.h" #include "BluetoothWindow.h" #include "defs.h" @@ -28,7 +29,7 @@ RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - BButton* addButton = new BButton(BRect(5,5,5,5), "add", "Add" B_UTF8_ELLIPSIS, + addButton = new BButton(BRect(5,5,5,5), "add", "Add" B_UTF8_ELLIPSIS, new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT); BButton* removeButton = new BButton(BRect(5,5,5,5), "remove", "Remove", @@ -86,6 +87,7 @@ void RemoteDevicesView::AttachedToWindow(void) { fAttrList->SetTarget(this); + addButton->SetTarget(this); LoadSettings(); fAttrList->Select(0); @@ -104,7 +106,12 @@ RemoteDevicesView::MessageReceived(BMessage *msg) } switch(msg->what) { - + case kMsgAddDevices: + { + InquiryPanel* iPanel = new InquiryPanel(BRect(0,0,50,50)); + iPanel->Show(); + } + break; default: BView::MessageReceived(msg); break; diff --git a/src/preferences/bluetooth/RemoteDevicesView.h b/src/preferences/bluetooth/RemoteDevicesView.h index b7c98d7baf..af6bb3051a 100644 --- a/src/preferences/bluetooth/RemoteDevicesView.h +++ b/src/preferences/bluetooth/RemoteDevicesView.h @@ -39,8 +39,9 @@ protected: void UpdateControls(); void UpdateAllColors(); - BListView *fAttrList; - BScrollView *fScrollView; + BButton* addButton; + BListView* fAttrList; + BScrollView* fScrollView; };