Bluetooth Pref: Updating view of incomming connection when Paring

This is not my code but from ticket #9265
* Made a picture of how it looks, old left andnew right. https://imagebin.ca/v/5wIe6TIMzw4C
* Think we have a bug somewhere and don't store the name of the Bluetooth device (shown i the image).
* I have made som small changes but other than that it's the same code as in the ticket
* Ran the src/tools/checkstyle/checkstyle.py to get som style stuff, probably missed some anyway.

Change-Id: Ifeb75c8ad890f541e100cdcf78b394675a48ada9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3825
Reviewed-by: Fredrik Modéen <[email protected]>
This commit is contained in:
Fredrik Modéen
2021-03-30 17:25:13 +00:00
parent 560961ee2a
commit 16196fd3b7
9 changed files with 371 additions and 141 deletions
@@ -0,0 +1,33 @@
/*
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Tri-Edge AI <[email protected]>
*/
#ifndef _BLUETOOTH_ICON_VIEW_H_
#define _BLUETOOTH_ICON_VIEW_H_
#include <View.h>
#include <Bitmap.h>
#include <MimeType.h>
#include <IconUtils.h>
namespace Bluetooth {
class BluetoothIconView : public BView {
public:
BluetoothIconView();
~BluetoothIconView();
void Draw(BRect rect);
private:
static BBitmap* fBitmap;
static int32 fRefCount;
};
}
#endif /* _BLUETOOTH_ICON_VIEW_H_ */
+24 -33
View File
@@ -1,52 +1,44 @@
/*
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
*
* All rights reserved. Distributed under the terms of the MIT License.
*
*/
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Ruiz Dorantes <[email protected]>
* Tri-Edge AI <[email protected]>
*/
#ifndef _CONNECTION_INCOMING_H_
#define _CONNECTION_INCOMING_H_
//----------------------- Global includes ----------------------
#include <AppKit.h>
#include <SupportKit.h>
#include <InterfaceKit.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <AppKit.h>
#include <SupportKit.h>
#include <InterfaceKit.h>
#include <ConnectionView.h>
#include <bluetooth/RemoteDevice.h>
#include <bluetooth/bdaddrUtils.h>
namespace Bluetooth {
class RemoteDevice;
class ConnectionView;
class ConnectionView
: public BView
{
class ConnectionIncoming : public BWindow {
public:
ConnectionView(BRect frame, const char *name);
~ConnectionView();
virtual void MessageReceived(BMessage *message);
void Draw(BRect update);
void Pulse();
private:
};
class ConnectionIncoming : public BWindow
{
public:
ConnectionIncoming(RemoteDevice* rDevice);
ConnectionIncoming(bdaddr_t address);
ConnectionIncoming(RemoteDevice* rDevice = NULL);
~ConnectionIncoming();
virtual void MessageReceived(BMessage *message);
virtual void MessageReceived(BMessage* message);
virtual bool QuitRequested();
private:
ConnectionView* _ConnectionView;
ConnectionView* fView;
};
}
@@ -55,5 +47,4 @@ private:
using Bluetooth::ConnectionIncoming;
#endif
#endif
#endif /* _CONNECTION_INCOMING_H_ */
@@ -0,0 +1,44 @@
/*
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Tri-Edge AI <[email protected]>
* Oliver Ruiz Dorantes <[email protected]>
*/
#ifndef _CONNECTION_VIEW_H_
#define _CONNECTION_VIEW_H_
#include <Window.h>
#include <View.h>
#include <StringView.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <Font.h>
#include <String.h>
namespace Bluetooth {
class BluetoothIconView;
class ConnectionView : public BView {
public:
ConnectionView(BRect frame,
BString device, BString address);
void Pulse();
private:
BString strMessage;
BluetoothIconView* fIcon;
BStringView* fMessage;
BStringView* fDeviceLabel;
BStringView* fDeviceText;
BStringView* fAddressLabel;
BStringView* fAddressText;
};
}
#endif /* _CONNECTION_VIEW_H_ */
+23 -10
View File
@@ -1,9 +1,14 @@
/*
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _PINCODE_REQUEST_WINDOW_H
#define _PINCODE_REQUEST_WINDOW_H
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Ruiz Dorantes <[email protected]>
* Tri-Edge AI <[email protected]>
*/
#ifndef _PINCODE_REQUEST_WINDOW_H_
#define _PINCODE_REQUEST_WINDOW_H_
#include <View.h>
@@ -12,20 +17,21 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/HCI/btHCI.h>
#include <BluetoothIconView.h>
class BStringView;
class BButton;
class BTextControl;
namespace Bluetooth {
namespace Bluetooth {
class RemoteDevice;
class PincodeWindow : public BWindow
{
class PincodeWindow : public BWindow {
public:
PincodeWindow(bdaddr_t address, hci_id hid);
PincodeWindow(RemoteDevice* rDevice);
virtual void MessageReceived(BMessage *msg);
virtual void MessageReceived(BMessage* msg);
virtual bool QuitRequested();
void SetBDaddr(BString address);
@@ -39,6 +45,13 @@ private:
BButton* fAcceptButton;
BButton* fCancelButton;
BTextControl* fPincodeText;
BluetoothIconView* fIcon;
BStringView* fMessage2;
BStringView* fDeviceLabel;
BStringView* fDeviceText;
BStringView* fAddressLabel;
BStringView* fAddressText;
};
}
@@ -47,4 +60,4 @@ private:
using Bluetooth::PincodeWindow;
#endif
#endif
#endif /* _PINCODE_REQUEST_WINDOW_H_ */