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;
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;
63 * 説明: ニコニコ動画の動画をコメントつきで保存
67 * 著作権: Copyright (c) 2007 PSI
77 public class MainFrame extends JFrame {
79 private static final long serialVersionUID = 2564486741331062989L;
80 public static final String PRODUCT_NAME = "いんきゅばす";
81 public static final String VERSION = "1.4.4";
82 public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource(
84 // TODO GUIが無いためフィールドに保持.
87 BorderLayout borderLayout1 = new BorderLayout();
88 JMenuBar jMenuBar1 = new JMenuBar();
89 JMenu jMenuFile = new JMenu();
90 JMenuItem jMenuFileExit = new JMenuItem();
91 JMenu jMenuHelp = new JMenu();
92 JMenuItem jMenuHelpAbout = new JMenuItem();
93 JLabel statusBar = new JLabel();
94 JTabbedPane mainTabbedPane = new JTabbedPane();
95 JPanel SavingInfoTabPanel = new JPanel();
96 JPanel FFMpegTabPanel = new JPanel();
97 JPanel VideoInfoPanel = new JPanel();
98 JTextField VideoID_TextField = new JTextField();
99 JButton DoButton = new JButton();
100 public static final String DoButtonDefString = "変換";
101 public static final String DoButtonStopString = "停止";
102 public static final String DoButtonWaitString = "待機";
103 JPanel UserInfoPanel = new JPanel();
104 GridBagLayout gridBagLayout3 = new GridBagLayout();
106 JLabel mailAddressLabel = new JLabel();
107 JTextField mailAddressField = new JTextField();
108 JLabel passwordLabel = new JLabel();
109 JPasswordField passwordField = new JPasswordField();
110 GridBagLayout gridBagLayout4 = new GridBagLayout();
111 GridBagLayout gridBagLayout6 = new GridBagLayout();
112 ButtonGroup CommentSaveButtonGroup = new ButtonGroup();
113 ButtonGroup ConvSaveButtonGroup = new ButtonGroup();
115 private void setNames() {
116 mainTabbedPane.setName("mainTabbedPane");
118 mailAddressField.setName("mailAddressField");
119 passwordField.setName("passwordField");
121 ffmpegPathField.setName("ffmpegPathField");
122 vhookPathField.setName("vhookPathField");
124 mainOptionField.setName("mainOptionField");
125 inputOptionField.setName("inputOptionField");
126 outputOptionField.setName("outputOptionField");
128 fontPathField.setName("fontPathField");
129 fontIndexField.setName("fontIndexField");
130 showConvVideoCheckBox.setName("showConvVideoCheckBox");
136 videoSaveInfoPanel = savePanel.getVideoSaveInfoPanel();
139 setDefaultCloseOperation(EXIT_ON_CLOSE);
143 SProperties setting = SProperties.loadSetting(null,
145 this.setSetting(setting);
146 } catch (Exception exception) {
147 exception.printStackTrace();
154 * @throws java.lang.Exception
156 private void jbInit() throws Exception {
157 GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
158 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
159 gridBagConstraints74.gridwidth = 2;
160 GridBagConstraints gridBagConstraints73 = new GridBagConstraints();
161 gridBagConstraints73.fill = GridBagConstraints.HORIZONTAL;
162 gridBagConstraints73.gridy = 6;
163 gridBagConstraints73.weightx = 1.0;
164 gridBagConstraints73.gridwidth = 4;
165 gridBagConstraints73.insets = new Insets(0, 0, 0, 5);
166 gridBagConstraints73.gridx = 1;
167 GridBagConstraints gridBagConstraints72 = new GridBagConstraints();
168 gridBagConstraints72.gridx = 0;
169 gridBagConstraints72.anchor = GridBagConstraints.WEST;
170 gridBagConstraints72.insets = new Insets(0, 5, 0, 5);
171 gridBagConstraints72.fill = GridBagConstraints.NONE;
172 gridBagConstraints72.gridwidth = 1;
173 gridBagConstraints72.gridy = 6;
174 ShadowKindLabel = new JLabel();
175 ShadowKindLabel.setText("影の種類");
176 ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
177 GridBagConstraints gridBagConstraints71 = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
178 GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 6);
179 gridBagConstraints71.fill = GridBagConstraints.BOTH;
180 gridBagConstraints71.ipady = 0;
181 GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
182 gridBagConstraints70.fill = GridBagConstraints.HORIZONTAL;
183 gridBagConstraints70.gridy = 1;
184 gridBagConstraints70.ipadx = 0;
185 gridBagConstraints70.ipady = 0;
186 gridBagConstraints70.weightx = 1.0;
187 gridBagConstraints70.insets = new Insets(0, 0, 0, 0);
188 gridBagConstraints70.gridx = 1;
189 GridBagConstraints gridBagConstraints69 = new GridBagConstraints();
190 gridBagConstraints69.gridx = 0;
191 gridBagConstraints69.ipadx = 0;
192 gridBagConstraints69.ipady = 0;
193 gridBagConstraints69.insets = new Insets(0, 5, 0, 5);
194 gridBagConstraints69.anchor = GridBagConstraints.WEST;
195 gridBagConstraints69.gridy = 1;
196 GridBagConstraints gridBagConstraints68 = new GridBagConstraints();
197 gridBagConstraints68.fill = GridBagConstraints.BOTH;
198 gridBagConstraints68.gridy = 0;
199 gridBagConstraints68.ipady = 0;
200 gridBagConstraints68.weightx = 1.0;
201 gridBagConstraints68.insets = new Insets(0, 0, 0, 0);
202 gridBagConstraints68.gridx = 1;
203 GridBagConstraints gridBagConstraints67 = new GridBagConstraints();
204 gridBagConstraints67.gridx = 0;
205 gridBagConstraints67.ipadx = 0;
206 gridBagConstraints67.ipady = 0;
207 gridBagConstraints67.insets = new Insets(0, 5, 0, 5);
208 gridBagConstraints67.anchor = GridBagConstraints.WEST;
209 gridBagConstraints67.gridy = 0;
210 GridBagConstraints gridBagConstraints66 = new GridBagConstraints();
211 gridBagConstraints66.gridx = 0;
212 gridBagConstraints66.insets = new Insets(0, 5, 5, 5);
213 gridBagConstraints66.anchor = GridBagConstraints.WEST;
214 gridBagConstraints66.gridwidth = 2;
215 gridBagConstraints66.gridy = 1;
216 ViewCommentLabel = new JLabel();
217 ViewCommentLabel.setText("表示コメント数");
218 GridBagConstraints gridBagConstraints65 = new GridBagConstraints();
219 gridBagConstraints65.fill = GridBagConstraints.HORIZONTAL;
220 gridBagConstraints65.gridy = 1;
221 gridBagConstraints65.weightx = 1.0;
222 gridBagConstraints65.gridwidth = 6;
223 gridBagConstraints65.insets = new Insets(0, 5, 5, 5);
224 gridBagConstraints65.gridx = 3;
225 GridBagConstraints gridBagConstraints64 = new GridBagConstraints(1, 1,
226 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
227 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
228 gridBagConstraints64.gridy = 3;
229 gridBagConstraints64.fill = GridBagConstraints.HORIZONTAL;
230 gridBagConstraints64.gridx = 4;
231 GridBagConstraints gridBagConstraints63 = new GridBagConstraints(0, 4,
232 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
233 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
234 gridBagConstraints63.gridy = 7;
235 gridBagConstraints63.gridx = 0;
236 gridBagConstraints63.gridwidth = 5;
237 GridBagConstraints gridBagConstraints62 = new GridBagConstraints(0, 3,
238 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
239 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
240 gridBagConstraints62.gridy = 5;
241 gridBagConstraints62.gridx = 1;
242 gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL;
243 gridBagConstraints62.insets = new Insets(0, 0, 5, 5);
244 gridBagConstraints62.gridwidth = 4;
245 GridBagConstraints gridBagConstraints61 = new GridBagConstraints(0, 2,
246 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
247 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
248 gridBagConstraints61.gridy = 5;
249 gridBagConstraints61.gridx = 0;
250 gridBagConstraints61.fill = GridBagConstraints.VERTICAL;
251 gridBagConstraints61.anchor = GridBagConstraints.WEST;
252 gridBagConstraints61.gridwidth = 1;
253 GridBagConstraints gridBagConstraints60 = new GridBagConstraints(0, 1,
254 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
255 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0);
256 gridBagConstraints60.gridy = 3;
257 gridBagConstraints60.gridx = 1;
258 gridBagConstraints60.fill = GridBagConstraints.HORIZONTAL;
259 gridBagConstraints60.insets = new Insets(0, 0, 0, 5);
260 gridBagConstraints60.gridwidth = 3;
261 GridBagConstraints gridBagConstraints59 = new GridBagConstraints(0, 0,
262 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
263 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);
264 gridBagConstraints59.gridy = 3;
265 gridBagConstraints59.insets = new Insets(5, 5, 5, 5);
266 gridBagConstraints59.gridx = 0;
267 gridBagConstraints59.fill = GridBagConstraints.NONE;
268 gridBagConstraints59.anchor = GridBagConstraints.WEST;
269 gridBagConstraints59.weightx = 0.0;
270 gridBagConstraints59.gridwidth = 1;
271 GridBagConstraints gridBagConstraints58 = new GridBagConstraints();
272 gridBagConstraints58.gridx = 0;
273 gridBagConstraints58.anchor = GridBagConstraints.WEST;
274 gridBagConstraints58.insets = new Insets(0, 5, 5, 5);
275 gridBagConstraints58.gridwidth = 5;
276 gridBagConstraints58.weightx = 1.0;
277 gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL;
278 gridBagConstraints58.gridy = 0;
281 final GridBagConstraints gbcFFmpegOptionComboBoxPanel = new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0,
282 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
284 final Insets ffmpegOptionInsets = new Insets(0, 0, 5, 5);
286 final GridBagConstraints gbcExtOptionLabel = new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
287 GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
289 final GridBagConstraints gbcExtOptionField = new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
290 GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
292 final GridBagConstraints gbcMainOptionLabel = new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
293 GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
295 final GridBagConstraints gbcMainOptionField = new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0,
296 GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
298 final GridBagConstraints gbcInputOptionLabel = new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
299 GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
301 final GridBagConstraints gbcInputOptionField = new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0,
302 GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
304 final GridBagConstraints gbcOutputOptionLabel = new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
305 GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
307 final GridBagConstraints gbcOutputOptionField = new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0,
308 GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
310 final GridBagConstraints gbcAvfilterOptionLabel = new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0,
311 GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
313 final GridBagConstraints gbcAvfilterOptionField = new GridBagConstraints(1, 6, 1, 1, 1.0, 0.0,
314 GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
317 GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
318 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
319 gridBagConstraints54.gridwidth = 3;
321 GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
322 gridBagConstraints33.gridx = 0;
323 gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
324 gridBagConstraints33.weightx = 1.0;
325 gridBagConstraints33.insets = new Insets(0, 5, 5, 5);
326 gridBagConstraints33.gridwidth = 5;
327 gridBagConstraints33.gridy = 9;
329 GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
330 gridBagConstraints14.gridx = 0;
331 gridBagConstraints14.anchor = GridBagConstraints.WEST;
332 gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
333 gridBagConstraints14.weightx = 1.0;
334 gridBagConstraints14.gridwidth = 5;
335 gridBagConstraints14.insets = new Insets(0, 5, 0, 5);
336 gridBagConstraints14.gridy = 8;
337 GridBagConstraints gridBagConstraints7 = new GridBagConstraints(0, 0,
338 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
339 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
340 gridBagConstraints7.weighty = 0.0;
341 GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
342 gridBagConstraints6.gridx = 0;
343 gridBagConstraints6.weighty = 1.0;
344 gridBagConstraints6.weightx = 1.0;
345 gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
346 gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
347 gridBagConstraints6.anchor = GridBagConstraints.NORTH;
348 gridBagConstraints6.gridy = 1;
349 GridBagConstraints gridBagConstraints1 = new GridBagConstraints(0, 1,
350 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
351 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
352 gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
353 gridBagConstraints1.anchor = GridBagConstraints.NORTH;
354 gridBagConstraints1.weighty = 1.0;
356 this.setIconImage(WinIcon);
357 contentPane = (JPanel) this.getContentPane();
358 contentPane.setLayout(borderLayout1);
359 setSize(new Dimension(400, 450));
360 setTitle(PRODUCT_NAME + " " + VERSION);
361 this.addWindowListener(new MainFrame_this_windowAdapter(this));
362 statusBar.setText(" ");
363 jMenuFile.setText("ファイル");
364 jMenuFileExit.setText("終了");
365 jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter(
367 jMenuHelp.setText("ヘルプ");
368 jMenuHelpAbout.setText("バージョン情報");
369 jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
371 VideoInfoPanel.setLayout(gridBagLayout1);
372 VideoID_TextField.setText("http://www.nicovideo.jp/watch/");
373 DoButton.setText(DoButtonDefString);
374 DoButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
375 SavingInfoTabPanel.setLayout(new GridLayout());
376 UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定"));
377 UserInfoPanel.setLayout(gridBagLayout3);
378 mailAddressLabel.setText("メールアドレス");
379 passwordLabel.setText("パスワード");
381 setListenerToSavePanelButton();
383 FFMpegTabPanel.setLayout(gridBagLayout6);
384 PathSettingPanel.setBorder(BorderFactory.createTitledBorder(
385 BorderFactory.createEtchedBorder(), "プログラムの位置の設定"));
386 PathSettingPanel.setLayout(gridBagLayout7);
387 FFmpegPathLabel.setText("FFmpeg");
388 SettingFFmpegPathButton.setText("参照");
389 SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter(
391 VhookPathLabel.setText("拡張vhookライブラリ");
392 SettingVhookPathButton.setText("参照");
393 SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter(
395 VhookSettingPanel.setLayout(gridBagLayout8);
396 VhookSettingPanel.setBorder(BorderFactory.createTitledBorder(
397 BorderFactory.createEtchedBorder(), "拡張vhookライブラリの設定"));
398 FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder(
399 BorderFactory.createEtchedBorder(), "FFmpegの設定"));
400 FFmpegSettingPanel.setLayout(gblFFmpegSettingPanel);
401 FontPathLabel.setText("フォントパス");
402 SettingFontPathButton.setText("参照");
403 SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter(
405 showConvVideoCheckBox.setText("変換中の画像を表示する");
407 extOptionLabel.setText("出力動画の拡張子");
408 inputOptionLabel.setText("入力オプション");
409 outputOptionLabel.setText("出力オプション");
410 mainOptionLabel.setText("メインオプション");
411 avfilterOptionLabel.setText("avfilterオプション");
413 FontIndexLabel.setText("フォント番号");
414 VideoID_Label.setText("URL/ID");
415 WayBackLabel.setText("過去ログ");
416 OpPanel.setLayout(new GridBagLayout());
418 BasicInfoTabPanel.setLayout(gridBagLayout12);
419 jMenuBar1.add(jMenuFile);
420 jMenuFile.add(jMenuFileExit);
421 jMenuBar1.add(jMenuHelp);
422 jMenuHelp.add(jMenuHelpAbout);
423 setJMenuBar(jMenuBar1);
425 contentPane.add(statusBar, BorderLayout.SOUTH);
426 contentPane.add(mainTabbedPane, java.awt.BorderLayout.CENTER);
427 contentPane.add(VideoInfoPanel, java.awt.BorderLayout.NORTH);
428 UserInfoPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1,
429 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
430 new Insets(0, 5, 5, 5), 0, 0));
431 UserInfoPanel.add(mailAddressField, new GridBagConstraints(1, 0, 1, 1,
432 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
433 new Insets(0, 5, 5, 5), 0, 0));
434 UserInfoPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1,
435 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
436 new Insets(0, 5, 5, 0), 0, 0));
437 UserInfoPanel.add(mailAddressLabel, new GridBagConstraints(0, 0, 1, 1,
438 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
439 new Insets(0, 5, 5, 0), 0, 0));
440 PathSettingPanel.add(ffmpegPathField, new GridBagConstraints(0, 1, 1,
441 1, 1.0, 0.0, GridBagConstraints.CENTER,
442 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
443 PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74);
444 PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2,
445 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
446 new Insets(0, 5, 5, 5), 0, 0));
447 PathSettingPanel.add(vhookPathField, new GridBagConstraints(0, 3, 1, 1,
448 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
449 new Insets(0, 5, 5, 5), 0, 0));
450 PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1,
451 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
452 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
453 PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
455 FFmpegSettingPanel.add(getFFmpegOptionComboBoxPanel(), gbcFFmpegOptionComboBoxPanel);
456 FFmpegSettingPanel.add(extOptionLabel, gbcExtOptionLabel);
457 FFmpegSettingPanel.add(extOptionField, gbcExtOptionField);
458 FFmpegSettingPanel.add(mainOptionField, gbcMainOptionField);
459 FFmpegSettingPanel.add(mainOptionLabel, gbcMainOptionLabel);
460 FFmpegSettingPanel.add(inputOptionField, gbcInputOptionField);
461 FFmpegSettingPanel.add(inputOptionLabel, gbcInputOptionLabel);
462 FFmpegSettingPanel.add(outputOptionField, gbcOutputOptionField);
463 FFmpegSettingPanel.add(outputOptionLabel, gbcOutputOptionLabel);
464 FFmpegSettingPanel.add(avfilterOptionLabel, gbcAvfilterOptionLabel);
465 FFmpegSettingPanel.add(avfilterOptionField, gbcAvfilterOptionField);
467 VideoInfoPanel.add(DoButton, gridBagConstraints71);
468 VideoInfoPanel.add(OpPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
469 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
470 new Insets(0, 0, 0, 0), 0, 0));
471 OpPanel.add(VideoID_Label, gridBagConstraints67);
472 OpPanel.add(VideoID_TextField, gridBagConstraints68);
473 OpPanel.add(WayBackLabel, gridBagConstraints69);
474 OpPanel.add(WayBackField, gridBagConstraints70);
476 mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
477 mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
478 mainTabbedPane.add(FFMpegTabPanel, "動画設定");
479 mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null);
480 SavingInfoTabPanel.add(savePanel);
481 BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
482 BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
483 VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
484 VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63);
485 VhookSettingPanel.add(fontPathField, gridBagConstraints60);
486 VhookSettingPanel.add(fontIndexField, gridBagConstraints62);
487 VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
488 VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
489 VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
490 VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
491 VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
492 VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
493 VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
494 VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
495 VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
497 FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
498 1.0, 0.0, GridBagConstraints.NORTHEAST,
499 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
500 FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
504 * 保存設定パネル内のボタンにアクションリスナを割り当てる.
506 private void setListenerToSavePanelButton() {
508 al = new InputVideoPanelButtonListener();
509 videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
510 videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
511 videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
513 al = new VideoUseRadioButtonListener();
514 videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
515 videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
516 videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
518 al = new InputCommentPanelButtonListener();
519 savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
520 savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
522 al = new OutputVideoPanelButtonListener();
523 savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
524 savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
527 private void setPopup() {
528 mainOptionField.addMouseListener(new PopupRightClick(
529 this.mainOptionField));
530 inputOptionField.addMouseListener(new PopupRightClick(
531 this.inputOptionField));
532 outputOptionField.addMouseListener(new PopupRightClick(
533 this.outputOptionField));
534 savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
535 savePanel.getCommentNumField()));
537 savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
538 savePanel.getCommentSavedFileField()));
539 savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
540 savePanel.getCommentSavedFolderField()));
542 savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
543 savePanel.getConvertedVideoSavedFileField()));
544 savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
545 savePanel.getConvertedVideoSavedFolderField()));
547 videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
548 videoSaveInfoPanel.getVideoSavedFileField()));
549 videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
550 videoSaveInfoPanel.getVideoSavedFolderField()));
551 videoSaveInfoPanel.getNibrFileField().addMouseListener(
552 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
554 ffmpegPathField.addMouseListener(new PopupRightClick(
555 this.ffmpegPathField));
556 vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField));
557 VideoID_TextField.addMouseListener(new PopupRightClick(
558 this.VideoID_TextField));
559 viewCommentField.addMouseListener(new PopupRightClick(
560 this.viewCommentField));
561 fontPathField.addMouseListener(new PopupRightClick(this.fontPathField));
562 mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField));
563 passwordField.addMouseListener(new PopupRightClick(this.passwordField));
564 WayBackField.addMouseListener(new PopupRightClick(this.WayBackField));
566 proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField));
567 proxyPortTextField.addMouseListener(new PopupRightClick(
568 this.proxyPortTextField));
570 fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField));
572 ngWordTextField.addMouseListener(new PopupRightClick(
573 this.ngWordTextField));
574 ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField));
577 private void setDropTarget() {
578 addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
579 addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
580 addTarget(videoSaveInfoPanel.getNibrFileField(), false);
582 addTarget(savePanel.getCommentSavedFileField(), false);
583 addTarget(savePanel.getCommentSavedFolderField(), true);
585 addTarget(savePanel.getConvertedVideoSavedFileField(), false);
586 addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
588 addTarget(ffmpegPathField, false);
589 addTarget(vhookPathField, false);
590 addTarget(fontPathField, false);
595 * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする.
596 * @param c 設定対象のテキストフィールドオブジェクト.
597 * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse.
598 * @return ドロップターゲット(用途無し).
600 private DropTarget addTarget(JTextField c, boolean isDir) {
601 return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
604 private File CurrentDir = new File(".");
605 private JPanel PathSettingPanel = new JPanel();
606 private JLabel FFmpegPathLabel = new JLabel();
607 private GridBagLayout gridBagLayout7 = new GridBagLayout();
608 private JTextField ffmpegPathField = new JTextField();
609 private JButton SettingFFmpegPathButton = new JButton();
610 private JLabel VhookPathLabel = new JLabel();
611 private JTextField vhookPathField = new JTextField();
612 private JButton SettingVhookPathButton = new JButton();
613 private JPanel VhookSettingPanel = new JPanel();
614 private GridBagLayout gridBagLayout8 = new GridBagLayout();
615 private JPanel FFmpegSettingPanel = new JPanel();
616 private GridBagLayout gblFFmpegSettingPanel = new GridBagLayout();
617 private JLabel FontPathLabel = new JLabel();
618 private JTextField fontPathField = new JTextField();
619 private JButton SettingFontPathButton = new JButton();
620 private JCheckBox showConvVideoCheckBox = new JCheckBox();
622 private void showSaveDialog(String title, JTextField field, boolean isSave,
624 JFileChooser chooser = new JFileChooser(CurrentDir);
625 chooser.setDialogTitle(title);
628 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
631 code = chooser.showSaveDialog(this);
633 code = chooser.showOpenDialog(this);
635 if (code == JFileChooser.APPROVE_OPTION) {
637 CurrentDir = chooser.getSelectedFile();
638 field.setText(CurrentDir.getAbsolutePath());
640 File selected = chooser.getSelectedFile();
641 CurrentDir = chooser.getCurrentDirectory();
642 field.setText(selected.getAbsolutePath());
647 private SProperties getSetting() {
648 SProperties setting = new SProperties(
650 getInputVideoSetting(),
651 getInputCommentSetting(),
652 getTcommentSetting(),
653 getOutputVideoSetting(),
655 getConvertSetting());
661 * @param setting 反映する設定.
663 private void setSetting(SProperties setting) {
665 final BasicSetting basic = setting.getBasicSetting();
666 tempDir = basic.getTempDir();
667 mailAddressField.setText(basic.getUser().getMail());
668 passwordField.setText(basic.getUser().getPassword());
670 useProxyCheckBox.setSelected(basic.isProxyUse());
671 proxyTextField.setText(basic.getProxyHost());
672 int proxy_port = basic.getProxyPort();
673 if (proxy_port >= 0 && proxy_port <= 65535) {
674 proxyPortTextField.setText(Integer.toString(proxy_port));
676 proxyPortTextField.setText("");
680 final InputVideoSetting inVideo = setting.getInputVideoSetting();
681 JRadioButton activeButton;
682 switch (inVideo.getProcessKind()) {
684 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
687 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
691 activeButton = videoSaveInfoPanel.getVideoSaveButton();
694 activeButton.doClick();
696 videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
697 videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
698 videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
699 final boolean videoFixName = inVideo.isAutoNaming();
700 videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
701 videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
702 videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
705 final InputCommentSetting inputComment = setting.getInputCommentSetting();
706 savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
707 savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
708 savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
709 savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
710 savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
711 savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
712 boolean commentFixName = inputComment.isAutoNaming();
713 savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
714 savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
717 InputTcommentSetting tcom = setting.getInputTcommentSetting();
718 savePanel.setTcommentDownload(tcom.getProcessKind());
719 savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
720 savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
721 savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
722 savePanel.setTcommentFileName(tcom.getFile().getPath());
725 final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
726 savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
727 savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
728 savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
729 savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
730 savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
731 savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
732 boolean convFixName = outputVideo.isAutoNaming();
733 savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
734 savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
737 final MovieSetting movie = setting.getMovieSetting();
738 ffmpegPathField.setText(movie.getFfmpeg().toString());
739 vhookPathField.setText(movie.getVhook().toString());
740 extOptionField.setText(movie.getFfmpegOption().getExtOption());
741 mainOptionField.setText(movie.getFfmpegOption().getMainOption());
742 outputOptionField.setText(movie.getFfmpegOption().getOutOption());
743 inputOptionField.setText(movie.getFfmpegOption().getInOption());
744 FFmpegOptionModel.reload(movie.getOptionFile());
747 final ConvertSetting conv = setting.getConvertSetting();
748 disableVhookCheckBox.setSelected(conv.isVhookDisabled());
749 viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
750 fontPathField.setText(conv.getFont().toString());
751 fontIndexField.setText(Integer.toString(conv.getFontIndex()));
752 shadowComboBox.setSelectedIndex(conv.getShadowIndex());
753 showConvVideoCheckBox.setSelected(conv.isShowConverting());
754 fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
755 opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
756 ngWordTextField.setText(conv.getNgSetting().getWord());
757 ngIdTextField.setText(conv.getNgSetting().getId());
761 * [ファイル|終了] アクションが実行されました。
766 void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
767 SProperties setting = getSetting();
768 SProperties.saveSetting(setting);
773 * [ヘルプ|バージョン情報] アクションが実行されました。
778 void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
779 MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
781 dlg.setLocationRelativeTo(this);
782 dlg.setVisible(true);
786 private Converter Converter = null;
787 private final JLabel extOptionLabel = new JLabel();
788 private final JTextField extOptionField = new JTextField();
789 private JLabel mainOptionLabel = new JLabel();
790 private JTextField mainOptionField = new JTextField();
791 private JLabel inputOptionLabel = new JLabel();
792 private JTextField inputOptionField = new JTextField();
793 private JLabel outputOptionLabel = new JLabel();
794 private JTextField outputOptionField = new JTextField();
795 private final JLabel avfilterOptionLabel = new JLabel();
796 private final JTextField avfilterOptionField = new JTextField();
797 private JLabel FontIndexLabel = new JLabel();
798 private JTextField fontIndexField = new JTextField();
799 private JLabel VideoID_Label = new JLabel();
800 private JLabel WayBackLabel = new JLabel();
801 private JTextField WayBackField = new JTextField();
802 private GridBagLayout gridBagLayout1 = new GridBagLayout();
803 private JPanel OpPanel = new JPanel();
804 private JPanel BasicInfoTabPanel = new JPanel();
805 private GridBagLayout gridBagLayout12 = new GridBagLayout();
806 private JPanel ConvertingSettingPanel = null;
807 private JPanel NGWordSettingPanel = null;
808 private JLabel NGWordLavel = null;
809 private JTextField ngWordTextField = null;
810 private JLabel NGIDLabel = null;
811 private JTextField ngIdTextField = null;
813 private JPanel ProxyInfoPanel = null;
814 private JCheckBox useProxyCheckBox = null;
815 private JLabel proxyLabel = null;
816 private JTextField proxyTextField = null;
817 private JLabel proxyPortLabel = null;
818 private JTextField proxyPortTextField = null;
820 private JCheckBox fixFontSizeCheckBox = null;
821 private JCheckBox opaqueCommentCheckBox = null;
822 private final SavePanel savePanel = new SavePanel();
823 private final VideoSaveInfoPanel videoSaveInfoPanel;
824 private JComboBox FFmpegOptionComboBox = null;
825 private JButton FFmpegOptionReloadButton = null;
826 private JPanel FFmpegOptionComboBoxPanel = null;
828 public void DoButton_actionPerformed(ActionEvent e) {
829 if (Converter == null || Converter.isConverted()) {
832 } catch (Exception ex) {
833 String text = ex.getMessage();
834 if (StringUtils.isEmpty(text)) {
835 text = "予期しないエラーのため中断しました。";
837 ex.printStackTrace();
838 statusBar.setText(text);
840 } else { /* 開始しているので、ストップする。 */
841 final ConvertStopFlag flag = Converter.getStopFlag();
842 if (!flag.needStop()) { /* まだストップしていない。 */
848 private void executeConvert() throws IOException {
851 // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
852 if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
854 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
855 NicoDBFinder finder = NicoDBFinder.getInstance();
856 NicoContent info = finder.findNicoContent(fileName);
858 url = info.getNicoId();
862 } catch (Exception ex) {
863 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
867 url = VideoID_TextField.getText();
870 TextProgressListener sl = new TextProgressListener() {
872 public void setText(final String text) {
873 SwingUtilities.invokeLater(new Runnable() {
876 statusBar.setText(text);
882 ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
884 public void changeState(final State s) {
885 SwingUtilities.invokeLater(new Runnable() {
890 DoButton.setText(DoButtonWaitString);
893 DoButton.setText(DoButtonDefString);
900 Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl,
901 new ConvertStopFlag(scl));
902 DoButton.setText(DoButtonStopString);
903 new Thread(Converter).start();
908 public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
909 showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
912 public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
913 showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
916 public void SettingFontPathButton_actionPerformed(ActionEvent e) {
917 showSaveDialog("フォントへのパス", fontPathField, false, false);
920 public void this_windowClosing(WindowEvent e) {
921 this.jMenuFileExit_actionPerformed(null);
925 * This method initializes ConvertingSettingPanel
927 * @return javax.swing.JPanel
929 private JPanel getConvertingSettingPanel() {
930 if (ConvertingSettingPanel == null) {
931 GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
932 gridBagConstraints11.weighty = 1.0;
933 gridBagConstraints11.weightx = 1.0;
934 gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
935 gridBagConstraints11.gridy = 1;
936 gridBagConstraints11.gridx = 0;
937 gridBagConstraints11.anchor = GridBagConstraints.NORTH;
938 gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
939 GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
940 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
941 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
942 gridBagConstraints.gridx = 0;
943 gridBagConstraints.anchor = GridBagConstraints.CENTER;
944 gridBagConstraints.weighty = 0.0;
945 gridBagConstraints.gridy = 0;
946 ConvertingSettingPanel = new JPanel();
947 ConvertingSettingPanel.setLayout(new GridBagLayout());
948 ConvertingSettingPanel.add(getNGWordSettingPanel(),
949 gridBagConstraints11);
950 ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
952 return ConvertingSettingPanel;
956 * This method initializes NGWordSettingPanel
958 * @return javax.swing.JPanel
960 private JPanel getNGWordSettingPanel() {
961 if (NGWordSettingPanel == null) {
962 GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
963 gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
964 gridBagConstraints5.gridy = 1;
965 gridBagConstraints5.weightx = 1.0;
966 gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
967 gridBagConstraints5.gridx = 1;
968 GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
969 gridBagConstraints4.gridx = 0;
970 gridBagConstraints4.anchor = GridBagConstraints.WEST;
971 gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
972 gridBagConstraints4.gridy = 1;
973 NGIDLabel = new JLabel();
974 NGIDLabel.setText("NG ID");
975 GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
976 gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
977 gridBagConstraints3.gridy = 0;
978 gridBagConstraints3.weightx = 1.0;
979 gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
980 gridBagConstraints3.gridx = 1;
981 GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
982 gridBagConstraints2.gridx = 0;
983 gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
984 gridBagConstraints2.gridy = 0;
985 NGWordLavel = new JLabel();
986 NGWordLavel.setText("NGワード");
987 NGWordSettingPanel = new JPanel();
988 NGWordSettingPanel.setLayout(new GridBagLayout());
989 NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
991 NGWordSettingPanel.add(NGWordLavel, gridBagConstraints2);
992 NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
993 NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
994 NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
996 return NGWordSettingPanel;
1000 * This method initializes NGWordTextField
1002 * @return javax.swing.JTextField
1004 private JTextField getNGWordTextField() {
1005 if (ngWordTextField == null) {
1006 ngWordTextField = new JTextField();
1007 ngWordTextField.setName("ngWordTextField");
1009 return ngWordTextField;
1013 * This method initializes NGIDTextField
1015 * @return javax.swing.JTextField
1017 private JTextField getNGIDTextField() {
1018 if (ngIdTextField == null) {
1019 ngIdTextField = new JTextField();
1020 ngIdTextField.setName("ngIdTextField");
1022 return ngIdTextField;
1026 * This method initializes ProxyInfoPanel
1028 * @return javax.swing.JPanel
1030 private JPanel getProxyInfoPanel() {
1031 if (ProxyInfoPanel == null) {
1032 GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1033 gridBagConstraints13.gridx = 0;
1034 gridBagConstraints13.gridwidth = 2;
1035 gridBagConstraints13.weightx = 1.0;
1036 gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1037 gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1038 gridBagConstraints13.gridy = 0;
1039 GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1040 gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1041 gridBagConstraints12.gridy = 2;
1042 gridBagConstraints12.weightx = 1.0;
1043 gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1044 gridBagConstraints12.gridx = 1;
1045 GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1046 gridBagConstraints10.gridx = 0;
1047 gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1048 gridBagConstraints10.gridy = 2;
1049 proxyPortLabel = new JLabel();
1050 proxyPortLabel.setText("ポート番号");
1051 GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1052 gridBagConstraints9.fill = GridBagConstraints.BOTH;
1053 gridBagConstraints9.gridy = 1;
1054 gridBagConstraints9.weightx = 1.0;
1055 gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1056 gridBagConstraints9.gridx = 1;
1057 GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1058 gridBagConstraints8.gridx = 0;
1059 gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1060 gridBagConstraints8.fill = GridBagConstraints.NONE;
1061 gridBagConstraints8.anchor = GridBagConstraints.EAST;
1062 gridBagConstraints8.gridy = 1;
1063 proxyLabel = new JLabel();
1064 proxyLabel.setText("プロキシ");
1065 ProxyInfoPanel = new JPanel();
1066 ProxyInfoPanel.setLayout(new GridBagLayout());
1067 ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1069 ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1070 ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1071 ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1072 ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1073 ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1075 return ProxyInfoPanel;
1079 * This method initializes ProxyTextField
1081 * @return javax.swing.JTextField
1083 private JTextField getProxyTextField() {
1084 if (proxyTextField == null) {
1085 proxyTextField = new JTextField();
1086 proxyTextField.setName("proxyTextField");
1088 return proxyTextField;
1092 * This method initializes ProxyPortTextField
1094 * @return javax.swing.JTextField
1096 private JTextField getProxyPortTextField() {
1097 if (proxyPortTextField == null) {
1098 proxyPortTextField = new JTextField();
1099 proxyPortTextField.setName("proxyPortTextField");
1101 return proxyPortTextField;
1105 * This method initializes UseProxyCheckBox
1107 * @return javax.swing.JCheckBox
1109 private JCheckBox getUseProxyCheckBox() {
1110 if (useProxyCheckBox == null) {
1111 useProxyCheckBox = new JCheckBox();
1112 useProxyCheckBox.setText("プロキシを使う");
1113 useProxyCheckBox.setName("useProxyCheckBox");
1115 return useProxyCheckBox;
1119 * This method initializes FixFontSizeCheckBox
1121 * @return javax.swing.JCheckBox
1123 private JCheckBox getFixFontSizeCheckBox() {
1124 if (fixFontSizeCheckBox == null) {
1125 fixFontSizeCheckBox = new JCheckBox();
1126 fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1127 fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1129 return fixFontSizeCheckBox;
1133 * This method initializes OpaqueCommentCheckBox
1135 * @return javax.swing.JCheckBox
1137 private JCheckBox getOpaqueCommentCheckBox() {
1138 if (opaqueCommentCheckBox == null) {
1139 opaqueCommentCheckBox = new JCheckBox();
1140 opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1141 opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1143 return opaqueCommentCheckBox;
1146 * This method initializes FFmpegOptionComboBox
1148 * @return javax.swing.JComboBox
1150 private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1151 private JCheckBox disableVhookCheckBox = null;
1152 private JTextField viewCommentField = null;
1153 private JLabel ViewCommentLabel = null;
1154 private JLabel ShadowKindLabel = null;
1155 private JComboBox shadowComboBox = null;
1157 private JComboBox getFFmpegOptionComboBox() {
1158 if (FFmpegOptionComboBox == null) {
1159 FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1160 FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1162 public void actionPerformed(java.awt.event.ActionEvent e) {
1163 if (FFmpegOptionModel.isFile()) {// ファイル
1164 extOptionField.setEnabled(false);
1165 mainOptionField.setEnabled(false);
1166 inputOptionField.setEnabled(false);
1167 outputOptionField.setEnabled(false);
1169 extOptionField.setEnabled(true);
1170 mainOptionField.setEnabled(true);
1171 inputOptionField.setEnabled(true);
1172 outputOptionField.setEnabled(true);
1177 return FFmpegOptionComboBox;
1181 * This method initializes FFmpegOptionReloadButton
1183 * @return javax.swing.JButton
1185 private JButton getFFmpegOptionReloadButton() {
1186 if (FFmpegOptionReloadButton == null) {
1187 FFmpegOptionReloadButton = new JButton();
1188 FFmpegOptionReloadButton.setText("更新");
1189 FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1191 public void actionPerformed(java.awt.event.ActionEvent e) {
1192 FFmpegOptionModel.reload();
1196 return FFmpegOptionReloadButton;
1200 * This method initializes FFmpegOptionComboBoxPanel
1202 * @return javax.swing.JPanel
1204 private JPanel getFFmpegOptionComboBoxPanel() {
1205 if (FFmpegOptionComboBoxPanel == null) {
1206 GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1207 gridBagConstraints47.fill = GridBagConstraints.BOTH;
1208 gridBagConstraints47.gridx = -1;
1209 gridBagConstraints47.gridy = -1;
1210 gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1211 GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1212 gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1213 gridBagConstraints46.gridwidth = 3;
1214 gridBagConstraints46.gridx = -1;
1215 gridBagConstraints46.gridy = -1;
1216 gridBagConstraints46.weightx = 1.0;
1217 gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1218 FFmpegOptionComboBoxPanel = new JPanel();
1219 FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1220 FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1221 gridBagConstraints46);
1222 FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1223 gridBagConstraints47);
1225 return FFmpegOptionComboBoxPanel;
1229 * This method initializes NotUseVhookCheckBox
1231 * @return javax.swing.JCheckBox
1233 private JCheckBox getNotUseVhookCheckBox() {
1234 if (disableVhookCheckBox == null) {
1235 disableVhookCheckBox = new JCheckBox();
1236 disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1237 disableVhookCheckBox.setName("disableVhookCheckBox");
1239 return disableVhookCheckBox;
1243 * This method initializes ViewCommentField
1245 * @return javax.swing.JTextField
1247 private JTextField getViewCommentField() {
1248 if (viewCommentField == null) {
1249 viewCommentField = new JTextField();
1250 viewCommentField.setName("viewCommentField");
1252 return viewCommentField;
1256 * This method initializes ShadowComboBox
1258 * @return javax.swing.JComboBox
1260 private JComboBox getShadowComboBox() {
1261 if (shadowComboBox == null) {
1262 shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1263 shadowComboBox.setName("shadowComboBox");
1265 return shadowComboBox;
1268 private BasicSetting getBasicSetting() {
1269 String mail = mailAddressField.getText();
1270 String pass = String.valueOf(passwordField.getPassword());
1271 boolean proxyUse = useProxyCheckBox.isSelected();
1272 String proxyHost = proxyTextField.getText();
1275 proxyPort = Integer.parseInt(proxyPortTextField.getText());
1276 } catch (NumberFormatException e) {
1279 // TODO 作業用ディレクトリの設定GUI無し
1280 return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1283 private InputVideoSetting getInputVideoSetting() {
1285 if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1286 kind = VideoSaveKind.NO_SAVE;
1287 } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1288 kind = VideoSaveKind.NICOBROWSER;
1290 kind = VideoSaveKind.SAVE;
1292 boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1293 String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1294 String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1295 boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1296 String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1298 return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1301 private InputCommentSetting getInputCommentSetting() {
1302 boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1303 String file = savePanel.getCommentSavedFileField().getText();
1306 back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1307 } catch (NumberFormatException ex) {
1310 boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1311 boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1312 String folder = savePanel.getCommentSavedFolderField().getText();
1313 boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1315 return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1320 * 画面入力値から投稿者コメント設定を作成する.
1321 * @return 作成した投稿者コメント設定.
1323 private InputTcommentSetting getTcommentSetting() {
1324 boolean down = savePanel.isTcommentDownload();
1325 boolean del = savePanel.isTcommentDelete();
1326 boolean naming = savePanel.isTcommentAutoFileName();
1327 String dir = savePanel.getTcommentDirectoryName();
1328 String f = savePanel.getTcommentFileName();
1329 return new InputTcommentSetting(down, naming, dir, f, del);
1332 private OutputVideoSetting getOutputVideoSetting() {
1333 boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1334 boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1335 boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1336 String file = savePanel.getConvertedVideoSavedFileField().getText();
1337 boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1338 boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1339 String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1341 return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1345 private MovieSetting getMovieSetting() {
1346 String ffmpeg = ffmpegPathField.getText();
1347 String vhook = vhookPathField.getText();
1348 String ext = extOptionField.getText();
1349 String main = mainOptionField.getText();
1350 String in = inputOptionField.getText();
1351 String out = outputOptionField.getText();
1352 File optionFile = FFmpegOptionModel.getSelectedFile();
1354 FfmpegOption opt = new FfmpegOption(ext, main, in, out);
1355 return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1358 private ConvertSetting getConvertSetting() {
1359 boolean vhookDisabled = disableVhookCheckBox.isSelected();
1360 int maxComment = 30;
1362 maxComment = Integer.parseInt(viewCommentField.getText());
1363 } catch (NumberFormatException ex) {
1365 File font = new File(fontPathField.getText());
1366 int fontIndex = Integer.parseInt(fontIndexField.getText());
1367 int shadowIndex = shadowComboBox.getSelectedIndex();
1368 boolean showConv = showConvVideoCheckBox.isSelected();
1369 boolean adjustFont = fixFontSizeCheckBox.isSelected();
1370 boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1371 NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1373 return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1374 commentOpaque, ngSetting);
1377 private class InputVideoPanelButtonListener implements ActionListener {
1379 public void actionPerformed(ActionEvent e) {
1380 final Object source = e.getSource();
1381 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1387 if (source == panel.getShowSavingVideoFolderDialogButton()) {
1388 title = "動画の保存先(フォルダ)";
1389 field = panel.getVideoSavedFolderField();
1392 } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1393 title = "動画の保存先(ファイル)";
1394 field = panel.getVideoSavedFileField();
1397 } else if (source == panel.getNibrFileChooserButton()) {
1398 title = "NicoBrowserファイル選択";
1399 field = panel.getNibrFileField();
1405 showSaveDialog(title, field, isSave, isDir);
1409 private class InputCommentPanelButtonListener implements ActionListener {
1411 public void actionPerformed(ActionEvent e) {
1412 final Object source = e.getSource();
1417 if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1418 title = "コメントの保存先(フォルダ)";
1419 field = savePanel.getCommentSavedFolderField();
1422 } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1423 title = "コメントの保存先(ファイル)";
1424 field = savePanel.getCommentSavedFileField();
1430 showSaveDialog(title, field, isSave, isDir);
1434 private class OutputVideoPanelButtonListener implements ActionListener {
1436 public void actionPerformed(ActionEvent e) {
1437 final Object source = e.getSource();
1442 if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1443 title = "コメント付き動画の保存先(フォルダ)";
1444 field = savePanel.getConvertedVideoSavedFolderField();
1447 } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1448 title = "コメント付き動画の保存先(ファイル)";
1449 field = savePanel.getConvertedVideoSavedFileField();
1455 showSaveDialog(title, field, isSave, isDir);
1459 private class VideoUseRadioButtonListener implements ActionListener {
1461 public void actionPerformed(ActionEvent e) {
1462 Object source = e.getSource();
1463 if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1470 private void maskBase() {
1474 private void maskExt() {
1478 private void mask(boolean b) {
1479 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1480 VideoID_TextField.setEditable(b);
1481 panel.getDelVideoCheckBox().setEnabled(b);
1483 panel.getSaveFolderRadioButton().setEnabled(b);
1484 panel.getVideoSavedFolderField().setEnabled(b);
1485 panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1487 panel.getSaveFileRadioButton().setEnabled(b);
1488 panel.getVideoSavedFileField().setEnabled(b);
1489 panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1491 panel.getNibrFileField().setEnabled(!b);
1492 panel.getNibrFileChooserButton().setEnabled(!b);
1497 class MainFrame_this_windowAdapter extends WindowAdapter {
1499 private MainFrame adaptee;
1501 MainFrame_this_windowAdapter(MainFrame adaptee) {
1502 this.adaptee = adaptee;
1506 public void windowClosing(WindowEvent e) {
1507 adaptee.this_windowClosing(e);
1511 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1513 private MainFrame adaptee;
1515 MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1516 this.adaptee = adaptee;
1519 public void actionPerformed(ActionEvent e) {
1520 adaptee.SettingFontPathButton_actionPerformed(e);
1524 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1526 private MainFrame adaptee;
1528 MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1529 this.adaptee = adaptee;
1532 public void actionPerformed(ActionEvent e) {
1533 adaptee.SettingVhookPathButton_actionPerformed(e);
1537 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1539 private MainFrame adaptee;
1541 MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1542 this.adaptee = adaptee;
1545 public void actionPerformed(ActionEvent e) {
1546 adaptee.SettingFFmpegPathButton_actionPerformed(e);
1550 class MainFrame_DoButton_actionAdapter implements ActionListener {
1552 private MainFrame adaptee;
1554 MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1555 this.adaptee = adaptee;
1558 public void actionPerformed(ActionEvent e) {
1559 adaptee.DoButton_actionPerformed(e);
1563 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1567 MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1568 this.adaptee = adaptee;
1571 public void actionPerformed(ActionEvent actionEvent) {
1572 adaptee.jMenuFileExit_actionPerformed(actionEvent);
1576 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1580 MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1581 this.adaptee = adaptee;
1584 public void actionPerformed(ActionEvent actionEvent) {
1585 adaptee.jMenuHelpAbout_actionPerformed(actionEvent);