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

语音助手中使用的类TipsWidget与任务栏项目中的同名类的实现不一样,导致符号冲突 解决方法是在任务栏的代码中加上命名空间, Log: 修复符号冲突导致的概率性崩溃问题 Bug: https://pms.uniontech.com/zentao/bug-view-35037.html
117 lines
2.6 KiB
C++
117 lines
2.6 KiB
C++
#ifndef NETWORKITEM_H
|
|
#define NETWORKITEM_H
|
|
|
|
#include <DGuiApplicationHelper>
|
|
#include <DSwitchButton>
|
|
#include <dloadingindicator.h>
|
|
|
|
#include <QScrollArea>
|
|
#include <QVBoxLayout>
|
|
#include <QLabel>
|
|
#include <QTimer>
|
|
|
|
DGUI_USE_NAMESPACE
|
|
DWIDGET_USE_NAMESPACE
|
|
|
|
class PluginState;
|
|
namespace Dock {
|
|
class TipsWidget;
|
|
}
|
|
class WiredItem;
|
|
class WirelessItem;
|
|
class HorizontalSeperator;
|
|
class NetworkItem : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
enum PluginState
|
|
{
|
|
Unknow = 0,
|
|
// A 无线 B 有线
|
|
Disabled,
|
|
Connected,
|
|
Disconnected,
|
|
Connecting,
|
|
// Failed,
|
|
ConnectNoInternet,
|
|
// Aenabled,
|
|
// Benabled,
|
|
Adisabled,
|
|
Bdisabled,
|
|
Aconnected,
|
|
Bconnected,
|
|
Adisconnected,
|
|
Bdisconnected,
|
|
Aconnecting,
|
|
Bconnecting,
|
|
AconnectNoInternet,
|
|
BconnectNoInternet,
|
|
// Afailed,
|
|
Bfailed,
|
|
Nocable
|
|
};
|
|
public:
|
|
explicit NetworkItem(QWidget *parent = nullptr);
|
|
|
|
QWidget *itemApplet();
|
|
QWidget *itemTips();
|
|
|
|
void updateDeviceItems(QMap<QString, WiredItem *> &wiredItems, QMap<QString, WirelessItem*> &wirelessItems);
|
|
|
|
const QString contextMenu() const;
|
|
void invokeMenuItem(const QString &menuId, const bool checked);
|
|
void refreshTips();
|
|
bool isShowControlCenter();
|
|
|
|
public slots:
|
|
void updateSelf();
|
|
void refreshIcon();
|
|
|
|
protected:
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
void paintEvent(QPaintEvent *e) override;
|
|
bool eventFilter(QObject *obj,QEvent *event) override;
|
|
|
|
private slots:
|
|
void wiredsEnable(bool enable);
|
|
void wirelessEnable(bool enable);
|
|
void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType);
|
|
|
|
private:
|
|
void getPluginState();
|
|
void updateMasterControlSwitch();
|
|
void updateView();
|
|
int getStrongestAp();
|
|
|
|
private:
|
|
Dock::TipsWidget *m_tipsWidget;
|
|
QScrollArea *m_applet;
|
|
|
|
QLabel *m_wiredTitle;
|
|
DSwitchButton *m_switchWiredBtn;
|
|
QVBoxLayout *m_wiredLayout;
|
|
QWidget *m_wiredControlPanel;
|
|
bool m_switchWiredBtnState;
|
|
|
|
QLabel *m_wirelessTitle;
|
|
DLoadingIndicator *m_loadingIndicator;
|
|
DSwitchButton *m_switchWirelessBtn;
|
|
QVBoxLayout *m_wirelessLayout;
|
|
QWidget *m_wirelessControlPanel;
|
|
bool m_switchWirelessBtnState;
|
|
|
|
bool m_switchWire;
|
|
|
|
QMap<QString, WiredItem *> m_wiredItems;
|
|
QMap<QString, WirelessItem *> m_wirelessItems;
|
|
QMap<QString, WirelessItem *> m_connectedWirelessDevice;
|
|
QMap<QString, WiredItem *> m_connectedWiredDevice;
|
|
|
|
QPixmap m_iconPixmap;
|
|
PluginState m_pluginState;
|
|
QTimer *m_timer;
|
|
QTimer *m_switchWireTimer;
|
|
};
|
|
|
|
#endif // NETWORKITEM_H
|