4 * Created on 2011/08/20, 16:33:03
6 package yukihane.inqubus.gui;
8 import java.awt.event.ActionEvent;
9 import java.awt.event.ActionListener;
11 import java.util.List;
12 import javax.swing.BorderFactory;
13 import javax.swing.ButtonGroup;
14 import javax.swing.ComboBoxModel;
15 import javax.swing.DefaultComboBoxModel;
16 import javax.swing.GroupLayout;
17 import javax.swing.GroupLayout.Alignment;
18 import static javax.swing.GroupLayout.DEFAULT_SIZE;
19 import static javax.swing.GroupLayout.PREFERRED_SIZE;
20 import javax.swing.JButton;
21 import javax.swing.JCheckBox;
22 import javax.swing.JComboBox;
23 import javax.swing.JDialog;
24 import javax.swing.JFileChooser;
25 import javax.swing.JFrame;
26 import javax.swing.JLabel;
27 import javax.swing.JPanel;
28 import javax.swing.JPasswordField;
29 import javax.swing.JRadioButton;
30 import javax.swing.JSpinner;
31 import javax.swing.JTabbedPane;
32 import javax.swing.JTextField;
33 import javax.swing.LayoutStyle.ComponentPlacement;
34 import javax.swing.SpinnerNumberModel;
35 import javax.swing.WindowConstants;
36 import org.apache.commons.configuration.ConfigurationException;
37 import org.slf4j.Logger;
38 import org.slf4j.LoggerFactory;
39 import yukihane.inqubus.config.Config;
40 import yukihane.inqubus.config.Config.CookieBrowser;
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 fldMail = new JTextField();
63 fldPassword.setEchoChar('*');
64 final JPanel pnlProxy = new JPanel();
65 cbProxyUse = new JCheckBox();
66 final JLabel lblProxyHost = new JLabel();
67 final JLabel lblProxyPort = new JLabel();
68 final JPanel pnlFile = new JPanel();
69 final JPanel pnlFileOutput = new JPanel();
70 final JLabel lblOutputDir = new JLabel();
71 final JLabel lblOutputFileNamePattern = new JLabel();
72 fldOutputDir = new JTextField();
73 fldOutputFileNamePattern = new JTextField();
74 cbOutputEnable = new JCheckBox();
75 cbOutputCommentOverlay = new JCheckBox();
76 cbOutputDisplayProgress = new JCheckBox();
77 final JPanel pnlComment = new JPanel();
78 final JPanel pnlCommentStandard = new JPanel();
79 final JLabel lblCommentSize = new JLabel();
80 final JLabel lblCommentSizeManual = new JLabel();
81 final JLabel lblCommentMinSize = new JLabel();
82 final JLabel lblCommentMinSizeManual = new JLabel();
83 final JLabel lblCommentDisplayMax = new JLabel();
84 final JLabel lblCommentDisplayMaxManual = new JLabel();
85 final JPanel pnlCommentAdvanced = new JPanel();
86 final JLabel lblFontPath = new JLabel();
87 cbFontSizeArrangeDisable = new JCheckBox();
88 cbCommentOpaque = new JCheckBox();
89 fldFontPath = new JTextField();
90 final JLabel lblFontIndex = new JLabel();
91 final JLabel lblFontShadow = new JLabel();
92 fldFontIndex = new JTextField();
93 final JPanel pnlFfmpeg = new JPanel();
94 final JPanel pnlFfmpegBinPath = new JPanel();
95 final JLabel lblFfmpegPath = new JLabel("ffmpeg");
96 final JLabel lblFfmpegDllPath = new JLabel("拡張ライブラリ");
97 final JLabel lblMediaInfoPath = new JLabel("MediaInfo");
98 final JPanel pnlNgSetting = new JPanel();
99 final JPanel pnlSearch = new JPanel();
101 setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
103 pnlNetwork.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
105 pnlAccount.setBorder(BorderFactory.createTitledBorder("アカウント"));
107 final JLabel lblMail = new JLabel("ID(メールアドレス)");
108 final JLabel lblPassword = new JLabel("パスワード");
110 GroupLayout gl_pnlAccount = new GroupLayout(pnlAccount);
111 pnlAccount.setLayout(gl_pnlAccount);
112 gl_pnlAccount.setHorizontalGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
113 .addComponent(btnAccount)
114 .addGroup(gl_pnlAccount.createSequentialGroup()
117 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
118 .addComponent(lblMail)
119 .addComponent(lblPassword)
121 .addPreferredGap(ComponentPlacement.RELATED)
122 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
123 .addComponent(fldPassword, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
124 .addComponent(fldMail, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
129 gl_pnlAccount.setVerticalGroup(
130 gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
131 .addGroup(gl_pnlAccount.createSequentialGroup()
133 .addComponent(btnAccount)
134 .addPreferredGap(ComponentPlacement.RELATED)
135 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
136 .addComponent(lblMail)
137 .addComponent(fldMail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
138 .addPreferredGap(ComponentPlacement.RELATED)
139 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
140 .addComponent(lblPassword)
141 .addComponent(fldPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
142 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
146 final JButton btnCookie = new JButton("...");
147 btnCookie.addActionListener(new FileChooseActionListener(this, JFileChooser.FILES_AND_DIRECTORIES, fldCookie));
149 final ButtonGroup grpLoginType = new ButtonGroup();
150 grpLoginType.add(btnAccount);
151 grpLoginType.add(btnLoginCookie);
153 final ButtonGroup grpCookie = new ButtonGroup();
154 grpCookie.add(btnCookieIe);
155 grpCookie.add(btnCookieFirefox);
156 grpCookie.add(btnCookieChrome);
157 grpCookie.add(btnCookieChromium);
158 grpCookie.add(btnCookieOpera);
159 grpCookie.add(btnCookieOther);
161 final JPanel pnlCookie = new JPanel();
162 pnlCookie.setBorder(BorderFactory.createTitledBorder("cookie"));
163 final GroupLayout glCookie = new GroupLayout(pnlCookie);
164 pnlCookie.setLayout(glCookie);
165 glCookie.setAutoCreateContainerGaps(true);
166 glCookie.setAutoCreateGaps(true);
168 glCookie.setHorizontalGroup(glCookie.createParallelGroup()
169 .addComponent(btnLoginCookie)
170 .addGroup(glCookie.createSequentialGroup()
172 .addGroup(glCookie.createParallelGroup()
173 .addComponent(btnCookieIe)
174 .addComponent(btnCookieFirefox)
175 .addComponent(btnCookieChrome)
176 .addComponent(btnCookieChromium)
177 .addComponent(btnCookieOpera)
178 .addComponent(btnCookieOther)
179 .addGroup(glCookie.createSequentialGroup()
180 .addComponent(fldCookie)
181 .addComponent(btnCookie)
187 glCookie.setVerticalGroup(glCookie.createSequentialGroup()
188 .addComponent(btnLoginCookie)
189 .addComponent(btnCookieIe)
190 .addComponent(btnCookieFirefox)
191 .addComponent(btnCookieChrome)
192 .addComponent(btnCookieChromium)
193 .addComponent(btnCookieOpera)
194 .addComponent(btnCookieOther)
195 .addGroup(glCookie.createParallelGroup(Alignment.BASELINE)
196 .addComponent(fldCookie)
197 .addComponent(btnCookie)
202 pnlProxy.setBorder(BorderFactory.createTitledBorder("プロキシ"));
204 cbProxyUse.setText("プロキシを使用する");
206 lblProxyHost.setText("ホスト名");
208 lblProxyPort.setText("ポート番号");
210 GroupLayout gl_pnlProxy = new GroupLayout(pnlProxy);
211 pnlProxy.setLayout(gl_pnlProxy);
212 gl_pnlProxy.setHorizontalGroup(
213 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
214 .addGroup(gl_pnlProxy.createSequentialGroup()
216 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
217 .addComponent(cbProxyUse)
218 .addGroup(gl_pnlProxy.createSequentialGroup()
219 .addComponent(lblProxyHost)
221 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
222 .addGroup(gl_pnlProxy.createSequentialGroup()
223 .addComponent(lblProxyPort)
224 .addPreferredGap(ComponentPlacement.RELATED)
225 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
226 .addContainerGap(181, Short.MAX_VALUE))
228 gl_pnlProxy.setVerticalGroup(
229 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
230 .addGroup(gl_pnlProxy.createSequentialGroup()
232 .addComponent(cbProxyUse)
233 .addPreferredGap(ComponentPlacement.RELATED)
234 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
235 .addComponent(lblProxyHost)
236 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
237 .addPreferredGap(ComponentPlacement.RELATED)
238 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
239 .addComponent(lblProxyPort)
240 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
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(pnlAccount, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
253 .addComponent(pnlCookie, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
254 .addComponent(pnlProxy, 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(pnlCookie, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
265 .addPreferredGap(ComponentPlacement.RELATED)
266 .addComponent(pnlProxy, 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 GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
337 pnlFile.setLayout(gl_pnlFile);
338 gl_pnlFile.setHorizontalGroup(
339 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
340 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
342 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
343 .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
344 .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
345 .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
349 gl_pnlFile.setVerticalGroup(
350 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
351 .addGroup(gl_pnlFile.createSequentialGroup()
353 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
354 .addPreferredGap(ComponentPlacement.RELATED)
355 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
356 .addPreferredGap(ComponentPlacement.RELATED)
357 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
358 .addPreferredGap(ComponentPlacement.RELATED)
362 tabbedPane.addTab("ファイル", pnlFile);
364 pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
366 lblCommentSize.setText("再生時間に応じたコメントの取得数");
368 lblCommentSizeManual.setText("手動取得");
370 lblCommentMinSize.setText("1分当たりのコメント取得数");
372 lblCommentMinSizeManual.setText("手動取得");
374 lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
376 lblCommentDisplayMaxManual.setText("手動設定");
378 GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
379 pnlCommentStandard.setLayout(gl_pnlCommentStandard);
380 gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
381 gl_pnlCommentStandard.setAutoCreateGaps(true);
382 gl_pnlCommentStandard.setHorizontalGroup(
383 gl_pnlCommentStandard.createSequentialGroup()
384 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
385 .addComponent(lblCommentSize)
386 .addComponent(lblCommentMinSize)
387 .addComponent(lblCommentDisplayMax))
388 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
389 .addComponent(cbCommentSizeAuto)
390 .addComponent(cbCommentMinDisable)
391 .addComponent(cbCommentMinSizeAuto)
392 .addComponent(cbCommentDisplaySizeDefault))
393 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
394 .addComponent(lblCommentSizeManual)
395 .addComponent(lblCommentMinSizeManual)
396 .addComponent(lblCommentDisplayMaxManual))
397 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
398 .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
399 .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
400 .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
402 gl_pnlCommentStandard.setVerticalGroup(
403 gl_pnlCommentStandard.createSequentialGroup()
404 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
405 .addComponent(lblCommentSize)
406 .addComponent(cbCommentSizeAuto)
407 .addComponent(lblCommentSizeManual)
408 .addComponent(fldCommentSizeManual))
409 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
410 .addComponent(lblCommentMinSize)
411 .addComponent(cbCommentMinDisable)
413 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
414 .addComponent(cbCommentMinSizeAuto)
415 .addComponent(lblCommentMinSizeManual)
416 .addComponent(fldCommentMinSizeManual))
417 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
418 .addComponent(lblCommentDisplayMax)
419 .addComponent(cbCommentDisplaySizeDefault)
420 .addComponent(lblCommentDisplayMaxManual)
421 .addComponent(fldCommentDisplaySizeManual))
424 pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
426 lblFontPath.setText("フォントパス");
428 cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
430 cbCommentOpaque.setText("コメント透明化を行わない");
432 final JButton btnFontPath = new JButton("...");
433 btnFontPath.addActionListener(
434 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
436 lblFontIndex.setText("フォント番号");
438 lblFontShadow.setText("影の種類");
439 final ComboBoxModel<String> cbmFontShadow
440 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
441 cmbFontShadow.setModel(cbmFontShadow);
443 GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
444 pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
445 gl_pnlCommentAdvanced.setHorizontalGroup(
446 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
447 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
449 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
450 .addComponent(cbCommentOpaque)
451 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
452 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
453 .addComponent(lblFontPath)
454 .addComponent(lblFontIndex)
455 .addComponent(lblFontShadow))
457 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
458 .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
459 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
460 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
461 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
462 .addPreferredGap(ComponentPlacement.RELATED)
463 .addComponent(btnFontPath))
464 .addComponent(cbFontSizeArrangeDisable))
467 gl_pnlCommentAdvanced.setVerticalGroup(
468 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
469 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
470 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
471 .addComponent(lblFontPath)
472 .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
473 .addComponent(btnFontPath))
474 .addPreferredGap(ComponentPlacement.RELATED)
475 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
476 .addComponent(lblFontIndex)
477 .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
478 .addPreferredGap(ComponentPlacement.RELATED)
479 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
480 .addComponent(lblFontShadow)
481 .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
482 .addPreferredGap(ComponentPlacement.RELATED)
483 .addComponent(cbFontSizeArrangeDisable)
484 .addPreferredGap(ComponentPlacement.RELATED)
485 .addComponent(cbCommentOpaque)
486 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
489 GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
490 pnlComment.setLayout(gl_pnlComment);
491 gl_pnlComment.setHorizontalGroup(
492 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
493 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
495 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
496 .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
497 .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
500 gl_pnlComment.setVerticalGroup(
501 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
502 .addGroup(gl_pnlComment.createSequentialGroup()
504 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
505 .addPreferredGap(ComponentPlacement.RELATED)
506 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
507 .addContainerGap(168, Short.MAX_VALUE))
510 tabbedPane.addTab("コメント", pnlComment);
512 pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
514 final JButton btnFfmpegPath = new JButton("...");
515 btnFfmpegPath.addActionListener(
516 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
518 final JButton btnFfmpegDllPath = new JButton("...");
519 btnFfmpegDllPath.addActionListener(
520 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
522 final JButton btnMediaInfoPath = new JButton("...");
523 btnMediaInfoPath.addActionListener(
524 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldMediaInfoPath));
526 GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath);
527 pnlFfmpegBinPath.setLayout(gl_jPanel10);
528 gl_jPanel10.setHorizontalGroup(
529 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
530 .addGroup(gl_jPanel10.createSequentialGroup()
532 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
533 .addComponent(lblFfmpegPath)
534 .addComponent(lblFfmpegDllPath)
535 .addComponent(lblMediaInfoPath)
537 .addPreferredGap(ComponentPlacement.RELATED)
538 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
539 .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
540 .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
541 .addComponent(fldMediaInfoPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
543 .addPreferredGap(ComponentPlacement.RELATED)
544 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
545 .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
546 .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING)
547 .addComponent(btnMediaInfoPath, GroupLayout.Alignment.TRAILING)
551 gl_jPanel10.setVerticalGroup(
552 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
553 .addGroup(gl_jPanel10.createSequentialGroup()
554 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
555 .addComponent(lblFfmpegPath)
556 .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
557 .addComponent(btnFfmpegPath))
558 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
559 .addComponent(lblFfmpegDllPath)
560 .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
561 .addComponent(btnFfmpegDllPath))
562 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
563 .addComponent(lblMediaInfoPath)
564 .addComponent(fldMediaInfoPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
565 .addComponent(btnMediaInfoPath))
569 pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
572 final JPanel pnlFffmpegEtc = new JPanel();
573 pnlFffmpegEtc.setBorder(BorderFactory.createTitledBorder("その他"));
574 final GroupLayout glFfmpegEtc = new GroupLayout(pnlFffmpegEtc);
575 glFfmpegEtc.setAutoCreateContainerGaps(true);
576 glFfmpegEtc.setAutoCreateGaps(true);
577 pnlFffmpegEtc.setLayout(glFfmpegEtc);
579 glFfmpegEtc.setHorizontalGroup(glFfmpegEtc.createParallelGroup()
580 .addComponent(cbDisplayConverting)
581 .addComponent(cbDllDisabled)
583 glFfmpegEtc.setVerticalGroup(glFfmpegEtc.createSequentialGroup()
584 .addComponent(cbDisplayConverting)
585 .addComponent(cbDllDisabled)
588 final GroupLayout glFfmpeg = new GroupLayout(pnlFfmpeg);
589 glFfmpeg.setAutoCreateContainerGaps(true);
590 pnlFfmpeg.setLayout(glFfmpeg);
591 glFfmpeg.setHorizontalGroup(glFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
592 .addComponent(pnlFfmpegBinPath)
593 .addComponent(pnlFfmpegParam)
594 .addComponent(pnlFffmpegEtc)
596 glFfmpeg.setVerticalGroup(glFfmpeg.createSequentialGroup()
597 .addComponent(pnlFfmpegBinPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
598 .addPreferredGap(ComponentPlacement.RELATED)
599 .addComponent(pnlFfmpegParam)
600 .addComponent(pnlFffmpegEtc)
603 tabbedPane.addTab("ffmpeg", pnlFfmpeg);
605 pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
606 pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
608 GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
609 pnlNgSetting.setLayout(gl_pnlNgSetting);
610 gl_pnlNgSetting.setHorizontalGroup(
611 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
612 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
614 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
615 .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
616 .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
619 gl_pnlNgSetting.setVerticalGroup(
620 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
621 .addGroup(gl_pnlNgSetting.createSequentialGroup()
623 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
624 .addPreferredGap(ComponentPlacement.RELATED)
625 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
629 tabbedPane.addTab("NG設定", pnlNgSetting);
631 pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
632 pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
634 final JLabel lblSearchNeedReboot = new JLabel(NEED_REBOOT);
636 GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
637 pnlSearch.setLayout(gl_pnlSearch);
638 gl_pnlSearch.setHorizontalGroup(
639 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
640 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
642 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
643 .addComponent(lblSearchNeedReboot, Alignment.CENTER)
644 .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
645 .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
648 gl_pnlSearch.setVerticalGroup(
649 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
650 .addGroup(gl_pnlSearch.createSequentialGroup()
652 .addComponent(lblSearchNeedReboot)
653 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
654 .addPreferredGap(ComponentPlacement.RELATED)
655 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
660 tabbedPane.addTab("検索", pnlSearch);
662 final JButton btnOk = new JButton("保存");
663 btnOk.addActionListener(new ActionListener() {
666 public void actionPerformed(ActionEvent e) {
671 final JButton btnCancel = new JButton("取消");
672 btnCancel.addActionListener(new ActionListener() {
675 public void actionPerformed(ActionEvent e) {
679 final JPanel pnlButton = new JPanel();
681 final GroupLayout glButton = new GroupLayout(pnlButton);
682 pnlButton.setLayout(glButton);
683 glButton.setHorizontalGroup(glButton.createSequentialGroup()
684 .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
686 .addPreferredGap(ComponentPlacement.UNRELATED)
687 .addComponent(btnCancel)
690 glButton.setVerticalGroup(glButton.createSequentialGroup()
691 .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
693 .addComponent(btnCancel)
697 GroupLayout layout = new GroupLayout(getContentPane());
698 layout.setAutoCreateContainerGaps(true);
699 getContentPane().setLayout(layout);
700 layout.setHorizontalGroup(
701 layout.createParallelGroup(GroupLayout.Alignment.LEADING)
702 .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
703 .addComponent(pnlButton)
705 layout.setVerticalGroup(
706 layout.createSequentialGroup()
707 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
708 .addComponent(pnlButton)
711 final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
712 final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
713 final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
714 final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
715 final JButton btnSystemTempDir = new JButton("...");
716 btnSystemTempDir.addActionListener(
717 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
719 mdlSystemThreadDownload.setMinimum(1);
720 final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
721 mdlSystemWaitDownload.setMinimum(0);
722 final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
723 mdlSystemThreadConvert.setMinimum(1);
724 final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
726 final JPanel pnlSystemGeneral = new JPanel();
727 pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
728 final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
729 glSystemGenegal.setAutoCreateGaps(true);
730 glSystemGenegal.setAutoCreateContainerGaps(true);
731 pnlSystemGeneral.setLayout(glSystemGenegal);
733 glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
734 .addGroup(glSystemGenegal.createSequentialGroup()
735 .addGroup(glSystemGenegal.createParallelGroup()
736 .addComponent(lblSystemThreadDownload)
737 .addComponent(lblSystemWaitDownload)
738 .addComponent(lblSystemThreadConvert))
739 .addGroup(glSystemGenegal.createParallelGroup()
740 .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
741 .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
742 .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
745 .addGroup(glSystemGenegal.createSequentialGroup()
746 .addComponent(lblSystemTempDir)
747 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
748 .addComponent(btnSystemTempDir)
752 glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
753 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
754 .addComponent(lblSystemThreadDownload)
755 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
756 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
757 .addComponent(lblSystemWaitDownload)
758 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
759 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
760 .addComponent(lblSystemThreadConvert)
761 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
762 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
763 .addComponent(lblSystemTempDir)
764 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
765 .addComponent(btnSystemTempDir)
769 final JLabel lblSystemNeedReboot = new JLabel("設定を有効にするにはいんきゅばすの再起動が必要です");
771 final JPanel pnlSystem = new JPanel();
772 pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
773 final GroupLayout glSystem = new GroupLayout(pnlSystem);
774 glSystem.setAutoCreateGaps(true);
775 glSystem.setAutoCreateContainerGaps(true);
776 pnlSystem.setLayout(glSystem);
778 glSystem.setHorizontalGroup(glSystem.createParallelGroup()
779 .addComponent(lblSystemNeedReboot, Alignment.CENTER)
780 .addComponent(pnlSystemGeneral));
782 glSystem.setVerticalGroup(glSystem.createSequentialGroup()
783 .addComponent(lblSystemNeedReboot)
784 .addComponent(pnlSystemGeneral));
786 tabbedPane.add("システム", pnlSystem);
789 setMinimumSize(getSize());
795 final JRadioButton btnAccount = new JRadioButton("次の情報を使用してログインする");
796 private final JTextField fldMail;
797 private final JPasswordField fldPassword = new JPasswordField();
799 final JRadioButton btnLoginCookie = new JRadioButton("ブラウザのログイン情報を使用してアクセスする");
800 final JRadioButton btnCookieIe = new JRadioButton("IE(7以降) (Windows)");
801 final JRadioButton btnCookieFirefox = new JRadioButton("Firefox(4以降) (Windows)");
802 final JRadioButton btnCookieChrome = new JRadioButton("Google Chrome (Windows)");
803 final JRadioButton btnCookieChromium = new JRadioButton("Chrome派生ブラウザ (Windows)");
804 final JRadioButton btnCookieOpera = new JRadioButton("Opera (Windows)");
805 final JRadioButton btnCookieOther = new JRadioButton("上記以外 - cookie保存ディレクトリを次に入力");
806 final JTextField fldCookie = new JTextField();
808 private final JCheckBox cbProxyUse;
809 private final JTextField fldProxyHost = new JTextField();
810 private final NumberFormattedTextField fldProxyPort = new NumberFormattedTextField();
813 private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
815 private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
817 private final JTextField fldOutputDir;
818 private final JTextField fldOutputFileNamePattern;
819 private final JButton btnOutputDir = new JButton("...");
820 private final JCheckBox cbOutputEnable;
821 private final JCheckBox cbOutputCommentOverlay;
822 private final JCheckBox cbOutputDisplayProgress;
825 private final JCheckBox cbCommentSizeAuto = new JCheckBox("自動調整");
826 private final NumberFormattedTextField fldCommentSizeManual = new NumberFormattedTextField();
827 private final JCheckBox cbCommentMinDisable = new JCheckBox("少コメ");
828 private final JCheckBox cbCommentMinSizeAuto = new JCheckBox("自動調整");
829 private final NumberFormattedTextField fldCommentMinSizeManual = new NumberFormattedTextField();
830 private final JCheckBox cbCommentDisplaySizeDefault = new JCheckBox("標準(30)");
831 private final NumberFormattedTextField fldCommentDisplaySizeManual = new NumberFormattedTextField();
833 private final JTextField fldFontPath;
834 private final JTextField fldFontIndex;
835 private final JComboBox<String> cmbFontShadow = new JComboBox<>();
836 private final JCheckBox cbFontSizeArrangeDisable;
837 private final JCheckBox cbCommentOpaque;
840 private final JTextField fldFfmpegPath = new JTextField();
841 private final JTextField fldFfmpegDllPath = new JTextField();
842 private final JTextField fldMediaInfoPath = new JTextField();
843 // ffmpeg - ffmpegパラメータ
844 private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
846 private final JCheckBox cbDisplayConverting = new JCheckBox("変換中動画表示");
847 private final JCheckBox cbDllDisabled = new JCheckBox("拡張DLL無効化(デバッグ用)");
850 private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
852 private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
855 private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
857 private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
859 private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
860 private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
861 private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
862 private final JTextField fldSystemTempDir = new JTextField();
865 // End of variables declaration//GEN-END:variables
867 private void loadConfig() {
868 final Config p = Config.INSTANCE;
873 btnAccount.setSelected(p.getNeedsLogin());
874 fldMail.setText(p.getId());
875 fldPassword.setText(p.getPassword());
880 btnLoginCookie.setSelected(!p.getNeedsLogin());
881 final CookieBrowser cookieBrowser = p.getCookieBrowser();
882 final JRadioButton enabledBrowser;
883 switch(cookieBrowser){
885 enabledBrowser = btnCookieIe;
888 enabledBrowser = btnCookieFirefox;
891 enabledBrowser = btnCookieChrome;
894 enabledBrowser = btnCookieChromium;
897 enabledBrowser = btnCookieOpera;
900 enabledBrowser = btnCookieOther;
903 throw new UnsupportedOperationException();
905 enabledBrowser.setSelected(true);
906 fldCookie.setText(p.getCookieDir());
911 cbProxyUse.setSelected(p.getProxyUse());
912 fldProxyHost.setText(p.getProxyHost());
913 fldProxyPort.setText(p.getProxyPort());
918 pnlFileVideo.fldDir.setText(p.getVideoDir());
919 pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
920 pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
925 pnlFileComment.fldDir.setText(p.getCommentDir());
926 pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
927 pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
932 fldOutputDir.setText(p.getOutputDir());
933 fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
934 cbOutputEnable.setSelected(p.getOutputEnable());
935 cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
936 cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
941 cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
942 fldCommentSizeManual.setText(p.getCommentSizeManual());
943 cbCommentMinDisable.setSelected(p.getCommentMinDisabled());
944 cbCommentMinSizeAuto.setSelected(p.getCommentMinSizeAutosize());
945 fldCommentSizeManual.setText(p.getCommentMinSizeManual());
946 cbCommentDisplaySizeDefault.setSelected(p.getCommentDisplaySizeDefault());
947 fldCommentDisplaySizeManual.setText(p.getCommentDisplaySizeManual());
952 fldFontPath.setText(p.getFontPath());
953 fldFontIndex.setText(p.getFontIndex());
954 cmbFontShadow.setSelectedIndex(p.getFontShadow());
955 cbFontSizeArrangeDisable.setSelected(p.getFontSizeArrangeDisable());
956 cbCommentOpaque.setSelected(p.getCommentOpaque());
961 fldFfmpegPath.setText(p.getFfmpegPath());
962 fldFfmpegDllPath.setText(p.getFfmpegDllPath());
963 fldMediaInfoPath.setText(p.getMediaInfoPath());
966 * ffmpeg - ffmpegパラメータ
968 pnlFfmpegParam.init(p);
973 cbDisplayConverting.setSelected(p.getFfmpegDisplayConverting());
974 cbDllDisabled.setSelected(p.getFfmpegDllDisabled());
979 final List<String> ngWords = p.getNgWords();
980 pnlNgWord.init(ngWords);
981 final List<String> ngIds = p.getNgIds();
987 pnlSearchVideo.init(p.getSearchVideoDirs());
988 pnlSearchComment.init(p.getSearchCommentDirs());
993 mdlSystemThreadDownload.setValue(p.getSystemDownloadThread());
994 mdlSystemWaitDownload.setValue(p.getSystemDownloadWait());
995 mdlSystemThreadConvert.setValue(p.getSystemConvertThread());
996 fldSystemTempDir.setText(p.getSystemTempDir());
999 private void saveConfig() {
1000 final Config p = Config.INSTANCE;
1005 p.setNeedsLogin(btnAccount.isSelected());
1006 p.setId(fldMail.getText());
1007 p.setPassword(String.valueOf(fldPassword.getPassword()));
1012 final CookieBrowser cookieBrowser;
1013 if(btnCookieIe.isSelected()) {
1014 cookieBrowser = CookieBrowser.MSIE;
1015 } else if(btnCookieFirefox.isSelected()) {
1016 cookieBrowser = CookieBrowser.FIREFOX;
1017 } else if (btnCookieChrome.isSelected()) {
1018 cookieBrowser = CookieBrowser.CHROME;
1019 } else if (btnCookieChromium.isSelected()) {
1020 cookieBrowser = CookieBrowser.CHROMIUM;
1021 } else if(btnCookieOpera.isSelected()) {
1022 cookieBrowser = CookieBrowser.OPERA;
1023 } else if(btnCookieOther.isSelected()) {
1024 cookieBrowser = CookieBrowser.OTHER;
1026 throw new UnsupportedOperationException();
1028 p.setCookieBrowser(cookieBrowser);
1029 p.setCookieDir(fldCookie.getText());
1034 p.setProxyUse(cbProxyUse.isSelected());
1035 p.setProxyHost(fldProxyHost.getText());
1036 p.setProxyPort(fldProxyPort.getText());
1041 p.setVideoDir(pnlFileVideo.fldDir.getText());
1042 p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
1043 p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
1048 p.setCommentDir(pnlFileComment.fldDir.getText());
1049 p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
1050 p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
1055 p.setOutputDir(fldOutputDir.getText());
1056 p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
1057 p.setOutputEnable(cbOutputEnable.isSelected());
1058 p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
1059 p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
1064 p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1065 p.setCommentSizeManual(fldCommentSizeManual.getText());
1066 p.setCommentMinDisabled(cbCommentMinDisable.isSelected());
1067 p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1068 p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1069 p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1070 p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1075 p.setFontPath(fldFontPath.getText());
1076 p.setFontIndex(fldFontIndex.getText());
1077 p.setFontShadow(cmbFontShadow.getSelectedIndex());
1078 p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1079 p.setCommentOpaque(cbCommentOpaque.isSelected());
1084 p.setFfmpegPath(fldFfmpegPath.getText());
1085 p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1086 p.setMediaInfoPath(fldMediaInfoPath.getText());
1089 * ffmpeg - ffmpegパラメータ
1091 final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1092 p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1093 p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1094 p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1095 p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1096 p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1097 p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1098 p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1099 p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1100 p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1101 p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1106 p.setFfmpegDisplayConverting(cbDisplayConverting.isSelected());
1107 p.setFfmpegDllDisabled(cbDllDisabled.isSelected());
1112 p.setNgWords(pnlNgWord.getAllElements());
1113 p.setNgIds(pnlNgId.getAllElements());
1118 p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1119 p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1124 p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
1125 p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
1126 p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
1127 p.setSystemTempDir(fldSystemTempDir.getText());
1131 } catch (ConfigurationException ex) {
1132 logger.error("コンフィグファイル保存に失敗", ex);
1137 class DownloadLocationPanel extends JPanel {
1139 private static final long serialVersionUID = 1L;
1140 final JTextField fldDir = new JTextField();
1141 final JTextField fldFileNamePattern = new JTextField();
1142 final JCheckBox cbLocal = new JCheckBox("local");
1144 DownloadLocationPanel(){
1147 final JLabel lblVideoDir = new JLabel("保存フォルダ");
1148 final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1150 final JButton btnDir = new JButton("...");
1151 btnDir.addActionListener(
1152 new FileChooseActionListener(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1154 final GroupLayout gl = new GroupLayout(this);
1156 gl.setHorizontalGroup(
1157 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1158 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1160 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1161 .addComponent(lblVideoFileNamepattern)
1162 .addComponent(lblVideoDir))
1163 .addPreferredGap(ComponentPlacement.RELATED)
1164 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1165 .addGroup(gl.createSequentialGroup()
1166 .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1167 .addPreferredGap(ComponentPlacement.RELATED)
1168 .addComponent(btnDir))
1169 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1170 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1171 .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1172 .addComponent(cbLocal)))
1175 gl.setVerticalGroup(
1176 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1177 .addGroup(gl.createSequentialGroup()
1178 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1179 .addComponent(lblVideoDir)
1180 .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1181 .addComponent(btnDir))
1182 .addPreferredGap(ComponentPlacement.RELATED)
1183 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1184 .addComponent(lblVideoFileNamepattern)
1185 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1186 .addComponent(cbLocal))
1187 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))