slightly better waiting screen on book open
authorNiki Roo <niki@nikiroo.be>
Fri, 1 May 2020 14:07:15 +0000 (16:07 +0200)
committerNiki Roo <niki@nikiroo.be>
Fri, 1 May 2020 14:07:15 +0000 (16:07 +0200)
src/be/nikiroo/fanfix_swing/Actions.java

index 4e696f0c07c158c9a731def75fae053309306895..54a3f10ff51ac98c45982a5727a817d8425ab817 100644 (file)
@@ -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?