From dd650dfb1b06c5d348e805ca7f967ebf65ba4390 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Fri, 1 May 2020 16:07:15 +0200 Subject: [PATCH] slightly better waiting screen on book open --- src/be/nikiroo/fanfix_swing/Actions.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/be/nikiroo/fanfix_swing/Actions.java b/src/be/nikiroo/fanfix_swing/Actions.java index 4e696f0c..54a3f10f 100644 --- a/src/be/nikiroo/fanfix_swing/Actions.java +++ b/src/be/nikiroo/fanfix_swing/Actions.java @@ -8,10 +8,15 @@ import java.io.IOException; import java.net.URL; import java.net.UnknownHostException; +import javax.swing.ImageIcon; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.SwingWorker; +import org.jsoup.helper.DataUtil; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; + import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.bundles.StringIdGui; import be.nikiroo.fanfix.bundles.UiConfig; @@ -20,6 +25,8 @@ import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.library.BasicLibrary; import be.nikiroo.fanfix.library.LocalLibrary; import be.nikiroo.fanfix.reader.BasicReader; +import be.nikiroo.fanfix_swing.gui.book.BookInfo; +import be.nikiroo.fanfix_swing.gui.utils.CoverImager; import be.nikiroo.fanfix_swing.gui.utils.UiHelper; import be.nikiroo.fanfix_swing.gui.viewer.Viewer; import be.nikiroo.utils.Progress; @@ -34,10 +41,16 @@ public class Actions { // TODO: UI final JDialog wait = new JDialog((Window) parentWindow); - wait.setTitle("Opening story"); - wait.setSize(400, 300); + wait.setTitle(meta.getTitle()); + // Image + ImageIcon img = new ImageIcon(CoverImager.generateCoverImage(lib, + BookInfo.fromMeta(lib, meta))); wait.setLayout(new BorderLayout()); - wait.add(new JLabel("Waiting...")); + wait.add(new JLabel("Opening " + meta.getTitle() + "..."), + BorderLayout.NORTH); + wait.add(new JLabel(img), BorderLayout.CENTER); + + wait.setSize(400, 300); // TODO: pg? -- 2.27.0