mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-10-26 20:22:20 +08:00
main.cpp 中通过 QStandardPaths 获取配置文件路径,此时未设置组织名称和程序名称,导致路径异常 Log: 1. main.cpp 中提前设置组织名称和程序名称,再读写配置文件 2. main.cpp 中提前检查配置文件所在文件夹是否存在,不存在则创建,再读写配置文件 3. 修复 main.cpp 中修改配置文件后没有写入的问题 4. 去除版本号中重复的 Version 字样(由关于窗口提供) 5. 修复关于窗口中组织图标显示为 deepin 的问题(已去除) 6. 修复 wayland 下窗口设置透明度相关警告(wayland 下禁用透明度动画) 7. 下载列表 wayland 下窗口标题添加翻译
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
#include "basewidgetopacity.h"
|
|
|
|
#include <QCloseEvent>
|
|
#include <QSettings>
|
|
#include <QStandardPaths>
|
|
#include <QPropertyAnimation>
|
|
|
|
BaseWidgetOpacity::BaseWidgetOpacity(QWidget *parent) : DBlurEffectWidget(parent)
|
|
{
|
|
// WidgetAnimation::widgetOpacity(this,true);
|
|
}
|
|
|
|
/// @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();
|
|
if(isWayland)
|
|
{
|
|
return DBlurEffectWidget::closeEvent(event);
|
|
}
|
|
|
|
if (!closeWindowAnimation)
|
|
{
|
|
closeWindowAnimation = true;
|
|
|
|
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
|
|
{
|
|
event->accept();
|
|
}
|
|
}
|