From 8fdc51a6268ec28e323e1ef8c9c4a05f7aa11450 Mon Sep 17 00:00:00 2001 From: momen Date: Tue, 5 May 2026 15:15:52 +0800 Subject: [PATCH] Bump version 5.1.2 --- debian/changelog | 5 +- src/frame/modules/update/updatectrlwidget.cpp | 11 ++++- src/frame/modules/update/updatectrlwidget.h | 1 + src/frame/modules/update/updatemodel.cpp | 14 ++++++ src/frame/modules/update/updatemodel.h | 4 ++ src/frame/modules/update/updatework.cpp | 47 +++++++++++++------ src/frame/modules/update/updatework.h | 2 + 7 files changed, 66 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index d4a6b15..66636fd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -gxde-control-center (5.1.1) UNRELEASED; urgency=medium +gxde-control-center (5.1.2) UNRELEASED; urgency=medium * 修复屏幕缩放调整条不对准刻度的问题 * 修复系统信息在时间异常时显示类似 ©2023-1970 等错误信息的问题 @@ -32,8 +32,9 @@ gxde-control-center (5.1.1) UNRELEASED; urgency=medium * 调整刷新按钮位置并使用 aptss apt 配置计算下载大小 * 为更新安装阶段补充非交互环境和 dpkg 配置策略 * 下载大小为 0 或获取不到时隐藏,并补充更新进度状态翻译 + * 仅在更新 dde、deepin 或 gxde 相关包后提示重启 - -- gfdgd_xi <3025613752@qq.com> Tue, 05 May 2026 13:05:48 +0800 + -- gfdgd_xi <3025613752@qq.com> Tue, 05 May 2026 13:18:34 +0800 gxde-control-center (4.10.29.1) UNRELEASED; urgency=medium diff --git a/src/frame/modules/update/updatectrlwidget.cpp b/src/frame/modules/update/updatectrlwidget.cpp index 00c38eb..b4c40cf 100644 --- a/src/frame/modules/update/updatectrlwidget.cpp +++ b/src/frame/modules/update/updatectrlwidget.cpp @@ -267,7 +267,7 @@ void UpdateCtrlWidget::setStatus(const UpdatesStatus &status) case UpdatesStatus::UpdateSucceeded: m_resultItem->setSuccess(true); m_resultGroup->setVisible(true); - m_reminderTip->setVisible(true); + m_reminderTip->setVisible(m_model->restartRequired()); break; case UpdatesStatus::UpdateFailed: m_resultGroup->setVisible(true); @@ -410,6 +410,13 @@ void UpdateCtrlWidget::setLowBattery(const bool &lowBattery) } } +void UpdateCtrlWidget::setRestartRequired(const bool &restartRequired) +{ + if (m_status == UpdatesStatus::UpdateSucceeded) { + m_reminderTip->setVisible(restartRequired); + } +} + void UpdateCtrlWidget::setUpdateProgress(const double value) { m_checkUpdateItem->setProgressValue(value * 100); @@ -421,6 +428,7 @@ void UpdateCtrlWidget::setModel(UpdateModel *model) connect(m_model, &UpdateModel::statusChanged, this, &UpdateCtrlWidget::setStatus); connect(m_model, &UpdateModel::lowBatteryChanged, this, &UpdateCtrlWidget::setLowBattery); + connect(m_model, &UpdateModel::restartRequiredChanged, this, &UpdateCtrlWidget::setRestartRequired); connect(m_model, &UpdateModel::downloadInfoChanged, this, &UpdateCtrlWidget::setDownloadInfo); connect(m_model, &UpdateModel::upgradeProgressChanged, this, &UpdateCtrlWidget::setProgressValue); connect(m_model, &UpdateModel::upgradeMessageChanged, this, &UpdateCtrlWidget::setUpgradeMessage); @@ -433,6 +441,7 @@ void UpdateCtrlWidget::setModel(UpdateModel *model) setFailureMessage(m_model->failureMessage()); setStatus(m_model->status()); setLowBattery(m_model->lowBattery()); + setRestartRequired(m_model->restartRequired()); setDownloadInfo(m_model->downloadInfo()); } diff --git a/src/frame/modules/update/updatectrlwidget.h b/src/frame/modules/update/updatectrlwidget.h index 812a85f..2fb1e3a 100644 --- a/src/frame/modules/update/updatectrlwidget.h +++ b/src/frame/modules/update/updatectrlwidget.h @@ -81,6 +81,7 @@ private: void setDownloadInfo(DownloadInfo *downloadInfo); void setProgressValue(const double value); void setLowBattery(const bool &lowBattery); + void setRestartRequired(const bool &restartRequired); void setUpdateProgress(const double value); void setUpgradeMessage(const QString &message); void setFailureMessage(const QString &message); diff --git a/src/frame/modules/update/updatemodel.cpp b/src/frame/modules/update/updatemodel.cpp index 396cd6d..174f229 100644 --- a/src/frame/modules/update/updatemodel.cpp +++ b/src/frame/modules/update/updatemodel.cpp @@ -52,6 +52,7 @@ UpdateModel::UpdateModel(QObject *parent) : m_downloadInfo(nullptr), m_upgradeProgress(0), m_lowBattery(false), + m_restartRequired(false), m_autoDownloadUpdates(true), m_mirrorId("") { @@ -112,6 +113,11 @@ bool UpdateModel::lowBattery() const return m_lowBattery; } +bool UpdateModel::restartRequired() const +{ + return m_restartRequired; +} + void UpdateModel::setLowBattery(bool lowBattery) { if (lowBattery != m_lowBattery) { @@ -120,6 +126,14 @@ void UpdateModel::setLowBattery(bool lowBattery) } } +void UpdateModel::setRestartRequired(bool restartRequired) +{ + if (restartRequired != m_restartRequired) { + m_restartRequired = restartRequired; + Q_EMIT restartRequiredChanged(restartRequired); + } +} + bool UpdateModel::autoDownloadUpdates() const { return m_autoDownloadUpdates; diff --git a/src/frame/modules/update/updatemodel.h b/src/frame/modules/update/updatemodel.h index 45cf272..59966c2 100644 --- a/src/frame/modules/update/updatemodel.h +++ b/src/frame/modules/update/updatemodel.h @@ -79,6 +79,8 @@ public: bool lowBattery() const; void setLowBattery(bool lowBattery); + bool restartRequired() const; + void setRestartRequired(bool restartRequired); bool autoDownloadUpdates() const; void setAutoDownloadUpdates(bool autoDownloadUpdates); @@ -116,6 +118,7 @@ Q_SIGNALS: void smartMirrorSwitchChanged(bool smartMirrorSwitch); void lowBatteryChanged(const bool &lowBattery); + void restartRequiredChanged(const bool &restartRequired); void statusChanged(const UpdatesStatus &status); #ifndef DISABLE_SYS_UPDATE_SOURCE_CHECK @@ -146,6 +149,7 @@ private: #endif bool m_lowBattery; + bool m_restartRequired; bool m_netselectExist; bool m_autoCleanCache; bool m_autoDownloadUpdates; diff --git a/src/frame/modules/update/updatework.cpp b/src/frame/modules/update/updatework.cpp index b5f358b..b722f25 100644 --- a/src/frame/modules/update/updatework.cpp +++ b/src/frame/modules/update/updatework.cpp @@ -412,7 +412,10 @@ void UpdateWorker::distUpgradePackages(const QStringList &packages) return; } + const bool restartRequired = packageUpdatesNeedRestart(packages); + m_model->setStatus(UpdatesStatus::Installing); + m_model->setRestartRequired(restartRequired); m_model->setFailureMessage(QString()); m_model->setUpgradeProgress(0); m_model->setUpgradeMessage(tr("Downloading updates...")); @@ -467,13 +470,7 @@ void UpdateWorker::distUpgradePackages(const QStringList &packages) m_model->setFailureMessage(QString()); m_model->setStatus(UpdatesStatus::UpdateSucceeded); - QProcess::startDetached("/usr/lib/gxde-control-center/reboot-reminder-dialog"); - - QFile file("/tmp/.dcc-update-successd"); - if (!file.exists()) { - file.open(QIODevice::WriteOnly); - file.close(); - } + showRestartReminderIfNeeded(m_model->restartRequired()); } else { qWarning() << "aptss upgrade failed" << "exitCode:" << exitCode @@ -636,6 +633,33 @@ QStringList UpdateWorker::upgradablePackages() const return packages; } +bool UpdateWorker::packageUpdatesNeedRestart(const QStringList &packages) const +{ + for (const QString &package : packages) { + const QString name = package.toLower(); + if (name.contains("dde") || name.contains("deepin") || name.contains("gxde")) { + return true; + } + } + + return false; +} + +void UpdateWorker::showRestartReminderIfNeeded(bool restartRequired) +{ + if (!restartRequired) { + return; + } + + QProcess::startDetached("/usr/lib/gxde-control-center/reboot-reminder-dialog"); + + QFile file("/tmp/.dcc-update-successd"); + if (!file.exists()) { + file.open(QIODevice::WriteOnly); + file.close(); + } +} + void UpdateWorker::clearAptssProcess() { if (!m_aptssProcess) { @@ -919,14 +943,7 @@ void UpdateWorker::onUpgradeStatusChanged(const QString &status) m_distUpgradeJob->deleteLater(); m_model->setStatus(UpdatesStatus::UpdateSucceeded); - - QProcess::startDetached("/usr/lib/gxde-control-center/reboot-reminder-dialog"); - - QFile file("/tmp/.dcc-update-successd"); - if (file.exists()) - return; - file.open(QIODevice::WriteOnly); - file.close(); + showRestartReminderIfNeeded(m_model->restartRequired()); } } diff --git a/src/frame/modules/update/updatework.h b/src/frame/modules/update/updatework.h index f53eeb2..40e0a65 100644 --- a/src/frame/modules/update/updatework.h +++ b/src/frame/modules/update/updatework.h @@ -112,6 +112,8 @@ private: void runAptssCheckList(); void runAptssDownloadSize(const QList &infos, const QStringList &packages); QStringList upgradablePackages() const; + bool packageUpdatesNeedRestart(const QStringList &packages) const; + void showRestartReminderIfNeeded(bool restartRequired); void clearAptssProcess(); private: -- Gitee