mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
optimize ui details
Change-Id: I9ad3312423a757f44ea8cc04afceb86d522a172d
This commit is contained in:
parent
8754639364
commit
ea04ee5226
Notes:
Deepin Code Review
2016-08-09 06:57:38 +00:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Tue, 09 Aug 2016 06:57:38 +0000 Reviewed-on: https://cr.deepin.io/15030 Project: dde/dde-dock Branch: refs/heads/master
@ -117,10 +117,12 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
case Top:
|
||||
case Bottom:
|
||||
backgroundRect = itemRect.marginsRemoved(QMargins(2, 1, 2, 1));
|
||||
// backgroundRect = itemRect;//.marginsRemoved(QMargins(2, 0, 2, 0));
|
||||
// backgroundRect = itemRect.marginsRemoved(QMargins(0, 1, 0, 1));
|
||||
case Left:
|
||||
case Right:
|
||||
backgroundRect = itemRect.marginsRemoved(QMargins(1, 2, 1, 2));
|
||||
backgroundRect = itemRect.marginsRemoved(QMargins(1, 1, 1, 1));
|
||||
// backgroundRect = itemRect.marginsRemoved(QMargins(1, 0, 1, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@ MainPanel::MainPanel(QWidget *parent)
|
||||
"border:" xstr(PANEL_BORDER) "px solid rgba(162, 162, 162, .2);"
|
||||
"background-color:rgba(10, 10, 10, .6);"
|
||||
"}"
|
||||
"QWidget #MainPanel[displayMode='1'] {"
|
||||
"border:none;"
|
||||
"}"
|
||||
// Top
|
||||
"QWidget #MainPanel[displayMode='0'][position='0'] {"
|
||||
"border-bottom-left-radius:5px;"
|
||||
|
@ -19,29 +19,32 @@ DiskControlItem::DiskControlItem(const DiskInfo &info, QWidget *parent)
|
||||
QIcon::setThemeName("deepin");
|
||||
|
||||
m_diskName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
m_diskName->setStyleSheet("color:white;");
|
||||
m_diskName->setStyleSheet("color:white;"
|
||||
"font-size:12px;");
|
||||
|
||||
m_diskCapacity->setStyleSheet("color:white;");
|
||||
m_diskCapacity->setStyleSheet("color:rgba(255, 255, 255, .6);"
|
||||
"font-size:10px;");
|
||||
|
||||
m_capacityValueBar->setTextVisible(false);
|
||||
m_capacityValueBar->setFixedHeight(3);
|
||||
m_capacityValueBar->setFixedHeight(2);
|
||||
m_capacityValueBar->setStyleSheet("QProgressBar {"
|
||||
"border:none;"
|
||||
"background-color:rgba(255, 255, 255, .3);"
|
||||
"background-color:rgba(255, 255, 255, .1);"
|
||||
"}"
|
||||
"QProgressBar::chunk {"
|
||||
"background-color:white;"
|
||||
"background-color:rgba(255, 255, 255, .8);"
|
||||
"}");
|
||||
|
||||
m_unmountButton->setNormalPic(":/icons/resources/unmount-normal.png");
|
||||
m_unmountButton->setHoverPic(":/icons/resources/unmount-hover.png");
|
||||
m_unmountButton->setPressPic(":/icons/resources/unmount-press.png");
|
||||
m_unmountButton->setStyleSheet("margin-top:12px;");
|
||||
|
||||
QVBoxLayout *infoLayout = new QVBoxLayout;
|
||||
infoLayout->addWidget(m_diskName);
|
||||
infoLayout->addWidget(m_diskCapacity);
|
||||
infoLayout->setSpacing(0);
|
||||
infoLayout->setContentsMargins(3, 4, 0, 8);
|
||||
infoLayout->setContentsMargins(3, 6, 0, 8);
|
||||
|
||||
QHBoxLayout *unmountLayout = new QHBoxLayout;
|
||||
unmountLayout->addLayout(infoLayout);
|
||||
@ -72,7 +75,7 @@ void DiskControlItem::updateInfo(const DiskInfo &info)
|
||||
{
|
||||
m_info = info;
|
||||
|
||||
m_diskIcon->setPixmap(QIcon::fromTheme(info.m_icon, m_unknowIcon).pixmap(32, 32));
|
||||
m_diskIcon->setPixmap(QIcon::fromTheme(info.m_icon, m_unknowIcon).pixmap(48, 48));
|
||||
if (!info.m_name.isEmpty())
|
||||
m_diskName->setText(info.m_name);
|
||||
else
|
||||
|
@ -34,7 +34,7 @@ void DiskPluginItem::resizeEvent(QResizeEvent *e)
|
||||
|
||||
QSize DiskPluginItem::sizeHint() const
|
||||
{
|
||||
return QSize(20, 20);
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void DiskPluginItem::updateIcon()
|
||||
|
@ -23,6 +23,7 @@ DeviceControlWidget::DeviceControlWidget(QWidget *parent)
|
||||
|
||||
m_seperator = new HorizontalSeperator;
|
||||
m_seperator->setFixedHeight(1);
|
||||
m_seperator->setColor(0.1);
|
||||
|
||||
QVBoxLayout *centeralLayout = new QVBoxLayout;
|
||||
centeralLayout->addStretch();
|
||||
|
@ -3,15 +3,21 @@
|
||||
#include <QPainter>
|
||||
|
||||
HorizontalSeperator::HorizontalSeperator(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
: QWidget(parent),
|
||||
m_color(255, 255, 255, 255 * 0.1)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
void HorizontalSeperator::setColor(const QColor color)
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
void HorizontalSeperator::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), QColor(255, 255, 255, 255 * 0.1));
|
||||
painter.fillRect(rect(), m_color);
|
||||
}
|
||||
|
@ -10,8 +10,13 @@ class HorizontalSeperator : public QWidget
|
||||
public:
|
||||
explicit HorizontalSeperator(QWidget *parent = 0);
|
||||
|
||||
void setColor(const QColor color);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
private:
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
#endif // HORIZONTALSEPERATOR_H
|
||||
|
@ -11,7 +11,7 @@ DeviceItem::DeviceItem(const QUuid &deviceUuid)
|
||||
|
||||
QSize DeviceItem::sizeHint() const
|
||||
{
|
||||
return QSize(20, 20);
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
const QUuid DeviceItem::uuid() const
|
||||
|
@ -32,7 +32,7 @@ void WirelessItem::paintEvent(QPaintEvent *e)
|
||||
|
||||
const Dock::DisplayMode displayMode = qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
|
||||
|
||||
const int iconSize = std::min(width(), height()) * 0.8;
|
||||
const int iconSize = displayMode == Dock::Fashion ? std::min(width(), height()) * 0.8 : 16;
|
||||
const QPixmap pixmap = iconPix(displayMode, iconSize);
|
||||
|
||||
QPainter painter(this);
|
||||
|
@ -15,7 +15,7 @@ PluginWidget::PluginWidget(QWidget *parent)
|
||||
|
||||
QSize PluginWidget::sizeHint() const
|
||||
{
|
||||
return QSize(20, 20);
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void PluginWidget::paintEvent(QPaintEvent *e)
|
||||
@ -29,7 +29,7 @@ void PluginWidget::paintEvent(QPaintEvent *e)
|
||||
|
||||
if (displayMode == Dock::Efficient)
|
||||
{
|
||||
pixmap = loadSvg(":/icons/resources/icons/normal.svg", QSize(18, 18));
|
||||
pixmap = loadSvg(":/icons/resources/icons/normal.svg", QSize(16, 16));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ PowerStatusWidget::PowerStatusWidget(QWidget *parent)
|
||||
|
||||
QSize PowerStatusWidget::sizeHint() const
|
||||
{
|
||||
return QSize(20, 20);
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void PowerStatusWidget::paintEvent(QPaintEvent *e)
|
||||
|
@ -14,5 +14,5 @@ void HorizontalSeparator::paintEvent(QPaintEvent *e)
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), QColor(255, 255, 255, 255 * 0.5));
|
||||
painter.fillRect(rect(), QColor(255, 255, 255, 255 * 0.1));
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ SinkInputWidget::SinkInputWidget(const QString &inputPath, QWidget *parent)
|
||||
|
||||
QHBoxLayout *centeralLayout = new QHBoxLayout;
|
||||
centeralLayout->addWidget(m_volumeIcon);
|
||||
centeralLayout->addSpacing(10);
|
||||
centeralLayout->addWidget(m_volumeSlider);
|
||||
centeralLayout->setSpacing(2);
|
||||
centeralLayout->setMargin(0);
|
||||
|
@ -30,6 +30,7 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
|
||||
QHBoxLayout *deviceLineLayout = new QHBoxLayout;
|
||||
deviceLineLayout->addWidget(deviceLabel);
|
||||
// deviceLineLayout->addSpacing(12);
|
||||
deviceLineLayout->addWidget(new HorizontalSeparator);
|
||||
deviceLineLayout->setMargin(0);
|
||||
deviceLineLayout->setSpacing(10);
|
||||
@ -37,6 +38,7 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
QHBoxLayout *volumeCtrlLayout = new QHBoxLayout;
|
||||
volumeCtrlLayout->addSpacing(2);
|
||||
volumeCtrlLayout->addWidget(m_volumeBtn);
|
||||
volumeCtrlLayout->addSpacing(10);
|
||||
volumeCtrlLayout->addWidget(m_volumeSlider);
|
||||
volumeCtrlLayout->setSpacing(0);
|
||||
volumeCtrlLayout->setMargin(0);
|
||||
@ -59,8 +61,11 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
|
||||
m_centeralLayout = new QVBoxLayout;
|
||||
m_centeralLayout->addLayout(deviceLineLayout);
|
||||
m_centeralLayout->addSpacing(8);
|
||||
m_centeralLayout->addLayout(volumeCtrlLayout);
|
||||
m_centeralLayout->addSpacing(10);
|
||||
m_centeralLayout->addWidget(m_applicationTitle);
|
||||
m_centeralLayout->addSpacing(8);
|
||||
|
||||
m_centeralWidget->setLayout(m_centeralLayout);
|
||||
m_centeralWidget->setFixedWidth(WIDTH);
|
||||
@ -124,7 +129,7 @@ void SoundApplet::volumeSliderValueChanged()
|
||||
void SoundApplet::sinkInputsChanged()
|
||||
{
|
||||
QVBoxLayout *appLayout = m_centeralLayout;
|
||||
while (QLayoutItem *item = appLayout->takeAt(3))
|
||||
while (QLayoutItem *item = appLayout->takeAt(6))
|
||||
{
|
||||
delete item->widget();
|
||||
delete item;
|
||||
|
@ -24,7 +24,7 @@ QWidget *SoundItem::popupApplet()
|
||||
|
||||
QSize SoundItem::sizeHint() const
|
||||
{
|
||||
return QSize(20, 20);
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void SoundItem::resizeEvent(QResizeEvent *e)
|
||||
@ -75,7 +75,7 @@ void SoundItem::refershIcon()
|
||||
iconString = QString("audio-volume-%1-symbolic").arg(volumeString);
|
||||
}
|
||||
|
||||
const int iconSize = std::min(width(), height()) * 0.8;
|
||||
const int iconSize = displayMode == Dock::Fashion ? std::min(width(), height()) * 0.8 : 16;
|
||||
const QIcon icon = QIcon::fromTheme(iconString);
|
||||
m_iconPixmap = icon.pixmap(iconSize, iconSize);
|
||||
|
||||
|
@ -44,7 +44,7 @@ const QImage TrayWidget::trayImage() const
|
||||
|
||||
QSize TrayWidget::sizeHint() const
|
||||
{
|
||||
return QSize(20, 20);
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void TrayWidget::paintEvent(QPaintEvent *e)
|
||||
|
@ -29,7 +29,7 @@ QWidget *TrashWidget::popupApplet()
|
||||
|
||||
QSize TrashWidget::sizeHint() const
|
||||
{
|
||||
return QSize(20, 20);
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void TrashWidget::dragEnterEvent(QDragEnterEvent *e)
|
||||
@ -64,13 +64,15 @@ void TrashWidget::resizeEvent(QResizeEvent *e)
|
||||
|
||||
void TrashWidget::updateIcon()
|
||||
{
|
||||
const Dock::DisplayMode displayMode = qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
|
||||
|
||||
QString iconString = "user-trash";
|
||||
if (!m_popupApplet->empty())
|
||||
iconString.append("-full");
|
||||
if (qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>() == Dock::Efficient)
|
||||
if (displayMode == Dock::Efficient)
|
||||
iconString.append("-symbolic");
|
||||
|
||||
const int size = std::min(width(), height()) * 0.8;
|
||||
const int size = displayMode == Dock::Fashion ? std::min(width(), height()) * 0.8 : 16;
|
||||
QIcon icon = QIcon::fromTheme(iconString);
|
||||
m_icon = icon.pixmap(size, size);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user