kylin-nm/plugins/netconnect/lanitem.h

89 lines
2.3 KiB
C
Raw Permalink Normal View History

2022-07-05 10:13:48 +08:00
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* 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
2023-04-21 10:03:57 +08:00
* the Free Software Foundation; either version 3 of the License, or
2022-07-05 10:13:48 +08:00
* (at your option) 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
2021-10-27 12:28:16 +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>
2021-12-01 11:07:21 +08:00
#include <QPainter>
2023-04-07 14:20:19 +08:00
#include <QToolButton>
#include <QMenu>
#include <QEvent>
2021-10-27 12:28:16 +08:00
#include "fixlabel.h"
//#include "infobutton.h"
#include "../component/AddBtn/grayinfobutton.h"
2021-10-27 12:28:16 +08:00
class LanItem : public QPushButton
{
2023-04-07 14:20:19 +08:00
Q_OBJECT
2021-10-27 12:28:16 +08:00
public:
LanItem(bool isAcitve, QWidget *parent = nullptr);
~LanItem();
public:
QLabel * iconLabel = nullptr;
GrayInfoButton * infoLabel = nullptr;
2021-10-27 12:28:16 +08:00
FixLabel * titileLabel = nullptr;
QLabel * statusLabel = nullptr;
2023-04-07 14:20:19 +08:00
QToolButton* m_moreButton = nullptr;
QMenu* m_moreMenu = nullptr;
QAction* m_connectAction = nullptr;
QAction* m_deleteAction = nullptr;
2022-01-17 14:29:24 +08:00
2021-10-27 12:28:16 +08:00
public:
void startLoading();
void stopLoading();
2023-04-07 14:20:19 +08:00
void setConnectActionText(bool isAcitve);
2021-10-27 12:28:16 +08:00
bool loading = false;
bool isAcitve = false;
QString uuid;
QString dbusPath;
2021-12-01 11:07:21 +08:00
protected:
void paintEvent(QPaintEvent *);
2023-04-07 14:20:19 +08:00
bool eventFilter(QObject *watched, QEvent *event);
2021-12-01 11:07:21 +08:00
2021-10-27 12:28:16 +08:00
private:
QTimer *waitTimer = nullptr;
QGSettings *themeGsettings = nullptr;
2022-01-17 14:29:24 +08:00
QList<QIcon> loadIcons;
2023-04-07 14:20:19 +08:00
int currentIconIndex=0;
2022-01-17 14:29:24 +08:00
private slots:
2023-04-07 14:20:19 +08:00
void updateIcon();
void onConnectTriggered();
void onDeletetTriggered();
Q_SIGNALS:
void connectActionTriggered();
void disconnectActionTriggered();
void deleteActionTriggered();
2021-10-27 12:28:16 +08:00
};
#endif // LANITEM_H