OSDN Git Service

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