chore: update files of project

This commit is contained in:
x-tools-author 2024-03-21 09:25:20 +08:00
parent 114a1e67a3
commit 4e334f5eb6
3 changed files with 16 additions and 16 deletions

View File

@ -11,7 +11,7 @@
#include <QBluetoothDeviceInfo> #include <QBluetoothDeviceInfo>
#include <QMessageBox> #include <QMessageBox>
xToolsBluetoothDeviceInfoComboBox::xToolsBluetoothDeviceInfoComboBox(QWidget* parent) xToolsBleDeviceInfoComboBox::xToolsBleDeviceInfoComboBox(QWidget* parent)
: xToolsComboBox(parent) : xToolsComboBox(parent)
, mScanner(Q_NULLPTR) , mScanner(Q_NULLPTR)
{ {
@ -28,14 +28,14 @@ xToolsBluetoothDeviceInfoComboBox::xToolsBluetoothDeviceInfoComboBox(QWidget* pa
#endif #endif
} }
xToolsBluetoothDeviceInfoComboBox::~xToolsBluetoothDeviceInfoComboBox() xToolsBleDeviceInfoComboBox::~xToolsBleDeviceInfoComboBox()
{ {
#if 0 #if 0
mScanner->stopDiscover(); mScanner->stopDiscover();
#endif #endif
} }
void xToolsBluetoothDeviceInfoComboBox::startDiscover() void xToolsBleDeviceInfoComboBox::startDiscover()
{ {
#if 0 #if 0
clear(); clear();
@ -43,14 +43,14 @@ void xToolsBluetoothDeviceInfoComboBox::startDiscover()
#endif #endif
} }
void xToolsBluetoothDeviceInfoComboBox::stopDiscover() void xToolsBleDeviceInfoComboBox::stopDiscover()
{ {
#if 0 #if 0
mScanner->stopDiscover(); mScanner->stopDiscover();
#endif #endif
} }
bool xToolsBluetoothDeviceInfoComboBox::isActive() bool xToolsBleDeviceInfoComboBox::isActive()
{ {
#if 0 #if 0
return mScanner->isActive(); return mScanner->isActive();
@ -58,19 +58,19 @@ bool xToolsBluetoothDeviceInfoComboBox::isActive()
return false; return false;
} }
void xToolsBluetoothDeviceInfoComboBox::setTimeoutInterval(int interval) void xToolsBleDeviceInfoComboBox::setTimeoutInterval(int interval)
{ {
#if 0 #if 0
mScanner->setTimeoutInterval(interval); mScanner->setTimeoutInterval(interval);
#endif #endif
} }
void xToolsBluetoothDeviceInfoComboBox::setNameFiltter(const QString& filtter) void xToolsBleDeviceInfoComboBox::setNameFiltter(const QString& filtter)
{ {
// mScanner->setNameFiltter(filtter); // mScanner->setNameFiltter(filtter);
} }
void xToolsBluetoothDeviceInfoComboBox::changeEvent(QEvent* event) void xToolsBleDeviceInfoComboBox::changeEvent(QEvent* event)
{ {
xToolsComboBox::changeEvent(event); xToolsComboBox::changeEvent(event);
if ((event->type() == QEvent::EnabledChange) && isEnabled()) { if ((event->type() == QEvent::EnabledChange) && isEnabled()) {
@ -78,7 +78,7 @@ void xToolsBluetoothDeviceInfoComboBox::changeEvent(QEvent* event)
} }
} }
void xToolsBluetoothDeviceInfoComboBox::onFinished() void xToolsBleDeviceInfoComboBox::onFinished()
{ {
// if (!isEnabled()) { // if (!isEnabled()) {
// return; // return;
@ -94,7 +94,7 @@ void xToolsBluetoothDeviceInfoComboBox::onFinished()
// emit finished(); // emit finished();
} }
void xToolsBluetoothDeviceInfoComboBox::onDeviceDiscovered(const QBluetoothDeviceInfo& info) void xToolsBleDeviceInfoComboBox::onDeviceDiscovered(const QBluetoothDeviceInfo& info)
{ {
if (!isEnabled()) { if (!isEnabled()) {
return; return;
@ -103,7 +103,7 @@ void xToolsBluetoothDeviceInfoComboBox::onDeviceDiscovered(const QBluetoothDevic
addItem(info.name(), QVariant::fromValue(info)); addItem(info.name(), QVariant::fromValue(info));
} }
void xToolsBluetoothDeviceInfoComboBox::onErrorOccurred(const QString& errStr) void xToolsBleDeviceInfoComboBox::onErrorOccurred(const QString& errStr)
{ {
QMessageBox::warning(this, tr("Error Occurred"), errStr); QMessageBox::warning(this, tr("Error Occurred"), errStr);
} }

View File

@ -13,12 +13,12 @@
#include "xToolsBleScanner.h" #include "xToolsBleScanner.h"
#include "xToolsComboBox.h" #include "xToolsComboBox.h"
class xToolsBluetoothDeviceInfoComboBox : public xToolsComboBox class xToolsBleDeviceInfoComboBox : public xToolsComboBox
{ {
Q_OBJECT Q_OBJECT
public: public:
xToolsBluetoothDeviceInfoComboBox(QWidget *parent = Q_NULLPTR); xToolsBleDeviceInfoComboBox(QWidget *parent = Q_NULLPTR);
~xToolsBluetoothDeviceInfoComboBox(); ~xToolsBleDeviceInfoComboBox();
void startDiscover(); void startDiscover();
void stopDiscover(); void stopDiscover();
bool isActive(); bool isActive();

View File

@ -56,11 +56,11 @@ xToolsBleCentralToolUi::xToolsBleCentralToolUi(QWidget* parent)
&QPushButton::clicked, &QPushButton::clicked,
this, this,
&xToolsBleCentralToolUi::onPushButtonReadClicked); &xToolsBleCentralToolUi::onPushButtonReadClicked);
connect(ui->comboBoxDevices, &xToolsBluetoothDeviceInfoComboBox::finished, this, [=]() { connect(ui->comboBoxDevices, &xToolsBleDeviceInfoComboBox::finished, this, [=]() {
ui->pushButtonScan->setText(tr("Scan")); ui->pushButtonScan->setText(tr("Scan"));
ui->pushButtonScan->setEnabled(true); ui->pushButtonScan->setEnabled(true);
}); });
connect(ui->comboBoxDevices, &xToolsBluetoothDeviceInfoComboBox::started, this, [=]() { connect(ui->comboBoxDevices, &xToolsBleDeviceInfoComboBox::started, this, [=]() {
ui->pushButtonScan->setText(tr("Stop")); ui->pushButtonScan->setText(tr("Stop"));
ui->pushButtonScan->setEnabled(true); ui->pushButtonScan->setEnabled(true);
}); });