OSDN Git Service

Converterのコンストラクタ引数に指定するのはURLでなく動画IDとする.
[coroid/inqubus.git] / frontend / src / saccubus / MainFrame.java
1 package saccubus;
2
3 import java.io.IOException;
4 import saccubus.converter.Converter;
5 import java.awt.BorderLayout;
6 import java.awt.Dimension;
7 import java.awt.GridBagConstraints;
8 import java.awt.GridBagLayout;
9 import java.awt.GridLayout;
10 import java.awt.Image;
11 import java.awt.Insets;
12 import java.awt.Toolkit;
13 import java.awt.dnd.DnDConstants;
14 import java.awt.dnd.DropTarget;
15 import java.awt.event.ActionEvent;
16 import java.awt.event.ActionListener;
17 import java.awt.event.KeyEvent;
18 import java.awt.event.WindowAdapter;
19 import java.awt.event.WindowEvent;
20 import java.io.File;
21 import java.util.concurrent.FutureTask;
22 import java.util.logging.Level;
23 import java.util.logging.Logger;
24 import javax.swing.BorderFactory;
25 import javax.swing.ButtonGroup;
26 import javax.swing.GroupLayout;
27 import javax.swing.JButton;
28 import javax.swing.JCheckBox;
29 import javax.swing.JComboBox;
30 import javax.swing.JFileChooser;
31 import javax.swing.JFrame;
32 import javax.swing.JLabel;
33 import javax.swing.JMenu;
34 import javax.swing.JMenuBar;
35 import javax.swing.JMenuItem;
36 import javax.swing.JOptionPane;
37 import javax.swing.JPanel;
38 import javax.swing.JPasswordField;
39 import javax.swing.JRadioButton;
40 import javax.swing.JTabbedPane;
41 import javax.swing.JTextField;
42 import javax.swing.LayoutStyle.ComponentPlacement;
43 import javax.swing.SwingUtilities;
44 import nicobrowser.entity.NicoContent;
45 import nicobrowser.main.Main;
46 import org.apache.commons.lang.StringUtils;
47 import saccubus.ConvertStopFlag.State;
48 import saccubus.converter.classic.profile.FfmpegOption;
49 import saccubus.converter.classic.profile.NgSetting;
50 import saccubus.net.TextProgressListener;
51 import saccubus.properties.BasicSetting;
52 import saccubus.properties.ConvertSetting;
53 import saccubus.properties.InputCommentSetting;
54 import saccubus.properties.InputVideoSetting;
55 import saccubus.properties.SProperties;
56 import saccubus.properties.InputTcommentSetting;
57 import saccubus.properties.MovieSetting;
58 import saccubus.properties.OutputVideoSetting;
59 import saccubus.util.FileDropTarget;
60 import saccubus.util.PopupRightClick;
61 import saccubus.util.WayBackTimeParser;
62 import yukihane.Util;
63 import yukihane.nicovideo.NicoDBFinder;
64
65 /**
66  * <p>
67  * タイトル: さきゅばす
68  * </p>
69  *
70  * <p>
71  * 説明: ニコニコ動画の動画をコメントつきで保存
72  * </p>
73  *
74  * <p>
75  * 著作権: Copyright (c) 2007 PSI
76  * </p>
77  *
78  * <p>
79  * 会社名:
80  * </p>
81  *
82  * @author 未入力
83  * @version 1.0
84  */
85 public class MainFrame extends JFrame {
86
87     private static final long serialVersionUID = 2564486741331062989L;
88     public static final String PRODUCT_NAME = "いんきゅばす";
89     public static final String VERSION = "1.7.2 (NicoBrowser" + Main.VERSION + ")";
90     public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource(
91             "icon32.png"));
92     // TODO GUIが無いためフィールドに保持.
93     private File tempDir;
94     JPanel contentPane;
95     BorderLayout borderLayout1 = new BorderLayout();
96     JMenuBar jMenuBar1 = new JMenuBar();
97     JMenu jMenuFile = new JMenu();
98     JMenuItem jMenuFileExit = new JMenuItem();
99     JMenu jMenuHelp = new JMenu();
100     JMenuItem jMenuHelpAbout = new JMenuItem();
101     JLabel statusBar = new JLabel();
102     JTabbedPane mainTabbedPane = new JTabbedPane();
103     JPanel SavingInfoTabPanel = new JPanel();
104     JPanel FFMpegTabPanel = new JPanel();
105     // メインウィンドウ
106     private JPanel videoInfoPanel = new JPanel();
107     private JPanel opPanel = new JPanel();
108     private JLabel videoIdLabel = new JLabel();
109     private JTextField videoIdField = new JTextField();
110     private JLabel wayBackLabel = new JLabel();
111     private JTextField wayBackField = new JTextField();
112     private JCheckBox reduceCommentCheckBox = new JCheckBox();
113     private JButton doButton = new JButton();
114     public static final String DoButtonDefString = "変換";
115     public static final String DoButtonStopString = "停止";
116     public static final String DoButtonWaitString = "待機";
117     JPanel UserInfoPanel = new JPanel();
118     GridBagLayout gridBagLayout3 = new GridBagLayout();
119     // ユーザ設定
120     JLabel mailAddressLabel = new JLabel();
121     JTextField mailAddressField = new JTextField();
122     JLabel passwordLabel = new JLabel();
123     JPasswordField passwordField = new JPasswordField();
124     GridBagLayout gridBagLayout4 = new GridBagLayout();
125     GridBagLayout gridBagLayout6 = new GridBagLayout();
126     ButtonGroup CommentSaveButtonGroup = new ButtonGroup();
127     ButtonGroup ConvSaveButtonGroup = new ButtonGroup();
128
129     private class FfmpegOptionCheckBoxListener implements ActionListener{
130
131         @Override
132         public void actionPerformed(ActionEvent e) {
133             setFFMpegOptionCheckbox();
134         }
135     }
136     private final FfmpegOptionCheckBoxListener ffmpegOptionCheckBoxListener = new FfmpegOptionCheckBoxListener();
137
138     private void setFFMpegOptionCheckbox() {
139         boolean resizable = (resizeCheckBox.isEnabled() && resizeCheckBox.isSelected());
140         resizeWidthField.setEnabled(resizable);
141         resizeHeigitField.setEnabled(resizable);
142         adjustRatioCheckBox.setEnabled(resizable);
143
144     }
145
146     private void setNames() {
147         mainTabbedPane.setName("mainTabbedPane");
148
149         mailAddressField.setName("mailAddressField");
150         passwordField.setName("passwordField");
151
152         ffmpegPathField.setName("ffmpegPathField");
153         vhookPathField.setName("vhookPathField");
154
155         mainOptionField.setName("mainOptionField");
156         inputOptionField.setName("inputOptionField");
157         outputOptionField.setName("outputOptionField");
158
159         fontPathField.setName("fontPathField");
160         fontIndexField.setName("fontIndexField");
161         showConvVideoCheckBox.setName("showConvVideoCheckBox");
162     }
163
164     public MainFrame() {
165         setNames();
166
167         videoSaveInfoPanel = savePanel.getVideoSaveInfoPanel();
168
169         try {
170             setDefaultCloseOperation(EXIT_ON_CLOSE);
171             jbInit();
172             setPopup();
173             setDropTarget();
174             SProperties setting = SProperties.loadSetting(null,
175                     null);
176             this.setSetting(setting);
177         } catch (Exception exception) {
178             exception.printStackTrace();
179         }
180     }
181
182     /**
183      * メイン画面最上部(ID/URL, 過去ログ, 変換ボタン)のパネルを初期化します.
184      */
185     private void initVideoInfoPanel() {
186
187         videoIdLabel.setText("URL/ID");
188         wayBackLabel.setText("過去ログ");
189         videoIdField.setText("http://www.nicovideo.jp/watch/");
190         reduceCommentCheckBox.setText("旧仕様コメント数");
191
192         final GroupLayout oppLayout = new GroupLayout(opPanel);
193         opPanel.setLayout(oppLayout);
194
195         oppLayout.setHorizontalGroup(oppLayout.createSequentialGroup()
196                 .addGroup(oppLayout.createParallelGroup()
197                     .addComponent(videoIdLabel)
198                     .addComponent(wayBackLabel))
199                 .addGroup(oppLayout.createParallelGroup()
200                     .addComponent(videoIdField)
201                     .addGroup(oppLayout.createSequentialGroup()
202                         .addComponent(wayBackField)
203                         .addComponent(reduceCommentCheckBox)))
204                 );
205
206         oppLayout.setVerticalGroup(oppLayout.createSequentialGroup()
207                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
208                         .addComponent(videoIdLabel)
209                         .addComponent(videoIdField))
210                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
211                         .addComponent(wayBackLabel)
212                         .addComponent(wayBackField)
213                         .addComponent(reduceCommentCheckBox))
214                 );
215
216         doButton.setText(DoButtonDefString);
217         doButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
218
219         final GroupLayout vipLayout = new GroupLayout(videoInfoPanel);
220         videoInfoPanel.setLayout(vipLayout);
221
222         vipLayout.setHorizontalGroup(vipLayout.createSequentialGroup()
223                 .addComponent(opPanel).addComponent(doButton));
224
225         vipLayout.setVerticalGroup(vipLayout.createParallelGroup()
226                 .addComponent(opPanel).addComponent(doButton, 10, 20, 50));
227     }
228
229     /**
230      * コンポーネントの初期化。
231      *
232      * @throws java.lang.Exception
233      */
234     private void jbInit() throws Exception {
235
236         initVideoInfoPanel();
237
238         GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
239                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
240         gridBagConstraints74.gridwidth = 2;
241         GridBagConstraints gridBagConstraints73 = new GridBagConstraints();
242         gridBagConstraints73.fill = GridBagConstraints.HORIZONTAL;
243         gridBagConstraints73.gridy = 6;
244         gridBagConstraints73.weightx = 1.0;
245         gridBagConstraints73.gridwidth = 4;
246         gridBagConstraints73.insets = new Insets(0, 0, 0, 5);
247         gridBagConstraints73.gridx = 1;
248         GridBagConstraints gridBagConstraints72 = new GridBagConstraints();
249         gridBagConstraints72.gridx = 0;
250         gridBagConstraints72.anchor = GridBagConstraints.WEST;
251         gridBagConstraints72.insets = new Insets(0, 5, 0, 5);
252         gridBagConstraints72.fill = GridBagConstraints.NONE;
253         gridBagConstraints72.gridwidth = 1;
254         gridBagConstraints72.gridy = 6;
255         ShadowKindLabel = new JLabel();
256         ShadowKindLabel.setText("影の種類");
257         ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
258         GridBagConstraints gridBagConstraints66 = new GridBagConstraints();
259         gridBagConstraints66.gridx = 0;
260         gridBagConstraints66.insets = new Insets(0, 5, 5, 5);
261         gridBagConstraints66.anchor = GridBagConstraints.WEST;
262         gridBagConstraints66.gridwidth = 2;
263         gridBagConstraints66.gridy = 1;
264         ViewCommentLabel = new JLabel();
265         ViewCommentLabel.setText("表示コメント数");
266         GridBagConstraints gridBagConstraints65 = new GridBagConstraints();
267         gridBagConstraints65.fill = GridBagConstraints.HORIZONTAL;
268         gridBagConstraints65.gridy = 1;
269         gridBagConstraints65.weightx = 1.0;
270         gridBagConstraints65.gridwidth = 6;
271         gridBagConstraints65.insets = new Insets(0, 5, 5, 5);
272         gridBagConstraints65.gridx = 3;
273         GridBagConstraints gridBagConstraints64 = new GridBagConstraints(1, 1,
274                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
275                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
276         gridBagConstraints64.gridy = 3;
277         gridBagConstraints64.fill = GridBagConstraints.HORIZONTAL;
278         gridBagConstraints64.gridx = 4;
279         GridBagConstraints gridBagConstraints63 = new GridBagConstraints(0, 4,
280                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
281                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
282         gridBagConstraints63.gridy = 7;
283         gridBagConstraints63.gridx = 0;
284         gridBagConstraints63.gridwidth = 5;
285         GridBagConstraints gridBagConstraints62 = new GridBagConstraints(0, 3,
286                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
287                 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
288         gridBagConstraints62.gridy = 5;
289         gridBagConstraints62.gridx = 1;
290         gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL;
291         gridBagConstraints62.insets = new Insets(0, 0, 5, 5);
292         gridBagConstraints62.gridwidth = 4;
293         GridBagConstraints gridBagConstraints61 = new GridBagConstraints(0, 2,
294                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
295                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
296         gridBagConstraints61.gridy = 5;
297         gridBagConstraints61.gridx = 0;
298         gridBagConstraints61.fill = GridBagConstraints.VERTICAL;
299         gridBagConstraints61.anchor = GridBagConstraints.WEST;
300         gridBagConstraints61.gridwidth = 1;
301         GridBagConstraints gridBagConstraints60 = new GridBagConstraints(0, 1,
302                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
303                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0);
304         gridBagConstraints60.gridy = 3;
305         gridBagConstraints60.gridx = 1;
306         gridBagConstraints60.fill = GridBagConstraints.HORIZONTAL;
307         gridBagConstraints60.insets = new Insets(0, 0, 0, 5);
308         gridBagConstraints60.gridwidth = 3;
309         GridBagConstraints gridBagConstraints59 = new GridBagConstraints(0, 0,
310                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
311                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);
312         gridBagConstraints59.gridy = 3;
313         gridBagConstraints59.insets = new Insets(5, 5, 5, 5);
314         gridBagConstraints59.gridx = 0;
315         gridBagConstraints59.fill = GridBagConstraints.NONE;
316         gridBagConstraints59.anchor = GridBagConstraints.WEST;
317         gridBagConstraints59.weightx = 0.0;
318         gridBagConstraints59.gridwidth = 1;
319         GridBagConstraints gridBagConstraints58 = new GridBagConstraints();
320         gridBagConstraints58.gridx = 0;
321         gridBagConstraints58.anchor = GridBagConstraints.WEST;
322         gridBagConstraints58.insets = new Insets(0, 5, 5, 5);
323         gridBagConstraints58.gridwidth = 5;
324         gridBagConstraints58.weightx = 1.0;
325         gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL;
326         gridBagConstraints58.gridy = 0;
327
328         GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
329                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
330         gridBagConstraints54.gridwidth = 3;
331
332         GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
333         gridBagConstraints33.gridx = 0;
334         gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
335         gridBagConstraints33.weightx = 1.0;
336         gridBagConstraints33.insets = new Insets(0, 5, 5, 5);
337         gridBagConstraints33.gridwidth = 5;
338         gridBagConstraints33.gridy = 9;
339
340         GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
341         gridBagConstraints14.gridx = 0;
342         gridBagConstraints14.anchor = GridBagConstraints.WEST;
343         gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
344         gridBagConstraints14.weightx = 1.0;
345         gridBagConstraints14.gridwidth = 5;
346         gridBagConstraints14.insets = new Insets(0, 5, 0, 5);
347         gridBagConstraints14.gridy = 8;
348         GridBagConstraints gridBagConstraints7 = new GridBagConstraints(0, 0,
349                 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
350                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
351         gridBagConstraints7.weighty = 0.0;
352         GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
353         gridBagConstraints6.gridx = 0;
354         gridBagConstraints6.weighty = 1.0;
355         gridBagConstraints6.weightx = 1.0;
356         gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
357         gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
358         gridBagConstraints6.anchor = GridBagConstraints.NORTH;
359         gridBagConstraints6.gridy = 1;
360         GridBagConstraints gridBagConstraints1 = new GridBagConstraints(0, 1,
361                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
362                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
363         gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
364         gridBagConstraints1.anchor = GridBagConstraints.NORTH;
365         gridBagConstraints1.weighty = 1.0;
366
367         this.setIconImage(WinIcon);
368         contentPane = (JPanel) this.getContentPane();
369         contentPane.setLayout(borderLayout1);
370         setSize(new Dimension(400, 450));
371         setTitle(PRODUCT_NAME + " " + VERSION);
372         this.addWindowListener(new MainFrame_this_windowAdapter(this));
373         statusBar.setText(" ");
374         jMenuFile.setText("ファイル");
375         jMenuFileExit.setText("終了");
376         jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter(
377                 this));
378         jMenuHelp.setText("ヘルプ");
379         jMenuHelpAbout.setText("バージョン情報");
380         jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
381                 this));
382         SavingInfoTabPanel.setLayout(new GridLayout());
383         UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定"));
384         UserInfoPanel.setLayout(gridBagLayout3);
385         mailAddressLabel.setText("メールアドレス");
386         passwordLabel.setText("パスワード");
387
388         setListenerToSavePanelButton();
389
390         FFMpegTabPanel.setLayout(gridBagLayout6);
391         PathSettingPanel.setBorder(BorderFactory.createTitledBorder(
392                 BorderFactory.createEtchedBorder(), "プログラムの位置の設定"));
393         PathSettingPanel.setLayout(gridBagLayout7);
394         FFmpegPathLabel.setText("FFmpeg");
395         SettingFFmpegPathButton.setText("参照");
396         SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter(
397                 this));
398         VhookPathLabel.setText("拡張vhookライブラリ");
399         SettingVhookPathButton.setText("参照");
400         SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter(
401                 this));
402         VhookSettingPanel.setLayout(gridBagLayout8);
403         VhookSettingPanel.setBorder(BorderFactory.createTitledBorder(
404                 BorderFactory.createEtchedBorder(), "拡張vhookライブラリの設定"));
405         FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder(
406                 BorderFactory.createEtchedBorder(), "FFmpegの設定"));
407         FFmpegSettingPanel.setLayout(gblFFmpegSettingPanel);
408         FontPathLabel.setText("フォントパス");
409         SettingFontPathButton.setText("参照");
410         SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter(
411                 this));
412         showConvVideoCheckBox.setText("変換中の画像を表示する");
413
414         extOptionLabel.setText("出力動画の拡張子");
415         inputOptionLabel.setText("入力オプション");
416         outputOptionLabel.setText("出力オプション");
417         mainOptionLabel.setText("メインオプション");
418         avfilterOptionLabel.setText("avfilterオプション");
419
420         FontIndexLabel.setText("フォント番号");
421
422         BasicInfoTabPanel.setLayout(gridBagLayout12);
423         jMenuBar1.add(jMenuFile);
424         jMenuFile.add(jMenuFileExit);
425         jMenuBar1.add(jMenuHelp);
426         jMenuHelp.add(jMenuHelpAbout);
427         setJMenuBar(jMenuBar1);
428
429         contentPane.add(statusBar, BorderLayout.SOUTH);
430         contentPane.add(mainTabbedPane, java.awt.BorderLayout.CENTER);
431         contentPane.add(videoInfoPanel, java.awt.BorderLayout.NORTH);
432         UserInfoPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1,
433                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
434                 new Insets(0, 5, 5, 5), 0, 0));
435         UserInfoPanel.add(mailAddressField, new GridBagConstraints(1, 0, 1, 1,
436                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
437                 new Insets(0, 5, 5, 5), 0, 0));
438         UserInfoPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1,
439                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
440                 new Insets(0, 5, 5, 0), 0, 0));
441         UserInfoPanel.add(mailAddressLabel, new GridBagConstraints(0, 0, 1, 1,
442                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
443                 new Insets(0, 5, 5, 0), 0, 0));
444         PathSettingPanel.add(ffmpegPathField, new GridBagConstraints(0, 1, 1,
445                 1, 1.0, 0.0, GridBagConstraints.CENTER,
446                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
447         PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74);
448         PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2,
449                 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
450                 new Insets(0, 5, 5, 5), 0, 0));
451         PathSettingPanel.add(vhookPathField, new GridBagConstraints(0, 3, 1, 1,
452                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
453                 new Insets(0, 5, 5, 5), 0, 0));
454         PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1,
455                 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
456                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
457         PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
458
459
460         final GroupLayout layout = new GroupLayout(FFmpegSettingPanel);
461         FFmpegSettingPanel.setLayout(layout);
462
463         layout.setHorizontalGroup(layout.createParallelGroup()
464                 .addComponent(getFFmpegOptionComboBoxPanel())
465                 .addGroup(layout.createSequentialGroup()
466                     .addGroup(layout.createParallelGroup()
467                         .addComponent(extOptionLabel)
468                         .addComponent(mainOptionLabel)
469                         .addComponent(inputOptionLabel)
470                         .addComponent(outputOptionLabel)
471                         .addComponent(avfilterOptionLabel)
472                     )
473                     .addPreferredGap(ComponentPlacement.RELATED)
474                     .addGroup(layout.createParallelGroup()
475                         .addComponent(extOptionField)
476                         .addComponent(mainOptionField)
477                         .addComponent(inputOptionField)
478                         .addComponent(outputOptionField)
479                         .addComponent(avfilterOptionField)
480                     )
481                 )
482                 .addGroup(layout.createParallelGroup()
483                     .addGroup(layout.createSequentialGroup()
484                         .addComponent(resizeCheckBox)
485                         .addPreferredGap(ComponentPlacement.UNRELATED)
486                         .addComponent(resizeWidthLabel)
487                         .addPreferredGap(ComponentPlacement.RELATED)
488                         .addComponent(resizeWidthField)
489                         .addPreferredGap(ComponentPlacement.UNRELATED)
490                         .addComponent(resizeHeightLabel)
491                         .addPreferredGap(ComponentPlacement.RELATED)
492                         .addComponent(resizeHeigitField)
493                     )
494                 )
495                 .addGroup(layout.createSequentialGroup()
496                     .addGap(10)
497                     .addComponent(adjustRatioCheckBox))
498                 .addGroup(layout.createSequentialGroup()
499                     .addGap(20)
500                 )
501             );
502
503         layout.setVerticalGroup(layout.createSequentialGroup()
504             .addComponent(getFFmpegOptionComboBoxPanel())
505             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
506                 .addComponent(extOptionLabel)
507                 .addComponent(extOptionField))
508             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
509                 .addComponent(mainOptionLabel)
510                 .addComponent(mainOptionField))
511             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
512                 .addComponent(inputOptionLabel)
513                 .addComponent(inputOptionField))
514             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
515                 .addComponent(outputOptionLabel)
516                 .addComponent(outputOptionField))
517             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
518                 .addComponent(avfilterOptionLabel)
519                 .addComponent(avfilterOptionField))
520             .addGroup(layout.createSequentialGroup()
521                 .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
522                     .addComponent(resizeCheckBox)
523                     .addComponent(resizeWidthLabel)
524                     .addComponent(resizeWidthField)
525                     .addComponent(resizeHeightLabel)
526                     .addComponent(resizeHeigitField))
527                 .addComponent(adjustRatioCheckBox)
528                 )
529             );
530
531         resizeCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
532         adjustRatioCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
533         setFFMpegOptionCheckbox();
534
535
536
537         mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
538         mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
539         mainTabbedPane.add(FFMpegTabPanel, "動画設定");
540         mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null);
541         SavingInfoTabPanel.add(savePanel);
542         BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
543         BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
544         VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
545         VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63);
546         VhookSettingPanel.add(fontPathField, gridBagConstraints60);
547         VhookSettingPanel.add(fontIndexField, gridBagConstraints62);
548         VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
549         VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
550         VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
551         VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
552         VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
553         VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
554         VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
555         VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
556         VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
557
558         FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
559                 1.0, 0.0, GridBagConstraints.NORTHEAST,
560                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
561         FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
562     }
563
564     /**
565      * 保存設定パネル内のボタンにアクションリスナを割り当てる.
566      */
567     private void setListenerToSavePanelButton() {
568         ActionListener al;
569         al = new InputVideoPanelButtonListener();
570         videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
571         videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
572         videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
573
574         al = new VideoUseRadioButtonListener();
575         videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
576         videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
577         videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
578
579         al = new InputCommentPanelButtonListener();
580         savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
581         savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
582
583         al = new OutputVideoPanelButtonListener();
584         savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
585         savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
586     }
587
588     private void setPopup() {
589         mainOptionField.addMouseListener(new PopupRightClick(
590                 this.mainOptionField));
591         inputOptionField.addMouseListener(new PopupRightClick(
592                 this.inputOptionField));
593         outputOptionField.addMouseListener(new PopupRightClick(
594                 this.outputOptionField));
595         savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
596                 savePanel.getCommentNumField()));
597
598         savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
599                 savePanel.getCommentSavedFileField()));
600         savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
601                 savePanel.getCommentSavedFolderField()));
602
603         savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
604                 savePanel.getConvertedVideoSavedFileField()));
605         savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
606                 savePanel.getConvertedVideoSavedFolderField()));
607
608         videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
609                 videoSaveInfoPanel.getVideoSavedFileField()));
610         videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
611                 videoSaveInfoPanel.getVideoSavedFolderField()));
612         videoSaveInfoPanel.getNibrFileField().addMouseListener(
613                 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
614
615         ffmpegPathField.addMouseListener(new PopupRightClick(
616                 this.ffmpegPathField));
617         vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField));
618         videoIdField.addMouseListener(new PopupRightClick(
619                 this.videoIdField));
620         viewCommentField.addMouseListener(new PopupRightClick(
621                 this.viewCommentField));
622         fontPathField.addMouseListener(new PopupRightClick(this.fontPathField));
623         mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField));
624         passwordField.addMouseListener(new PopupRightClick(this.passwordField));
625         wayBackField.addMouseListener(new PopupRightClick(this.wayBackField));
626
627         proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField));
628         proxyPortTextField.addMouseListener(new PopupRightClick(
629                 this.proxyPortTextField));
630
631         fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField));
632
633         ngWordTextField.addMouseListener(new PopupRightClick(
634                 this.ngWordTextField));
635         ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField));
636     }
637
638     private void setDropTarget() {
639         addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
640         addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
641         addTarget(videoSaveInfoPanel.getNibrFileField(), false);
642
643         addTarget(savePanel.getCommentSavedFileField(), false);
644         addTarget(savePanel.getCommentSavedFolderField(), true);
645
646         addTarget(savePanel.getConvertedVideoSavedFileField(), false);
647         addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
648
649         addTarget(ffmpegPathField, false);
650         addTarget(vhookPathField, false);
651         addTarget(fontPathField, false);
652
653     }
654
655     /**
656      * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする.
657      * @param c 設定対象のテキストフィールドオブジェクト.
658      * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse.
659      * @return ドロップターゲット(用途無し).
660      */
661     private DropTarget addTarget(JTextField c, boolean isDir) {
662         return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
663                 c, isDir), true);
664     }
665     private File CurrentDir = new File(".");
666     private JPanel PathSettingPanel = new JPanel();
667     private JLabel FFmpegPathLabel = new JLabel();
668     private GridBagLayout gridBagLayout7 = new GridBagLayout();
669     private JTextField ffmpegPathField = new JTextField();
670     private JButton SettingFFmpegPathButton = new JButton();
671     private JLabel VhookPathLabel = new JLabel();
672     private JTextField vhookPathField = new JTextField();
673     private JButton SettingVhookPathButton = new JButton();
674     private JPanel VhookSettingPanel = new JPanel();
675     private GridBagLayout gridBagLayout8 = new GridBagLayout();
676     private JPanel FFmpegSettingPanel = new JPanel();
677     private GridBagLayout gblFFmpegSettingPanel = new GridBagLayout();
678     private JLabel FontPathLabel = new JLabel();
679     private JTextField fontPathField = new JTextField();
680     private JButton SettingFontPathButton = new JButton();
681     private JCheckBox showConvVideoCheckBox = new JCheckBox();
682
683     private void showSaveDialog(String title, JTextField field, boolean isSave,
684             boolean isDir) {
685         JFileChooser chooser = new JFileChooser(CurrentDir);
686         chooser.setDialogTitle(title);
687         int code = 0;
688         if (isDir) {
689             chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
690         }
691         if (isSave) {
692             code = chooser.showSaveDialog(this);
693         } else {
694             code = chooser.showOpenDialog(this);
695         }
696         if (code == JFileChooser.APPROVE_OPTION) {
697             if (isDir) {
698                 CurrentDir = chooser.getSelectedFile();
699                 field.setText(CurrentDir.getAbsolutePath());
700             } else {
701                 File selected = chooser.getSelectedFile();
702                 CurrentDir = chooser.getCurrentDirectory();
703                 field.setText(selected.getAbsolutePath());
704             }
705         }
706     }
707
708     private SProperties getSetting() {
709         SProperties setting = new SProperties(
710                 getBasicSetting(),
711                 getInputVideoSetting(),
712                 getInputCommentSetting(),
713                 getTcommentSetting(),
714                 getOutputVideoSetting(),
715                 getMovieSetting(),
716                 getConvertSetting());
717         return setting;
718     }
719
720     /**
721      * 設定を画面に反映する.
722      * @param setting 反映する設定.
723      */
724     private void setSetting(SProperties setting) {
725         // 基本設定
726         final BasicSetting basic = setting.getBasicSetting();
727         tempDir = basic.getTempDir();
728         mailAddressField.setText(basic.getUser().getMail());
729         passwordField.setText(basic.getUser().getPassword());
730         // プロキシ関連
731         useProxyCheckBox.setSelected(basic.isProxyUse());
732         proxyTextField.setText(basic.getProxyHost());
733         int proxy_port = basic.getProxyPort();
734         if (proxy_port >= 0 && proxy_port <= 65535) {
735             proxyPortTextField.setText(Integer.toString(proxy_port));
736         } else {
737             proxyPortTextField.setText("");
738         }
739
740         // 保存設定 - 入力動画
741         final InputVideoSetting inVideo = setting.getInputVideoSetting();
742         JRadioButton activeButton;
743         switch (inVideo.getProcessKind()) {
744             case NO_SAVE:
745                 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
746                 break;
747             case NICOBROWSER:
748                 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
749                 break;
750             case SAVE:
751             default:
752                 activeButton = videoSaveInfoPanel.getVideoSaveButton();
753                 break;
754         }
755         activeButton.doClick();
756
757         videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
758         videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
759         videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
760         final boolean videoFixName = inVideo.isAutoNaming();
761         videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
762         videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
763         videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
764
765         // 保存設定 - 入力コメント
766         final InputCommentSetting inputComment = setting.getInputCommentSetting();
767         savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
768         savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
769         savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
770         savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
771         savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
772         savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
773         boolean commentFixName = inputComment.isAutoNaming();
774         savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
775         savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
776
777         // 投稿者コメント
778         InputTcommentSetting tcom = setting.getInputTcommentSetting();
779         savePanel.setTcommentDownload(tcom.getProcessKind());
780         savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
781         savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
782         savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
783         savePanel.setTcommentFileName(tcom.getFile().getPath());
784
785         // 保存設定 - 出力コメント付き動画
786         final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
787         savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
788         savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
789         savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
790         savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
791         savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
792         savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
793         boolean convFixName = outputVideo.isAutoNaming();
794         savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
795         savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
796
797         // 動画設定
798         final MovieSetting movie = setting.getMovieSetting();
799         ffmpegPathField.setText(movie.getFfmpeg().toString());
800         vhookPathField.setText(movie.getVhook().toString());
801         extOptionField.setText(movie.getFfmpegOption().getExtOption());
802         mainOptionField.setText(movie.getFfmpegOption().getMainOption());
803         inputOptionField.setText(movie.getFfmpegOption().getInOption());
804         outputOptionField.setText(movie.getFfmpegOption().getOutOption());
805         avfilterOptionField.setText(movie.getFfmpegOption().getAvfilterOption());
806         resizeCheckBox.setSelected(movie.getFfmpegOption().isResize());
807         resizeWidthField.setText(Integer.toString(movie.getFfmpegOption().getResizeWidth()));
808         resizeHeigitField.setText(Integer.toString(movie.getFfmpegOption().getResizeHeight()));
809         adjustRatioCheckBox.setSelected(movie.getFfmpegOption().isAdjustRatio());
810         FFmpegOptionModel.reload(movie.getOptionFile());
811
812         // 変換設定
813         final ConvertSetting conv = setting.getConvertSetting();
814         disableVhookCheckBox.setSelected(conv.isVhookDisabled());
815         viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
816         fontPathField.setText(conv.getFont().toString());
817         fontIndexField.setText(Integer.toString(conv.getFontIndex()));
818         shadowComboBox.setSelectedIndex(conv.getShadowIndex());
819         showConvVideoCheckBox.setSelected(conv.isShowConverting());
820         fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
821         opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
822         ngWordTextField.setText(conv.getNgSetting().getWord());
823         ngIdTextField.setText(conv.getNgSetting().getId());
824     }
825
826     /**
827      * [ファイル|終了] アクションが実行されました。
828      *
829      * @param actionEvent
830      *            ActionEvent
831      */
832     void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
833         try {
834             SProperties setting = getSetting();
835             SProperties.saveSetting(setting);
836         } catch (Throwable t) {
837             Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, "設定保存に失敗", t);
838         }
839         System.exit(0);
840     }
841
842     /**
843      * [ヘルプ|バージョン情報] アクションが実行されました。
844      *
845      * @param actionEvent
846      *            ActionEvent
847      */
848     void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
849         MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
850         dlg.pack();
851         dlg.setLocationRelativeTo(this);
852         dlg.setVisible(true);
853     }
854
855     /* 変換・保存する */
856     private Converter Converter = null;
857     // FFmpegの設定 ここから
858     private final JLabel extOptionLabel = new JLabel();
859     private final JTextField extOptionField = new JTextField();
860     private JLabel mainOptionLabel = new JLabel();
861     private JTextField mainOptionField = new JTextField();
862     private JLabel inputOptionLabel = new JLabel();
863     private JTextField inputOptionField = new JTextField();
864     private JLabel outputOptionLabel = new JLabel();
865     private JTextField outputOptionField = new JTextField();
866     private final JLabel avfilterOptionLabel = new JLabel();
867     private final JTextField avfilterOptionField = new JTextField();
868     private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるよう縮小(-s)");
869     private final JLabel resizeWidthLabel = new JLabel("横");
870     private final JTextField resizeWidthField = new NumberFormattedTextField();
871     private final JLabel resizeHeightLabel = new JLabel("縦");
872     private final JTextField resizeHeigitField = new NumberFormattedTextField();
873     private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持");
874     // FFmpegの設定 ここまで
875     private JLabel FontIndexLabel = new JLabel();
876     private JTextField fontIndexField = new JTextField();
877     private JPanel BasicInfoTabPanel = new JPanel();
878     private GridBagLayout gridBagLayout12 = new GridBagLayout();
879     private JPanel ConvertingSettingPanel = null;
880     private JPanel NGWordSettingPanel = null;
881     private JLabel NGWordLabel = null;
882     private JTextField ngWordTextField = null;
883     private JLabel NGIDLabel = null;
884     private JTextField ngIdTextField = null;
885     // プロキシ設定
886     private JPanel ProxyInfoPanel = null;
887     private JCheckBox useProxyCheckBox = null;
888     private JLabel proxyLabel = null;
889     private JTextField proxyTextField = null;
890     private JLabel proxyPortLabel = null;
891     private JTextField proxyPortTextField = null;
892     //
893     private JCheckBox fixFontSizeCheckBox = null;
894     private JCheckBox opaqueCommentCheckBox = null;
895     private final SavePanel savePanel = new SavePanel();
896     private final VideoSaveInfoPanel videoSaveInfoPanel;
897     private JComboBox FFmpegOptionComboBox = null;
898     private JButton FFmpegOptionReloadButton = null;
899     private JPanel FFmpegOptionComboBoxPanel = null;
900
901     public void DoButton_actionPerformed(ActionEvent e) {
902         if (Converter == null || Converter.isConverted()) {
903             try {
904                 executeConvert();
905             } catch (Exception ex) {
906                 String text = ex.getMessage();
907                 if (StringUtils.isEmpty(text)) {
908                     text = "予期しないエラーのため中断しました。";
909                 }
910                 ex.printStackTrace();
911                 statusBar.setText(text);
912             }
913         } else { /* 開始しているので、ストップする。 */
914             final ConvertStopFlag flag = Converter.getStopFlag();
915             if (!flag.needStop()) { /* まだストップしていない。 */
916                 flag.requestStop();
917             }
918         }
919     }
920
921     private void executeConvert() throws IOException {
922         String url;
923
924         // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
925         if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
926             try {
927                 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
928                 NicoDBFinder finder = NicoDBFinder.getInstance();
929                 NicoContent info = finder.findNicoContent(fileName);
930                 if (info != null) {
931                     url = info.getNicoId();
932                 } else {
933                     // TODO これはダメ…だけどそのうちこの処理自体削除になる
934                     url = "";
935                 }
936             } catch (Exception ex) {
937                 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
938                 return;
939             }
940         } else {
941             url = videoIdField.getText();
942         }
943
944         TextProgressListener sl = new TextProgressListener() {
945
946             public void setText(final String text) {
947                 SwingUtilities.invokeLater(new Runnable() {
948
949                     public void run() {
950                         statusBar.setText(text);
951                     }
952                 });
953             }
954         };
955
956         ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
957
958             public void changeState(final State s) {
959                 SwingUtilities.invokeLater(new Runnable() {
960
961                     public void run() {
962                         switch (s) {
963                             case STOPPING:
964                                 doButton.setText(DoButtonWaitString);
965                                 break;
966                             case FINISHED:
967                                 doButton.setText(DoButtonDefString);
968                         }
969                     }
970                 });
971             }
972         };
973
974         final String id = Util.getVideoId(url);
975         Converter = new Converter(id, getSetting().toProfile(), sl,
976                 new ConvertStopFlag(scl));
977         doButton.setText(DoButtonStopString);
978         FutureTask<Boolean> task = new FutureTask<Boolean>(Converter);
979         new Thread(task).start();
980
981     }
982
983     /* FFmpegへのパス */
984     public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
985         showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
986     }
987
988     public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
989         showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
990     }
991
992     public void SettingFontPathButton_actionPerformed(ActionEvent e) {
993         showSaveDialog("フォントへのパス", fontPathField, false, false);
994     }
995
996     public void this_windowClosing(WindowEvent e) {
997         this.jMenuFileExit_actionPerformed(null);
998     }
999
1000     /**
1001      * This method initializes ConvertingSettingPanel
1002      *
1003      * @return javax.swing.JPanel
1004      */
1005     private JPanel getConvertingSettingPanel() {
1006         if (ConvertingSettingPanel == null) {
1007             GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
1008             gridBagConstraints11.weighty = 1.0;
1009             gridBagConstraints11.weightx = 1.0;
1010             gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
1011             gridBagConstraints11.gridy = 1;
1012             gridBagConstraints11.gridx = 0;
1013             gridBagConstraints11.anchor = GridBagConstraints.NORTH;
1014             gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
1015             GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
1016                     2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
1017                     GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
1018             gridBagConstraints.gridx = 0;
1019             gridBagConstraints.anchor = GridBagConstraints.CENTER;
1020             gridBagConstraints.weighty = 0.0;
1021             gridBagConstraints.gridy = 0;
1022             ConvertingSettingPanel = new JPanel();
1023             ConvertingSettingPanel.setLayout(new GridBagLayout());
1024             ConvertingSettingPanel.add(getNGWordSettingPanel(),
1025                     gridBagConstraints11);
1026             ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
1027         }
1028         return ConvertingSettingPanel;
1029     }
1030
1031     /**
1032      * This method initializes NGWordSettingPanel
1033      *
1034      * @return javax.swing.JPanel
1035      */
1036     private JPanel getNGWordSettingPanel() {
1037         if (NGWordSettingPanel == null) {
1038             GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
1039             gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
1040             gridBagConstraints5.gridy = 1;
1041             gridBagConstraints5.weightx = 1.0;
1042             gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
1043             gridBagConstraints5.gridx = 1;
1044             GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
1045             gridBagConstraints4.gridx = 0;
1046             gridBagConstraints4.anchor = GridBagConstraints.WEST;
1047             gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
1048             gridBagConstraints4.gridy = 1;
1049             NGIDLabel = new JLabel();
1050             NGIDLabel.setText("NG ID");
1051             GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
1052             gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
1053             gridBagConstraints3.gridy = 0;
1054             gridBagConstraints3.weightx = 1.0;
1055             gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
1056             gridBagConstraints3.gridx = 1;
1057             GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
1058             gridBagConstraints2.gridx = 0;
1059             gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
1060             gridBagConstraints2.gridy = 0;
1061             NGWordLabel = new JLabel();
1062             NGWordLabel.setText("NGワード");
1063             NGWordSettingPanel = new JPanel();
1064             NGWordSettingPanel.setLayout(new GridBagLayout());
1065             NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
1066                     "NGワード・ID設定(半角スペース区切りで複数入力)"));
1067             NGWordSettingPanel.add(NGWordLabel, gridBagConstraints2);
1068             NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
1069             NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
1070             NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
1071         }
1072         return NGWordSettingPanel;
1073     }
1074
1075     /**
1076      * This method initializes NGWordTextField
1077      *
1078      * @return javax.swing.JTextField
1079      */
1080     private JTextField getNGWordTextField() {
1081         if (ngWordTextField == null) {
1082             ngWordTextField = new JTextField();
1083             ngWordTextField.setName("ngWordTextField");
1084         }
1085         return ngWordTextField;
1086     }
1087
1088     /**
1089      * This method initializes NGIDTextField
1090      *
1091      * @return javax.swing.JTextField
1092      */
1093     private JTextField getNGIDTextField() {
1094         if (ngIdTextField == null) {
1095             ngIdTextField = new JTextField();
1096             ngIdTextField.setName("ngIdTextField");
1097         }
1098         return ngIdTextField;
1099     }
1100
1101     /**
1102      * This method initializes ProxyInfoPanel
1103      *
1104      * @return javax.swing.JPanel
1105      */
1106     private JPanel getProxyInfoPanel() {
1107         if (ProxyInfoPanel == null) {
1108             GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1109             gridBagConstraints13.gridx = 0;
1110             gridBagConstraints13.gridwidth = 2;
1111             gridBagConstraints13.weightx = 1.0;
1112             gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1113             gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1114             gridBagConstraints13.gridy = 0;
1115             GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1116             gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1117             gridBagConstraints12.gridy = 2;
1118             gridBagConstraints12.weightx = 1.0;
1119             gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1120             gridBagConstraints12.gridx = 1;
1121             GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1122             gridBagConstraints10.gridx = 0;
1123             gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1124             gridBagConstraints10.gridy = 2;
1125             proxyPortLabel = new JLabel();
1126             proxyPortLabel.setText("ポート番号");
1127             GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1128             gridBagConstraints9.fill = GridBagConstraints.BOTH;
1129             gridBagConstraints9.gridy = 1;
1130             gridBagConstraints9.weightx = 1.0;
1131             gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1132             gridBagConstraints9.gridx = 1;
1133             GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1134             gridBagConstraints8.gridx = 0;
1135             gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1136             gridBagConstraints8.fill = GridBagConstraints.NONE;
1137             gridBagConstraints8.anchor = GridBagConstraints.EAST;
1138             gridBagConstraints8.gridy = 1;
1139             proxyLabel = new JLabel();
1140             proxyLabel.setText("プロキシ");
1141             ProxyInfoPanel = new JPanel();
1142             ProxyInfoPanel.setLayout(new GridBagLayout());
1143             ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1144                     "プロキシ設定"));
1145             ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1146             ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1147             ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1148             ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1149             ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1150         }
1151         return ProxyInfoPanel;
1152     }
1153
1154     /**
1155      * This method initializes ProxyTextField
1156      *
1157      * @return javax.swing.JTextField
1158      */
1159     private JTextField getProxyTextField() {
1160         if (proxyTextField == null) {
1161             proxyTextField = new JTextField();
1162             proxyTextField.setName("proxyTextField");
1163         }
1164         return proxyTextField;
1165     }
1166
1167     /**
1168      * This method initializes ProxyPortTextField
1169      *
1170      * @return javax.swing.JTextField
1171      */
1172     private JTextField getProxyPortTextField() {
1173         if (proxyPortTextField == null) {
1174             proxyPortTextField = new JTextField();
1175             proxyPortTextField.setName("proxyPortTextField");
1176         }
1177         return proxyPortTextField;
1178     }
1179
1180     /**
1181      * This method initializes UseProxyCheckBox
1182      *
1183      * @return javax.swing.JCheckBox
1184      */
1185     private JCheckBox getUseProxyCheckBox() {
1186         if (useProxyCheckBox == null) {
1187             useProxyCheckBox = new JCheckBox();
1188             useProxyCheckBox.setText("プロキシを使う");
1189             useProxyCheckBox.setName("useProxyCheckBox");
1190         }
1191         return useProxyCheckBox;
1192     }
1193
1194     /**
1195      * This method initializes FixFontSizeCheckBox
1196      *
1197      * @return javax.swing.JCheckBox
1198      */
1199     private JCheckBox getFixFontSizeCheckBox() {
1200         if (fixFontSizeCheckBox == null) {
1201             fixFontSizeCheckBox = new JCheckBox();
1202             fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1203             fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1204         }
1205         return fixFontSizeCheckBox;
1206     }
1207
1208     /**
1209      * This method initializes OpaqueCommentCheckBox
1210      *
1211      * @return javax.swing.JCheckBox
1212      */
1213     private JCheckBox getOpaqueCommentCheckBox() {
1214         if (opaqueCommentCheckBox == null) {
1215             opaqueCommentCheckBox = new JCheckBox();
1216             opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1217             opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1218         }
1219         return opaqueCommentCheckBox;
1220     }
1221     /**
1222      * This method initializes FFmpegOptionComboBox
1223      *
1224      * @return javax.swing.JComboBox
1225      */
1226     private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1227     private JCheckBox disableVhookCheckBox = null;
1228     private JTextField viewCommentField = null;
1229     private JLabel ViewCommentLabel = null;
1230     private JLabel ShadowKindLabel = null;
1231     private JComboBox shadowComboBox = null;
1232
1233     private JComboBox getFFmpegOptionComboBox() {
1234         if (FFmpegOptionComboBox == null) {
1235             FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1236             FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1237
1238                 public void actionPerformed(java.awt.event.ActionEvent e) {
1239                     if (FFmpegOptionModel.isFile()) {// ファイル
1240                         setFFMpegOptionEnabled(false);
1241                     } else {// ファイルでない
1242                         setFFMpegOptionEnabled(true);
1243                         setFFMpegOptionCheckbox();
1244                     }
1245                 }
1246
1247                 private void setFFMpegOptionEnabled(boolean enable) {
1248                     extOptionField.setEnabled(enable);
1249                     mainOptionField.setEnabled(enable);
1250                     inputOptionField.setEnabled(enable);
1251                     outputOptionField.setEnabled(enable);
1252                     avfilterOptionField.setEnabled(enable);
1253                     resizeCheckBox.setEnabled(enable);
1254                     resizeWidthField.setEnabled(enable);
1255                     resizeHeigitField.setEditable(enable);
1256                     adjustRatioCheckBox.setEnabled(enable);
1257                 }
1258             });
1259         }
1260         return FFmpegOptionComboBox;
1261     }
1262
1263     /**
1264      * This method initializes FFmpegOptionReloadButton
1265      *
1266      * @return javax.swing.JButton
1267      */
1268     private JButton getFFmpegOptionReloadButton() {
1269         if (FFmpegOptionReloadButton == null) {
1270             FFmpegOptionReloadButton = new JButton();
1271             FFmpegOptionReloadButton.setText("更新");
1272             FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1273
1274                 public void actionPerformed(java.awt.event.ActionEvent e) {
1275                     FFmpegOptionModel.reload();
1276                 }
1277             });
1278         }
1279         return FFmpegOptionReloadButton;
1280     }
1281
1282     /**
1283      * This method initializes FFmpegOptionComboBoxPanel
1284      *
1285      * @return javax.swing.JPanel
1286      */
1287     private JPanel getFFmpegOptionComboBoxPanel() {
1288         if (FFmpegOptionComboBoxPanel == null) {
1289             GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1290             gridBagConstraints47.fill = GridBagConstraints.BOTH;
1291             gridBagConstraints47.gridx = -1;
1292             gridBagConstraints47.gridy = -1;
1293             gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1294             GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1295             gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1296             gridBagConstraints46.gridwidth = 3;
1297             gridBagConstraints46.gridx = -1;
1298             gridBagConstraints46.gridy = -1;
1299             gridBagConstraints46.weightx = 1.0;
1300             gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1301             FFmpegOptionComboBoxPanel = new JPanel();
1302             FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1303             FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1304                     gridBagConstraints46);
1305             FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1306                     gridBagConstraints47);
1307         }
1308         return FFmpegOptionComboBoxPanel;
1309     }
1310
1311     /**
1312      * This method initializes NotUseVhookCheckBox
1313      *
1314      * @return javax.swing.JCheckBox
1315      */
1316     private JCheckBox getNotUseVhookCheckBox() {
1317         if (disableVhookCheckBox == null) {
1318             disableVhookCheckBox = new JCheckBox();
1319             disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1320             disableVhookCheckBox.setName("disableVhookCheckBox");
1321         }
1322         return disableVhookCheckBox;
1323     }
1324
1325     /**
1326      * This method initializes ViewCommentField
1327      *
1328      * @return javax.swing.JTextField
1329      */
1330     private JTextField getViewCommentField() {
1331         if (viewCommentField == null) {
1332             viewCommentField = new JTextField();
1333             viewCommentField.setName("viewCommentField");
1334         }
1335         return viewCommentField;
1336     }
1337
1338     /**
1339      * This method initializes ShadowComboBox
1340      *
1341      * @return javax.swing.JComboBox
1342      */
1343     private JComboBox getShadowComboBox() {
1344         if (shadowComboBox == null) {
1345             shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1346             shadowComboBox.setName("shadowComboBox");
1347         }
1348         return shadowComboBox;
1349     }
1350
1351     private BasicSetting getBasicSetting() {
1352         String mail = mailAddressField.getText();
1353         String pass = String.valueOf(passwordField.getPassword());
1354         boolean proxyUse = useProxyCheckBox.isSelected();
1355         String proxyHost = proxyTextField.getText();
1356         int proxyPort;
1357         try {
1358             proxyPort = Integer.parseInt(proxyPortTextField.getText());
1359         } catch (NumberFormatException e) {
1360             proxyPort = -1;
1361         }
1362         // TODO 作業用ディレクトリの設定GUI無し
1363         return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1364     }
1365
1366     private InputVideoSetting getInputVideoSetting() {
1367         VideoSaveKind kind;
1368         if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1369             kind = VideoSaveKind.NO_SAVE;
1370         } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1371             kind = VideoSaveKind.NICOBROWSER;
1372         } else {
1373             kind = VideoSaveKind.SAVE;
1374         }
1375         boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1376         String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1377         String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1378         boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1379         String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1380
1381         return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1382     }
1383
1384     private InputCommentSetting getInputCommentSetting() {
1385         boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1386         String file = savePanel.getCommentSavedFileField().getText();
1387         int back_comment;
1388         try {
1389             back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1390         } catch (NumberFormatException ex) {
1391             back_comment = 500;
1392         }
1393         boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1394         boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1395         String folder = savePanel.getCommentSavedFolderField().getText();
1396         boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1397
1398         final String txt = wayBackField.getText();
1399         long backLogPoint;
1400         try {
1401             backLogPoint = (StringUtils.isNotBlank(txt)) ? WayBackTimeParser.parse(txt) : -1;
1402         } catch (IOException ex) {
1403             backLogPoint = -1;
1404         }
1405         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1406                 back_comment, reduceCommentCheckBox.isSelected(), backLogPoint);
1407     }
1408
1409     /**
1410      * 画面入力値から投稿者コメント設定を作成する.
1411      * @return 作成した投稿者コメント設定.
1412      */
1413     private InputTcommentSetting getTcommentSetting() {
1414         boolean down = savePanel.isTcommentDownload();
1415         boolean del = savePanel.isTcommentDelete();
1416         boolean naming = savePanel.isTcommentAutoFileName();
1417         String dir = savePanel.getTcommentDirectoryName();
1418         String f = savePanel.getTcommentFileName();
1419         return new InputTcommentSetting(down, naming, dir, f, del);
1420     }
1421
1422     private OutputVideoSetting getOutputVideoSetting() {
1423         boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1424         boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1425         boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1426         String file = savePanel.getConvertedVideoSavedFileField().getText();
1427         boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1428         boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1429         String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1430
1431         return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1432                 addTcomment);
1433     }
1434
1435     private MovieSetting getMovieSetting() {
1436         String ffmpeg = ffmpegPathField.getText();
1437         String vhook = vhookPathField.getText();
1438         String ext = extOptionField.getText();
1439         String main = mainOptionField.getText();
1440         String in = inputOptionField.getText();
1441         String out = outputOptionField.getText();
1442         String avfilter = avfilterOptionField.getText();
1443         boolean resize = resizeCheckBox.isSelected();
1444         String width = resizeWidthField.getText();
1445         String height = resizeHeigitField.getText();
1446         boolean adjust = adjustRatioCheckBox.isSelected();
1447         File optionFile = FFmpegOptionModel.getSelectedFile();
1448
1449         FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust);
1450         return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1451     }
1452
1453     private ConvertSetting getConvertSetting() {
1454         boolean vhookDisabled = disableVhookCheckBox.isSelected();
1455         int maxComment = 30;
1456         try {
1457             maxComment = Integer.parseInt(viewCommentField.getText());
1458         } catch (NumberFormatException ex) {
1459         }
1460         File font = new File(fontPathField.getText());
1461         int fontIndex = Integer.parseInt(fontIndexField.getText());
1462         int shadowIndex = shadowComboBox.getSelectedIndex();
1463         boolean showConv = showConvVideoCheckBox.isSelected();
1464         boolean adjustFont = fixFontSizeCheckBox.isSelected();
1465         boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1466         NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1467
1468         return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1469                 commentOpaque, ngSetting);
1470     }
1471
1472     private class InputVideoPanelButtonListener implements ActionListener {
1473
1474         public void actionPerformed(ActionEvent e) {
1475             final Object source = e.getSource();
1476             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1477             String title;
1478             JTextField field;
1479             boolean isSave;
1480             boolean isDir;
1481
1482             if (source == panel.getShowSavingVideoFolderDialogButton()) {
1483                 title = "動画の保存先(フォルダ)";
1484                 field = panel.getVideoSavedFolderField();
1485                 isSave = true;
1486                 isDir = true;
1487             } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1488                 title = "動画の保存先(ファイル)";
1489                 field = panel.getVideoSavedFileField();
1490                 isSave = true;
1491                 isDir = false;
1492             } else if (source == panel.getNibrFileChooserButton()) {
1493                 title = "NicoBrowserファイル選択";
1494                 field = panel.getNibrFileField();
1495                 isSave = false;
1496                 isDir = false;
1497             } else {
1498                 return;
1499             }
1500             showSaveDialog(title, field, isSave, isDir);
1501         }
1502     }
1503
1504     private class InputCommentPanelButtonListener implements ActionListener {
1505
1506         public void actionPerformed(ActionEvent e) {
1507             final Object source = e.getSource();
1508             String title;
1509             JTextField field;
1510             boolean isSave;
1511             boolean isDir;
1512             if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1513                 title = "コメントの保存先(フォルダ)";
1514                 field = savePanel.getCommentSavedFolderField();
1515                 isSave = true;
1516                 isDir = true;
1517             } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1518                 title = "コメントの保存先(ファイル)";
1519                 field = savePanel.getCommentSavedFileField();
1520                 isSave = true;
1521                 isDir = false;
1522             } else {
1523                 return;
1524             }
1525             showSaveDialog(title, field, isSave, isDir);
1526         }
1527     }
1528
1529     private class OutputVideoPanelButtonListener implements ActionListener {
1530
1531         public void actionPerformed(ActionEvent e) {
1532             final Object source = e.getSource();
1533             String title;
1534             JTextField field;
1535             boolean isSave;
1536             boolean isDir;
1537             if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1538                 title = "コメント付き動画の保存先(フォルダ)";
1539                 field = savePanel.getConvertedVideoSavedFolderField();
1540                 isSave = true;
1541                 isDir = true;
1542             } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1543                 title = "コメント付き動画の保存先(ファイル)";
1544                 field = savePanel.getConvertedVideoSavedFileField();
1545                 isSave = true;
1546                 isDir = false;
1547             } else {
1548                 return;
1549             }
1550             showSaveDialog(title, field, isSave, isDir);
1551         }
1552     }
1553
1554     private class VideoUseRadioButtonListener implements ActionListener {
1555
1556         public void actionPerformed(ActionEvent e) {
1557             Object source = e.getSource();
1558             if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1559                 maskExt();
1560             } else {
1561                 maskBase();
1562             }
1563         }
1564
1565         private void maskBase() {
1566             mask(true);
1567         }
1568
1569         private void maskExt() {
1570             mask(false);
1571         }
1572
1573         private void mask(boolean b) {
1574             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1575             videoIdField.setEditable(b);
1576             panel.getDelVideoCheckBox().setEnabled(b);
1577
1578             panel.getSaveFolderRadioButton().setEnabled(b);
1579             panel.getVideoSavedFolderField().setEnabled(b);
1580             panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1581
1582             panel.getSaveFileRadioButton().setEnabled(b);
1583             panel.getVideoSavedFileField().setEnabled(b);
1584             panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1585
1586             panel.getNibrFileField().setEnabled(!b);
1587             panel.getNibrFileChooserButton().setEnabled(!b);
1588         }
1589     }
1590 }
1591
1592 class MainFrame_this_windowAdapter extends WindowAdapter {
1593
1594     private MainFrame adaptee;
1595
1596     MainFrame_this_windowAdapter(MainFrame adaptee) {
1597         this.adaptee = adaptee;
1598     }
1599
1600     @Override
1601     public void windowClosing(WindowEvent e) {
1602         adaptee.this_windowClosing(e);
1603     }
1604 }
1605
1606 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1607
1608     private MainFrame adaptee;
1609
1610     MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1611         this.adaptee = adaptee;
1612     }
1613
1614     public void actionPerformed(ActionEvent e) {
1615         adaptee.SettingFontPathButton_actionPerformed(e);
1616     }
1617 }
1618
1619 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1620
1621     private MainFrame adaptee;
1622
1623     MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1624         this.adaptee = adaptee;
1625     }
1626
1627     public void actionPerformed(ActionEvent e) {
1628         adaptee.SettingVhookPathButton_actionPerformed(e);
1629     }
1630 }
1631
1632 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1633
1634     private MainFrame adaptee;
1635
1636     MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1637         this.adaptee = adaptee;
1638     }
1639
1640     public void actionPerformed(ActionEvent e) {
1641         adaptee.SettingFFmpegPathButton_actionPerformed(e);
1642     }
1643 }
1644
1645 class MainFrame_DoButton_actionAdapter implements ActionListener {
1646
1647     private MainFrame adaptee;
1648
1649     MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1650         this.adaptee = adaptee;
1651     }
1652
1653     public void actionPerformed(ActionEvent e) {
1654         adaptee.DoButton_actionPerformed(e);
1655     }
1656 }
1657
1658 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1659
1660     MainFrame adaptee;
1661
1662     MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1663         this.adaptee = adaptee;
1664     }
1665
1666     public void actionPerformed(ActionEvent actionEvent) {
1667         adaptee.jMenuFileExit_actionPerformed(actionEvent);
1668     }
1669 }
1670
1671 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1672
1673     MainFrame adaptee;
1674
1675     MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1676         this.adaptee = adaptee;
1677     }
1678
1679     public void actionPerformed(ActionEvent actionEvent) {
1680         adaptee.jMenuHelpAbout_actionPerformed(actionEvent);
1681     }
1682 }