mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00

原来的qSort排序没生效,未在添加设备的同时更新设备的时间。 设备是按照发现的先后顺序添加至qlist中的,不改变原来list中的设备顺序,直接按照顺序添加至布局中即可将后发现的设备显示在最上面。 删除原来根据蓝牙设备信号变化排序列表的相关代码。 Log: 修复蓝牙列表排序问题。 Bug: https://pms.uniontech.com/zentao/bug-view-58098.html Change-Id: I88adb0123731a080d81e7f17f574083470503338
89 lines
2.5 KiB
C++
89 lines
2.5 KiB
C++
/*
|
|
* Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd.
|
|
*
|
|
* Author: zhaolong <zhaolong@uniontech.com>
|
|
*
|
|
* Maintainer: zhaolong <zhaolong@uniontech.com>
|
|
*
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef ADAPTERITEM_H
|
|
#define ADAPTERITEM_H
|
|
|
|
#include "device.h"
|
|
|
|
#include <QScrollArea>
|
|
|
|
class QLabel;
|
|
class QVBoxLayout;
|
|
class HorizontalSeparator;
|
|
class Adapter;
|
|
class SwitchItem;
|
|
class DeviceItem;
|
|
class AdaptersManager;
|
|
class MenueItem;
|
|
class AdapterItem : public QScrollArea
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit AdapterItem(AdaptersManager *a, Adapter *adapter, QWidget *parent = nullptr);
|
|
int deviceCount();
|
|
void setPowered(bool powered);
|
|
bool isPowered();
|
|
inline Device::State initDeviceState() { return m_initDeviceState; }
|
|
inline Device::State currentDeviceState() { return m_currentDeviceState; }
|
|
QStringList connectedDevsName();
|
|
|
|
signals:
|
|
void deviceStateChanged();
|
|
void powerChanged(bool powered);
|
|
void sizeChange();
|
|
|
|
private slots:
|
|
void deviceItemPaired(const bool paired);
|
|
void removeDeviceItem(const Device *device);
|
|
void showAndConnect(bool change);
|
|
void addDeviceItem(const Device *constDevice);
|
|
void deviceChangeState(const Device::State state);
|
|
void moveDeviceItem(Device::State state, DeviceItem *item);
|
|
|
|
public slots:
|
|
void refresh();
|
|
|
|
private:
|
|
void createDeviceItem(Device *device);
|
|
void updateView();
|
|
void showDevices(bool powered);
|
|
|
|
private:
|
|
QWidget *m_centralWidget;
|
|
HorizontalSeparator *m_line;
|
|
QVBoxLayout *m_deviceLayout;
|
|
|
|
AdaptersManager *m_adaptersManager;
|
|
|
|
Adapter *m_adapter;
|
|
SwitchItem *m_switchItem;
|
|
QMap<QString, DeviceItem *> m_deviceItems;
|
|
Device::State m_initDeviceState;
|
|
Device::State m_currentDeviceState;
|
|
QList<DeviceItem *> m_sortConnected;
|
|
QList<DeviceItem *> m_sortUnConnect;
|
|
QMap<DeviceItem *, Device::State> m_devicesState;
|
|
};
|
|
|
|
#endif // ADAPTERITEM_H
|