mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Merge branch 'zhaolong/uos_bug31390' into 'uos'
fix(bluetooth): 蓝牙状态指示异常 See merge request dde-v20/dde-dock!569
This commit is contained in:
commit
377c0df912
@ -77,7 +77,7 @@ AdapterItem::AdapterItem(AdaptersManager *adapterManager, Adapter *adapter, QWid
|
||||
auto device = const_cast<Device *>(constDevice);
|
||||
if (device) {
|
||||
if (device->state() == Device::StateAvailable) {
|
||||
m_initDeviceState = Device::StateConnected;
|
||||
m_initDeviceState = Device::StateAvailable;
|
||||
continue;
|
||||
}
|
||||
if (device->state() == Device::StateConnected) {
|
||||
@ -222,7 +222,13 @@ void AdapterItem::deviceChangeState(const Device::State state)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Device::StateAvailable:
|
||||
case Device::StateAvailable: {
|
||||
int index = m_sortUnConnect.indexOf(deviceItem);
|
||||
if (index < 0)
|
||||
m_sortConnected.removeOne(deviceItem);
|
||||
else
|
||||
m_sortUnConnect.removeOne(deviceItem);
|
||||
}
|
||||
break;
|
||||
case Device::StateConnected: {
|
||||
int index = m_sortConnected.indexOf(deviceItem);
|
||||
@ -236,8 +242,15 @@ void AdapterItem::deviceChangeState(const Device::State state)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_currentDeviceState = state;
|
||||
emit deviceStateChanged(state);
|
||||
|
||||
if (m_sortConnected.size() > 0)
|
||||
m_currentDeviceState = Device::StateConnected;
|
||||
else if (state == Device::StateAvailable)
|
||||
m_currentDeviceState = Device::StateAvailable;
|
||||
else
|
||||
m_currentDeviceState = Device::StateUnavailable;
|
||||
|
||||
emit deviceStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
QStringList connectedDevsName();
|
||||
|
||||
signals:
|
||||
void deviceStateChanged(const Device::State state);
|
||||
void deviceStateChanged();
|
||||
void powerChanged(bool powered);
|
||||
void sizeChange();
|
||||
|
||||
@ -81,6 +81,7 @@ private:
|
||||
Device::State m_currentDeviceState;
|
||||
QList<DeviceItem *> m_sortConnected;
|
||||
QList<DeviceItem *> m_sortUnConnect;
|
||||
QMap<DeviceItem *, Device::State> m_devicesState;
|
||||
};
|
||||
|
||||
#endif // ADAPTERITEM_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user