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.FILES_AND_DIRECTORIES, 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 GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
338 pnlFile.setLayout(gl_pnlFile);
339 gl_pnlFile.setHorizontalGroup(
340 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
341 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
343 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
344 .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
345 .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
346 .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
350 gl_pnlFile.setVerticalGroup(
351 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
352 .addGroup(gl_pnlFile.createSequentialGroup()
354 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
355 .addPreferredGap(ComponentPlacement.RELATED)
356 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
357 .addPreferredGap(ComponentPlacement.RELATED)
358 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
359 .addPreferredGap(ComponentPlacement.RELATED)
363 tabbedPane.addTab("ファイル", pnlFile);
365 pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
367 lblCommentSize.setText("再生時間に応じたコメントの取得数");
369 lblCommentSizeManual.setText("手動取得");
371 lblCommentMinSize.setText("1分当たりのコメント取得数");
373 lblCommentMinSizeManual.setText("手動取得");
375 lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
377 lblCommentDisplayMaxManual.setText("手動設定");
379 GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
380 pnlCommentStandard.setLayout(gl_pnlCommentStandard);
381 gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
382 gl_pnlCommentStandard.setAutoCreateGaps(true);
383 gl_pnlCommentStandard.setHorizontalGroup(
384 gl_pnlCommentStandard.createSequentialGroup()
385 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
386 .addComponent(lblCommentSize)
387 .addComponent(lblCommentMinSize)
388 .addComponent(lblCommentDisplayMax))
389 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
390 .addComponent(cbCommentSizeAuto)
391 .addComponent(cbCommentMinDisable)
392 .addComponent(cbCommentMinSizeAuto)
393 .addComponent(cbCommentDisplaySizeDefault))
394 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
395 .addComponent(lblCommentSizeManual)
396 .addComponent(lblCommentMinSizeManual)
397 .addComponent(lblCommentDisplayMaxManual))
398 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
399 .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
400 .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
401 .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
403 gl_pnlCommentStandard.setVerticalGroup(
404 gl_pnlCommentStandard.createSequentialGroup()
405 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
406 .addComponent(lblCommentSize)
407 .addComponent(cbCommentSizeAuto)
408 .addComponent(lblCommentSizeManual)
409 .addComponent(fldCommentSizeManual))
410 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
411 .addComponent(lblCommentMinSize)
412 .addComponent(cbCommentMinDisable)
414 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
415 .addComponent(cbCommentMinSizeAuto)
416 .addComponent(lblCommentMinSizeManual)
417 .addComponent(fldCommentMinSizeManual))
418 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
419 .addComponent(lblCommentDisplayMax)
420 .addComponent(cbCommentDisplaySizeDefault)
421 .addComponent(lblCommentDisplayMaxManual)
422 .addComponent(fldCommentDisplaySizeManual))
425 pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
427 lblFontPath.setText("フォントパス");
429 cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
431 cbCommentOpaque.setText("コメント透明化を行わない");
433 final JButton btnFontPath = new JButton("...");
434 btnFontPath.addActionListener(
435 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
437 lblFontIndex.setText("フォント番号");
439 lblFontShadow.setText("影の種類");
440 final ComboBoxModel<String> cbmFontShadow
441 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
442 cmbFontShadow.setModel(cbmFontShadow);
444 GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
445 pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
446 gl_pnlCommentAdvanced.setHorizontalGroup(
447 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
448 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
450 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
451 .addComponent(cbCommentOpaque)
452 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
453 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
454 .addComponent(lblFontPath)
455 .addComponent(lblFontIndex)
456 .addComponent(lblFontShadow))
458 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
459 .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
460 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
461 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
462 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
463 .addPreferredGap(ComponentPlacement.RELATED)
464 .addComponent(btnFontPath))
465 .addComponent(cbFontSizeArrangeDisable))
468 gl_pnlCommentAdvanced.setVerticalGroup(
469 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
470 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
471 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
472 .addComponent(lblFontPath)
473 .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
474 .addComponent(btnFontPath))
475 .addPreferredGap(ComponentPlacement.RELATED)
476 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
477 .addComponent(lblFontIndex)
478 .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
479 .addPreferredGap(ComponentPlacement.RELATED)
480 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
481 .addComponent(lblFontShadow)
482 .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
483 .addPreferredGap(ComponentPlacement.RELATED)
484 .addComponent(cbFontSizeArrangeDisable)
485 .addPreferredGap(ComponentPlacement.RELATED)
486 .addComponent(cbCommentOpaque)
487 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
490 GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
491 pnlComment.setLayout(gl_pnlComment);
492 gl_pnlComment.setHorizontalGroup(
493 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
494 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
496 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
497 .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
498 .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
501 gl_pnlComment.setVerticalGroup(
502 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
503 .addGroup(gl_pnlComment.createSequentialGroup()
505 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
506 .addPreferredGap(ComponentPlacement.RELATED)
507 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
508 .addContainerGap(168, Short.MAX_VALUE))
511 tabbedPane.addTab("コメント", pnlComment);
513 pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
515 final JButton btnFfmpegPath = new JButton("...");
516 btnFfmpegPath.addActionListener(
517 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
519 final JButton btnFfmpegDllPath = new JButton("...");
520 btnFfmpegDllPath.addActionListener(
521 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
523 final JButton btnMediaInfoPath = new JButton("...");
524 btnMediaInfoPath.addActionListener(
525 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldMediaInfoPath));
527 GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath);
528 pnlFfmpegBinPath.setLayout(gl_jPanel10);
529 gl_jPanel10.setHorizontalGroup(
530 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
531 .addGroup(gl_jPanel10.createSequentialGroup()
533 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
534 .addComponent(lblFfmpegPath)
535 .addComponent(lblFfmpegDllPath)
536 .addComponent(lblMediaInfoPath)
538 .addPreferredGap(ComponentPlacement.RELATED)
539 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
540 .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
541 .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
542 .addComponent(fldMediaInfoPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
544 .addPreferredGap(ComponentPlacement.RELATED)
545 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
546 .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
547 .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING)
548 .addComponent(btnMediaInfoPath, GroupLayout.Alignment.TRAILING)
552 gl_jPanel10.setVerticalGroup(
553 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
554 .addGroup(gl_jPanel10.createSequentialGroup()
555 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
556 .addComponent(lblFfmpegPath)
557 .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
558 .addComponent(btnFfmpegPath))
559 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
560 .addComponent(lblFfmpegDllPath)
561 .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
562 .addComponent(btnFfmpegDllPath))
563 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
564 .addComponent(lblMediaInfoPath)
565 .addComponent(fldMediaInfoPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
566 .addComponent(btnMediaInfoPath))
570 pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
573 final JPanel pnlFffmpegEtc = new JPanel();
574 pnlFffmpegEtc.setBorder(BorderFactory.createTitledBorder("その他"));
575 final GroupLayout glFfmpegEtc = new GroupLayout(pnlFffmpegEtc);
576 glFfmpegEtc.setAutoCreateContainerGaps(true);
577 glFfmpegEtc.setAutoCreateGaps(true);
578 pnlFffmpegEtc.setLayout(glFfmpegEtc);
580 glFfmpegEtc.setHorizontalGroup(glFfmpegEtc.createParallelGroup()
581 .addComponent(cbDisplayConverting)
582 .addComponent(cbDllDisabled)
584 glFfmpegEtc.setVerticalGroup(glFfmpegEtc.createSequentialGroup()
585 .addComponent(cbDisplayConverting)
586 .addComponent(cbDllDisabled)
589 final GroupLayout glFfmpeg = new GroupLayout(pnlFfmpeg);
590 glFfmpeg.setAutoCreateContainerGaps(true);
591 pnlFfmpeg.setLayout(glFfmpeg);
592 glFfmpeg.setHorizontalGroup(glFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
593 .addComponent(pnlFfmpegBinPath)
594 .addComponent(pnlFfmpegParam)
595 .addComponent(pnlFffmpegEtc)
597 glFfmpeg.setVerticalGroup(glFfmpeg.createSequentialGroup()
598 .addComponent(pnlFfmpegBinPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
599 .addPreferredGap(ComponentPlacement.RELATED)
600 .addComponent(pnlFfmpegParam)
601 .addComponent(pnlFffmpegEtc)
604 tabbedPane.addTab("ffmpeg", pnlFfmpeg);
606 pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
607 pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
609 GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
610 pnlNgSetting.setLayout(gl_pnlNgSetting);
611 gl_pnlNgSetting.setHorizontalGroup(
612 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
613 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
615 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
616 .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
617 .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
620 gl_pnlNgSetting.setVerticalGroup(
621 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
622 .addGroup(gl_pnlNgSetting.createSequentialGroup()
624 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
625 .addPreferredGap(ComponentPlacement.RELATED)
626 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
630 tabbedPane.addTab("NG設定", pnlNgSetting);
632 pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
633 pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
635 final JLabel lblSearchNeedReboot = new JLabel(NEED_REBOOT);
637 GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
638 pnlSearch.setLayout(gl_pnlSearch);
639 gl_pnlSearch.setHorizontalGroup(
640 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
641 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
643 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
644 .addComponent(lblSearchNeedReboot, Alignment.CENTER)
645 .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
646 .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
649 gl_pnlSearch.setVerticalGroup(
650 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
651 .addGroup(gl_pnlSearch.createSequentialGroup()
653 .addComponent(lblSearchNeedReboot)
654 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
655 .addPreferredGap(ComponentPlacement.RELATED)
656 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
661 tabbedPane.addTab("検索", pnlSearch);
663 final JButton btnOk = new JButton("保存");
664 btnOk.addActionListener(new ActionListener() {
667 public void actionPerformed(ActionEvent e) {
672 final JButton btnCancel = new JButton("取消");
673 btnCancel.addActionListener(new ActionListener() {
676 public void actionPerformed(ActionEvent e) {
680 final JPanel pnlButton = new JPanel();
682 final GroupLayout glButton = new GroupLayout(pnlButton);
683 pnlButton.setLayout(glButton);
684 glButton.setHorizontalGroup(glButton.createSequentialGroup()
685 .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
687 .addPreferredGap(ComponentPlacement.UNRELATED)
688 .addComponent(btnCancel)
691 glButton.setVerticalGroup(glButton.createSequentialGroup()
692 .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
694 .addComponent(btnCancel)
698 GroupLayout layout = new GroupLayout(getContentPane());
699 layout.setAutoCreateContainerGaps(true);
700 getContentPane().setLayout(layout);
701 layout.setHorizontalGroup(
702 layout.createParallelGroup(GroupLayout.Alignment.LEADING)
703 .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
704 .addComponent(pnlButton)
706 layout.setVerticalGroup(
707 layout.createSequentialGroup()
708 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
709 .addComponent(pnlButton)
712 final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
713 final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
714 final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
715 final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
716 final JButton btnSystemTempDir = new JButton("...");
717 btnSystemTempDir.addActionListener(
718 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
720 mdlSystemThreadDownload.setMinimum(1);
721 final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
722 mdlSystemWaitDownload.setMinimum(0);
723 final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
724 mdlSystemThreadConvert.setMinimum(1);
725 final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
727 final JPanel pnlSystemGeneral = new JPanel();
728 pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
729 final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
730 glSystemGenegal.setAutoCreateGaps(true);
731 glSystemGenegal.setAutoCreateContainerGaps(true);
732 pnlSystemGeneral.setLayout(glSystemGenegal);
734 glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
735 .addGroup(glSystemGenegal.createSequentialGroup()
736 .addGroup(glSystemGenegal.createParallelGroup()
737 .addComponent(lblSystemThreadDownload)
738 .addComponent(lblSystemWaitDownload)
739 .addComponent(lblSystemThreadConvert))
740 .addGroup(glSystemGenegal.createParallelGroup()
741 .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
742 .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
743 .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
746 .addGroup(glSystemGenegal.createSequentialGroup()
747 .addComponent(lblSystemTempDir)
748 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
749 .addComponent(btnSystemTempDir)
753 glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
754 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
755 .addComponent(lblSystemThreadDownload)
756 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
757 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
758 .addComponent(lblSystemWaitDownload)
759 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
760 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
761 .addComponent(lblSystemThreadConvert)
762 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
763 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
764 .addComponent(lblSystemTempDir)
765 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
766 .addComponent(btnSystemTempDir)
770 final JLabel lblSystemNeedReboot = new JLabel("設定を有効にするにはいんきゅばすの再起動が必要です");
772 final JPanel pnlSystem = new JPanel();
773 pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
774 final GroupLayout glSystem = new GroupLayout(pnlSystem);
775 glSystem.setAutoCreateGaps(true);
776 glSystem.setAutoCreateContainerGaps(true);
777 pnlSystem.setLayout(glSystem);
779 glSystem.setHorizontalGroup(glSystem.createParallelGroup()
780 .addComponent(lblSystemNeedReboot, Alignment.CENTER)
781 .addComponent(pnlSystemGeneral));
783 glSystem.setVerticalGroup(glSystem.createSequentialGroup()
784 .addComponent(lblSystemNeedReboot)
785 .addComponent(pnlSystemGeneral));
787 tabbedPane.add("システム", pnlSystem);
790 setMinimumSize(getSize());
796 final JRadioButton btnAccount = new JRadioButton("次の情報を使用してログインする");
797 private final JTextField fldMail;
798 private final JPasswordField fldPassword = new JPasswordField();
800 final JRadioButton btnLoginCookie = new JRadioButton("ブラウザのログイン情報を使用してアクセスする");
801 final JRadioButton btnCookieIe = new JRadioButton("IE(7以降) (Windows)");
802 final JRadioButton btnCookieFirefox = new JRadioButton("Firefox(4以降) (Windows)");
803 final JRadioButton btnCookieChrome = new JRadioButton("Google Chrome (Windows)");
804 final JRadioButton btnCookieChromium = new JRadioButton("Chrome派生ブラウザ (Windows)");
805 final JRadioButton btnCookieOpera = new JRadioButton("Opera (Windows)");
806 final JRadioButton btnCookieOther = new JRadioButton("上記以外 - cookie保存ディレクトリを次に入力");
807 final JTextField fldCookie = new JTextField();
809 private final JCheckBox cbProxyUse;
810 private final JTextField fldProxyHost = new JTextField();
811 private final NumberFormattedTextField fldProxyPort = new NumberFormattedTextField();
814 private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
816 private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
818 private final JTextField fldOutputDir;
819 private final JTextField fldOutputFileNamePattern;
820 private final JButton btnOutputDir = new JButton("...");
821 private final JCheckBox cbOutputEnable;
822 private final JCheckBox cbOutputCommentOverlay;
823 private final JCheckBox cbOutputDisplayProgress;
826 private final JCheckBox cbCommentSizeAuto = new JCheckBox("自動調整");
827 private final NumberFormattedTextField fldCommentSizeManual = new NumberFormattedTextField();
828 private final JCheckBox cbCommentMinDisable = new JCheckBox("少コメ");
829 private final JCheckBox cbCommentMinSizeAuto = new JCheckBox("自動調整");
830 private final NumberFormattedTextField fldCommentMinSizeManual = new NumberFormattedTextField();
831 private final JCheckBox cbCommentDisplaySizeDefault = new JCheckBox("標準(30)");
832 private final NumberFormattedTextField fldCommentDisplaySizeManual = new NumberFormattedTextField();
834 private final JTextField fldFontPath;
835 private final JTextField fldFontIndex;
836 private final JComboBox<String> cmbFontShadow = new JComboBox<>();
837 private final JCheckBox cbFontSizeArrangeDisable;
838 private final JCheckBox cbCommentOpaque;
841 private final JTextField fldFfmpegPath = new JTextField();
842 private final JTextField fldFfmpegDllPath = new JTextField();
843 private final JTextField fldMediaInfoPath = new JTextField();
844 // ffmpeg - ffmpegパラメータ
845 private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
847 private final JCheckBox cbDisplayConverting = new JCheckBox("変換中動画表示");
848 private final JCheckBox cbDllDisabled = new JCheckBox("拡張DLL無効化(デバッグ用)");
851 private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
853 private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
856 private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
858 private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
860 private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
861 private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
862 private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
863 private final JTextField fldSystemTempDir = new JTextField();
866 // End of variables declaration//GEN-END:variables
868 private void loadConfig() {
869 final Config p = Config.INSTANCE;
874 btnAccount.setSelected(p.getNeedsLogin());
875 fldMail.setText(p.getId());
876 fldPassword.setText(p.getPassword());
881 btnLoginCookie.setSelected(!p.getNeedsLogin());
882 final CookieBrowser cookieBrowser = p.getCookieBrowser();
883 final JRadioButton enabledBrowser;
884 switch(cookieBrowser){
886 enabledBrowser = btnCookieIe;
889 enabledBrowser = btnCookieFirefox;
892 enabledBrowser = btnCookieChrome;
895 enabledBrowser = btnCookieChromium;
898 enabledBrowser = btnCookieOpera;
901 enabledBrowser = btnCookieOther;
904 throw new UnsupportedOperationException();
906 enabledBrowser.setSelected(true);
907 fldCookie.setText(p.getCookieDir());
912 cbProxyUse.setSelected(p.getProxyUse());
913 fldProxyHost.setText(p.getProxyHost());
914 fldProxyPort.setText(p.getProxyPort());
919 pnlFileVideo.fldDir.setText(p.getVideoDir());
920 pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
921 pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
926 pnlFileComment.fldDir.setText(p.getCommentDir());
927 pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
928 pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
933 fldOutputDir.setText(p.getOutputDir());
934 fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
935 cbOutputEnable.setSelected(p.getOutputEnable());
936 cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
937 cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
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;
1006 p.setNeedsLogin(btnAccount.isSelected());
1007 p.setId(fldMail.getText());
1008 p.setPassword(String.valueOf(fldPassword.getPassword()));
1013 final CookieBrowser cookieBrowser;
1014 if(btnCookieIe.isSelected()) {
1015 cookieBrowser = CookieBrowser.MSIE;
1016 } else if(btnCookieFirefox.isSelected()) {
1017 cookieBrowser = CookieBrowser.FIREFOX;
1018 } else if (btnCookieChrome.isSelected()) {
1019 cookieBrowser = CookieBrowser.CHROME;
1020 } else if (btnCookieChromium.isSelected()) {
1021 cookieBrowser = CookieBrowser.CHROMIUM;
1022 } else if(btnCookieOpera.isSelected()) {
1023 cookieBrowser = CookieBrowser.OPERA;
1024 } else if(btnCookieOther.isSelected()) {
1025 cookieBrowser = CookieBrowser.OTHER;
1027 throw new UnsupportedOperationException();
1029 p.setCookieBrowser(cookieBrowser);
1030 p.setCookieDir(fldCookie.getText());
1035 p.setProxyUse(cbProxyUse.isSelected());
1036 p.setProxyHost(fldProxyHost.getText());
1037 p.setProxyPort(fldProxyPort.getText());
1042 p.setVideoDir(pnlFileVideo.fldDir.getText());
1043 p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
1044 p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
1049 p.setCommentDir(pnlFileComment.fldDir.getText());
1050 p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
1051 p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
1056 p.setOutputDir(fldOutputDir.getText());
1057 p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
1058 p.setOutputEnable(cbOutputEnable.isSelected());
1059 p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
1060 p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
1065 p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1066 p.setCommentSizeManual(fldCommentSizeManual.getText());
1067 p.setCommentMinDisabled(cbCommentMinDisable.isSelected());
1068 p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1069 p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1070 p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1071 p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1076 p.setFontPath(fldFontPath.getText());
1077 p.setFontIndex(fldFontIndex.getText());
1078 p.setFontShadow(cmbFontShadow.getSelectedIndex());
1079 p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1080 p.setCommentOpaque(cbCommentOpaque.isSelected());
1085 p.setFfmpegPath(fldFfmpegPath.getText());
1086 p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1087 p.setMediaInfoPath(fldMediaInfoPath.getText());
1090 * ffmpeg - ffmpegパラメータ
1092 final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1093 p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1094 p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1095 p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1096 p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1097 p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1098 p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1099 p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1100 p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1101 p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1102 p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1107 p.setFfmpegDisplayConverting(cbDisplayConverting.isSelected());
1108 p.setFfmpegDllDisabled(cbDllDisabled.isSelected());
1113 p.setNgWords(pnlNgWord.getAllElements());
1114 p.setNgIds(pnlNgId.getAllElements());
1119 p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1120 p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1125 p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
1126 p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
1127 p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
1128 p.setSystemTempDir(fldSystemTempDir.getText());
1132 } catch (ConfigurationException ex) {
1133 logger.error("コンフィグファイル保存に失敗", ex);
1138 class DownloadLocationPanel extends JPanel {
1140 private static final long serialVersionUID = 1L;
1141 final JTextField fldDir = new JTextField();
1142 final JTextField fldFileNamePattern = new JTextField();
1143 final JCheckBox cbLocal = new JCheckBox("local");
1145 DownloadLocationPanel(){
1148 final JLabel lblVideoDir = new JLabel("保存フォルダ");
1149 final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1151 final JButton btnDir = new JButton("...");
1152 btnDir.addActionListener(
1153 new FileChooseActionListener(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1155 final GroupLayout gl = new GroupLayout(this);
1157 gl.setHorizontalGroup(
1158 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1159 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1161 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1162 .addComponent(lblVideoFileNamepattern)
1163 .addComponent(lblVideoDir))
1164 .addPreferredGap(ComponentPlacement.RELATED)
1165 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1166 .addGroup(gl.createSequentialGroup()
1167 .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1168 .addPreferredGap(ComponentPlacement.RELATED)
1169 .addComponent(btnDir))
1170 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1171 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1172 .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1173 .addComponent(cbLocal)))
1176 gl.setVerticalGroup(
1177 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1178 .addGroup(gl.createSequentialGroup()
1179 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1180 .addComponent(lblVideoDir)
1181 .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1182 .addComponent(btnDir))
1183 .addPreferredGap(ComponentPlacement.RELATED)
1184 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1185 .addComponent(lblVideoFileNamepattern)
1186 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1187 .addComponent(cbLocal))
1188 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))