2015-07-06 13:35:13 +00:00
|
|
|
#ifndef BTDEVICESELECTIONDIALOG_H
|
|
|
|
#define BTDEVICESELECTIONDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QListWidgetItem>
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QtBluetooth/QBluetoothLocalDevice>
|
|
|
|
#include <QtBluetooth/qbluetoothglobal.h>
|
|
|
|
#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
|
|
|
|
|
2015-07-07 05:17:38 +00:00
|
|
|
#if QT_VERSION < 0x050500
|
2015-07-06 13:35:13 +00:00
|
|
|
Q_DECLARE_METATYPE(QBluetoothDeviceInfo)
|
2015-07-07 05:17:38 +00:00
|
|
|
#endif
|
2015-07-06 13:35:13 +00:00
|
|
|
|
|
|
|
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
|