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.5.0";
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 inputOptionField.setText(movie.getFfmpegOption().getInOption());
743 outputOptionField.setText(movie.getFfmpegOption().getOutOption());
744 avfilterOptionField.setText(movie.getFfmpegOption().getAvfilterOption());
745 FFmpegOptionModel.reload(movie.getOptionFile());
748 final ConvertSetting conv = setting.getConvertSetting();
749 disableVhookCheckBox.setSelected(conv.isVhookDisabled());
750 viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
751 fontPathField.setText(conv.getFont().toString());
752 fontIndexField.setText(Integer.toString(conv.getFontIndex()));
753 shadowComboBox.setSelectedIndex(conv.getShadowIndex());
754 showConvVideoCheckBox.setSelected(conv.isShowConverting());
755 fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
756 opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
757 ngWordTextField.setText(conv.getNgSetting().getWord());
758 ngIdTextField.setText(conv.getNgSetting().getId());
762 * [ファイル|終了] アクションが実行されました。
767 void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
768 SProperties setting = getSetting();
769 SProperties.saveSetting(setting);
774 * [ヘルプ|バージョン情報] アクションが実行されました。
779 void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
780 MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
782 dlg.setLocationRelativeTo(this);
783 dlg.setVisible(true);
787 private Converter Converter = null;
788 private final JLabel extOptionLabel = new JLabel();
789 private final JTextField extOptionField = new JTextField();
790 private JLabel mainOptionLabel = new JLabel();
791 private JTextField mainOptionField = new JTextField();
792 private JLabel inputOptionLabel = new JLabel();
793 private JTextField inputOptionField = new JTextField();
794 private JLabel outputOptionLabel = new JLabel();
795 private JTextField outputOptionField = new JTextField();
796 private final JLabel avfilterOptionLabel = new JLabel();
797 private final JTextField avfilterOptionField = new JTextField();
798 private JLabel FontIndexLabel = new JLabel();
799 private JTextField fontIndexField = new JTextField();
800 private JLabel VideoID_Label = new JLabel();
801 private JLabel WayBackLabel = new JLabel();
802 private JTextField WayBackField = new JTextField();
803 private GridBagLayout gridBagLayout1 = new GridBagLayout();
804 private JPanel OpPanel = new JPanel();
805 private JPanel BasicInfoTabPanel = new JPanel();
806 private GridBagLayout gridBagLayout12 = new GridBagLayout();
807 private JPanel ConvertingSettingPanel = null;
808 private JPanel NGWordSettingPanel = null;
809 private JLabel NGWordLavel = null;
810 private JTextField ngWordTextField = null;
811 private JLabel NGIDLabel = null;
812 private JTextField ngIdTextField = null;
814 private JPanel ProxyInfoPanel = null;
815 private JCheckBox useProxyCheckBox = null;
816 private JLabel proxyLabel = null;
817 private JTextField proxyTextField = null;
818 private JLabel proxyPortLabel = null;
819 private JTextField proxyPortTextField = null;
821 private JCheckBox fixFontSizeCheckBox = null;
822 private JCheckBox opaqueCommentCheckBox = null;
823 private final SavePanel savePanel = new SavePanel();
824 private final VideoSaveInfoPanel videoSaveInfoPanel;
825 private JComboBox FFmpegOptionComboBox = null;
826 private JButton FFmpegOptionReloadButton = null;
827 private JPanel FFmpegOptionComboBoxPanel = null;
829 public void DoButton_actionPerformed(ActionEvent e) {
830 if (Converter == null || Converter.isConverted()) {
833 } catch (Exception ex) {
834 String text = ex.getMessage();
835 if (StringUtils.isEmpty(text)) {
836 text = "予期しないエラーのため中断しました。";
838 ex.printStackTrace();
839 statusBar.setText(text);
841 } else { /* 開始しているので、ストップする。 */
842 final ConvertStopFlag flag = Converter.getStopFlag();
843 if (!flag.needStop()) { /* まだストップしていない。 */
849 private void executeConvert() throws IOException {
852 // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
853 if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
855 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
856 NicoDBFinder finder = NicoDBFinder.getInstance();
857 NicoContent info = finder.findNicoContent(fileName);
859 url = info.getNicoId();
863 } catch (Exception ex) {
864 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
868 url = VideoID_TextField.getText();
871 TextProgressListener sl = new TextProgressListener() {
873 public void setText(final String text) {
874 SwingUtilities.invokeLater(new Runnable() {
877 statusBar.setText(text);
883 ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
885 public void changeState(final State s) {
886 SwingUtilities.invokeLater(new Runnable() {
891 DoButton.setText(DoButtonWaitString);
894 DoButton.setText(DoButtonDefString);
901 Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl,
902 new ConvertStopFlag(scl));
903 DoButton.setText(DoButtonStopString);
904 new Thread(Converter).start();
909 public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
910 showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
913 public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
914 showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
917 public void SettingFontPathButton_actionPerformed(ActionEvent e) {
918 showSaveDialog("フォントへのパス", fontPathField, false, false);
921 public void this_windowClosing(WindowEvent e) {
922 this.jMenuFileExit_actionPerformed(null);
926 * This method initializes ConvertingSettingPanel
928 * @return javax.swing.JPanel
930 private JPanel getConvertingSettingPanel() {
931 if (ConvertingSettingPanel == null) {
932 GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
933 gridBagConstraints11.weighty = 1.0;
934 gridBagConstraints11.weightx = 1.0;
935 gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
936 gridBagConstraints11.gridy = 1;
937 gridBagConstraints11.gridx = 0;
938 gridBagConstraints11.anchor = GridBagConstraints.NORTH;
939 gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
940 GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
941 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
942 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
943 gridBagConstraints.gridx = 0;
944 gridBagConstraints.anchor = GridBagConstraints.CENTER;
945 gridBagConstraints.weighty = 0.0;
946 gridBagConstraints.gridy = 0;
947 ConvertingSettingPanel = new JPanel();
948 ConvertingSettingPanel.setLayout(new GridBagLayout());
949 ConvertingSettingPanel.add(getNGWordSettingPanel(),
950 gridBagConstraints11);
951 ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
953 return ConvertingSettingPanel;
957 * This method initializes NGWordSettingPanel
959 * @return javax.swing.JPanel
961 private JPanel getNGWordSettingPanel() {
962 if (NGWordSettingPanel == null) {
963 GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
964 gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
965 gridBagConstraints5.gridy = 1;
966 gridBagConstraints5.weightx = 1.0;
967 gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
968 gridBagConstraints5.gridx = 1;
969 GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
970 gridBagConstraints4.gridx = 0;
971 gridBagConstraints4.anchor = GridBagConstraints.WEST;
972 gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
973 gridBagConstraints4.gridy = 1;
974 NGIDLabel = new JLabel();
975 NGIDLabel.setText("NG ID");
976 GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
977 gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
978 gridBagConstraints3.gridy = 0;
979 gridBagConstraints3.weightx = 1.0;
980 gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
981 gridBagConstraints3.gridx = 1;
982 GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
983 gridBagConstraints2.gridx = 0;
984 gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
985 gridBagConstraints2.gridy = 0;
986 NGWordLavel = new JLabel();
987 NGWordLavel.setText("NGワード");
988 NGWordSettingPanel = new JPanel();
989 NGWordSettingPanel.setLayout(new GridBagLayout());
990 NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
992 NGWordSettingPanel.add(NGWordLavel, gridBagConstraints2);
993 NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
994 NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
995 NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
997 return NGWordSettingPanel;
1001 * This method initializes NGWordTextField
1003 * @return javax.swing.JTextField
1005 private JTextField getNGWordTextField() {
1006 if (ngWordTextField == null) {
1007 ngWordTextField = new JTextField();
1008 ngWordTextField.setName("ngWordTextField");
1010 return ngWordTextField;
1014 * This method initializes NGIDTextField
1016 * @return javax.swing.JTextField
1018 private JTextField getNGIDTextField() {
1019 if (ngIdTextField == null) {
1020 ngIdTextField = new JTextField();
1021 ngIdTextField.setName("ngIdTextField");
1023 return ngIdTextField;
1027 * This method initializes ProxyInfoPanel
1029 * @return javax.swing.JPanel
1031 private JPanel getProxyInfoPanel() {
1032 if (ProxyInfoPanel == null) {
1033 GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1034 gridBagConstraints13.gridx = 0;
1035 gridBagConstraints13.gridwidth = 2;
1036 gridBagConstraints13.weightx = 1.0;
1037 gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1038 gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1039 gridBagConstraints13.gridy = 0;
1040 GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1041 gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1042 gridBagConstraints12.gridy = 2;
1043 gridBagConstraints12.weightx = 1.0;
1044 gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1045 gridBagConstraints12.gridx = 1;
1046 GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1047 gridBagConstraints10.gridx = 0;
1048 gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1049 gridBagConstraints10.gridy = 2;
1050 proxyPortLabel = new JLabel();
1051 proxyPortLabel.setText("ポート番号");
1052 GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1053 gridBagConstraints9.fill = GridBagConstraints.BOTH;
1054 gridBagConstraints9.gridy = 1;
1055 gridBagConstraints9.weightx = 1.0;
1056 gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1057 gridBagConstraints9.gridx = 1;
1058 GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1059 gridBagConstraints8.gridx = 0;
1060 gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1061 gridBagConstraints8.fill = GridBagConstraints.NONE;
1062 gridBagConstraints8.anchor = GridBagConstraints.EAST;
1063 gridBagConstraints8.gridy = 1;
1064 proxyLabel = new JLabel();
1065 proxyLabel.setText("プロキシ");
1066 ProxyInfoPanel = new JPanel();
1067 ProxyInfoPanel.setLayout(new GridBagLayout());
1068 ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1070 ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1071 ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1072 ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1073 ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1074 ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1076 return ProxyInfoPanel;
1080 * This method initializes ProxyTextField
1082 * @return javax.swing.JTextField
1084 private JTextField getProxyTextField() {
1085 if (proxyTextField == null) {
1086 proxyTextField = new JTextField();
1087 proxyTextField.setName("proxyTextField");
1089 return proxyTextField;
1093 * This method initializes ProxyPortTextField
1095 * @return javax.swing.JTextField
1097 private JTextField getProxyPortTextField() {
1098 if (proxyPortTextField == null) {
1099 proxyPortTextField = new JTextField();
1100 proxyPortTextField.setName("proxyPortTextField");
1102 return proxyPortTextField;
1106 * This method initializes UseProxyCheckBox
1108 * @return javax.swing.JCheckBox
1110 private JCheckBox getUseProxyCheckBox() {
1111 if (useProxyCheckBox == null) {
1112 useProxyCheckBox = new JCheckBox();
1113 useProxyCheckBox.setText("プロキシを使う");
1114 useProxyCheckBox.setName("useProxyCheckBox");
1116 return useProxyCheckBox;
1120 * This method initializes FixFontSizeCheckBox
1122 * @return javax.swing.JCheckBox
1124 private JCheckBox getFixFontSizeCheckBox() {
1125 if (fixFontSizeCheckBox == null) {
1126 fixFontSizeCheckBox = new JCheckBox();
1127 fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1128 fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1130 return fixFontSizeCheckBox;
1134 * This method initializes OpaqueCommentCheckBox
1136 * @return javax.swing.JCheckBox
1138 private JCheckBox getOpaqueCommentCheckBox() {
1139 if (opaqueCommentCheckBox == null) {
1140 opaqueCommentCheckBox = new JCheckBox();
1141 opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1142 opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1144 return opaqueCommentCheckBox;
1147 * This method initializes FFmpegOptionComboBox
1149 * @return javax.swing.JComboBox
1151 private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1152 private JCheckBox disableVhookCheckBox = null;
1153 private JTextField viewCommentField = null;
1154 private JLabel ViewCommentLabel = null;
1155 private JLabel ShadowKindLabel = null;
1156 private JComboBox shadowComboBox = null;
1158 private JComboBox getFFmpegOptionComboBox() {
1159 if (FFmpegOptionComboBox == null) {
1160 FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1161 FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1163 public void actionPerformed(java.awt.event.ActionEvent e) {
1164 if (FFmpegOptionModel.isFile()) {// ファイル
1165 extOptionField.setEnabled(false);
1166 mainOptionField.setEnabled(false);
1167 inputOptionField.setEnabled(false);
1168 outputOptionField.setEnabled(false);
1169 avfilterOptionField.setEnabled(false);
1171 extOptionField.setEnabled(true);
1172 mainOptionField.setEnabled(true);
1173 inputOptionField.setEnabled(true);
1174 outputOptionField.setEnabled(true);
1175 avfilterOptionField.setEditable(true);
1180 return FFmpegOptionComboBox;
1184 * This method initializes FFmpegOptionReloadButton
1186 * @return javax.swing.JButton
1188 private JButton getFFmpegOptionReloadButton() {
1189 if (FFmpegOptionReloadButton == null) {
1190 FFmpegOptionReloadButton = new JButton();
1191 FFmpegOptionReloadButton.setText("更新");
1192 FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1194 public void actionPerformed(java.awt.event.ActionEvent e) {
1195 FFmpegOptionModel.reload();
1199 return FFmpegOptionReloadButton;
1203 * This method initializes FFmpegOptionComboBoxPanel
1205 * @return javax.swing.JPanel
1207 private JPanel getFFmpegOptionComboBoxPanel() {
1208 if (FFmpegOptionComboBoxPanel == null) {
1209 GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1210 gridBagConstraints47.fill = GridBagConstraints.BOTH;
1211 gridBagConstraints47.gridx = -1;
1212 gridBagConstraints47.gridy = -1;
1213 gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1214 GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1215 gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1216 gridBagConstraints46.gridwidth = 3;
1217 gridBagConstraints46.gridx = -1;
1218 gridBagConstraints46.gridy = -1;
1219 gridBagConstraints46.weightx = 1.0;
1220 gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1221 FFmpegOptionComboBoxPanel = new JPanel();
1222 FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1223 FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1224 gridBagConstraints46);
1225 FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1226 gridBagConstraints47);
1228 return FFmpegOptionComboBoxPanel;
1232 * This method initializes NotUseVhookCheckBox
1234 * @return javax.swing.JCheckBox
1236 private JCheckBox getNotUseVhookCheckBox() {
1237 if (disableVhookCheckBox == null) {
1238 disableVhookCheckBox = new JCheckBox();
1239 disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1240 disableVhookCheckBox.setName("disableVhookCheckBox");
1242 return disableVhookCheckBox;
1246 * This method initializes ViewCommentField
1248 * @return javax.swing.JTextField
1250 private JTextField getViewCommentField() {
1251 if (viewCommentField == null) {
1252 viewCommentField = new JTextField();
1253 viewCommentField.setName("viewCommentField");
1255 return viewCommentField;
1259 * This method initializes ShadowComboBox
1261 * @return javax.swing.JComboBox
1263 private JComboBox getShadowComboBox() {
1264 if (shadowComboBox == null) {
1265 shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1266 shadowComboBox.setName("shadowComboBox");
1268 return shadowComboBox;
1271 private BasicSetting getBasicSetting() {
1272 String mail = mailAddressField.getText();
1273 String pass = String.valueOf(passwordField.getPassword());
1274 boolean proxyUse = useProxyCheckBox.isSelected();
1275 String proxyHost = proxyTextField.getText();
1278 proxyPort = Integer.parseInt(proxyPortTextField.getText());
1279 } catch (NumberFormatException e) {
1282 // TODO 作業用ディレクトリの設定GUI無し
1283 return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1286 private InputVideoSetting getInputVideoSetting() {
1288 if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1289 kind = VideoSaveKind.NO_SAVE;
1290 } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1291 kind = VideoSaveKind.NICOBROWSER;
1293 kind = VideoSaveKind.SAVE;
1295 boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1296 String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1297 String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1298 boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1299 String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1301 return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1304 private InputCommentSetting getInputCommentSetting() {
1305 boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1306 String file = savePanel.getCommentSavedFileField().getText();
1309 back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1310 } catch (NumberFormatException ex) {
1313 boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1314 boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1315 String folder = savePanel.getCommentSavedFolderField().getText();
1316 boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1318 return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1323 * 画面入力値から投稿者コメント設定を作成する.
1324 * @return 作成した投稿者コメント設定.
1326 private InputTcommentSetting getTcommentSetting() {
1327 boolean down = savePanel.isTcommentDownload();
1328 boolean del = savePanel.isTcommentDelete();
1329 boolean naming = savePanel.isTcommentAutoFileName();
1330 String dir = savePanel.getTcommentDirectoryName();
1331 String f = savePanel.getTcommentFileName();
1332 return new InputTcommentSetting(down, naming, dir, f, del);
1335 private OutputVideoSetting getOutputVideoSetting() {
1336 boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1337 boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1338 boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1339 String file = savePanel.getConvertedVideoSavedFileField().getText();
1340 boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1341 boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1342 String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1344 return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1348 private MovieSetting getMovieSetting() {
1349 String ffmpeg = ffmpegPathField.getText();
1350 String vhook = vhookPathField.getText();
1351 String ext = extOptionField.getText();
1352 String main = mainOptionField.getText();
1353 String in = inputOptionField.getText();
1354 String out = outputOptionField.getText();
1355 String avfilter = avfilterOptionField.getText();
1356 File optionFile = FFmpegOptionModel.getSelectedFile();
1358 FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter);
1359 return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1362 private ConvertSetting getConvertSetting() {
1363 boolean vhookDisabled = disableVhookCheckBox.isSelected();
1364 int maxComment = 30;
1366 maxComment = Integer.parseInt(viewCommentField.getText());
1367 } catch (NumberFormatException ex) {
1369 File font = new File(fontPathField.getText());
1370 int fontIndex = Integer.parseInt(fontIndexField.getText());
1371 int shadowIndex = shadowComboBox.getSelectedIndex();
1372 boolean showConv = showConvVideoCheckBox.isSelected();
1373 boolean adjustFont = fixFontSizeCheckBox.isSelected();
1374 boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1375 NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1377 return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1378 commentOpaque, ngSetting);
1381 private class InputVideoPanelButtonListener implements ActionListener {
1383 public void actionPerformed(ActionEvent e) {
1384 final Object source = e.getSource();
1385 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1391 if (source == panel.getShowSavingVideoFolderDialogButton()) {
1392 title = "動画の保存先(フォルダ)";
1393 field = panel.getVideoSavedFolderField();
1396 } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1397 title = "動画の保存先(ファイル)";
1398 field = panel.getVideoSavedFileField();
1401 } else if (source == panel.getNibrFileChooserButton()) {
1402 title = "NicoBrowserファイル選択";
1403 field = panel.getNibrFileField();
1409 showSaveDialog(title, field, isSave, isDir);
1413 private class InputCommentPanelButtonListener implements ActionListener {
1415 public void actionPerformed(ActionEvent e) {
1416 final Object source = e.getSource();
1421 if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1422 title = "コメントの保存先(フォルダ)";
1423 field = savePanel.getCommentSavedFolderField();
1426 } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1427 title = "コメントの保存先(ファイル)";
1428 field = savePanel.getCommentSavedFileField();
1434 showSaveDialog(title, field, isSave, isDir);
1438 private class OutputVideoPanelButtonListener implements ActionListener {
1440 public void actionPerformed(ActionEvent e) {
1441 final Object source = e.getSource();
1446 if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1447 title = "コメント付き動画の保存先(フォルダ)";
1448 field = savePanel.getConvertedVideoSavedFolderField();
1451 } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1452 title = "コメント付き動画の保存先(ファイル)";
1453 field = savePanel.getConvertedVideoSavedFileField();
1459 showSaveDialog(title, field, isSave, isDir);
1463 private class VideoUseRadioButtonListener implements ActionListener {
1465 public void actionPerformed(ActionEvent e) {
1466 Object source = e.getSource();
1467 if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1474 private void maskBase() {
1478 private void maskExt() {
1482 private void mask(boolean b) {
1483 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1484 VideoID_TextField.setEditable(b);
1485 panel.getDelVideoCheckBox().setEnabled(b);
1487 panel.getSaveFolderRadioButton().setEnabled(b);
1488 panel.getVideoSavedFolderField().setEnabled(b);
1489 panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1491 panel.getSaveFileRadioButton().setEnabled(b);
1492 panel.getVideoSavedFileField().setEnabled(b);
1493 panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1495 panel.getNibrFileField().setEnabled(!b);
1496 panel.getNibrFileChooserButton().setEnabled(!b);
1501 class MainFrame_this_windowAdapter extends WindowAdapter {
1503 private MainFrame adaptee;
1505 MainFrame_this_windowAdapter(MainFrame adaptee) {
1506 this.adaptee = adaptee;
1510 public void windowClosing(WindowEvent e) {
1511 adaptee.this_windowClosing(e);
1515 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1517 private MainFrame adaptee;
1519 MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1520 this.adaptee = adaptee;
1523 public void actionPerformed(ActionEvent e) {
1524 adaptee.SettingFontPathButton_actionPerformed(e);
1528 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1530 private MainFrame adaptee;
1532 MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1533 this.adaptee = adaptee;
1536 public void actionPerformed(ActionEvent e) {
1537 adaptee.SettingVhookPathButton_actionPerformed(e);
1541 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1543 private MainFrame adaptee;
1545 MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1546 this.adaptee = adaptee;
1549 public void actionPerformed(ActionEvent e) {
1550 adaptee.SettingFFmpegPathButton_actionPerformed(e);
1554 class MainFrame_DoButton_actionAdapter implements ActionListener {
1556 private MainFrame adaptee;
1558 MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1559 this.adaptee = adaptee;
1562 public void actionPerformed(ActionEvent e) {
1563 adaptee.DoButton_actionPerformed(e);
1567 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1571 MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1572 this.adaptee = adaptee;
1575 public void actionPerformed(ActionEvent actionEvent) {
1576 adaptee.jMenuFileExit_actionPerformed(actionEvent);
1580 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1584 MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1585 this.adaptee = adaptee;
1588 public void actionPerformed(ActionEvent actionEvent) {
1589 adaptee.jMenuHelpAbout_actionPerformed(actionEvent);