From 032752faf933376f863405e05a1fe1a40425adee Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Thu, 2 Jul 2026 20:32:30 +0800 Subject: [PATCH] revert: remove the ability that disable built-in close window animation no need to preserve this option because frameless window and close window animation will be fully removed in future. --- app/mainwindow.cpp | 31 +++++++++++-------------------- app/mainwindow.h | 2 -- app/settings.cpp | 11 ----------- app/settings.h | 2 -- app/settingsdialog.cpp | 7 ------- app/settingsdialog.h | 1 - 6 files changed, 11 insertions(+), 43 deletions(-) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index e4660c2..0ea0872 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -75,7 +75,11 @@ MainWindow::MainWindow(QWidget *parent) m_exitAnimationGroup->addAnimation(m_fadeOutAnimation); m_exitAnimationGroup->addAnimation(m_floatUpAnimation); connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished, - this, &MainWindow::doCloseWindow); +#ifdef Q_OS_MAC + this, &QWidget::hide); +#else + this, &QWidget::close); +#endif GraphicsScene * scene = new GraphicsScene(this); @@ -592,16 +596,12 @@ void MainWindow::centerWindow() void MainWindow::closeWindow() { - if (Settings::instance()->useBuiltInCloseAnimation()) { - QRect windowRect(this->geometry()); - m_floatUpAnimation->setStartValue(windowRect); - m_floatUpAnimation->setEndValue(windowRect.adjusted(0, -80, 0, 0)); - m_floatUpAnimation->setStartValue(QRect(this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height())); - m_floatUpAnimation->setEndValue(QRect(this->geometry().x(), this->geometry().y()-80, this->geometry().width(), this->geometry().height())); - m_exitAnimationGroup->start(); - } else { - doCloseWindow(); - } + QRect windowRect(this->geometry()); + m_floatUpAnimation->setStartValue(windowRect); + m_floatUpAnimation->setEndValue(windowRect.adjusted(0, -80, 0, 0)); + m_floatUpAnimation->setStartValue(QRect(this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height())); + m_floatUpAnimation->setEndValue(QRect(this->geometry().x(), this->geometry().y()-80, this->geometry().width(), this->geometry().height())); + m_exitAnimationGroup->start(); } void MainWindow::updateWidgetsPosition() @@ -925,15 +925,6 @@ void MainWindow::on_actionQuitApp_triggered() quitAppAction(false); } -void MainWindow::doCloseWindow() -{ -#ifdef Q_OS_MAC - this->hide(); -#else - this->close(); -#endif -} - bool MainWindow::updateFileWatcher(const QString &basePath) { m_fileSystemWatcher->removePaths(m_fileSystemWatcher->files()); diff --git a/app/mainwindow.h b/app/mainwindow.h index de19e8f..42ff248 100644 --- a/app/mainwindow.h +++ b/app/mainwindow.h @@ -106,8 +106,6 @@ private slots: void on_actionLocateInFileManager_triggered(); void on_actionQuitApp_triggered(); - void doCloseWindow(); - private: bool updateFileWatcher(const QString & basePath = QString()); void updateGalleryButtonsVisibility(); diff --git a/app/settings.cpp b/app/settings.cpp index da71a27..cddd0fc 100644 --- a/app/settings.cpp +++ b/app/settings.cpp @@ -50,11 +50,6 @@ bool Settings::stayOnTop() const return m_qsettings->value("stay_on_top", true).toBool(); } -bool Settings::useBuiltInCloseAnimation() const -{ - return m_qsettings->value("use_built_in_close_animation", true).toBool(); -} - bool Settings::useLightCheckerboard() const { return m_qsettings->value("use_light_checkerboard", false).toBool(); @@ -112,12 +107,6 @@ void Settings::setStayOnTop(bool on) m_qsettings->sync(); } -void Settings::setUseBuiltInCloseAnimation(bool on) -{ - m_qsettings->setValue("use_built_in_close_animation", on); - m_qsettings->sync(); -} - void Settings::setUseLightCheckerboard(bool light) { m_qsettings->setValue("use_light_checkerboard", light); diff --git a/app/settings.h b/app/settings.h index 4bacf4a..93f509a 100644 --- a/app/settings.h +++ b/app/settings.h @@ -35,7 +35,6 @@ public: static Settings *instance(); bool stayOnTop() const; - bool useBuiltInCloseAnimation() const; bool useLightCheckerboard() const; bool loopGallery() const; bool svgTiny12Only() const; @@ -45,7 +44,6 @@ public: Qt::HighDpiScaleFactorRoundingPolicy hiDpiScaleFactorBehavior() const; void setStayOnTop(bool on); - void setUseBuiltInCloseAnimation(bool on); void setUseLightCheckerboard(bool light); void setLoopGallery(bool on); void setSvgTiny12Only(bool on); diff --git a/app/settingsdialog.cpp b/app/settingsdialog.cpp index 9ba70d3..51a730e 100644 --- a/app/settingsdialog.cpp +++ b/app/settingsdialog.cpp @@ -20,7 +20,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent) , m_stayOnTop(new QCheckBox) - , m_useBuiltInCloseAnimation(new QCheckBox) , m_useLightCheckerboard(new QCheckBox) , m_loopGallery(new QCheckBox) , m_svgTiny12Only(new QCheckBox) @@ -121,7 +120,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) } settingsForm->addRow(tr("Stay on top when start-up"), m_stayOnTop); - settingsForm->addRow(tr("Use built-in close window animation"), m_useBuiltInCloseAnimation); settingsForm->addRow(tr("Use light-color checkerboard"), m_useLightCheckerboard); settingsForm->addRow(tr("Loop the loaded gallery"), m_loopGallery); settingsForm->addRow(tr("Limit SVG support to SVG Tiny 1.2"), m_svgTiny12Only); @@ -131,7 +129,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) settingsForm->addRow(tr("HiDPI scale factor rounding policy"), m_hiDpiRoundingPolicyBehavior); m_stayOnTop->setChecked(Settings::instance()->stayOnTop()); - m_useBuiltInCloseAnimation->setChecked(Settings::instance()->useBuiltInCloseAnimation()); m_useLightCheckerboard->setChecked(Settings::instance()->useLightCheckerboard()); m_loopGallery->setChecked(Settings::instance()->loopGallery()); m_svgTiny12Only->setChecked(Settings::instance()->svgTiny12Only()); @@ -165,10 +162,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) Settings::instance()->setStayOnTop(state == Qt::Checked); }); - connect(m_useBuiltInCloseAnimation, &QCHECKBOX_CHECKSTATECHANGED, this, [ = ](QT_CHECKSTATE state){ - Settings::instance()->setUseBuiltInCloseAnimation(state == Qt::Checked); - }); - connect(m_useLightCheckerboard, &QCHECKBOX_CHECKSTATECHANGED, this, [ = ](QT_CHECKSTATE state){ Settings::instance()->setUseLightCheckerboard(state == Qt::Checked); }); diff --git a/app/settingsdialog.h b/app/settingsdialog.h index 6654317..84a1717 100644 --- a/app/settingsdialog.h +++ b/app/settingsdialog.h @@ -23,7 +23,6 @@ public slots: private: QCheckBox * m_stayOnTop = nullptr; - QCheckBox * m_useBuiltInCloseAnimation = nullptr; QCheckBox * m_useLightCheckerboard = nullptr; QCheckBox * m_loopGallery = nullptr; QCheckBox * m_svgTiny12Only = nullptr;