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>
<li> <li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('name')"> <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> <i class="fa" ng-class="{'fa-check': isSetDisplayOrder('name')}"></i>
</a> </a>
</li> </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> <li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('percent')"> <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> <i class="fa" ng-class="{'fa-check': isSetDisplayOrder('percent')}"></i>
</a> </a>
</li> </li>
<li> <li>
<a class="pointer-cursor" ng-click="changeDisplayOrder('remain')"> <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> <i class="fa" ng-class="{'fa-check': isSetDisplayOrder('remain')}"></i>
</a> </a>
</li> </li>

View file

@ -29,7 +29,9 @@
}; };
var processDownloadTask = function (task) { 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) { if (task.bittorrent && task.bittorrent.info) {
task.taskName = task.bittorrent.info.name; task.taskName = task.bittorrent.info.name;
@ -39,7 +41,8 @@
task.taskName = translateFilter('Unknown'); 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.idle = task.downloadSpeed == 0;
task.remainTime = calculateDownloadRemainTime(remainLength, task.downloadSpeed); task.remainTime = calculateDownloadRemainTime(remainLength, task.downloadSpeed);
}; };

View file

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

View file

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

View file

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