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 VERSION = "1.22r NicoBrowser拡張 1.4.4";
81 public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource(
83 // TODO GUIが無いためフィールドに保持.
86 BorderLayout borderLayout1 = new BorderLayout();
87 JMenuBar jMenuBar1 = new JMenuBar();
88 JMenu jMenuFile = new JMenu();
89 JMenuItem jMenuFileExit = new JMenuItem();
90 JMenu jMenuHelp = new JMenu();
91 JMenuItem jMenuHelpAbout = new JMenuItem();
92 JLabel statusBar = new JLabel();
93 JTabbedPane mainTabbedPane = new JTabbedPane();
94 JPanel SavingInfoTabPanel = new JPanel();
95 JPanel FFMpegTabPanel = new JPanel();
96 JPanel VideoInfoPanel = new JPanel();
97 JTextField VideoID_TextField = new JTextField();
98 JButton DoButton = new JButton();
99 public static final String DoButtonDefString = "変換";
100 public static final String DoButtonStopString = "停止";
101 public static final String DoButtonWaitString = "待機";
102 JPanel UserInfoPanel = new JPanel();
103 GridBagLayout gridBagLayout3 = new GridBagLayout();
105 JLabel mailAddressLabel = new JLabel();
106 JTextField mailAddressField = new JTextField();
107 JLabel passwordLabel = new JLabel();
108 JPasswordField passwordField = new JPasswordField();
109 GridBagLayout gridBagLayout4 = new GridBagLayout();
110 GridBagLayout gridBagLayout6 = new GridBagLayout();
111 ButtonGroup CommentSaveButtonGroup = new ButtonGroup();
112 ButtonGroup ConvSaveButtonGroup = new ButtonGroup();
114 private void setNames() {
115 mainTabbedPane.setName("mainTabbedPane");
117 mailAddressField.setName("mailAddressField");
118 passwordField.setName("passwordField");
120 ffmpegPathField.setName("ffmpegPathField");
121 vhookPathField.setName("vhookPathField");
123 mainOptionField.setName("mainOptionField");
124 inputOptionField.setName("inputOptionField");
125 outputOptionField.setName("outputOptionField");
127 fontPathField.setName("fontPathField");
128 fontIndexField.setName("fontIndexField");
129 showConvVideoCheckBox.setName("showConvVideoCheckBox");
135 videoSaveInfoPanel = savePanel.getVideoSaveInfoPanel();
138 setDefaultCloseOperation(EXIT_ON_CLOSE);
142 SProperties setting = SProperties.loadSetting(null,
144 this.setSetting(setting);
145 } catch (Exception exception) {
146 exception.printStackTrace();
153 * @throws java.lang.Exception
155 private void jbInit() throws Exception {
156 GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
157 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
158 gridBagConstraints74.gridwidth = 2;
159 GridBagConstraints gridBagConstraints73 = new GridBagConstraints();
160 gridBagConstraints73.fill = GridBagConstraints.HORIZONTAL;
161 gridBagConstraints73.gridy = 6;
162 gridBagConstraints73.weightx = 1.0;
163 gridBagConstraints73.gridwidth = 4;
164 gridBagConstraints73.insets = new Insets(0, 0, 0, 5);
165 gridBagConstraints73.gridx = 1;
166 GridBagConstraints gridBagConstraints72 = new GridBagConstraints();
167 gridBagConstraints72.gridx = 0;
168 gridBagConstraints72.anchor = GridBagConstraints.WEST;
169 gridBagConstraints72.insets = new Insets(0, 5, 0, 5);
170 gridBagConstraints72.fill = GridBagConstraints.NONE;
171 gridBagConstraints72.gridwidth = 1;
172 gridBagConstraints72.gridy = 6;
173 ShadowKindLabel = new JLabel();
174 ShadowKindLabel.setText("影の種類");
175 ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
176 GridBagConstraints gridBagConstraints71 = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
177 GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 6);
178 gridBagConstraints71.fill = GridBagConstraints.BOTH;
179 gridBagConstraints71.ipady = 0;
180 GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
181 gridBagConstraints70.fill = GridBagConstraints.HORIZONTAL;
182 gridBagConstraints70.gridy = 1;
183 gridBagConstraints70.ipadx = 0;
184 gridBagConstraints70.ipady = 0;
185 gridBagConstraints70.weightx = 1.0;
186 gridBagConstraints70.insets = new Insets(0, 0, 0, 0);
187 gridBagConstraints70.gridx = 1;
188 GridBagConstraints gridBagConstraints69 = new GridBagConstraints();
189 gridBagConstraints69.gridx = 0;
190 gridBagConstraints69.ipadx = 0;
191 gridBagConstraints69.ipady = 0;
192 gridBagConstraints69.insets = new Insets(0, 5, 0, 5);
193 gridBagConstraints69.anchor = GridBagConstraints.WEST;
194 gridBagConstraints69.gridy = 1;
195 GridBagConstraints gridBagConstraints68 = new GridBagConstraints();
196 gridBagConstraints68.fill = GridBagConstraints.BOTH;
197 gridBagConstraints68.gridy = 0;
198 gridBagConstraints68.ipady = 0;
199 gridBagConstraints68.weightx = 1.0;
200 gridBagConstraints68.insets = new Insets(0, 0, 0, 0);
201 gridBagConstraints68.gridx = 1;
202 GridBagConstraints gridBagConstraints67 = new GridBagConstraints();
203 gridBagConstraints67.gridx = 0;
204 gridBagConstraints67.ipadx = 0;
205 gridBagConstraints67.ipady = 0;
206 gridBagConstraints67.insets = new Insets(0, 5, 0, 5);
207 gridBagConstraints67.anchor = GridBagConstraints.WEST;
208 gridBagConstraints67.gridy = 0;
209 GridBagConstraints gridBagConstraints66 = new GridBagConstraints();
210 gridBagConstraints66.gridx = 0;
211 gridBagConstraints66.insets = new Insets(0, 5, 5, 5);
212 gridBagConstraints66.anchor = GridBagConstraints.WEST;
213 gridBagConstraints66.gridwidth = 2;
214 gridBagConstraints66.gridy = 1;
215 ViewCommentLabel = new JLabel();
216 ViewCommentLabel.setText("表示コメント数");
217 GridBagConstraints gridBagConstraints65 = new GridBagConstraints();
218 gridBagConstraints65.fill = GridBagConstraints.HORIZONTAL;
219 gridBagConstraints65.gridy = 1;
220 gridBagConstraints65.weightx = 1.0;
221 gridBagConstraints65.gridwidth = 6;
222 gridBagConstraints65.insets = new Insets(0, 5, 5, 5);
223 gridBagConstraints65.gridx = 3;
224 GridBagConstraints gridBagConstraints64 = new GridBagConstraints(1, 1,
225 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
226 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
227 gridBagConstraints64.gridy = 3;
228 gridBagConstraints64.fill = GridBagConstraints.HORIZONTAL;
229 gridBagConstraints64.gridx = 4;
230 GridBagConstraints gridBagConstraints63 = new GridBagConstraints(0, 4,
231 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
232 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
233 gridBagConstraints63.gridy = 7;
234 gridBagConstraints63.gridx = 0;
235 gridBagConstraints63.gridwidth = 5;
236 GridBagConstraints gridBagConstraints62 = new GridBagConstraints(0, 3,
237 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
238 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
239 gridBagConstraints62.gridy = 5;
240 gridBagConstraints62.gridx = 1;
241 gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL;
242 gridBagConstraints62.insets = new Insets(0, 0, 5, 5);
243 gridBagConstraints62.gridwidth = 4;
244 GridBagConstraints gridBagConstraints61 = new GridBagConstraints(0, 2,
245 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
246 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
247 gridBagConstraints61.gridy = 5;
248 gridBagConstraints61.gridx = 0;
249 gridBagConstraints61.fill = GridBagConstraints.VERTICAL;
250 gridBagConstraints61.anchor = GridBagConstraints.WEST;
251 gridBagConstraints61.gridwidth = 1;
252 GridBagConstraints gridBagConstraints60 = new GridBagConstraints(0, 1,
253 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
254 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0);
255 gridBagConstraints60.gridy = 3;
256 gridBagConstraints60.gridx = 1;
257 gridBagConstraints60.fill = GridBagConstraints.HORIZONTAL;
258 gridBagConstraints60.insets = new Insets(0, 0, 0, 5);
259 gridBagConstraints60.gridwidth = 3;
260 GridBagConstraints gridBagConstraints59 = new GridBagConstraints(0, 0,
261 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
262 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);
263 gridBagConstraints59.gridy = 3;
264 gridBagConstraints59.insets = new Insets(5, 5, 5, 5);
265 gridBagConstraints59.gridx = 0;
266 gridBagConstraints59.fill = GridBagConstraints.NONE;
267 gridBagConstraints59.anchor = GridBagConstraints.WEST;
268 gridBagConstraints59.weightx = 0.0;
269 gridBagConstraints59.gridwidth = 1;
270 GridBagConstraints gridBagConstraints58 = new GridBagConstraints();
271 gridBagConstraints58.gridx = 0;
272 gridBagConstraints58.anchor = GridBagConstraints.WEST;
273 gridBagConstraints58.insets = new Insets(0, 5, 5, 5);
274 gridBagConstraints58.gridwidth = 5;
275 gridBagConstraints58.weightx = 1.0;
276 gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL;
277 gridBagConstraints58.gridy = 0;
278 GridBagConstraints gridBagConstraints57 = new GridBagConstraints();
279 gridBagConstraints57.fill = GridBagConstraints.BOTH;
280 gridBagConstraints57.gridy = 2;
281 gridBagConstraints57.weightx = 1.0;
282 gridBagConstraints57.insets = new Insets(0, 0, 5, 5);
283 gridBagConstraints57.gridx = 1;
284 GridBagConstraints gridBagConstraints56 = new GridBagConstraints();
285 gridBagConstraints56.gridx = 0;
286 gridBagConstraints56.insets = new Insets(0, 5, 5, 5);
287 gridBagConstraints56.anchor = GridBagConstraints.WEST;
288 gridBagConstraints56.gridy = 2;
289 ExtOptionLabel = new JLabel();
290 ExtOptionLabel.setText("出力動画の拡張子");
291 GridBagConstraints gridBagConstraints55 = new GridBagConstraints();
292 gridBagConstraints55.gridx = 0;
293 gridBagConstraints55.fill = GridBagConstraints.HORIZONTAL;
294 gridBagConstraints55.weightx = 1.0;
295 gridBagConstraints55.gridwidth = 2;
296 gridBagConstraints55.gridy = 1;
297 GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2,
298 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
299 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
300 gridBagConstraints54.gridwidth = 3;
301 GridBagConstraints gridBagConstraints53 = new GridBagConstraints(1, 3,
302 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
303 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
304 gridBagConstraints53.gridy = 5;
305 gridBagConstraints53.gridheight = 1;
306 gridBagConstraints53.weightx = 1.0;
307 gridBagConstraints53.gridwidth = 1;
308 GridBagConstraints gridBagConstraints52 = new GridBagConstraints(2, 2,
309 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
310 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
311 gridBagConstraints52.gridy = 4;
312 gridBagConstraints52.gridwidth = 1;
313 gridBagConstraints52.weightx = 1.0;
314 gridBagConstraints52.gridx = 1;
315 GridBagConstraints gridBagConstraints51 = new GridBagConstraints(2, 1,
316 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
317 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
318 gridBagConstraints51.gridy = 3;
319 gridBagConstraints51.gridwidth = 1;
320 gridBagConstraints51.weightx = 1.0;
321 gridBagConstraints51.gridx = 1;
322 GridBagConstraints gridBagConstraints50 = new GridBagConstraints(0, 3,
323 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
324 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
325 gridBagConstraints50.gridy = 5;
326 GridBagConstraints gridBagConstraints49 = new GridBagConstraints(0, 2,
327 2, 1, 0.0, 0.0, GridBagConstraints.WEST,
328 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
329 gridBagConstraints49.gridy = 4;
330 gridBagConstraints49.gridwidth = 1;
331 GridBagConstraints gridBagConstraints48 = new GridBagConstraints(0, 1,
332 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
333 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
334 gridBagConstraints48.gridy = 3;
336 GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
337 gridBagConstraints33.gridx = 0;
338 gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
339 gridBagConstraints33.weightx = 1.0;
340 gridBagConstraints33.insets = new Insets(0, 5, 5, 5);
341 gridBagConstraints33.gridwidth = 5;
342 gridBagConstraints33.gridy = 9;
344 GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
345 gridBagConstraints14.gridx = 0;
346 gridBagConstraints14.anchor = GridBagConstraints.WEST;
347 gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
348 gridBagConstraints14.weightx = 1.0;
349 gridBagConstraints14.gridwidth = 5;
350 gridBagConstraints14.insets = new Insets(0, 5, 0, 5);
351 gridBagConstraints14.gridy = 8;
352 GridBagConstraints gridBagConstraints7 = new GridBagConstraints(0, 0,
353 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
354 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
355 gridBagConstraints7.weighty = 0.0;
356 GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
357 gridBagConstraints6.gridx = 0;
358 gridBagConstraints6.weighty = 1.0;
359 gridBagConstraints6.weightx = 1.0;
360 gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
361 gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
362 gridBagConstraints6.anchor = GridBagConstraints.NORTH;
363 gridBagConstraints6.gridy = 1;
364 GridBagConstraints gridBagConstraints1 = new GridBagConstraints(0, 1,
365 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
366 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
367 gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
368 gridBagConstraints1.anchor = GridBagConstraints.NORTH;
369 gridBagConstraints1.weighty = 1.0;
370 this.setIconImage(WinIcon);
371 contentPane = (JPanel) this.getContentPane();
372 contentPane.setLayout(borderLayout1);
373 setSize(new Dimension(400, 450));
374 setTitle("さきゅばす " + VERSION);
375 this.addWindowListener(new MainFrame_this_windowAdapter(this));
376 statusBar.setText(" ");
377 jMenuFile.setText("ファイル");
378 jMenuFileExit.setText("終了");
379 jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter(
381 jMenuHelp.setText("ヘルプ");
382 jMenuHelpAbout.setText("バージョン情報");
383 jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
385 VideoInfoPanel.setLayout(gridBagLayout1);
386 VideoID_TextField.setText("http://www.nicovideo.jp/watch/");
387 DoButton.setText(DoButtonDefString);
388 DoButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
389 SavingInfoTabPanel.setLayout(new GridLayout());
390 UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定"));
391 UserInfoPanel.setLayout(gridBagLayout3);
392 mailAddressLabel.setText("メールアドレス");
393 passwordLabel.setText("パスワード");
395 setListenerToSavePanelButton();
397 FFMpegTabPanel.setLayout(gridBagLayout6);
398 PathSettingPanel.setBorder(BorderFactory.createTitledBorder(
399 BorderFactory.createEtchedBorder(), "プログラムの位置の設定"));
400 PathSettingPanel.setLayout(gridBagLayout7);
401 FFmpegPathLabel.setText("FFmpeg");
402 SettingFFmpegPathButton.setText("参照");
403 SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter(
405 VhookPathLabel.setText("拡張vhookライブラリ");
406 SettingVhookPathButton.setText("参照");
407 SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter(
409 VhookSettingPanel.setLayout(gridBagLayout8);
410 VhookSettingPanel.setBorder(BorderFactory.createTitledBorder(
411 BorderFactory.createEtchedBorder(), "拡張vhookライブラリの設定"));
412 FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder(
413 BorderFactory.createEtchedBorder(), "FFmpegの設定"));
414 FFmpegSettingPanel.setLayout(gridBagLayout9);
415 FontPathLabel.setText("フォントパス");
416 SettingFontPathButton.setText("参照");
417 SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter(
419 showConvVideoCheckBox.setText("変換中の画像を表示する");
420 inputOptionLabel.setText("入力オプション");
421 outputOptionLabel.setText("出力オプション");
422 mainOptionLabel.setText("メインオプション");
423 FontIndexLabel.setText("フォント番号");
424 VideoID_Label.setText("URL/ID");
425 WayBackLabel.setText("過去ログ");
426 OpPanel.setLayout(new GridBagLayout());
428 BasicInfoTabPanel.setLayout(gridBagLayout12);
429 jMenuBar1.add(jMenuFile);
430 jMenuFile.add(jMenuFileExit);
431 jMenuBar1.add(jMenuHelp);
432 jMenuHelp.add(jMenuHelpAbout);
433 setJMenuBar(jMenuBar1);
435 contentPane.add(statusBar, BorderLayout.SOUTH);
436 contentPane.add(mainTabbedPane, java.awt.BorderLayout.CENTER);
437 contentPane.add(VideoInfoPanel, java.awt.BorderLayout.NORTH);
438 UserInfoPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1,
439 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
440 new Insets(0, 5, 5, 5), 0, 0));
441 UserInfoPanel.add(mailAddressField, new GridBagConstraints(1, 0, 1, 1,
442 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
443 new Insets(0, 5, 5, 5), 0, 0));
444 UserInfoPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1,
445 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
446 new Insets(0, 5, 5, 0), 0, 0));
447 UserInfoPanel.add(mailAddressLabel, new GridBagConstraints(0, 0, 1, 1,
448 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
449 new Insets(0, 5, 5, 0), 0, 0));
450 PathSettingPanel.add(ffmpegPathField, new GridBagConstraints(0, 1, 1,
451 1, 1.0, 0.0, GridBagConstraints.CENTER,
452 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
453 PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74);
454 PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2,
455 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
456 new Insets(0, 5, 5, 5), 0, 0));
457 PathSettingPanel.add(vhookPathField, new GridBagConstraints(0, 3, 1, 1,
458 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
459 new Insets(0, 5, 5, 5), 0, 0));
460 PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1,
461 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
462 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
463 PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
464 FFmpegSettingPanel.add(outputOptionField, gridBagConstraints53);
465 FFmpegSettingPanel.add(inputOptionField, gridBagConstraints52);
466 FFmpegSettingPanel.add(mainOptionField, gridBagConstraints51);
467 FFmpegSettingPanel.add(mainOptionLabel, gridBagConstraints48);
468 FFmpegSettingPanel.add(inputOptionLabel, gridBagConstraints49);
469 FFmpegSettingPanel.add(outputOptionLabel, gridBagConstraints50);
470 FFmpegSettingPanel.add(getFFmpegOptionComboBoxPanel(),
471 gridBagConstraints55);
472 FFmpegSettingPanel.add(ExtOptionLabel, gridBagConstraints56);
473 FFmpegSettingPanel.add(getExtOptionField(), gridBagConstraints57);
474 VideoInfoPanel.add(DoButton, gridBagConstraints71);
475 VideoInfoPanel.add(OpPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
476 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
477 new Insets(0, 0, 0, 0), 0, 0));
478 OpPanel.add(VideoID_Label, gridBagConstraints67);
479 OpPanel.add(VideoID_TextField, gridBagConstraints68);
480 OpPanel.add(WayBackLabel, gridBagConstraints69);
481 OpPanel.add(WayBackField, gridBagConstraints70);
483 mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
484 mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
485 mainTabbedPane.add(FFMpegTabPanel, "動画設定");
486 mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null);
487 SavingInfoTabPanel.add(savePanel);
488 BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
489 BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
490 VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
491 VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63);
492 VhookSettingPanel.add(fontPathField, gridBagConstraints60);
493 VhookSettingPanel.add(fontIndexField, gridBagConstraints62);
494 VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
495 VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
496 VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
497 VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
498 VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
499 VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
500 VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
501 VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
502 VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
504 FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
505 1.0, 0.0, GridBagConstraints.NORTHEAST,
506 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
507 FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
511 * 保存設定パネル内のボタンにアクションリスナを割り当てる.
513 private void setListenerToSavePanelButton() {
515 al = new InputVideoPanelButtonListener();
516 videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
517 videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
518 videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
520 al = new VideoUseRadioButtonListener();
521 videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
522 videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
523 videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
525 al = new InputCommentPanelButtonListener();
526 savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
527 savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
529 al = new OutputVideoPanelButtonListener();
530 savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
531 savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
534 private void setPopup() {
535 mainOptionField.addMouseListener(new PopupRightClick(
536 this.mainOptionField));
537 inputOptionField.addMouseListener(new PopupRightClick(
538 this.inputOptionField));
539 outputOptionField.addMouseListener(new PopupRightClick(
540 this.outputOptionField));
541 savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
542 savePanel.getCommentNumField()));
544 savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
545 savePanel.getCommentSavedFileField()));
546 savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
547 savePanel.getCommentSavedFolderField()));
549 savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
550 savePanel.getConvertedVideoSavedFileField()));
551 savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
552 savePanel.getConvertedVideoSavedFolderField()));
554 videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
555 videoSaveInfoPanel.getVideoSavedFileField()));
556 videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
557 videoSaveInfoPanel.getVideoSavedFolderField()));
558 videoSaveInfoPanel.getNibrFileField().addMouseListener(
559 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
561 ffmpegPathField.addMouseListener(new PopupRightClick(
562 this.ffmpegPathField));
563 vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField));
564 VideoID_TextField.addMouseListener(new PopupRightClick(
565 this.VideoID_TextField));
566 viewCommentField.addMouseListener(new PopupRightClick(
567 this.viewCommentField));
568 fontPathField.addMouseListener(new PopupRightClick(this.fontPathField));
569 mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField));
570 passwordField.addMouseListener(new PopupRightClick(this.passwordField));
571 WayBackField.addMouseListener(new PopupRightClick(this.WayBackField));
573 proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField));
574 proxyPortTextField.addMouseListener(new PopupRightClick(
575 this.proxyPortTextField));
577 fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField));
579 ngWordTextField.addMouseListener(new PopupRightClick(
580 this.ngWordTextField));
581 ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField));
584 private void setDropTarget() {
585 addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
586 addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
587 addTarget(videoSaveInfoPanel.getNibrFileField(), false);
589 addTarget(savePanel.getCommentSavedFileField(), false);
590 addTarget(savePanel.getCommentSavedFolderField(), true);
592 addTarget(savePanel.getConvertedVideoSavedFileField(), false);
593 addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
595 addTarget(ffmpegPathField, false);
596 addTarget(vhookPathField, false);
597 addTarget(fontPathField, false);
602 * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする.
603 * @param c 設定対象のテキストフィールドオブジェクト.
604 * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse.
605 * @return ドロップターゲット(用途無し).
607 private DropTarget addTarget(JTextField c, boolean isDir) {
608 return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
611 private File CurrentDir = new File(".");
612 private JPanel PathSettingPanel = new JPanel();
613 private JLabel FFmpegPathLabel = new JLabel();
614 private GridBagLayout gridBagLayout7 = new GridBagLayout();
615 private JTextField ffmpegPathField = new JTextField();
616 private JButton SettingFFmpegPathButton = new JButton();
617 private JLabel VhookPathLabel = new JLabel();
618 private JTextField vhookPathField = new JTextField();
619 private JButton SettingVhookPathButton = new JButton();
620 private JPanel VhookSettingPanel = new JPanel();
621 private GridBagLayout gridBagLayout8 = new GridBagLayout();
622 private JPanel FFmpegSettingPanel = new JPanel();
623 private GridBagLayout gridBagLayout9 = new GridBagLayout();
624 private JLabel FontPathLabel = new JLabel();
625 private JTextField fontPathField = new JTextField();
626 private JButton SettingFontPathButton = new JButton();
627 private JCheckBox showConvVideoCheckBox = new JCheckBox();
629 private void showSaveDialog(String title, JTextField field, boolean isSave,
631 JFileChooser chooser = new JFileChooser(CurrentDir);
632 chooser.setDialogTitle(title);
635 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
638 code = chooser.showSaveDialog(this);
640 code = chooser.showOpenDialog(this);
642 if (code == JFileChooser.APPROVE_OPTION) {
644 CurrentDir = chooser.getSelectedFile();
645 field.setText(CurrentDir.getAbsolutePath());
647 File selected = chooser.getSelectedFile();
648 CurrentDir = chooser.getCurrentDirectory();
649 field.setText(selected.getAbsolutePath());
654 private SProperties getSetting() {
655 SProperties setting = new SProperties(
657 getInputVideoSetting(),
658 getInputCommentSetting(),
659 getTcommentSetting(),
660 getOutputVideoSetting(),
662 getConvertSetting());
668 * @param setting 反映する設定.
670 private void setSetting(SProperties setting) {
672 final BasicSetting basic = setting.getBasicSetting();
673 tempDir = basic.getTempDir();
674 mailAddressField.setText(basic.getUser().getMail());
675 passwordField.setText(basic.getUser().getPassword());
677 useProxyCheckBox.setSelected(basic.isProxyUse());
678 proxyTextField.setText(basic.getProxyHost());
679 int proxy_port = basic.getProxyPort();
680 if (proxy_port >= 0 && proxy_port <= 65535) {
681 proxyPortTextField.setText(Integer.toString(proxy_port));
683 proxyPortTextField.setText("");
687 final InputVideoSetting inVideo = setting.getInputVideoSetting();
688 JRadioButton activeButton;
689 switch (inVideo.getProcessKind()) {
691 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
694 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
698 activeButton = videoSaveInfoPanel.getVideoSaveButton();
701 activeButton.doClick();
703 videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
704 videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
705 videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
706 final boolean videoFixName = inVideo.isAutoNaming();
707 videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
708 videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
709 videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
712 final InputCommentSetting inputComment = setting.getInputCommentSetting();
713 savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
714 savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
715 savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
716 savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
717 savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
718 savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
719 boolean commentFixName = inputComment.isAutoNaming();
720 savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
721 savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
724 InputTcommentSetting tcom = setting.getInputTcommentSetting();
725 savePanel.setTcommentDownload(tcom.getProcessKind());
726 savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
727 savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
728 savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
729 savePanel.setTcommentFileName(tcom.getFile().getPath());
732 final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
733 savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
734 savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
735 savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
736 savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
737 savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
738 savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
739 boolean convFixName = outputVideo.isAutoNaming();
740 savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
741 savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
744 final MovieSetting movie = setting.getMovieSetting();
745 ffmpegPathField.setText(movie.getFfmpeg().toString());
746 vhookPathField.setText(movie.getVhook().toString());
747 extOptionField.setText(movie.getFfmpegOption().getExtOption());
748 mainOptionField.setText(movie.getFfmpegOption().getMainOption());
749 outputOptionField.setText(movie.getFfmpegOption().getOutOption());
750 inputOptionField.setText(movie.getFfmpegOption().getInOption());
751 FFmpegOptionModel.reload(movie.getOptionFile());
754 final ConvertSetting conv = setting.getConvertSetting();
755 disableVhookCheckBox.setSelected(conv.isVhookDisabled());
756 viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
757 fontPathField.setText(conv.getFont().toString());
758 fontIndexField.setText(Integer.toString(conv.getFontIndex()));
759 shadowComboBox.setSelectedIndex(conv.getShadowIndex());
760 showConvVideoCheckBox.setSelected(conv.isShowConverting());
761 fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
762 opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
763 ngWordTextField.setText(conv.getNgSetting().getWord());
764 ngIdTextField.setText(conv.getNgSetting().getId());
768 * [ファイル|終了] アクションが実行されました。
773 void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
774 SProperties setting = getSetting();
775 SProperties.saveSetting(setting);
780 * [ヘルプ|バージョン情報] アクションが実行されました。
785 void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
786 MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
788 dlg.setLocationRelativeTo(this);
789 dlg.setVisible(true);
793 private Converter Converter = null;
794 private JLabel inputOptionLabel = new JLabel();
795 private JTextField inputOptionField = new JTextField();
796 private JLabel outputOptionLabel = new JLabel();
797 private JTextField outputOptionField = new JTextField();
798 private JLabel mainOptionLabel = new JLabel();
799 private JTextField mainOptionField = new JTextField();
800 private JLabel FontIndexLabel = new JLabel();
801 private JTextField fontIndexField = new JTextField();
802 private JLabel VideoID_Label = new JLabel();
803 private JLabel WayBackLabel = new JLabel();
804 private JTextField WayBackField = new JTextField();
805 private GridBagLayout gridBagLayout1 = new GridBagLayout();
806 private JPanel OpPanel = new JPanel();
807 private JPanel BasicInfoTabPanel = new JPanel();
808 private GridBagLayout gridBagLayout12 = new GridBagLayout();
809 private JPanel ConvertingSettingPanel = null;
810 private JPanel NGWordSettingPanel = null;
811 private JLabel NGWordLavel = null;
812 private JTextField ngWordTextField = null;
813 private JLabel NGIDLabel = null;
814 private JTextField ngIdTextField = null;
816 private JPanel ProxyInfoPanel = null;
817 private JCheckBox useProxyCheckBox = null;
818 private JLabel proxyLabel = null;
819 private JTextField proxyTextField = null;
820 private JLabel proxyPortLabel = null;
821 private JTextField proxyPortTextField = null;
823 private JCheckBox fixFontSizeCheckBox = null;
824 private JCheckBox opaqueCommentCheckBox = null;
825 private final SavePanel savePanel = new SavePanel();
826 private final VideoSaveInfoPanel videoSaveInfoPanel;
827 private JComboBox FFmpegOptionComboBox = null;
828 private JButton FFmpegOptionReloadButton = null;
829 private JPanel FFmpegOptionComboBoxPanel = null;
831 public void DoButton_actionPerformed(ActionEvent e) {
832 if (Converter == null || Converter.isConverted()) {
835 } catch (Exception ex) {
836 String text = ex.getMessage();
837 if (StringUtils.isEmpty(text)) {
838 text = "予期しないエラーのため中断しました。";
840 ex.printStackTrace();
841 statusBar.setText(text);
843 } else { /* 開始しているので、ストップする。 */
844 final ConvertStopFlag flag = Converter.getStopFlag();
845 if (!flag.needStop()) { /* まだストップしていない。 */
851 private void executeConvert() throws IOException {
854 // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
855 if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
857 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
858 NicoDBFinder finder = NicoDBFinder.getInstance();
859 NicoContent info = finder.findNicoContent(fileName);
861 url = info.getNicoId();
865 } catch (Exception ex) {
866 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
870 url = VideoID_TextField.getText();
873 TextProgressListener sl = new TextProgressListener() {
875 public void setText(final String text) {
876 SwingUtilities.invokeLater(new Runnable() {
879 statusBar.setText(text);
885 ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
887 public void changeState(final State s) {
888 SwingUtilities.invokeLater(new Runnable() {
893 DoButton.setText(DoButtonWaitString);
896 DoButton.setText(DoButtonDefString);
903 Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl,
904 new ConvertStopFlag(scl));
905 DoButton.setText(DoButtonStopString);
906 new Thread(Converter).start();
911 public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
912 showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
915 public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
916 showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
919 public void SettingFontPathButton_actionPerformed(ActionEvent e) {
920 showSaveDialog("フォントへのパス", fontPathField, false, false);
923 public void this_windowClosing(WindowEvent e) {
924 this.jMenuFileExit_actionPerformed(null);
928 * This method initializes ConvertingSettingPanel
930 * @return javax.swing.JPanel
932 private JPanel getConvertingSettingPanel() {
933 if (ConvertingSettingPanel == null) {
934 GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
935 gridBagConstraints11.weighty = 1.0;
936 gridBagConstraints11.weightx = 1.0;
937 gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
938 gridBagConstraints11.gridy = 1;
939 gridBagConstraints11.gridx = 0;
940 gridBagConstraints11.anchor = GridBagConstraints.NORTH;
941 gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
942 GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
943 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
944 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
945 gridBagConstraints.gridx = 0;
946 gridBagConstraints.anchor = GridBagConstraints.CENTER;
947 gridBagConstraints.weighty = 0.0;
948 gridBagConstraints.gridy = 0;
949 ConvertingSettingPanel = new JPanel();
950 ConvertingSettingPanel.setLayout(new GridBagLayout());
951 ConvertingSettingPanel.add(getNGWordSettingPanel(),
952 gridBagConstraints11);
953 ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
955 return ConvertingSettingPanel;
959 * This method initializes NGWordSettingPanel
961 * @return javax.swing.JPanel
963 private JPanel getNGWordSettingPanel() {
964 if (NGWordSettingPanel == null) {
965 GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
966 gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
967 gridBagConstraints5.gridy = 1;
968 gridBagConstraints5.weightx = 1.0;
969 gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
970 gridBagConstraints5.gridx = 1;
971 GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
972 gridBagConstraints4.gridx = 0;
973 gridBagConstraints4.anchor = GridBagConstraints.WEST;
974 gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
975 gridBagConstraints4.gridy = 1;
976 NGIDLabel = new JLabel();
977 NGIDLabel.setText("NG ID");
978 GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
979 gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
980 gridBagConstraints3.gridy = 0;
981 gridBagConstraints3.weightx = 1.0;
982 gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
983 gridBagConstraints3.gridx = 1;
984 GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
985 gridBagConstraints2.gridx = 0;
986 gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
987 gridBagConstraints2.gridy = 0;
988 NGWordLavel = new JLabel();
989 NGWordLavel.setText("NGワード");
990 NGWordSettingPanel = new JPanel();
991 NGWordSettingPanel.setLayout(new GridBagLayout());
992 NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
994 NGWordSettingPanel.add(NGWordLavel, gridBagConstraints2);
995 NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
996 NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
997 NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
999 return NGWordSettingPanel;
1003 * This method initializes NGWordTextField
1005 * @return javax.swing.JTextField
1007 private JTextField getNGWordTextField() {
1008 if (ngWordTextField == null) {
1009 ngWordTextField = new JTextField();
1010 ngWordTextField.setName("ngWordTextField");
1012 return ngWordTextField;
1016 * This method initializes NGIDTextField
1018 * @return javax.swing.JTextField
1020 private JTextField getNGIDTextField() {
1021 if (ngIdTextField == null) {
1022 ngIdTextField = new JTextField();
1023 ngIdTextField.setName("ngIdTextField");
1025 return ngIdTextField;
1029 * This method initializes ProxyInfoPanel
1031 * @return javax.swing.JPanel
1033 private JPanel getProxyInfoPanel() {
1034 if (ProxyInfoPanel == null) {
1035 GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1036 gridBagConstraints13.gridx = 0;
1037 gridBagConstraints13.gridwidth = 2;
1038 gridBagConstraints13.weightx = 1.0;
1039 gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1040 gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1041 gridBagConstraints13.gridy = 0;
1042 GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1043 gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1044 gridBagConstraints12.gridy = 2;
1045 gridBagConstraints12.weightx = 1.0;
1046 gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1047 gridBagConstraints12.gridx = 1;
1048 GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1049 gridBagConstraints10.gridx = 0;
1050 gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1051 gridBagConstraints10.gridy = 2;
1052 proxyPortLabel = new JLabel();
1053 proxyPortLabel.setText("ポート番号");
1054 GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1055 gridBagConstraints9.fill = GridBagConstraints.BOTH;
1056 gridBagConstraints9.gridy = 1;
1057 gridBagConstraints9.weightx = 1.0;
1058 gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1059 gridBagConstraints9.gridx = 1;
1060 GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1061 gridBagConstraints8.gridx = 0;
1062 gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1063 gridBagConstraints8.fill = GridBagConstraints.NONE;
1064 gridBagConstraints8.anchor = GridBagConstraints.EAST;
1065 gridBagConstraints8.gridy = 1;
1066 proxyLabel = new JLabel();
1067 proxyLabel.setText("プロキシ");
1068 ProxyInfoPanel = new JPanel();
1069 ProxyInfoPanel.setLayout(new GridBagLayout());
1070 ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1072 ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1073 ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1074 ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1075 ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1076 ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1078 return ProxyInfoPanel;
1082 * This method initializes ProxyTextField
1084 * @return javax.swing.JTextField
1086 private JTextField getProxyTextField() {
1087 if (proxyTextField == null) {
1088 proxyTextField = new JTextField();
1089 proxyTextField.setName("proxyTextField");
1091 return proxyTextField;
1095 * This method initializes ProxyPortTextField
1097 * @return javax.swing.JTextField
1099 private JTextField getProxyPortTextField() {
1100 if (proxyPortTextField == null) {
1101 proxyPortTextField = new JTextField();
1102 proxyPortTextField.setName("proxyPortTextField");
1104 return proxyPortTextField;
1108 * This method initializes UseProxyCheckBox
1110 * @return javax.swing.JCheckBox
1112 private JCheckBox getUseProxyCheckBox() {
1113 if (useProxyCheckBox == null) {
1114 useProxyCheckBox = new JCheckBox();
1115 useProxyCheckBox.setText("プロキシを使う");
1116 useProxyCheckBox.setName("useProxyCheckBox");
1118 return useProxyCheckBox;
1122 * This method initializes FixFontSizeCheckBox
1124 * @return javax.swing.JCheckBox
1126 private JCheckBox getFixFontSizeCheckBox() {
1127 if (fixFontSizeCheckBox == null) {
1128 fixFontSizeCheckBox = new JCheckBox();
1129 fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1130 fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1132 return fixFontSizeCheckBox;
1136 * This method initializes OpaqueCommentCheckBox
1138 * @return javax.swing.JCheckBox
1140 private JCheckBox getOpaqueCommentCheckBox() {
1141 if (opaqueCommentCheckBox == null) {
1142 opaqueCommentCheckBox = new JCheckBox();
1143 opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1144 opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1146 return opaqueCommentCheckBox;
1149 * This method initializes FFmpegOptionComboBox
1151 * @return javax.swing.JComboBox
1153 private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1154 private JLabel ExtOptionLabel = null;
1155 private JTextField extOptionField = null;
1156 private JCheckBox disableVhookCheckBox = null;
1157 private JTextField viewCommentField = null;
1158 private JLabel ViewCommentLabel = null;
1159 private JLabel ShadowKindLabel = null;
1160 private JComboBox shadowComboBox = null;
1162 private JComboBox getFFmpegOptionComboBox() {
1163 if (FFmpegOptionComboBox == null) {
1164 FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1165 FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1167 public void actionPerformed(java.awt.event.ActionEvent e) {
1168 if (FFmpegOptionModel.isFile()) {// ファイル
1169 extOptionField.setEnabled(false);
1170 mainOptionField.setEnabled(false);
1171 inputOptionField.setEnabled(false);
1172 outputOptionField.setEnabled(false);
1174 extOptionField.setEnabled(true);
1175 mainOptionField.setEnabled(true);
1176 inputOptionField.setEnabled(true);
1177 outputOptionField.setEnabled(true);
1182 return FFmpegOptionComboBox;
1186 * This method initializes FFmpegOptionReloadButton
1188 * @return javax.swing.JButton
1190 private JButton getFFmpegOptionReloadButton() {
1191 if (FFmpegOptionReloadButton == null) {
1192 FFmpegOptionReloadButton = new JButton();
1193 FFmpegOptionReloadButton.setText("更新");
1194 FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1196 public void actionPerformed(java.awt.event.ActionEvent e) {
1197 FFmpegOptionModel.reload();
1201 return FFmpegOptionReloadButton;
1205 * This method initializes FFmpegOptionComboBoxPanel
1207 * @return javax.swing.JPanel
1209 private JPanel getFFmpegOptionComboBoxPanel() {
1210 if (FFmpegOptionComboBoxPanel == null) {
1211 GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1212 gridBagConstraints47.fill = GridBagConstraints.BOTH;
1213 gridBagConstraints47.gridx = -1;
1214 gridBagConstraints47.gridy = -1;
1215 gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1216 GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1217 gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1218 gridBagConstraints46.gridwidth = 3;
1219 gridBagConstraints46.gridx = -1;
1220 gridBagConstraints46.gridy = -1;
1221 gridBagConstraints46.weightx = 1.0;
1222 gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1223 FFmpegOptionComboBoxPanel = new JPanel();
1224 FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1225 FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1226 gridBagConstraints46);
1227 FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1228 gridBagConstraints47);
1230 return FFmpegOptionComboBoxPanel;
1234 * This method initializes ExtOptionField
1236 * @return javax.swing.JTextField
1238 private JTextField getExtOptionField() {
1239 if (extOptionField == null) {
1240 extOptionField = new JTextField();
1241 extOptionField.setName("extOptionField");
1243 return extOptionField;
1247 * This method initializes NotUseVhookCheckBox
1249 * @return javax.swing.JCheckBox
1251 private JCheckBox getNotUseVhookCheckBox() {
1252 if (disableVhookCheckBox == null) {
1253 disableVhookCheckBox = new JCheckBox();
1254 disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1255 disableVhookCheckBox.setName("disableVhookCheckBox");
1257 return disableVhookCheckBox;
1261 * This method initializes ViewCommentField
1263 * @return javax.swing.JTextField
1265 private JTextField getViewCommentField() {
1266 if (viewCommentField == null) {
1267 viewCommentField = new JTextField();
1268 viewCommentField.setName("viewCommentField");
1270 return viewCommentField;
1274 * This method initializes ShadowComboBox
1276 * @return javax.swing.JComboBox
1278 private JComboBox getShadowComboBox() {
1279 if (shadowComboBox == null) {
1280 shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1281 shadowComboBox.setName("shadowComboBox");
1283 return shadowComboBox;
1286 private BasicSetting getBasicSetting() {
1287 String mail = mailAddressField.getText();
1288 String pass = String.valueOf(passwordField.getPassword());
1289 boolean proxyUse = useProxyCheckBox.isSelected();
1290 String proxyHost = proxyTextField.getText();
1293 proxyPort = Integer.parseInt(proxyPortTextField.getText());
1294 } catch (NumberFormatException e) {
1297 // TODO 作業用ディレクトリの設定GUI無し
1298 return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1301 private InputVideoSetting getInputVideoSetting() {
1303 if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1304 kind = VideoSaveKind.NO_SAVE;
1305 } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1306 kind = VideoSaveKind.NICOBROWSER;
1308 kind = VideoSaveKind.SAVE;
1310 boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1311 String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1312 String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1313 boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1314 String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1316 return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1319 private InputCommentSetting getInputCommentSetting() {
1320 boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1321 String file = savePanel.getCommentSavedFileField().getText();
1324 back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1325 } catch (NumberFormatException ex) {
1328 boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1329 boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1330 String folder = savePanel.getCommentSavedFolderField().getText();
1331 boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1333 return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1338 * 画面入力値から投稿者コメント設定を作成する.
1339 * @return 作成した投稿者コメント設定.
1341 private InputTcommentSetting getTcommentSetting() {
1342 boolean down = savePanel.isTcommentDownload();
1343 boolean del = savePanel.isTcommentDelete();
1344 boolean naming = savePanel.isTcommentAutoFileName();
1345 String dir = savePanel.getTcommentDirectoryName();
1346 String f = savePanel.getTcommentFileName();
1347 return new InputTcommentSetting(down, naming, dir, f, del);
1350 private OutputVideoSetting getOutputVideoSetting() {
1351 boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1352 boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1353 boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1354 String file = savePanel.getConvertedVideoSavedFileField().getText();
1355 boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1356 boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1357 String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1359 return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1363 private MovieSetting getMovieSetting() {
1364 String ffmpeg = ffmpegPathField.getText();
1365 String vhook = vhookPathField.getText();
1366 String ext = extOptionField.getText();
1367 String main = mainOptionField.getText();
1368 String in = inputOptionField.getText();
1369 String out = outputOptionField.getText();
1370 File optionFile = FFmpegOptionModel.getSelectedFile();
1372 FfmpegOption opt = new FfmpegOption(ext, main, in, out);
1373 return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1376 private ConvertSetting getConvertSetting() {
1377 boolean vhookDisabled = disableVhookCheckBox.isSelected();
1378 int maxComment = 30;
1380 maxComment = Integer.parseInt(viewCommentField.getText());
1381 } catch (NumberFormatException ex) {
1383 File font = new File(fontPathField.getText());
1384 int fontIndex = Integer.parseInt(fontIndexField.getText());
1385 int shadowIndex = shadowComboBox.getSelectedIndex();
1386 boolean showConv = showConvVideoCheckBox.isSelected();
1387 boolean adjustFont = fixFontSizeCheckBox.isSelected();
1388 boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1389 NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1391 return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1392 commentOpaque, ngSetting);
1395 private class InputVideoPanelButtonListener implements ActionListener {
1397 public void actionPerformed(ActionEvent e) {
1398 final Object source = e.getSource();
1399 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1405 if (source == panel.getShowSavingVideoFolderDialogButton()) {
1406 title = "動画の保存先(フォルダ)";
1407 field = panel.getVideoSavedFolderField();
1410 } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1411 title = "動画の保存先(ファイル)";
1412 field = panel.getVideoSavedFileField();
1415 } else if (source == panel.getNibrFileChooserButton()) {
1416 title = "NicoBrowserファイル選択";
1417 field = panel.getNibrFileField();
1423 showSaveDialog(title, field, isSave, isDir);
1427 private class InputCommentPanelButtonListener implements ActionListener {
1429 public void actionPerformed(ActionEvent e) {
1430 final Object source = e.getSource();
1435 if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1436 title = "コメントの保存先(フォルダ)";
1437 field = savePanel.getCommentSavedFolderField();
1440 } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1441 title = "コメントの保存先(ファイル)";
1442 field = savePanel.getCommentSavedFileField();
1448 showSaveDialog(title, field, isSave, isDir);
1452 private class OutputVideoPanelButtonListener implements ActionListener {
1454 public void actionPerformed(ActionEvent e) {
1455 final Object source = e.getSource();
1460 if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1461 title = "コメント付き動画の保存先(フォルダ)";
1462 field = savePanel.getConvertedVideoSavedFolderField();
1465 } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1466 title = "コメント付き動画の保存先(ファイル)";
1467 field = savePanel.getConvertedVideoSavedFileField();
1473 showSaveDialog(title, field, isSave, isDir);
1477 private class VideoUseRadioButtonListener implements ActionListener {
1479 public void actionPerformed(ActionEvent e) {
1480 Object source = e.getSource();
1481 if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1488 private void maskBase() {
1492 private void maskExt() {
1496 private void mask(boolean b) {
1497 final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1498 VideoID_TextField.setEditable(b);
1499 panel.getDelVideoCheckBox().setEnabled(b);
1501 panel.getSaveFolderRadioButton().setEnabled(b);
1502 panel.getVideoSavedFolderField().setEnabled(b);
1503 panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1505 panel.getSaveFileRadioButton().setEnabled(b);
1506 panel.getVideoSavedFileField().setEnabled(b);
1507 panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1509 panel.getNibrFileField().setEnabled(!b);
1510 panel.getNibrFileChooserButton().setEnabled(!b);
1515 class MainFrame_this_windowAdapter extends WindowAdapter {
1517 private MainFrame adaptee;
1519 MainFrame_this_windowAdapter(MainFrame adaptee) {
1520 this.adaptee = adaptee;
1524 public void windowClosing(WindowEvent e) {
1525 adaptee.this_windowClosing(e);
1529 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1531 private MainFrame adaptee;
1533 MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1534 this.adaptee = adaptee;
1537 public void actionPerformed(ActionEvent e) {
1538 adaptee.SettingFontPathButton_actionPerformed(e);
1542 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1544 private MainFrame adaptee;
1546 MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1547 this.adaptee = adaptee;
1550 public void actionPerformed(ActionEvent e) {
1551 adaptee.SettingVhookPathButton_actionPerformed(e);
1555 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1557 private MainFrame adaptee;
1559 MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1560 this.adaptee = adaptee;
1563 public void actionPerformed(ActionEvent e) {
1564 adaptee.SettingFFmpegPathButton_actionPerformed(e);
1568 class MainFrame_DoButton_actionAdapter implements ActionListener {
1570 private MainFrame adaptee;
1572 MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1573 this.adaptee = adaptee;
1576 public void actionPerformed(ActionEvent e) {
1577 adaptee.DoButton_actionPerformed(e);
1581 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1585 MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1586 this.adaptee = adaptee;
1589 public void actionPerformed(ActionEvent actionEvent) {
1590 adaptee.jMenuFileExit_actionPerformed(actionEvent);
1594 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1598 MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1599 this.adaptee = adaptee;
1602 public void actionPerformed(ActionEvent actionEvent) {
1603 adaptee.jMenuHelpAbout_actionPerformed(actionEvent);