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
CSS change, some fallbacks programs for Desktop
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix
/
Library.java
diff --git
a/src/be/nikiroo/fanfix/Library.java
b/src/be/nikiroo/fanfix/Library.java
index 03b584cf760849ec9fcaccc84529db806318ce87..88228497d8e1b6722e42ca35490006d331fadc9b 100644
(file)
--- a/
src/be/nikiroo/fanfix/Library.java
+++ b/
src/be/nikiroo/fanfix/Library.java
@@
-14,9
+14,9
@@
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.output.BasicOutput;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.fanfix.supported.BasicSupport;
import be.nikiroo.fanfix.output.BasicOutput;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.fanfix.supported.BasicSupport;
-import be.nikiroo.utils.ui.Progress;
import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
import be.nikiroo.fanfix.supported.InfoReader;
import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
import be.nikiroo.fanfix.supported.InfoReader;
+import be.nikiroo.utils.Progress;
/**
* Manage a library of Stories: import, export, list.
/**
* Manage a library of Stories: import, export, list.
@@
-217,17
+217,25
@@
public class Library {
*/
public File export(String luid, OutputType type, String target, Progress pg)
throws IOException {
*/
public File export(String luid, OutputType type, String target, Progress pg)
throws IOException {
+ Progress pgGetStory = new Progress();
+ Progress pgOut = new Progress();
+ if (pg != null) {
+ pg.setMax(2);
+ pg.addProgress(pgGetStory, 1);
+ pg.addProgress(pgOut, 1);
+ }
+
BasicOutput out = BasicOutput.getOutput(type, true);
if (out == null) {
throw new IOException("Output type not supported: " + type);
}
BasicOutput out = BasicOutput.getOutput(type, true);
if (out == null) {
throw new IOException("Output type not supported: " + type);
}
- Story story = getStory(luid, pg);
+ Story story = getStory(luid, pg
GetStory
);
if (story == null) {
throw new IOException("Cannot find story to export: " + luid);
}
if (story == null) {
throw new IOException("Cannot find story to export: " + luid);
}
- return out.process(story, target);
+ return out.process(story, target
, pgOut
);
}
/**
}
/**
@@
-235,14
+243,16
@@
public class Library {
*
* @param story
* the {@link Story} to save
*
* @param story
* the {@link Story} to save
+ * @param pg
+ * the optional progress reporter
*
* @return the same {@link Story}, whose LUID may have changed
*
* @throws IOException
* in case of I/O error
*/
*
* @return the same {@link Story}, whose LUID may have changed
*
* @throws IOException
* in case of I/O error
*/
- public Story save(Story story) throws IOException {
- return save(story, null);
+ public Story save(Story story
, Progress pg
) throws IOException {
+ return save(story, null
, pg
);
}
/**
}
/**
@@
-253,13
+263,15
@@
public class Library {
* the {@link Story} to save
* @param luid
* the <b>correct</b> LUID or NULL to get the next free one
* the {@link Story} to save
* @param luid
* the <b>correct</b> LUID or NULL to get the next free one
+ * @param pg
+ * the optional progress reporter
*
* @return the same {@link Story}, whose LUID may have changed
*
* @throws IOException
* in case of I/O error
*/
*
* @return the same {@link Story}, whose LUID may have changed
*
* @throws IOException
* in case of I/O error
*/
- public Story save(Story story, String luid) throws IOException {
+ public Story save(Story story, String luid
, Progress pg
) throws IOException {
// Do not change the original metadata, but change the original story
MetaData key = story.getMeta().clone();
story.setMeta(key);
// Do not change the original metadata, but change the original story
MetaData key = story.getMeta().clone();
story.setMeta(key);
@@
-284,7
+296,7
@@
public class Library {
}
BasicOutput it = BasicOutput.getOutput(out, true);
}
BasicOutput it = BasicOutput.getOutput(out, true);
- File file = it.process(story, getFile(key).getPath());
+ File file = it.process(story, getFile(key).getPath()
, pg
);
getStories().put(story.getMeta(), file);
return story;
getStories().put(story.getMeta(), file);
return story;