diff --git a/src/langs/zh_Hans.txt b/src/langs/zh_Hans.txt
index 3e755c2..68f327e 100644
--- a/src/langs/zh_Hans.txt
+++ b/src/langs/zh_Hans.txt
@@ -190,6 +190,8 @@ Supported Placeholder=支持的占位符
AriaNg Title=AriaNg 标题
Current RPC Alias=当前 RPC 别名
Downloading Count=正在下载数量
+Overall Completed Percent=整体完成进度
+Completed Percent=完成进度
Waiting Count=正在等待数量
Stopped Count=已停止数量
You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已经在浏览器中禁用通知功能. 如需使用此功能, 请修改您浏览器的设置.
diff --git a/src/langs/zh_Hant.txt b/src/langs/zh_Hant.txt
index ec01f78..2dccf43 100644
--- a/src/langs/zh_Hant.txt
+++ b/src/langs/zh_Hant.txt
@@ -189,6 +189,8 @@ Data has been copied to clipboard.=資料已經複製到剪貼簿中.
Supported Placeholder=支援的預留位置
AriaNg Title=AriaNg 標題
Downloading Count=正在下載數量
+Overall Completed Percent=整體完成進度
+Completed Percent=完成進度
Current RPC Alias=目前 RPC 別名
Waiting Count=正在等待數量
Stopped Count=已停止數量
diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js
index fc7bd7d..f0d478b 100644
--- a/src/scripts/config/defaultLanguage.js
+++ b/src/scripts/config/defaultLanguage.js
@@ -194,6 +194,8 @@
'AriaNg Title': 'AriaNg Title',
'Current RPC Alias': 'Current RPC Alias',
'Downloading Count': 'Downloading Count',
+ 'Overall Completed Percent': 'Overall Completed Percent',
+ 'Completed Percent': 'Completed Percent',
'Waiting Count': 'Waiting Count',
'Stopped Count': 'Stopped Count',
'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.': 'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.',
diff --git a/src/scripts/controllers/main.js b/src/scripts/controllers/main.js
index c9cbffc..3ebe41d 100644
--- a/src/scripts/controllers/main.js
+++ b/src/scripts/controllers/main.js
@@ -8,6 +8,7 @@
var refreshPageTitle = function () {
$document[0].title = ariaNgTitleService.getFinalTitleByGlobalStat({
globalStat: $scope.globalStat,
+ completedPercent: $rootScope.taskContext.getOverallPercent(),
currentRpcProfile: getCurrentRPCProfile()
});
};
diff --git a/src/scripts/core/root.js b/src/scripts/core/root.js
index 39d1cef..e73b641 100644
--- a/src/scripts/core/root.js
+++ b/src/scripts/core/root.js
@@ -99,6 +99,27 @@
list: [],
selected: {},
enableSelectAll: false,
+ getOverallPercent: function () {
+ var allCompletedLength = 0;
+ var allTotalLength = 0;
+
+ if (!this.list || this.list.length < 1) {
+ return 0;
+ }
+
+ for (var i = 0; i < this.list.length; i++) {
+ var task = this.list[i];
+
+ allCompletedLength += task.completedLength;
+ allTotalLength += task.totalLength;
+ }
+
+ if (allCompletedLength <= 0 || allTotalLength <= 0) {
+ return 0;
+ }
+
+ return allCompletedLength / allTotalLength * 100;
+ },
getSelectedTaskIds: function () {
var result = [];
diff --git a/src/scripts/services/ariaNgTitleService.js b/src/scripts/services/ariaNgTitleService.js
index bf3b823..ef99d14 100644
--- a/src/scripts/services/ariaNgTitleService.js
+++ b/src/scripts/services/ariaNgTitleService.js
@@ -34,6 +34,10 @@
value = $filter('readableVolume')(value, context.scale);
}
+ if (context.type === 'percent') {
+ value = $filter('percent')(value, context.scale || 2);
+ }
+
if (context.prefix && !context.noprefix) {
value = context.prefix + value;
}
@@ -74,6 +78,15 @@
});
};
+ var replaceOverallCompletedPercentCount = function (title, value) {
+ return replacePlaceholders(title, 'completedPercent', {
+ prefix: ariaNgLocalizationService.getLocalizedText('Completed Percent') + ': ',
+ value: value,
+ type: 'percent',
+ suffix: '%'
+ });
+ };
+
var replaceWaitingCount = function (title, value) {
return replacePlaceholders(title, 'waiting', {
prefix: ariaNgLocalizationService.getLocalizedText('Waiting') + ': ',
@@ -118,6 +131,7 @@
context = angular.extend({
downloadingCount: 0,
+ completedPercent: 0,
waitingCount: 0,
stoppedCount: 0,
downloadSpeed: 0,
@@ -126,6 +140,7 @@
title = replaceCurrentRPCAlias(title, context.currentRPCAlias);
title = replaceDownloadingCount(title, context.downloadingCount);
+ title = replaceOverallCompletedPercentCount(title, context.completedPercent);
title = replaceWaitingCount(title, context.waitingCount);
title = replaceStoppedCount(title, context.stoppedCount);
title = replaceDownloadSpeed(title, context.downloadSpeed);
@@ -138,6 +153,7 @@
var context = {
currentRPCAlias: (params && params.currentRpcProfile ? (params.currentRpcProfile.rpcAlias || (params.currentRpcProfile.rpcHost + ':' + params.currentRpcProfile.rpcPort)) : ''),
downloadingCount: (params && params.globalStat ? params.globalStat.numActive : 0),
+ completedPercent: (params && params.completedPercent ? params.completedPercent : 0),
waitingCount: (params && params.globalStat ? params.globalStat.numWaiting : 0),
stoppedCount: (params && params.globalStat ? params.globalStat.numStopped : 0),
downloadSpeed: (params && params.globalStat ? params.globalStat.downloadSpeed : 0),
diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html
index b67cf0c..bb3499a 100644
--- a/src/views/settings-ariang.html
+++ b/src/views/settings-ariang.html
@@ -58,6 +58,7 @@
('AriaNg Title' | translate) + ': ${title}
' +
('Current RPC Alias' | translate) + ': ${rpcprofile}
' +
('Downloading Count' | translate) + ': ${downloading}
' +
+ ('Overall Completed Percent' | translate) + ': ${completedPercent}
' +
('Waiting Count' | translate) + ': ${waiting}
' +
('Stopped Count' | translate) + ': ${stopped}
' +
('Download Speed' | translate) + ': ${downspeed}
' +