OSDN Git Service

20091203_frontend_nicobrowser_extend のマージ
[coroid/inqubus.git] / frontend / src / saccubus / ConvertingSetting.java
index d2084c6..d6bcccd 100644 (file)
@@ -38,7 +38,7 @@ public class ConvertingSetting {
 
        private String Password;
 
-       private boolean SaveVideo;
+       private VideoSaveKind saveVideo;
 
        private File VideoFile;
 
@@ -115,7 +115,7 @@ public class ConvertingSetting {
        private int ShadowIndex;
 
        public ConvertingSetting(String mailaddress, String password,
-                       boolean savevideo, String videofile, boolean savecomment,
+                       VideoSaveKind savevideo, String videofile, boolean savecomment,
                        String commentfile, boolean saveconverted, String convvideofile,
                        String videoshownum, String ffmpegpath, String vhookpath,
                        String cmdlineoption_ext, String cmdlineoption_main,
@@ -132,7 +132,7 @@ public class ConvertingSetting {
                        int shadow_index) {
                MailAddress = mailaddress;
                Password = password;
-               SaveVideo = savevideo;
+        this.saveVideo = savevideo;
                if (videofile.lastIndexOf(".") < videofile.lastIndexOf("\\")) {
                        videofile += ".flv";
                }
@@ -228,14 +228,15 @@ public class ConvertingSetting {
                return Password;
        }
 
-       public boolean isSaveVideo() {
-               return SaveVideo;
+       public VideoSaveKind getVideoSaveKind() {
+               return saveVideo;
        }
 
        public boolean isSaveComment() {
                return SaveComment;
        }
 
+    /** @return \81u\83R\83\81\83\93\83g\95t\82«\93®\89æ\82É\95Ï\8a·\82·\82é\81v\82È\82çtrue. */
        public boolean isSaveConverted() {
                return SaveConverted;
        }
@@ -260,6 +261,10 @@ public class ConvertingSetting {
                return CmdLineOptionMain;
        }
 
+    /**
+     * @return \93®\89æ\95Û\91\90Ý\92è\82Å\81u\95Û\91\82·\82é\83t\83H\83\8b\83_\82ð\8ew\92è\82µ\81A\83t\83@\83C\83\8b\96¼\82Í\8e©\93®\82Å\8c\88\92è\82·\82é\81v\82Ì\82Å\82 \82ê\82Îtrue.
+     * \81u\95Û\91\82·\82é\83t\83@\83C\83\8b\96¼\82ð\8ew\92è\82·\82é\81v\82Ì\82Å\82 \82ê\82Îfalse.
+     */
        public boolean isVideoFixFileName() {
                return VideoFixFileName;
        }
@@ -426,8 +431,7 @@ public class ConvertingSetting {
                Properties prop = new Properties();
                prop.setProperty(PROP_MAILADDR, setting.getMailAddress());
                prop.setProperty(PROP_PASSWORD, setting.getPassword());
-               prop.setProperty(PROP_SAVE_VIDEO, Boolean.toString(setting
-                               .isSaveVideo()));
+        prop.setProperty(PROP_SAVE_VIDEO, setting.getVideoSaveKind().toString());
                prop.setProperty(PROP_VIDEO_FILE, setting.getVideoFile().getPath());
                prop.setProperty(PROP_SAVE_COMMENT, Boolean.toString(setting
                                .isSaveComment()));
@@ -495,6 +499,20 @@ public class ConvertingSetting {
                }
        }
 
+    /** \96{\89Æ\82³\82«\82ã\82Î\82·\82Å\95Û\91\82µ\82Ä\82¢\82½\8fê\8d\87\81APROP_SAVE_VIDEO\82Ítrue/false\82È\82Ì\82Å\95Ï\8a·\82·\82é. */
+    private static VideoSaveKind convertVideoSaveKind(Properties prop) {
+        VideoSaveKind kind;
+        String saveVideo = prop.getProperty(PROP_SAVE_VIDEO);
+        if (Boolean.toString(true).equals(saveVideo) || saveVideo == null) {
+            kind = VideoSaveKind.SAVE;
+        } else if (Boolean.toString(false).equals(saveVideo)) {
+            kind = VideoSaveKind.NO_SAVE;
+        } else {
+            kind = VideoSaveKind.valueOf(saveVideo);
+        }
+        return kind;
+    }
+
        public static ConvertingSetting loadSetting(String user, String password) {
                Properties prop = new Properties();
                try {
@@ -517,8 +535,10 @@ public class ConvertingSetting {
                if(!win_dir.endsWith("\\")){
                        win_dir = win_dir+"\\";
                }
+
+        final VideoSaveKind kind = convertVideoSaveKind(prop);
                return new ConvertingSetting(user, password,
-                               Boolean.parseBoolean(prop.getProperty(PROP_SAVE_VIDEO, "true")),
+                kind,
                                prop.getProperty(PROP_VIDEO_FILE, ".\\video.flv"),
                                 Boolean.parseBoolean(prop.getProperty(PROP_SAVE_COMMENT, "true")),
                                 prop.getProperty(PROP_COMMENT_FILE, ".\\comment.xml"),