4 * Created on 2011/08/20, 16:33:03
6 package yukihane.inqubus.gui;
8 import static javax.swing.GroupLayout.DEFAULT_SIZE;
9 import static javax.swing.GroupLayout.PREFERRED_SIZE;
11 import java.awt.event.ActionEvent;
12 import java.awt.event.ActionListener;
14 import java.util.List;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17 import javax.swing.BorderFactory;
18 import javax.swing.ButtonGroup;
19 import javax.swing.ComboBoxModel;
20 import javax.swing.DefaultComboBoxModel;
21 import javax.swing.GroupLayout;
22 import javax.swing.GroupLayout.Alignment;
23 import javax.swing.JButton;
24 import javax.swing.JCheckBox;
25 import javax.swing.JComboBox;
26 import javax.swing.JDialog;
27 import javax.swing.JFileChooser;
28 import javax.swing.JFrame;
29 import javax.swing.JLabel;
30 import javax.swing.JPanel;
31 import javax.swing.JPasswordField;
32 import javax.swing.JRadioButton;
33 import javax.swing.JSpinner;
34 import javax.swing.JTabbedPane;
35 import javax.swing.JTextField;
36 import javax.swing.LayoutStyle.ComponentPlacement;
37 import javax.swing.SpinnerNumberModel;
38 import javax.swing.WindowConstants;
39 import org.apache.commons.configuration.ConfigurationException;
40 import yukihane.inqubus.config.Config;
41 import yukihane.inqubus.config.Config.CookieBrowser;
47 public class ConfigDialog extends JDialog {
48 private static final long serialVersionUID = 1L;
49 private static final Logger logger = LoggerFactory.getLogger(ConfigDialog.class);
50 private static final String NEED_REBOOT = "設定を有効にするにはいんきゅばすの再起動が必要です";
52 /** Creates new form Properties */
53 public ConfigDialog() {
57 public ConfigDialog(JFrame owner){
60 final JTabbedPane tabbedPane = new JTabbedPane();
61 final JPanel pnlNetwork = new JPanel();
62 final JPanel pnlAccount = new JPanel();
63 fldMail = new JTextField();
64 fldPassword.setEchoChar('*');
65 final JPanel pnlProxy = new JPanel();
66 cbProxyUse = new JCheckBox();
67 final JLabel lblProxyHost = new JLabel();
68 final JLabel lblProxyPort = new JLabel();
69 final JPanel pnlFile = new JPanel();
70 final JPanel pnlFileOutput = new JPanel();
71 final JLabel lblOutputDir = new JLabel();
72 final JLabel lblOutputFileNamePattern = new JLabel();
73 fldOutputDir = new JTextField();
74 fldOutputFileNamePattern = new JTextField();
75 cbOutputEnable = new JCheckBox();
76 cbOutputCommentOverlay = new JCheckBox();
77 cbOutputDisplayProgress = new JCheckBox();
78 final JPanel pnlComment = new JPanel();
79 final JPanel pnlCommentStandard = new JPanel();
80 final JLabel lblCommentSize = new JLabel();
81 final JLabel lblCommentSizeManual = new JLabel();
82 final JLabel lblCommentMinSize = new JLabel();
83 final JLabel lblCommentMinSizeManual = new JLabel();
84 final JLabel lblCommentDisplayMax = new JLabel();
85 final JLabel lblCommentDisplayMaxManual = new JLabel();
86 final JPanel pnlCommentAdvanced = new JPanel();
87 final JLabel lblFontPath = new JLabel();
88 cbFontSizeArrangeDisable = new JCheckBox();
89 cbCommentOpaque = new JCheckBox();
90 fldFontPath = new JTextField();
91 final JLabel lblFontIndex = new JLabel();
92 final JLabel lblFontShadow = new JLabel();
93 fldFontIndex = new JTextField();
94 final JPanel pnlFfmpeg = new JPanel();
95 final JPanel pnlFfmpegBinPath = new JPanel();
96 final JLabel lblFfmpegPath = new JLabel("ffmpeg");
97 final JLabel lblFfmpegDllPath = new JLabel("拡張ライブラリ");
98 final JLabel lblMediaInfoPath = new JLabel("MediaInfo");
99 final JPanel pnlNgSetting = new JPanel();
100 final JPanel pnlSearch = new JPanel();
102 setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
104 pnlNetwork.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
106 pnlAccount.setBorder(BorderFactory.createTitledBorder("アカウント"));
108 final JLabel lblMail = new JLabel("ID(メールアドレス)");
109 final JLabel lblPassword = new JLabel("パスワード");
111 GroupLayout gl_pnlAccount = new GroupLayout(pnlAccount);
112 pnlAccount.setLayout(gl_pnlAccount);
113 gl_pnlAccount.setHorizontalGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
114 .addComponent(btnAccount)
115 .addGroup(gl_pnlAccount.createSequentialGroup()
118 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
119 .addComponent(lblMail)
120 .addComponent(lblPassword)
122 .addPreferredGap(ComponentPlacement.RELATED)
123 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
124 .addComponent(fldPassword, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
125 .addComponent(fldMail, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
130 gl_pnlAccount.setVerticalGroup(
131 gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
132 .addGroup(gl_pnlAccount.createSequentialGroup()
134 .addComponent(btnAccount)
135 .addPreferredGap(ComponentPlacement.RELATED)
136 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
137 .addComponent(lblMail)
138 .addComponent(fldMail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
139 .addPreferredGap(ComponentPlacement.RELATED)
140 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
141 .addComponent(lblPassword)
142 .addComponent(fldPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
143 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
147 final JButton btnCookie = new JButton("...");
148 btnCookie.addActionListener(new FileChooseActionListener(this, JFileChooser.DIRECTORIES_ONLY, fldCookie));
150 final ButtonGroup grpLoginType = new ButtonGroup();
151 grpLoginType.add(btnAccount);
152 grpLoginType.add(btnLoginCookie);
154 final ButtonGroup grpCookie = new ButtonGroup();
155 grpCookie.add(btnCookieIe);
156 grpCookie.add(btnCookieFirefox);
157 grpCookie.add(btnCookieChrome);
158 grpCookie.add(btnCookieChromium);
159 grpCookie.add(btnCookieOpera);
160 grpCookie.add(btnCookieOther);
162 final JPanel pnlCookie = new JPanel();
163 pnlCookie.setBorder(BorderFactory.createTitledBorder("cookie"));
164 final GroupLayout glCookie = new GroupLayout(pnlCookie);
165 pnlCookie.setLayout(glCookie);
166 glCookie.setAutoCreateContainerGaps(true);
167 glCookie.setAutoCreateGaps(true);
169 glCookie.setHorizontalGroup(glCookie.createParallelGroup()
170 .addComponent(btnLoginCookie)
171 .addGroup(glCookie.createSequentialGroup()
173 .addGroup(glCookie.createParallelGroup()
174 .addComponent(btnCookieIe)
175 .addComponent(btnCookieFirefox)
176 .addComponent(btnCookieChrome)
177 .addComponent(btnCookieChromium)
178 .addComponent(btnCookieOpera)
179 .addComponent(btnCookieOther)
180 .addGroup(glCookie.createSequentialGroup()
181 .addComponent(fldCookie)
182 .addComponent(btnCookie)
188 glCookie.setVerticalGroup(glCookie.createSequentialGroup()
189 .addComponent(btnLoginCookie)
190 .addComponent(btnCookieIe)
191 .addComponent(btnCookieFirefox)
192 .addComponent(btnCookieChrome)
193 .addComponent(btnCookieChromium)
194 .addComponent(btnCookieOpera)
195 .addComponent(btnCookieOther)
196 .addGroup(glCookie.createParallelGroup(Alignment.BASELINE)
197 .addComponent(fldCookie)
198 .addComponent(btnCookie)
203 pnlProxy.setBorder(BorderFactory.createTitledBorder("プロキシ"));
205 cbProxyUse.setText("プロキシを使用する");
207 lblProxyHost.setText("ホスト名");
209 lblProxyPort.setText("ポート番号");
211 GroupLayout gl_pnlProxy = new GroupLayout(pnlProxy);
212 pnlProxy.setLayout(gl_pnlProxy);
213 gl_pnlProxy.setHorizontalGroup(
214 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
215 .addGroup(gl_pnlProxy.createSequentialGroup()
217 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
218 .addComponent(cbProxyUse)
219 .addGroup(gl_pnlProxy.createSequentialGroup()
220 .addComponent(lblProxyHost)
222 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
223 .addGroup(gl_pnlProxy.createSequentialGroup()
224 .addComponent(lblProxyPort)
225 .addPreferredGap(ComponentPlacement.RELATED)
226 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
227 .addContainerGap(181, Short.MAX_VALUE))
229 gl_pnlProxy.setVerticalGroup(
230 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
231 .addGroup(gl_pnlProxy.createSequentialGroup()
233 .addComponent(cbProxyUse)
234 .addPreferredGap(ComponentPlacement.RELATED)
235 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
236 .addComponent(lblProxyHost)
237 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
238 .addPreferredGap(ComponentPlacement.RELATED)
239 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
240 .addComponent(lblProxyPort)
241 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
246 GroupLayout gl_pnlNetwork = new GroupLayout(pnlNetwork);
247 pnlNetwork.setLayout(gl_pnlNetwork);
248 gl_pnlNetwork.setHorizontalGroup(
249 gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
250 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNetwork.createSequentialGroup()
252 .addGroup(gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.TRAILING)
253 .addComponent(pnlAccount, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
254 .addComponent(pnlCookie, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
255 .addComponent(pnlProxy, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
259 gl_pnlNetwork.setVerticalGroup(
260 gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
261 .addGroup(gl_pnlNetwork.createSequentialGroup()
263 .addComponent(pnlAccount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
264 .addPreferredGap(ComponentPlacement.RELATED)
265 .addComponent(pnlCookie, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
266 .addPreferredGap(ComponentPlacement.RELATED)
267 .addComponent(pnlProxy, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
272 tabbedPane.addTab("ネットワーク", pnlNetwork);
274 pnlFileVideo.setBorder(BorderFactory.createTitledBorder("動画"));
276 pnlFileComment.setBorder(BorderFactory.createTitledBorder("コメント"));
278 pnlFileOutput.setBorder(BorderFactory.createTitledBorder("変換動画"));
280 lblOutputDir.setText("保存フォルダ");
282 lblOutputFileNamePattern.setText("ファイル名規則");
284 btnOutputDir.addActionListener(
285 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldOutputDir));
287 cbOutputEnable.setText("変換");
289 cbOutputCommentOverlay.setText("コメント付与");
291 cbOutputDisplayProgress.setText("変換中動画表示");
293 GroupLayout gl_pnlFileOutput = new GroupLayout(pnlFileOutput);
294 pnlFileOutput.setLayout(gl_pnlFileOutput);
295 gl_pnlFileOutput.setHorizontalGroup(
296 gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
297 .addGroup(gl_pnlFileOutput.createSequentialGroup()
299 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
300 .addComponent(lblOutputFileNamePattern)
301 .addComponent(lblOutputDir))
302 .addPreferredGap(ComponentPlacement.RELATED)
303 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
304 .addGroup(gl_pnlFileOutput.createSequentialGroup()
305 .addComponent(fldOutputDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
306 .addPreferredGap(ComponentPlacement.RELATED)
307 .addComponent(btnOutputDir)
309 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileOutput.createSequentialGroup()
310 .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
311 .addPreferredGap(ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
312 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
313 .addComponent(cbOutputDisplayProgress)
314 .addGroup(gl_pnlFileOutput.createSequentialGroup()
315 .addComponent(cbOutputEnable)
316 .addPreferredGap(ComponentPlacement.RELATED)
317 .addComponent(cbOutputCommentOverlay))))))
319 gl_pnlFileOutput.setVerticalGroup(
320 gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
321 .addGroup(gl_pnlFileOutput.createSequentialGroup()
322 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
323 .addComponent(lblOutputDir)
324 .addComponent(fldOutputDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
325 .addComponent(btnOutputDir))
326 .addPreferredGap(ComponentPlacement.RELATED)
327 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
328 .addComponent(lblOutputFileNamePattern)
329 .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
330 .addComponent(cbOutputCommentOverlay)
331 .addComponent(cbOutputEnable))
332 .addPreferredGap(ComponentPlacement.RELATED)
333 .addComponent(cbOutputDisplayProgress)
334 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
337 final JPanel pnlFileProhibit = new JPanel();
338 pnlFileProhibit.setBorder(BorderFactory.createTitledBorder("禁則文字"));
339 final JLabel lblReplaceFrom = new JLabel("置換対象文字");
340 final JLabel lblReplaceTo = new JLabel("置換後文字");
342 final GroupLayout glProhibit = new GroupLayout(pnlFileProhibit);
343 glProhibit.setAutoCreateContainerGaps(true);
344 glProhibit.setAutoCreateGaps(true);
345 pnlFileProhibit.setLayout(glProhibit);
347 glProhibit.setHorizontalGroup(glProhibit.createSequentialGroup()
348 .addGroup(glProhibit.createParallelGroup()
349 .addComponent(lblReplaceFrom)
350 .addComponent(lblReplaceTo)
352 .addGroup(glProhibit.createParallelGroup()
353 .addComponent(fldReplaceFrom)
354 .addComponent(fldReplaceTo)
358 glProhibit.setVerticalGroup(glProhibit.createSequentialGroup()
359 .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
360 .addComponent(lblReplaceFrom)
361 .addComponent(fldReplaceFrom)
363 .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
364 .addComponent(lblReplaceTo)
365 .addComponent(fldReplaceTo)
369 GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
370 pnlFile.setLayout(gl_pnlFile);
371 gl_pnlFile.setHorizontalGroup(
372 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
373 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
375 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
376 .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
377 .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
378 .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
379 .addComponent(pnlFileProhibit, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
383 gl_pnlFile.setVerticalGroup(
384 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
385 .addGroup(gl_pnlFile.createSequentialGroup()
387 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
388 .addPreferredGap(ComponentPlacement.RELATED)
389 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
390 .addPreferredGap(ComponentPlacement.RELATED)
391 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
392 .addPreferredGap(ComponentPlacement.RELATED)
393 .addComponent(pnlFileProhibit, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
397 tabbedPane.addTab("ファイル", pnlFile);
399 pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
401 lblCommentSize.setText("再生時間に応じたコメントの取得数");
403 lblCommentSizeManual.setText("手動取得");
405 lblCommentMinSize.setText("1分当たりのコメント取得数");
407 lblCommentMinSizeManual.setText("手動取得");
409 lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
411 lblCommentDisplayMaxManual.setText("手動設定");
413 GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
414 pnlCommentStandard.setLayout(gl_pnlCommentStandard);
415 gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
416 gl_pnlCommentStandard.setAutoCreateGaps(true);
417 gl_pnlCommentStandard.setHorizontalGroup(
418 gl_pnlCommentStandard.createSequentialGroup()
419 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
420 .addComponent(lblCommentSize)
421 .addComponent(lblCommentMinSize)
422 .addComponent(lblCommentDisplayMax))
423 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
424 .addComponent(cbCommentSizeAuto)
425 .addComponent(cbCommentMinDisable)
426 .addComponent(cbCommentMinSizeAuto)
427 .addComponent(cbCommentDisplaySizeDefault))
428 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
429 .addComponent(lblCommentSizeManual)
430 .addComponent(lblCommentMinSizeManual)
431 .addComponent(lblCommentDisplayMaxManual))
432 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
433 .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
434 .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
435 .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
437 gl_pnlCommentStandard.setVerticalGroup(
438 gl_pnlCommentStandard.createSequentialGroup()
439 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
440 .addComponent(lblCommentSize)
441 .addComponent(cbCommentSizeAuto)
442 .addComponent(lblCommentSizeManual)
443 .addComponent(fldCommentSizeManual))
444 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
445 .addComponent(lblCommentMinSize)
446 .addComponent(cbCommentMinDisable)
448 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
449 .addComponent(cbCommentMinSizeAuto)
450 .addComponent(lblCommentMinSizeManual)
451 .addComponent(fldCommentMinSizeManual))
452 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
453 .addComponent(lblCommentDisplayMax)
454 .addComponent(cbCommentDisplaySizeDefault)
455 .addComponent(lblCommentDisplayMaxManual)
456 .addComponent(fldCommentDisplaySizeManual))
459 pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
461 lblFontPath.setText("フォントパス");
463 cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
465 cbCommentOpaque.setText("コメント透明化を行わない");
467 final JButton btnFontPath = new JButton("...");
468 btnFontPath.addActionListener(
469 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
471 lblFontIndex.setText("フォント番号");
473 lblFontShadow.setText("影の種類");
474 final ComboBoxModel<String> cbmFontShadow
475 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
476 cmbFontShadow.setModel(cbmFontShadow);
478 GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
479 pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
480 gl_pnlCommentAdvanced.setHorizontalGroup(
481 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
482 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
484 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
485 .addComponent(cbCommentOpaque)
486 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
487 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
488 .addComponent(lblFontPath)
489 .addComponent(lblFontIndex)
490 .addComponent(lblFontShadow))
492 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
493 .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
494 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
495 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
496 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
497 .addPreferredGap(ComponentPlacement.RELATED)
498 .addComponent(btnFontPath))
499 .addComponent(cbFontSizeArrangeDisable))
502 gl_pnlCommentAdvanced.setVerticalGroup(
503 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
504 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
505 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
506 .addComponent(lblFontPath)
507 .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
508 .addComponent(btnFontPath))
509 .addPreferredGap(ComponentPlacement.RELATED)
510 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
511 .addComponent(lblFontIndex)
512 .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
513 .addPreferredGap(ComponentPlacement.RELATED)
514 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
515 .addComponent(lblFontShadow)
516 .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
517 .addPreferredGap(ComponentPlacement.RELATED)
518 .addComponent(cbFontSizeArrangeDisable)
519 .addPreferredGap(ComponentPlacement.RELATED)
520 .addComponent(cbCommentOpaque)
521 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
524 GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
525 pnlComment.setLayout(gl_pnlComment);
526 gl_pnlComment.setHorizontalGroup(
527 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
528 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
530 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
531 .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
532 .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
535 gl_pnlComment.setVerticalGroup(
536 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
537 .addGroup(gl_pnlComment.createSequentialGroup()
539 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
540 .addPreferredGap(ComponentPlacement.RELATED)
541 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
542 .addContainerGap(168, Short.MAX_VALUE))
545 tabbedPane.addTab("コメント", pnlComment);
547 pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
549 final JButton btnFfmpegPath = new JButton("...");
550 btnFfmpegPath.addActionListener(
551 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
553 final JButton btnFfmpegDllPath = new JButton("...");
554 btnFfmpegDllPath.addActionListener(
555 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
557 final JButton btnMediaInfoPath = new JButton("...");
558 btnMediaInfoPath.addActionListener(
559 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldMediaInfoPath));
561 GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath);
562 pnlFfmpegBinPath.setLayout(gl_jPanel10);
563 gl_jPanel10.setHorizontalGroup(
564 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
565 .addGroup(gl_jPanel10.createSequentialGroup()
567 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
568 .addComponent(lblFfmpegPath)
569 .addComponent(lblFfmpegDllPath)
570 .addComponent(lblMediaInfoPath)
572 .addPreferredGap(ComponentPlacement.RELATED)
573 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
574 .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
575 .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
576 .addComponent(fldMediaInfoPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
578 .addPreferredGap(ComponentPlacement.RELATED)
579 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
580 .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
581 .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING)
582 .addComponent(btnMediaInfoPath, GroupLayout.Alignment.TRAILING)
586 gl_jPanel10.setVerticalGroup(
587 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
588 .addGroup(gl_jPanel10.createSequentialGroup()
589 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
590 .addComponent(lblFfmpegPath)
591 .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
592 .addComponent(btnFfmpegPath))
593 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
594 .addComponent(lblFfmpegDllPath)
595 .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
596 .addComponent(btnFfmpegDllPath))
597 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
598 .addComponent(lblMediaInfoPath)
599 .addComponent(fldMediaInfoPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
600 .addComponent(btnMediaInfoPath))
604 pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
607 final JPanel pnlFffmpegEtc = new JPanel();
608 pnlFffmpegEtc.setBorder(BorderFactory.createTitledBorder("その他"));
609 final GroupLayout glFfmpegEtc = new GroupLayout(pnlFffmpegEtc);
610 glFfmpegEtc.setAutoCreateContainerGaps(true);
611 glFfmpegEtc.setAutoCreateGaps(true);
612 pnlFffmpegEtc.setLayout(glFfmpegEtc);
614 glFfmpegEtc.setHorizontalGroup(glFfmpegEtc.createParallelGroup()
615 .addComponent(cbDisplayConverting)
616 .addComponent(cbDllDisabled)
618 glFfmpegEtc.setVerticalGroup(glFfmpegEtc.createSequentialGroup()
619 .addComponent(cbDisplayConverting)
620 .addComponent(cbDllDisabled)
623 final GroupLayout glFfmpeg = new GroupLayout(pnlFfmpeg);
624 glFfmpeg.setAutoCreateContainerGaps(true);
625 pnlFfmpeg.setLayout(glFfmpeg);
626 glFfmpeg.setHorizontalGroup(glFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
627 .addComponent(pnlFfmpegBinPath)
628 .addComponent(pnlFfmpegParam)
629 .addComponent(pnlFffmpegEtc)
631 glFfmpeg.setVerticalGroup(glFfmpeg.createSequentialGroup()
632 .addComponent(pnlFfmpegBinPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
633 .addPreferredGap(ComponentPlacement.RELATED)
634 .addComponent(pnlFfmpegParam)
635 .addComponent(pnlFffmpegEtc)
638 tabbedPane.addTab("ffmpeg", pnlFfmpeg);
640 pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
641 pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
643 GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
644 pnlNgSetting.setLayout(gl_pnlNgSetting);
645 gl_pnlNgSetting.setHorizontalGroup(
646 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
647 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
649 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
650 .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
651 .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
654 gl_pnlNgSetting.setVerticalGroup(
655 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
656 .addGroup(gl_pnlNgSetting.createSequentialGroup()
658 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
659 .addPreferredGap(ComponentPlacement.RELATED)
660 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
664 tabbedPane.addTab("NG設定", pnlNgSetting);
666 pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
667 pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
669 final JLabel lblSearchNeedReboot = new JLabel(NEED_REBOOT);
671 GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
672 pnlSearch.setLayout(gl_pnlSearch);
673 gl_pnlSearch.setHorizontalGroup(
674 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
675 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
677 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
678 .addComponent(lblSearchNeedReboot, Alignment.CENTER)
679 .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
680 .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
683 gl_pnlSearch.setVerticalGroup(
684 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
685 .addGroup(gl_pnlSearch.createSequentialGroup()
687 .addComponent(lblSearchNeedReboot)
688 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
689 .addPreferredGap(ComponentPlacement.RELATED)
690 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
695 tabbedPane.addTab("検索", pnlSearch);
697 final JButton btnOk = new JButton("保存");
698 btnOk.addActionListener(new ActionListener() {
701 public void actionPerformed(ActionEvent e) {
706 final JButton btnCancel = new JButton("取消");
707 btnCancel.addActionListener(new ActionListener() {
710 public void actionPerformed(ActionEvent e) {
714 final JPanel pnlButton = new JPanel();
716 final GroupLayout glButton = new GroupLayout(pnlButton);
717 pnlButton.setLayout(glButton);
718 glButton.setHorizontalGroup(glButton.createSequentialGroup()
719 .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
721 .addPreferredGap(ComponentPlacement.UNRELATED)
722 .addComponent(btnCancel)
725 glButton.setVerticalGroup(glButton.createSequentialGroup()
726 .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
728 .addComponent(btnCancel)
732 GroupLayout layout = new GroupLayout(getContentPane());
733 layout.setAutoCreateContainerGaps(true);
734 getContentPane().setLayout(layout);
735 layout.setHorizontalGroup(
736 layout.createParallelGroup(GroupLayout.Alignment.LEADING)
737 .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
738 .addComponent(pnlButton)
740 layout.setVerticalGroup(
741 layout.createSequentialGroup()
742 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
743 .addComponent(pnlButton)
746 final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
747 final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
748 final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
749 final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
750 final JButton btnSystemTempDir = new JButton("...");
751 btnSystemTempDir.addActionListener(
752 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
754 mdlSystemThreadDownload.setMinimum(1);
755 final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
756 mdlSystemWaitDownload.setMinimum(0);
757 final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
758 mdlSystemThreadConvert.setMinimum(1);
759 final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
761 final JPanel pnlSystemGeneral = new JPanel();
762 pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
763 final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
764 glSystemGenegal.setAutoCreateGaps(true);
765 glSystemGenegal.setAutoCreateContainerGaps(true);
766 pnlSystemGeneral.setLayout(glSystemGenegal);
768 glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
769 .addGroup(glSystemGenegal.createSequentialGroup()
770 .addGroup(glSystemGenegal.createParallelGroup()
771 .addComponent(lblSystemThreadDownload)
772 .addComponent(lblSystemWaitDownload)
773 .addComponent(lblSystemThreadConvert))
774 .addGroup(glSystemGenegal.createParallelGroup()
775 .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
776 .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
777 .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
780 .addGroup(glSystemGenegal.createSequentialGroup()
781 .addComponent(lblSystemTempDir)
782 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
783 .addComponent(btnSystemTempDir)
787 glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
788 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
789 .addComponent(lblSystemThreadDownload)
790 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
791 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
792 .addComponent(lblSystemWaitDownload)
793 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
794 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
795 .addComponent(lblSystemThreadConvert)
796 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
797 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
798 .addComponent(lblSystemTempDir)
799 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
800 .addComponent(btnSystemTempDir)
804 final JLabel lblSystemNeedReboot = new JLabel("設定を有効にするにはいんきゅばすの再起動が必要です");
806 final JPanel pnlSystem = new JPanel();
807 pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
808 final GroupLayout glSystem = new GroupLayout(pnlSystem);
809 glSystem.setAutoCreateGaps(true);
810 glSystem.setAutoCreateContainerGaps(true);
811 pnlSystem.setLayout(glSystem);
813 glSystem.setHorizontalGroup(glSystem.createParallelGroup()
814 .addComponent(lblSystemNeedReboot, Alignment.CENTER)
815 .addComponent(pnlSystemGeneral));
817 glSystem.setVerticalGroup(glSystem.createSequentialGroup()
818 .addComponent(lblSystemNeedReboot)
819 .addComponent(pnlSystemGeneral));
821 tabbedPane.add("システム", pnlSystem);
824 setMinimumSize(getSize());
830 final JRadioButton btnAccount = new JRadioButton("次の情報を使用してログインする");
831 private final JTextField fldMail;
832 private final JPasswordField fldPassword = new JPasswordField();
834 final JRadioButton btnLoginCookie = new JRadioButton("ブラウザのログイン情報を使用してアクセスする");
835 final JRadioButton btnCookieIe = new JRadioButton("IE(7以降) (Windows)");
836 final JRadioButton btnCookieFirefox = new JRadioButton("Firefox(4以降) (Windows)");
837 final JRadioButton btnCookieChrome = new JRadioButton("Google Chrome (Windows)");
838 final JRadioButton btnCookieChromium = new JRadioButton("Chrome派生ブラウザ (Windows)");
839 final JRadioButton btnCookieOpera = new JRadioButton("Opera (Windows)");
840 final JRadioButton btnCookieOther = new JRadioButton("上記以外 - cookie保存ディレクトリを次に入力");
841 final JTextField fldCookie = new JTextField();
843 private final JCheckBox cbProxyUse;
844 private final JTextField fldProxyHost = new JTextField();
845 private final NumberFormattedTextField fldProxyPort = new NumberFormattedTextField();
848 private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
850 private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
852 private final JTextField fldOutputDir;
853 private final JTextField fldOutputFileNamePattern;
854 private final JButton btnOutputDir = new JButton("...");
855 private final JCheckBox cbOutputEnable;
856 private final JCheckBox cbOutputCommentOverlay;
857 private final JCheckBox cbOutputDisplayProgress;
859 private final JTextField fldReplaceFrom = new JTextField();
860 private final JTextField fldReplaceTo = new JTextField();
863 private final JCheckBox cbCommentSizeAuto = new JCheckBox("自動調整");
864 private final NumberFormattedTextField fldCommentSizeManual = new NumberFormattedTextField();
865 private final JCheckBox cbCommentMinDisable = new JCheckBox("少コメ");
866 private final JCheckBox cbCommentMinSizeAuto = new JCheckBox("自動調整");
867 private final NumberFormattedTextField fldCommentMinSizeManual = new NumberFormattedTextField();
868 private final JCheckBox cbCommentDisplaySizeDefault = new JCheckBox("標準(30)");
869 private final NumberFormattedTextField fldCommentDisplaySizeManual = new NumberFormattedTextField();
871 private final JTextField fldFontPath;
872 private final JTextField fldFontIndex;
873 private final JComboBox<String> cmbFontShadow = new JComboBox<>();
874 private final JCheckBox cbFontSizeArrangeDisable;
875 private final JCheckBox cbCommentOpaque;
878 private final JTextField fldFfmpegPath = new JTextField();
879 private final JTextField fldFfmpegDllPath = new JTextField();
880 private final JTextField fldMediaInfoPath = new JTextField();
881 // ffmpeg - ffmpegパラメータ
882 private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
884 private final JCheckBox cbDisplayConverting = new JCheckBox("変換中動画表示");
885 private final JCheckBox cbDllDisabled = new JCheckBox("拡張DLL無効化(デバッグ用)");
888 private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
890 private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
893 private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
895 private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
897 private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
898 private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
899 private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
900 private final JTextField fldSystemTempDir = new JTextField();
903 // End of variables declaration//GEN-END:variables
905 private void loadConfig() {
906 final Config p = Config.INSTANCE;
911 btnAccount.setSelected(p.getNeedsLogin());
912 fldMail.setText(p.getId());
913 fldPassword.setText(p.getPassword());
918 final CookieBrowser cookieBrowser = p.getCookieBrowser();
919 final JRadioButton enabledBrowser;
920 switch(cookieBrowser){
922 enabledBrowser = btnCookieIe;
925 enabledBrowser = btnCookieFirefox;
928 enabledBrowser = btnCookieChrome;
931 enabledBrowser = btnCookieChromium;
934 enabledBrowser = btnCookieOpera;
937 enabledBrowser = btnCookieOther;
940 throw new UnsupportedOperationException();
942 enabledBrowser.setSelected(true);
943 fldCookie.setText(p.getCookieDir());
948 cbProxyUse.setSelected(p.getProxyUse());
949 fldProxyHost.setText(p.getProxyHost());
950 fldProxyPort.setText(p.getProxyPort());
955 pnlFileVideo.fldDir.setText(p.getVideoDir());
956 pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
957 pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
962 pnlFileComment.fldDir.setText(p.getCommentDir());
963 pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
964 pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
969 fldOutputDir.setText(p.getOutputDir());
970 fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
971 cbOutputEnable.setSelected(p.getOutputEnable());
972 cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
973 cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
978 fldReplaceFrom.setText(p.getReplaceFrom());
979 fldReplaceTo.setText(p.getReplaceTo());
984 cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
985 fldCommentSizeManual.setText(p.getCommentSizeManual());
986 cbCommentMinDisable.setSelected(p.getCommentMinDisabled());
987 cbCommentMinSizeAuto.setSelected(p.getCommentMinSizeAutosize());
988 fldCommentSizeManual.setText(p.getCommentMinSizeManual());
989 cbCommentDisplaySizeDefault.setSelected(p.getCommentDisplaySizeDefault());
990 fldCommentDisplaySizeManual.setText(p.getCommentDisplaySizeManual());
995 fldFontPath.setText(p.getFontPath());
996 fldFontIndex.setText(p.getFontIndex());
997 cmbFontShadow.setSelectedIndex(p.getFontShadow());
998 cbFontSizeArrangeDisable.setSelected(p.getFontSizeArrangeDisable());
999 cbCommentOpaque.setSelected(p.getCommentOpaque());
1004 fldFfmpegPath.setText(p.getFfmpegPath());
1005 fldFfmpegDllPath.setText(p.getFfmpegDllPath());
1006 fldMediaInfoPath.setText(p.getMediaInfoPath());
1009 * ffmpeg - ffmpegパラメータ
1011 pnlFfmpegParam.init(p);
1016 cbDisplayConverting.setSelected(p.getFfmpegDisplayConverting());
1017 cbDllDisabled.setSelected(p.getFfmpegDllDisabled());
1022 final List<String> ngWords = p.getNgWords();
1023 pnlNgWord.init(ngWords);
1024 final List<String> ngIds = p.getNgIds();
1025 pnlNgId.init(ngIds);
1030 pnlSearchVideo.init(p.getSearchVideoDirs());
1031 pnlSearchComment.init(p.getSearchCommentDirs());
1036 mdlSystemThreadDownload.setValue(p.getSystemDownloadThread());
1037 mdlSystemWaitDownload.setValue(p.getSystemDownloadWait());
1038 mdlSystemThreadConvert.setValue(p.getSystemConvertThread());
1039 fldSystemTempDir.setText(p.getSystemTempDir());
1042 private void saveConfig() {
1043 final Config p = Config.INSTANCE;
1049 p.setId(fldMail.getText());
1050 p.setPassword(String.valueOf(fldPassword.getPassword()));
1055 p.setProxyUse(cbProxyUse.isSelected());
1056 p.setProxyHost(fldProxyHost.getText());
1057 p.setProxyPort(fldProxyPort.getText());
1062 p.setVideoDir(pnlFileVideo.fldDir.getText());
1063 p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
1064 p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
1069 p.setCommentDir(pnlFileComment.fldDir.getText());
1070 p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
1071 p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
1076 p.setOutputDir(fldOutputDir.getText());
1077 p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
1078 p.setOutputEnable(cbOutputEnable.isSelected());
1079 p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
1080 p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
1085 p.setReplaceFrom(fldReplaceFrom.getText());
1086 p.setReplaceTo(fldReplaceTo.getText());
1091 p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1092 p.setCommentSizeManual(fldCommentSizeManual.getText());
1093 p.setCommentMinDisabled(cbCommentMinDisable.isSelected());
1094 p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1095 p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1096 p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1097 p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1102 p.setFontPath(fldFontPath.getText());
1103 p.setFontIndex(fldFontIndex.getText());
1104 p.setFontShadow(cmbFontShadow.getSelectedIndex());
1105 p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1106 p.setCommentOpaque(cbCommentOpaque.isSelected());
1111 p.setFfmpegPath(fldFfmpegPath.getText());
1112 p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1113 p.setMediaInfoPath(fldMediaInfoPath.getText());
1116 * ffmpeg - ffmpegパラメータ
1118 final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1119 p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1120 p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1121 p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1122 p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1123 p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1124 p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1125 p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1126 p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1127 p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1128 p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1133 p.setFfmpegDisplayConverting(cbDisplayConverting.isSelected());
1134 p.setFfmpegDllDisabled(cbDllDisabled.isSelected());
1139 p.setNgWords(pnlNgWord.getAllElements());
1140 p.setNgIds(pnlNgId.getAllElements());
1145 p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1146 p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1151 p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
1152 p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
1153 p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
1154 p.setSystemTempDir(fldSystemTempDir.getText());
1158 } catch (ConfigurationException ex) {
1159 logger.error("コンフィグファイル保存に失敗", ex);
1164 class DownloadLocationPanel extends JPanel {
1166 private static final long serialVersionUID = 1L;
1167 final JTextField fldDir = new JTextField();
1168 final JTextField fldFileNamePattern = new JTextField();
1169 final JCheckBox cbLocal = new JCheckBox("local");
1171 DownloadLocationPanel(){
1174 final JLabel lblVideoDir = new JLabel("保存フォルダ");
1175 final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1177 final JButton btnDir = new JButton("...");
1178 btnDir.addActionListener(
1179 new FileChooseActionListener(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1181 final GroupLayout gl = new GroupLayout(this);
1183 gl.setHorizontalGroup(
1184 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1185 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1187 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1188 .addComponent(lblVideoFileNamepattern)
1189 .addComponent(lblVideoDir))
1190 .addPreferredGap(ComponentPlacement.RELATED)
1191 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1192 .addGroup(gl.createSequentialGroup()
1193 .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1194 .addPreferredGap(ComponentPlacement.RELATED)
1195 .addComponent(btnDir))
1196 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1197 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1198 .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1199 .addComponent(cbLocal)))
1202 gl.setVerticalGroup(
1203 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1204 .addGroup(gl.createSequentialGroup()
1205 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1206 .addComponent(lblVideoDir)
1207 .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1208 .addComponent(btnDir))
1209 .addPreferredGap(ComponentPlacement.RELATED)
1210 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1211 .addComponent(lblVideoFileNamepattern)
1212 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1213 .addComponent(cbLocal))
1214 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))