676 lines
24 KiB
Diff
676 lines
24 KiB
Diff
From: =?utf-8?b?5byg5aSp5rO9?=
|
|
<11297911+zhang_tian_ze@user.noreply.gitee.com>
|
|
Date: Thu, 15 Dec 2022 06:03:50 +0000
|
|
Subject: =?utf-8?b?ITQzIOWinuWKoOaUtuiXj+acgOi/keeEpueCueaJk+W8gO+8jOWQjA==?=
|
|
=?utf-8?b?5q2ldXBzdHJlYW3vvIzlop7liqBEZWJpYW4gTWVyZ2UgcHVsbCByZXF1ZXN0ICE0?=
|
|
=?utf-8?b?MyBmcm9tIOW8oOWkqeazvS9vcGVua3lsaW4veWFuZ3R6ZQ==?=
|
|
|
|
---
|
|
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 +-
|
|
15 files changed, 304 insertions(+), 40 deletions(-)
|
|
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/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 <QObject>
|
|
+#include <QLabel>
|
|
+#include <QPushButton>
|
|
+#include <QStylePainter>
|
|
+#include <QStyleOption>
|
|
+#include <QHBoxLayout>
|
|
+#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 <QDebug>
|
|
+
|
|
+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 <QObject>
|
|
+#include <QLabel>
|
|
+#include <QPaintEvent>
|
|
+#include <QStylePainter>
|
|
+#include <QStyleOption>
|
|
+
|
|
+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 <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
-#ifndef PUSHBUTTON_H
|
|
-#define PUSHBUTTON_H
|
|
+#ifndef SPLITBARFRAME_H
|
|
+#define SPLITBARFRAME_H
|
|
#include <QPushButton>
|
|
#include <QHBoxLayout>
|
|
#include <QLabel>
|
|
@@ -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
|