From f9322dfeb1842a7a6ceca567890283c453b202fd Mon Sep 17 00:00:00 2001 From: zhang_tian_ze Date: Thu, 15 Dec 2022 13:43:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9OpenKylin=E4=B8=8BUI=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=9C=80=E8=BF=91=E6=94=B6?= =?UTF-8?q?=E8=97=8F=E9=A1=B5=E7=84=A6=E7=82=B9=E6=89=93=E5=BC=80=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 142 ------------------- debian/control | 44 ------ debian/copyright | 29 ---- debian/rules | 7 - debian/source/format | 1 - debian/watch | 2 - src/UserInterface/Button/push_button.cpp | 104 ++++++++++++++ src/UserInterface/Button/push_button.h | 44 ++++++ src/UserInterface/Button/textlabel.cpp | 34 +++++ src/UserInterface/Button/textlabel.h | 27 ++++ src/UserInterface/Widget/function_Widget.cpp | 8 +- src/UserInterface/Widget/function_Widget.h | 2 +- src/UserInterface/Widget/splitbar_frame.h | 6 +- src/UserInterface/full_mainwindow.cpp | 11 +- src/UserInterface/full_mainwindow.h | 3 +- src/UserInterface/mainwindow.cpp | 44 ++++-- src/UserInterface/mainwindow.h | 9 +- src/UserInterface/userinterface.pri | 4 + src/UtilityFunction/Style/style.h | 12 +- src/UtilityFunction/utility.cpp | 32 ++++- src/UtilityFunction/utility.h | 4 +- 21 files changed, 304 insertions(+), 265 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/rules delete mode 100644 debian/source/format delete mode 100644 debian/watch create mode 100644 src/UserInterface/Button/push_button.cpp create mode 100644 src/UserInterface/Button/push_button.h create mode 100644 src/UserInterface/Button/textlabel.cpp create mode 100644 src/UserInterface/Button/textlabel.h diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index b724d1a..0000000 --- a/debian/changelog +++ /dev/null @@ -1,142 +0,0 @@ -ukui-menu (3.1.1-ok4~1124) v101; urgency=medium - - * close-cd #I5RF2N 开始菜单展开后没有置顶,也没有全屏 - * 增加了列表应用拖拽固定到任务栏功能(需要任务栏同步更新) - - -- lixueman Thu, 24 Nov 2022 09:29:48 +0800 - -ukui-menu (3.1.1-ok4~1104) yangtze; urgency=medium - - *close-cd I5XN4B 【开始菜单】重启后点击开始菜单电源按钮,会话管理器界面自动弹出开始菜单,关闭开始菜单后不再自动弹出 - - -- lixueman Fri, 04 Nov 2022 16:45:18 +0800 - -ukui-menu (3.1.1-ok4~1101) yangtze; urgency=medium - - * close-cd #146246 【开始菜单】开始菜单icon模糊 - - -- zhangtianze Tue, 01 Nov 2022 15:27:05 +0800 - -ukui-menu (3.1.1-ok4~1024) yangtze; urgency=medium - - * close-cd #I5SPVS 移动面板后使用win键打开菜单栏位置不对 - * close-cd #I5RF2N 开始菜单展开后没有置顶,也没有全屏 - * close-cd #I5R2AO 开始菜单放大后应用图标缺失、电源按钮被任务栏挡住,且有小概率未正确全屏 - - -- lixueman Mon, 24 Oct 2022 17:10:56 +0800 - -ukui-menu (3.1.1-ok4~1020) yangtze; urgency=medium - - * close-cd #129225【开始菜单】【PC】在列表顶部或底部继续触摸拖动概率性出现图标缺失情况,再次滑动显示正常(1/10) - - -- lixueman Thu, 20 Oct 2022 09:11:06 +0800 - -ukui-menu (3.1.1-ok4~1012) yangtze; urgency=medium - - * close-cd #116176 【设计】【开始菜单】【浅色模式】底板缺少描边及阴影 - - -- lixueman Wed, 12 Oct 2022 11:14:50 +0800 - -ukui-menu (3.1.1-ok4~0920) yangtze; urgency=medium - - * 任务:开始菜单工具提示内容优化(收藏&最近 区域),增加路径提示 - - -- lixueman Tue, 20 Sep 2022 09:04:27 +0800 - -ukui-menu (3.1.1-ok4~0913) yangtze; urgency=medium - - * close-cd #125158 【开始菜单】切换全屏时动画显示不太流畅 - * close-cd #133399 【开始菜单】【PC】只有一个用户,开始菜单右键电源按钮存在切换用户选项 - * 添加版权信息 - * 修改规范性问题 - - -- lixueman Tue, 13 Sep 2022 08:40:10 +0800 - -ukui-menu (3.1.1-ok4~0907) yangtze; urgency=medium - - * close-cd #125158 【开始菜单】切换全屏时动画显示不太流畅 - * close-cd #133399 【开始菜单】【PC】只有一个用户,开始菜单右键电源按钮存在切换用户选项 - * 添加版权信息 - - -- lixueman Wed, 07 Sep 2022 14:12:53 +0800 - -ukui-menu (3.1.1-ok4~0831) yangtze; urgency=medium - - * close-cd # 131373 【wayland】【软件更新器】点击打开软件更新器后,开始菜单过6s左右才退出; - - -- lixueman Wed, 31 Aug 2022 00:52:08 +0800 - -ukui-menu (3.1.1-ok4~0818) yangtze; urgency=medium - - * close-cd #125159 修改全屏下固定到收藏不生效问题 - * close-cd #130911 【开始菜单】【PC】最大化后无法上下滑动翻页 - - -- lixueman Thu, 18 Aug 2022 11:19:35 +0800 - -ukui-menu (3.1.1-ok4~0727) yangtze; urgency=medium - - * 增加开始菜单藏文翻译 - * 调整点击应用时窗口隐藏时机 - * 修改分类下拉选择框宽度 - - -- lixueman Wed, 27 Jul 2022 20:32:11 +0800 - -ukui-menu (3.1.1-ok4~0725) yangtze; urgency=medium - - * 解决平板模式下win键可以打开开始菜单问题 - - -- lixueman Mon, 25 Jul 2022 09:15:22 +0800 - -ukui-menu (3.1.1-ok4~0721.1) yangtze; urgency=medium - - * 解决了强调色修改后,搜索框未及时刷新问题 - - -- lixueman Thu, 21 Jul 2022 15:34:09 +0800 - -ukui-menu (3.1.1-ok4~0721) yangtze; urgency=medium - - * close-cd #130526 修改搜索框和收藏最近按钮高亮色 - * close-cd #130514 全屏菜单的滑块透明度修改 - * close-cd #130485 修改字母集导航页禁用按钮样式 - * close-cd #130477 修改功能集导航页禁用按钮样式 - - -- kylin Thu, 21 Jul 2022 13:51:42 +0800 - -ukui-menu (3.1.1-ok4~0718) yangtze; urgency=medium - - * close-cd #127740 修复wayland下默认全屏切换动画位置异常,不显示动画 - * close-cd #129213 解决开始菜单点击屏幕键盘后延迟退出问题 - * close-cd #128764 增加搜索按下键切换焦点至搜索结果页;全屏增加字符输入直接切换搜索框 - * close-cd #128492,解决字母和功能分类固定到所有软件未置顶问题 - - -- lixueman Mon, 18 Jul 2022 15:09:23 +0800 - -ukui-menu (3.1.1-ok4~0712) yangtze; urgency=medium - - * close-cd #128498 - 修复【wayland】【开始菜单】多次点击tab键和回车键后,开始菜单点不开问题 - - -- lixueman Tue, 12 Jul 2022 16:11:49 +0800 - -ukui-menu (3.1.1-ok4~0708) yangtze; urgency=medium - - * 调整全屏窗口初始化代码结构 - * 增加全屏开始菜单分类选择下拉按钮动画效果 - * 增加全屏开始菜单点击空白区域退出功能 - * 固定全屏电源右键菜单位置 - - -- lixueman Fri, 08 Jul 2022 11:25:23 +0800 - -ukui-menu (3.1.1-ok4~0623) yangtze; urgency=medium - - * 调整QGuiApplication::platformName()调用时机 - * 增加全屏窗口显示时位置设定 - * 合入app-manager接口 - - -- lixueman Wed, 22 Jun 2022 11:22:58 +0800 - -ukui-menu (3.1.1-ok1) yangtze; urgency=medium - - * 版本号规范化 - - -- Xie Wei Fri, 06 May 2022 17:54:45 +0800: diff --git a/debian/control b/debian/control deleted file mode 100644 index b845cb7..0000000 --- a/debian/control +++ /dev/null @@ -1,44 +0,0 @@ -Source: ukui-menu -Section: x11 -Priority: optional -Maintainer: Kylin Team -Uploaders: Aron Xu , - handsome_feng -Build-Depends: debhelper-compat (=12), - qtbase5-dev, - libqt5svg5-dev, - libqt5x11extras5-dev, - libglib2.0-dev (>= 2.36), - libgsettings-qt-dev, - qttools5-dev-tools, - libbamf3-dev, - libkf5windowsystem-dev, - libuchardet-dev, - libukui-log4qt-dev, - libxtst-dev, - libx11-dev, - libukui-common0, - libukui-common-dev, - libpeony-dev, - libkysdk-waylandhelper-dev -Standards-Version: 4.5.0 -Rules-Requires-Root: no -Homepage: https://github.com/ukui/ukui-menu -Vcs-Git: https://github.com/ukui/ukui-menu -Vcs-Browser: https://github.com/ukui/ukui-menu - -Package: ukui-menu -Architecture: any -Depends: ${shlibs:Depends}, - ${misc:Depends}, - accountsservice, - libgsettings-qt1, - libqt5x11extras5, - bamfdaemon, - libkysdk-waylandhelper -Suggests:kylin-status-manager -Description: Advanced ukui menu - UKUI menu provides start menu development library and advanced - graphical user interface. - . - The package contains executable file. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 3a0edea..0000000 --- a/debian/copyright +++ /dev/null @@ -1,29 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: ukui-menu -Upstream-Contact: liuhao -Source: https://github.com/ukui/ukui-menu - -Files: * -Copyright: 2019 Tianjin KYLIN Information Technology Co., Ltd. -License: GPL-3.0+ - -Files: debian/* -Copyright: 2019 liuhao -License: GPL-3.0+ - -License: GPL-3.0+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see . - . - On Debian systems, the complete text of the GNU General - Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/rules b/debian/rules deleted file mode 100644 index 95cf77f..0000000 --- a/debian/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f - -export DEB_BUILD_MAINT_OPTIONS = hardening=+all -export QT_SELECT := qt5 - -%: - dh $@ diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 89ae9db..0000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/debian/watch b/debian/watch deleted file mode 100644 index e685515..0000000 --- a/debian/watch +++ /dev/null @@ -1,2 +0,0 @@ -version=4 -https://github.com/ukui/ukui-menu/releases .*/ukui-menu_(\d\S+)\.orig\.tar\.gz diff --git a/src/UserInterface/Button/push_button.cpp b/src/UserInterface/Button/push_button.cpp new file mode 100644 index 0000000..cff465a --- /dev/null +++ b/src/UserInterface/Button/push_button.cpp @@ -0,0 +1,104 @@ +#include "push_button.h" + +PushButton::PushButton(QWidget *parent) : QPushButton(parent) +{ + m_btnLayout = new QHBoxLayout(this); + this->setLayout(m_btnLayout); + m_label = new IconLabel(this); + m_btnLayout->addWidget(m_label); + + m_label->setAlignment(Qt::AlignCenter); + m_btnLayout->setAlignment(Qt::AlignCenter); +} + +void PushButton::setLabel(QPixmap pixmap, int size) +{ + m_label->setFixedSize(size, size); + m_label->setIcon(pixmap); +} + +PushButton::~PushButton() +{ + +} + +void PushButton::paintEvent(QPaintEvent *e) +{ + Q_UNUSED(e); + QStylePainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + QStyleOptionButton option; + initStyleOption(&option); + + if (option.state & QStyle::State_Sunken) { + painter.save(); + painter.setPen(Qt::NoPen); + painter.setBrush(Qt::white); + if (g_curStyle == "ukui-dark" || g_isFullScreen) { + painter.setOpacity(0.25); + } else { + painter.setOpacity(0.65); + } + + 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); + if (g_curStyle == "ukui-dark" || g_isFullScreen) { + painter.setOpacity(0.1); + } else { + painter.setOpacity(0.35); + } + + painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); + painter.restore(); + } + + if (option.state & QStyle::State_On) { + painter.save(); + painter.setPen(Qt::NoPen); + painter.setBrush(Qt::white); + if (g_curStyle == "ukui-dark" || g_isFullScreen) { + painter.setOpacity(0.2); + } else { + painter.setOpacity(0.5); + } + + painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); + painter.restore(); + } + + if (option.state & QStyle::State_HasFocus) { + painter.save(); + QStyleOption opt; + QColor color = opt.palette.color(QPalette::Highlight); + painter.setPen(QPen(color, 2)); + painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); + painter.restore(); + } +} + +IconLabel::IconLabel(QWidget *parent) + : QLabel(parent) +{ + this->setContentsMargins(0, 0, 0, 0); +} + +void IconLabel::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setRenderHints(QPainter::SmoothPixmapTransform, true); + painter.drawPixmap(0, 0, m_pixmap); + return QLabel::paintEvent(event); +} + +void IconLabel::setIcon(const QPixmap &pixmap) +{ + m_pixmap = pixmap; +} + + diff --git a/src/UserInterface/Button/push_button.h b/src/UserInterface/Button/push_button.h new file mode 100644 index 0000000..5c044ba --- /dev/null +++ b/src/UserInterface/Button/push_button.h @@ -0,0 +1,44 @@ +#ifndef PUSHBUTTON_H +#define PUSHBUTTON_H + +#include +#include +#include +#include +#include +#include +#include "utility.h" + +class IconLabel : public QLabel +{ + Q_OBJECT +public: + IconLabel(QWidget *parent = nullptr); + void setIcon(const QPixmap &pixmap); +protected: + void paintEvent(QPaintEvent *event) override; + +private: + QPixmap m_pixmap; +}; + +class PushButton : public QPushButton +{ + Q_OBJECT +public: + explicit PushButton(QWidget *parent = nullptr); + ~PushButton(); + + void setLabel(QPixmap pixmap, int size); + +protected: + void paintEvent(QPaintEvent *e) override; + +private: + QHBoxLayout *m_btnLayout = nullptr; + IconLabel *m_label = nullptr; + +Q_SIGNALS: + +}; +#endif // PUSHBUTTON_H diff --git a/src/UserInterface/Button/textlabel.cpp b/src/UserInterface/Button/textlabel.cpp new file mode 100644 index 0000000..90e4722 --- /dev/null +++ b/src/UserInterface/Button/textlabel.cpp @@ -0,0 +1,34 @@ +#include "textlabel.h" +#include + +TextLabel::TextLabel(QWidget *parent) : QLabel(parent) +{ + +} + +void TextLabel::checkState(bool isChecked) +{ + m_isChecked = isChecked; +} + +void TextLabel::paintEvent(QPaintEvent *event) +{ + if (m_isChecked) { + return QLabel::paintEvent(event); + } + + QStylePainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + QStyleOptionFrame option; + initStyleOption(&option); + + if (option.state & QStyle::State_HasFocus) { + painter.save(); + QStyleOption opt; + QColor color = opt.palette.color(QPalette::Highlight); + painter.setPen(QPen(color, 2)); + painter.drawRoundedRect(option.rect.adjusted(1, 1, -1, -1), 6, 6); + painter.restore(); + } + QLabel::paintEvent(event); +} diff --git a/src/UserInterface/Button/textlabel.h b/src/UserInterface/Button/textlabel.h new file mode 100644 index 0000000..18eb961 --- /dev/null +++ b/src/UserInterface/Button/textlabel.h @@ -0,0 +1,27 @@ +#ifndef TEXTLABEL_H +#define TEXTLABEL_H + +#include +#include +#include +#include +#include + +class TextLabel : public QLabel +{ + Q_OBJECT +public: + explicit TextLabel(QWidget *parent = nullptr); + + void checkState(bool isChecked); + +private: + void paintEvent(QPaintEvent *event) override; + + bool m_isChecked = false; + +Q_SIGNALS: + +}; + +#endif // TEXTLABEL_H diff --git a/src/UserInterface/Widget/function_Widget.cpp b/src/UserInterface/Widget/function_Widget.cpp index cc0eee7..8cd4967 100755 --- a/src/UserInterface/Widget/function_Widget.cpp +++ b/src/UserInterface/Widget/function_Widget.cpp @@ -74,9 +74,9 @@ FunctionWidget::FunctionWidget(QWidget *parent): QWidget(parent) FunctionWidget::~FunctionWidget() { - if (themeSetting) { - delete themeSetting; - } +// if (themeSetting) { +// delete themeSetting; +// } if (myTimer) { delete myTimer; @@ -146,7 +146,7 @@ FunctionWidget::~FunctionWidget() delete effect; } - themeSetting = nullptr; +// themeSetting = nullptr; myTimer = nullptr; upWidget = nullptr; upLayout = nullptr; diff --git a/src/UserInterface/Widget/function_Widget.h b/src/UserInterface/Widget/function_Widget.h index 9fe81d9..0f6f28a 100755 --- a/src/UserInterface/Widget/function_Widget.h +++ b/src/UserInterface/Widget/function_Widget.h @@ -47,7 +47,7 @@ protected: private: CurrentTimeInterface *Time = nullptr; - QGSettings *themeSetting = nullptr; +// QGSettings *themeSetting = nullptr; QGSettings *timeSetting = nullptr; QString themeName; QObject *plugin = nullptr; diff --git a/src/UserInterface/Widget/splitbar_frame.h b/src/UserInterface/Widget/splitbar_frame.h index 079d757..bb5195e 100755 --- a/src/UserInterface/Widget/splitbar_frame.h +++ b/src/UserInterface/Widget/splitbar_frame.h @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#ifndef PUSHBUTTON_H -#define PUSHBUTTON_H +#ifndef SPLITBARFRAME_H +#define SPLITBARFRAME_H #include #include #include @@ -51,4 +51,4 @@ protected: void paintEvent(QPaintEvent *event); }; -#endif // PUSHBUTTON_H +#endif // SPLITBARFRAME diff --git a/src/UserInterface/full_mainwindow.cpp b/src/UserInterface/full_mainwindow.cpp index d614bb9..499e76d 100755 --- a/src/UserInterface/full_mainwindow.cpp +++ b/src/UserInterface/full_mainwindow.cpp @@ -82,11 +82,11 @@ void FullMainWindow::initButtonUI() m_fullSelectMenuButton->setFixedSize(QSize(16, 34)); m_fullSelectMenuButton->setAcceptDrops(true); m_fullSelectMenuButton->setFocusPolicy(Qt::StrongFocus); - m_fullSelectMenuButton->setIcon(QPixmap(":/data/img/mainviewwidget/DM-arrow-2x.png")); + m_fullSelectMenuButton->setIcon(getCurPixmap(":/data/img/mainviewwidget/DM-arrow-2x.png", false, 16)); QPalette palete; palete.setColor(QPalette::NoRole, Qt::white); m_fullSelectMenuButton->setPalette(palete); - m_minPushButton = new QPushButton(centralwidget); + m_minPushButton = new PushButton(centralwidget); m_minPushButton->setObjectName(QString::fromUtf8("minPushButton")); m_minPushButton->setFixedSize(QSize(48, 48)); m_minPushButton->setFlat(true); @@ -288,9 +288,10 @@ void FullMainWindow::changeStyle() "%1:hover {border-radius:24px; background:" + buttonColorHover + ";}" "%1:pressed {border-radius:24px; background:" + buttonColorPress + ";}"); m_fullSelectToolButton->setStyleSheet(m_buttonStyle.arg("QPushButton")); - m_fullSelectMenuButton->setIcon(QPixmap(":/data/img/mainviewwidget/DM-arrow-2x.png")); - m_minPushButton->setIcon(getCurIcon(":/data/img/mainviewwidget/full-min.svg", false)); - m_minPushButton->setProperty("useIconHighlightEffect", 0x0); + + QPixmap pixmap = loadSvg(QString(":/data/img/mainviewwidget/full-min.svg"), 25); + m_minPushButton->setLabel(pixmap, 25); +// m_minPushButton->setProperty("useIconHighlightEffect", 0x0); } void FullMainWindow::on_minPushButton_clicked() diff --git a/src/UserInterface/full_mainwindow.h b/src/UserInterface/full_mainwindow.h index 09a7c01..c793607 100755 --- a/src/UserInterface/full_mainwindow.h +++ b/src/UserInterface/full_mainwindow.h @@ -30,6 +30,7 @@ #include "searchappthread.h" #include "full_searchresult_widget.h" #include "rotationlabel.h" +#include "push_button.h" class FullMainWindow : public QMainWindow { @@ -99,7 +100,7 @@ private: QSpacerItem *horizontalSpacer_2; QPushButton *m_fullSelectToolButton; RotationLabel *m_fullSelectMenuButton; - QPushButton *m_minPushButton; + PushButton *m_minPushButton; QStackedWidget *m_fullStackedWidget; FullCommonUseWidget *m_fullCommonPage; diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index 18f538b..ad46566 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -165,16 +165,16 @@ void MainWindow::registDbusServer() m_topStackedWidget->setCurrentIndex(0); m_lineEdit->clear(); this->clearFocus(); - m_isFullScreen = false; + g_isFullScreen = false; } else if (m_fullWindow->isVisible()) { m_fullWindow->hide(); m_fullWindow->clearFocus(); m_fullWindow->resetEditline(); - m_isFullScreen = true; + g_isFullScreen = true; } else { - if (!m_isFullScreen) { + if (!g_isFullScreen) { this->show(); setMinWindowPos(); this->raise(); @@ -384,24 +384,25 @@ void MainWindow::initRightWidgetButton() m_mainRightVerticalLayout_1 = new QVBoxLayout(); m_rightTopHorizontalLayout = new QHBoxLayout(); m_rightTopHorizontalLayout->setSpacing(30); - m_rightTopHorizontalLayout->setContentsMargins(8, 0, 10, 0); + m_rightTopHorizontalLayout->setContentsMargins(8, 0, 6, 0); //收藏按键 - m_collectPushButton = new QLabel(m_centralwidget); + m_collectPushButton = new TextLabel(m_centralwidget); m_collectPushButton->setFocusPolicy(Qt::StrongFocus); m_collectPushButton->setFixedHeight(34); // m_collectPushButton->setFlat(true); m_collectPushButton->installEventFilter(this); //最近按键 - m_recentPushButton = new QLabel(m_centralwidget); + m_recentPushButton = new TextLabel(m_centralwidget); m_recentPushButton->setFixedHeight(34); m_recentPushButton->setFocusPolicy(Qt::StrongFocus); // m_recentPushButton->setFlat(true); m_recentPushButton->installEventFilter(this); m_horizontalSpacer_3 = new QSpacerItem(332, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); //放大缩小按键 - m_minMaxChangeButton = new QPushButton(m_centralwidget); - m_minMaxChangeButton->setFixedSize(QSize(24, 24)); - m_minMaxChangeButton->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-max.svg", true)); + m_minMaxChangeButton = new PushButton(m_centralwidget); + m_minMaxChangeButton->setFixedSize(QSize(34, 34)); + QPixmap pixmap = getCurPixmap(":/data/img/mainviewwidget/DM-max.svg",true, 16); + m_minMaxChangeButton->setLabel(pixmap, 16); m_minMaxChangeButton->setFlat(true); m_rightTopHorizontalLayout->addWidget(m_collectPushButton); m_rightTopHorizontalLayout->addWidget(m_recentPushButton); @@ -638,6 +639,9 @@ void MainWindow::changeStyle() } } + QPixmap pixmap = getCurPixmap(":/data/img/mainviewwidget/DM-max.svg",true, 16); + m_minMaxChangeButton->setLabel(pixmap, 16); + m_buttonStyle = QString("%1{border-radius:13px; background:" + buttonColorDefault + ";}" "%1:hover {border-radius:13px; background:" + buttonColorHover + ";}" "%1:pressed {border-radius:13px; background:" + buttonColorPress + ";}"); @@ -745,6 +749,14 @@ bool MainWindow::event(QEvent *event) QApplication::postEvent(m_selectMenuButton, new QEvent(QEvent::MouseButtonPress)); } + if (m_collectPushButton->hasFocus()) { + on_collectPushButton_clicked(); + } + + if (m_recentPushButton->hasFocus()) { + on_recentPushButton_clicked(); + } + if (m_lineEdit->hasFocus()) { m_minSearchResultListView->setFocus(); } else { @@ -1231,6 +1243,8 @@ void MainWindow::databaseThreadCloseSlot() void MainWindow::on_collectPushButton_clicked() { + m_recentPushButton->checkState(false); + m_collectPushButton->checkState(true); m_rightStackedWidget->setCurrentIndex(0); QString textColorHightLight = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16).mid(2, 6); @@ -1245,6 +1259,8 @@ void MainWindow::on_collectPushButton_clicked() void MainWindow::on_recentPushButton_clicked() { + m_collectPushButton->checkState(false); + m_recentPushButton->checkState(true); m_rightStackedWidget->setCurrentIndex(1); QString textColorDefault = QString::number(this->palette().color(QPalette::Text).rgba(), 16).mid(2, 6); m_collectPushButton->setStyleSheet(QString("color:#%1").arg(textColorDefault)); @@ -1270,7 +1286,7 @@ void MainWindow::on_searchPushButton_clicked() void MainWindow::on_minMaxChangeButton_clicked() { m_canHide = true; - m_isFullScreen = true; + g_isFullScreen = true; QPropertyAnimation *m_maxAnimation = new QPropertyAnimation(m_animationPage, "geometry", this); connect(m_maxAnimation, &QPropertyAnimation::finished, this, &MainWindow::maxAnimationFinished); @@ -1300,7 +1316,7 @@ void MainWindow::showWindow() { Style::initWidStyle(); myDebug() << "调用开始菜单显示"; - if (m_isFullScreen) { + if (g_isFullScreen) { m_fullWindow->show(); setMaxWindowPos(); m_fullWindow->raise(); @@ -1322,13 +1338,13 @@ void MainWindow::hideWindow() m_fullWindow->hide(); m_fullWindow->resetEditline(); this->clearFocus(); - m_isFullScreen = true; + g_isFullScreen = true; } else { this->hide(); m_topStackedWidget->setCurrentIndex(0); m_lineEdit->clear(); this->clearFocus(); - m_isFullScreen = false; + g_isFullScreen = false; } } @@ -1415,7 +1431,7 @@ void MainWindow::showNormalWindowSlot() QEventLoop loop; QTimer::singleShot(100, &loop, SLOT(quit())); loop.exec(); - m_isFullScreen = false; + g_isFullScreen = false; m_minAnimation->setEasingCurve(QEasingCurve::OutExpo); m_minAnimation->setStartValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); m_minAnimation->setEndValue(QRect(this->x() + 5, this->y() + 5, Style::m_minw - 10, Style::m_minh - 10)); diff --git a/src/UserInterface/mainwindow.h b/src/UserInterface/mainwindow.h index 2afcb93..75fee17 100755 --- a/src/UserInterface/mainwindow.h +++ b/src/UserInterface/mainwindow.h @@ -53,6 +53,8 @@ #include "animationpage.h" #include "rotationlabel.h" #include "rightlistview.h" +#include "push_button.h" +#include "textlabel.h" #include "ukuistylehelper/ukuistylehelper.h" #include "windowmanager/windowmanager.h" @@ -200,10 +202,10 @@ private: QHBoxLayout *m_rightTopHorizontalLayout = nullptr; QVBoxLayout *m_rightCollectLayout = nullptr; QVBoxLayout *m_rightRecentLayout = nullptr; - QLabel *m_collectPushButton = nullptr; - QLabel *m_recentPushButton = nullptr; + TextLabel *m_collectPushButton = nullptr; + TextLabel *m_recentPushButton = nullptr; QSpacerItem *m_horizontalSpacer_3 = nullptr; - QPushButton *m_minMaxChangeButton = nullptr; + PushButton *m_minMaxChangeButton = nullptr; QSpacerItem *m_verticalSpacer = nullptr; QStackedWidget *m_rightStackedWidget = nullptr; QWidget *m_collectPage = nullptr; @@ -220,7 +222,6 @@ private: MenuBox *m_dropDownMenu = nullptr; bool m_canHide = true; - bool m_isFullScreen = false; QString m_buttonStyle; UkuiMenuInterface *m_ukuiMenuInterface = nullptr; QPropertyAnimation *m_animation = nullptr; diff --git a/src/UserInterface/userinterface.pri b/src/UserInterface/userinterface.pri index 00b893b..f635b07 100755 --- a/src/UserInterface/userinterface.pri +++ b/src/UserInterface/userinterface.pri @@ -11,6 +11,8 @@ HEADERS += \ $$PWD/Button/function_classify_button.h \ $$PWD/Button/letter_classify_button.h \ $$PWD/Button/tool_button.h \ + $$PWD/Button/push_button.h \ + $$PWD/Button/textlabel.h\ $$PWD/ListView/fulllistview.h \ $$PWD/ListView/klistview.h \ $$PWD/ListView/listview.h \ @@ -48,6 +50,8 @@ SOURCES += \ $$PWD/Button/function_classify_button.cpp \ $$PWD/Button/letter_classify_button.cpp \ $$PWD/Button/tool_button.cpp \ + $$PWD/Button/push_button.cpp \ + $$PWD/Button/textlabel.cpp\ $$PWD/ListView/fulllistview.cpp \ $$PWD/ListView/klistview.cpp \ $$PWD/ListView/listview.cpp \ diff --git a/src/UtilityFunction/Style/style.h b/src/UtilityFunction/Style/style.h index 6ca2f80..4fe232e 100755 --- a/src/UtilityFunction/Style/style.h +++ b/src/UtilityFunction/Style/style.h @@ -40,16 +40,16 @@ #define RightClickMenuOpacity 0.95 #define ToolTipBackground "rgba(26, 26, 26, 0.7)" #define DefaultBackground "rgba(19, 19, 20, 0.7)" //默认态背景色 -#define LineBackground "rgba(255,255,255)" //分割线背景色 +#define LineBackground "rgba(255, 255, 255)" //分割线背景色 #define SBClassifyBtnSelectedBackground "#3D6BE5" //侧边栏上部分类按钮选择背景 #define SBFunBtnHoverBackground "rgba(255, 255, 255, 0.14)" //侧边栏目下部功能按钮悬浮背景 #define ClassifyBtnHoverBackground "rgba(255, 255, 255, 0.14)" //分类按钮悬浮背景 #define MMBtnHoverBackground "rgba(255, 255, 255, 0.14)" //最大化最小化按钮悬浮背景 -#define QueryLineEditDefaultBackground "rgba(0, 0, 0,0.04)" //搜索框默认态背景 -#define QueryLineEditBackground "rgba(255, 255, 255,0.06)" //搜索框背景 -#define QueryLineEditClickedDefaultBackground "rgba(0, 0, 0,0.04)" //搜索框默认态背景选中 -#define QueryLineEditClickedBackground "rgba(255, 255, 255,0.06)" //搜索框背景选中 -#define QueryLineEditClickedBorderDefault "rgba(0, 0, 0,0.1)" //搜索框默认态背景选中边框 +#define QueryLineEditDefaultBackground "rgba(0, 0, 0, 0.04)" //搜索框默认态背景 +#define QueryLineEditBackground "rgba(255, 255, 255, 0.06)" //搜索框背景 +#define QueryLineEditClickedDefaultBackground "rgba(0, 0, 0, 0.04)" //搜索框默认态背景选中 +#define QueryLineEditClickedBackground "rgba(255, 255, 255, 0.06)" //搜索框背景选中 +#define QueryLineEditClickedBorderDefault "rgba(255, 255, 255, 0.25)" //搜索框默认态背景选中边框 #define QueryLineEditClickedBorder "rgba(5, 151, 255, 1)" //搜索框背景选中边框 #define AppBtnHover "#ffffff" //按钮悬浮 diff --git a/src/UtilityFunction/utility.cpp b/src/UtilityFunction/utility.cpp index 8af6b3f..5b66523 100755 --- a/src/UtilityFunction/utility.cpp +++ b/src/UtilityFunction/utility.cpp @@ -34,8 +34,9 @@ QString g_projectCodeName = "V10SP1"; QString g_subProjectCodeName = ""; QString g_platform = ""; -bool g_menuStatus = false; QString g_curStyle = ""; +bool g_menuStatus = false; +bool g_isFullScreen = false; const QPixmap loadSvg(const QString &fileName, const int size) { @@ -132,6 +133,35 @@ QIcon getCurIcon(const QString &iconPath, bool autoSet) return QIcon(pixmap); } +QPixmap getCurPixmap(const QString &iconPath, bool autoSet, int size) +{ + QPixmap pixmap; + + if (iconPath.endsWith("png")) { + pixmap = QPixmap(iconPath); + } else { + pixmap = loadSvg(iconPath, size); + } + + if (!autoSet) { + return drawSymbolicColoredPixmap(pixmap); + } + + if (QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit())) { + QGSettings gsetting(QString("org.ukui.style").toLocal8Bit()); + + if (gsetting.keys().contains(QString("styleName"))) { + if (gsetting.get("style-name").toString() == "ukui-light" + || gsetting.get("style-name").toString() == "ukui-default") { + pixmap = drawSymbolicBlackColoredPixmap(pixmap); + } else { + pixmap = drawSymbolicColoredPixmap(pixmap); + } + } + } + return pixmap; +} + //不通过任务栏获取屏幕可用区域数据 QVariantList getScreenGeometryList() { diff --git a/src/UtilityFunction/utility.h b/src/UtilityFunction/utility.h index 66a047c..7adee3e 100755 --- a/src/UtilityFunction/utility.h +++ b/src/UtilityFunction/utility.h @@ -71,6 +71,7 @@ bool checkOsRelease();//区分社区办与商业版 void centerToScreen(QWidget *widget); QIcon getCurIcon(const QString &iconPath, bool autoSet); +QPixmap getCurPixmap(const QString &iconPath, bool autoSet, int size); //获取用户图像 QString getUserIcon(); @@ -87,8 +88,9 @@ enum PanelPositon { extern QString g_projectCodeName; extern QString g_subProjectCodeName; extern QString g_platform; -extern bool g_menuStatus; extern QString g_curStyle; +extern bool g_menuStatus; +extern bool g_isFullScreen; #endif // UTILITY_H