kylin-nm/plugins/netconnect/lanitem.h

69 lines
1.4 KiB
C
Raw Normal View History

2022-06-02 16:27:45 +08:00
#ifndef LANITEM_H
#define LANITEM_H
#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QLabel>
#include <QVariantMap>
#include <QTimer>
#include <QGSettings>
#include <QDebug>
#include <QImage>
#include <QPainter>
2022-10-19 10:04:47 +08:00
#include <QToolButton>
#include <QMenu>
#include <QEvent>
2022-06-02 16:27:45 +08:00
#include "fixlabel.h"
#include "infobutton.h"
class LanItem : public QPushButton
{
2022-10-19 10:04:47 +08:00
Q_OBJECT
2022-06-02 16:27:45 +08:00
public:
LanItem(bool isAcitve, QWidget *parent = nullptr);
~LanItem();
public:
QLabel * iconLabel = nullptr;
InfoButton * infoLabel = nullptr;
FixLabel * titileLabel = nullptr;
QLabel * statusLabel = nullptr;
2022-10-19 10:04:47 +08:00
QToolButton* m_moreButton = nullptr;
QMenu* m_moreMenu = nullptr;
QAction* m_connectAction = nullptr;
QAction* m_deleteAction = nullptr;
2022-06-02 16:27:45 +08:00
public:
void startLoading();
void stopLoading();
2022-10-19 10:04:47 +08:00
void setConnectActionText(bool isAcitve);
2022-06-02 16:27:45 +08:00
bool loading = false;
bool isAcitve = false;
QString uuid;
QString dbusPath;
protected:
void paintEvent(QPaintEvent *);
2022-10-19 10:04:47 +08:00
bool eventFilter(QObject *watched, QEvent *event);
2022-06-02 16:27:45 +08:00
private:
QTimer *waitTimer = nullptr;
QGSettings *themeGsettings = nullptr;
QList<QIcon> loadIcons;
2022-10-19 10:04:47 +08:00
int currentIconIndex=0;
2022-06-02 16:27:45 +08:00
private slots:
2022-10-19 10:04:47 +08:00
void updateIcon();
void onConnectTriggered();
void onDeletetTriggered();
Q_SIGNALS:
void connectActionTriggered();
void disconnectActionTriggered();
void deleteActionTriggered();
2022-06-02 16:27:45 +08:00
};
#endif // LANITEM_H