4 * Created on 2011/05/28, 18:14:51
6 package yukihane.inqubus.gui;
9 import java.awt.ItemSelectable;
10 import java.awt.Toolkit;
11 import java.awt.datatransfer.DataFlavor;
12 import java.awt.datatransfer.Transferable;
13 import java.awt.event.ActionEvent;
14 import java.awt.event.ActionListener;
15 import java.awt.event.ItemEvent;
16 import java.awt.event.ItemListener;
17 import java.awt.event.KeyEvent;
19 import java.io.FilenameFilter;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.List;
24 import java.util.logging.Level;
25 import java.util.logging.Logger;
26 import java.util.regex.Matcher;
27 import java.util.regex.Pattern;
28 import javax.swing.BorderFactory;
29 import javax.swing.DropMode;
30 import javax.swing.GroupLayout;
31 import javax.swing.GroupLayout.Alignment;
32 import javax.swing.JButton;
33 import javax.swing.JCheckBox;
34 import javax.swing.JFrame;
35 import javax.swing.JLabel;
36 import javax.swing.JMenu;
37 import javax.swing.JMenuBar;
38 import javax.swing.JMenuItem;
39 import javax.swing.JPanel;
40 import javax.swing.JScrollPane;
41 import javax.swing.JTable;
42 import javax.swing.JTextField;
43 import javax.swing.KeyStroke;
44 import javax.swing.LayoutStyle.ComponentPlacement;
45 import javax.swing.TransferHandler;
46 import javax.swing.WindowConstants;
47 import org.apache.commons.lang.StringUtils;
48 import saccubus.MainFrame_AboutBox;
49 import saccubus.worker.Download;
50 import saccubus.worker.profile.CommentProfile;
51 import saccubus.worker.profile.DownloadProfile;
52 import saccubus.worker.profile.GeneralProfile;
53 import saccubus.worker.profile.LoginProfile;
54 import saccubus.worker.profile.ProxyProfile;
55 import saccubus.worker.profile.VideoProfile;
57 import yukihane.inqubus.Config;
58 import yukihane.inqubus.model.Target;
59 import yukihane.inqubus.model.TargetsTableModel;
65 public class MainFrame extends JFrame {
67 private static final long serialVersionUID = 1L;
68 private static final Logger logger = Logger.getLogger(MainFrame.class.getName());
69 private static final String ID_FIELD_TOOLTIP = "動画のIDまたはURLを入力します。";
70 private static final String FILE_LOCALBUTTON_TOOLTIP
71 = "ダウンロードする場合はチェックを外します。ローカルファイルを使用する場合はチェックを入れます。";
72 private static final String FILE_INPUTFIELD_TOOLTIP
73 = "ダウンロードする場合はファイル命名規則を入力します。"
74 + "ローカルファイルを使用する場合はパスを含むファイル名を入力します。";
75 private static final String FILE_OUTPUTFIELD_TOOLTIP
77 private final TargetsTableModel targetModel = new TargetsTableModel();
79 /** Creates new form MainFrame */
81 final URL url = MainFrame_AboutBox.class.getResource("icon.png");
82 final Image icon1 = Toolkit.getDefaultToolkit().createImage(url);
83 final URL url32 = MainFrame_AboutBox.class.getResource("icon32.png");
84 final Image icon2 = Toolkit.getDefaultToolkit().createImage(url32);
85 final List<Image> images = new ArrayList<Image>(2);
88 setIconImages(images);
90 final JPanel pnlMain = new JPanel();
91 final JScrollPane scrDisplay = new JScrollPane();
92 tblDisplay = new JTable();
93 final JPanel pnlButton = new JPanel();
94 btnStart = new JButton();
95 btnStop = new JButton();
96 btnDeselect = new JButton();
97 final JPanel pnlInputMain = new JPanel();
98 final JLabel lblId = new JLabel();
99 fldId = new JTextField();
100 fldId.setToolTipText(ID_FIELD_TOOLTIP);
101 final JLabel lblVideo = new JLabel();
102 cbVideoLocal = new JCheckBox();
103 cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
104 fldVideo = new JTextField();
105 fldVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
106 btnVideo = new JButton();
107 final JLabel lblComment = new JLabel();
108 cbCommentLocal = new JCheckBox();
109 cbCommentLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
110 cbCommentLocal.addItemListener(new ItemListener() {
113 public void itemStateChanged(ItemEvent e) {
114 final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
115 cbBackLog.setEnabled(!selected);
117 cbBackLog.setSelected(false);
121 fldComment = new JTextField();
122 fldComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
123 btnComment = new JButton();
124 final JLabel lblOutput = new JLabel();
125 cbOutputEnable = new JCheckBox();
126 fldOutput = new JTextField();
127 fldOutput.setToolTipText(FILE_OUTPUTFIELD_TOOLTIP);
129 setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
131 btnApply.addActionListener(new ApplyActionListener());
133 pnlMain.setBorder(BorderFactory.createEtchedBorder());
135 tblDisplay.setModel(targetModel);
136 tblDisplay.setDropMode(DropMode.INSERT_ROWS);
137 scrDisplay.setViewportView(tblDisplay);
139 pnlButton.setBorder(BorderFactory.createEtchedBorder());
141 btnStart.setText("開始");
143 btnStop.setText("停止");
145 btnDeselect.setText("選択解除");
147 GroupLayout gl_pnlButton = new GroupLayout(pnlButton);
148 pnlButton.setLayout(gl_pnlButton);
149 gl_pnlButton.setHorizontalGroup(
150 gl_pnlButton.createParallelGroup(Alignment.LEADING)
151 .addGroup(gl_pnlButton.createSequentialGroup()
153 .addComponent(btnStart)
154 .addPreferredGap(ComponentPlacement.RELATED)
155 .addComponent(btnStop)
156 .addPreferredGap(ComponentPlacement.RELATED, 250, Short.MAX_VALUE)
157 .addComponent(btnDeselect)
160 gl_pnlButton.setVerticalGroup(
161 gl_pnlButton.createParallelGroup(Alignment.LEADING)
162 .addGroup(gl_pnlButton.createSequentialGroup()
164 .addGroup(gl_pnlButton.createParallelGroup(Alignment.BASELINE)
165 .addComponent(btnStart)
166 .addComponent(btnStop)
167 .addComponent(btnDeselect))
168 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
171 pnlInputMain.setBorder(BorderFactory.createEtchedBorder());
175 fldId.addFocusListener(new java.awt.event.FocusAdapter() {
177 public void focusLost(java.awt.event.FocusEvent evt) {
178 idFieldFocusLost(evt);
182 lblVideo.setText("動画");
184 cbVideoLocal.setText("local");
185 cbVideoLocal.addItemListener(new java.awt.event.ItemListener() {
187 public void itemStateChanged(java.awt.event.ItemEvent evt) {
188 useMovieLocalCheckBoxItemStateChanged(evt);
192 btnVideo.setText("...");
194 lblComment.setText("コメント");
196 cbCommentLocal.setText("local");
197 cbCommentLocal.addItemListener(new java.awt.event.ItemListener() {
199 public void itemStateChanged(java.awt.event.ItemEvent evt) {
200 useMovieLocalCheckBoxItemStateChanged(evt);
204 btnComment.setText("...");
206 lblOutput.setText("出力");
208 cbOutputEnable.setText("変換");
209 cbOutputEnable.addItemListener(new java.awt.event.ItemListener() {
211 public void itemStateChanged(java.awt.event.ItemEvent evt) {
212 outputConvertCheckBoxItemStateChanged(evt);
217 GroupLayout gl_pnlInputMain = new GroupLayout(pnlInputMain);
218 pnlInputMain.setLayout(gl_pnlInputMain);
219 gl_pnlInputMain.setHorizontalGroup(
220 gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
221 .addGroup(gl_pnlInputMain.createSequentialGroup()
223 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
224 .addGroup(gl_pnlInputMain.createSequentialGroup()
225 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
226 .addComponent(lblComment)
227 .addComponent(lblVideo)
229 .addComponent(lblOutput))
230 .addPreferredGap(ComponentPlacement.RELATED)
231 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
232 .addGroup(gl_pnlInputMain.createSequentialGroup()
233 .addComponent(cbVideoLocal)
234 .addPreferredGap(ComponentPlacement.RELATED)
235 .addComponent(fldVideo, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)
236 .addPreferredGap(ComponentPlacement.RELATED)
237 .addComponent(btnVideo))
238 .addGroup(gl_pnlInputMain.createSequentialGroup()
239 .addComponent(fldId, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
240 .addComponent(cbBackLog)
241 .addComponent(fldBackLog, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
242 .addComponent(cbBackLogReduce)
244 .addGroup(Alignment.TRAILING, gl_pnlInputMain.createSequentialGroup()
245 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.TRAILING)
246 .addGroup(Alignment.LEADING, gl_pnlInputMain.createSequentialGroup()
247 .addComponent(cbOutputEnable)
248 .addPreferredGap(ComponentPlacement.RELATED)
249 .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
250 .addGroup(gl_pnlInputMain.createSequentialGroup()
251 .addComponent(cbCommentLocal)
252 .addPreferredGap(ComponentPlacement.RELATED)
253 .addComponent(fldComment, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)))
254 .addPreferredGap(ComponentPlacement.RELATED)
255 .addComponent(btnComment))))
256 .addComponent(btnApply, Alignment.TRAILING))
259 gl_pnlInputMain.setVerticalGroup(
260 gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
261 .addGroup(gl_pnlInputMain.createSequentialGroup()
263 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
264 .addComponent(fldId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
266 .addComponent(cbBackLog)
267 .addComponent(fldBackLog)
268 .addComponent(cbBackLogReduce)
270 .addPreferredGap(ComponentPlacement.RELATED)
271 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
272 .addComponent(lblVideo)
273 .addComponent(fldVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
274 .addComponent(btnVideo)
275 .addComponent(cbVideoLocal))
276 .addPreferredGap(ComponentPlacement.RELATED)
277 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
278 .addComponent(lblComment)
279 .addComponent(fldComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
280 .addComponent(btnComment)
281 .addComponent(cbCommentLocal))
282 .addPreferredGap(ComponentPlacement.RELATED)
283 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
284 .addComponent(lblOutput)
285 .addComponent(fldOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
286 .addComponent(cbOutputEnable))
287 .addPreferredGap(ComponentPlacement.UNRELATED)
288 .addComponent(btnApply)
289 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
292 GroupLayout gl_pnlMain = new GroupLayout(pnlMain);
293 pnlMain.setLayout(gl_pnlMain);
294 gl_pnlMain.setHorizontalGroup(
295 gl_pnlMain.createParallelGroup(Alignment.LEADING)
296 .addGroup(Alignment.TRAILING, gl_pnlMain.createSequentialGroup()
298 .addGroup(gl_pnlMain.createParallelGroup(Alignment.TRAILING)
299 .addComponent(pnlInputMain, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
300 .addComponent(scrDisplay, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
301 .addComponent(pnlButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
304 gl_pnlMain.setVerticalGroup(
305 gl_pnlMain.createParallelGroup(Alignment.LEADING)
306 .addGroup(Alignment.TRAILING, gl_pnlMain.createSequentialGroup()
308 .addComponent(scrDisplay, GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
309 .addPreferredGap(ComponentPlacement.RELATED)
310 .addComponent(pnlButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
311 .addPreferredGap(ComponentPlacement.RELATED)
312 .addComponent(pnlInputMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
317 JMenuBar menuBar = initMenuBar();
318 setJMenuBar(menuBar);
320 GroupLayout layout = new GroupLayout(getContentPane());
321 getContentPane().setLayout(layout);
322 layout.setHorizontalGroup(
323 layout.createParallelGroup(Alignment.LEADING)
324 .addComponent(pnlMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
326 layout.setVerticalGroup(
327 layout.createParallelGroup(Alignment.LEADING)
328 .addComponent(pnlMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
333 pnlMain.setTransferHandler(new DownloadListTransferHandler());
334 tblDisplay.setTransferHandler(new TableTransferHandler());
337 private class ApplyActionListener implements ActionListener {
340 public void actionPerformed(ActionEvent e) {
341 final DownloadProfile prof = new InqubusDownloadProfile();
342 final String id = Util.getVideoId(fldId.getText());
344 new Download(prof, id).execute();
347 /** This method is called from within the constructor to
348 * initialize the form.
349 * WARNING: Do NOT modify this code. The content of this method is
350 * always regenerated by the Form Editor.
352 @SuppressWarnings("unchecked")
353 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
354 private void initComponents() {
355 }// </editor-fold>//GEN-END:initComponents
357 private File searchFileMatchId(final File dir, final String id) throws UnsupportedOperationException {
358 // TODO 候補は複数返すようにして、その後の対処は呼び出しもとで行ってもらった方が良いかも
363 final File[] lists = dir.listFiles(new FilenameFilter() {
365 final Pattern pattern = Pattern.compile(id + "\\D");
368 public boolean accept(File dir, String name) {
369 return pattern.matcher(name).find();
373 if (lists.length == 1) {
375 } else if (lists.length > 1) {
376 throw new UnsupportedOperationException();
382 private void useMovieLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useMovieLocalCheckBoxItemStateChanged
383 final Config p = Config.INSTANCE;
385 final ItemSelectable source = evt.getItemSelectable();
390 if (source == cbVideoLocal) {
393 dir = new File(p.getVideoDir());
397 dir = new File(p.getCommentDir());
400 final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
401 btn.setEnabled(useLocal);
405 final File f = searchFileMatchId(dir, fldId.getText());
412 text = p.getVideoFileNamePattern();
415 }//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged
417 private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged
418 final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED);
419 fldOutput.setEnabled(convert);
420 }//GEN-LAST:event_outputConvertCheckBoxItemStateChanged
422 private void idFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_idFieldFocusLost
423 final Config p = Config.INSTANCE;
424 final String id = fldId.getText();
429 if (cbVideoLocal.isSelected() && fldVideo.getText().isEmpty()) {
430 final File dir = new File(p.getVideoDir());
431 final File file = searchFileMatchId(dir, id);
433 fldVideo.setText(file.getPath());
437 if (cbCommentLocal.isSelected() && fldComment.getText().isEmpty()) {
438 final File dir = new File(p.getCommentDir());
439 final File file = searchFileMatchId(dir, id);
441 fldComment.setText(file.getPath());
445 }//GEN-LAST:event_idFieldFocusLost
446 // Variables declaration - do not modify//GEN-BEGIN:variables
447 private final JTable tblDisplay;
449 private final JButton btnStart;
450 private final JButton btnStop;
451 private final JButton btnDeselect;
453 private final JTextField fldId;
454 private final JCheckBox cbBackLog = new JCheckBox("過去ログ");
455 private final JTextField fldBackLog = new JTextField();
456 private final JCheckBox cbBackLogReduce = new JCheckBox("コメ数減少");
457 private final JCheckBox cbVideoLocal;
458 private final JTextField fldVideo;
459 private final JButton btnVideo;
460 private final JCheckBox cbCommentLocal;
461 private final JTextField fldComment;
462 private final JButton btnComment;
463 private final JCheckBox cbOutputEnable;
464 private final JTextField fldOutput;
466 private final JButton btnApply = new JButton("適用");
467 // End of variables declaration//GEN-END:variables
469 private void initInputPanel() {
470 final Config p = Config.INSTANCE;
473 fldBackLog.setEnabled(false);
474 fldBackLog.setToolTipText("YYYY/MM/DD hh:mm:ss形式、あるいは1970/01/01からの経過秒を入力します。");
475 cbBackLog.setEnabled(true);
476 cbBackLog.addItemListener(new ItemListener() {
479 public void itemStateChanged(ItemEvent e) {
480 final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
481 fldBackLog.setEnabled(selected);
482 cbBackLogReduce.setEnabled(selected);
485 cbBackLogReduce.setEnabled(false);
486 cbBackLogReduce.setToolTipText("「コメントの量を減らす」場合はチェックを付けます。");
488 final boolean movieLocal = p.getVideoUseLocal();
489 cbVideoLocal.setSelected(movieLocal);
490 btnVideo.setEnabled(movieLocal);
492 fldVideo.setText(p.getVideoFileNamePattern());
495 final boolean commentLocal = p.getCommentUseLocal();
496 cbCommentLocal.setSelected(commentLocal);
497 btnComment.setEnabled(commentLocal);
499 fldComment.setText(p.getCommentFileNamePattern());
502 final boolean convert = p.getOutputEnable();
503 cbOutputEnable.setSelected(convert);
504 fldOutput.setEnabled(convert);
505 fldOutput.setText(p.getOutputFileNamePattern());
509 private JMenuBar initMenuBar() {
510 final JMenuBar menuBar = new JMenuBar();
512 final JMenu mnFile = new JMenu("ファイル(F)");
515 final JMenuItem itExit = new JMenuItem("終了(X)", KeyEvent.VK_X);
516 itExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
517 itExit.addActionListener(new ActionListener() {
520 public void actionPerformed(ActionEvent e) {
521 throw new UnsupportedOperationException("Not supported yet.");
526 final JMenu mnTool = new JMenu("ツール(T)");
529 final JMenuItem itOption = new JMenuItem("オプション(O)...", KeyEvent.VK_O);
531 itOption.addActionListener(new ActionListener() {
534 public void actionPerformed(ActionEvent e) {
535 final yukihane.inqubus.gui.ConfigDialog dlg = new yukihane.inqubus.gui.ConfigDialog(MainFrame.this);
536 dlg.setLocationRelativeTo(MainFrame.this);
538 dlg.setVisible(true);
541 mnTool.add(itOption);
543 final JMenu mnHelp = new JMenu("ヘルプ(H)");
546 final JMenuItem itAbout = new JMenuItem("このソフトウェアについて(A)...", KeyEvent.VK_A);
547 itAbout.addActionListener(new ActionListener() {
550 public void actionPerformed(ActionEvent e) {
551 MainFrame_AboutBox dlg = new MainFrame_AboutBox(MainFrame.this);
553 dlg.setLocationRelativeTo(MainFrame.this);
555 dlg.setVisible(true);
563 private class DownloadListTransferHandler extends TransferHandler {
565 private static final long serialVersionUID = 1L;
566 private final Pattern movieIdPattern = Pattern.compile("(\\w\\w\\d+)");
569 public boolean canImport(TransferHandler.TransferSupport support) {
570 Transferable transferable = support.getTransferable();
571 if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)
572 || transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
579 public boolean importData(TransferHandler.TransferSupport support) {
581 Transferable transferable = support.getTransferable();
582 if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
583 @SuppressWarnings("unchecked")
584 final List<File> data = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
585 Collection<Target> targets = Target.from(data);
586 targetModel.addTarget(targets);
587 } else if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
588 String data = (String) transferable.getTransferData(DataFlavor.stringFlavor);
589 Matcher matcher = movieIdPattern.matcher(data);
590 if (matcher.find()) {
591 String movieId = matcher.group(1);
592 Target target = Target.fromId(movieId);
593 targetModel.addTarget(target);
600 } catch (Exception e) {
601 logger.log(Level.SEVERE, null, e);
607 private class TableTransferHandler extends DownloadListTransferHandler {
609 private static final long serialVersionUID = 1L;
612 public boolean canImport(TransferHandler.TransferSupport support) {
613 return super.canImport(support);
617 public boolean importData(TransferHandler.TransferSupport support) {
618 return super.importData(support);
623 private class InqubusDownloadProfile implements DownloadProfile {
625 private final LoginProfile loginProfile;
626 private final ProxyProfile proxyProfile;
627 private final VideoProfile videoProfile;
628 private final CommentProfile commentProfile;
629 private final GeneralProfile generalProfile;
631 private InqubusDownloadProfile() {
632 this.loginProfile = new InqubusLoginProfile();
633 this.proxyProfile = new InqubusProxyProfile();
634 this.videoProfile = new InqubusVideoProfile();
635 this.commentProfile = new InqubusCommentProfile();
636 this.generalProfile = new InqubusGeneralProfile();
640 public LoginProfile getLoginInfo() {
641 return this.loginProfile;
645 public ProxyProfile getProxyProfile() {
646 return this.proxyProfile;
650 public VideoProfile getVideoProfile() {
651 return this.videoProfile;
655 public CommentProfile getCommentProfile() {
656 return this.commentProfile;
660 public GeneralProfile getGeneralProfile() {
661 return this.generalProfile;
665 private class InqubusLoginProfile implements LoginProfile {
666 private final String mail;
667 private final String password;
669 private InqubusLoginProfile(){
670 final Config p = Config.INSTANCE;
671 this.mail = p.getId();
672 this.password = p.getPassword();
676 public String getMail() {
681 public String getPassword() {
682 return this.password;
686 private class InqubusProxyProfile implements ProxyProfile {
687 private final boolean use;
688 private final String host;
689 private final int port;
691 private InqubusProxyProfile(){
692 final Config p = Config.INSTANCE;
693 this.use = p.getProxyUse();
694 this.host = p.getProxyHost();
695 final String pp = p.getProxyPort();
696 this.port = StringUtils.isBlank(pp) ? -1 : Integer.parseInt(pp);
700 public boolean use() {
705 public String getHost() {
710 public int getPort() {
715 private class InqubusVideoProfile implements VideoProfile {
716 private final boolean download;
717 private final File dir;
718 private final String fileName;
719 private final File localFile;
721 private InqubusVideoProfile(){
722 this.download = !cbVideoLocal.isSelected();
724 this.dir = new File(fldVideo.getText());
725 // TODO ディレクトリとファイル名の入力欄を分ける
726 this.fileName = "{id}_{title}";
727 this.localFile = null;
730 this.fileName = null;
731 this.localFile = new File(fldVideo.getText());
736 public boolean isDownload() {
737 return this.download;
741 public File getDir() {
746 public String getFileName() {
747 return this.fileName;
751 public File getLocalFile() {
752 return this.localFile;
756 private class InqubusCommentProfile implements CommentProfile {
759 public int getLengthRelatedCommentSize() {
760 throw new UnsupportedOperationException("Not supported yet.");
764 public boolean isDisablePerMinComment() {
765 throw new UnsupportedOperationException("Not supported yet.");
769 public int getPerMinCommentSize() {
770 throw new UnsupportedOperationException("Not supported yet.");
774 public long getBackLogPoint() {
775 throw new UnsupportedOperationException("Not supported yet.");
779 public boolean isDownload() {
780 throw new UnsupportedOperationException("Not supported yet.");
784 public File getDir() {
785 throw new UnsupportedOperationException("Not supported yet.");
789 public String getFileName() {
790 throw new UnsupportedOperationException("Not supported yet.");
794 public File getLocalFile() {
795 throw new UnsupportedOperationException("Not supported yet.");
800 private class InqubusGeneralProfile implements GeneralProfile {
801 // private final String replaceFrom;
802 private InqubusGeneralProfile() {
803 final Config p = Config.INSTANCE;
804 // TODO 置換文字設定コンフィグが無い
805 // this.replaceFrom = p.get
809 public String getReplaceFrom() {
810 // return this.replaceFrom;
811 throw new UnsupportedOperationException("Not supported yet.");
815 public String getReplaceTo() {
816 throw new UnsupportedOperationException("Not supported yet.");