mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-05-30 22:01:41 +00:00
chore: adjust dock ui
1. adjust dock window space to 10 2. make traymainwindow contentsMagins to fixed value 3. make trycontrolpanel background color alpha 4. remove space between fullscreen and dock 5. set border for quick panel items 6. adjust standitem icon and text space 7. adjust sliderContainer icon background color log: as title
This commit is contained in:
parent
48cced00a9
commit
e8e0f3c96f
@ -422,7 +422,7 @@ void MultiScreenWorker::onRequestUpdateRegionMonitor()
|
||||
}
|
||||
|
||||
// 触屏监控高度固定调整为最大任务栏高度100+任务栏与屏幕边缘间距
|
||||
const int monitHeight = 100 + WINDOWMARGIN;
|
||||
const int monitHeight = 100 + WINDOWMARGIN * qApp->devicePixelRatio();
|
||||
|
||||
// 任务栏触屏唤起区域
|
||||
m_touchRectList.clear();
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QObject>
|
||||
#include <QFlag>
|
||||
|
||||
#define WINDOWMARGIN ((m_displayMode == Dock::Efficient) ? 0 : 10)
|
||||
#define WINDOWMARGIN ((m_displayMode == Dock::Efficient) ? 0 : 5)
|
||||
#define ANIMATIONTIME 300
|
||||
#define FREE_POINT(p) if (p) {\
|
||||
delete p;\
|
||||
|
@ -1097,7 +1097,7 @@ int MainPanelControl::trayAreaSize(qreal ratio) const
|
||||
length += (m_position == Dock::Position::Top || m_position == Dock::Position::Bottom ? topWindow->width() * ratio : topWindow->height() * ratio);
|
||||
}
|
||||
|
||||
length += topWindow->dockSpace() * ratio;
|
||||
length += topWindow->dockSpace();
|
||||
}
|
||||
|
||||
return length;
|
||||
|
@ -431,9 +431,9 @@ QRect MainWindowBase::getDockGeometry(QScreen *screen, const Dock::Position &pos
|
||||
}
|
||||
int y = 0;
|
||||
if (pos == Dock::Position::Top)
|
||||
y = (screenRect.y() + static_cast<int>(margin / ratio));
|
||||
y = (screenRect.y() + static_cast<int>(margin));
|
||||
else
|
||||
y = (screenRect.y() + static_cast<int>(screenRect.height() / ratio - margin / ratio)) - dockSize;
|
||||
y = (screenRect.y() + static_cast<int>(screenRect.height() / ratio - margin)) - dockSize;
|
||||
rect.setX(x);
|
||||
rect.setY(y);
|
||||
rect.setWidth(width);
|
||||
@ -451,9 +451,9 @@ QRect MainWindowBase::getDockGeometry(QScreen *screen, const Dock::Position &pos
|
||||
}
|
||||
int x = 0;
|
||||
if (pos == Dock::Position::Left)
|
||||
x = screenRect.x() + static_cast<int>(margin / ratio);
|
||||
x = screenRect.x() + static_cast<int>(margin);
|
||||
else
|
||||
x = screenRect.x() + static_cast<int>(screenRect.width() /ratio - margin / ratio) - dockSize;
|
||||
x = screenRect.x() + static_cast<int>(screenRect.width() /ratio - margin) - dockSize;
|
||||
|
||||
int y = screenRect.y() + static_cast<int>(((screenRect.height() / ratio) - totalSize) / 2);
|
||||
// 计算y坐标
|
||||
|
@ -393,9 +393,8 @@ void TrayManagerWindow::resetChildWidgetSize()
|
||||
int dateTimeHeight = m_appPluginDatetimeWidget->height() - - m.top() - m.bottom() - trayHeight;
|
||||
m_dateTimeWidget->setFixedSize(dateTimeWidth, dateTimeHeight);
|
||||
m_systemPluginWidget->setFixedSize(m_systemPluginWidget->suitableSize());
|
||||
int contentSpace = qMin(MAXDIFF, qMax(((Utils::isDraging() ? height() : (int)m_windowFashionSize) - MINHIGHT), 0)) + MINSPACE;
|
||||
m_mainLayout->setContentsMargins(contentSpace, contentSpace, contentSpace, contentSpace);
|
||||
m_mainLayout->setSpacing(contentSpace);
|
||||
m_mainLayout->setContentsMargins(SINGLEROWSPACE, SINGLEROWSPACE, SINGLEROWSPACE, SINGLEROWSPACE);
|
||||
m_mainLayout->setSpacing(SINGLEROWSPACE);
|
||||
|
||||
// 调整插件和日期窗体的位置显示,这里没有用到布局,是因为在调整任务栏位置的时候,
|
||||
// 随着布局方向的改变,显示有很大的问题
|
||||
@ -537,8 +536,8 @@ void TrayManagerWindow::paintEvent(QPaintEvent *event)
|
||||
painter.save();
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setClipPath(path);
|
||||
painter.fillRect(rect().adjusted(1, 1, -1, -1), maskColor(102));
|
||||
painter.setPen(maskColor(110));
|
||||
painter.fillRect(rect().adjusted(1, 1, -1, -1), maskColor(255 * 0.1));
|
||||
painter.setPen(maskColor(255 * 0.15));
|
||||
painter.drawPath(path);
|
||||
painter.restore();
|
||||
|
||||
|
@ -816,7 +816,7 @@ void WindowManager::onRequestNotifyWindowManager()
|
||||
}
|
||||
|
||||
XcbMisc::instance()->set_strut_partial(static_cast<xcb_window_t>(mainWindow->winId()), orientation,
|
||||
static_cast<uint>(strut + WINDOWMARGIN * ratio), // 设置窗口与屏幕边缘距离,需要乘缩放
|
||||
static_cast<uint>(strut), // 设置窗口与屏幕边缘距离,需要乘缩放
|
||||
static_cast<uint>(strutStart), // 设置任务栏起点坐标(上下为x,左右为y)
|
||||
static_cast<uint>(strutEnd)); // 设置任务栏终点坐标(上下为x,左右为y)
|
||||
}
|
||||
|
@ -93,12 +93,22 @@ void QuickSettingItem::paintEvent(QPaintEvent *e)
|
||||
painter.setClipPath(path);
|
||||
// 绘制背景色
|
||||
QColor backColor(Qt::white);
|
||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::DarkType) {
|
||||
backColor = Qt::black;
|
||||
}
|
||||
backColor.setAlphaF(0.5);
|
||||
backColor.setAlphaF(0.1);
|
||||
|
||||
DPalette dpa = DPaletteHelper::instance()->palette(this);
|
||||
painter.fillRect(rect(), backColor);
|
||||
|
||||
QColor borderColor(Qt::black);
|
||||
borderColor.setAlphaF(0.2);
|
||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) {
|
||||
borderColor = QColor(Qt::white);
|
||||
borderColor.setAlphaF(0.15);
|
||||
}
|
||||
|
||||
painter.save();
|
||||
painter.setPen(borderColor);
|
||||
painter.drawRoundedRect(rect(), RADIUS, RADIUS);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
QColor QuickSettingItem::foregroundColor() const
|
||||
|
@ -100,6 +100,7 @@ QWidget *StandardQuickItem::iconWidget(QWidget *parent)
|
||||
layout->setAlignment(Qt::AlignVCenter);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
layout->addSpacing(6);
|
||||
QLabel *imageLabel = new QLabel(widget);
|
||||
imageLabel->setObjectName("imageLabel");
|
||||
imageLabel->setFixedHeight(ICONHEIGHT);
|
||||
@ -113,7 +114,7 @@ QWidget *StandardQuickItem::iconWidget(QWidget *parent)
|
||||
labelText->setFixedWidth(70);
|
||||
updatePluginName(labelText);
|
||||
layout->addWidget(imageLabel);
|
||||
layout->addSpacing(7);
|
||||
layout->addSpacing(4);
|
||||
layout->addWidget(labelText);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
: QWidget(parent)
|
||||
, m_iconSize(QSize(24, 24))
|
||||
, m_shadowSize(QSize())
|
||||
, m_isEnter(false)
|
||||
{}
|
||||
|
||||
void updateData(const QIcon &icon, const QSize &iconSize, const QSize &shadowSize)
|
||||
@ -40,6 +41,20 @@ public:
|
||||
update();
|
||||
}
|
||||
|
||||
void enterEvent(QEvent *event) override
|
||||
{
|
||||
m_isEnter = true;
|
||||
QWidget::enterEvent(event);
|
||||
update();
|
||||
}
|
||||
|
||||
void leaveEvent(QEvent *event) override
|
||||
{
|
||||
m_isEnter = false;
|
||||
QWidget::leaveEvent(event);
|
||||
update();
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
@ -47,6 +62,7 @@ private:
|
||||
QIcon m_icon;
|
||||
QSize m_iconSize;
|
||||
QSize m_shadowSize;
|
||||
bool m_isEnter;
|
||||
};
|
||||
|
||||
void SliderIconWidget::paintEvent(QPaintEvent *e)
|
||||
@ -60,8 +76,12 @@ void SliderIconWidget::paintEvent(QPaintEvent *e)
|
||||
// 绘制圆形背景
|
||||
painter.setPen(Qt::NoPen);
|
||||
// 获取阴影部分背景颜色
|
||||
DPalette dpa = DPaletteHelper::instance()->palette(this);
|
||||
painter.setBrush(dpa.brush(DPalette::ColorRole::Midlight));
|
||||
QColor backColor = (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType ? Qt::black : Qt::white);
|
||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType)
|
||||
backColor.setAlphaF(m_isEnter ? 0.2 : 0.1);
|
||||
else
|
||||
backColor.setAlphaF(m_isEnter ? 0.1 : 0.2);
|
||||
painter.setBrush(backColor);
|
||||
int x = (rect().width() - m_shadowSize.width() ) / 2;
|
||||
int y = (rect().height() - m_shadowSize.height() ) / 2;
|
||||
painter.drawEllipse(QRect(x, y, m_shadowSize.width(), m_shadowSize.height()));
|
||||
@ -270,23 +290,29 @@ void SliderProxyStyle::drawRoundSlider(QPainter *painter, QRect rectGroove, QRec
|
||||
QColor color = wigdet->isEnabled() ? (DGuiApplicationHelper::DarkType == DGuiApplicationHelper::instance()->themeType() ? Qt::white : Qt::black) : Qt::gray;
|
||||
// 此处中绘制圆形滑动条,需要绘制圆角,圆角大小为其高度的一半
|
||||
int radius = rectGroove.height() / 2;
|
||||
|
||||
|
||||
// 此处绘制滑条的全长
|
||||
QBrush allBrush(QColor(190,190,190));
|
||||
QColor allBrush = (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType ? Qt::black : Qt::white);
|
||||
allBrush.setAlphaF( 0.15);
|
||||
|
||||
QPainterPath allPathGroove;
|
||||
allPathGroove.addRoundedRect(rectGroove, radius, radius);
|
||||
painter->fillPath(allPathGroove, allBrush);
|
||||
|
||||
// 已经滑动过的区域
|
||||
QBrush brush(color);
|
||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::DarkType) {
|
||||
color.setAlphaF(0.6);
|
||||
}
|
||||
|
||||
QPainterPath pathGroove;
|
||||
int handleSize = qMin(rectHandle.width(), rectHandle.height());
|
||||
rectGroove.setWidth(rectHandle.x() + (rectHandle.width() - handleSize) / 2);
|
||||
pathGroove.addRoundedRect(rectGroove, radius, radius);
|
||||
painter->fillPath(pathGroove, brush);
|
||||
painter->fillPath(pathGroove, color);
|
||||
|
||||
// 绘制滑块,因为滑块是正圆形,而它本来的区域是一个长方形区域,因此,需要计算当前
|
||||
// 区域的正中心区域,将其作为一个正方形区域来绘制圆形滑块
|
||||
color.setAlphaF(1.0);
|
||||
int x = rectHandle.x() + (rectHandle.width() - handleSize) / 2;
|
||||
int y = rectHandle.y() + (rectHandle.height() - handleSize) / 2;
|
||||
rectHandle.setX(x);
|
||||
@ -296,5 +322,5 @@ void SliderProxyStyle::drawRoundSlider(QPainter *painter, QRect rectGroove, QRec
|
||||
|
||||
QPainterPath pathHandle;
|
||||
pathHandle.addEllipse(rectHandle);
|
||||
painter->fillPath(pathHandle, brush);
|
||||
painter->fillPath(pathHandle, color);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user