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;
279 GridBagConstraints gridBagConstraints57 = new GridBagConstraints();
280 gridBagConstraints57.fill = GridBagConstraints.BOTH;
281 gridBagConstraints57.gridy = 2;
282 gridBagConstraints57.weightx = 1.0;
283 gridBagConstraints57.insets = new Insets(0, 0, 5, 5);
284 gridBagConstraints57.gridx = 1;
285 GridBagConstraints gridBagConstraints56 = new GridBagConstraints();
286 gridBagConstraints56.gridx = 0;
287 gridBagConstraints56.insets = new Insets(0, 5, 5, 5);
288 gridBagConstraints56.anchor = GridBagConstraints.WEST;
289 gridBagConstraints56.gridy = 2;
290 ExtOptionLabel = new JLabel();
291 ExtOptionLabel.setText("出力動画の拡張子");
292 GridBagConstraints gridBagConstraints55 = new GridBagConstraints();
293 gridBagConstraints55.gridx = 0;
294 gridBagConstraints55.fill = GridBagConstraints.HORIZONTAL;
295 gridBagConstraints55.weightx = 1.0;
296 gridBagConstraints55.gridwidth = 2;
297 gridBagConstraints55.gridy = 1;
298 GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2,
299 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
300 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
301 gridBagConstraints54.gridwidth = 3;
302 GridBagConstraints gridBagConstraints53 = new GridBagConstraints(1, 3,
303 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
304 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
305 gridBagConstraints53.gridy = 5;
306 gridBagConstraints53.gridheight = 1;
307 gridBagConstraints53.weightx = 1.0;
308 gridBagConstraints53.gridwidth = 1;
309 GridBagConstraints gridBagConstraints52 = new GridBagConstraints(2, 2,
310 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
311 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
312 gridBagConstraints52.gridy = 4;
313 gridBagConstraints52.gridwidth = 1;
314 gridBagConstraints52.weightx = 1.0;
315 gridBagConstraints52.gridx = 1;
316 GridBagConstraints gridBagConstraints51 = new GridBagConstraints(2, 1,
317 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
318 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
319 gridBagConstraints51.gridy = 3;
320 gridBagConstraints51.gridwidth = 1;
321 gridBagConstraints51.weightx = 1.0;
322 gridBagConstraints51.gridx = 1;
323 GridBagConstraints gridBagConstraints50 = new GridBagConstraints(0, 3,
324 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
325 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
326 gridBagConstraints50.gridy = 5;
327 GridBagConstraints gridBagConstraints49 = new GridBagConstraints(0, 2,
328 2, 1, 0.0, 0.0, GridBagConstraints.WEST,
329 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
330 gridBagConstraints49.gridy = 4;
331 gridBagConstraints49.gridwidth = 1;
332 GridBagConstraints gridBagConstraints48 = new GridBagConstraints(0, 1,
333 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
334 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
335 gridBagConstraints48.gridy = 3;
337 GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
338 gridBagConstraints33.gridx = 0;
339 gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
340 gridBagConstraints33.weightx = 1.0;
341 gridBagConstraints33.insets = new Insets(0, 5, 5, 5);
342 gridBagConstraints33.gridwidth = 5;
343 gridBagConstraints33.gridy = 9;
345 GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
346 gridBagConstraints14.gridx = 0;
347 gridBagConstraints14.anchor = GridBagConstraints.WEST;
348 gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
349 gridBagConstraints14.weightx = 1.0;
350 gridBagConstraints14.gridwidth = 5;
351 gridBagConstraints14.insets = new Insets(0, 5, 0, 5);
352 gridBagConstraints14.gridy = 8;
353 GridBagConstraints gridBagConstraints7 = new GridBagConstraints(0, 0,
354 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
355 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
356 gridBagConstraints7.weighty = 0.0;
357 GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
358 gridBagConstraints6.gridx = 0;
359 gridBagConstraints6.weighty = 1.0;
360 gridBagConstraints6.weightx = 1.0;
361 gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
362 gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
363 gridBagConstraints6.anchor = GridBagConstraints.NORTH;
364 gridBagConstraints6.gridy = 1;
365 GridBagConstraints gridBagConstraints1 = new GridBagConstraints(0, 1,
366 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
367 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
368 gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
369 gridBagConstraints1.anchor = GridBagConstraints.NORTH;
370 gridBagConstraints1.weighty = 1.0;
371 this.setIconImage(WinIcon);
372 contentPane = (JPanel) this.getContentPane();
373 contentPane.setLayout(borderLayout1);
374 setSize(new Dimension(400, 450));
375 setTitle(PRODUCT_NAME + " " + VERSION);
376 this.addWindowListener(new MainFrame_this_windowAdapter(this));
377 statusBar.setText(" ");
378 jMenuFile.setText("ファイル");
379 jMenuFileExit.setText("終了");
380 jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter(
382 jMenuHelp.setText("ヘルプ");
383 jMenuHelpAbout.setText("バージョン情報");
384 jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
386 VideoInfoPanel.setLayout(gridBagLayout1);
387 VideoID_TextField.setText("http://www.nicovideo.jp/watch/");
388 DoButton.setText(DoButtonDefString);
389 DoButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
390 SavingInfoTabPanel.setLayout(new GridLayout());
391 UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定"));
392 UserInfoPanel.setLayout(gridBagLayout3);
393 mailAddressLabel.setText("メールアドレス");
394 passwordLabel.setText("パスワード");
396 setListenerToSavePanelButton();
398 FFMpegTabPanel.setLayout(gridBagLayout6);
399 PathSettingPanel.setBorder(BorderFactory.createTitledBorder(
400 BorderFactory.createEtchedBorder(), "プログラムの位置の設定"));
401 PathSettingPanel.setLayout(gridBagLayout7);
402 FFmpegPathLabel.setText("FFmpeg");
403 SettingFFmpegPathButton.setText("参照");
404 SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter(
406 VhookPathLabel.setText("拡張vhookライブラリ");
407 SettingVhookPathButton.setText("参照");
408 SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter(
410 VhookSettingPanel.setLayout(gridBagLayout8);
411 VhookSettingPanel.setBorder(BorderFactory.createTitledBorder(
412 BorderFactory.createEtchedBorder(), "拡張vhookライブラリの設定"));
413 FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder(
414 BorderFactory.createEtchedBorder(), "FFmpegの設定"));
415 FFmpegSettingPanel.setLayout(gridBagLayout9);
416 FontPathLabel.setText("フォントパス");
417 SettingFontPathButton.setText("参照");
418 SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter(
420 showConvVideoCheckBox.setText("変換中の画像を表示する");
421 inputOptionLabel.setText("入力オプション");
422 outputOptionLabel.setText("出力オプション");
423 mainOptionLabel.setText("メインオプション");
424 FontIndexLabel.setText("フォント番号");
425 VideoID_Label.setText("URL/ID");
426 WayBackLabel.setText("過去ログ");
427 OpPanel.setLayout(new GridBagLayout());
429 BasicInfoTabPanel.setLayout(gridBagLayout12);
430 jMenuBar1.add(jMenuFile);
431 jMenuFile.add(jMenuFileExit);
432 jMenuBar1.add(jMenuHelp);
433 jMenuHelp.add(jMenuHelpAbout);
434 setJMenuBar(jMenuBar1);
436 contentPane.add(statusBar, BorderLayout.SOUTH);
437 contentPane.add(mainTabbedPane, java.awt.BorderLayout.CENTER);
438 contentPane.add(VideoInfoPanel, java.awt.BorderLayout.NORTH);
439 UserInfoPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1,
440 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
441 new Insets(0, 5, 5, 5), 0, 0));
442 UserInfoPanel.add(mailAddressField, new GridBagConstraints(1, 0, 1, 1,
443 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
444 new Insets(0, 5, 5, 5), 0, 0));
445 UserInfoPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1,
446 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
447 new Insets(0, 5, 5, 0), 0, 0));
448 UserInfoPanel.add(mailAddressLabel, new GridBagConstraints(0, 0, 1, 1,
449 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
450 new Insets(0, 5, 5, 0), 0, 0));
451 PathSettingPanel.add(ffmpegPathField, new GridBagConstraints(0, 1, 1,
452 1, 1.0, 0.0, GridBagConstraints.CENTER,
453 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
454 PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74);
455 PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2,
456 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
457 new Insets(0, 5, 5, 5), 0, 0));
458 PathSettingPanel.add(vhookPathField, new GridBagConstraints(0, 3, 1, 1,
459 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
460 new Insets(0, 5, 5, 5), 0, 0));
461 PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1,
462 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
463 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
464 PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
465 FFmpegSettingPanel.add(outputOptionField, gridBagConstraints53);
466 FFmpegSettingPanel.add(inputOptionField, gridBagConstraints52);
467 FFmpegSettingPanel.add(mainOptionField, gridBagConstraints51);
468 FFmpegSettingPanel.add(mainOptionLabel, gridBagConstraints48);
469 FFmpegSettingPanel.add(inputOptionLabel, gridBagConstraints49);
470 FFmpegSettingPanel.add(outputOptionLabel, gridBagConstraints50);
471 FFmpegSettingPanel.add(getFFmpegOptionComboBoxPanel(),
472 gridBagConstraints55);
473 FFmpegSettingPanel.add(ExtOptionLabel, gridBagConstraints56);
474 FFmpegSettingPanel.add(getExtOptionField(), gridBagConstraints57);
475 VideoInfoPanel.add(DoButton, gridBagConstraints71);
476 VideoInfoPanel.add(OpPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
477 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
478 new Insets(0, 0, 0, 0), 0, 0));
479 OpPanel.add(VideoID_Label, gridBagConstraints67);
480 OpPanel.add(VideoID_TextField, gridBagConstraints68);
481 OpPanel.add(WayBackLabel, gridBagConstraints69);
482 OpPanel.add(WayBackField, gridBagConstraints70);
484 mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
485 mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
486 mainTabbedPane.add(FFMpegTabPanel, "動画設定");
487 mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null);
488 SavingInfoTabPanel.add(savePanel);
489 BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
490 BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
491 VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
492 VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63);
493 VhookSettingPanel.add(fontPathField, gridBagConstraints60);
494 VhookSettingPanel.add(fontIndexField, gridBagConstraints62);
495 VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
496 VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
497 VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
498 VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
499 VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
500 VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
501 VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
502 VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
503 VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
505 FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
506 1.0, 0.0, GridBagConstraints.NORTHEAST,
507 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
508 FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
512 * 保存設定パネル内のボタンにアクションリスナを割り当てる.
514 private void setListenerToSavePanelButton() {
516 al = new InputVideoPanelButtonListener();
517 videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
518 videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
519 videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
521 al = new VideoUseRadioButtonListener();
522 videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
523 videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
524 videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
526 al = new InputCommentPanelButtonListener();
527 savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
528 savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
530 al = new OutputVideoPanelButtonListener();
531 savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
532 savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
535 private void setPopup() {
536 mainOptionField.addMouseListener(new PopupRightClick(
537 this.mainOptionField));
538 inputOptionField.addMouseListener(new PopupRightClick(
539 this.inputOptionField));
540 outputOptionField.addMouseListener(new PopupRightClick(
541 this.outputOptionField));
542 savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
543 savePanel.getCommentNumField()));
545 savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
546 savePanel.getCommentSavedFileField()));
547 savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
548 savePanel.getCommentSavedFolderField()));
550 savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
551 savePanel.getConvertedVideoSavedFileField()));
552 savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
553 savePanel.getConvertedVideoSavedFolderField()));
555 videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
556 videoSaveInfoPanel.getVideoSavedFileField()));
557 videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
558 videoSaveInfoPanel.getVideoSavedFolderField()));
559 videoSaveInfoPanel.getNibrFileField().addMouseListener(
560 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
562 ffmpegPathField.addMouseListener(new PopupRightClick(
563 this.ffmpegPathField));
564 vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField));
565 VideoID_TextField.addMouseListener(new PopupRightClick(
566 this.VideoID_TextField));
567 viewCommentField.addMouseListener(new PopupRightClick(
568 this.viewCommentField));
569 fontPathField.addMouseListener(new PopupRightClick(this.fontPathField));
570 mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField));
571 passwordField.addMouseListener(new PopupRightClick(this.passwordField));
572 WayBackField.addMouseListener(new PopupRightClick(this.WayBackField));
574 proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField));
575 proxyPortTextField.addMouseListener(new PopupRightClick(
576 this.proxyPortTextField));
578 fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField));
580 ngWordTextField.addMouseListener(new PopupRightClick(
581 this.ngWordTextField));
582 ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField));
585 private void setDropTarget() {
586 addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
587 addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
588 addTarget(videoSaveInfoPanel.getNibrFileField(), false);
590 addTarget(savePanel.getCommentSavedFileField(), false);
591 addTarget(savePanel.getCommentSavedFolderField(), true);
593 addTarget(savePanel.getConvertedVideoSavedFileField(), false);
594 addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
596 addTarget(ffmpegPathField, false);
597 addTarget(vhookPathField, false);
598 addTarget(fontPathField, false);
603 * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする.
604 * @param c 設定対象のテキストフィールドオブジェクト.
605 * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse.
606 * @return ドロップターゲット(用途無し).
608 private DropTarget addTarget(JTextField c, boolean isDir) {
609 return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
612 private File CurrentDir = new File(".");
613 private JPanel PathSettingPanel = new JPanel();
614 private JLabel FFmpegPathLabel = new JLabel();
615 private GridBagLayout gridBagLayout7 = new GridBagLayout();
616 private JTextField ffmpegPathField = new JTextField();
617 private JButton SettingFFmpegPathButton = new JButton();
618 private JLabel VhookPathLabel = new JLabel();
619 private JTextField vhookPathField = new JTextField();
620 private JButton SettingVhookPathButton = new JButton();
621 private JPanel VhookSettingPanel = new JPanel();
622 private GridBagLayout gridBagLayout8 = new GridBagLayout();
623 private JPanel FFmpegSettingPanel = new JPanel();
624 private GridBagLayout gridBagLayout9 = new GridBagLayout();
625 private JLabel FontPathLabel = new JLabel();
626 private JTextField fontPathField = new JTextField();
627 private JButton SettingFontPathButton = new JButton();
628 private JCheckBox showConvVideoCheckBox = new JCheckBox();
630 private void showSaveDialog(String title, JTextField field, boolean isSave,
632 JFileChooser chooser = new JFileChooser(CurrentDir);
633 chooser.setDialogTitle(title);
636 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
639 code = chooser.showSaveDialog(this);
641 code = chooser.showOpenDialog(this);
643 if (code == JFileChooser.APPROVE_OPTION) {
645 CurrentDir = chooser.getSelectedFile();
646 field.setText(CurrentDir.getAbsolutePath());
648 File selected = chooser.getSelectedFile();
649 CurrentDir = chooser.getCurrentDirectory();
650 field.setText(selected.getAbsolutePath());
655 private SProperties getSetting() {
656 SProperties setting = new SProperties(
658 getInputVideoSetting(),
659 getInputCommentSetting(),
660 getTcommentSetting(),
661 getOutputVideoSetting(),
663 getConvertSetting());
669 * @param setting 反映する設定.
671 private void setSetting(SProperties setting) {
673 final BasicSetting basic = setting.getBasicSetting();
674 tempDir = basic.getTempDir();
675 mailAddressField.setText(basic.getUser().getMail());
676 passwordField.setText(basic.getUser().getPassword());
678 useProxyCheckBox.setSelected(basic.isProxyUse());
679 proxyTextField.setText(basic.getProxyHost());
680 int proxy_port = basic.getProxyPort();
681 if (proxy_port >= 0 && proxy_port <= 65535) {
682 proxyPortTextField.setText(Integer.toString(proxy_port));
684 proxyPortTextField.setText("");
688 final InputVideoSetting inVideo = setting.getInputVideoSetting();
689 JRadioButton activeButton;
690 switch (inVideo.getProcessKind()) {
692 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
695 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
699 activeButton = videoSaveInfoPanel.getVideoSaveButton();
702 activeButton.doClick();
704 videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
705 videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
706 videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
707 final boolean videoFixName = inVideo.isAutoNaming();
708 videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
709 videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
710 videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
713 final InputCommentSetting inputComment = setting.getInputCommentSetting();
714 savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
715 savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
716 savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
717 savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
718 savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
719 savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
720 boolean commentFixName = inputComment.isAutoNaming();
721 savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
722 savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
725 InputTcommentSetting tcom = setting.getInputTcommentSetting();
726 savePanel.setTcommentDownload(tcom.getProcessKind());
727 savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
728 savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
729 savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
730 savePanel.setTcommentFileName(tcom.getFile().getPath());
733 final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
734 savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
735 savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
736 savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
737 savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
738 savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
739 savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
740 boolean convFixName = outputVideo.isAutoNaming();
741 savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
742 savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
745 final MovieSetting movie = setting.getMovieSetting();
746 ffmpegPathField.setText(movie.getFfmpeg().toString());
747 vhookPathField.setText(movie.getVhook().toString());
748 extOptionField.setText(movie.getFfmpegOption().getExtOption());
749 mainOptionField.setText(movie.getFfmpegOption().getMainOption());
750 outputOptionField.setText(movie.getFfmpegOption().getOutOption());
751 inputOptionField.setText(movie.getFfmpegOption().getInOption());
752 FFmpegOptionModel.reload(movie.getOptionFile());
755 final ConvertSetting conv = setting.getConvertSetting();
756 disableVhookCheckBox.setSelected(conv.isVhookDisabled());
757 viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
758 fontPathField.setText(conv.getFont().toString());
759 fontIndexField.setText(Integer.toString(conv.getFontIndex()));
760 shadowComboBox.setSelectedIndex(conv.getShadowIndex());
761 showConvVideoCheckBox.setSelected(conv.isShowConverting());
762 fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
763 opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
764 ngWordTextField.setText(conv.getNgSetting().getWord());
765 ngIdTextField.setText(conv.getNgSetting().getId());
769 * [ファイル|終了] アクションが実行されました。
774 void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
775 SProperties setting = getSetting();
776 SProperties.saveSetting(setting);
781 * [ヘルプ|バージョン情報] アクションが実行されました。
786 void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
787 MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
789 dlg.setLocationRelativeTo(this);
790 dlg.setVisible(true);
794 private Converter Converter = null;
795 private JLabel inputOptionLabel = new JLabel();
796 private JTextField inputOptionField = new JTextField();
797 private JLabel outputOptionLabel = new JLabel();
798 private JTextField outputOptionField = new JTextField();
799 private JLabel mainOptionLabel = new JLabel();
800 private JTextField mainOptionField = new JTextField();
801 private JLabel FontIndexLabel = new JLabel();
802 private JTextField fontIndexField = new JTextField();
803 private JLabel VideoID_Label = new JLabel();
804 private JLabel WayBackLabel = new JLabel();
805 private JTextField WayBackField = new JTextField();
806 private GridBagLayout gridBagLayout1 = new GridBagLayout();
807 private JPanel OpPanel = new JPanel();
808 private JPanel BasicInfoTabPanel = new JPanel();
809 private GridBagLayout gridBagLayout12 = new GridBagLayout();
810 private JPanel ConvertingSettingPanel = null;
811 private JPanel NGWordSettingPanel = null;
812 private JLabel NGWordLavel = null;
813 private JTextField ngWordTextField = null;
814 private JLabel NGIDLabel = null;
815 private JTextField ngIdTextField = null;
817 private JPanel ProxyInfoPanel = null;
818 private JCheckBox useProxyCheckBox = null;
819 private JLabel proxyLabel = null;
820 private JTextField proxyTextField = null;
821 private JLabel proxyPortLabel = null;
822 private JTextField proxyPortTextField = null;
824 private JCheckBox fixFontSizeCheckBox = null;
825 private JCheckBox opaqueCommentCheckBox = null;
826 private final SavePanel savePanel = new SavePanel();
827 private final VideoSaveInfoPanel videoSaveInfoPanel;
828 private JComboBox FFmpegOptionComboBox = null;
829 private JButton FFmpegOptionReloadButton = null;
830 private JPanel FFmpegOptionComboBoxPanel = null;
832 public void DoButton_actionPerformed(ActionEvent e) {
833 if (Converter == null || Converter.isConverted()) {
836 } catch (Exception ex) {
837 String text = ex.getMessage();
838 if (StringUtils.isEmpty(text)) {
839 text = "予期しないエラーのため中断しました。";
841 ex.printStackTrace();
842 statusBar.setText(text);
844 } else { /* 開始しているので、ストップする。 */
845 final ConvertStopFlag flag = Converter.getStopFlag();
846 if (!flag.needStop()) { /* まだストップしていない。 */
852 private void executeConvert() throws IOException {
855 // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
856 if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
858 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
859 NicoDBFinder finder = NicoDBFinder.getInstance();
860 NicoContent info = finder.findNicoContent(fileName);
862 url = info.getNicoId();
866 } catch (Exception ex) {
867 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
871 url = VideoID_TextField.getText();
874 TextProgressListener sl = new TextProgressListener() {
876 public void setText(final String text) {
877 SwingUtilities.invokeLater(new Runnable() {
880 statusBar.setText(text);
886 ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
888 public void changeState(final State s) {
889 SwingUtilities.invokeLater(new Runnable() {
894 DoButton.setText(DoButtonWaitString);
897 DoButton.setText(DoButtonDefString);
904 Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl,
905 new ConvertStopFlag(scl));
906 DoButton.setText(DoButtonStopString);
907 new Thread(Converter).start();
912 public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
913 showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
916 public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
917 showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
920 public void SettingFontPathButton_actionPerformed(ActionEvent e) {
921 showSaveDialog("フォントへのパス", fontPathField, false, false);
924 public void this_windowClosing(WindowEvent e) {
925 this.jMenuFileExit_actionPerformed(null);
929 * This method initializes ConvertingSettingPanel
931 * @return javax.swing.JPanel
933 private JPanel getConvertingSettingPanel() {
934 if (ConvertingSettingPanel == null) {
935 GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
936 gridBagConstraints11.weighty = 1.0;
937 gridBagConstraints11.weightx = 1.0;
938 gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
939 gridBagConstraints11.gridy = 1;
940 gridBagConstraints11.gridx = 0;
941 gridBagConstraints11.anchor = GridBagConstraints.NORTH;
942 gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
943 GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
944 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
945 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
946 gridBagConstraints.gridx = 0;
947 gridBagConstraints.anchor = GridBagConstraints.CENTER;
948 gridBagConstraints.weighty = 0.0;
949 gridBagConstraints.gridy = 0;
950 ConvertingSettingPanel = new JPanel();
951 ConvertingSettingPanel.setLayout(new GridBagLayout());
952 ConvertingSettingPanel.add(getNGWordSettingPanel(),
953 gridBagConstraints11);
954 ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
956 return ConvertingSettingPanel;
960 * This method initializes NGWordSettingPanel
962 * @return javax.swing.JPanel
964 private JPanel getNGWordSettingPanel() {
965 if (NGWordSettingPanel == null) {
966 GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
967 gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
968 gridBagConstraints5.gridy = 1;
969 gridBagConstraints5.weightx = 1.0;
970 gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
971 gridBagConstraints5.gridx = 1;
972 GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
973 gridBagConstraints4.gridx = 0;
974 gridBagConstraints4.anchor = GridBagConstraints.WEST;
975 gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
976 gridBagConstraints4.gridy = 1;
977 NGIDLabel = new JLabel();
978 NGIDLabel.setText("NG ID");
979 GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
980 gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
981 gridBagConstraints3.gridy = 0;
982 gridBagConstraints3.weightx = 1.0;
983 gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
984 gridBagConstraints3.gridx = 1;
985 GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
986 gridBagConstraints2.gridx = 0;
987 gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
988 gridBagConstraints2.gridy = 0;
989 NGWordLavel = new JLabel();
990 NGWordLavel.setText("NGワード");
991 NGWordSettingPanel = new JPanel();
992 NGWordSettingPanel.setLayout(new GridBagLayout());
993 NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
995 NGWordSettingPanel.add(NGWordLavel, gridBagConstraints2);
996 NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
997 NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
998 NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
1000 return NGWordSettingPanel;
1004 * This method initializes NGWordTextField
1006 * @return javax.swing.JTextField
1008 private JTextField getNGWordTextField() {
1009 if (ngWordTextField == null) {
1010 ngWordTextField = new JTextField();
1011 ngWordTextField.setName("ngWordTextField");
1013 return ngWordTextField;
1017 * This method initializes NGIDTextField
1019 * @return javax.swing.JTextField
1021 private JTextField getNGIDTextField() {
1022 if (ngIdTextField == null) {
1023 ngIdTextField = new JTextField();
1024 ngIdTextField.setName("ngIdTextField");
1026 return ngIdTextField;
1030 * This method initializes ProxyInfoPanel
1032 * @return javax.swing.JPanel
1034 private JPanel getProxyInfoPanel() {
1035 if (ProxyInfoPanel == null) {
1036 GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1037 gridBagConstraints13.gridx = 0;
1038 gridBagConstraints13.gridwidth = 2;
1039 gridBagConstraints13.weightx = 1.0;
1040 gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1041 gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1042 gridBagConstraints13.gridy = 0;
1043 GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1044 gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1045 gridBagConstraints12.gridy = 2;
1046 gridBagConstraints12.weightx = 1.0;
1047 gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1048 gridBagConstraints12.gridx = 1;
1049 GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1050 gridBagConstraints10.gridx = 0;
1051 gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1052 gridBagConstraints10.gridy = 2;
1053 proxyPortLabel = new JLabel();
1054 proxyPortLabel.setText("ポート番号");
1055 GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1056 gridBagConstraints9.fill = GridBagConstraints.BOTH;
1057 gridBagConstraints9.gridy = 1;
1058 gridBagConstraints9.weightx = 1.0;
1059 gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1060 gridBagConstraints9.gridx = 1;
1061 GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1062 gridBagConstraints8.gridx = 0;
1063 gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1064 gridBagConstraints8.fill = GridBagConstraints.NONE;
1065 gridBagConstraints8.anchor = GridBagConstraints.EAST;
1066 gridBagConstraints8.gridy = 1;
1067 proxyLabel = new JLabel();
1068 proxyLabel.setText("プロキシ");
1069 ProxyInfoPanel = new JPanel();
1070 ProxyInfoPanel.setLayout(new GridBagLayout());
1071 ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1073 ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1074 ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1075 ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1076 ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1077 ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1079 return ProxyInfoPanel;
1083 * This method initializes ProxyTextField
1085 * @return javax.swing.JTextField
1087 private JTextField getProxyTextField() {
1088 if (proxyTextField == null) {
1089 proxyTextField = new JTextField();
1090 proxyTextField.setName("proxyTextField");
1092 return proxyTextField;
1096 * This method initializes ProxyPortTextField
1098 * @return javax.swing.JTextField
1100 private JTextField getProxyPortTextField() {
1101 if (proxyPortTextField == null) {
1102 proxyPortTextField = new JTextField();
1103 proxyPortTextField.setName("proxyPortTextField");
1105 return proxyPortTextField;
1109 * This method initializes UseProxyCheckBox
1111 * @return javax.swing.JCheckBox
1113 private JCheckBox getUseProxyCheckBox() {
1114 if (useProxyCheckBox == null) {
1115 useProxyCheckBox = new JCheckBox();
1116 useProxyCheckBox.setText("プロキシを使う");
1117 useProxyCheckBox.setName("useProxyCheckBox");
1119 return useProxyCheckBox;
1123 * This method initializes FixFontSizeCheckBox
1125 * @return javax.swing.JCheckBox
1127 private JCheckBox getFixFontSizeCheckBox() {
1128 if (fixFontSizeCheckBox == null) {
1129 fixFontSizeCheckBox = new JCheckBox();
1130 fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1131 fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1133 return fixFontSizeCheckBox;
1137 * This method initializes OpaqueCommentCheckBox
1139 * @return javax.swing.JCheckBox
1141 private JCheckBox getOpaqueCommentCheckBox() {
1142 if (opaqueCommentCheckBox == null) {
1143 opaqueCommentCheckBox = new JCheckBox();
1144 opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1145 opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1147 return opaqueCommentCheckBox;
1150 * This method initializes FFmpegOptionComboBox
1152 * @return javax.swing.JComboBox
1154 private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1155 private JLabel ExtOptionLabel = null;
1156 private JTextField extOptionField = null;
1157 private JCheckBox disableVhookCheckBox = null;
1158 private JTextField viewCommentField = null;
1159 private JLabel ViewCommentLabel = null;
1160 private JLabel ShadowKindLabel = null;
1161 private JComboBox shadowComboBox = null;
1163 private JComboBox getFFmpegOptionComboBox() {
1164 if (FFmpegOptionComboBox == null) {
1165 FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1166 FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1168 public void actionPerformed(java.awt.event.ActionEvent e) {
1169 if (FFmpegOptionModel.isFile()) {// ファイル
1170 extOptionField.setEnabled(false);
1171 mainOptionField.setEnabled(false);
1172 inputOptionField.setEnabled(false);
1173 outputOptionField.setEnabled(false);
1175 extOptionField.setEnabled(true);
1176 mainOptionField.setEnabled(true);
1177 inputOptionField.setEnabled(true);
1178 outputOptionField.setEnabled(true);
1183 return FFmpegOptionComboBox;
1187 * This method initializes FFmpegOptionReloadButton
1189 * @return javax.swing.JButton
1191 private JButton getFFmpegOptionReloadButton() {
1192 if (FFmpegOptionReloadButton == null) {
1193 FFmpegOptionReloadButton = new JButton();
1194 FFmpegOptionReloadButton.setText("更新");
1195 FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1197 public void actionPerformed(java.awt.event.ActionEvent e) {
1198 FFmpegOptionModel.reload();
1202 return FFmpegOptionReloadButton;
1206 * This method initializes FFmpegOptionComboBoxPanel
1208 * @return javax.swing.JPanel
1210 private JPanel getFFmpegOptionComboBoxPanel() {
1211 if (FFmpegOptionComboBoxPanel == null) {
1212 GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1213 gridBagConstraints47.fill = GridBagConstraints.BOTH;
1214 gridBagConstraints47.gridx = -1;
1215 gridBagConstraints47.gridy = -1;
1216 gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1217 GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1218 gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1219 gridBagConstraints46.gridwidth = 3;
1220 gridBagConstraints46.gridx = -1;
1221 gridBagConstraints46.gridy = -1;
1222 gridBagConstraints46.weightx = 1.0;
1223 gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1224 FFmpegOptionComboBoxPanel = new JPanel();
1225 FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1226 FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1227 gridBagConstraints46);
1228 FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1229 gridBagConstraints47);
1231 return FFmpegOptionComboBoxPanel;
1235 * This method initializes ExtOptionField
1237 * @return javax.swing.JTextField
1239 private JTextField getExtOptionField() {
1240 if (extOptionField == null) {
1241 extOptionField = new JTextField();
1242 extOptionField.setName("extOptionField");
1244 return extOptionField;
1248 * This method initializes NotUseVhookCheckBox
1250 * @return javax.swing.JCheckBox
1252 private JCheckBox getNotUseVhookCheckBox() {
1253 if (disableVhookCheckBox == null) {
1254 disableVhookCheckBox = new JCheckBox();
1255 disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1256 disableVhookCheckBox.setName("disableVhookCheckBox");
1258 return disableVhookCheckBox;
1262 * This method initializes ViewCommentField
1264 * @return javax.swing.JTextField
1266 private JTextField getViewCommentField() {
1267 if (viewCommentField == null) {
1268 viewCommentField = new JTextField();
1269 viewCommentField.setName("viewCommentField");
1271 return viewCommentField;
1275 * This method initializes ShadowComboBox
1277 * @return javax.swing.JComboBox
1279 private JComboBox getShadowComboBox() {
1280 if (shadowComboBox == null) {
1281 shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1282 shadowComboBox.setName("shadowComboBox");
1284 return shadowComboBox;
1287 private BasicSetting getBasicSetting() {
1288 String mail = mailAddressField.getText();
1289 String pass = String.valueOf(passwordField.getPassword());
1290 boolean proxyUse = useProxyCheckBox.isSelected();
1291 String proxyHost = proxyTextField.getText();
1294 proxyPort = Integer.parseInt(proxyPortTextField.getText());
1295 } catch (NumberFormatException e) {
1298 // TODO 作業用ディレクトリの設定GUI無し
1299 return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1302 private InputVideoSetting getInputVideoSetting() {
1304 if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1305 kind = VideoSaveKind.NO_SAVE;
1306 } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1307 kind = VideoSaveKind.NICOBROWSER;
1309 kind = VideoSaveKind.SAVE;
1311 boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1312 String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1313 String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1314 boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1315 String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1317 return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1320 private InputCommentSetting getInputCommentSetting() {
1321 boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1322 String file = savePanel.getCommentSavedFileField().getText();
1325 back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1326 } catch (NumberFormatException ex) {
1329 boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1330 boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1331 String folder = savePanel.getCommentSavedFolderField().getText();
1332 boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1334 return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1339 * 画面入力値から投稿者コメント設定を作成する.
1340 * @return 作成した投稿者コメント設定.
1342 private InputTcommentSetting getTcommentSetting() {
1343 boolean down = savePanel.isTcommentDownload();
1344 boolean del = savePanel.isTcommentDelete();
1345 boolean naming = savePanel.isTcommentAutoFileName();
1346 String dir = savePanel.getTcommentDirectoryName();
1347 String f = savePanel.getTcommentFileName();
1348 return new InputTcommentSetting(down, naming, dir, f, del);
1351 private OutputVideoSetting getOutputVideoSetting() {
1352 boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1353 boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1354 boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1355 String file = savePanel.getConvertedVideoSavedFileField().getText();
1356 boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1357 boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1358 String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1360 return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1364 private MovieSetting getMovieSetting() {
1365 String ffmpeg = ffmpegPathField.getText();
1366 String vhook = vhookPathField.getText();
1367 String ext = extOptionField.getText();
1368 String main = mainOptionField.getText();
1369 String in = inputOptionField.getText();
1370 String out = outputOptionField.getText();
1371 File optionFile = FFmpegOptionModel.getSelectedFile();
1373 FfmpegOption opt = new FfmpegOption(ext, main, in, out);
1374 return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1377 private ConvertSetting getConvertSetting() {
1378 boolean vhookDisabled = disableVhookCheckBox.isSelected();
1379 int maxComment = 30;
1381 maxComment = Integer.parseInt(viewCommentField.getText());
1382 } catch (NumberFormatException ex) {
1384 File font = new File(fontPathField.getText());
1385 int fontIndex = Integer.parseInt(fontIndexField.getText());
1386 int shadowIndex = shadowComboBox.getSelectedIndex();
1387 boolean showConv = showConvVideoCheckBox.isSelected();
1388 boolean adjustFont = fixFontSizeCheckBox.isSelected();
1389 boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1390 NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1392 return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1393 commentOpaque, ngSetting);
1396 private class InputVideoPanelButtonListener implements ActionListener {
1398 public void actionPerformed(ActionEvent e) {
1399 final Object source = e.getSource();
1400 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1406 if (source == panel.getShowSavingVideoFolderDialogButton()) {
1407 title = "動画の保存先(フォルダ)";
1408 field = panel.getVideoSavedFolderField();
1411 } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1412 title = "動画の保存先(ファイル)";
1413 field = panel.getVideoSavedFileField();
1416 } else if (source == panel.getNibrFileChooserButton()) {
1417 title = "NicoBrowserファイル選択";
1418 field = panel.getNibrFileField();
1424 showSaveDialog(title, field, isSave, isDir);
1428 private class InputCommentPanelButtonListener implements ActionListener {
1430 public void actionPerformed(ActionEvent e) {
1431 final Object source = e.getSource();
1436 if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1437 title = "コメントの保存先(フォルダ)";
1438 field = savePanel.getCommentSavedFolderField();
1441 } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1442 title = "コメントの保存先(ファイル)";
1443 field = savePanel.getCommentSavedFileField();
1449 showSaveDialog(title, field, isSave, isDir);
1453 private class OutputVideoPanelButtonListener implements ActionListener {
1455 public void actionPerformed(ActionEvent e) {
1456 final Object source = e.getSource();
1461 if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1462 title = "コメント付き動画の保存先(フォルダ)";
1463 field = savePanel.getConvertedVideoSavedFolderField();
1466 } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1467 title = "コメント付き動画の保存先(ファイル)";
1468 field = savePanel.getConvertedVideoSavedFileField();
1474 showSaveDialog(title, field, isSave, isDir);
1478 private class VideoUseRadioButtonListener implements ActionListener {
1480 public void actionPerformed(ActionEvent e) {
1481 Object source = e.getSource();
1482 if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1489 private void maskBase() {
1493 private void maskExt() {
1497 private void mask(boolean b) {
1498 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1499 VideoID_TextField.setEditable(b);
1500 panel.getDelVideoCheckBox().setEnabled(b);
1502 panel.getSaveFolderRadioButton().setEnabled(b);
1503 panel.getVideoSavedFolderField().setEnabled(b);
1504 panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1506 panel.getSaveFileRadioButton().setEnabled(b);
1507 panel.getVideoSavedFileField().setEnabled(b);
1508 panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1510 panel.getNibrFileField().setEnabled(!b);
1511 panel.getNibrFileChooserButton().setEnabled(!b);
1516 class MainFrame_this_windowAdapter extends WindowAdapter {
1518 private MainFrame adaptee;
1520 MainFrame_this_windowAdapter(MainFrame adaptee) {
1521 this.adaptee = adaptee;
1525 public void windowClosing(WindowEvent e) {
1526 adaptee.this_windowClosing(e);
1530 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1532 private MainFrame adaptee;
1534 MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1535 this.adaptee = adaptee;
1538 public void actionPerformed(ActionEvent e) {
1539 adaptee.SettingFontPathButton_actionPerformed(e);
1543 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1545 private MainFrame adaptee;
1547 MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1548 this.adaptee = adaptee;
1551 public void actionPerformed(ActionEvent e) {
1552 adaptee.SettingVhookPathButton_actionPerformed(e);
1556 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1558 private MainFrame adaptee;
1560 MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1561 this.adaptee = adaptee;
1564 public void actionPerformed(ActionEvent e) {
1565 adaptee.SettingFFmpegPathButton_actionPerformed(e);
1569 class MainFrame_DoButton_actionAdapter implements ActionListener {
1571 private MainFrame adaptee;
1573 MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1574 this.adaptee = adaptee;
1577 public void actionPerformed(ActionEvent e) {
1578 adaptee.DoButton_actionPerformed(e);
1582 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1586 MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1587 this.adaptee = adaptee;
1590 public void actionPerformed(ActionEvent actionEvent) {
1591 adaptee.jMenuFileExit_actionPerformed(actionEvent);
1595 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1599 MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1600 this.adaptee = adaptee;
1603 public void actionPerformed(ActionEvent actionEvent) {
1604 adaptee.jMenuHelpAbout_actionPerformed(actionEvent);