- Implement ADD button for remote devices list

- Shape a bit more the skeleton panel for scanning devices


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29223 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2009-02-15 18:32:23 +00:00
parent 63c851a15d
commit 3fcbf7dc22
4 changed files with 57 additions and 121 deletions
+35 -102
View File
@@ -2,22 +2,19 @@
* Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com> * Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
* All rights reserved. Distributed under the terms of the MIT License. * All rights reserved. Distributed under the terms of the MIT License.
*/ */
#include "BluetoothWindow.h"
#include <Alert.h> #include <Alert.h>
#include <Button.h> #include <Button.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <Messenger.h> #include <StatusBar.h>
#include <SpaceLayoutItem.h> #include <SpaceLayoutItem.h>
#include <TextView.h>
#include <TabView.h> #include <TabView.h>
#include <InquiryPanel.h>
#include "RemoteDevicesView.h"
//#include "ConnChanView.h"
#include "defs.h" #include "defs.h"
static const uint32 kMsgSetDefaults = 'dflt'; static const uint32 kMsgUpdate = 'dflt';
static const uint32 kMsgRevert = 'rvrt'; static const uint32 kMsgRevert = 'rvrt';
static const uint32 kMsgStartServices = 'SrSR'; static const uint32 kMsgStartServices = 'SrSR';
@@ -25,61 +22,43 @@ static const uint32 kMsgStopServices = 'StST';
static const uint32 kMsgShowDebug = 'ShDG'; static const uint32 kMsgShowDebug = 'ShDG';
BluetoothWindow::BluetoothWindow(BRect frame) InquiryPanel::InquiryPanel(BRect frame)
: BWindow(frame, "Bluetooth", B_TITLED_WINDOW, : BWindow(frame, "Bluetooth", B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS,
B_ALL_WORKSPACES) B_ALL_WORKSPACES)
{ {
BRect iDontCare(0,0,0,0);
BRect iDontCareToo(0,0,5,5);
SetLayout(new BGroupLayout(B_HORIZONTAL)); SetLayout(new BGroupLayout(B_HORIZONTAL));
fDefaultsButton = new BButton("defaults", "Defaults", fScanProgress = new BStatusBar(iDontCare, "status", "Scanning", "Scan time");
new BMessage(kMsgSetDefaults), B_WILL_DRAW); 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); 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) AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(fMenubar) .Add(fScanProgress)
.Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
.Add(tabView) .Add(fMessage)
.Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(fRevertButton) .Add(fAddButton)
.AddGlue() .AddGlue()
.Add(fDefaultsButton) .Add(fInquiryButton)
) )
.SetInsets(5, 5, 5, 5) .SetInsets(5, 5, 5, 5)
); );
@@ -87,7 +66,7 @@ BluetoothWindow::BluetoothWindow(BRect frame)
void void
BluetoothWindow::MessageReceived(BMessage *message) InquiryPanel::MessageReceived(BMessage *message)
{ {
switch (message->what) { switch (message->what) {
case kMsgUpdate: case kMsgUpdate:
@@ -96,76 +75,30 @@ BluetoothWindow::MessageReceived(BMessage *message)
fRevertButton->SetEnabled(true);*/ fRevertButton->SetEnabled(true);*/
break; break;
case kMsgSetDefaults: /* case kMsgSetDefaults:
/* fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS)); fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS));
fAntialiasingSettings->SetDefaults(); fAntialiasingSettings->SetDefaults();
fDefaultsButton->SetEnabled(false); fDefaultsButton->SetEnabled(false);
fRevertButton->SetEnabled(true); fRevertButton->SetEnabled(true);
*/ break; break;
case kMsgRevert: case kMsgRevert:
/* fColorsView -> MessageReceived(new BMessage(REVERT_SETTINGS)); fColorsView -> MessageReceived(new BMessage(REVERT_SETTINGS));
fAntialiasingSettings->Revert(); fAntialiasingSettings->Revert();
fDefaultsButton->SetEnabled(fColorsView->IsDefaultable() fDefaultsButton->SetEnabled(fColorsView->IsDefaultable()
|| fAntialiasingSettings->IsDefaultable()); || fAntialiasingSettings->IsDefaultable());
fRevertButton->SetEnabled(false); fRevertButton->SetEnabled(false);
*/ break; break;
case B_ABOUT_REQUESTED: */ default:
AboutRequested();
break;
default:
BWindow::MessageReceived(message); BWindow::MessageReceived(message);
break; 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 bool
BluetoothWindow::QuitRequested(void) InquiryPanel::QuitRequested(void)
{ {
be_app->PostMessage(B_QUIT_REQUESTED);
return true; return true;
} }
+10 -15
View File
@@ -11,28 +11,23 @@
#include <Message.h> #include <Message.h>
#include <TabView.h> #include <TabView.h>
class BStatusBar;
class BButton;
class BTextView;
#include "InquirySettingsView.h" class InquiryPanel : public BWindow
class RemoteDevicesView;
class ConnChanView;
class InquiryWindow : public BWindow
{ {
public: public:
InquiryWindow(BRect frame); InquiryPanel(BRect frame);
bool QuitRequested(void); bool QuitRequested(void);
void MessageReceived(BMessage *message); void MessageReceived(BMessage *message);
private: private:
RemoteDevicesView* fRemoteDevices; BStatusBar* fScanProgress;
ConnChanView* fConnChan; BButton* fAddButton;
BButton* fDefaultsButton; BButton* fInquiryButton;
BButton* fRevertButton; BTextView* fMessage;
BMenuBar* fMenubar;
}; };
#endif #endif
@@ -15,6 +15,7 @@
#include <stdio.h> #include <stdio.h>
#include "InquiryPanel.h"
#include "BluetoothWindow.h" #include "BluetoothWindow.h"
#include "defs.h" #include "defs.h"
@@ -28,7 +29,7 @@ RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags)
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 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); new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT);
BButton* removeButton = new BButton(BRect(5,5,5,5), "remove", "Remove", BButton* removeButton = new BButton(BRect(5,5,5,5), "remove", "Remove",
@@ -86,6 +87,7 @@ void
RemoteDevicesView::AttachedToWindow(void) RemoteDevicesView::AttachedToWindow(void)
{ {
fAttrList->SetTarget(this); fAttrList->SetTarget(this);
addButton->SetTarget(this);
LoadSettings(); LoadSettings();
fAttrList->Select(0); fAttrList->Select(0);
@@ -104,7 +106,12 @@ RemoteDevicesView::MessageReceived(BMessage *msg)
} }
switch(msg->what) { switch(msg->what) {
case kMsgAddDevices:
{
InquiryPanel* iPanel = new InquiryPanel(BRect(0,0,50,50));
iPanel->Show();
}
break;
default: default:
BView::MessageReceived(msg); BView::MessageReceived(msg);
break; break;
@@ -39,8 +39,9 @@ protected:
void UpdateControls(); void UpdateControls();
void UpdateAllColors(); void UpdateAllColors();
BListView *fAttrList; BButton* addButton;
BScrollView *fScrollView; BListView* fAttrList;
BScrollView* fScrollView;
}; };