feat(dde-dock): for task 11525

This commit is contained in:
wangxuwen 2019-11-07 20:39:09 +08:00
parent b5bba30e16
commit f71146b1fa
13 changed files with 72 additions and 8 deletions

View File

@ -40,6 +40,7 @@
#include <QTimeLine>
#include <QX11Info>
#include <QGSettings>
#include <DGuiApplicationHelper>
#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();
}

View File

@ -32,6 +32,7 @@
#include <QGraphicsView>
#include <QGraphicsItem>
#include <QGraphicsItemAnimation>
#include <DGuiApplicationHelper>
#include <com_deepin_dde_daemon_dock_entry.h>
@ -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<QPixmap> *m_smallWatcher;
QFutureWatcher<QPixmap> *m_largeWatcher;
DGuiApplicationHelper::ColorType m_themeType;
static QPoint MousePressPos;
};

View File

@ -1,9 +1,11 @@
<RCC>
<qresource prefix="/indicator">
<file>resources/indicator_active.png</file>
<file>resources/indicator.png</file>
<file>resources/indicator_ver.png</file>
<file>resources/indicator_active_ver.png</file>
<file>resources/indicator_dark.svg</file>
<file>resources/indicator.svg</file>
<file>resources/indicator_ver.svg</file>
<file>resources/indicator_active_ver.svg</file>
<file>resources/indicator_dark_ver.svg</file>
<file>resources/indicator_active.svg</file>
</qresource>
<qresource prefix="/icons">
<file>resources/arrow-up.svg</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="2" viewBox="0 0 20 2">
<rect width="20" height="2" x="14" y="55" fill-opacity=".6" fill-rule="evenodd" transform="translate(-14 -55)"/>
</svg>

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

View File

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="2" viewBox="0 0 20 2">
<defs>
<linearGradient id="indicator_active-a" x1="93.733%" x2="0%" y1="50%" y2="50%">
<stop offset="0%" stop-color="#2CA7F8" stop-opacity=".5"/>
<stop offset="48.823%" stop-color="#48CBFD" stop-opacity=".896"/>
<stop offset="100%" stop-color="#2CA7F8" stop-opacity=".5"/>
</linearGradient>
</defs>
<rect width="20" height="2" x="92" y="55" fill="url(#indicator_active-a)" fill-rule="evenodd" transform="translate(-92 -55)"/>
</svg>

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

View File

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="20" viewBox="0 0 2 20">
<defs>
<linearGradient id="indicator_active-a" y1="93.733%" y2="0%" x1="50%" x2="50%">
<stop offset="0%" stop-color="#2CA7F8" stop-opacity=".5"/>
<stop offset="48.823%" stop-color="#48CBFD" stop-opacity=".896"/>
<stop offset="100%" stop-color="#2CA7F8" stop-opacity=".5"/>
</linearGradient>
</defs>
<rect width="2" height="20" y="92" x="55" fill="url(#indicator_active-a)" fill-rule="evenodd" transform="translate(-55 -92)"/>
</svg>

After

Width:  |  Height:  |  Size: 547 B

View File

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="2" viewBox="0 0 20 2">
<defs>
<linearGradient id="indicator_dark-a" x1="100%" x2="0%" y1="50%" y2="50%">
<stop offset="0%" stop-color="#FFF" stop-opacity=".2"/>
<stop offset="48.823%" stop-color="#FFF" stop-opacity=".6"/>
<stop offset="100%" stop-color="#FFF" stop-opacity=".2"/>
</linearGradient>
</defs>
<rect width="20" height="2" x="14" y="55" fill="url(#indicator_dark-a)" fill-rule="evenodd" transform="translate(-14 -55)"/>
</svg>

After

Width:  |  Height:  |  Size: 529 B

View File

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="20" viewBox="0 0 2 20">
<defs>
<linearGradient id="indicator_dark-a" y1="100%" y2="0%" x1="50%" x2="50%">
<stop offset="0%" stop-color="#FFF" stop-opacity=".2"/>
<stop offset="48.823%" stop-color="#FFF" stop-opacity=".6"/>
<stop offset="100%" stop-color="#FFF" stop-opacity=".2"/>
</linearGradient>
</defs>
<rect width="2" height="20" y="14" x="55" fill="url(#indicator_dark-a)" fill-rule="evenodd" transform="translate(-55 -14)"/>
</svg>

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="20" viewBox="0 0 2 20">
<rect width="2" height="20" x="55" y="14" fill-opacity=".6" fill-rule="evenodd" transform="translate(-55 -14)"/>
</svg>

After

Width:  |  Height:  |  Size: 204 B