Progress bar unified.

This commit is contained in:
Gunther Brunner
2014-04-04 20:26:04 +09:00
parent 941f4cb051
commit 1b651a47f2
2 changed files with 83 additions and 32 deletions

View File

@@ -63,6 +63,50 @@ module.exports = function UploadCtrl($scope, $rootScope, SettingsService, gettex
})
}
$scope.taskFinished = function () {
if ($scope.installEnabled) {
if ($scope.upload && $scope.upload.settled &&
$scope.installation && $scope.installation.settled) {
return true
}
} else {
if ($scope.upload && $scope.upload.settled) {
return true
}
}
return false
}
$scope.taskProgressMax = function () {
return $scope.taskProgressMaxDivisor() * 100
}
$scope.taskProgressMaxDivisor = function () {
if ($scope.installEnabled) {
return 2
} else {
return 1
}
}
$scope.taskProgress = function () {
if ($scope.installEnabled) {
var sum = 0
if ($scope.upload) {
sum += $scope.upload.progress
}
if ($scope.installation) {
sum += $scope.installation.progress
}
return sum
} else {
if ($scope.upload) {
return $scope.upload.progress
}
}
return 0
}
//
// $scope.installEnabled = true
// SettingsService.bind($scope, {