git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code cleanup 3 and update jexer-niki :
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix
/
reader
/
GuiReader.java
diff --git
a/src/be/nikiroo/fanfix/reader/GuiReader.java
b/src/be/nikiroo/fanfix/reader/GuiReader.java
index cdf80d0c9fda7b3d02b0d4b7d045a011f877b551..932425838629c945309cfd3979f285ee5b1d0e9a 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/GuiReader.java
+++ b/
src/be/nikiroo/fanfix/reader/GuiReader.java
@@
-13,10
+13,11
@@
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import be.nikiroo.fanfix.Instance;
import javax.swing.event.HyperlinkListener;
import be.nikiroo.fanfix.Instance;
-import be.nikiroo.fanfix.LocalLibrary;
import be.nikiroo.fanfix.VersionCheck;
import be.nikiroo.fanfix.bundles.UiConfig;
import be.nikiroo.fanfix.VersionCheck;
import be.nikiroo.fanfix.bundles.UiConfig;
+import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.data.Story;
+import be.nikiroo.fanfix.library.LocalLibrary;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.utils.Progress;
import be.nikiroo.utils.Version;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.utils.Progress;
import be.nikiroo.utils.Version;
@@
-69,19
+70,14
@@
class GuiReader extends BasicReader {
localLibrary = new LocalLibrary(dir, text, images);
}
localLibrary = new LocalLibrary(dir, text, images);
}
- @Override
public void read() throws IOException {
public void read() throws IOException {
- if (getStory() == null) {
+ MetaData meta = getMeta();
+
+ if (meta == null) {
throw new IOException("No story to read");
}
throw new IOException("No story to read");
}
- open(getStory().getMeta().getLuid(), null);
- }
-
- @Override
- public void read(int chapter) throws IOException {
- // TODO: show a special page?
- read();
+ read(meta.getLuid(), null);
}
/**
}
/**
@@
-105,7
+101,7
@@
class GuiReader extends BasicReader {
}
try {
}
try {
- Story story =
Instance.
getLibrary().getStory(luid, pgGetStory);
+ Story story = getLibrary().getStory(luid, pgGetStory);
if (story != null) {
story = localLibrary.save(story, luid, pgSave);
} else {
if (story != null) {
story = localLibrary.save(story, luid, pgSave);
} else {
@@
-131,7
+127,6
@@
class GuiReader extends BasicReader {
return localLibrary.getInfo(luid) != null;
}
return localLibrary.getInfo(luid) != null;
}
- @Override
public void browse(String type) {
// TODO: improve presentation of update message
final VersionCheck updates = VersionCheck.check();
public void browse(String type) {
// TODO: improve presentation of update message
final VersionCheck updates = VersionCheck.check();
@@
-189,8
+184,7
@@
class GuiReader extends BasicReader {
}
}
}
}
- new GuiReaderFrame(GuiReader.this, typeFinal)
- .setVisible(true);
+ new GuiReaderFrame(GuiReader.this, typeFinal).setVisible(true);
}
});
}
}
});
}
@@
-208,27
+202,28
@@
class GuiReader extends BasicReader {
void delete(String luid) {
try {
localLibrary.delete(luid);
void delete(String luid) {
try {
localLibrary.delete(luid);
-
Instance.
getLibrary().delete(luid);
+ getLibrary().delete(luid);
} catch (IOException e) {
Instance.syserr(e);
}
}
// open the given book
} catch (IOException e) {
Instance.syserr(e);
}
}
// open the given book
- void
open
(String luid, Progress pg) throws IOException {
+ void
read
(String luid, Progress pg) throws IOException {
File file = localLibrary.getFile(luid);
if (file == null) {
imprt(luid, pg);
file = localLibrary.getFile(luid);
}
File file = localLibrary.getFile(luid);
if (file == null) {
imprt(luid, pg);
file = localLibrary.getFile(luid);
}
- open(getLibrary().getInfo(luid), file);
+ // TODO: show a special page for the chapter?
+ openExternal(getLibrary().getInfo(luid), file);
}
}
- void changeType(String luid, String new
Typ
e) {
+ void changeType(String luid, String new
Sourc
e) {
try {
try {
- localLibrary.changeSource(luid, new
Typ
e, null);
-
Instance.getLibrary().changeSource(luid, newTyp
e, null);
+ localLibrary.changeSource(luid, new
Sourc
e, null);
+
getLibrary().changeSource(luid, newSourc
e, null);
} catch (IOException e) {
Instance.syserr(e);
}
} catch (IOException e) {
Instance.syserr(e);
}