いんきゅばす(仮称; 旧名: さきゅばすのNicoBrowser拡張版)
Révision | dd23278b166893c0e9d74f2e5b56ce38b4a00e26 (tree) |
---|---|
l'heure | 2012-05-12 20:09:45 |
Auteur | yukihane <yukihane.feather@gmai...> |
Commiter | yukihane |
Merge branch 'only_owner_comment'
@@ -98,10 +98,12 @@ public class Download extends Worker<DownloadResult, DownloadProgress> { | ||
98 | 98 | final File file = new File(profile.getCommentProfile().getDir(), name); |
99 | 99 | |
100 | 100 | final EnumSet<DownloadCommentType> commentSet = EnumSet.of(DownloadCommentType.OWNER); |
101 | - if (profile.getCommentProfile().isDisablePerMinComment()) { | |
102 | - commentSet.add(DownloadCommentType.COMMENT_OLD); | |
103 | - } else { | |
104 | - commentSet.add(DownloadCommentType.COMMENT); | |
101 | + if (!profile.getCommentProfile().isOwnerCommentOnly()) { | |
102 | + if (profile.getCommentProfile().isDisablePerMinComment()) { | |
103 | + commentSet.add(DownloadCommentType.COMMENT_OLD); | |
104 | + } else { | |
105 | + commentSet.add(DownloadCommentType.COMMENT); | |
106 | + } | |
105 | 107 | } |
106 | 108 | commentFile = client.getCommentFile(vi, file.getPath(), commentSet, wbi, profile.getCommentProfile(). |
107 | 109 | getLengthRelatedCommentSize()); |
@@ -16,6 +16,13 @@ public interface CommentProfile extends Inputable { | ||
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @return {@link #isDownload()}がtrueの場合に, |
19 | + * 投稿者コメントのみ取得する場合はtrue. 通常コメントも取得する場合はfalse. | |
20 | + * {@link #isDownload()}がfalseの場合未定義. | |
21 | + */ | |
22 | + boolean isOwnerCommentOnly(); | |
23 | + | |
24 | + /** | |
25 | + * @return {@link #isDownload()}がtrueの場合に, | |
19 | 26 | * 昔の仕様でコメントダウンロードを行う場合はtrue. 現在の仕様で行う場合はfalse. |
20 | 27 | * {@link #isDownload()}がfalseの場合未定義. |
21 | 28 | */ |
@@ -49,6 +49,11 @@ public class ConfigCommentProfile implements CommentProfile { | ||
49 | 49 | } |
50 | 50 | |
51 | 51 | @Override |
52 | + public boolean isOwnerCommentOnly() { | |
53 | + return false; | |
54 | + } | |
55 | + | |
56 | + @Override | |
52 | 57 | public boolean isDownload() { |
53 | 58 | return download; |
54 | 59 | } |
@@ -22,7 +22,6 @@ import java.beans.PropertyChangeEvent; | ||
22 | 22 | import java.beans.PropertyChangeListener; |
23 | 23 | import java.io.File; |
24 | 24 | import java.io.IOException; |
25 | -import java.net.MalformedURLException; | |
26 | 25 | import java.net.URL; |
27 | 26 | import java.nio.file.FileSystem; |
28 | 27 | import java.nio.file.FileSystems; |
@@ -32,8 +31,6 @@ import java.util.HashSet; | ||
32 | 31 | import java.util.List; |
33 | 32 | import java.util.Set; |
34 | 33 | import java.util.SortedSet; |
35 | -import org.slf4j.Logger; | |
36 | -import org.slf4j.LoggerFactory; | |
37 | 34 | import javax.swing.BorderFactory; |
38 | 35 | import javax.swing.DefaultComboBoxModel; |
39 | 36 | import javax.swing.DropMode; |
@@ -61,6 +58,8 @@ import javax.swing.border.BevelBorder; | ||
61 | 58 | import javax.swing.table.TableModel; |
62 | 59 | import org.apache.commons.configuration.ConfigurationException; |
63 | 60 | import org.apache.commons.lang.builder.ToStringBuilder; |
61 | +import org.slf4j.Logger; | |
62 | +import org.slf4j.LoggerFactory; | |
64 | 63 | import saccubus.MainFrame_AboutBox; |
65 | 64 | import saccubus.util.WayBackTimeParser; |
66 | 65 | import saccubus.worker.profile.CommentProfile; |
@@ -215,18 +214,12 @@ public class MainFrame extends JFrame { | ||
215 | 214 | cbBackLogReduce.setToolTipText("「コメントの量を減らす」場合はチェックを付けます。"); |
216 | 215 | |
217 | 216 | cbCommentLocal = new JCheckBox(); |
218 | - cbCommentLocal.addItemListener(new ItemListener() { | |
217 | + cbOwnerComment = new JCheckBox(); | |
219 | 218 | |
220 | - @Override | |
221 | - public void itemStateChanged(ItemEvent e) { | |
222 | - final boolean selected = (e.getStateChange() == ItemEvent.SELECTED); | |
223 | - cbBackLogReduce.setEnabled(!selected); | |
224 | - cbBackLog.setEnabled(!selected); | |
225 | - } | |
226 | - }); | |
227 | 219 | btnComment.addActionListener( |
228 | 220 | new FileChooseActionListener(MainFrame.this, JFileChooser.FILES_ONLY, fldComment)); |
229 | 221 | fldComment.setTransferHandler(new ContentTransferHandler(fldComment.getTransferHandler(), cbCommentLocal)); |
222 | + | |
230 | 223 | final JLabel lblOutput = new JLabel(); |
231 | 224 | cbOutputEnable = new JCheckBox(); |
232 | 225 | fldOutput = new JTextField(); |
@@ -300,14 +293,20 @@ public class MainFrame extends JFrame { | ||
300 | 293 | lblComment.setText("コメント"); |
301 | 294 | |
302 | 295 | cbCommentLocal.setText("local"); |
303 | - cbCommentLocal.addItemListener(new java.awt.event.ItemListener() { | |
296 | + cbCommentLocal.addItemListener(new ItemListener() { | |
304 | 297 | |
305 | 298 | @Override |
306 | - public void itemStateChanged(java.awt.event.ItemEvent evt) { | |
307 | - useMovieLocalCheckBoxItemStateChanged(evt); | |
299 | + public void itemStateChanged(ItemEvent e) { | |
300 | + useMovieLocalCheckBoxItemStateChanged(e); | |
301 | + final boolean selected = (e.getStateChange() == ItemEvent.SELECTED); | |
302 | + cbBackLogReduce.setEnabled(!selected); | |
303 | + cbBackLog.setEnabled(!selected); | |
304 | + cbOwnerComment.setEnabled(!selected); | |
308 | 305 | } |
309 | 306 | }); |
310 | 307 | |
308 | + cbOwnerComment.setText("投コメのみ"); | |
309 | + | |
311 | 310 | lblOutput.setText("出力"); |
312 | 311 | |
313 | 312 | cbOutputEnable.setText("変換"); |
@@ -329,12 +328,6 @@ public class MainFrame extends JFrame { | ||
329 | 328 | .addComponent(lblId) |
330 | 329 | .addPreferredGap(ComponentPlacement.RELATED) |
331 | 330 | .addComponent(cmbId, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE) |
332 | - .addPreferredGap(ComponentPlacement.UNRELATED) | |
333 | - .addComponent(cbBackLogReduce) | |
334 | - .addPreferredGap(ComponentPlacement.UNRELATED) | |
335 | - .addComponent(cbBackLog) | |
336 | - .addPreferredGap(ComponentPlacement.RELATED) | |
337 | - .addComponent(fldBackLog, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE) | |
338 | 331 | .addContainerGap() |
339 | 332 | ) |
340 | 333 | .addGroup(glInputMain.createSequentialGroup() |
@@ -346,21 +339,34 @@ public class MainFrame extends JFrame { | ||
346 | 339 | ) |
347 | 340 | .addPreferredGap(ComponentPlacement.RELATED) |
348 | 341 | .addGroup(glInputMain.createParallelGroup(Alignment.LEADING) |
349 | - .addComponent(cbVideoLocal) | |
350 | - .addComponent(cbCommentLocal) | |
351 | - .addComponent(cbOutputEnable) | |
352 | - ) | |
353 | - .addPreferredGap(ComponentPlacement.RELATED) | |
354 | - .addGroup(glInputMain.createParallelGroup(Alignment.LEADING) | |
355 | - .addComponent(cmbVideo, 300, 300, Short.MAX_VALUE) | |
356 | - .addComponent(cmbComment, 300, 300, Short.MAX_VALUE) | |
357 | - .addComponent(fldOutput, 300, 300, Short.MAX_VALUE) | |
342 | + .addGroup(glInputMain.createSequentialGroup() | |
343 | + .addGroup(glInputMain.createParallelGroup(Alignment.LEADING) | |
344 | + .addComponent(cbVideoLocal) | |
345 | + .addComponent(cbCommentLocal) | |
346 | + .addComponent(cbOutputEnable) | |
347 | + ) | |
348 | + .addPreferredGap(ComponentPlacement.RELATED) | |
349 | + .addGroup(glInputMain.createParallelGroup(Alignment.LEADING) | |
350 | + .addComponent(cmbVideo, 300, 300, Short.MAX_VALUE) | |
351 | + .addComponent(cmbComment, 300, 300, Short.MAX_VALUE) | |
352 | + .addComponent(fldOutput, 300, 300, Short.MAX_VALUE) | |
353 | + ) | |
354 | + .addGroup(glInputMain.createParallelGroup() | |
355 | + .addComponent(btnVideo) | |
356 | + .addComponent(btnComment) | |
357 | + ) | |
358 | + .addContainerGap() | |
359 | + ) | |
360 | + .addGroup(glInputMain.createSequentialGroup() | |
361 | + .addComponent(cbOwnerComment) | |
362 | + .addPreferredGap(ComponentPlacement.UNRELATED) | |
363 | + .addComponent(cbBackLogReduce) | |
364 | + .addPreferredGap(ComponentPlacement.UNRELATED) | |
365 | + .addComponent(cbBackLog) | |
366 | + .addPreferredGap(ComponentPlacement.RELATED) | |
367 | + .addComponent(fldBackLog, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE) | |
368 | + ) | |
358 | 369 | ) |
359 | - .addGroup(glInputMain.createParallelGroup() | |
360 | - .addComponent(btnVideo) | |
361 | - .addComponent(btnComment) | |
362 | - ) | |
363 | - .addContainerGap() | |
364 | 370 | ) |
365 | 371 | ); |
366 | 372 |
@@ -371,9 +377,6 @@ public class MainFrame extends JFrame { | ||
371 | 377 | .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE) |
372 | 378 | .addComponent(cmbId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) |
373 | 379 | .addComponent(lblId) |
374 | - .addComponent(cbBackLogReduce) | |
375 | - .addComponent(cbBackLog) | |
376 | - .addComponent(fldBackLog) | |
377 | 380 | ) |
378 | 381 | .addPreferredGap(ComponentPlacement.RELATED) |
379 | 382 | .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE) |
@@ -391,6 +394,13 @@ public class MainFrame extends JFrame { | ||
391 | 394 | ) |
392 | 395 | .addPreferredGap(ComponentPlacement.RELATED) |
393 | 396 | .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE) |
397 | + .addComponent(cbOwnerComment) | |
398 | + .addComponent(cbBackLogReduce) | |
399 | + .addComponent(cbBackLog) | |
400 | + .addComponent(fldBackLog) | |
401 | + ) | |
402 | + .addPreferredGap(ComponentPlacement.RELATED) | |
403 | + .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE) | |
394 | 404 | .addComponent(lblOutput) |
395 | 405 | .addComponent(fldOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) |
396 | 406 | .addComponent(cbOutputEnable) |
@@ -689,6 +699,7 @@ public class MainFrame extends JFrame { | ||
689 | 699 | private final FileComboBox cmbComment = new FileComboBox(); |
690 | 700 | private final JTextField fldComment = cmbComment.getEditorComponent(); |
691 | 701 | private final JButton btnComment = new JButton("..."); |
702 | + private final JCheckBox cbOwnerComment; | |
692 | 703 | private final JCheckBox cbOutputEnable; |
693 | 704 | private final JTextField fldOutput; |
694 | 705 | // 入力領域 - ffmpeg |
@@ -921,6 +932,7 @@ public class MainFrame extends JFrame { | ||
921 | 932 | |
922 | 933 | private class InqubusCommentProfile extends ConfigCommentProfile { |
923 | 934 | private final boolean download; |
935 | + private final boolean ownerCommentOnly; | |
924 | 936 | private final File dir; |
925 | 937 | private final String fileName; |
926 | 938 | private final File localFile; |
@@ -936,10 +948,12 @@ public class MainFrame extends JFrame { | ||
936 | 948 | this.dir = new File(p.getCommentDir()); |
937 | 949 | this.fileName = fldComment.getText(); |
938 | 950 | this.localFile = null; |
951 | + this.ownerCommentOnly = cbOwnerComment.isSelected(); | |
939 | 952 | } else { |
940 | 953 | this.dir = null; |
941 | 954 | this.fileName = null; |
942 | 955 | this.localFile = new File(fldComment.getText()); |
956 | + this.ownerCommentOnly = false; | |
943 | 957 | } |
944 | 958 | |
945 | 959 | if(cbBackLog.isSelected()) { |
@@ -961,6 +975,11 @@ public class MainFrame extends JFrame { | ||
961 | 975 | } |
962 | 976 | |
963 | 977 | @Override |
978 | + public boolean isOwnerCommentOnly(){ | |
979 | + return this.ownerCommentOnly; | |
980 | + } | |
981 | + | |
982 | + @Override | |
964 | 983 | public File getDir() { |
965 | 984 | return this.dir; |
966 | 985 | } |