OSDN Git Service

投稿者コメントのみダウンロードするかどうかを画面設定から取得し, APIに渡す
authoryukihane <yukihane.feather@gmail.com>
Sat, 12 May 2012 09:45:03 +0000 (18:45 +0900)
committeryukihane <yukihane.feather@gmail.com>
Sat, 12 May 2012 09:45:03 +0000 (18:45 +0900)
frontend/src/saccubus/worker/impl/download/Download.java
frontend/src/saccubus/worker/profile/CommentProfile.java
frontend/src/yukihane/inqubus/config/ConfigCommentProfile.java
frontend/src/yukihane/inqubus/gui/MainFrame.java

index 84732e0..8a412ec 100644 (file)
@@ -98,10 +98,12 @@ public class Download extends Worker<DownloadResult, DownloadProgress> {
             final File file = new File(profile.getCommentProfile().getDir(), name);
 
             final EnumSet<DownloadCommentType> commentSet = EnumSet.of(DownloadCommentType.OWNER);
-            if (profile.getCommentProfile().isDisablePerMinComment()) {
-                commentSet.add(DownloadCommentType.COMMENT_OLD);
-            } else {
-                commentSet.add(DownloadCommentType.COMMENT);
+            if (!profile.getCommentProfile().isOwnerCommentOnly()) {
+                if (profile.getCommentProfile().isDisablePerMinComment()) {
+                    commentSet.add(DownloadCommentType.COMMENT_OLD);
+                } else {
+                    commentSet.add(DownloadCommentType.COMMENT);
+                }
             }
             commentFile = client.getCommentFile(vi, file.getPath(), commentSet, wbi, profile.getCommentProfile().
                     getLengthRelatedCommentSize());
index 022bc0b..ea735f8 100644 (file)
@@ -16,6 +16,13 @@ public interface CommentProfile extends Inputable {
 
     /**
      * @return {@link #isDownload()}がtrueの場合に,
+     * 投稿者コメントのみ取得する場合はtrue. 通常コメントも取得する場合はfalse.
+     * {@link #isDownload()}がfalseの場合未定義.
+     */
+    boolean isOwnerCommentOnly();
+
+    /**
+     * @return {@link #isDownload()}がtrueの場合に,
      * 昔の仕様でコメントダウンロードを行う場合はtrue. 現在の仕様で行う場合はfalse.
      * {@link #isDownload()}がfalseの場合未定義.
      */
index c7209b6..33838c2 100644 (file)
@@ -49,6 +49,11 @@ public class ConfigCommentProfile implements CommentProfile {
     }
 
     @Override
+    public boolean isOwnerCommentOnly() {
+        return false;
+    }
+
+    @Override
     public boolean isDownload() {
         return download;
     }
index ba2e997..4f2f317 100644 (file)
@@ -932,6 +932,7 @@ public class MainFrame extends JFrame {
 
     private class InqubusCommentProfile extends ConfigCommentProfile {
         private final boolean download;
+        private final boolean ownerCommentOnly;
         private final File dir;
         private final String fileName;
         private final File localFile;
@@ -947,10 +948,12 @@ public class MainFrame extends JFrame {
                 this.dir = new File(p.getCommentDir());
                 this.fileName = fldComment.getText();
                 this.localFile = null;
+                this.ownerCommentOnly = cbOwnerComment.isSelected();
             } else {
                 this.dir = null;
                 this.fileName = null;
                 this.localFile = new File(fldComment.getText());
+                this.ownerCommentOnly = false;
             }
 
             if(cbBackLog.isSelected()) {
@@ -972,6 +975,11 @@ public class MainFrame extends JFrame {
         }
 
         @Override
+        public boolean isOwnerCommentOnly(){
+            return this.ownerCommentOnly;
+        }
+
+        @Override
         public File getDir() {
             return this.dir;
         }