OSDN Git Service

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