From d17f27eb3a3298895a63eb89e7acb5e120c759bf Mon Sep 17 00:00:00 2001 From: JK-Lix <776579471@qq.com> Date: Wed, 4 Aug 2021 14:30:08 +0800 Subject: [PATCH] =?UTF-8?q?Fix:bug#67075=20=E8=93=9D=E7=89=99=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E4=B8=8A=E9=99=90=E4=BF=AE=E6=94=B9=E4=B8=BA30?= =?UTF-8?q?=E4=B8=AA=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/devices/bluetooth/bluetoothmain.cpp | 30 +++++++++---------- .../devices/bluetooth/bluetoothnamelabel.cpp | 12 ++++++++ .../devices/bluetooth/bluetoothnamelabel.h | 2 +- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/plugins/devices/bluetooth/bluetoothmain.cpp b/plugins/devices/bluetooth/bluetoothmain.cpp index cec47bdce..e7af37234 100644 --- a/plugins/devices/bluetooth/bluetoothmain.cpp +++ b/plugins/devices/bluetooth/bluetoothmain.cpp @@ -287,6 +287,7 @@ void BlueToothMain::InitMainbottomUI() { m_localDevice->startDiscovery(); } + } } @@ -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__; @@ -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){ @@ -740,6 +735,8 @@ BlueToothMain::~BlueToothMain() settings = nullptr; delete device_list; device_list = nullptr; + clearAllDeviceItemUi(); + } void BlueToothMain::clearAllDeviceItemUi() { @@ -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__ ; diff --git a/plugins/devices/bluetooth/bluetoothnamelabel.cpp b/plugins/devices/bluetooth/bluetoothnamelabel.cpp index 6d5129fcc..4f65da612 100644 --- a/plugins/devices/bluetooth/bluetoothnamelabel.cpp +++ b/plugins/devices/bluetooth/bluetoothnamelabel.cpp @@ -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; @@ -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;}"); } @@ -187,7 +195,11 @@ void BluetoothNameLabel::settings_changed(const QString &key) qDebug() << Q_FUNC_INFO <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"){ diff --git a/plugins/devices/bluetooth/bluetoothnamelabel.h b/plugins/devices/bluetooth/bluetoothnamelabel.h index 642b4b525..7bde6c215 100644 --- a/plugins/devices/bluetooth/bluetoothnamelabel.h +++ b/plugins/devices/bluetooth/bluetoothnamelabel.h @@ -15,7 +15,7 @@ #include #include -#define DEVNAMELENGTH 20 +#define DEVNAMELENGTH 30 class BluetoothNameLabel : public QWidget {