Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bluetooth): bluetooth #2

Open
wants to merge 1 commit into
base: dev-kirin-9A0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions plugins/devices/bluetooth/bluetoothmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ void BlueToothMain::InitMainbottomUI()
{
m_localDevice->startDiscovery();
}

}

}
Expand Down Expand Up @@ -404,19 +405,12 @@ void BlueToothMain::updateUIWhenAdapterChanged()
connect(m_localDevice.data(),&BluezQt::Adapter::discoveringChanged,this,[=](bool discover){
if(discover){
m_timer->start();
//discovering_timer->start();
//每次开启后清除适配器扫描列表
// if (0 == IntermittentScann_timer_count)
// {
// Discovery_device_address.clear();
// qDebug() << __FUNCTION__ << "Discovery_device_address "<< __LINE__;
// }
loadLabel->setVisible(true);
}
else
{
//if (0 == IntermittentScann_timer_count)
// clearUiShowDeviceList();
//delayStartDiscover_timer->start();
m_timer->stop();
loadLabel->setVisible(false);
}
});
qDebug() << Q_FUNC_INFO << __LINE__;
Expand All @@ -425,7 +419,8 @@ void BlueToothMain::updateUIWhenAdapterChanged()
loadLabel->setVisible(true);
if (!m_timer->isActive())
m_timer->start();
//discovering_timer->start();
//if (!discovering_timer->isActive())
// discovering_timer->start();
}

connect(m_localDevice.data(),&BluezQt::Adapter::uuidsChanged,this,[=](const QStringList &uuids){
Expand Down Expand Up @@ -740,6 +735,8 @@ BlueToothMain::~BlueToothMain()
settings = nullptr;
delete device_list;
device_list = nullptr;
clearAllDeviceItemUi();

}
void BlueToothMain::clearAllDeviceItemUi()
{
Expand Down Expand Up @@ -934,10 +931,13 @@ void BlueToothMain::receiveConnectsignal(QString device)

qDebug() <<__FUNCTION__ << " device name :" << device << __LINE__ ;

// if (m_localDevice->isDiscovering())
// {
// m_localDevice->stopDiscovery();
// }
if (m_localDevice->isDiscovering())
{
clearTimer();
m_localDevice->stopDiscovery();
if (!delayStartDiscover_timer->isActive())
delayStartDiscover_timer->start();
}

int ps_bluetooth = system("ps aux|grep ukui-bluetooth|grep -v \"grep\" ");
qDebug() <<__FUNCTION__ << ps_bluetooth << __LINE__ ;
Expand Down
12 changes: 12 additions & 0 deletions plugins/devices/bluetooth/bluetoothnamelabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ BluetoothNameLabel::BluetoothNameLabel(QWidget *parent, int x, int y):
if(QGSettings::isSchemaInstalled("org.ukui.style")){
settings = new QGSettings("org.ukui.style");
if(settings->get("style-name").toString() == "ukui-black" || settings->get("style-name").toString() == "ukui-dark")
{
style_flag = true;
icon_pencil->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
icon_pencil->setProperty("useIconHighlightEffect", 0x10);
}
else
style_flag = false;

Expand Down Expand Up @@ -138,7 +142,11 @@ void BluetoothNameLabel::enterEvent(QEvent *event)
// this->update();

if(style_flag)
{
this->setStyleSheet("QWidget#BluetoothNameLabel{background-color:black;border:none;border-radius:2px;}");
icon_pencil->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
icon_pencil->setProperty("useIconHighlightEffect", 0x10);
}
else
this->setStyleSheet("QWidget#BluetoothNameLabel{background-color:white;border:none;border-radius:2px;}");
}
Expand Down Expand Up @@ -187,7 +195,11 @@ void BluetoothNameLabel::settings_changed(const QString &key)
qDebug() << Q_FUNC_INFO <<key;
if(key == "styleName"){
if(settings->get("style-name").toString() == "ukui-black" || settings->get("style-name").toString() == "ukui-dark")
{
style_flag = true;
icon_pencil->setProperty("setIconHighlightEffectDefaultColor", QColor(Qt::white));
icon_pencil->setProperty("useIconHighlightEffect", 0x10);
}
else
style_flag = false;
}else if(key == "systemFontSize"){
Expand Down
2 changes: 1 addition & 1 deletion plugins/devices/bluetooth/bluetoothnamelabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <QHBoxLayout>
#include <QMessageBox>

#define DEVNAMELENGTH 20
#define DEVNAMELENGTH 30

class BluetoothNameLabel : public QWidget
{
Expand Down