OSDN Git Service

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