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;
46 public class ConfigDialog extends JDialog {
47 private static final long serialVersionUID = 1L;
48 private static final Logger logger = LoggerFactory.getLogger(ConfigDialog.class);
49 private static final String NEED_REBOOT = "設定を有効にするにはいんきゅばすの再起動が必要です";
51 /** Creates new form Properties */
52 public ConfigDialog() {
56 public ConfigDialog(JFrame owner){
59 final JTabbedPane tabbedPane = new JTabbedPane();
60 final JPanel pnlNetwork = new JPanel();
61 final JPanel pnlAccount = new JPanel();
62 final JLabel lblMail = new JLabel();
63 fldMail = new JTextField();
64 fldPassword.setEchoChar('*');
65 final JLabel lblPassword = new JLabel();
66 final JPanel pnlProxy = new JPanel();
67 cbProxyUse = new JCheckBox();
68 final JLabel lblProxyHost = new JLabel();
69 final JLabel lblProxyPort = new JLabel();
70 final JPanel pnlFile = new JPanel();
71 final JPanel pnlFileOutput = new JPanel();
72 final JLabel lblOutputDir = new JLabel();
73 final JLabel lblOutputFileNamePattern = new JLabel();
74 fldOutputDir = new JTextField();
75 fldOutputFileNamePattern = new JTextField();
76 cbOutputEnable = new JCheckBox();
77 cbOutputCommentOverlay = new JCheckBox();
78 cbOutputDisplayProgress = new JCheckBox();
79 final JPanel pnlComment = new JPanel();
80 final JPanel pnlCommentStandard = new JPanel();
81 final JLabel lblCommentSize = new JLabel();
82 final JLabel lblCommentSizeManual = new JLabel();
83 final JLabel lblCommentMinSize = new JLabel();
84 final JLabel lblCommentMinSizeManual = new JLabel();
85 final JLabel lblCommentDisplayMax = new JLabel();
86 final JLabel lblCommentDisplayMaxManual = new JLabel();
87 final JPanel pnlCommentAdvanced = new JPanel();
88 final JLabel lblFontPath = new JLabel();
89 cbFontSizeArrangeDisable = new JCheckBox();
90 cbCommentOpaque = new JCheckBox();
91 fldFontPath = new JTextField();
92 final JLabel lblFontIndex = new JLabel();
93 final JLabel lblFontShadow = new JLabel();
94 fldFontIndex = new JTextField();
95 final JPanel pnlFfmpeg = new JPanel();
96 final JPanel pnlFfmpegBinPath = new JPanel();
97 final JLabel lblFfmpegPath = new JLabel("ffmpeg");
98 final JLabel lblFfmpegDllPath = new JLabel("拡張ライブラリ");
99 final JLabel lblMediaInfoPath = new JLabel("MediaInfo");
100 final JPanel pnlNgSetting = new JPanel();
101 final JPanel pnlSearch = new JPanel();
103 setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
105 pnlNetwork.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
107 pnlAccount.setBorder(BorderFactory.createTitledBorder("アカウント"));
109 lblMail.setText("ID(メールアドレス)");
111 lblPassword.setText("パスワード");
113 GroupLayout gl_pnlAccount = new GroupLayout(pnlAccount);
114 pnlAccount.setLayout(gl_pnlAccount);
115 gl_pnlAccount.setHorizontalGroup(
116 gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
117 .addGroup(gl_pnlAccount.createSequentialGroup()
119 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
120 .addComponent(lblMail)
121 .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))
128 gl_pnlAccount.setVerticalGroup(
129 gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
130 .addGroup(gl_pnlAccount.createSequentialGroup()
132 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
133 .addComponent(lblMail)
134 .addComponent(fldMail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
135 .addPreferredGap(ComponentPlacement.RELATED)
136 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
137 .addComponent(lblPassword)
138 .addComponent(fldPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
139 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
142 pnlProxy.setBorder(BorderFactory.createTitledBorder("プロキシ"));
144 cbProxyUse.setText("プロキシを使用する");
146 lblProxyHost.setText("ホスト名");
148 lblProxyPort.setText("ポート番号");
150 GroupLayout gl_pnlProxy = new GroupLayout(pnlProxy);
151 pnlProxy.setLayout(gl_pnlProxy);
152 gl_pnlProxy.setHorizontalGroup(
153 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
154 .addGroup(gl_pnlProxy.createSequentialGroup()
156 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
157 .addComponent(cbProxyUse)
158 .addGroup(gl_pnlProxy.createSequentialGroup()
159 .addComponent(lblProxyHost)
161 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
162 .addGroup(gl_pnlProxy.createSequentialGroup()
163 .addComponent(lblProxyPort)
164 .addPreferredGap(ComponentPlacement.RELATED)
165 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
166 .addContainerGap(181, Short.MAX_VALUE))
168 gl_pnlProxy.setVerticalGroup(
169 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
170 .addGroup(gl_pnlProxy.createSequentialGroup()
172 .addComponent(cbProxyUse)
173 .addPreferredGap(ComponentPlacement.RELATED)
174 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
175 .addComponent(lblProxyHost)
176 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
177 .addPreferredGap(ComponentPlacement.RELATED)
178 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
179 .addComponent(lblProxyPort)
180 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
185 final JCheckBox cbxCookie = new JCheckBox("ブラウザのログイン情報を使用してアクセスする");
186 final JRadioButton btnCookieIe = new JRadioButton("IE(7以降) (Windows)");
187 final JRadioButton btnCookieFirefox = new JRadioButton("Firefox(4以降) (Windows)");
188 final JRadioButton btnCookieChrome = new JRadioButton("Google Chrome (Windows)");
189 final JRadioButton btnCookieChromium = new JRadioButton("Chrome派生ブラウザ (Windows)");
190 final JRadioButton btnCookieOpera = new JRadioButton("Opera (Windows)");
191 final JRadioButton btnCookieOther = new JRadioButton("上記以外 - cookie保存ディレクトリを次に入力");
192 final JTextField fldCookie = new JTextField();
193 final JButton btnCookie = new JButton("...");
194 btnCookie.addActionListener(new FileChooseActionListener(this, JFileChooser.DIRECTORIES_ONLY, fldCookie));
196 final ButtonGroup grpCookie = new ButtonGroup();
197 grpCookie.add(btnCookieIe);
198 grpCookie.add(btnCookieFirefox);
199 grpCookie.add(btnCookieChrome);
200 grpCookie.add(btnCookieChromium);
201 grpCookie.add(btnCookieOpera);
202 grpCookie.add(btnCookieOther);
204 final JPanel pnlCookie = new JPanel();
205 pnlCookie.setBorder(BorderFactory.createTitledBorder("cookie"));
206 final GroupLayout glCookie = new GroupLayout(pnlCookie);
207 pnlCookie.setLayout(glCookie);
208 glCookie.setAutoCreateContainerGaps(true);
209 glCookie.setAutoCreateGaps(true);
211 glCookie.setHorizontalGroup(glCookie.createParallelGroup()
212 .addComponent(cbxCookie)
213 .addGroup(glCookie.createSequentialGroup()
215 .addGroup(glCookie.createParallelGroup()
216 .addComponent(btnCookieIe)
217 .addComponent(btnCookieFirefox)
218 .addComponent(btnCookieChrome)
219 .addComponent(btnCookieChromium)
220 .addComponent(btnCookieOpera)
221 .addComponent(btnCookieOther)
222 .addGroup(glCookie.createSequentialGroup()
223 .addComponent(fldCookie)
224 .addComponent(btnCookie)
230 glCookie.setVerticalGroup(glCookie.createSequentialGroup()
231 .addComponent(cbxCookie)
232 .addComponent(btnCookieIe)
233 .addComponent(btnCookieFirefox)
234 .addComponent(btnCookieChrome)
235 .addComponent(btnCookieChromium)
236 .addComponent(btnCookieOpera)
237 .addComponent(btnCookieOther)
238 .addGroup(glCookie.createParallelGroup(Alignment.BASELINE)
239 .addComponent(fldCookie)
240 .addComponent(btnCookie)
245 GroupLayout gl_pnlNetwork = new GroupLayout(pnlNetwork);
246 pnlNetwork.setLayout(gl_pnlNetwork);
247 gl_pnlNetwork.setHorizontalGroup(
248 gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
249 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNetwork.createSequentialGroup()
251 .addGroup(gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.TRAILING)
252 .addComponent(pnlProxy, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
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)
258 gl_pnlNetwork.setVerticalGroup(
259 gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
260 .addGroup(gl_pnlNetwork.createSequentialGroup()
262 .addComponent(pnlAccount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
263 .addPreferredGap(ComponentPlacement.RELATED)
264 .addComponent(pnlProxy, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
265 .addPreferredGap(ComponentPlacement.RELATED)
266 .addComponent(pnlCookie, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
271 tabbedPane.addTab("ネットワーク", pnlNetwork);
273 pnlFileVideo.setBorder(BorderFactory.createTitledBorder("動画"));
275 pnlFileComment.setBorder(BorderFactory.createTitledBorder("コメント"));
277 pnlFileOutput.setBorder(BorderFactory.createTitledBorder("変換動画"));
279 lblOutputDir.setText("保存フォルダ");
281 lblOutputFileNamePattern.setText("ファイル名規則");
283 btnOutputDir.addActionListener(
284 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldOutputDir));
286 cbOutputEnable.setText("変換");
288 cbOutputCommentOverlay.setText("コメント付与");
290 cbOutputDisplayProgress.setText("変換中動画表示");
292 GroupLayout gl_pnlFileOutput = new GroupLayout(pnlFileOutput);
293 pnlFileOutput.setLayout(gl_pnlFileOutput);
294 gl_pnlFileOutput.setHorizontalGroup(
295 gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
296 .addGroup(gl_pnlFileOutput.createSequentialGroup()
298 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
299 .addComponent(lblOutputFileNamePattern)
300 .addComponent(lblOutputDir))
301 .addPreferredGap(ComponentPlacement.RELATED)
302 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
303 .addGroup(gl_pnlFileOutput.createSequentialGroup()
304 .addComponent(fldOutputDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
305 .addPreferredGap(ComponentPlacement.RELATED)
306 .addComponent(btnOutputDir)
308 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileOutput.createSequentialGroup()
309 .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
310 .addPreferredGap(ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
311 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
312 .addComponent(cbOutputDisplayProgress)
313 .addGroup(gl_pnlFileOutput.createSequentialGroup()
314 .addComponent(cbOutputEnable)
315 .addPreferredGap(ComponentPlacement.RELATED)
316 .addComponent(cbOutputCommentOverlay))))))
318 gl_pnlFileOutput.setVerticalGroup(
319 gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
320 .addGroup(gl_pnlFileOutput.createSequentialGroup()
321 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
322 .addComponent(lblOutputDir)
323 .addComponent(fldOutputDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
324 .addComponent(btnOutputDir))
325 .addPreferredGap(ComponentPlacement.RELATED)
326 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
327 .addComponent(lblOutputFileNamePattern)
328 .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
329 .addComponent(cbOutputCommentOverlay)
330 .addComponent(cbOutputEnable))
331 .addPreferredGap(ComponentPlacement.RELATED)
332 .addComponent(cbOutputDisplayProgress)
333 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
336 final JPanel pnlFileProhibit = new JPanel();
337 pnlFileProhibit.setBorder(BorderFactory.createTitledBorder("禁則文字"));
338 final JLabel lblReplaceFrom = new JLabel("置換対象文字");
339 final JLabel lblReplaceTo = new JLabel("置換後文字");
341 final GroupLayout glProhibit = new GroupLayout(pnlFileProhibit);
342 glProhibit.setAutoCreateContainerGaps(true);
343 glProhibit.setAutoCreateGaps(true);
344 pnlFileProhibit.setLayout(glProhibit);
346 glProhibit.setHorizontalGroup(glProhibit.createSequentialGroup()
347 .addGroup(glProhibit.createParallelGroup()
348 .addComponent(lblReplaceFrom)
349 .addComponent(lblReplaceTo)
351 .addGroup(glProhibit.createParallelGroup()
352 .addComponent(fldReplaceFrom)
353 .addComponent(fldReplaceTo)
357 glProhibit.setVerticalGroup(glProhibit.createSequentialGroup()
358 .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
359 .addComponent(lblReplaceFrom)
360 .addComponent(fldReplaceFrom)
362 .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
363 .addComponent(lblReplaceTo)
364 .addComponent(fldReplaceTo)
368 GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
369 pnlFile.setLayout(gl_pnlFile);
370 gl_pnlFile.setHorizontalGroup(
371 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
372 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
374 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
375 .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
376 .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
377 .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
378 .addComponent(pnlFileProhibit, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
382 gl_pnlFile.setVerticalGroup(
383 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
384 .addGroup(gl_pnlFile.createSequentialGroup()
386 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
387 .addPreferredGap(ComponentPlacement.RELATED)
388 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
389 .addPreferredGap(ComponentPlacement.RELATED)
390 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
391 .addPreferredGap(ComponentPlacement.RELATED)
392 .addComponent(pnlFileProhibit, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
396 tabbedPane.addTab("ファイル", pnlFile);
398 pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
400 lblCommentSize.setText("再生時間に応じたコメントの取得数");
402 lblCommentSizeManual.setText("手動取得");
404 lblCommentMinSize.setText("1分当たりのコメント取得数");
406 lblCommentMinSizeManual.setText("手動取得");
408 lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
410 lblCommentDisplayMaxManual.setText("手動設定");
412 GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
413 pnlCommentStandard.setLayout(gl_pnlCommentStandard);
414 gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
415 gl_pnlCommentStandard.setAutoCreateGaps(true);
416 gl_pnlCommentStandard.setHorizontalGroup(
417 gl_pnlCommentStandard.createSequentialGroup()
418 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
419 .addComponent(lblCommentSize)
420 .addComponent(lblCommentMinSize)
421 .addComponent(lblCommentDisplayMax))
422 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
423 .addComponent(cbCommentSizeAuto)
424 .addComponent(cbCommentMinDisable)
425 .addComponent(cbCommentMinSizeAuto)
426 .addComponent(cbCommentDisplaySizeDefault))
427 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
428 .addComponent(lblCommentSizeManual)
429 .addComponent(lblCommentMinSizeManual)
430 .addComponent(lblCommentDisplayMaxManual))
431 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
432 .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
433 .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
434 .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
436 gl_pnlCommentStandard.setVerticalGroup(
437 gl_pnlCommentStandard.createSequentialGroup()
438 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
439 .addComponent(lblCommentSize)
440 .addComponent(cbCommentSizeAuto)
441 .addComponent(lblCommentSizeManual)
442 .addComponent(fldCommentSizeManual))
443 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
444 .addComponent(lblCommentMinSize)
445 .addComponent(cbCommentMinDisable)
447 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
448 .addComponent(cbCommentMinSizeAuto)
449 .addComponent(lblCommentMinSizeManual)
450 .addComponent(fldCommentMinSizeManual))
451 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
452 .addComponent(lblCommentDisplayMax)
453 .addComponent(cbCommentDisplaySizeDefault)
454 .addComponent(lblCommentDisplayMaxManual)
455 .addComponent(fldCommentDisplaySizeManual))
458 pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
460 lblFontPath.setText("フォントパス");
462 cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
464 cbCommentOpaque.setText("コメント透明化を行わない");
466 final JButton btnFontPath = new JButton("...");
467 btnFontPath.addActionListener(
468 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
470 lblFontIndex.setText("フォント番号");
472 lblFontShadow.setText("影の種類");
473 final ComboBoxModel<String> cbmFontShadow
474 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
475 cmbFontShadow.setModel(cbmFontShadow);
477 GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
478 pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
479 gl_pnlCommentAdvanced.setHorizontalGroup(
480 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
481 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
483 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
484 .addComponent(cbCommentOpaque)
485 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
486 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
487 .addComponent(lblFontPath)
488 .addComponent(lblFontIndex)
489 .addComponent(lblFontShadow))
491 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
492 .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
493 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
494 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
495 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
496 .addPreferredGap(ComponentPlacement.RELATED)
497 .addComponent(btnFontPath))
498 .addComponent(cbFontSizeArrangeDisable))
501 gl_pnlCommentAdvanced.setVerticalGroup(
502 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
503 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
504 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
505 .addComponent(lblFontPath)
506 .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
507 .addComponent(btnFontPath))
508 .addPreferredGap(ComponentPlacement.RELATED)
509 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
510 .addComponent(lblFontIndex)
511 .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
512 .addPreferredGap(ComponentPlacement.RELATED)
513 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
514 .addComponent(lblFontShadow)
515 .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
516 .addPreferredGap(ComponentPlacement.RELATED)
517 .addComponent(cbFontSizeArrangeDisable)
518 .addPreferredGap(ComponentPlacement.RELATED)
519 .addComponent(cbCommentOpaque)
520 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
523 GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
524 pnlComment.setLayout(gl_pnlComment);
525 gl_pnlComment.setHorizontalGroup(
526 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
527 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
529 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
530 .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
531 .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
534 gl_pnlComment.setVerticalGroup(
535 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
536 .addGroup(gl_pnlComment.createSequentialGroup()
538 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
539 .addPreferredGap(ComponentPlacement.RELATED)
540 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
541 .addContainerGap(168, Short.MAX_VALUE))
544 tabbedPane.addTab("コメント", pnlComment);
546 pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
548 final JButton btnFfmpegPath = new JButton("...");
549 btnFfmpegPath.addActionListener(
550 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
552 final JButton btnFfmpegDllPath = new JButton("...");
553 btnFfmpegDllPath.addActionListener(
554 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
556 final JButton btnMediaInfoPath = new JButton("...");
557 btnMediaInfoPath.addActionListener(
558 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldMediaInfoPath));
560 GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath);
561 pnlFfmpegBinPath.setLayout(gl_jPanel10);
562 gl_jPanel10.setHorizontalGroup(
563 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
564 .addGroup(gl_jPanel10.createSequentialGroup()
566 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
567 .addComponent(lblFfmpegPath)
568 .addComponent(lblFfmpegDllPath)
569 .addComponent(lblMediaInfoPath)
571 .addPreferredGap(ComponentPlacement.RELATED)
572 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
573 .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
574 .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
575 .addComponent(fldMediaInfoPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
577 .addPreferredGap(ComponentPlacement.RELATED)
578 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
579 .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
580 .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING)
581 .addComponent(btnMediaInfoPath, GroupLayout.Alignment.TRAILING)
585 gl_jPanel10.setVerticalGroup(
586 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
587 .addGroup(gl_jPanel10.createSequentialGroup()
588 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
589 .addComponent(lblFfmpegPath)
590 .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
591 .addComponent(btnFfmpegPath))
592 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
593 .addComponent(lblFfmpegDllPath)
594 .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
595 .addComponent(btnFfmpegDllPath))
596 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
597 .addComponent(lblMediaInfoPath)
598 .addComponent(fldMediaInfoPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
599 .addComponent(btnMediaInfoPath))
603 pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
606 final JPanel pnlFffmpegEtc = new JPanel();
607 pnlFffmpegEtc.setBorder(BorderFactory.createTitledBorder("その他"));
608 final GroupLayout glFfmpegEtc = new GroupLayout(pnlFffmpegEtc);
609 glFfmpegEtc.setAutoCreateContainerGaps(true);
610 glFfmpegEtc.setAutoCreateGaps(true);
611 pnlFffmpegEtc.setLayout(glFfmpegEtc);
613 glFfmpegEtc.setHorizontalGroup(glFfmpegEtc.createParallelGroup()
614 .addComponent(cbDisplayConverting)
615 .addComponent(cbDllDisabled)
617 glFfmpegEtc.setVerticalGroup(glFfmpegEtc.createSequentialGroup()
618 .addComponent(cbDisplayConverting)
619 .addComponent(cbDllDisabled)
622 final GroupLayout glFfmpeg = new GroupLayout(pnlFfmpeg);
623 glFfmpeg.setAutoCreateContainerGaps(true);
624 pnlFfmpeg.setLayout(glFfmpeg);
625 glFfmpeg.setHorizontalGroup(glFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
626 .addComponent(pnlFfmpegBinPath)
627 .addComponent(pnlFfmpegParam)
628 .addComponent(pnlFffmpegEtc)
630 glFfmpeg.setVerticalGroup(glFfmpeg.createSequentialGroup()
631 .addComponent(pnlFfmpegBinPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
632 .addPreferredGap(ComponentPlacement.RELATED)
633 .addComponent(pnlFfmpegParam)
634 .addComponent(pnlFffmpegEtc)
637 tabbedPane.addTab("ffmpeg", pnlFfmpeg);
639 pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
640 pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
642 GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
643 pnlNgSetting.setLayout(gl_pnlNgSetting);
644 gl_pnlNgSetting.setHorizontalGroup(
645 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
646 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
648 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
649 .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
650 .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
653 gl_pnlNgSetting.setVerticalGroup(
654 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
655 .addGroup(gl_pnlNgSetting.createSequentialGroup()
657 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
658 .addPreferredGap(ComponentPlacement.RELATED)
659 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
663 tabbedPane.addTab("NG設定", pnlNgSetting);
665 pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
666 pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
668 final JLabel lblSearchNeedReboot = new JLabel(NEED_REBOOT);
670 GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
671 pnlSearch.setLayout(gl_pnlSearch);
672 gl_pnlSearch.setHorizontalGroup(
673 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
674 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
676 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
677 .addComponent(lblSearchNeedReboot, Alignment.CENTER)
678 .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
679 .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
682 gl_pnlSearch.setVerticalGroup(
683 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
684 .addGroup(gl_pnlSearch.createSequentialGroup()
686 .addComponent(lblSearchNeedReboot)
687 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
688 .addPreferredGap(ComponentPlacement.RELATED)
689 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
694 tabbedPane.addTab("検索", pnlSearch);
696 final JButton btnOk = new JButton("保存");
697 btnOk.addActionListener(new ActionListener() {
700 public void actionPerformed(ActionEvent e) {
705 final JButton btnCancel = new JButton("取消");
706 btnCancel.addActionListener(new ActionListener() {
709 public void actionPerformed(ActionEvent e) {
713 final JPanel pnlButton = new JPanel();
715 final GroupLayout glButton = new GroupLayout(pnlButton);
716 pnlButton.setLayout(glButton);
717 glButton.setHorizontalGroup(glButton.createSequentialGroup()
718 .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
720 .addPreferredGap(ComponentPlacement.UNRELATED)
721 .addComponent(btnCancel)
724 glButton.setVerticalGroup(glButton.createSequentialGroup()
725 .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
727 .addComponent(btnCancel)
731 GroupLayout layout = new GroupLayout(getContentPane());
732 layout.setAutoCreateContainerGaps(true);
733 getContentPane().setLayout(layout);
734 layout.setHorizontalGroup(
735 layout.createParallelGroup(GroupLayout.Alignment.LEADING)
736 .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
737 .addComponent(pnlButton)
739 layout.setVerticalGroup(
740 layout.createSequentialGroup()
741 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
742 .addComponent(pnlButton)
745 final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
746 final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
747 final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
748 final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
749 final JButton btnSystemTempDir = new JButton("...");
750 btnSystemTempDir.addActionListener(
751 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
753 mdlSystemThreadDownload.setMinimum(1);
754 final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
755 mdlSystemWaitDownload.setMinimum(0);
756 final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
757 mdlSystemThreadConvert.setMinimum(1);
758 final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
760 final JPanel pnlSystemGeneral = new JPanel();
761 pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
762 final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
763 glSystemGenegal.setAutoCreateGaps(true);
764 glSystemGenegal.setAutoCreateContainerGaps(true);
765 pnlSystemGeneral.setLayout(glSystemGenegal);
767 glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
768 .addGroup(glSystemGenegal.createSequentialGroup()
769 .addGroup(glSystemGenegal.createParallelGroup()
770 .addComponent(lblSystemThreadDownload)
771 .addComponent(lblSystemWaitDownload)
772 .addComponent(lblSystemThreadConvert))
773 .addGroup(glSystemGenegal.createParallelGroup()
774 .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
775 .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
776 .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
779 .addGroup(glSystemGenegal.createSequentialGroup()
780 .addComponent(lblSystemTempDir)
781 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
782 .addComponent(btnSystemTempDir)
786 glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
787 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
788 .addComponent(lblSystemThreadDownload)
789 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
790 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
791 .addComponent(lblSystemWaitDownload)
792 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
793 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
794 .addComponent(lblSystemThreadConvert)
795 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
796 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
797 .addComponent(lblSystemTempDir)
798 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
799 .addComponent(btnSystemTempDir)
803 final JLabel lblSystemNeedReboot = new JLabel("設定を有効にするにはいんきゅばすの再起動が必要です");
805 final JPanel pnlSystem = new JPanel();
806 pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
807 final GroupLayout glSystem = new GroupLayout(pnlSystem);
808 glSystem.setAutoCreateGaps(true);
809 glSystem.setAutoCreateContainerGaps(true);
810 pnlSystem.setLayout(glSystem);
812 glSystem.setHorizontalGroup(glSystem.createParallelGroup()
813 .addComponent(lblSystemNeedReboot, Alignment.CENTER)
814 .addComponent(pnlSystemGeneral));
816 glSystem.setVerticalGroup(glSystem.createSequentialGroup()
817 .addComponent(lblSystemNeedReboot)
818 .addComponent(pnlSystemGeneral));
820 tabbedPane.add("システム", pnlSystem);
823 setMinimumSize(getSize());
829 private final JTextField fldMail;
830 private final JPasswordField fldPassword = new JPasswordField();
832 private final JCheckBox cbProxyUse;
833 private final JTextField fldProxyHost = new JTextField();
834 private final NumberFormattedTextField fldProxyPort = new NumberFormattedTextField();
837 private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
839 private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
841 private final JTextField fldOutputDir;
842 private final JTextField fldOutputFileNamePattern;
843 private final JButton btnOutputDir = new JButton("...");
844 private final JCheckBox cbOutputEnable;
845 private final JCheckBox cbOutputCommentOverlay;
846 private final JCheckBox cbOutputDisplayProgress;
848 private final JTextField fldReplaceFrom = new JTextField();
849 private final JTextField fldReplaceTo = new JTextField();
852 private final JCheckBox cbCommentSizeAuto = new JCheckBox("自動調整");
853 private final NumberFormattedTextField fldCommentSizeManual = new NumberFormattedTextField();
854 private final JCheckBox cbCommentMinDisable = new JCheckBox("少コメ");
855 private final JCheckBox cbCommentMinSizeAuto = new JCheckBox("自動調整");
856 private final NumberFormattedTextField fldCommentMinSizeManual = new NumberFormattedTextField();
857 private final JCheckBox cbCommentDisplaySizeDefault = new JCheckBox("標準(30)");
858 private final NumberFormattedTextField fldCommentDisplaySizeManual = new NumberFormattedTextField();
860 private final JTextField fldFontPath;
861 private final JTextField fldFontIndex;
862 private final JComboBox<String> cmbFontShadow = new JComboBox<>();
863 private final JCheckBox cbFontSizeArrangeDisable;
864 private final JCheckBox cbCommentOpaque;
867 private final JTextField fldFfmpegPath = new JTextField();
868 private final JTextField fldFfmpegDllPath = new JTextField();
869 private final JTextField fldMediaInfoPath = new JTextField();
870 // ffmpeg - ffmpegパラメータ
871 private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
873 private final JCheckBox cbDisplayConverting = new JCheckBox("変換中動画表示");
874 private final JCheckBox cbDllDisabled = new JCheckBox("拡張DLL無効化(デバッグ用)");
877 private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
879 private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
882 private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
884 private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
886 private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
887 private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
888 private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
889 private final JTextField fldSystemTempDir = new JTextField();
892 // End of variables declaration//GEN-END:variables
894 private void loadConfig() {
895 final Config p = Config.INSTANCE;
900 fldMail.setText(p.getId());
901 fldPassword.setText(p.getPassword());
906 cbProxyUse.setSelected(p.getProxyUse());
907 fldProxyHost.setText(p.getProxyHost());
908 fldProxyPort.setText(p.getProxyPort());
913 pnlFileVideo.fldDir.setText(p.getVideoDir());
914 pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
915 pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
920 pnlFileComment.fldDir.setText(p.getCommentDir());
921 pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
922 pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
927 fldOutputDir.setText(p.getOutputDir());
928 fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
929 cbOutputEnable.setSelected(p.getOutputEnable());
930 cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
931 cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
936 fldReplaceFrom.setText(p.getReplaceFrom());
937 fldReplaceTo.setText(p.getReplaceTo());
942 cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
943 fldCommentSizeManual.setText(p.getCommentSizeManual());
944 cbCommentMinDisable.setSelected(p.getCommentMinDisabled());
945 cbCommentMinSizeAuto.setSelected(p.getCommentMinSizeAutosize());
946 fldCommentSizeManual.setText(p.getCommentMinSizeManual());
947 cbCommentDisplaySizeDefault.setSelected(p.getCommentDisplaySizeDefault());
948 fldCommentDisplaySizeManual.setText(p.getCommentDisplaySizeManual());
953 fldFontPath.setText(p.getFontPath());
954 fldFontIndex.setText(p.getFontIndex());
955 cmbFontShadow.setSelectedIndex(p.getFontShadow());
956 cbFontSizeArrangeDisable.setSelected(p.getFontSizeArrangeDisable());
957 cbCommentOpaque.setSelected(p.getCommentOpaque());
962 fldFfmpegPath.setText(p.getFfmpegPath());
963 fldFfmpegDllPath.setText(p.getFfmpegDllPath());
964 fldMediaInfoPath.setText(p.getMediaInfoPath());
967 * ffmpeg - ffmpegパラメータ
969 pnlFfmpegParam.init(p);
974 cbDisplayConverting.setSelected(p.getFfmpegDisplayConverting());
975 cbDllDisabled.setSelected(p.getFfmpegDllDisabled());
980 final List<String> ngWords = p.getNgWords();
981 pnlNgWord.init(ngWords);
982 final List<String> ngIds = p.getNgIds();
988 pnlSearchVideo.init(p.getSearchVideoDirs());
989 pnlSearchComment.init(p.getSearchCommentDirs());
994 mdlSystemThreadDownload.setValue(p.getSystemDownloadThread());
995 mdlSystemWaitDownload.setValue(p.getSystemDownloadWait());
996 mdlSystemThreadConvert.setValue(p.getSystemConvertThread());
997 fldSystemTempDir.setText(p.getSystemTempDir());
1000 private void saveConfig() {
1001 final Config p = Config.INSTANCE;
1007 p.setId(fldMail.getText());
1008 p.setPassword(String.valueOf(fldPassword.getPassword()));
1013 p.setProxyUse(cbProxyUse.isSelected());
1014 p.setProxyHost(fldProxyHost.getText());
1015 p.setProxyPort(fldProxyPort.getText());
1020 p.setVideoDir(pnlFileVideo.fldDir.getText());
1021 p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
1022 p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
1027 p.setCommentDir(pnlFileComment.fldDir.getText());
1028 p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
1029 p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
1034 p.setOutputDir(fldOutputDir.getText());
1035 p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
1036 p.setOutputEnable(cbOutputEnable.isSelected());
1037 p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
1038 p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
1043 p.setReplaceFrom(fldReplaceFrom.getText());
1044 p.setReplaceTo(fldReplaceTo.getText());
1049 p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1050 p.setCommentSizeManual(fldCommentSizeManual.getText());
1051 p.setCommentMinDisabled(cbCommentMinDisable.isSelected());
1052 p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1053 p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1054 p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1055 p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1060 p.setFontPath(fldFontPath.getText());
1061 p.setFontIndex(fldFontIndex.getText());
1062 p.setFontShadow(cmbFontShadow.getSelectedIndex());
1063 p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1064 p.setCommentOpaque(cbCommentOpaque.isSelected());
1069 p.setFfmpegPath(fldFfmpegPath.getText());
1070 p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1071 p.setMediaInfoPath(fldMediaInfoPath.getText());
1074 * ffmpeg - ffmpegパラメータ
1076 final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1077 p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1078 p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1079 p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1080 p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1081 p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1082 p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1083 p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1084 p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1085 p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1086 p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1091 p.setFfmpegDisplayConverting(cbDisplayConverting.isSelected());
1092 p.setFfmpegDllDisabled(cbDllDisabled.isSelected());
1097 p.setNgWords(pnlNgWord.getAllElements());
1098 p.setNgIds(pnlNgId.getAllElements());
1103 p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1104 p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1109 p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
1110 p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
1111 p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
1112 p.setSystemTempDir(fldSystemTempDir.getText());
1116 } catch (ConfigurationException ex) {
1117 logger.error("コンフィグファイル保存に失敗", ex);
1122 class DownloadLocationPanel extends JPanel {
1124 private static final long serialVersionUID = 1L;
1125 final JTextField fldDir = new JTextField();
1126 final JTextField fldFileNamePattern = new JTextField();
1127 final JCheckBox cbLocal = new JCheckBox("local");
1129 DownloadLocationPanel(){
1132 final JLabel lblVideoDir = new JLabel("保存フォルダ");
1133 final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1135 final JButton btnDir = new JButton("...");
1136 btnDir.addActionListener(
1137 new FileChooseActionListener(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1139 final GroupLayout gl = new GroupLayout(this);
1141 gl.setHorizontalGroup(
1142 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1143 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1145 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1146 .addComponent(lblVideoFileNamepattern)
1147 .addComponent(lblVideoDir))
1148 .addPreferredGap(ComponentPlacement.RELATED)
1149 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1150 .addGroup(gl.createSequentialGroup()
1151 .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1152 .addPreferredGap(ComponentPlacement.RELATED)
1153 .addComponent(btnDir))
1154 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1155 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1156 .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1157 .addComponent(cbLocal)))
1160 gl.setVerticalGroup(
1161 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1162 .addGroup(gl.createSequentialGroup()
1163 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1164 .addComponent(lblVideoDir)
1165 .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1166 .addComponent(btnDir))
1167 .addPreferredGap(ComponentPlacement.RELATED)
1168 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1169 .addComponent(lblVideoFileNamepattern)
1170 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1171 .addComponent(cbLocal))
1172 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))