fix: 修复蓝牙插件状态不准确的问题

蓝牙图标和tips显示不准确是由于少判断了一个状态导致,蓝牙图标应该根据当前是否有蓝牙连接来显示。当有蓝牙连接时tips显示已连接的设备,有设备正在连接时显示"正在连接...",没有蓝牙设备连接时显示“蓝牙”。

Log: 蓝牙断开连接正在断开时,任务栏蓝牙图标是蓝色且提示空白
Bug: https://pms.uniontech.com/zentao/bug-view-61146.html
Change-Id: I99b95a75f8499e746510de747e34003c1e2404e9
This commit is contained in:
chenwei 2021-01-21 09:52:33 +08:00
parent 02a1129b0b
commit 36a5f51a0e

View File

@ -133,16 +133,10 @@ void BluetoothItem::refreshIcon()
QString iconString;
if (m_adapterPowered) {
switch (m_devState) {
case Device::StateConnected:
stateString = "active";
break;
case Device::StateAvailable: {
return ;
}
case Device::StateUnavailable: {
stateString = "disable";
} break;
if (m_applet->connectedDevicesName().isEmpty()) {
stateString = "disable";
} else {
stateString = "active";
}
} else {
stateString = "disable";
@ -165,8 +159,7 @@ void BluetoothItem::refreshTips()
QString tipsText;
if (m_adapterPowered) {
switch (m_devState) {
case Device::StateConnected: {
if (!m_applet->connectedDevicesName().isEmpty() && m_devState != Device::StateAvailable) {
QStringList textList;
for (QString devName : m_applet->connectedDevicesName()) {
textList << tr("%1 connected").arg(devName);
@ -174,15 +167,11 @@ void BluetoothItem::refreshTips()
m_tipsLabel->setTextList(textList);
return;
}
case Device::StateAvailable: {
if (m_devState == Device::StateAvailable) {
tipsText = tr("Connecting...");
}
break ;
case Device::StateUnavailable: {
} else {
tipsText = tr("Bluetooth");
}
break;
}
} else {
tipsText = tr("Turned off");
}