fix: 修复 Deepin 系统上显示“开发者模式未开启”的问题

没有区分 Deepin 和 UOS,在 Deepin 上对开发者模式状态文件进行判断,可能造成错误

Log: 添加判断区分 Deepin 和 UOS,仅在 UOS 判断开发者模式状态文件;优化 main 函数长度,将环境变量设置和 config.ini 读写放入 Utils 独立静态函数中调用;修复从托盘打开主界面时透明度动画不流畅的问题;优化关闭窗口动画代码,与打开窗口动画代码合并;修复主窗口关闭时,从托盘打开关于对话框后,调起主窗口会遮挡关于对话框的问题
This commit is contained in:
zty199
2023-02-05 22:20:19 +08:00
parent de2db98324
commit ab6c3d37d2
9 changed files with 228 additions and 106 deletions

View File

@@ -1,5 +1,6 @@
#include "basewidgetopacity.h"
#include "utils/widgetanimation.h"
#include "utils/utils.h"
#include <QSettings>
#include <QStandardPaths>
@@ -8,7 +9,6 @@
BaseWidgetOpacity::BaseWidgetOpacity(QWidget *parent) : DBlurEffectWidget(parent)
{
// WidgetAnimation::widgetOpacity(this,true);
}
/**
@@ -19,7 +19,7 @@ void BaseWidgetOpacity::showEvent(QShowEvent *event)
{
// FIXME: wayland 不支持直接设置窗口透明度,需要调用 wayland 相关库(考虑抄控制中心“窗口移动时启用透明特效”代码?)
QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat);
bool isWayland = config.value("build/isWayland").toBool();
bool isWayland = Utils::isWayland();
if (!isWayland)
{
if (!showWindowAnimation)
@@ -32,13 +32,15 @@ void BaseWidgetOpacity::showEvent(QShowEvent *event)
DBlurEffectWidget::showEvent(event);
}
/// @brief 窗口关闭事件
/// @param event
/**
* @brief 窗口关闭事件
* @param event
*/
void BaseWidgetOpacity::closeEvent(QCloseEvent *event)
{
// FIXME: wayland 不支持直接设置窗口透明度,需要调用 wayland 相关库(考虑抄控制中心“窗口移动时启用透明特效”代码?)
QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat);
bool isWayland = config.value("build/isWayland").toBool();
bool isWayland = Utils::isWayland();
if (isWayland)
{
return DBlurEffectWidget::closeEvent(event);
@@ -47,23 +49,8 @@ void BaseWidgetOpacity::closeEvent(QCloseEvent *event)
if (!closeWindowAnimation)
{
closeWindowAnimation = true;
WidgetAnimation::widgetOpacity(this, false);
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
animation->setEasingCurve(QEasingCurve::OutQuart);
animation->setDuration(500);
animation->setStartValue(1.0);
animation->setEndValue(0.0);
QObject::connect(animation, &QPropertyAnimation::valueChanged, this, [=](const QVariant &value)
{
this->update();
// setWindowTitle(QString("ヾ(⌒∇⌒*)See You♪ - %1%").arg(int(value.toFloat() * 100)));
});
QObject::connect(animation, &QPropertyAnimation::finished, this, [=]()
{ this->close(); });
animation->start();
event->ignore();
}
else