X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=inline;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2Fui%2FGuiReader.java;h=f4a932b3b899ef3fc48826bbe0b3aaa913a68d90;hb=596ed3d65b2585c4358935d6fbb130f50e237787;hp=620df26075159b7560977bc65d8733733d692d9b;hpb=1ee6709558f5e1a6200dd6ec20c0f206c22797cc;p=nikiroo-utils.git
diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReader.java b/src/be/nikiroo/fanfix/reader/ui/GuiReader.java
index 620df26..f4a932b 100644
--- a/src/be/nikiroo/fanfix/reader/ui/GuiReader.java
+++ b/src/be/nikiroo/fanfix/reader/ui/GuiReader.java
@@ -17,6 +17,8 @@ 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;
@@ -115,11 +117,14 @@ class GuiReader extends BasicReader {
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("
");
for (String item : updates.getChanges().get(v)) {
@@ -158,7 +163,8 @@ class GuiReader extends BasicReader {
public void run() {
if (updates.isNewVersionAvailable()) {
int rep = JOptionPane.showConfirmDialog(null,
- updateMessage, "Updates available",
+ updateMessage,
+ trans(StringIdGui.NEW_VERSION_TITLE),
JOptionPane.OK_CANCEL_OPTION);
if (rep == JOptionPane.OK_OPTION) {
updates.ok();
@@ -266,20 +272,32 @@ class GuiReader extends BasicReader {
* in case of I/O errors
*/
void read(String luid, boolean sync, Progress pg) throws IOException {
- File file = cacheLib.getFile(luid, pg);
+ MetaData meta = cacheLib.getInfo(luid);
- GuiReaderTextViewer viewer = new GuiReaderTextViewer(cacheLib,
- cacheLib.getStory(luid, null));
+ boolean textInternal = Instance.getUiConfig().getBoolean(
+ UiConfig.NON_IMAGES_DOCUMENT_USE_INTERNAL_READER, true);
+ boolean imageInternal = Instance.getUiConfig().getBoolean(
+ UiConfig.IMAGES_DOCUMENT_USE_INTERNAL_READER, true);
- // TODO: testing text viewer:
- if (false) {
+ boolean useInternalViewer = true;
+ if (meta.isImageDocument() && !imageInternal) {
+ useInternalViewer = false;
+ }
+ if (!meta.isImageDocument() && !textInternal) {
+ useInternalViewer = false;
+ }
+
+ if (useInternalViewer) {
+ GuiReaderViewer viewer = new GuiReaderViewer(cacheLib,
+ cacheLib.getStory(luid, null));
if (sync) {
sync(viewer);
} else {
viewer.setVisible(true);
}
} else {
- openExternal(getLibrary().getInfo(luid), file, sync);
+ File file = cacheLib.getFile(luid, pg);
+ openExternal(meta, file, sync);
}
}
@@ -338,6 +356,18 @@ class GuiReader extends BasicReader {
}
}
+ /**
+ * Simple shortcut method to call {link Instance#getTransGui()#getString()}.
+ *
+ * @param id
+ * the ID to translate
+ *
+ * @return the translated result
+ */
+ static String trans(StringIdGui id, Object... params) {
+ return Instance.getTransGui().getString(id, params);
+ }
+
/**
* Start a frame and wait until it is closed before returning.
*