mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
hide size on unknow device
Change-Id: Id3e309b018ab5e583f384336894986217292c44d
This commit is contained in:
parent
07747272ac
commit
783f798a25
Notes:
Deepin Code Review
2016-08-08 12:17:47 +00:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Mon, 08 Aug 2016 12:17:47 +0000 Reviewed-on: https://cr.deepin.io/14989 Project: dde/dde-dock Branch: refs/heads/master
@ -8,6 +8,8 @@ DWIDGET_USE_NAMESPACE
|
|||||||
DiskControlItem::DiskControlItem(const DiskInfo &info, QWidget *parent)
|
DiskControlItem::DiskControlItem(const DiskInfo &info, QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
|
|
||||||
|
m_unknowIcon(":/icons/resources/unknow.svg"),
|
||||||
|
|
||||||
m_diskIcon(new QLabel),
|
m_diskIcon(new QLabel),
|
||||||
m_diskName(new QLabel),
|
m_diskName(new QLabel),
|
||||||
m_diskCapacity(new QLabel),
|
m_diskCapacity(new QLabel),
|
||||||
@ -39,7 +41,7 @@ DiskControlItem::DiskControlItem(const DiskInfo &info, QWidget *parent)
|
|||||||
infoLayout->addWidget(m_diskName);
|
infoLayout->addWidget(m_diskName);
|
||||||
infoLayout->addWidget(m_diskCapacity);
|
infoLayout->addWidget(m_diskCapacity);
|
||||||
infoLayout->setSpacing(0);
|
infoLayout->setSpacing(0);
|
||||||
infoLayout->setMargin(0);
|
infoLayout->setContentsMargins(3, 7, 0, 7);
|
||||||
|
|
||||||
QHBoxLayout *unmountLayout = new QHBoxLayout;
|
QHBoxLayout *unmountLayout = new QHBoxLayout;
|
||||||
unmountLayout->addLayout(infoLayout);
|
unmountLayout->addLayout(infoLayout);
|
||||||
@ -51,7 +53,7 @@ DiskControlItem::DiskControlItem(const DiskInfo &info, QWidget *parent)
|
|||||||
progressLayout->addLayout(unmountLayout);
|
progressLayout->addLayout(unmountLayout);
|
||||||
progressLayout->addWidget(m_capacityValueBar);
|
progressLayout->addWidget(m_capacityValueBar);
|
||||||
progressLayout->setSpacing(0);
|
progressLayout->setSpacing(0);
|
||||||
progressLayout->setMargin(0);
|
progressLayout->setContentsMargins(10, 0, 0, 0);
|
||||||
|
|
||||||
QHBoxLayout *centeralLayout = new QHBoxLayout;
|
QHBoxLayout *centeralLayout = new QHBoxLayout;
|
||||||
centeralLayout->addWidget(m_diskIcon);
|
centeralLayout->addWidget(m_diskIcon);
|
||||||
@ -70,11 +72,17 @@ void DiskControlItem::updateInfo(const DiskInfo &info)
|
|||||||
{
|
{
|
||||||
m_info = info;
|
m_info = info;
|
||||||
|
|
||||||
m_diskIcon->setPixmap(QIcon::fromTheme(info.m_icon).pixmap(32, 32));
|
m_diskIcon->setPixmap(QIcon::fromTheme(info.m_icon, m_unknowIcon).pixmap(32, 32));
|
||||||
m_diskName->setText(info.m_name);
|
if (!info.m_name.isEmpty())
|
||||||
m_diskCapacity->setText(QString("%1/%2").arg(formatDiskSize(info.m_usedSize)).arg(formatDiskSize(info.m_totalSize)));
|
m_diskName->setText(info.m_name);
|
||||||
|
else
|
||||||
|
m_diskName->setText(tr("Unknown device"));
|
||||||
|
if (info.m_totalSize)
|
||||||
|
m_diskCapacity->setText(QString("%1/%2").arg(formatDiskSize(info.m_usedSize)).arg(formatDiskSize(info.m_totalSize)));
|
||||||
|
else
|
||||||
|
m_diskCapacity->clear();
|
||||||
m_capacityValueBar->setMinimum(0);
|
m_capacityValueBar->setMinimum(0);
|
||||||
m_capacityValueBar->setMaximum(info.m_totalSize);
|
m_capacityValueBar->setMaximum(std::max(1ull, info.m_totalSize));
|
||||||
m_capacityValueBar->setValue(info.m_usedSize);
|
m_capacityValueBar->setValue(info.m_usedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
class DiskControlItem : public QWidget
|
class DiskControlItem : public QWidget
|
||||||
{
|
{
|
||||||
@ -25,6 +26,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DiskInfo m_info;
|
DiskInfo m_info;
|
||||||
|
QIcon m_unknowIcon;
|
||||||
|
|
||||||
QLabel *m_diskIcon;
|
QLabel *m_diskIcon;
|
||||||
QLabel *m_diskName;
|
QLabel *m_diskName;
|
||||||
|
@ -5,5 +5,6 @@
|
|||||||
<file>resources/unmount-press.png</file>
|
<file>resources/unmount-press.png</file>
|
||||||
<file>resources/unmount-normal.png</file>
|
<file>resources/unmount-normal.png</file>
|
||||||
<file>resources/unmount-hover.png</file>
|
<file>resources/unmount-hover.png</file>
|
||||||
|
<file>resources/unknow.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
28
plugins/disk-mount/resources/unknow.svg
Normal file
28
plugins/disk-mount/resources/unknow.svg
Normal 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 |
Loading…
x
Reference in New Issue
Block a user