- 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:
parent
63c851a15d
commit
3fcbf7dc22
@ -2,22 +2,19 @@
|
||||
* Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#include "BluetoothWindow.h"
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Button.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <Messenger.h>
|
||||
#include <StatusBar.h>
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <TextView.h>
|
||||
#include <TabView.h>
|
||||
|
||||
|
||||
#include "RemoteDevicesView.h"
|
||||
|
||||
//#include "ConnChanView.h"
|
||||
#include <InquiryPanel.h>
|
||||
#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;
|
||||
}
|
||||
|
@ -11,28 +11,23 @@
|
||||
#include <Message.h>
|
||||
#include <TabView.h>
|
||||
|
||||
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
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#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;
|
||||
|
@ -39,8 +39,9 @@ protected:
|
||||
void UpdateControls();
|
||||
void UpdateAllColors();
|
||||
|
||||
BListView *fAttrList;
|
||||
BScrollView *fScrollView;
|
||||
BButton* addButton;
|
||||
BListView* fAttrList;
|
||||
BScrollView* fScrollView;
|
||||
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user