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
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
dde-shell (0.0.25) unstable; urgency=medium

* fix: Application preview UI issue(https://github.com/linuxdeepin/developer-center/issues/8801)
* fix: dock panel border color issue(https://github.com/linuxdeepin/developer-center/issues/8342)
* fix: uos-ai icon error(https://github.com/linuxdeepin/developer-center/issues/9363)

-- Zhang kun <[email protected]> Mon, 24 Jun 2024 11:10:20 +0800

dde-shell (0.0.24) unstable; urgency=medium

* fix(taskmanager): radius of the indicators are not working (linuxdeepin/developer-center#8804)
Expand Down
24 changes: 15 additions & 9 deletions panels/dock/package/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ Window {
color: "transparent"
flags: Qt.WindowDoesNotAcceptFocus

function blendColorAlpha(fallback) {
var appearance = DS.applet("org.deepin.ds.dde-appearance")
if (!appearance || appearance.opacity < 0)
return fallback
return appearance.opacity
}

DLayerShellWindow.anchors: position2Anchors(Applet.position)
DLayerShellWindow.layer: DLayerShellWindow.LayerTop
DLayerShellWindow.exclusionZone: Applet.dockSize
Expand All @@ -50,6 +57,7 @@ Window {
D.DWindow.windowRadius: 0
D.DWindow.enableBlurWindow: true
D.DWindow.themeType: Panel.colorTheme
D.DWindow.borderColor: D.DTK.themeType === D.ApplicationHelper.DarkType ? Qt.rgba(0, 0, 0, dock.blendColorAlpha(0.6) + 10 / 255) : Qt.rgba(0, 0, 0, 0.15)
D.ColorSelector.family: D.Palette.CrystalColor

onDockSizeChanged: {
Expand All @@ -72,25 +80,23 @@ Window {
control: parent
anchors.fill: parent
cornerRadius: 0

function blendColorAlpha(fallback) {
var appearance = DS.applet("org.deepin.ds.dde-appearance")
if (!appearance || appearance.opacity < 0)
return fallback
return appearance.opacity
}
blendColor: {
if (valid) {
return DStyle.Style.control.selectColor(undefined,
Qt.rgba(235 / 255.0, 235 / 255.0, 235 / 255.0, blendColorAlpha(0.6)),
Qt.rgba(10 / 255, 10 / 255, 10 /255, blendColorAlpha(85 / 255)))
Qt.rgba(235 / 255.0, 235 / 255.0, 235 / 255.0, dock.blendColorAlpha(0.6)),
Qt.rgba(10 / 255, 10 / 255, 10 /255, dock.blendColorAlpha(85 / 255)))
}
return DStyle.Style.control.selectColor(undefined,
DStyle.Style.behindWindowBlur.lightNoBlurColor,
DStyle.Style.behindWindowBlur.darkNoBlurColor)
}
}

D.InsideBoxBorder {
anchors.fill: parent
color: D.DTK.themeType === D.ApplicationHelper.DarkType ? Qt.rgba(1, 1, 1, 0.15) : Qt.rgba(1, 1, 1, dock.blendColorAlpha(0.6) - 0.05)
}

PropertyAnimation {
id: hideShowAnimation;
target: dock;
Expand Down
97 changes: 64 additions & 33 deletions panels/dock/taskmanager/x11preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ Q_LOGGING_CATEGORY(x11WindowPreview, "dde.shell.dock.taskmanager.x11WindowPrevie

#define PREVIEW_TITLE_HEIGHT 20
#define PREVIEW_CONTENT_HEIGHT 118
#define PREVIEW_CONTENT_WIDTH 208
#define PREVIEW_CONTENT_MAX_WIDTH 240
#define PREVIEW_CONTENT_MIN_WIDTH 80
#define PREVIEW_CONTENT_MARGIN 10
#define PREVIEW_CONTAINER_MARGIN 10
#define PREVIEW_HOVER_BORDER 4
#define PREVIEW_MINI_WIDTH 140
#define PREVIEW_HOVER_BORDER_COLOR QColor(0, 0, 0, 255 * 0.2)
Expand Down Expand Up @@ -290,14 +293,14 @@ class AppItemWindowDeletegate : public QAbstractItemDelegate
} else {
auto rect = QRect((option.rect.left()),
(option.rect.top()),
PREVIEW_CONTENT_WIDTH + PREVIEW_HOVER_BORDER * 2,
PREVIEW_CONTENT_MAX_WIDTH + PREVIEW_HOVER_BORDER * 2,
PREVIEW_TITLE_HEIGHT + PREVIEW_HOVER_BORDER * 2)
.marginsAdded(QMargins(-PREVIEW_HOVER_BORDER, -PREVIEW_HOVER_BORDER, -PREVIEW_HOVER_BORDER, -PREVIEW_HOVER_BORDER));
auto text = QFontMetrics(m_parent->font()).elidedText(index.data(WindowTitleRole).toString(), Qt::TextElideMode::ElideRight, rect.width() - PREVIEW_TITLE_HEIGHT);
painter->drawText(rect, text);

if (option.state.testFlag(QStyle::State_MouseOver)) {
hoverRect.setSize(QSize(PREVIEW_CONTENT_WIDTH + PREVIEW_HOVER_BORDER * 2, PREVIEW_TITLE_HEIGHT + PREVIEW_HOVER_BORDER * 2));
hoverRect.setSize(QSize(PREVIEW_CONTENT_MAX_WIDTH + PREVIEW_HOVER_BORDER * 2, PREVIEW_TITLE_HEIGHT + PREVIEW_HOVER_BORDER * 2));
hoverRect = hoverRect.marginsAdded(QMargins(-2, -2, -2, -2));

painter->save();
Expand All @@ -318,11 +321,12 @@ class AppItemWindowDeletegate : public QAbstractItemDelegate
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
{
if (!WM_HELPER->hasComposite()) {
return QSize(PREVIEW_CONTENT_WIDTH + PREVIEW_HOVER_BORDER * 2, PREVIEW_TITLE_HEIGHT + PREVIEW_HOVER_BORDER * 2);
return QSize(PREVIEW_CONTENT_MAX_WIDTH + PREVIEW_HOVER_BORDER * 2, PREVIEW_TITLE_HEIGHT + PREVIEW_HOVER_BORDER * 2);
}

auto pixmap = index.data(WindowPreviewContentRole).value<QPixmap>();
return calSize(pixmap.size()) + QSize(PREVIEW_HOVER_BORDER * 2, PREVIEW_HOVER_BORDER * 2);
int width = qBound(PREVIEW_CONTENT_MIN_WIDTH, calSize(pixmap.size()).width(), PREVIEW_CONTENT_MAX_WIDTH);
return QSize(width, PREVIEW_CONTENT_HEIGHT) + QSize(PREVIEW_HOVER_BORDER * 2, PREVIEW_HOVER_BORDER * 2);
}

virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Expand Down Expand Up @@ -360,13 +364,15 @@ class AppItemWindowDeletegate : public QAbstractItemDelegate
private:
QSize calSize(const QSize &imageSize) const
{
qreal factor = qreal(PREVIEW_CONTENT_HEIGHT) / imageSize.height();
auto scaled = imageSize.scaled(imageSize * factor, Qt::KeepAspectRatio);
if (scaled.width() <= PREVIEW_CONTENT_WIDTH) {
return scaled;
qreal factor = 1.0f;
if (imageSize.height() > PREVIEW_CONTENT_HEIGHT) {
factor = qreal(PREVIEW_CONTENT_HEIGHT) / imageSize.height();
}
if (imageSize.width() * factor > PREVIEW_CONTENT_MAX_WIDTH) {
factor = qreal(PREVIEW_CONTENT_MAX_WIDTH) / imageSize.width();
}

return {PREVIEW_CONTENT_WIDTH, PREVIEW_CONTENT_HEIGHT};
return imageSize.scaled(imageSize * factor, Qt::KeepAspectRatio);
}

};
Expand All @@ -377,6 +383,7 @@ X11WindowPreviewContainer::X11WindowPreviewContainer(X11WindowMonitor* monitor,
, m_isPreviewEntered(false)
, m_isDockPreviewCount(0)
, m_model(new AppItemWindowModel(this))
, m_titleWidget(new QWidget())
{
m_hideTimer = new QTimer(this);
m_hideTimer->setSingleShot(true);
Expand Down Expand Up @@ -489,13 +496,6 @@ void X11WindowPreviewContainer::hideEvent(QHideEvent*)

void X11WindowPreviewContainer::resizeEvent(QResizeEvent *event)
{
m_previewTitle->setText(
QFontMetrics(m_previewTitle->font())
.elidedText(m_previewTitleStr,
Qt::TextElideMode::ElideRight,
width() - m_previewTitle->geometry().left() - (width() - m_closeAllButton->geometry().left()) - 1)
);

updatePosition();
}

Expand Down Expand Up @@ -542,12 +542,7 @@ void X11WindowPreviewContainer::updatePosition()
void X11WindowPreviewContainer::updatePreviewTitle(const QString& title)
{
m_previewTitleStr = title;
m_previewTitle->setText(
QFontMetrics(m_previewTitle->font())
.elidedText(m_previewTitleStr,
Qt::TextElideMode::ElideRight,
width() - m_previewTitle->geometry().left() - (width() - m_closeAllButton->geometry().left()) - 1)
);
m_previewTitle->setText(m_previewTitleStr);
}

void X11WindowPreviewContainer::initUI()
Expand All @@ -556,9 +551,10 @@ void X11WindowPreviewContainer::initUI()
QVBoxLayout* mainLayout = new QVBoxLayout;
QHBoxLayout* titleLayout = new QHBoxLayout;
titleLayout->setContentsMargins(5, 0, 5, 0);
titleLayout->setSpacing(0);

m_previewIcon = new QLabel(this);
m_previewTitle = new QLabel(this);
m_previewTitle = new DLabel(this);
m_previewTitle->setFixedHeight(PREVIEW_TITLE_HEIGHT);
m_previewIcon->setFixedSize(PREVIEW_TITLE_HEIGHT, PREVIEW_TITLE_HEIGHT);

Expand All @@ -569,6 +565,7 @@ void X11WindowPreviewContainer::initUI()

m_previewIcon->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_previewTitle->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_previewTitle->setElideMode(Qt::ElideRight);

auto updateWindowTitleColorType = [this](){
QPalette pa = palette();
Expand All @@ -582,9 +579,10 @@ void X11WindowPreviewContainer::initUI()
connect(DGuiApplicationHelper::instance(), & DGuiApplicationHelper::themeTypeChanged, this , updateWindowTitleColorType);

titleLayout->addWidget(m_previewIcon);
titleLayout->addSpacing(6);
titleLayout->addWidget(m_previewTitle);
titleLayout->addStretch();
titleLayout->addWidget(m_closeAllButton);
titleLayout->addWidget(m_closeAllButton, 0, Qt::AlignRight);

m_view->setModel(m_model);
m_view->setItemDelegate(new AppItemWindowDeletegate(m_view, this));
Expand All @@ -601,9 +599,16 @@ void X11WindowPreviewContainer::initUI()
pal.setColor(QPalette::Base, Qt::transparent);
m_view->setPalette(pal);

mainLayout->addLayout(titleLayout);
m_titleWidget->setLayout(titleLayout);

mainLayout->addWidget(m_titleWidget, 0, Qt::AlignHCenter);
mainLayout->addSpacing(PREVIEW_CONTENT_MARGIN);
mainLayout->addWidget(m_view);
mainLayout->setAlignment(m_view, Qt::AlignCenter);
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(PREVIEW_CONTENT_MARGIN, PREVIEW_CONTENT_MARGIN,
PREVIEW_CONTENT_MARGIN, PREVIEW_CONTENT_MARGIN);

setLayout(mainLayout);

setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
Expand All @@ -625,20 +630,46 @@ void X11WindowPreviewContainer::updateSize()
m_view->updateGeometry();

auto screenSize = screen()->size();
screenSize -= QSize(m_direction % 2 == 0 ? 0 : m_baseWindow->width() + 20, m_direction % 2 == 0 ? m_baseWindow->height() + 20 : 0);

setMaximumSize(screenSize);
setMinimumSize(0, 0);
auto calFixHeight = [=]()-> int {
int resHeight = screenSize.height();

bool beyondEdge = m_view->viewportSizeHint().height() + 2 * PREVIEW_CONTENT_MARGIN + PREVIEW_TITLE_HEIGHT > screenSize.height();
// 3 * PREVIEW_CONTENT_MARGIN = titleWidget到listview的距离 + 2 * margin
int listviewContainerHeight = m_view->viewportSizeHint().height() + 3 * PREVIEW_CONTENT_MARGIN + PREVIEW_TITLE_HEIGHT;

if (m_direction % 2 == 0) {
// 2D模式下Listview纵向排列, 需要去掉任务栏高度, 所以减去 m_baseWindow->height()
resHeight = beyondEdge ? screenSize.height() - 2 * PREVIEW_CONTENT_MARGIN - m_baseWindow->height() : listviewContainerHeight;
} else {
resHeight = beyondEdge ? screenSize.height() - 2 * PREVIEW_CONTENT_MARGIN : listviewContainerHeight;
}

return resHeight;
};

auto calFixWidth = [=]()-> int {
int resWidth = screenSize.width();

bool beyondEdge = m_view->viewportSizeHint().width() + 2 * (PREVIEW_CONTENT_MARGIN + PREVIEW_CONTAINER_MARGIN) > screenSize.width();
int listviewContainerWidth = m_view->viewportSizeHint().width() + 2 * PREVIEW_CONTENT_MARGIN;

m_view->setFixedSize(m_view->viewportSizeHint());
if (m_direction % 2 == 0) {
resWidth = beyondEdge ? screenSize.width() - 2 * PREVIEW_CONTENT_MARGIN : listviewContainerWidth;
} else {
resWidth = listviewContainerWidth;
}

return resWidth;
};

setFixedSize(calFixWidth(), calFixHeight());

if (m_view->width() + this->contentsMargins().left() * 2 <= PREVIEW_MINI_WIDTH) {
setMaximumWidth(PREVIEW_MINI_WIDTH);
}

int maxContentWidth = std::max(m_view->width(), PREVIEW_CONTENT_WIDTH);
m_previewTitle->setMaximumWidth(maxContentWidth - m_previewIcon->width() - m_closeAllButton->width() - 20);

m_titleWidget->setFixedWidth(m_view->width());
QTimer::singleShot(0, this, &X11WindowPreviewContainer::adjustSize);
}

Expand Down
5 changes: 3 additions & 2 deletions panels/dock/taskmanager/x11preview.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <cstdint>

#include <QLabel>
#include <DLabel>
#include <QWidget>
#include <QListView>
#include <DToolButton>
Expand Down Expand Up @@ -62,9 +62,10 @@ private Q_SLOTS:

AppItemWindowModel* m_model;
PreviewsListView* m_view;
QWidget *m_titleWidget;

QLabel* m_previewIcon;
QLabel* m_previewTitle;
DLabel* m_previewTitle;
DToolButton* m_closeAllButton;

QTimer* m_hideTimer;
Expand Down
14 changes: 0 additions & 14 deletions panels/dock/tray/plugins/uos-ai/uosaiplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,6 @@ bool UosAiPlugin::pluginIsDisable()
#ifdef USE_V23_DOCK
QIcon UosAiPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType)
{
QString iconName = "UosAiAssistant";
if (dockPart == DockPart::DCCSetting) {
QPixmap pixmap = loadSvg(iconName, QSize(18, 18));
if (themeType == DGuiApplicationHelper::ColorType::LightType) {
return pixmap;
} else {
QPainter pa(&pixmap);
pa.setCompositionMode(QPainter::CompositionMode_SourceIn);
pa.fillRect(pixmap.rect(), Qt::white);
return pixmap;
}
}


QString icon = ":/assets/icons/deepin/builtin/uosai.svg";
if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType)
icon = ":/assets/icons/deepin/builtin/uosai_dark.svg";
Expand Down