From 629a9b3f85a46eb81ffea74fc42d9d8185cd2ba7 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 18 Apr 2020 16:58:04 +0200 Subject: [PATCH] Improve progress names --- src/be/nikiroo/fanfix/library/BasicLibrary.java | 10 +++++++++- src/be/nikiroo/fanfix/supported/BasicSupport.java | 5 ++++- src/be/nikiroo/fanfix/supported/Cbz.java | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index c2ab12b7..7f286079 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -755,6 +755,7 @@ abstract public class BasicLibrary { } Story story = save(support.process(pgProcess), pgSave); + pg.setName(story.getMeta().getTitle()); pg.done(); return story.getMeta(); @@ -872,13 +873,18 @@ abstract public class BasicLibrary { */ public synchronized Story save(Story story, String luid, Progress pg) throws IOException { - + if (pg == null) { + pg = new Progress(); + } + Instance.getInstance().getTraceHandler().trace(this.getClass().getSimpleName() + ": saving story " + luid); // Do not change the original metadata, but change the original story MetaData meta = story.getMeta().clone(); story.setMeta(meta); + pg.setName("Saving story"); + if (luid == null || luid.isEmpty()) { meta.setLuid(String.format("%03d", getNextId())); } else { @@ -896,6 +902,8 @@ abstract public class BasicLibrary { Instance.getInstance().getTraceHandler() .trace(this.getClass().getSimpleName() + ": story saved (" + luid + ")"); + pg.setName(meta.getTitle()); + pg.done(); return story; } diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index bc91e8b4..ba2164ca 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -336,6 +336,8 @@ public abstract class BasicSupport { } else { pg.setMinMax(0, 100); } + + pg.setName("Initialising"); pg.setProgress(1); Progress pgMeta = new Progress(); @@ -343,7 +345,7 @@ public abstract class BasicSupport { Story story = processMeta(true, pgMeta); pgMeta.done(); // 10% - pg.setName("Retrieving " + story.getMeta().getTitle()); + pg.setName(story.getMeta().getTitle()); Progress pgGetChapters = new Progress(); pg.addProgress(pgGetChapters, 10); @@ -390,6 +392,7 @@ public abstract class BasicSupport { pgChaps.done(); } + pg.setName(story.getMeta().getTitle()); pg.done(); return story; diff --git a/src/be/nikiroo/fanfix/supported/Cbz.java b/src/be/nikiroo/fanfix/supported/Cbz.java index 76b66aba..cf603352 100644 --- a/src/be/nikiroo/fanfix/supported/Cbz.java +++ b/src/be/nikiroo/fanfix/supported/Cbz.java @@ -63,6 +63,8 @@ class Cbz extends Epub { } else { pg.setMinMax(0, 100); } + + pg.setName("Initialising"); Progress pgMeta = new Progress(); pg.addProgress(pgMeta, 10); @@ -70,6 +72,8 @@ class Cbz extends Epub { MetaData meta = story.getMeta(); pgMeta.done(); // 10% + + pg.setName(meta.getTitle()); File tmpDir = Instance.getInstance().getTempFiles().createTempDir("info-text"); String basename = null; @@ -193,7 +197,9 @@ class Cbz extends Epub { } } - pg.setProgress(100); + pg.setName(meta.getTitle()); + pg.done(); + return story; } -- 2.27.0