From e9e506adcd0bc8d4146dbd32f7bee8fd2a3b3cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=8D=9A=E6=96=87?= Date: Tue, 16 Aug 2016 10:48:21 +0800 Subject: [PATCH] use theme icon instead of resources Change-Id: I9decb7816190557c4e98b4172605c184689e0fbb --- frame/item/containeritem.cpp | 13 +++++++++++-- frame/item/containeritem.h | 2 -- frame/item/resources.qrc | 8 ++++++-- frame/item/resources/arrow-down.svg | 18 ++++++++++++++++++ frame/item/resources/arrow-left.svg | 18 ++++++++++++++++++ frame/item/resources/arrow-right.svg | 18 ++++++++++++++++++ frame/item/resources/arrow-up.svg | 18 ++++++++++++++++++ frame/item/resources/arrow_down_normal.png | Bin 301 -> 0 bytes frame/item/resources/arrow_up_normal.png | Bin 283 -> 0 bytes plugins/disk-mount/diskpluginitem.cpp | 8 ++++++-- 10 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 frame/item/resources/arrow-down.svg create mode 100644 frame/item/resources/arrow-left.svg create mode 100644 frame/item/resources/arrow-right.svg create mode 100644 frame/item/resources/arrow-up.svg delete mode 100644 frame/item/resources/arrow_down_normal.png delete mode 100644 frame/item/resources/arrow_up_normal.png diff --git a/frame/item/containeritem.cpp b/frame/item/containeritem.cpp index 375bb83c5..7f4207926 100644 --- a/frame/item/containeritem.cpp +++ b/frame/item/containeritem.cpp @@ -4,7 +4,6 @@ ContainerItem::ContainerItem(QWidget *parent) : DockItem(parent), - m_icon(":/indicator/resources/arrow_up_normal.png"), m_containerWidget(new ContainerWidget(this)) { m_containerWidget->setVisible(false); @@ -53,8 +52,18 @@ void ContainerItem::paintEvent(QPaintEvent *e) if (DockDisplayMode == Dock::Fashion) return; + QPixmap icon; + switch (DockPosition) + { + case Top: icon = QPixmap(":/icons/resources/arrow-down.svg"); break; + case Left: icon = QPixmap(":/icons/resources/arrow-right.svg"); break; + case Bottom: icon = QPixmap(":/icons/resources/arrow-up.svg"); break; + case Right: icon = QPixmap(":/icons/resources/arrow-left.svg"); break; + default: Q_UNREACHABLE(); + } + QPainter painter(this); - painter.drawPixmap(rect().center() - m_icon.rect().center(), m_icon); + painter.drawPixmap(rect().center() - icon.rect().center(), icon); } void ContainerItem::mouseReleaseEvent(QMouseEvent *e) diff --git a/frame/item/containeritem.h b/frame/item/containeritem.h index 563a79053..ddeac1d0e 100644 --- a/frame/item/containeritem.h +++ b/frame/item/containeritem.h @@ -27,8 +27,6 @@ protected: QSize sizeHint() const; private: - QPixmap m_icon; - ContainerWidget *m_containerWidget; }; diff --git a/frame/item/resources.qrc b/frame/item/resources.qrc index dc87fc058..6e091cd01 100644 --- a/frame/item/resources.qrc +++ b/frame/item/resources.qrc @@ -4,7 +4,11 @@ resources/indicator.png resources/indicator_ver.png resources/indicator_active_ver.png - resources/arrow_up_normal.png - resources/arrow_down_normal.png + + + resources/arrow-up.svg + resources/arrow-right.svg + resources/arrow-left.svg + resources/arrow-down.svg diff --git a/frame/item/resources/arrow-down.svg b/frame/item/resources/arrow-down.svg new file mode 100644 index 000000000..03c33c877 --- /dev/null +++ b/frame/item/resources/arrow-down.svg @@ -0,0 +1,18 @@ + + + + arrow-down + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/frame/item/resources/arrow-left.svg b/frame/item/resources/arrow-left.svg new file mode 100644 index 000000000..398fbf4df --- /dev/null +++ b/frame/item/resources/arrow-left.svg @@ -0,0 +1,18 @@ + + + + arrow-left + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/frame/item/resources/arrow-right.svg b/frame/item/resources/arrow-right.svg new file mode 100644 index 000000000..25a187ff1 --- /dev/null +++ b/frame/item/resources/arrow-right.svg @@ -0,0 +1,18 @@ + + + + arrow-right + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/frame/item/resources/arrow-up.svg b/frame/item/resources/arrow-up.svg new file mode 100644 index 000000000..261b96e16 --- /dev/null +++ b/frame/item/resources/arrow-up.svg @@ -0,0 +1,18 @@ + + + + arrow-up + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/frame/item/resources/arrow_down_normal.png b/frame/item/resources/arrow_down_normal.png deleted file mode 100644 index 934c6f323179ecce0c452ea5a36aaaad0c32241d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP*AeO zHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkDP|+?=7srr_TSsWZ74jz zo6sP2fcZ#q!w#k+$J-sV7GzaA)QC;!Sg|6bAR{B=$87WbeFjEGO(JCprFzQAt`QLt z`#L%}&cC|4nxDBFVdQ&MBb@0KV90H~;_u diff --git a/frame/item/resources/arrow_up_normal.png b/frame/item/resources/arrow_up_normal.png deleted file mode 100644 index 41618ff5ab73f4e476aaa0b22f0ab824bca89cf8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP*AeO zHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkDP|*rc7srr_TSsWZ73{| zK5*hh1mmK{EUSW*i3gWk>gedmpE{Pw!EJXoD=SM#!LFnCv;dF(g6y`&= #include #include +#include DiskPluginItem::DiskPluginItem(QWidget *parent) : QWidget(parent), m_displayMode(Dock::Efficient) { + QIcon::setThemeName("deepin"); } void DiskPluginItem::setDockDisplayMode(const Dock::DisplayMode mode) @@ -53,9 +55,11 @@ QSize DiskPluginItem::sizeHint() const void DiskPluginItem::updateIcon() { if (m_displayMode == Dock::Efficient) - m_icon = ImageUtil::loadSvg(":/icons/resources/icon-small.svg", 16); +// m_icon = ImageUtil::loadSvg(":/icons/resources/icon-small.svg", 16); + m_icon = QIcon::fromTheme("drive-removable-dock-symbolic").pixmap(16, 16); else - m_icon = ImageUtil::loadSvg(":/icons/resources/icon.svg", std::min(width(), height()) * 0.8); +// m_icon = ImageUtil::loadSvg(":/icons/resources/icon.svg", std::min(width(), height()) * 0.8); + m_icon = QIcon::fromTheme("drive-removable-dock").pixmap(std::min(width(), height()) * 0.8, std::min(width(), height()) * 0.8); update(); }