diff --git a/include/widgets/dstyle.h b/include/widgets/dstyle.h index c8fa4f544..755733796 100644 --- a/include/widgets/dstyle.h +++ b/include/widgets/dstyle.h @@ -73,6 +73,7 @@ void drawIndicatorChecked(QPainter *pa, const QRectF &rect); void drawDeleteButton(QPainter *pa, const QRectF &rect); void drawAddButton(QPainter *pa, const QRectF &rect); +void drawTitleBarIcon(QPainter *pa, const QRectF &rect, const QString &iconName); void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect); void drawTitleBarMinButton(QPainter *pa, const QRectF &rect); void drawTitleBarMaxButton(QPainter *pa, const QRectF &rect); diff --git a/src/widgets/assets/icons/bloom/window_close.dci b/src/widgets/assets/icons/bloom/window_close.dci new file mode 100644 index 000000000..bd2910c15 Binary files /dev/null and b/src/widgets/assets/icons/bloom/window_close.dci differ diff --git a/src/widgets/assets/icons/bloom/window_maximize.dci b/src/widgets/assets/icons/bloom/window_maximize.dci new file mode 100644 index 000000000..db5e97158 Binary files /dev/null and b/src/widgets/assets/icons/bloom/window_maximize.dci differ diff --git a/src/widgets/assets/icons/bloom/window_menu.dci b/src/widgets/assets/icons/bloom/window_menu.dci index 60357bbc1..3f775f229 100644 Binary files a/src/widgets/assets/icons/bloom/window_menu.dci and b/src/widgets/assets/icons/bloom/window_menu.dci differ diff --git a/src/widgets/assets/icons/bloom/window_minimize.dci b/src/widgets/assets/icons/bloom/window_minimize.dci new file mode 100644 index 000000000..8f292b516 Binary files /dev/null and b/src/widgets/assets/icons/bloom/window_minimize.dci differ diff --git a/src/widgets/assets/icons/bloom/window_normal.dci b/src/widgets/assets/icons/bloom/window_normal.dci new file mode 100644 index 000000000..0726e8139 Binary files /dev/null and b/src/widgets/assets/icons/bloom/window_normal.dci differ diff --git a/src/widgets/assets/icons/dtk-icon-theme.qrc b/src/widgets/assets/icons/dtk-icon-theme.qrc index 2dd0415d2..c4761d464 100644 --- a/src/widgets/assets/icons/dtk-icon-theme.qrc +++ b/src/widgets/assets/icons/dtk-icon-theme.qrc @@ -68,5 +68,9 @@ bloom/play_pause.dci bloom/play_previous.dci bloom/play_next.dci + bloom/window_close.dci + bloom/window_maximize.dci + bloom/window_minimize.dci + bloom/window_normal.dci diff --git a/src/widgets/daboutdialog.cpp b/src/widgets/daboutdialog.cpp index 3ee17afa8..93eca15b2 100644 --- a/src/widgets/daboutdialog.cpp +++ b/src/widgets/daboutdialog.cpp @@ -63,6 +63,7 @@ void DAboutDialogPrivate::init() D_Q(DAboutDialog); q->setFixedSize(540, 290); + q->setWindowFlags(q->windowFlags() | Qt::CustomizeWindowHint); // overwrite default info if distribution config file existed. loadDistributionInfo(); diff --git a/src/widgets/dalertcontrol.cpp b/src/widgets/dalertcontrol.cpp index 11b8104a4..40eb413ee 100644 --- a/src/widgets/dalertcontrol.cpp +++ b/src/widgets/dalertcontrol.cpp @@ -282,9 +282,6 @@ bool DAlertControl::eventFilter(QObject *watched, QEvent *event) if (watched == d->follower) { if (event->type() == QEvent::Move || event->type() == QEvent::Resize) d->updateTooltipPos(); - - if (event->type() == QEvent::Hide || event->type() == QEvent::HideToParent) - hideAlertMessage(); } if (d->follower && watched == d->follower->topLevelWidget()) { diff --git a/src/widgets/dstyle.cpp b/src/widgets/dstyle.cpp index d1877795b..234d0da24 100644 --- a/src/widgets/dstyle.cpp +++ b/src/widgets/dstyle.cpp @@ -696,7 +696,7 @@ void drawAddButton(QPainter *pa, const QRectF &rect) pa->fillPath(path, QColor("#48bf00")); } -void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) +void drawTitleBarIcon(QPainter *pa, const QRectF &rect, const QString &iconName) { const QPen pen = pa->pen(); pa->setPen(Qt::NoPen); @@ -705,7 +705,7 @@ void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) content_rect.moveCenter(rect.center().toPoint()); pa->setPen(pen); - const DDciIcon &icon = DDciIcon::fromTheme(QLatin1String("window_menu")); + const DDciIcon &icon = DDciIcon::fromTheme(iconName); auto devicePixelRatio = pa->device() ? pa->device()->devicePixelRatioF() : qApp->devicePixelRatio(); auto appTheme = DGuiApplicationHelper::toColorType(pa->pen().color()); @@ -714,55 +714,29 @@ void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) icon.paint(pa, rect.toRect(), devicePixelRatio, theme, DDciIcon::Normal, Qt::AlignCenter, palette); } +void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) +{ + drawTitleBarIcon(pa, rect, QLatin1String("window_menu")); +} + void drawTitleBarMinButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRect content_rect(0, 0, rect.width() / 5, rect.height() / 5); - content_rect.moveCenter(rect.center().toPoint()); - pa->setPen(pen); - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - drawDecreaseElement(pa, content_rect); + drawTitleBarIcon(pa, rect, QLatin1String("window_minimize")); } void drawTitleBarMaxButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRect content_rect(0, 0, rect.width() / 5, rect.height() / 6); - content_rect.moveCenter(rect.center().toPoint()); - pa->setPen(pen); - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - pa->drawRect(content_rect); + drawTitleBarIcon(pa, rect, QLatin1String("window_maximize")); } void drawTitleBarCloseButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRectF content_rect(0, 0, rect.width() / 5, rect.height() / 5); - content_rect.moveCenter(rect.center()); - pa->setPen(pen); - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - drawForkElement(pa, content_rect); + drawTitleBarIcon(pa, rect, QLatin1String("window_close")); } void drawTitleBarNormalButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRect content_rect(0, 0, rect.width() / 5, rect.height() / 5); - content_rect.moveCenter(rect.center().toPoint()); - pa->setPen(pen); - - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - pa->drawRect(content_rect.x(), content_rect.y() + 2, content_rect.width() - 2, content_rect.height() - 2); - pa->drawLine(content_rect.x() + 2, content_rect.y(), content_rect.right(), content_rect.y()); - pa->drawLine(content_rect.right() + 1, content_rect.y(), content_rect.right() + 1, content_rect.bottom() - 2); + drawTitleBarIcon(pa, rect, QLatin1String("window_normal")); } void drawTitleQuitFullButton(QPainter *pa, const QRectF &rect)