change disk mount plugin icon

Change-Id: Iaeb07332e2e0aa6d5e5a2da7a1c4acc491861355
This commit is contained in:
石博文 2016-07-20 14:18:22 +08:00 committed by Hualet Wang
parent fe005ca8d5
commit bc136137a0
32 changed files with 80 additions and 6 deletions

View File

@ -15,14 +15,16 @@ HEADERS += \
dbus/dbusdiskmount.h \
dbus/variant/diskinfo.h \
diskcontrolwidget.h \
diskpluginitem.h
diskpluginitem.h \
imageutil.h
SOURCES += \
diskmountplugin.cpp \
dbus/dbusdiskmount.cpp \
dbus/variant/diskinfo.cpp \
diskcontrolwidget.cpp \
diskpluginitem.cpp
diskpluginitem.cpp \
imageutil.cpp
target.path = $${PREFIX}/lib/dde-dock/plugins/
INSTALLS += target

View File

@ -1,4 +1,5 @@
#include "diskpluginitem.h"
#include "imageutil.h"
#include <QPainter>
#include <QDebug>
@ -39,9 +40,9 @@ QSize DiskPluginItem::sizeHint() const
void DiskPluginItem::updateIcon()
{
if (m_displayMode == Dock::Efficient)
m_icon = QPixmap(":/icons/resources/icon_small.png");
m_icon = ImageUtil::loadSvg(":/icons/resources/icon-small.svg", 16);
else
m_icon = QPixmap(":/icons/resources/icon.png");
m_icon = ImageUtil::loadSvg(":/icons/resources/icon.svg", std::min(width(), height()) * 0.8);
update();
}

View File

@ -0,0 +1,17 @@
#include "imageutil.h"
#include <QPainter>
const QPixmap ImageUtil::loadSvg(const QString &path, const int size)
{
QPixmap pixmap(size, size);
QSvgRenderer renderer(path);
pixmap.fill(Qt::transparent);
QPainter painter;
painter.begin(&pixmap);
renderer.render(&painter);
painter.end();
return pixmap;
}

View File

@ -0,0 +1,13 @@
#ifndef IMAGEUTIL_H
#define IMAGEUTIL_H
#include <QPixmap>
#include <QSvgRenderer>
class ImageUtil
{
public:
static const QPixmap loadSvg(const QString &path, const int size);
};
#endif // IMAGEUTIL_H

View File

@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/icons">
<file>resources/icon_small.png</file>
<file>resources/icon.png</file>
<file>resources/icon-small.svg</file>
<file>resources/icon.svg</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

View File

@ -0,0 +1,13 @@
<?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 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
<title>drive_harddisk_usb_symbolic_active_16px</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="drive_harddisk_usb_symbolic_active_16px">
<rect id="Rectangle-1" x="0" y="0" width="16" height="16"></rect>
<path d="M4.65225822,10.640635 C4.64809326,10.6446576 4.01426838,11.2786248 4.01426838,11.2786248 C3.71579984,11.1016038 3.36739161,11 2.99533109,11 C1.88961947,11 0.995808339,11.8946651 0.995808339,13.0009554 C0.995808339,14.1057285 1.89001311,15 2.99533109,15 C4.09938509,15 4.99580834,14.1050847 4.99580834,13.0009554 C4.99580834,12.6307652 4.89536061,12.2841544 4.72027406,11.9868327 L5.15337486,11.5537319 L8.87873219,12.4850713 C9.0491197,12.5276681 9.22936322,12.4777436 9.35355339,12.3535534 L11.1436317,10.563475 L11.6482656,11.0681089 C11.8449165,11.2647598 12.1626667,11.2658436 12.3604014,11.0681089 L14.061411,9.36709926 C14.2580619,9.17044838 14.2591457,8.85269813 14.061411,8.65496342 L12.3604014,6.95395382 C12.1637505,6.75730293 11.8460003,6.75621911 11.6482656,6.95395382 L9.94725597,8.65496342 C9.75060509,8.8516143 9.74952126,9.16936455 9.94725597,9.36709926 L10.436525,9.85636826 L8.86015634,11.4496509 L5.97799599,10.7291108 L6.34531786,10.3617889 C6.35087195,10.3564862 12,4.70710678 12,4.70710678 L13.1464466,5.85355339 C13.4377906,6.14489741 13.9367059,5.9785923 13.9949747,5.57071068 L14.4949747,2.07071068 C14.5421152,1.74072751 14.2592725,1.4578848 13.9292893,1.50502525 L10.4292893,2.00502525 C10.0214077,2.06329406 9.85510259,2.56220937 10.1464466,2.85355339 L11.2928932,4 L6.16865662,9.1242366 C6.16865662,9.1242366 5.01461645,6.69249033 5.09514798,6.6119588 C5.3907725,6.31633428 5.98202154,5.72508524 5.98202154,5.72508524 C6.27906451,5.89981527 6.62537235,6 6.99533109,6 C8.09938509,6 8.99580834,5.10508467 8.99580834,4.00095541 C8.99580834,2.89530981 8.09977906,2 6.99533109,2 C5.88961947,2 4.99580834,2.89466509 4.99580834,4.00095541 C4.99580834,4.37289182 5.09715939,4.72096955 5.27379599,5.01909722 L4.14644661,6.14644661 C4.00187701,6.29101621 3.95988978,6.50903834 4.04042748,6.69695965 L5.40707931,9.88581391 L4.65225822,10.640635 Z" id="Combined-Shape" fill="#FFFFFF"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
<title>磁盘挂载-48px</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M21,42 C32.5979797,42 42,32.5979797 42,21 C42,9.40202025 32.5979797,0 21,0 C9.40202025,0 0,9.40202025 0,21 C0,32.5979797 9.40202025,42 21,42 Z" id="path-1"></path>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-2">
<feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="磁盘挂载-48px">
<rect id="Rectangle-33" opacity="0.623717351" x="0" y="0" width="48" height="48"></rect>
<g id="Group-18" transform="translate(3.000000, 3.000000)">
<g id="Oval-31">
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
<use fill="#FF6932" fill-rule="evenodd" xlink:href="#path-1"></use>
</g>
<path d="M27.2564016,0.947743843 C25.2802948,0.331841898 23.1789003,0 21,0 C9.40202025,0 0,9.40202025 0,21 C0,25.6657423 1.52159116,29.9760978 4.09562199,33.4619153 L27.2564016,0.947743843 L27.2564016,0.947743843 Z" id="Combined-Shape" fill="#FFF357" opacity="0.29973181"></path>
<path d="M14.7998047,0.947743843 C16.7759115,0.331841898 18.877306,0 21.0562063,0 C32.6541861,0 42.0562063,9.40202025 42.0562063,21 C42.0562063,25.6657423 40.5346152,29.9760978 37.9605843,33.4619153 L14.7998047,0.947743843 L14.7998047,0.947743843 Z" id="Combined-Shape" fill="#FFF357" opacity="0.29973181"></path>
<path d="M21.0534566,9.80754157 L29.6091717,21.5854251 C30.5822675,22.9249986 30.0336876,24.0109375 28.3719359,24.0109375 L13.7444081,24.0109374 C12.0880058,24.0109374 11.5369797,22.9200048 12.5055618,21.5854251 L21.0534566,9.80754157 Z M11,28 C11,27.4477153 11.4553056,27 11.9918031,27 L30.0081969,27 C30.5559546,27 31,27.4438648 31,28 C31,28.5522847 30.5446944,29 30.0081969,29 L11.9918031,29 C11.4440454,29 11,28.5561352 11,28 Z" id="Combined-Shape" fill="#FFFFFF"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B