synchronize updateProgressBar
This commit is contained in:
parent
e934c28919
commit
13d3c97d4f
1 changed files with 9 additions and 7 deletions
|
@ -191,13 +191,15 @@ class MainPageController {
|
|||
* Updates the progress bar of the UI.
|
||||
*/
|
||||
fun updateProgressBar() {
|
||||
logger.info("Progress ${processedImageFilesCount.get()}/${imageFilesTotal} ${progressBar.progress}")
|
||||
progressBar.progress =
|
||||
((processedImageFilesCount.incrementAndGet() * 100) / imageFilesTotal).toDouble() / 100.0
|
||||
if (processedImageFilesCount.get() == imageFilesTotal) {
|
||||
progressBar.isVisible = false
|
||||
cancelButton.isVisible = false
|
||||
logger.info("Finished processing images.")
|
||||
synchronized(this) {
|
||||
logger.info("Progress ${processedImageFilesCount.get()}/${imageFilesTotal} ${progressBar.progress}")
|
||||
val processedImages = processedImageFilesCount.incrementAndGet()
|
||||
progressBar.progress = ((processedImages * 100) / imageFilesTotal).toDouble() / 100.0
|
||||
if (processedImageFilesCount.get() == imageFilesTotal) {
|
||||
progressBar.isVisible = false
|
||||
cancelButton.isVisible = false
|
||||
logger.info("Finished processing images.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue