Merge "use theme icon instead of resources"

This commit is contained in:
石博文 2016-08-19 00:48:05 +00:00 committed by Deepin Code Review
commit 7024805a0f
10 changed files with 95 additions and 8 deletions

View File

@ -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)

View File

@ -27,8 +27,6 @@ protected:
QSize sizeHint() const;
private:
QPixmap m_icon;
ContainerWidget *m_containerWidget;
};

View File

@ -4,7 +4,11 @@
<file>resources/indicator.png</file>
<file>resources/indicator_ver.png</file>
<file>resources/indicator_active_ver.png</file>
<file>resources/arrow_up_normal.png</file>
<file>resources/arrow_down_normal.png</file>
</qresource>
<qresource prefix="/icons">
<file>resources/arrow-up.svg</file>
<file>resources/arrow-right.svg</file>
<file>resources/arrow-left.svg</file>
<file>resources/arrow-down.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
<title>arrow-down</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="arrow-down">
<g id="Group" transform="translate(8.000000, 8.000000) rotate(-90.000000) translate(-8.000000, -8.000000) translate(0.000000, -0.000000)">
<g id="g34312" transform="translate(-0.000000, 0.000000)">
<rect id="rect34314" x="0" y="0" width="16" height="16"></rect>
</g>
<path d="M9.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L9.1659754,12.8712 C9.29656714,13.0027661 9.48922641,13.0512925 9.6665597,12.9972857 C9.84389299,12.9432788 9.97679846,12.7956017 10.0118864,12.6135778 C10.0469744,12.431554 9.97848657,12.2450551 9.8339354,12.129 L6.2460455,8.0001 L9.8339354,3.8712 C9.99600823,3.72944524 10.0491416,3.49985954 9.96582508,3.30131391 C9.88250853,3.10276828 9.68145209,2.97984935 9.4667554,2.9962 C9.35439248,3.00529746 9.24840007,3.05209509 9.1659754,3.129 Z" id="polyline34316" fill="#FFFFFF"></path>
<path d="M9.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L9.1659754,12.8712 C9.29656714,13.0027661 9.48922641,13.0512925 9.6665597,12.9972857 C9.84389299,12.9432788 9.97679846,12.7956017 10.0118864,12.6135778 C10.0469744,12.431554 9.97848657,12.2450551 9.8339354,12.129 L6.2460455,8.0001 L9.8339354,3.8712 C9.99600823,3.72944524 10.0491416,3.49985954 9.96582508,3.30131391 C9.88250853,3.10276828 9.68145209,2.97984935 9.4667554,2.9962 C9.35439248,3.00529746 9.24840007,3.05209509 9.1659754,3.129 Z" id="polyline34316-copy" fill="#FFFFFF"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
<title>arrow-left</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="arrow-left">
<g id="Group">
<g id="g34312">
<rect id="rect34314" x="0" y="0" width="16" height="16"></rect>
</g>
<path d="M10.4667554,2.9962 C10.3543925,3.00529746 10.2484001,3.05209509 10.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L10.1659754,12.8712 C10.2965671,13.0027661 10.4892264,13.0512925 10.6665597,12.9972857 C10.843893,12.9432788 10.9767985,12.7956017 11.0118864,12.6135778 C11.0469744,12.431554 10.9784866,12.2450551 10.8339354,12.129 L6.2460455,8.0001 L10.8339354,3.8712 C10.9960082,3.72944524 11.0491416,3.49985954 10.9658251,3.30131391 C10.8825085,3.10276828 10.6814521,2.97984935 10.4667554,2.9962 L10.4667554,2.9962 Z" id="polyline34316" fill="#FFFFFF"></path>
<path d="M10.4667554,2.9962 C10.3543925,3.00529746 10.2484001,3.05209509 10.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L10.1659754,12.8712 C10.2965671,13.0027661 10.4892264,13.0512925 10.6665597,12.9972857 C10.843893,12.9432788 10.9767985,12.7956017 11.0118864,12.6135778 C11.0469744,12.431554 10.9784866,12.2450551 10.8339354,12.129 L6.2460455,8.0001 L10.8339354,3.8712 C10.9960082,3.72944524 11.0491416,3.49985954 10.9658251,3.30131391 C10.8825085,3.10276828 10.6814521,2.97984935 10.4667554,2.9962 L10.4667554,2.9962 Z" id="polyline34316-copy" fill="#FFFFFF"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
<title>arrow-right</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="arrow-right">
<g id="Group" transform="translate(8.000000, 8.000000) scale(-1, -1) translate(-8.000000, -8.000000) ">
<g id="g34312">
<rect id="rect34314" x="0" y="0" width="16" height="16"></rect>
</g>
<path d="M10.4667554,2.9962 C10.3543925,3.00529746 10.2484001,3.05209509 10.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L10.1659754,12.8712 C10.2965671,13.0027661 10.4892264,13.0512925 10.6665597,12.9972857 C10.843893,12.9432788 10.9767985,12.7956017 11.0118864,12.6135778 C11.0469744,12.431554 10.9784866,12.2450551 10.8339354,12.129 L6.2460455,8.0001 L10.8339354,3.8712 C10.9960082,3.72944524 11.0491416,3.49985954 10.9658251,3.30131391 C10.8825085,3.10276828 10.6814521,2.97984935 10.4667554,2.9962 L10.4667554,2.9962 Z" id="polyline34316" fill="#FFFFFF"></path>
<path d="M10.4667554,2.9962 C10.3543925,3.00529746 10.2484001,3.05209509 10.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L10.1659754,12.8712 C10.2965671,13.0027661 10.4892264,13.0512925 10.6665597,12.9972857 C10.843893,12.9432788 10.9767985,12.7956017 11.0118864,12.6135778 C11.0469744,12.431554 10.9784866,12.2450551 10.8339354,12.129 L6.2460455,8.0001 L10.8339354,3.8712 C10.9960082,3.72944524 11.0491416,3.49985954 10.9658251,3.30131391 C10.8825085,3.10276828 10.6814521,2.97984935 10.4667554,2.9962 L10.4667554,2.9962 Z" id="polyline34316-copy" fill="#FFFFFF"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
<title>arrow-up</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="arrow-up">
<g id="Group" transform="translate(8.000000, 8.000000) scale(1, -1) rotate(-90.000000) translate(-8.000000, -8.000000) ">
<g id="g34312" transform="translate(-0.000000, 0.000000)">
<rect id="rect34314" x="0" y="0" width="16" height="16"></rect>
</g>
<path d="M9.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L9.1659754,12.8712 C9.29656714,13.0027661 9.48922641,13.0512925 9.6665597,12.9972857 C9.84389299,12.9432788 9.97679846,12.7956017 10.0118864,12.6135778 C10.0469744,12.431554 9.97848657,12.2450551 9.8339354,12.129 L6.2460455,8.0001 L9.8339354,3.8712 C9.99600823,3.72944524 10.0491416,3.49985954 9.96582508,3.30131391 C9.88250853,3.10276828 9.68145209,2.97984935 9.4667554,2.9962 C9.35439248,3.00529746 9.24840007,3.05209509 9.1659754,3.129 Z" id="polyline34316" fill="#FFFFFF"></path>
<path d="M9.1659754,3.129 L5.1659755,7.629 C5.06099923,7.7238107 5.00108933,7.85864653 5.00108933,8.0001 C5.00108933,8.14155347 5.06099923,8.2763893 5.1659755,8.3712 L9.1659754,12.8712 C9.29656714,13.0027661 9.48922641,13.0512925 9.6665597,12.9972857 C9.84389299,12.9432788 9.97679846,12.7956017 10.0118864,12.6135778 C10.0469744,12.431554 9.97848657,12.2450551 9.8339354,12.129 L6.2460455,8.0001 L9.8339354,3.8712 C9.99600823,3.72944524 10.0491416,3.49985954 9.96582508,3.30131391 C9.88250853,3.10276828 9.68145209,2.97984935 9.4667554,2.9962 C9.35439248,3.00529746 9.24840007,3.05209509 9.1659754,3.129 Z" id="polyline34316-copy" fill="#FFFFFF"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

View File

@ -4,11 +4,13 @@
#include <QPainter>
#include <QDebug>
#include <QMouseEvent>
#include <QIcon>
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();
}