diff --git a/plugins/netconnect/drownlabel.cpp b/plugins/component/DrownLabel/drownlabel.cpp similarity index 100% rename from plugins/netconnect/drownlabel.cpp rename to plugins/component/DrownLabel/drownlabel.cpp diff --git a/plugins/netconnect/drownlabel.h b/plugins/component/DrownLabel/drownlabel.h similarity index 100% rename from plugins/netconnect/drownlabel.h rename to plugins/component/DrownLabel/drownlabel.h diff --git a/plugins/component/drownlabel.pri b/plugins/component/drownlabel.pri new file mode 100644 index 00000000..185bbd36 --- /dev/null +++ b/plugins/component/drownlabel.pri @@ -0,0 +1,9 @@ +#LIBINTERFACE_NAME = $$qtLibraryTarget(drownlabel) + +SOURCES += \ + $$PWD/DrownLabel/drownlabel.cpp \ + +HEADERS += \ + $$PWD/DrownLabel/drownlabel.h \ + + diff --git a/plugins/netconnect/deviceframe.h b/plugins/netconnect/deviceframe.h index 4edfa131..a1226bb0 100644 --- a/plugins/netconnect/deviceframe.h +++ b/plugins/netconnect/deviceframe.h @@ -8,7 +8,7 @@ #include #include #include "../component/SwitchButton/switchbutton.h" -#include "drownlabel.h" +#include "../component/DrownLabel/drownlabel.h" class DeviceFrame : public QFrame { diff --git a/plugins/netconnect/netconnect.pro b/plugins/netconnect/netconnect.pro index 830854a0..77461449 100644 --- a/plugins/netconnect/netconnect.pro +++ b/plugins/netconnect/netconnect.pro @@ -4,6 +4,7 @@ CONFIG += plugin include(../component/switchbutton.pri) include(../component/infobutton.pri) +include(../component/drownlabel.pri) TARGET = $$qtLibraryTarget(netconnect) DESTDIR = ../.. @@ -29,7 +30,7 @@ PKGCONFIG += gsettings-qt \ SOURCES += \ addnetbtn.cpp \ deviceframe.cpp \ - drownlabel.cpp \ +# drownlabel.cpp \ itemframe.cpp \ lanitem.cpp \ netconnect.cpp @@ -37,7 +38,7 @@ SOURCES += \ HEADERS += \ addnetbtn.h \ deviceframe.h \ - drownlabel.h \ +# drownlabel.h \ itemframe.h \ lanitem.h \ netconnect.h diff --git a/plugins/wlanconnect/deviceframe.h b/plugins/wlanconnect/deviceframe.h index c4c48fbe..34085b86 100644 --- a/plugins/wlanconnect/deviceframe.h +++ b/plugins/wlanconnect/deviceframe.h @@ -6,7 +6,7 @@ #include #include #include -#include "drownlabel.h" +#include "../component/DrownLabel/drownlabel.h" class DeviceFrame : public QFrame { diff --git a/plugins/wlanconnect/drownlabel.cpp b/plugins/wlanconnect/drownlabel.cpp deleted file mode 100644 index dac4364d..00000000 --- a/plugins/wlanconnect/drownlabel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "drownlabel.h" -#include "deviceframe.h" - -#define ICONSIZE 12,12 -DrownLabel::DrownLabel(QString devName, QWidget * parent) : QLabel(parent) -{ - m_devName = devName; - setFixedSize(36,36); -// setFlat(true); - loadPixmap(isChecked); -} - -DrownLabel::~DrownLabel() -{ - -} -void DrownLabel::setDropDownStatus(bool status) -{ - isChecked = status; - loadPixmap(isChecked); -} - -void DrownLabel::loadPixmap(bool isChecked) -{ - if (isChecked) { - if (QIcon::fromTheme("ukui-up-symbolic").isNull()) { - qDebug() << "ukui-up-symbolic is missing"; - } - setPixmap(QIcon::fromTheme("ukui-up-symbolic").pixmap(ICONSIZE)); - } else { - if (QIcon::fromTheme("ukui-down-symbolic").isNull()) { - qDebug() << "ukui-down-symbolic is missing"; - } - setPixmap(QIcon::fromTheme("ukui-down-symbolic").pixmap(ICONSIZE)); - } -} - - -void DrownLabel::mouseReleaseEvent(QMouseEvent *event) -{ - emit labelClicked(); - QWidget::mouseReleaseEvent(event); -} diff --git a/plugins/wlanconnect/drownlabel.h b/plugins/wlanconnect/drownlabel.h deleted file mode 100644 index f47caa24..00000000 --- a/plugins/wlanconnect/drownlabel.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef DROWNLABEL_H -#define DROWNLABEL_H - -#include -#include -#include -#include -#include - -class DrownLabel : public QLabel -{ - Q_OBJECT -public: - explicit DrownLabel(QString devName, QWidget * parent = nullptr); - ~DrownLabel(); - void setDropDownStatus(bool status); - QString m_devName; - bool isChecked = true; - -private: - void loadPixmap(bool isChecked); - -protected: - virtual void mouseReleaseEvent(QMouseEvent * event); - -Q_SIGNALS: - void labelClicked(); -}; - -#endif // DROWNLABEL_H diff --git a/plugins/wlanconnect/wlanconnect.pro b/plugins/wlanconnect/wlanconnect.pro index e9ef921e..5fff685c 100644 --- a/plugins/wlanconnect/wlanconnect.pro +++ b/plugins/wlanconnect/wlanconnect.pro @@ -4,6 +4,7 @@ CONFIG += plugin include(../component/switchbutton.pri) include(../component/infobutton.pri) +include(../component/drownlabel.pri) TARGET = $$qtLibraryTarget(wlanconnect) DESTDIR = ../.. @@ -28,14 +29,14 @@ PKGCONFIG += gsettings-qt \ SOURCES += \ deviceframe.cpp \ - drownlabel.cpp \ +# drownlabel.cpp \ itemframe.cpp \ wlanconnect.cpp \ wlanitem.cpp HEADERS += \ deviceframe.h \ - drownlabel.h \ +# drownlabel.h \ itemframe.h \ wlanconnect.h \ wlanitem.h