Fix: ui, set a global progress on the download

This commit is contained in:
Laurent Clouet
2024-04-11 15:24:50 +00:00
parent 50ddc9ae3f
commit 74b39797ce
8 changed files with 97 additions and 58 deletions

View File

@@ -24,7 +24,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Time;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -38,11 +37,9 @@ import java.util.TimerTask;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
@@ -795,6 +792,8 @@ import okhttp3.HttpUrl;
ExecutorService executor = Executors.newFixedThreadPool(total);
ArrayList<Callable<Error.Type>> tasks = new ArrayList<>();
this.gui.getDownloadProgress().reset("Downloading project");
for (int i = 0; i < total; i++) {
Chunk chunk = ajob_.getArchiveChunks().get(i);
@@ -804,7 +803,6 @@ import okhttp3.HttpUrl;
this.server,
this.gui,
this.log,
String.format(LOCALE, "chunk %d/%d", finalI + 1, total),
this.directoryManager.getActualStoragePathFor(chunk),
chunk.getMd5(),
String.format(LOCALE, "%s?chunk=%s", this.server.getPage("download-chunk"), chunk.getId())
@@ -839,11 +837,11 @@ import okhttp3.HttpUrl;
}
protected Error.Type downloadExecutable(Job ajob) throws SheepItException {
this.gui.getDownloadProgress().reset("Downloading Blender");
return (new DownloadManager(
this.server,
this.gui,
this.log,
"renderer",
this.directoryManager.getActualStorageBinaryPathFor(ajob),
ajob.getRendererMD5(),
String.format(LOCALE, "%s?job=%s", this.server.getPage("download-binary"), ajob.getId())