summaryrefslogtreecommitdiffstats
path: root/qt-ui/btdeviceselectiondialog.h
diff options
context:
space:
mode:
authorGravatar Claudiu Olteanu <olteanu.claudiu@ymail.com>2015-07-06 16:35:13 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-06 08:36:42 -0700
commitdff4e5f33eee0ba112ddd2265410a5e858d6c98f (patch)
tree87c3e50d860999dc6372bb2a1b25f84f962bbbea /qt-ui/btdeviceselectiondialog.h
parentb4c4d95ea4d19d63492a5de4abdab31673ab9725 (diff)
downloadsubsurface-dff4e5f33eee0ba112ddd2265410a5e858d6c98f.tar.gz
Add a dialog for remote Bluetooth devices selection
Implement a dialog which can be used for remote Bluetooth devices selection and to control the local Bluetooth device. Functionalities of the widget: - expose information about the local BT device - scan for remote BT devices - pair/unpair with a remote BT device - turn on/off the local BT device - logging - save the selected BT device The selection dialog is created when the bluetoothMode checkbox is enabled. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/btdeviceselectiondialog.h')
-rw-r--r--qt-ui/btdeviceselectiondialog.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/qt-ui/btdeviceselectiondialog.h b/qt-ui/btdeviceselectiondialog.h
new file mode 100644
index 000000000..6bcc43f34
--- /dev/null
+++ b/qt-ui/btdeviceselectiondialog.h
@@ -0,0 +1,46 @@
+#ifndef BTDEVICESELECTIONDIALOG_H
+#define BTDEVICESELECTIONDIALOG_H
+
+#include <QDialog>
+#include <QListWidgetItem>
+#include <QPointer>
+#include <QtBluetooth/QBluetoothLocalDevice>
+#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
+
+Q_DECLARE_METATYPE(QBluetoothDeviceInfo)
+
+namespace Ui {
+ class BtDeviceSelectionDialog;
+}
+
+class BtDeviceSelectionDialog : public QDialog {
+ Q_OBJECT
+
+public:
+ explicit BtDeviceSelectionDialog(QWidget *parent = 0);
+ ~BtDeviceSelectionDialog();
+ QString getSelectedDeviceAddress();
+ QString getSelectedDeviceName();
+
+private slots:
+ void on_changeDeviceState_clicked();
+ void on_save_clicked();
+ void on_clear_clicked();
+ void on_scan_clicked();
+ void remoteDeviceScanFinished();
+ void hostModeStateChanged(QBluetoothLocalDevice::HostMode mode);
+ void addRemoteDevice(const QBluetoothDeviceInfo &remoteDeviceInfo);
+ void itemActivated(QListWidgetItem *item);
+ void displayPairingMenu(const QPoint &pos);
+ void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing);
+ void error(QBluetoothLocalDevice::Error error);
+
+private:
+ Ui::BtDeviceSelectionDialog *ui;
+ QBluetoothLocalDevice *localDevice;
+ QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent;
+ QSharedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo;
+};
+
+#endif // BTDEVICESELECTIONDIALOG_H