mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix(bluetooth): 去掉正在连接状态图标
需求改动去掉插件正在连接状态图标 Log: 应需求改动去掉正在连接状态图标 Task: https://pms.uniontech.com/zentao/task-view-25677.html
This commit is contained in:
parent
5d362d1dc9
commit
212789567e
@ -43,12 +43,10 @@ BluetoothItem::BluetoothItem(QWidget *parent)
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_tipsLabel(new TipsWidget(this))
|
, m_tipsLabel(new TipsWidget(this))
|
||||||
, m_applet(new BluetoothApplet(this))
|
, m_applet(new BluetoothApplet(this))
|
||||||
, m_refreshIconTimer(new QTimer(this))
|
|
||||||
{
|
{
|
||||||
m_applet->setVisible(false);
|
m_applet->setVisible(false);
|
||||||
m_adapterPowered = m_applet->poweredInitState();
|
m_adapterPowered = m_applet->poweredInitState();
|
||||||
m_refreshIconTimer->setInterval(100);
|
|
||||||
connect(m_refreshIconTimer, &QTimer::timeout, this, &BluetoothItem::refreshIcon);
|
|
||||||
connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) {
|
connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) {
|
||||||
m_adapterPowered = powered;
|
m_adapterPowered = powered;
|
||||||
refreshIcon();
|
refreshIcon();
|
||||||
@ -134,17 +132,6 @@ void BluetoothItem::refreshIcon()
|
|||||||
stateString = "active";
|
stateString = "active";
|
||||||
break;
|
break;
|
||||||
case Device::StateAvailable: {
|
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 ;
|
return ;
|
||||||
}
|
}
|
||||||
case Device::StateUnavailable: {
|
case Device::StateUnavailable: {
|
||||||
@ -155,7 +142,6 @@ void BluetoothItem::refreshIcon()
|
|||||||
stateString = "disable";
|
stateString = "disable";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_refreshIconTimer->stop();
|
|
||||||
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
|
iconString = QString("bluetooth-%1-symbolic").arg(stateString);
|
||||||
|
|
||||||
const qreal ratio = devicePixelRatioF();
|
const qreal ratio = devicePixelRatioF();
|
||||||
@ -232,9 +218,5 @@ void BluetoothItem::paintEvent(QPaintEvent *event)
|
|||||||
const QRectF &rf = QRectF(rect());
|
const QRectF &rf = QRectF(rect());
|
||||||
const QRectF &rfp = QRectF(m_iconPixmap.rect());
|
const QRectF &rfp = QRectF(m_iconPixmap.rect());
|
||||||
painter.drawPixmap(rf.center() - rfp.center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ private:
|
|||||||
|
|
||||||
Device::State m_devState;
|
Device::State m_devState;
|
||||||
bool m_adapterPowered;
|
bool m_adapterPowered;
|
||||||
QTimer *m_refreshIconTimer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BLUETOOTHITEM_H
|
#endif // BLUETOOTHITEM_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user