Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)

if (NOT DEFINED VERSION)
set(VERSION 6.0.34)
set(VERSION 6.0.35)
endif()

project(dde-dock)
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
dde-dock (6.0.35) unstable; urgency=medium

* feat: adjust dock ui

-- tsic404 <liuheng@deepin.org> Thu, 01 Feb 2024 10:58:27 +0800

dde-dock (6.0.34) unstable; urgency=medium

* fix: dock animation broken (https://github.com/linuxdeepin/developer-center/issues/7143)
Expand Down
2 changes: 1 addition & 1 deletion frame/util/multiscreenworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void MultiScreenWorker::onRequestUpdateRegionMonitor()
}

// 触屏监控高度固定调整为最大任务栏高度100+任务栏与屏幕边缘间距
const int monitHeight = 100 + WINDOWMARGIN;
const int monitHeight = 100 + WINDOWMARGIN * qApp->devicePixelRatio();

// 任务栏触屏唤起区域
m_touchRectList.clear();
Expand Down
2 changes: 1 addition & 1 deletion frame/util/multiscreenworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;\
Expand Down
2 changes: 1 addition & 1 deletion frame/window/mainpanelcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions frame/window/mainwindowbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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坐标
Expand Down
9 changes: 4 additions & 5 deletions frame/window/traymanagerwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

// 调整插件和日期窗体的位置显示,这里没有用到布局,是因为在调整任务栏位置的时候,
// 随着布局方向的改变,显示有很大的问题
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion frame/window/windowmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
18 changes: 14 additions & 4 deletions plugins/pluginmanager/quicksettingitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion plugins/pluginmanager/standardquickitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down
40 changes: 33 additions & 7 deletions widgets/slidercontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class SliderIconWidget : public QWidget
: QWidget(parent)
, m_iconSize(QSize(24, 24))
, m_shadowSize(QSize())
, m_isEnter(false)
{}

void updateData(const QIcon &icon, const QSize &iconSize, const QSize &shadowSize)
Expand All @@ -40,13 +41,28 @@ class SliderIconWidget : public QWidget
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;

private:
QIcon m_icon;
QSize m_iconSize;
QSize m_shadowSize;
bool m_isEnter;
};

void SliderIconWidget::paintEvent(QPaintEvent *e)
Expand All @@ -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()));
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}