From f71146b1fa0f0839d1349326324c34fd2b55d92d Mon Sep 17 00:00:00 2001 From: wangxuwen Date: Thu, 7 Nov 2019 20:39:09 +0800 Subject: [PATCH] feat(dde-dock): for task 11525 --- frame/item/appitem.cpp | 21 ++++++++++++++---- frame/item/appitem.h | 3 +++ frame/item/item.qrc | 10 +++++---- frame/item/resources/indicator.png | Bin 136 -> 0 bytes frame/item/resources/indicator.svg | 3 +++ frame/item/resources/indicator_active.png | Bin 180 -> 0 bytes frame/item/resources/indicator_active.svg | 10 +++++++++ frame/item/resources/indicator_active_ver.png | Bin 188 -> 0 bytes frame/item/resources/indicator_active_ver.svg | 10 +++++++++ frame/item/resources/indicator_dark.svg | 10 +++++++++ frame/item/resources/indicator_dark_ver.svg | 10 +++++++++ frame/item/resources/indicator_ver.png | Bin 134 -> 0 bytes frame/item/resources/indicator_ver.svg | 3 +++ 13 files changed, 72 insertions(+), 8 deletions(-) delete mode 100644 frame/item/resources/indicator.png create mode 100644 frame/item/resources/indicator.svg delete mode 100644 frame/item/resources/indicator_active.png create mode 100644 frame/item/resources/indicator_active.svg delete mode 100644 frame/item/resources/indicator_active_ver.png create mode 100644 frame/item/resources/indicator_active_ver.svg create mode 100644 frame/item/resources/indicator_dark.svg create mode 100644 frame/item/resources/indicator_dark_ver.svg delete mode 100644 frame/item/resources/indicator_ver.png create mode 100644 frame/item/resources/indicator_ver.svg diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index c76501212..320f0ed93 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #define APP_DRAG_THRESHOLD 20 @@ -82,10 +83,6 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent) m_appIcon(QPixmap()), - m_horizontalIndicator(QPixmap(":/indicator/resources/indicator.png")), - m_verticalIndicator(QPixmap(":/indicator/resources/indicator_ver.png")), - m_activeHorizontalIndicator(QPixmap(":/indicator/resources/indicator_active.png")), - m_activeVerticalIndicator(QPixmap(":/indicator/resources/indicator_active_ver.png")), m_updateIconGeometryTimer(new QTimer(this)), m_retryObtainIconTimer(new QTimer(this)), @@ -129,6 +126,7 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent) connect(GSettingsByApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged); connect(GSettingsByDockApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged); + connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &AppItem::onThemeTypeChanged); } AppItem::~AppItem() @@ -240,6 +238,15 @@ void AppItem::paintEvent(QPaintEvent *e) QPoint p; QPixmap pixmap; QPixmap activePixmap; + if(DGuiApplicationHelper::DarkType == m_themeType){ + m_horizontalIndicator = QPixmap(":/indicator/resources/indicator_dark.svg"); + m_verticalIndicator = QPixmap(":/indicator/resources/indicator_dark_ver.svg"); + }else { + m_horizontalIndicator = QPixmap(":/indicator/resources/indicator.svg"); + m_verticalIndicator = QPixmap(":/indicator/resources/indicator_ver.svg"); + } + m_activeHorizontalIndicator = QPixmap(":/indicator/resources/indicator_active.svg"); + m_activeVerticalIndicator = QPixmap(":/indicator/resources/indicator_active_ver.svg"); switch (DockPosition) { case Top: pixmap = m_horizontalIndicator; @@ -699,3 +706,9 @@ bool AppItem::checkGSettingsControl() const return (setting->keys().contains("control") && setting->get("control").toBool()) || (GSettingsByApp()->keys().contains("control") && GSettingsByApp()->get("control").toBool()); } + +void AppItem::onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType) +{ + m_themeType = themeType; + update(); +} diff --git a/frame/item/appitem.h b/frame/item/appitem.h index 776d72eba..0e06a435a 100644 --- a/frame/item/appitem.h +++ b/frame/item/appitem.h @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -95,6 +96,7 @@ private slots: void checkAttentionEffect(); void onGSettingsChanged(const QString& key); bool checkGSettingsControl() const; + void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType); private: TipsWidget *m_appNameTips; @@ -125,6 +127,7 @@ private: QFutureWatcher *m_smallWatcher; QFutureWatcher *m_largeWatcher; + DGuiApplicationHelper::ColorType m_themeType; static QPoint MousePressPos; }; diff --git a/frame/item/item.qrc b/frame/item/item.qrc index 83e1b9ec5..4384a0de0 100644 --- a/frame/item/item.qrc +++ b/frame/item/item.qrc @@ -1,9 +1,11 @@ - resources/indicator_active.png - resources/indicator.png - resources/indicator_ver.png - resources/indicator_active_ver.png + resources/indicator_dark.svg + resources/indicator.svg + resources/indicator_ver.svg + resources/indicator_active_ver.svg + resources/indicator_dark_ver.svg + resources/indicator_active.svg resources/arrow-up.svg diff --git a/frame/item/resources/indicator.png b/frame/item/resources/indicator.png deleted file mode 100644 index 907ba6ed639eeb696b378bc2e92c90da2eef8241..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^B0$W + + diff --git a/frame/item/resources/indicator_active.png b/frame/item/resources/indicator_active.png deleted file mode 100644 index abc8dfb637ab48d17b521af9129318795cdee3c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 180 zcmeAS@N?(olHy`uVBq!ia0vp^B0$W&x{A8C%-raoJu3UX4P zCfi3iYH22WQ%mvv4FO#q2%Lks`_ diff --git a/frame/item/resources/indicator_active.svg b/frame/item/resources/indicator_active.svg new file mode 100644 index 000000000..e7f73e341 --- /dev/null +++ b/frame/item/resources/indicator_active.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/frame/item/resources/indicator_active_ver.png b/frame/item/resources/indicator_active_ver.png deleted file mode 100644 index 4fdfd4a66f95c46ccfd8586ec1e19dd666125606..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^Oh7Ec!3HFkTfSKYq*&4&eH|GXHuiJ>Nn{1`i#=T& zLpWr0dk+d8HsD}+-%#@;?ow)(XZ + + + + + + + + + diff --git a/frame/item/resources/indicator_dark.svg b/frame/item/resources/indicator_dark.svg new file mode 100644 index 000000000..33ecb66c6 --- /dev/null +++ b/frame/item/resources/indicator_dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/frame/item/resources/indicator_dark_ver.svg b/frame/item/resources/indicator_dark_ver.svg new file mode 100644 index 000000000..1da9d5a38 --- /dev/null +++ b/frame/item/resources/indicator_dark_ver.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/frame/item/resources/indicator_ver.png b/frame/item/resources/indicator_ver.png deleted file mode 100644 index d3a4f2d3bc81f90b044fe266fd1a871aee6ce0a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 134 zcmeAS@N?(olHy`uVBq!ia0vp^Oh7Ec!3HFkTfSKYq*&4&eH|GXHuiJ>Nn{1`Z9QEa zLpWrU|NQ^IpOsl)1B0P>-Ld*NSr(1EBpie87`!bI44ZMqe1=E|quF!rO(GH2T~ZsW g_Z=!}l;ALB*l>-n{eH3p2hbn}Pgg&ebxsLQ04HlGZvX%Q diff --git a/frame/item/resources/indicator_ver.svg b/frame/item/resources/indicator_ver.svg new file mode 100644 index 000000000..80a2bc9df --- /dev/null +++ b/frame/item/resources/indicator_ver.svg @@ -0,0 +1,3 @@ + + +