OSDN Git Service

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