diff --git a/src/dcc-update-plugin/operation/updatedatastructs.h b/src/dcc-update-plugin/operation/updatedatastructs.h index 4e4bce3b2..2a600b09d 100644 --- a/src/dcc-update-plugin/operation/updatedatastructs.h +++ b/src/dcc-update-plugin/operation/updatedatastructs.h @@ -316,7 +316,11 @@ inline QString transferDeliveryConfigToLastoreDeliveryConfig(const QString& deli LastoreUpgradeSpeedLimitConfig lastoreDeliveryConfig; lastoreDeliveryConfig.isOnlineSpeedLimit = UpgradeSpeedLimitConfig::fromJson(deliveryConfig.toUtf8()).ifInOnlineLimit(); lastoreDeliveryConfig.speedLimitEnabled = UpgradeSpeedLimitConfig::fromJson(deliveryConfig.toUtf8()).shouldLimitRate(); - lastoreDeliveryConfig.limitSpeed = QString::number(UpgradeSpeedLimitConfig::fromJson(deliveryConfig.toUtf8()).currentRate); + if (lastoreDeliveryConfig.isOnlineSpeedLimit) { + lastoreDeliveryConfig.limitSpeed = QString::number(UpgradeSpeedLimitConfig::fromJson(deliveryConfig.toUtf8()).currentRate); + } else { + lastoreDeliveryConfig.limitSpeed = QString::number(UpgradeSpeedLimitConfig::fromJson(deliveryConfig.toUtf8()).limitRate); + } return lastoreDeliveryConfig.toJson(); } diff --git a/src/dcc-update-plugin/qml/UpdateSetting.qml b/src/dcc-update-plugin/qml/UpdateSetting.qml index bb8841b13..18f00ed4d 100644 --- a/src/dcc-update-plugin/qml/UpdateSetting.qml +++ b/src/dcc-update-plugin/qml/UpdateSetting.qml @@ -14,7 +14,6 @@ import org.deepin.dcc.update 1.0 DccObject { id: root property bool syncingUpgradeDeliverySwitch: false - property bool pendingUpgradeDeliveryEnabled: dccData.model().upgradeDeliveryEnable FontMetrics { id: fm @@ -34,7 +33,7 @@ DccObject { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap - text: qsTr("Failed to change Upgrade Delivery setting") + text: qsTr("Failed to change Delivery Optimization setting") } Item { @@ -48,12 +47,15 @@ DccObject { spacing: 10 ButtonWithToolTip { - text: qsTr("OK") + text: qsTr("Cancel") Layout.fillWidth: true focus: upgradeDeliverySetConfigFailedDialog.visible onClicked: { upgradeDeliverySetConfigFailedDialog.close() } + Keys.onEscapePressed: { + upgradeDeliverySetConfigFailedDialog.close() + } } component ButtonWithToolTip: D.Button { @@ -103,8 +105,7 @@ DccObject { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap - text: root.pendingUpgradeDeliveryEnabled ? qsTr("Update Delivery Optimization service exception. Failed to enable.") - : qsTr("Update Delivery Optimization service exception. Failed to disable.") + text: qsTr("Update Delivery Optimization service exception") } Item { @@ -123,12 +124,15 @@ DccObject { focus: upgradeDeliverySetEnableFailedDialog.visible onClicked: { upgradeDeliverySetEnableFailedDialog.close() - dccData.work().setUpgradeDeliveryEnabled(root.pendingUpgradeDeliveryEnabled, true) + dccData.work().setUpgradeDeliveryEnabled(!dccData.model().upgradeDeliveryEnable, true) + } + Keys.onEscapePressed: { + upgradeDeliverySetEnableFailedDialog.close() } } EnableFailedDialogButton { - text: qsTr("OK") + text: qsTr("Cancel") Layout.fillWidth: true onClicked: { upgradeDeliverySetEnableFailedDialog.close() @@ -173,6 +177,7 @@ DccObject { parentName: "updateSettingsPage" displayName: qsTr("Update Type") weight: 10 + visible: !dccData.model().isPrivateUpdate } DccObject { @@ -181,6 +186,7 @@ DccObject { parentName: "updateSettingsPage" weight: 20 pageType: DccObject.Item + visible: !dccData.model().isPrivateUpdate page: DccGroupView { height: implicitHeight + 10 spacing: 0 @@ -245,7 +251,7 @@ DccObject { DccObject { id: advancedSetting - property bool showDetails: false + property bool showDetails: dccData.model().isPrivateUpdate name: "advancedSettingTitle" parentName: "updateSettingsPage" displayName: qsTr("Advanced Settings") @@ -253,7 +259,7 @@ DccObject { pageType: DccObject.Item page: RowLayout { Component.onDestruction: { - advancedSetting.showDetails = false + advancedSetting.showDetails = false || dccData.model().isPrivateUpdate } DccLabel { property D.Palette textColor: D.Palette { @@ -335,10 +341,10 @@ DccObject { DccObject { name: "upgradeDeliverySwitch" parentName: "upgradeDeliveryGrp" - displayName: qsTr("Upgrade Delivery") + displayName: qsTr("Delivery Optimization") description: qsTr("When enabled, your device may share previously downloaded system updates with other devices on your local network.When you turn it off, cached files from update delivery will be cleared during the next restart.") weight: 10 - enabled: !dccData.model().updateProhibited + enabled: !dccData.model().isPrivateUpdate pageType: DccObject.Editor page: D.Switch { id: upgradeDeliverySwitch @@ -347,7 +353,6 @@ DccObject { if (root.syncingUpgradeDeliverySwitch) { return } - root.pendingUpgradeDeliveryEnabled = checked dccData.work().setUpgradeDeliveryEnabled(checked) } Connections { @@ -365,7 +370,7 @@ DccObject { id: upgradeDeliveryUploadLimitSetting name: "upgradeDeliveryUploadLimitSetting" parentName: "upgradeDeliveryGrp" - displayName: qsTr("Upgrade Delivery Upload Limit Setting") + displayName: qsTr("Delivery Optimization-Upload throttling") visible: dccData.model().upgradeDeliveryEnable weight: 20 enabled: !dccData.model().upgradeUploadSpeedIsOnline @@ -465,9 +470,9 @@ DccObject { id: upgradeDeliveryDownloadLimitSetting name: "upgradeDeliveryDownloadLimitSetting" parentName: "upgradeDeliveryGrp" - displayName: qsTr("Upgrade Delivery Download Limit Setting") + displayName: qsTr("Delivery Optimization-Limit Speed") visible: dccData.model().upgradeDeliveryEnable - weight: 20 + weight: 30 enabled: !dccData.model().upgradeDownloadSpeedIsOnline pageType: DccObject.Item Connections { @@ -566,7 +571,7 @@ DccObject { id: downloadLimitGrp name: "downloadLimitGrp" parentName: "advancedSettingGroup" - weight: 40 + weight: 50 enabled: !dccData.model().downloadIsOnlineSpeedLimit pageType: DccObject.Item page: DccGroupView { diff --git a/src/dcc-update-plugin/translations/update_en.ts b/src/dcc-update-plugin/translations/update_en.ts index edb5f7409..a94515042 100644 --- a/src/dcc-update-plugin/translations/update_en.ts +++ b/src/dcc-update-plugin/translations/update_en.ts @@ -422,6 +422,22 @@ Delivers updates for additional repository sources + + Delivery Optimization + + + + When enabled, your device may share previously downloaded system updates with other devices on your local network.When you turn it off, cached files from update delivery will be cleared during the next restart. + + + + Delivery Optimization-Limit Speed + + + + Delivery Optimization-Upload throttling + + Limit Speed @@ -494,6 +510,22 @@ Only numbers between 10-999999 are allowed + + Failed to change Delivery Optimization setting + + + + Update Delivery Optimization service exception + + + + Retry + + + + Cancel + + Join the internal testing channel to get deepin latest updates. diff --git a/src/dcc-update-plugin/translations/update_en_US.ts b/src/dcc-update-plugin/translations/update_en_US.ts index 0d2777b6f..c9b68a0ad 100644 --- a/src/dcc-update-plugin/translations/update_en_US.ts +++ b/src/dcc-update-plugin/translations/update_en_US.ts @@ -422,6 +422,22 @@ Delivers updates for additional repository sources + + Delivery Optimization + + + + When enabled, your device may share previously downloaded system updates with other devices on your local network.When you turn it off, cached files from update delivery will be cleared during the next restart. + + + + Delivery Optimization-Limit Speed + + + + Delivery Optimization-Upload throttling + + Limit Speed @@ -490,6 +506,26 @@ Only numbers between 1-99999 are allowed + + Only numbers between 10-999999 are allowed + + + + Failed to change Delivery Optimization setting + + + + Update Delivery Optimization service exception + + + + Retry + + + + Cancel + + Join the internal testing channel to get deepin latest updates. diff --git a/src/dcc-update-plugin/translations/update_zh_CN.ts b/src/dcc-update-plugin/translations/update_zh_CN.ts index 31dd7ee24..77908728c 100644 --- a/src/dcc-update-plugin/translations/update_zh_CN.ts +++ b/src/dcc-update-plugin/translations/update_zh_CN.ts @@ -443,7 +443,7 @@ 提供额外添加的仓库源更新内容 - Upgrade Delivery + Delivery Optimization 传递优化 @@ -451,12 +451,12 @@ 开启此功能,你的设备可能会将以前下载的部分系统更新发送到本地网络的设备上。关闭此功能后,将在重启时清除传递优化时缓存的文件 - Upgrade Delivery Download Limit Setting - 下载限速 + Delivery Optimization-Limit Speed + 传递优化-下载限速 - Upgrade Delivery Upload Limit Setting - 上传限速 + Delivery Optimization-Upload throttling + 传递优化-上传限速 Limit Speed @@ -531,24 +531,20 @@ 只允许输入10-999999 - Failed to change Upgrade Delivery setting + Failed to change Delivery Optimization setting 更新传递优化服务异常 - Update Delivery Optimization service exception. Failed to enable. - 更新传递优化服务异常,开启失败 - - - Update Delivery Optimization service exception. Failed to disable. - 更新传递优化服务异常,关闭失败 + Update Delivery Optimization service exception + 更新传递优化服务异常 Retry 再试一次 - OK - 确定 + Cancel + 取消 Join the internal testing channel to get deepin latest updates. diff --git a/src/dcc-update-plugin/translations/update_zh_HK.ts b/src/dcc-update-plugin/translations/update_zh_HK.ts index 19da3bab1..5bc34bc04 100644 --- a/src/dcc-update-plugin/translations/update_zh_HK.ts +++ b/src/dcc-update-plugin/translations/update_zh_HK.ts @@ -443,7 +443,7 @@ 提供額外添加的倉庫源更新內容 - Upgrade Delivery + Delivery Optimization 傳遞優化 @@ -451,12 +451,12 @@ 開啟此功能,你的裝置可能會將以前下載的部分系統更新傳送到本地網絡的裝置上。關閉此功能後,將在重新啟動時清除更新傳遞時快取的檔案 - Upgrade Delivery Download Limit Setting - 下載限速 + Delivery Optimization-Limit Speed + 傳遞優化-下載限速 - Upgrade Delivery Upload Limit Setting - 上傳限速 + Delivery Optimization-Upload throttling + 傳遞優化-上傳限速 Limit Speed @@ -527,24 +527,20 @@ 只允許輸入1-99999 - Failed to change Upgrade Delivery setting + Failed to change Delivery Optimization setting 更新傳遞優化服務異常 - Update Delivery Optimization service exception. Failed to enable. - 更新傳遞優化服務異常,開啓失敗 - - - Update Delivery Optimization service exception. Failed to disable. - 更新傳遞優化服務異常,關閉失敗 + Update Delivery Optimization service exception + 更新傳遞優化服務異常 Retry 再試一次 - OK - 確定 + Cancel + 取消 Join the internal testing channel to get deepin latest updates. diff --git a/src/dcc-update-plugin/translations/update_zh_TW.ts b/src/dcc-update-plugin/translations/update_zh_TW.ts index 282b0c5e7..c75638f3c 100644 --- a/src/dcc-update-plugin/translations/update_zh_TW.ts +++ b/src/dcc-update-plugin/translations/update_zh_TW.ts @@ -443,7 +443,7 @@ 提供額外新增的倉庫源更新內容 - Upgrade Delivery + Delivery Optimization 傳遞優化 @@ -451,12 +451,12 @@ 開啟此功能,你的裝置可能會將以前下載的部分系統更新傳送到本機網路的裝置上。關閉此功能後,將在重新啟動時清除更新傳遞時快取的檔案 - Upgrade Delivery Download Limit Setting - 下載限速 + Delivery Optimization-Limit Speed + 傳遞優化-下載限速 - Upgrade Delivery Upload Limit Setting - 上傳限速 + Delivery Optimization-Upload throttling + 傳遞優化-上傳限速 Limit Speed @@ -527,24 +527,20 @@ 只允許輸入1-99999 - Failed to change Upgrade Delivery setting + Failed to change Delivery Optimization setting 更新傳遞優化服務異常 - Update Delivery Optimization service exception. Failed to enable. - 更新傳遞優化服務異常,開啟失敗 - - - Update Delivery Optimization service exception. Failed to disable. - 更新傳遞優化服務異常,關閉失敗 + Update Delivery Optimization service exception + 更新傳遞優化服務異常 Retry 再試一次 - OK - 確定 + Cancel + 取消 Join the internal testing channel to get deepin latest updates. diff --git a/src/dock-update-plugin/pluginupdateplugin.cpp b/src/dock-update-plugin/pluginupdateplugin.cpp index 9195ace5d..6a1d6e418 100644 --- a/src/dock-update-plugin/pluginupdateplugin.cpp +++ b/src/dock-update-plugin/pluginupdateplugin.cpp @@ -40,6 +40,7 @@ PluginUpdatePlugin::PluginUpdatePlugin(QObject *parent) , m_currentState(UpdateState::UpdatesAvailable) , m_updateMode(0) , m_shouldShow(false) + , m_isPrivateUpdate(false) { m_tipsLabel->setVisible(false); m_tipsLabel->setAccessibleName("plugin-update"); @@ -239,7 +240,7 @@ void PluginUpdatePlugin::loadPlugin() void PluginUpdatePlugin::refreshPluginItemsVisible() { - bool shouldShow = !pluginIsDisable() && m_shouldShow; + bool shouldShow = !pluginIsDisable() && m_shouldShow && !m_isPrivateUpdate; if (!shouldShow) { if (m_pluginLoaded) { @@ -288,6 +289,8 @@ void PluginUpdatePlugin::onConfigChanged(const QString &key) } else if (key == "update-status") { m_updateStatus = m_dconfig->value("update-status", QVariant()); qCInfo(dockUpdatePlugin) << "UpdateStatus changed to:" << m_updateStatus; + } else if (key == "intranet-update") { + m_isPrivateUpdate = m_dconfig->value("intranet-update", false).toBool(); } //对dconfig获取的数据进行解析,从而处理更新的状态和是否显示 updateStateFromUpdateStatus(); diff --git a/src/dock-update-plugin/pluginupdateplugin.h b/src/dock-update-plugin/pluginupdateplugin.h index 1f73ed669..af3f60fad 100644 --- a/src/dock-update-plugin/pluginupdateplugin.h +++ b/src/dock-update-plugin/pluginupdateplugin.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2025-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -76,6 +76,7 @@ class PluginUpdatePlugin : public QObject, PluginsItemInterfaceV2 int m_updateMode; QVariant m_updateStatus; bool m_shouldShow; + bool m_isPrivateUpdate; }; Q_DECLARE_METATYPE(UpdateState)