From 212789567e22217aa4f871369542b65df94da434 Mon Sep 17 00:00:00 2001 From: zhaolong Date: Fri, 12 Jun 2020 09:50:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(bluetooth):=20=E5=8E=BB=E6=8E=89=E6=AD=A3?= =?UTF-8?q?=E5=9C=A8=E8=BF=9E=E6=8E=A5=E7=8A=B6=E6=80=81=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 需求改动去掉插件正在连接状态图标 Log: 应需求改动去掉正在连接状态图标 Task: https://pms.uniontech.com/zentao/task-view-25677.html --- plugins/bluetooth/bluetoothitem.cpp | 20 +------------------- plugins/bluetooth/bluetoothitem.h | 1 - 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/plugins/bluetooth/bluetoothitem.cpp b/plugins/bluetooth/bluetoothitem.cpp index d37162041..740a04e3a 100644 --- a/plugins/bluetooth/bluetoothitem.cpp +++ b/plugins/bluetooth/bluetoothitem.cpp @@ -43,12 +43,10 @@ BluetoothItem::BluetoothItem(QWidget *parent) : QWidget(parent) , m_tipsLabel(new TipsWidget(this)) , m_applet(new BluetoothApplet(this)) - , m_refreshIconTimer(new QTimer(this)) { m_applet->setVisible(false); m_adapterPowered = m_applet->poweredInitState(); - m_refreshIconTimer->setInterval(100); - connect(m_refreshIconTimer, &QTimer::timeout, this, &BluetoothItem::refreshIcon); + connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) { m_adapterPowered = powered; refreshIcon(); @@ -134,17 +132,6 @@ void BluetoothItem::refreshIcon() stateString = "active"; break; case Device::StateAvailable: { - m_refreshIconTimer->start(); - stateString = "waiting"; - iconString = QString("bluetooth-%1-symbolic").arg(stateString); - const qreal ratio = devicePixelRatioF(); - int iconSize = PLUGIN_ICON_MAX_SIZE; - if (height() <= PLUGIN_BACKGROUND_MIN_SIZE && DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) - iconString.append(PLUGIN_MIN_ICON_NAME); - - m_iconPixmap = ImageUtil::loadSvg(iconString, ":/", iconSize, ratio); - - update(); return ; } case Device::StateUnavailable: { @@ -155,7 +142,6 @@ void BluetoothItem::refreshIcon() stateString = "disable"; } - m_refreshIconTimer->stop(); iconString = QString("bluetooth-%1-symbolic").arg(stateString); const qreal ratio = devicePixelRatioF(); @@ -232,9 +218,5 @@ void BluetoothItem::paintEvent(QPaintEvent *event) const QRectF &rf = QRectF(rect()); const QRectF &rfp = QRectF(m_iconPixmap.rect()); painter.drawPixmap(rf.center() - rfp.center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap); - if (m_devState == Device::StateAvailable) { - QTime time = QTime::currentTime(); - painter.rotate((time.second() + (time.msec() / 1000.0)) * 6.0); - } } diff --git a/plugins/bluetooth/bluetoothitem.h b/plugins/bluetooth/bluetoothitem.h index 1f5cc764c..349a8e85e 100644 --- a/plugins/bluetooth/bluetoothitem.h +++ b/plugins/bluetooth/bluetoothitem.h @@ -65,7 +65,6 @@ private: Device::State m_devState; bool m_adapterPowered; - QTimer *m_refreshIconTimer; }; #endif // BLUETOOTHITEM_H