X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2Fui%2FGuiReader.java;h=2a4d7a942d4f67c5e7dd50553bb5ac9ba39de8f0;hb=0b39fb9f4fc11d0880158a3b182900b9fe82da42;hp=576ac9cc80191c492e2e50572568ec0eaa79d9b7;hpb=16a81ef7656c5c692fb831927e75edde25dd77a0;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReader.java b/src/be/nikiroo/fanfix/reader/ui/GuiReader.java index 576ac9c..2a4d7a9 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReader.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReader.java @@ -2,11 +2,14 @@ package be.nikiroo.fanfix.reader.ui; import java.awt.Desktop; import java.awt.EventQueue; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import javax.swing.JEditorPane; +import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.event.HyperlinkEvent; @@ -14,15 +17,30 @@ import javax.swing.event.HyperlinkListener; import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.VersionCheck; +import be.nikiroo.fanfix.bundles.StringIdGui; +import be.nikiroo.fanfix.bundles.UiConfig; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.library.BasicLibrary; import be.nikiroo.fanfix.library.CacheLibrary; import be.nikiroo.fanfix.reader.BasicReader; +import be.nikiroo.fanfix.reader.Reader; +import be.nikiroo.fanfix.supported.SupportType; import be.nikiroo.utils.Progress; import be.nikiroo.utils.Version; import be.nikiroo.utils.ui.UIUtils; +/** + * This class implements a graphical {@link Reader} using the Swing library from + * Java. + *

+ * It can thus be themed to look native-like, or metal-like, or use any other + * theme you may want to try. + *

+ * We actually try to enable native look-alike mode on start. + * + * @author niki + */ class GuiReader extends BasicReader { static private boolean nativeLookLoaded; @@ -30,7 +48,14 @@ class GuiReader extends BasicReader { private File cacheDir; + /** + * Create a new graphical {@link Reader}. + * + * @throws IOException + * in case of I/O errors + */ public GuiReader() throws IOException { + // TODO: allow different themes? if (!nativeLookLoaded) { UIUtils.setLookAndFeel(); nativeLookLoaded = true; @@ -60,14 +85,14 @@ class GuiReader extends BasicReader { } @Override - public void read() throws IOException { + public void read(boolean sync) throws IOException { MetaData meta = getMeta(); if (meta == null) { throw new IOException("No story to read"); } - read(meta.getLuid(), null); + read(meta.getLuid(), sync, null); } /** @@ -85,17 +110,22 @@ class GuiReader extends BasicReader { @Override public void browse(String type) { + final Boolean[] done = new Boolean[] { false }; + // TODO: improve presentation of update message final VersionCheck updates = VersionCheck.check(); StringBuilder builder = new StringBuilder(); final JEditorPane updateMessage = new JEditorPane("text/html", ""); if (updates.isNewVersionAvailable()) { - builder.append("A new version of the program is available at https://github.com/nikiroo/fanfix/releases"); + builder.append(trans(StringIdGui.NEW_VERSION_AVAILABLE, + "https://github.com/nikiroo/fanfix/releases")); builder.append("
"); builder.append("
"); for (Version v : updates.getNewer()) { - builder.append("\tVersion " + v + ""); + builder.append("\t" + + trans(StringIdGui.NEW_VERSION_VERSION, v.toString()) + + ""); builder.append("
"); builder.append("