(README update)
[fanfix.git] / src / be / nikiroo / fanfix / output / BasicOutput.java
index 1342eb03016189535039fedf322f41cadcb92ff7..9bf096cca1ef8f5b7e5594694dc88da558f2ec11 100644 (file)
@@ -11,7 +11,7 @@ import be.nikiroo.fanfix.data.Chapter;
 import be.nikiroo.fanfix.data.Paragraph;
 import be.nikiroo.fanfix.data.Paragraph.ParagraphType;
 import be.nikiroo.fanfix.data.Story;
-import be.nikiroo.utils.ui.Progress;
+import be.nikiroo.utils.Progress;
 
 /**
  * This class is the base class used by the other output classes. It can be used
@@ -52,15 +52,23 @@ public abstract class BasicOutput {
                /**
                 * A description of this output type.
                 * 
+                * @param longDesc
+                *            TRUE for the long description, FALSE for the short one
+                * 
                 * @return the description
                 */
-               public String getDesc() {
-                       String desc = Instance.getTrans().getStringX(StringId.OUTPUT_DESC,
-                                       this.name());
+               public String getDesc(boolean longDesc) {
+                       StringId id = longDesc ? StringId.OUTPUT_DESC
+                                       : StringId.OUTPUT_DESC_SHORT;
+
+                       String desc = Instance.getTrans().getStringX(id, this.name());
 
                        if (desc == null) {
-                               desc = Instance.getTrans()
-                                               .getString(StringId.OUTPUT_DESC, this);
+                               desc = Instance.getTrans().getString(id, this);
+                       }
+
+                       if (desc == null) {
+                               desc = this.toString();
                        }
 
                        return desc;
@@ -69,12 +77,17 @@ public abstract class BasicOutput {
                /**
                 * The default extension to add to the output files.
                 * 
+                * @param readerTarget
+                *            the target to point to to read the {@link Story} (for
+                *            instance, the main entry point if this {@link Story} is in
+                *            a directory bundle)
+                * 
                 * @return the extension
                 */
-               public String getDefaultExtension() {
+               public String getDefaultExtension(boolean readerTarget) {
                        BasicOutput output = BasicOutput.getOutput(this, false);
                        if (output != null) {
-                               return output.getDefaultExtension();
+                               return output.getDefaultExtension(readerTarget);
                        }
 
                        return null;
@@ -166,7 +179,7 @@ public abstract class BasicOutput {
                File targetDir = new File(target).getParentFile();
                String targetName = new File(target).getName();
 
-               String ext = getDefaultExtension();
+               String ext = getDefaultExtension(false);
                if (ext != null && !ext.isEmpty()) {
                        if (targetName.toLowerCase().endsWith(ext)) {
                                targetName = targetName.substring(0,
@@ -239,9 +252,14 @@ public abstract class BasicOutput {
        /**
         * The default extension to add to the output files.
         * 
+        * @param readerTarget
+        *            the target to point to to read the {@link Story} (for
+        *            instance, the main entry point if this {@link Story} is in a
+        *            directory bundle)
+        * 
         * @return the extension
         */
-       public String getDefaultExtension() {
+       public String getDefaultExtension(boolean readerTarget) {
                return "";
        }