mirror of
https://github.com/ProjectSWGCore/launcher.git
synced 2026-01-16 23:04:25 -05:00
Added progress bar to active downloads
This commit is contained in:
@@ -144,6 +144,16 @@ class ServerListView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
progressbar {
|
||||
val updateStatus = LauncherData.INSTANCE.login.activeServerProperty.select { it.updateServerProperty }
|
||||
visibleWhen { updateStatus.select { it.statusProperty }.select { ReadOnlyBooleanWrapper(it == UpdateServer.UpdateServerStatus.DOWNLOADING) } }
|
||||
prefHeight = 12.0
|
||||
maxHeight = 12.0
|
||||
maxWidth = Double.POSITIVE_INFINITY
|
||||
|
||||
progressProperty().bind(updateStatus.select { it.downloadProgressProperty })
|
||||
isFillWidth = true
|
||||
}
|
||||
}
|
||||
button("Play") { // TODO: Get proper string for this
|
||||
isFillWidth = true
|
||||
|
||||
@@ -110,6 +110,9 @@ class Style : Stylesheet() {
|
||||
highlightFill = additionalColorPrimary
|
||||
textFill = textColorPrimary
|
||||
}
|
||||
s(progressBar child bar) {
|
||||
backgroundColor += additionalColorSecondary
|
||||
}
|
||||
|
||||
// ComboBox, Button, and ScrollBar button styling
|
||||
s( comboBox,
|
||||
|
||||
@@ -89,7 +89,8 @@ class DownloadService : Service() {
|
||||
dataTransferredBinding = dataTransferredBinding.add(downloadAmount)
|
||||
threadPool.execute { download(file, fileLockPool, downloadAmount, running) }
|
||||
}
|
||||
dpi.server.downloadProgressProperty.bind(dataTransferredBinding.divide(files.stream().mapToLong { it.length }.sum().toDouble()))
|
||||
val totalDownloadSize = files.stream().mapToLong { it.length }.sum().toDouble()
|
||||
Platform.runLater { dpi.server.downloadProgressProperty.bind(dataTransferredBinding.divide(totalDownloadSize)) }
|
||||
|
||||
// Waits for all files to complete, then is able to grab the one remaining lock
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user