Merge pull request !99 from 杨敏/openkylin/nile
This commit is contained in:
杨敏 2024-08-15 05:43:46 +00:00 committed by openkylin-cibot
parent 1057264440
commit 548b72d0c1
3 changed files with 115 additions and 0 deletions

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
ukui-screensaver (4.10.0.0-ok30~0815) nile; urgency=medium
* BUG号#IAHFEB 锁屏登录界面网络连接按钮悬浮色与其他按钮不一致
#IA5AIS【次要】【屏保】mp4动态屏保的预览界面、屏保界面不会循环播放
#IABL4C【次要】【gg-维哈柯】【屏保】哈柯文,屏保界面休息时间,时分秒显示顺序错误
* 需求号:无
* 其他改动说明:无
* 其他改动影响域:无
-- Yang Min <yangmin@kylinos.cn> Thu, 15 Aug 2024 13:39:12 +0800
ukui-screensaver (4.10.0.0-ok29~0802) nile; urgency=medium ukui-screensaver (4.10.0.0-ok29~0802) nile; urgency=medium
* BUG号#IAF8BR 显示器息屏后,自动断开重连会导致电脑自动解锁登录 * BUG号#IAF8BR 显示器息屏后,自动断开重连会导致电脑自动解锁登录

103
debian/patches/0055-99-fixbug.patch vendored Normal file
View File

@ -0,0 +1,103 @@
From: =?utf-8?b?5p2o5pWP?= <yangmin@kylinos.cn>
Date: Thu, 15 Aug 2024 05:43:46 +0000
Subject: =?utf-8?q?!99_fixbug_Merge_pull_request_!99_from_=E6=9D=A8?=
=?utf-8?q?=E6=95=8F/openkylin/nile?=
---
src/CMakeLists.txt | 2 +-
src/widgets/networkbutton.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7094827..f76501d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -118,7 +118,7 @@ add_executable(ukui-screensaver-dialog ${dialog_SRC})
add_definitions(-DAPP_API_MAJOR=0
-DAPP_API_MINOR=11
-DAPP_API_FUNC=0
-# -DSUPPORT_MEDIA_CONTROL
+ -DSUPPORT_MEDIA_CONTROL
)
target_include_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_INCLUDE_DIRS} ${KYSDKWAYLANDHELPER_INCLUDE_DIRS})
target_link_directories(ukui-screensaver-dialog PRIVATE ${KYSDKSYSTIME_LIBRARY_DIRS} ${KYSDKWAYLANDHELPER_LIBRARY_DIRS})
diff --git a/src/widgets/networkbutton.cpp b/src/widgets/networkbutton.cpp
index b64b2ec..9d5972b 100644
--- a/src/widgets/networkbutton.cpp
+++ b/src/widgets/networkbutton.cpp
@@ -18,7 +18,9 @@
#include "networkbutton.h"
#include <QStylePainter>
#include <QStyleOption>
+#include <QApplication>
#include <QMouseEvent>
+#include "commonfunc.h"
NetWorkButton::NetWorkButton(QWidget *parent) : KyNetworkIcon(parent)
{
@@ -58,6 +60,14 @@ void NetWorkButton::paintEvent(QPaintEvent *e)
// painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
// painter.restore();
// }
+ if (option.state & QStyle::State_MouseOver) {
+ painter.save();
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(Qt::white);
+ painter.setOpacity(0.15);
+ painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
+ painter.restore();
+ }
if (curStatus == CLICKED) {
painter.save();
@@ -84,7 +94,49 @@ void NetWorkButton::paintEvent(QPaintEvent *e)
painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
painter.restore();
}
- QPushButton::paintEvent(e);
+
+ if (option.state & QStyle::State_HasFocus) {
+ painter.save();
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(Qt::white);
+ painter.setOpacity(0.25);
+ painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
+ painter.restore();
+ painter.save();
+ QStyleOption opt;
+ QColor color = opt.palette.color(QPalette::Highlight);
+ painter.setPen(QPen(color, 2));
+ painter.setBrush(Qt::NoBrush);
+ painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6);
+ painter.restore();
+ }
+ // 绘制图片
+ int buttonWidget = this->width();
+ int buttonHeight = this->height();
+ QRect buttonRect(0, 0, buttonWidget, buttonHeight);
+
+ QPixmap pixmap = option.icon.pixmap(option.iconSize, QIcon::Active);
+ pixmap = drawSymbolicColoredPixmap(pixmap, "white");
+ int pixmapWidth = static_cast<int>(pixmap.width() / qApp->devicePixelRatio());
+ int pixmapHeight = static_cast<int>(pixmap.height() / qApp->devicePixelRatio());
+ QRect pixmapRect(0, 0, pixmapWidth, pixmapHeight);
+
+ int deltaX = 0;
+ int deltaY = 0;
+ if (pixmapRect.width() < buttonRect.width())
+ deltaX = buttonRect.width() - pixmapRect.width();
+ else
+ deltaX = pixmapRect.width() - buttonRect.width();
+ if (pixmapRect.height() < buttonRect.height())
+ deltaY = buttonRect.height() - pixmapRect.height();
+ else
+ deltaY = pixmapRect.height() - buttonRect.height();
+
+ painter.save();
+ painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+ painter.translate(deltaX / 2, deltaY / 2);
+ painter.drawPixmap(pixmapRect, pixmap);
+ painter.restore();
}
void NetWorkButton::mouseReleaseEvent(QMouseEvent *e)

View File

@ -52,3 +52,4 @@
0052-94.patch 0052-94.patch
0053-97-fixbug.patch 0053-97-fixbug.patch
0054-98-IABL4C-gg-IA5AIS-mp4.patch 0054-98-IABL4C-gg-IA5AIS-mp4.patch
0055-99-fixbug.patch