display order supports by file size

This commit is contained in:
MaysWind 2016-05-16 21:53:45 +08:00
parent ec77ab9c20
commit 3042489c06
5 changed files with 24 additions and 11 deletions

View file

@ -66,19 +66,25 @@
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('name')">
<span translate>File Name</span>
<span translate>By File Name</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('name')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('size')">
<span translate>By File Size</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('size')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('percent')">
<span translate>Completed Percent</span>
<span translate>By Completed Percent</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('percent')}"></i>
</a>
</li>
<li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('remain')">
<span translate>Remain Time</span>
<span translate>By Remain Time</span>
<i class="fa" ng-class="{'fa-check': isSetDisplayOrder('remain')}"></i>
</a>
</li>

View file

@ -29,7 +29,9 @@
};
var processDownloadTask = function (task) {
var remainLength = task.totalLength - task.completedLength;
var totalLength = parseInt(task.totalLength);
var completedLength = parseInt(task.completedLength);
var remainLength = totalLength - completedLength;
if (task.bittorrent && task.bittorrent.info) {
task.taskName = task.bittorrent.info.name;
@ -39,7 +41,8 @@
task.taskName = translateFilter('Unknown');
}
task.completePercent = task.completedLength / task.totalLength * 100;
task.fileSize = totalLength;
task.completePercent = completedLength / totalLength * 100;
task.idle = task.downloadSpeed == 0;
task.remainTime = calculateDownloadRemainTime(remainLength, task.downloadSpeed);
};

View file

@ -9,6 +9,8 @@
if (type == 'name') {
return orderByFilter(array, ['taskName'], false);
} else if (type == 'size') {
return orderByFilter(array, ['fileSize'], false);
} else if (type == 'percent') {
return orderByFilter(array, ['completePercent'], true);
} else if (type == 'remain') {

View file

@ -9,9 +9,10 @@
'Delete': 'Delete',
'Display Order': 'Display Order',
'Default': 'Default',
'File Name': 'File Name',
'Completed Percent': 'Completed Percent',
'Remain Time': 'Remain Time',
'By File Name': 'By File Name',
'By File Size': 'By File Size',
'By Completed Percent': 'By Completed Percent',
'By Remain Time': 'By Remain Time',
'Settings': 'Settings',
'Download': 'Download',
'Downloading': 'Downloading',

View file

@ -9,9 +9,10 @@
'Delete': '删除下载任务',
'Display Order': '显示顺序',
'Default': '默认',
'File Name': '文件名',
'Completed Percent': '完成度',
'Remain Time': '剩余时间',
'By File Name': '按文件名',
'By File Size': '按文件大小',
'By Completed Percent': '按完成度',
'By Remain Time': '按剩余时间',
'Settings': '系统设置',
'Download': '下载',
'Downloading': '正在下载',