Bluetooth: Added settings to remember last used device.
Signed-off-by: Matt Madia <[email protected]>
This commit is contained in:
@@ -77,7 +77,7 @@ BluetoothApplication::MessageReceived(BMessage* message)
|
|||||||
BMessageRunner::StartSending(be_app_messenger,
|
BMessageRunner::StartSending(be_app_messenger,
|
||||||
new BMessage('Xtmp'), 2 * 1000000, 1);
|
new BMessage('Xtmp'), 2 * 1000000, 1);
|
||||||
} else {
|
} else {
|
||||||
fWindow = new BluetoothWindow(BRect(100, 100, 550, 420));
|
fWindow = new BluetoothWindow(BRect(100, 100, 750, 420));
|
||||||
fWindow->Show();
|
fWindow->Show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008-2009, Oliver Ruiz Dorantes, <[email protected]>
|
||||||
|
* Copyright 2012-2013, Tri-Edge AI <[email protected]>
|
||||||
|
*
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT license.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "BluetoothSettings.h"
|
||||||
|
|
||||||
|
BluetoothSettings::BluetoothSettings()
|
||||||
|
{
|
||||||
|
find_directory(B_USER_SETTINGS_DIRECTORY, &fPath);
|
||||||
|
fPath.Append("Bluetooth_settings", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BluetoothSettings::~BluetoothSettings()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothSettings::Defaults()
|
||||||
|
{
|
||||||
|
Data.PickedDevice = bdaddrUtils::NullAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothSettings::Load()
|
||||||
|
{
|
||||||
|
fFile = new BFile(fPath.Path(), B_READ_ONLY);
|
||||||
|
|
||||||
|
if (fFile->InitCheck() == B_OK) {
|
||||||
|
fFile->Read(&Data, sizeof(Data));
|
||||||
|
// TODO: Add more settings here.
|
||||||
|
} else
|
||||||
|
Defaults();
|
||||||
|
|
||||||
|
delete fFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothSettings::Save()
|
||||||
|
{
|
||||||
|
fFile = new BFile(fPath.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
||||||
|
|
||||||
|
if (fFile->InitCheck() == B_OK) {
|
||||||
|
fFile->Write(&Data, sizeof(Data));
|
||||||
|
// TODO: Add more settings here.
|
||||||
|
}
|
||||||
|
|
||||||
|
delete fFile;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008-2009, Oliver Ruiz Dorantes, <[email protected]>
|
||||||
|
* Copyright 2012-2013, Tri-Edge AI <[email protected]>
|
||||||
|
*
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT license.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BLUETOOTH_SETTINGS_H
|
||||||
|
#define BLUETOOTH_SETTINGS_H
|
||||||
|
|
||||||
|
#include <bluetooth/bdaddrUtils.h>
|
||||||
|
#include <bluetooth/LocalDevice.h>
|
||||||
|
|
||||||
|
#include <File.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
#include <Path.h>
|
||||||
|
|
||||||
|
class BluetoothSettings
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct {
|
||||||
|
bdaddr_t PickedDevice;
|
||||||
|
} Data;
|
||||||
|
|
||||||
|
BluetoothSettings();
|
||||||
|
~BluetoothSettings();
|
||||||
|
|
||||||
|
void Defaults();
|
||||||
|
void Load();
|
||||||
|
void Save();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BPath fPath;
|
||||||
|
BFile* fFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BLUETOOTH_SETTINGS_H
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
|
* Copyright 2008-2009, Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
|
||||||
|
* Copyright 2012-2013, Tri-Edge AI, <[email protected]>
|
||||||
|
*
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BluetoothSettingsView.h"
|
#include "BluetoothSettingsView.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "defs.h"
|
||||||
#include <stdlib.h>
|
#include "BluetoothSettings.h"
|
||||||
|
#include "BluetoothWindow.h"
|
||||||
|
#include "ExtendedLocalDeviceView.h"
|
||||||
|
|
||||||
|
#include <bluetooth/LocalDevice.h>
|
||||||
|
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
@@ -19,12 +26,8 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
#include <bluetooth/LocalDevice.h>
|
#include <stdio.h>
|
||||||
#include "ExtendedLocalDeviceView.h"
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "BluetoothWindow.h"
|
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "Settings view"
|
#define B_TRANSLATION_CONTEXT "Settings view"
|
||||||
@@ -45,13 +48,15 @@ static const char* kLaptopLabel = B_TRANSLATE_MARK("Laptop");
|
|||||||
static const char* kHandheldLabel = B_TRANSLATE_MARK("Handheld");
|
static const char* kHandheldLabel = B_TRANSLATE_MARK("Handheld");
|
||||||
static const char* kPhoneLabel = B_TRANSLATE_MARK("Smart phone");
|
static const char* kPhoneLabel = B_TRANSLATE_MARK("Smart phone");
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
BluetoothSettingsView::BluetoothSettingsView(const char* name)
|
BluetoothSettingsView::BluetoothSettingsView(const char* name)
|
||||||
: BView(name, 0),
|
:
|
||||||
|
BView(name, 0),
|
||||||
fLocalDevicesMenu(NULL)
|
fLocalDevicesMenu(NULL)
|
||||||
{
|
{
|
||||||
|
fSettings.Load();
|
||||||
|
|
||||||
_BuildConnectionPolicy();
|
_BuildConnectionPolicy();
|
||||||
fPolicyMenuField = new BMenuField("policy",
|
fPolicyMenuField = new BMenuField("policy",
|
||||||
B_TRANSLATE("Incoming connections policy:"), fPolicyMenu);
|
B_TRANSLATE("Incoming connections policy:"), fPolicyMenu);
|
||||||
@@ -65,10 +70,7 @@ BluetoothSettingsView::BluetoothSettingsView(const char* name)
|
|||||||
fInquiryTimeControl->SetHashMarkCount(255 / 15);
|
fInquiryTimeControl->SetHashMarkCount(255 / 15);
|
||||||
fInquiryTimeControl->SetEnabled(true);
|
fInquiryTimeControl->SetEnabled(true);
|
||||||
|
|
||||||
// hinting menu
|
fExtDeviceView = new ExtendedLocalDeviceView(BRect(0, 0, 5, 5), NULL);
|
||||||
_BuildClassMenu();
|
|
||||||
fClassMenuField = new BMenuField("class", B_TRANSLATE("Identify host as:"),
|
|
||||||
fClassMenu);
|
|
||||||
|
|
||||||
// localdevices menu
|
// localdevices menu
|
||||||
_BuildLocalDevicesMenu();
|
_BuildLocalDevicesMenu();
|
||||||
@@ -76,13 +78,20 @@ BluetoothSettingsView::BluetoothSettingsView(const char* name)
|
|||||||
B_TRANSLATE("Local devices found on system:"),
|
B_TRANSLATE("Local devices found on system:"),
|
||||||
fLocalDevicesMenu);
|
fLocalDevicesMenu);
|
||||||
|
|
||||||
fExtDeviceView = new ExtendedLocalDeviceView(BRect(0, 0, 5, 5), NULL);
|
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
|
|
||||||
|
if (ActiveLocalDevice != NULL) {
|
||||||
|
fExtDeviceView->SetLocalDevice(ActiveLocalDevice);
|
||||||
|
fExtDeviceView->SetEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// hinting menu
|
||||||
|
_BuildClassMenu();
|
||||||
|
fClassMenuField = new BMenuField("class", B_TRANSLATE("Identify host as:"),
|
||||||
|
fClassMenu);
|
||||||
|
|
||||||
// controls pane
|
// controls pane
|
||||||
AddChild(BGridLayoutBuilder(10, 10)
|
AddChild(BGridLayoutBuilder(10, 10)
|
||||||
|
|
||||||
.Add(fClassMenuField->CreateLabelLayoutItem(), 0, 0)
|
.Add(fClassMenuField->CreateLabelLayoutItem(), 0, 0)
|
||||||
.Add(fClassMenuField->CreateMenuBarLayoutItem(), 1, 0)
|
.Add(fClassMenuField->CreateMenuBarLayoutItem(), 1, 0)
|
||||||
|
|
||||||
@@ -107,7 +116,7 @@ BluetoothSettingsView::BluetoothSettingsView(const char* name)
|
|||||||
|
|
||||||
BluetoothSettingsView::~BluetoothSettingsView()
|
BluetoothSettingsView::~BluetoothSettingsView()
|
||||||
{
|
{
|
||||||
|
fSettings.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -133,16 +142,18 @@ BluetoothSettingsView::MessageReceived(BMessage* message)
|
|||||||
case kMsgLocalSwitched:
|
case kMsgLocalSwitched:
|
||||||
{
|
{
|
||||||
LocalDevice* lDevice;
|
LocalDevice* lDevice;
|
||||||
if (message->FindPointer("LocalDevice", (void**) &lDevice) == B_OK) {
|
|
||||||
// Device integrity should be rechecked
|
if (message->FindPointer("LocalDevice",
|
||||||
fExtDeviceView->SetLocalDevice(lDevice);
|
(void**)&lDevice) == B_OK) {
|
||||||
fExtDeviceView->SetEnabled(true);
|
|
||||||
ActiveLocalDevice = lDevice;
|
_MarkLocalDevice(lDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
// TODO: To be fixed. :)
|
||||||
/*
|
|
||||||
To be fixed :)
|
/*
|
||||||
case kMsgSetConnectionPolicy:
|
case kMsgSetConnectionPolicy:
|
||||||
{
|
{
|
||||||
//uint8 Policy;
|
//uint8 Policy;
|
||||||
@@ -153,24 +164,30 @@ BluetoothSettingsView::MessageReceived(BMessage* message)
|
|||||||
case kMsgSetInquiryTime:
|
case kMsgSetInquiryTime:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}*/
|
}
|
||||||
|
*/
|
||||||
case kMsgSetDeviceClass:
|
case kMsgSetDeviceClass:
|
||||||
{
|
{
|
||||||
uint8 deviceClass;
|
uint8 deviceClass;
|
||||||
if (message->FindInt8("DeviceClass", (int8*)&deviceClass) == B_OK) {
|
|
||||||
|
if (message->FindInt8("DeviceClass",
|
||||||
|
(int8*)&deviceClass) == B_OK) {
|
||||||
|
|
||||||
if (deviceClass == 5)
|
if (deviceClass == 5)
|
||||||
_SetDeviceClass(2, 3, 0x72);
|
_SetDeviceClass(2, 3, 0x72);
|
||||||
else
|
else
|
||||||
_SetDeviceClass(1, deviceClass, 0x72);
|
_SetDeviceClass(1, deviceClass, 0x72);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kMsgRefresh:
|
case kMsgRefresh:
|
||||||
|
{
|
||||||
_BuildLocalDevicesMenu();
|
_BuildLocalDevicesMenu();
|
||||||
fLocalDevicesMenu->SetTargetForItems(this);
|
fLocalDevicesMenu->SetTargetForItems(this);
|
||||||
break;
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
}
|
}
|
||||||
@@ -178,12 +195,13 @@ BluetoothSettingsView::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BluetoothSettingsView::_SetDeviceClass(uint8 major, uint8 minor, uint16 service)
|
BluetoothSettingsView::_SetDeviceClass(uint8 major, uint8 minor,
|
||||||
|
uint16 service)
|
||||||
{
|
{
|
||||||
bool haveRun = true;
|
bool haveRun = true;
|
||||||
|
|
||||||
DeviceClass devClass;
|
DeviceClass devClass(major, minor, service);
|
||||||
devClass.SetRecord(major, minor, service);
|
|
||||||
if (ActiveLocalDevice != NULL)
|
if (ActiveLocalDevice != NULL)
|
||||||
ActiveLocalDevice->SetDeviceClass(devClass);
|
ActiveLocalDevice->SetDeviceClass(devClass);
|
||||||
else
|
else
|
||||||
@@ -217,13 +235,16 @@ BluetoothSettingsView::_BuildConnectionPolicy()
|
|||||||
fPolicyMenu->AddItem(item);
|
fPolicyMenu->AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BluetoothSettingsView::_BuildClassMenu()
|
BluetoothSettingsView::_BuildClassMenu()
|
||||||
{
|
{
|
||||||
|
|
||||||
BMessage* message = NULL;
|
BMessage* message = NULL;
|
||||||
BMenuItem* item = NULL;
|
BMenuItem* item = NULL;
|
||||||
|
DeviceClass devClass;
|
||||||
|
|
||||||
|
if (ActiveLocalDevice != NULL) {
|
||||||
|
devClass = ActiveLocalDevice->GetDeviceClass();
|
||||||
|
}
|
||||||
|
|
||||||
fClassMenu = new BPopUpMenu(B_TRANSLATE("Identify us as..."));
|
fClassMenu = new BPopUpMenu(B_TRANSLATE("Identify us as..."));
|
||||||
|
|
||||||
@@ -232,25 +253,45 @@ BluetoothSettingsView::_BuildClassMenu()
|
|||||||
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kDesktopLabel), message);
|
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kDesktopLabel), message);
|
||||||
fClassMenu->AddItem(item);
|
fClassMenu->AddItem(item);
|
||||||
|
|
||||||
|
if (devClass.MajorDeviceClass() == 1 &&
|
||||||
|
devClass.MinorDeviceClass() == 1)
|
||||||
|
item->SetMarked(true);
|
||||||
|
|
||||||
message = new BMessage(kMsgSetDeviceClass);
|
message = new BMessage(kMsgSetDeviceClass);
|
||||||
message->AddInt8("DeviceClass", 2);
|
message->AddInt8("DeviceClass", 2);
|
||||||
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kServerLabel), message);
|
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kServerLabel), message);
|
||||||
fClassMenu->AddItem(item);
|
fClassMenu->AddItem(item);
|
||||||
|
|
||||||
|
if (devClass.MajorDeviceClass() == 1 &&
|
||||||
|
devClass.MinorDeviceClass() == 2)
|
||||||
|
item->SetMarked(true);
|
||||||
|
|
||||||
message = new BMessage(kMsgSetDeviceClass);
|
message = new BMessage(kMsgSetDeviceClass);
|
||||||
message->AddInt8("DeviceClass", 3);
|
message->AddInt8("DeviceClass", 3);
|
||||||
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kLaptopLabel), message);
|
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kLaptopLabel), message);
|
||||||
fClassMenu->AddItem(item);
|
fClassMenu->AddItem(item);
|
||||||
|
|
||||||
|
if (devClass.MajorDeviceClass() == 1 &&
|
||||||
|
devClass.MinorDeviceClass() == 3)
|
||||||
|
item->SetMarked(true);
|
||||||
|
|
||||||
message = new BMessage(kMsgSetDeviceClass);
|
message = new BMessage(kMsgSetDeviceClass);
|
||||||
message->AddInt8("DeviceClass", 4);
|
message->AddInt8("DeviceClass", 4);
|
||||||
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kHandheldLabel), message);
|
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kHandheldLabel), message);
|
||||||
fClassMenu->AddItem(item);
|
fClassMenu->AddItem(item);
|
||||||
|
|
||||||
|
if (devClass.MajorDeviceClass() == 1 &&
|
||||||
|
devClass.MinorDeviceClass() == 4)
|
||||||
|
item->SetMarked(true);
|
||||||
|
|
||||||
message = new BMessage(kMsgSetDeviceClass);
|
message = new BMessage(kMsgSetDeviceClass);
|
||||||
message->AddInt8("DeviceClass", 5);
|
message->AddInt8("DeviceClass", 5);
|
||||||
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kPhoneLabel), message);
|
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kPhoneLabel), message);
|
||||||
fClassMenu->AddItem(item);
|
fClassMenu->AddItem(item);
|
||||||
|
|
||||||
|
if (devClass.MajorDeviceClass() == 2 &&
|
||||||
|
devClass.MinorDeviceClass() == 3)
|
||||||
|
item->SetMarked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -260,20 +301,47 @@ BluetoothSettingsView::_BuildLocalDevicesMenu()
|
|||||||
LocalDevice* lDevice;
|
LocalDevice* lDevice;
|
||||||
|
|
||||||
if (!fLocalDevicesMenu)
|
if (!fLocalDevicesMenu)
|
||||||
fLocalDevicesMenu = new BPopUpMenu(B_TRANSLATE("Pick LocalDevice..."));
|
fLocalDevicesMenu = new BPopUpMenu(B_TRANSLATE("Pick device..."));
|
||||||
|
|
||||||
for (uint32 index = 0; index < LocalDevice::GetLocalDeviceCount(); index++) {
|
while (fLocalDevicesMenu->CountItems() > 0) {
|
||||||
|
BMenuItem* item = fLocalDevicesMenu->RemoveItem(0L);
|
||||||
|
|
||||||
|
if (item != NULL) {
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ActiveLocalDevice = NULL;
|
||||||
|
|
||||||
|
for (uint32 i = 0; i < LocalDevice::GetLocalDeviceCount(); i++) {
|
||||||
lDevice = LocalDevice::GetLocalDevice();
|
lDevice = LocalDevice::GetLocalDevice();
|
||||||
if (lDevice != NULL) {
|
|
||||||
|
|
||||||
// TODO Check if they already exists
|
if (lDevice != NULL) {
|
||||||
BMessage* message = new BMessage(kMsgLocalSwitched);
|
BMessage* message = new BMessage(kMsgLocalSwitched);
|
||||||
message->AddPointer("LocalDevice", lDevice);
|
message->AddPointer("LocalDevice", lDevice);
|
||||||
|
|
||||||
BMenuItem* item = new BMenuItem((lDevice->GetFriendlyName().String()),
|
BMenuItem* item = new BMenuItem(
|
||||||
message);
|
(lDevice->GetFriendlyName().String()), message);
|
||||||
|
|
||||||
|
if (bdaddrUtils::Compare(lDevice->GetBluetoothAddress(),
|
||||||
|
fSettings.Data.PickedDevice)) {
|
||||||
|
|
||||||
|
item->SetMarked(true);
|
||||||
|
ActiveLocalDevice = lDevice;
|
||||||
|
}
|
||||||
|
|
||||||
fLocalDevicesMenu->AddItem(item);
|
fLocalDevicesMenu->AddItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothSettingsView::_MarkLocalDevice(LocalDevice* lDevice)
|
||||||
|
{
|
||||||
|
// TODO: Device integrity should be rechecked.
|
||||||
|
|
||||||
|
fExtDeviceView->SetLocalDevice(lDevice);
|
||||||
|
fExtDeviceView->SetEnabled(true);
|
||||||
|
ActiveLocalDevice = lDevice;
|
||||||
|
fSettings.Data.PickedDevice = lDevice->GetBluetoothAddress();
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,49 +1,58 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
|
* Copyright 2008-2009, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes@gmail.com>
|
||||||
|
* Copyright 2012-2013, Tri-Edge AI, <[email protected]>
|
||||||
|
*
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BLUETOOTH_SETTINGS_VIEW_H
|
#ifndef BLUETOOTH_SETTINGS_VIEW_H
|
||||||
#define BLUETOOTH_SETTINGS_VIEW_H
|
#define BLUETOOTH_SETTINGS_VIEW_H
|
||||||
|
|
||||||
|
#include "BluetoothSettings.h"
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
class BluetoothSettings;
|
||||||
|
class ExtendedLocalDeviceView;
|
||||||
|
class LocalDevice;
|
||||||
|
|
||||||
class BBox;
|
class BBox;
|
||||||
class BMenuField;
|
class BMenuField;
|
||||||
class BPopUpMenu;
|
class BPopUpMenu;
|
||||||
class BSlider;
|
class BSlider;
|
||||||
|
|
||||||
class ExtendedLocalDeviceView;
|
|
||||||
|
|
||||||
class BluetoothSettingsView : public BView {
|
class BluetoothSettingsView : public BView {
|
||||||
public:
|
public:
|
||||||
BluetoothSettingsView(const char* name);
|
BluetoothSettingsView(const char* name);
|
||||||
virtual ~BluetoothSettingsView();
|
virtual ~BluetoothSettingsView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _BuildConnectionPolicy();
|
void _BuildConnectionPolicy();
|
||||||
void _BuildClassMenu();
|
void _BuildClassMenu();
|
||||||
void _BuildLocalDevicesMenu();
|
void _BuildLocalDevicesMenu();
|
||||||
bool _SetDeviceClass(uint8 major, uint8 minor
|
bool _SetDeviceClass(uint8 major, uint8 minor,
|
||||||
, uint16 service);
|
uint16 service);
|
||||||
|
void _MarkLocalDevice(LocalDevice* lDevice);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float fDivider;
|
BluetoothSettings fSettings;
|
||||||
|
|
||||||
BMenuField* fPolicyMenuField;
|
float fDivider;
|
||||||
BPopUpMenu* fPolicyMenu;
|
|
||||||
BMenuField* fClassMenuField;
|
|
||||||
BPopUpMenu* fClassMenu;
|
|
||||||
BMenuField* fLocalDevicesMenuField;
|
|
||||||
BPopUpMenu* fLocalDevicesMenu;
|
|
||||||
|
|
||||||
ExtendedLocalDeviceView* fExtDeviceView;
|
BMenuField* fPolicyMenuField;
|
||||||
|
BPopUpMenu* fPolicyMenu;
|
||||||
|
BMenuField* fClassMenuField;
|
||||||
|
BPopUpMenu* fClassMenu;
|
||||||
|
BMenuField* fLocalDevicesMenuField;
|
||||||
|
BPopUpMenu* fLocalDevicesMenu;
|
||||||
|
|
||||||
BSlider* fInquiryTimeControl;
|
ExtendedLocalDeviceView* fExtDeviceView;
|
||||||
|
|
||||||
|
BSlider* fInquiryTimeControl;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ BluetoothWindow::BluetoothWindow(BRect frame)
|
|||||||
// tabView->AddTab(fConnChan);
|
// tabView->AddTab(fConnChan);
|
||||||
tabView->AddTab(fSettingsView);
|
tabView->AddTab(fSettingsView);
|
||||||
|
|
||||||
|
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
|
|
||||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
|
||||||
|
|||||||
@@ -2,37 +2,36 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BLUETOOTH_WINDOW_H
|
#ifndef BLUETOOTH_WINDOW_H
|
||||||
#define BLUETOOTH_WINDOW_H
|
#define BLUETOOTH_WINDOW_H
|
||||||
|
|
||||||
|
#include "BluetoothSettingsView.h"
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <TabView.h>
|
#include <TabView.h>
|
||||||
|
|
||||||
|
class BluetoothSettingsView;
|
||||||
#include "BluetoothSettingsView.h"
|
|
||||||
|
|
||||||
class RemoteDevicesView;
|
class RemoteDevicesView;
|
||||||
class ConnChanView;
|
class ConnChanView;
|
||||||
|
|
||||||
class BluetoothWindow : public BWindow
|
class BluetoothWindow : public BWindow {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
BluetoothWindow(BRect frame);
|
BluetoothWindow(BRect frame);
|
||||||
bool QuitRequested(void);
|
bool QuitRequested(void);
|
||||||
void MessageReceived(BMessage *message);
|
void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RemoteDevicesView* fRemoteDevices;
|
RemoteDevicesView* fRemoteDevices;
|
||||||
ConnChanView* fConnChan;
|
ConnChanView* fConnChan;
|
||||||
BButton* fDefaultsButton;
|
BButton* fDefaultsButton;
|
||||||
BButton* fRevertButton;
|
BButton* fRevertButton;
|
||||||
BMenuBar* fMenubar;
|
BMenuBar* fMenubar;
|
||||||
|
|
||||||
BluetoothSettingsView* fSettingsView;
|
|
||||||
|
|
||||||
|
BluetoothSettingsView* fSettingsView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ AddResources Bluetooth : bluetooth-pref.rdef ;
|
|||||||
Preference Bluetooth :
|
Preference Bluetooth :
|
||||||
BluetoothDeviceView.cpp
|
BluetoothDeviceView.cpp
|
||||||
BluetoothMain.cpp
|
BluetoothMain.cpp
|
||||||
|
BluetoothSettings.cpp
|
||||||
BluetoothSettingsView.cpp
|
BluetoothSettingsView.cpp
|
||||||
BluetoothWindow.cpp
|
BluetoothWindow.cpp
|
||||||
DeviceListItem.cpp
|
DeviceListItem.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user