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){
58 setTitle("いんきゅばす 設定");
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 JLabel lblCommentOwnerOnly = new JLabel();
87 final JPanel pnlCommentAdvanced = new JPanel();
88 final JLabel lblFontPath = new JLabel();
89 cbFontSizeArrangeDisable = new JCheckBox();
90 cbCommentOpaque = new JCheckBox();
91 fldFontPath = new JTextField();
92 final JLabel lblFontIndex = new JLabel();
93 final JLabel lblFontShadow = new JLabel();
94 fldFontIndex = new JTextField();
95 final JPanel pnlFfmpeg = new JPanel();
96 final JPanel pnlFfmpegBinPath = new JPanel();
97 final JLabel lblFfmpegPath = new JLabel("ffmpeg");
98 final JLabel lblFfmpegDllPath = new JLabel("拡張ライブラリ");
99 final JLabel lblMediaInfoPath = new JLabel("MediaInfo");
100 final JPanel pnlNgSetting = new JPanel();
101 final JPanel pnlSearch = new JPanel();
103 setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
105 pnlNetwork.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
107 pnlAccount.setBorder(BorderFactory.createTitledBorder("アカウント"));
109 final JLabel lblMail = new JLabel("ID(メールアドレス)");
110 final JLabel lblPassword = new JLabel("パスワード");
112 GroupLayout gl_pnlAccount = new GroupLayout(pnlAccount);
113 pnlAccount.setLayout(gl_pnlAccount);
114 gl_pnlAccount.setHorizontalGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
115 .addComponent(btnAccount)
116 .addGroup(gl_pnlAccount.createSequentialGroup()
119 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
120 .addComponent(lblMail)
121 .addComponent(lblPassword)
123 .addPreferredGap(ComponentPlacement.RELATED)
124 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
125 .addComponent(fldPassword, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
126 .addComponent(fldMail, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
131 gl_pnlAccount.setVerticalGroup(
132 gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
133 .addGroup(gl_pnlAccount.createSequentialGroup()
135 .addComponent(btnAccount)
136 .addPreferredGap(ComponentPlacement.RELATED)
137 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
138 .addComponent(lblMail)
139 .addComponent(fldMail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
140 .addPreferredGap(ComponentPlacement.RELATED)
141 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
142 .addComponent(lblPassword)
143 .addComponent(fldPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
144 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
148 final JButton btnCookie = new JButton("...");
149 btnCookie.addActionListener(new FileChooseActionListener(this, JFileChooser.FILES_AND_DIRECTORIES, fldCookie));
151 final ButtonGroup grpLoginType = new ButtonGroup();
152 grpLoginType.add(btnAccount);
153 grpLoginType.add(btnLoginCookie);
155 final ButtonGroup grpCookie = new ButtonGroup();
156 grpCookie.add(btnCookieIe);
157 grpCookie.add(btnCookieFirefox);
158 grpCookie.add(btnCookieChrome);
159 grpCookie.add(btnCookieChromium);
160 grpCookie.add(btnCookieOpera);
161 grpCookie.add(btnCookieOther);
163 final JPanel pnlCookie = new JPanel();
164 pnlCookie.setBorder(BorderFactory.createTitledBorder("cookie"));
165 final GroupLayout glCookie = new GroupLayout(pnlCookie);
166 pnlCookie.setLayout(glCookie);
167 glCookie.setAutoCreateContainerGaps(true);
168 glCookie.setAutoCreateGaps(true);
170 glCookie.setHorizontalGroup(glCookie.createParallelGroup()
171 .addComponent(btnLoginCookie)
172 .addGroup(glCookie.createSequentialGroup()
174 .addGroup(glCookie.createParallelGroup()
175 .addComponent(btnCookieIe)
176 .addComponent(btnCookieFirefox)
177 .addComponent(btnCookieChrome)
178 .addComponent(btnCookieChromium)
179 .addComponent(btnCookieOpera)
180 .addComponent(btnCookieOther)
181 .addGroup(glCookie.createSequentialGroup()
182 .addComponent(fldCookie)
183 .addComponent(btnCookie)
189 glCookie.setVerticalGroup(glCookie.createSequentialGroup()
190 .addComponent(btnLoginCookie)
191 .addComponent(btnCookieIe)
192 .addComponent(btnCookieFirefox)
193 .addComponent(btnCookieChrome)
194 .addComponent(btnCookieChromium)
195 .addComponent(btnCookieOpera)
196 .addComponent(btnCookieOther)
197 .addGroup(glCookie.createParallelGroup(Alignment.BASELINE)
198 .addComponent(fldCookie)
199 .addComponent(btnCookie)
204 pnlProxy.setBorder(BorderFactory.createTitledBorder("プロキシ"));
206 cbProxyUse.setText("プロキシを使用する");
208 lblProxyHost.setText("ホスト名");
210 lblProxyPort.setText("ポート番号");
212 GroupLayout gl_pnlProxy = new GroupLayout(pnlProxy);
213 pnlProxy.setLayout(gl_pnlProxy);
214 gl_pnlProxy.setHorizontalGroup(
215 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
216 .addGroup(gl_pnlProxy.createSequentialGroup()
218 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
219 .addComponent(cbProxyUse)
220 .addGroup(gl_pnlProxy.createSequentialGroup()
221 .addComponent(lblProxyHost)
223 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
224 .addGroup(gl_pnlProxy.createSequentialGroup()
225 .addComponent(lblProxyPort)
226 .addPreferredGap(ComponentPlacement.RELATED)
227 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
228 .addContainerGap(181, Short.MAX_VALUE))
230 gl_pnlProxy.setVerticalGroup(
231 gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
232 .addGroup(gl_pnlProxy.createSequentialGroup()
234 .addComponent(cbProxyUse)
235 .addPreferredGap(ComponentPlacement.RELATED)
236 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
237 .addComponent(lblProxyHost)
238 .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
239 .addPreferredGap(ComponentPlacement.RELATED)
240 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
241 .addComponent(lblProxyPort)
242 .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
247 GroupLayout gl_pnlNetwork = new GroupLayout(pnlNetwork);
248 pnlNetwork.setLayout(gl_pnlNetwork);
249 gl_pnlNetwork.setHorizontalGroup(
250 gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
251 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNetwork.createSequentialGroup()
253 .addGroup(gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.TRAILING)
254 .addComponent(pnlAccount, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
255 .addComponent(pnlCookie, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
256 .addComponent(pnlProxy, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
260 gl_pnlNetwork.setVerticalGroup(
261 gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
262 .addGroup(gl_pnlNetwork.createSequentialGroup()
264 .addComponent(pnlAccount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
265 .addPreferredGap(ComponentPlacement.RELATED)
266 .addComponent(pnlCookie, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
267 .addPreferredGap(ComponentPlacement.RELATED)
268 .addComponent(pnlProxy, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
273 tabbedPane.addTab("ネットワーク", pnlNetwork);
275 pnlFileVideo.setBorder(BorderFactory.createTitledBorder("動画"));
277 pnlFileComment.setBorder(BorderFactory.createTitledBorder("コメント"));
279 pnlFileOutput.setBorder(BorderFactory.createTitledBorder("変換動画"));
281 lblOutputDir.setText("保存フォルダ");
283 lblOutputFileNamePattern.setText("ファイル名規則");
285 btnOutputDir.addActionListener(
286 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldOutputDir));
288 cbOutputEnable.setText("変換");
290 cbOutputCommentOverlay.setText("コメント付与");
292 cbOutputDisplayProgress.setText("変換中動画表示");
294 GroupLayout gl_pnlFileOutput = new GroupLayout(pnlFileOutput);
295 pnlFileOutput.setLayout(gl_pnlFileOutput);
296 gl_pnlFileOutput.setHorizontalGroup(
297 gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
298 .addGroup(gl_pnlFileOutput.createSequentialGroup()
300 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
301 .addComponent(lblOutputFileNamePattern)
302 .addComponent(lblOutputDir))
303 .addPreferredGap(ComponentPlacement.RELATED)
304 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
305 .addGroup(gl_pnlFileOutput.createSequentialGroup()
306 .addComponent(fldOutputDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
307 .addPreferredGap(ComponentPlacement.RELATED)
308 .addComponent(btnOutputDir)
310 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileOutput.createSequentialGroup()
311 .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
312 .addPreferredGap(ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
313 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
314 .addComponent(cbOutputDisplayProgress)
315 .addGroup(gl_pnlFileOutput.createSequentialGroup()
316 .addComponent(cbOutputEnable)
317 .addPreferredGap(ComponentPlacement.RELATED)
318 .addComponent(cbOutputCommentOverlay))))))
320 gl_pnlFileOutput.setVerticalGroup(
321 gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
322 .addGroup(gl_pnlFileOutput.createSequentialGroup()
323 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
324 .addComponent(lblOutputDir)
325 .addComponent(fldOutputDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
326 .addComponent(btnOutputDir))
327 .addPreferredGap(ComponentPlacement.RELATED)
328 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
329 .addComponent(lblOutputFileNamePattern)
330 .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
331 .addComponent(cbOutputCommentOverlay)
332 .addComponent(cbOutputEnable))
333 .addPreferredGap(ComponentPlacement.RELATED)
334 .addComponent(cbOutputDisplayProgress)
335 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
338 GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
339 pnlFile.setLayout(gl_pnlFile);
340 gl_pnlFile.setHorizontalGroup(
341 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
342 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
344 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
345 .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
346 .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
347 .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
351 gl_pnlFile.setVerticalGroup(
352 gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
353 .addGroup(gl_pnlFile.createSequentialGroup()
355 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
356 .addPreferredGap(ComponentPlacement.RELATED)
357 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
358 .addPreferredGap(ComponentPlacement.RELATED)
359 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
360 .addPreferredGap(ComponentPlacement.RELATED)
364 tabbedPane.addTab("ファイル", pnlFile);
366 pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
368 lblCommentSize.setText("再生時間に応じたコメントの取得数");
370 lblCommentSizeManual.setText("手動取得");
372 lblCommentMinSize.setText("1分当たりのコメント取得数");
374 lblCommentMinSizeManual.setText("手動取得");
376 lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
378 lblCommentDisplayMaxManual.setText("手動設定");
380 lblCommentOwnerOnly.setText("取得するコメントの種類");
382 GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
383 pnlCommentStandard.setLayout(gl_pnlCommentStandard);
384 gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
385 gl_pnlCommentStandard.setAutoCreateGaps(true);
386 gl_pnlCommentStandard.setHorizontalGroup(
387 gl_pnlCommentStandard.createSequentialGroup()
388 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
389 .addComponent(lblCommentSize)
390 .addComponent(lblCommentMinSize)
391 .addComponent(lblCommentDisplayMax)
392 .addComponent(lblCommentOwnerOnly)
394 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
395 .addGroup(gl_pnlCommentStandard.createSequentialGroup()
396 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
397 .addComponent(cbCommentSizeAuto)
398 .addComponent(cbCommentMinDisable)
399 .addComponent(cbCommentMinSizeAuto)
400 .addComponent(cbCommentDisplaySizeDefault)
402 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
403 .addComponent(lblCommentSizeManual)
404 .addComponent(lblCommentMinSizeManual)
405 .addComponent(lblCommentDisplayMaxManual))
406 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
407 .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
408 .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
409 .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
411 .addGroup(gl_pnlCommentStandard.createSequentialGroup()
412 .addComponent(cbCommentOwnerOnly)
416 gl_pnlCommentStandard.setVerticalGroup(
417 gl_pnlCommentStandard.createSequentialGroup()
418 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
419 .addComponent(lblCommentSize)
420 .addComponent(cbCommentSizeAuto)
421 .addComponent(lblCommentSizeManual)
422 .addComponent(fldCommentSizeManual))
423 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
424 .addComponent(lblCommentMinSize)
425 .addComponent(cbCommentMinDisable)
427 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
428 .addComponent(cbCommentMinSizeAuto)
429 .addComponent(lblCommentMinSizeManual)
430 .addComponent(fldCommentMinSizeManual))
431 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
432 .addComponent(lblCommentDisplayMax)
433 .addComponent(cbCommentDisplaySizeDefault)
434 .addComponent(lblCommentDisplayMaxManual)
435 .addComponent(fldCommentDisplaySizeManual))
436 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
437 .addComponent(lblCommentOwnerOnly)
438 .addComponent(cbCommentOwnerOnly)
442 pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
444 lblFontPath.setText("フォントパス");
446 cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
448 cbCommentOpaque.setText("コメント透明化を行わない");
450 final JButton btnFontPath = new JButton("...");
451 btnFontPath.addActionListener(
452 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
454 lblFontIndex.setText("フォント番号");
456 lblFontShadow.setText("影の種類");
457 final ComboBoxModel<String> cbmFontShadow
458 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
459 cmbFontShadow.setModel(cbmFontShadow);
461 GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
462 pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
463 gl_pnlCommentAdvanced.setHorizontalGroup(
464 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
465 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
467 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
468 .addComponent(cbCommentOpaque)
469 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
470 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
471 .addComponent(lblFontPath)
472 .addComponent(lblFontIndex)
473 .addComponent(lblFontShadow))
475 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
476 .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
477 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
478 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
479 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
480 .addPreferredGap(ComponentPlacement.RELATED)
481 .addComponent(btnFontPath))
482 .addComponent(cbFontSizeArrangeDisable))
485 gl_pnlCommentAdvanced.setVerticalGroup(
486 gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
487 .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
488 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
489 .addComponent(lblFontPath)
490 .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
491 .addComponent(btnFontPath))
492 .addPreferredGap(ComponentPlacement.RELATED)
493 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
494 .addComponent(lblFontIndex)
495 .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
496 .addPreferredGap(ComponentPlacement.RELATED)
497 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
498 .addComponent(lblFontShadow)
499 .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
500 .addPreferredGap(ComponentPlacement.RELATED)
501 .addComponent(cbFontSizeArrangeDisable)
502 .addPreferredGap(ComponentPlacement.RELATED)
503 .addComponent(cbCommentOpaque)
504 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
507 GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
508 pnlComment.setLayout(gl_pnlComment);
509 gl_pnlComment.setHorizontalGroup(
510 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
511 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
513 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
514 .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
515 .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
518 gl_pnlComment.setVerticalGroup(
519 gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
520 .addGroup(gl_pnlComment.createSequentialGroup()
522 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
523 .addPreferredGap(ComponentPlacement.RELATED)
524 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
525 .addContainerGap(168, Short.MAX_VALUE))
528 tabbedPane.addTab("コメント", pnlComment);
530 pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
532 final JButton btnFfmpegPath = new JButton("...");
533 btnFfmpegPath.addActionListener(
534 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
536 final JButton btnFfmpegDllPath = new JButton("...");
537 btnFfmpegDllPath.addActionListener(
538 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
540 final JButton btnMediaInfoPath = new JButton("...");
541 btnMediaInfoPath.addActionListener(
542 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldMediaInfoPath));
544 GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath);
545 pnlFfmpegBinPath.setLayout(gl_jPanel10);
546 gl_jPanel10.setHorizontalGroup(
547 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
548 .addGroup(gl_jPanel10.createSequentialGroup()
550 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
551 .addComponent(lblFfmpegPath)
552 .addComponent(lblFfmpegDllPath)
553 .addComponent(lblMediaInfoPath)
555 .addPreferredGap(ComponentPlacement.RELATED)
556 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
557 .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
558 .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
559 .addComponent(fldMediaInfoPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
561 .addPreferredGap(ComponentPlacement.RELATED)
562 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
563 .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
564 .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING)
565 .addComponent(btnMediaInfoPath, GroupLayout.Alignment.TRAILING)
569 gl_jPanel10.setVerticalGroup(
570 gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
571 .addGroup(gl_jPanel10.createSequentialGroup()
572 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
573 .addComponent(lblFfmpegPath)
574 .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
575 .addComponent(btnFfmpegPath))
576 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
577 .addComponent(lblFfmpegDllPath)
578 .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
579 .addComponent(btnFfmpegDllPath))
580 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
581 .addComponent(lblMediaInfoPath)
582 .addComponent(fldMediaInfoPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
583 .addComponent(btnMediaInfoPath))
587 pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
590 final JPanel pnlFffmpegEtc = new JPanel();
591 pnlFffmpegEtc.setBorder(BorderFactory.createTitledBorder("その他"));
592 final GroupLayout glFfmpegEtc = new GroupLayout(pnlFffmpegEtc);
593 glFfmpegEtc.setAutoCreateContainerGaps(true);
594 glFfmpegEtc.setAutoCreateGaps(true);
595 pnlFffmpegEtc.setLayout(glFfmpegEtc);
597 glFfmpegEtc.setHorizontalGroup(glFfmpegEtc.createParallelGroup()
598 .addComponent(cbDisplayConverting)
599 .addComponent(cbDllDisabled)
601 glFfmpegEtc.setVerticalGroup(glFfmpegEtc.createSequentialGroup()
602 .addComponent(cbDisplayConverting)
603 .addComponent(cbDllDisabled)
606 final GroupLayout glFfmpeg = new GroupLayout(pnlFfmpeg);
607 glFfmpeg.setAutoCreateContainerGaps(true);
608 pnlFfmpeg.setLayout(glFfmpeg);
609 glFfmpeg.setHorizontalGroup(glFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
610 .addComponent(pnlFfmpegBinPath)
611 .addComponent(pnlFfmpegParam)
612 .addComponent(pnlFffmpegEtc)
614 glFfmpeg.setVerticalGroup(glFfmpeg.createSequentialGroup()
615 .addComponent(pnlFfmpegBinPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
616 .addPreferredGap(ComponentPlacement.RELATED)
617 .addComponent(pnlFfmpegParam)
618 .addComponent(pnlFffmpegEtc)
621 tabbedPane.addTab("ffmpeg", pnlFfmpeg);
623 pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
624 pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
626 GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
627 pnlNgSetting.setLayout(gl_pnlNgSetting);
628 gl_pnlNgSetting.setHorizontalGroup(
629 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
630 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
632 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
633 .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
634 .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
637 gl_pnlNgSetting.setVerticalGroup(
638 gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
639 .addGroup(gl_pnlNgSetting.createSequentialGroup()
641 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
642 .addPreferredGap(ComponentPlacement.RELATED)
643 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
647 tabbedPane.addTab("NG設定", pnlNgSetting);
649 pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
650 pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
652 final JLabel lblSearchNeedReboot = new JLabel(NEED_REBOOT);
654 GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
655 pnlSearch.setLayout(gl_pnlSearch);
656 gl_pnlSearch.setHorizontalGroup(
657 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
658 .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
660 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
661 .addComponent(lblSearchNeedReboot, Alignment.CENTER)
662 .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
663 .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
666 gl_pnlSearch.setVerticalGroup(
667 gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
668 .addGroup(gl_pnlSearch.createSequentialGroup()
670 .addComponent(lblSearchNeedReboot)
671 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
672 .addPreferredGap(ComponentPlacement.RELATED)
673 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
678 tabbedPane.addTab("検索", pnlSearch);
680 final JButton btnOk = new JButton("保存");
681 btnOk.addActionListener(new ActionListener() {
684 public void actionPerformed(ActionEvent e) {
689 final JButton btnCancel = new JButton("取消");
690 btnCancel.addActionListener(new ActionListener() {
693 public void actionPerformed(ActionEvent e) {
697 final JPanel pnlButton = new JPanel();
699 final GroupLayout glButton = new GroupLayout(pnlButton);
700 pnlButton.setLayout(glButton);
701 glButton.setHorizontalGroup(glButton.createSequentialGroup()
702 .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
704 .addPreferredGap(ComponentPlacement.UNRELATED)
705 .addComponent(btnCancel)
708 glButton.setVerticalGroup(glButton.createSequentialGroup()
709 .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
711 .addComponent(btnCancel)
715 GroupLayout layout = new GroupLayout(getContentPane());
716 layout.setAutoCreateContainerGaps(true);
717 getContentPane().setLayout(layout);
718 layout.setHorizontalGroup(
719 layout.createParallelGroup(GroupLayout.Alignment.LEADING)
720 .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
721 .addComponent(pnlButton)
723 layout.setVerticalGroup(
724 layout.createSequentialGroup()
725 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
726 .addComponent(pnlButton)
729 final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
730 final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
731 final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
732 final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
733 final JButton btnSystemTempDir = new JButton("...");
734 btnSystemTempDir.addActionListener(
735 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
737 mdlSystemThreadDownload.setMinimum(1);
738 final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
739 mdlSystemWaitDownload.setMinimum(0);
740 final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
741 mdlSystemThreadConvert.setMinimum(1);
742 final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
744 final JPanel pnlSystemGeneral = new JPanel();
745 pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
746 final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
747 glSystemGenegal.setAutoCreateGaps(true);
748 glSystemGenegal.setAutoCreateContainerGaps(true);
749 pnlSystemGeneral.setLayout(glSystemGenegal);
751 glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
752 .addGroup(glSystemGenegal.createSequentialGroup()
753 .addGroup(glSystemGenegal.createParallelGroup()
754 .addComponent(lblSystemThreadDownload)
755 .addComponent(lblSystemWaitDownload)
756 .addComponent(lblSystemThreadConvert))
757 .addGroup(glSystemGenegal.createParallelGroup()
758 .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
759 .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
760 .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
763 .addGroup(glSystemGenegal.createSequentialGroup()
764 .addComponent(lblSystemTempDir)
765 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
766 .addComponent(btnSystemTempDir)
770 glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
771 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
772 .addComponent(lblSystemThreadDownload)
773 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
774 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
775 .addComponent(lblSystemWaitDownload)
776 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
777 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
778 .addComponent(lblSystemThreadConvert)
779 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
780 .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
781 .addComponent(lblSystemTempDir)
782 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
783 .addComponent(btnSystemTempDir)
787 final JLabel lblSystemNeedReboot = new JLabel("設定を有効にするにはいんきゅばすの再起動が必要です");
789 final JPanel pnlSystem = new JPanel();
790 pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
791 final GroupLayout glSystem = new GroupLayout(pnlSystem);
792 glSystem.setAutoCreateGaps(true);
793 glSystem.setAutoCreateContainerGaps(true);
794 pnlSystem.setLayout(glSystem);
796 glSystem.setHorizontalGroup(glSystem.createParallelGroup()
797 .addComponent(lblSystemNeedReboot, Alignment.CENTER)
798 .addComponent(pnlSystemGeneral));
800 glSystem.setVerticalGroup(glSystem.createSequentialGroup()
801 .addComponent(lblSystemNeedReboot)
802 .addComponent(pnlSystemGeneral));
804 tabbedPane.add("システム", pnlSystem);
807 setMinimumSize(getSize());
813 final JRadioButton btnAccount = new JRadioButton("次の情報を使用してログインする");
814 private final JTextField fldMail;
815 private final JPasswordField fldPassword = new JPasswordField();
817 final JRadioButton btnLoginCookie = new JRadioButton("ブラウザのログイン情報を使用してアクセスする");
818 final JRadioButton btnCookieIe = new JRadioButton("IE(7以降) (Windows)");
819 final JRadioButton btnCookieFirefox = new JRadioButton("Firefox(4以降) (Windows)");
820 final JRadioButton btnCookieChrome = new JRadioButton("Google Chrome (Windows)");
821 final JRadioButton btnCookieChromium = new JRadioButton("Chrome派生ブラウザ (Windows)");
822 final JRadioButton btnCookieOpera = new JRadioButton("Opera (Windows)");
823 final JRadioButton btnCookieOther = new JRadioButton("上記以外 - cookie保存ディレクトリを次に入力");
824 final JTextField fldCookie = new JTextField();
826 private final JCheckBox cbProxyUse;
827 private final JTextField fldProxyHost = new JTextField();
828 private final NumberFormattedTextField fldProxyPort = new NumberFormattedTextField();
831 private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
833 private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
835 private final JTextField fldOutputDir;
836 private final JTextField fldOutputFileNamePattern;
837 private final JButton btnOutputDir = new JButton("...");
838 private final JCheckBox cbOutputEnable;
839 private final JCheckBox cbOutputCommentOverlay;
840 private final JCheckBox cbOutputDisplayProgress;
843 private final JCheckBox cbCommentSizeAuto = new JCheckBox("自動調整");
844 private final NumberFormattedTextField fldCommentSizeManual = new NumberFormattedTextField();
845 private final JCheckBox cbCommentMinDisable = new JCheckBox("少コメ");
846 private final JCheckBox cbCommentMinSizeAuto = new JCheckBox("自動調整");
847 private final NumberFormattedTextField fldCommentMinSizeManual = new NumberFormattedTextField();
848 private final JCheckBox cbCommentDisplaySizeDefault = new JCheckBox("標準(30)");
849 private final NumberFormattedTextField fldCommentDisplaySizeManual = new NumberFormattedTextField();
850 private final JCheckBox cbCommentOwnerOnly = new JCheckBox("投稿者コメントのみ");
852 private final JTextField fldFontPath;
853 private final JTextField fldFontIndex;
854 private final JComboBox<String> cmbFontShadow = new JComboBox<>();
855 private final JCheckBox cbFontSizeArrangeDisable;
856 private final JCheckBox cbCommentOpaque;
859 private final JTextField fldFfmpegPath = new JTextField();
860 private final JTextField fldFfmpegDllPath = new JTextField();
861 private final JTextField fldMediaInfoPath = new JTextField();
862 // ffmpeg - ffmpegパラメータ
863 private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
865 private final JCheckBox cbDisplayConverting = new JCheckBox("変換中動画表示");
866 private final JCheckBox cbDllDisabled = new JCheckBox("拡張DLL無効化(デバッグ用)");
869 private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
871 private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
874 private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
876 private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
878 private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
879 private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
880 private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
881 private final JTextField fldSystemTempDir = new JTextField();
884 // End of variables declaration//GEN-END:variables
886 private void loadConfig() {
887 final Config p = Config.INSTANCE;
892 btnAccount.setSelected(p.getNeedsLogin());
893 fldMail.setText(p.getId());
894 fldPassword.setText(p.getPassword());
899 btnLoginCookie.setSelected(!p.getNeedsLogin());
900 final CookieBrowser cookieBrowser = p.getCookieBrowser();
901 final JRadioButton enabledBrowser;
902 switch(cookieBrowser){
904 enabledBrowser = btnCookieIe;
907 enabledBrowser = btnCookieFirefox;
910 enabledBrowser = btnCookieChrome;
913 enabledBrowser = btnCookieChromium;
916 enabledBrowser = btnCookieOpera;
919 enabledBrowser = btnCookieOther;
922 throw new UnsupportedOperationException();
924 enabledBrowser.setSelected(true);
925 fldCookie.setText(p.getCookieDir());
930 cbProxyUse.setSelected(p.getProxyUse());
931 fldProxyHost.setText(p.getProxyHost());
932 fldProxyPort.setText(p.getProxyPort());
937 pnlFileVideo.fldDir.setText(p.getVideoDir());
938 pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
939 pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
944 pnlFileComment.fldDir.setText(p.getCommentDir());
945 pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
946 pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
951 fldOutputDir.setText(p.getOutputDir());
952 fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
953 cbOutputEnable.setSelected(p.getOutputEnable());
954 cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
955 cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
960 cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
961 fldCommentSizeManual.setText(p.getCommentSizeManual());
962 cbCommentMinDisable.setSelected(p.getCommentMinDisabled());
963 cbCommentMinSizeAuto.setSelected(p.getCommentMinSizeAutosize());
964 fldCommentSizeManual.setText(p.getCommentMinSizeManual());
965 cbCommentDisplaySizeDefault.setSelected(p.getCommentDisplaySizeDefault());
966 fldCommentDisplaySizeManual.setText(p.getCommentDisplaySizeManual());
967 cbCommentOwnerOnly.setSelected(p.getCommentOwnerOnly());
972 fldFontPath.setText(p.getFontPath());
973 fldFontIndex.setText(p.getFontIndex());
974 cmbFontShadow.setSelectedIndex(p.getFontShadow());
975 cbFontSizeArrangeDisable.setSelected(p.getFontSizeArrangeDisable());
976 cbCommentOpaque.setSelected(p.getCommentOpaque());
981 fldFfmpegPath.setText(p.getFfmpegPath());
982 fldFfmpegDllPath.setText(p.getFfmpegDllPath());
983 fldMediaInfoPath.setText(p.getMediaInfoPath());
986 * ffmpeg - ffmpegパラメータ
988 pnlFfmpegParam.init(p);
993 cbDisplayConverting.setSelected(p.getFfmpegDisplayConverting());
994 cbDllDisabled.setSelected(p.getFfmpegDllDisabled());
999 final List<String> ngWords = p.getNgWords();
1000 pnlNgWord.init(ngWords);
1001 final List<String> ngIds = p.getNgIds();
1002 pnlNgId.init(ngIds);
1007 pnlSearchVideo.init(p.getSearchVideoDirs());
1008 pnlSearchComment.init(p.getSearchCommentDirs());
1013 mdlSystemThreadDownload.setValue(p.getSystemDownloadThread());
1014 mdlSystemWaitDownload.setValue(p.getSystemDownloadWait());
1015 mdlSystemThreadConvert.setValue(p.getSystemConvertThread());
1016 fldSystemTempDir.setText(p.getSystemTempDir());
1019 private void saveConfig() {
1020 final Config p = Config.INSTANCE;
1025 p.setNeedsLogin(btnAccount.isSelected());
1026 p.setId(fldMail.getText());
1027 p.setPassword(String.valueOf(fldPassword.getPassword()));
1032 final CookieBrowser cookieBrowser;
1033 if(btnCookieIe.isSelected()) {
1034 cookieBrowser = CookieBrowser.MSIE;
1035 } else if(btnCookieFirefox.isSelected()) {
1036 cookieBrowser = CookieBrowser.FIREFOX;
1037 } else if (btnCookieChrome.isSelected()) {
1038 cookieBrowser = CookieBrowser.CHROME;
1039 } else if (btnCookieChromium.isSelected()) {
1040 cookieBrowser = CookieBrowser.CHROMIUM;
1041 } else if(btnCookieOpera.isSelected()) {
1042 cookieBrowser = CookieBrowser.OPERA;
1043 } else if(btnCookieOther.isSelected()) {
1044 cookieBrowser = CookieBrowser.OTHER;
1046 throw new UnsupportedOperationException();
1048 p.setCookieBrowser(cookieBrowser);
1049 p.setCookieDir(fldCookie.getText());
1054 p.setProxyUse(cbProxyUse.isSelected());
1055 p.setProxyHost(fldProxyHost.getText());
1056 p.setProxyPort(fldProxyPort.getText());
1061 p.setVideoDir(pnlFileVideo.fldDir.getText());
1062 p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
1063 p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
1068 p.setCommentDir(pnlFileComment.fldDir.getText());
1069 p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
1070 p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
1075 p.setOutputDir(fldOutputDir.getText());
1076 p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
1077 p.setOutputEnable(cbOutputEnable.isSelected());
1078 p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
1079 p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
1084 p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1085 p.setCommentSizeManual(fldCommentSizeManual.getText());
1086 p.setCommentMinDisabled(cbCommentMinDisable.isSelected());
1087 p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1088 p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1089 p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1090 p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1091 p.setCommentOwnerOnly(cbCommentOwnerOnly.isSelected());
1096 p.setFontPath(fldFontPath.getText());
1097 p.setFontIndex(fldFontIndex.getText());
1098 p.setFontShadow(cmbFontShadow.getSelectedIndex());
1099 p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1100 p.setCommentOpaque(cbCommentOpaque.isSelected());
1105 p.setFfmpegPath(fldFfmpegPath.getText());
1106 p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1107 p.setMediaInfoPath(fldMediaInfoPath.getText());
1110 * ffmpeg - ffmpegパラメータ
1112 final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1113 p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1114 p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1115 p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1116 p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1117 p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1118 p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1119 p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1120 p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1121 p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1122 p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1127 p.setFfmpegDisplayConverting(cbDisplayConverting.isSelected());
1128 p.setFfmpegDllDisabled(cbDllDisabled.isSelected());
1133 p.setNgWords(pnlNgWord.getAllElements());
1134 p.setNgIds(pnlNgId.getAllElements());
1139 p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1140 p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1145 p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
1146 p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
1147 p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
1148 p.setSystemTempDir(fldSystemTempDir.getText());
1152 } catch (ConfigurationException ex) {
1153 logger.error("コンフィグファイル保存に失敗", ex);
1158 class DownloadLocationPanel extends JPanel {
1160 private static final long serialVersionUID = 1L;
1161 final JTextField fldDir = new JTextField();
1162 final JTextField fldFileNamePattern = new JTextField();
1163 final JCheckBox cbLocal = new JCheckBox("local");
1165 DownloadLocationPanel(){
1168 final JLabel lblVideoDir = new JLabel("保存フォルダ");
1169 final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1171 final JButton btnDir = new JButton("...");
1172 btnDir.addActionListener(
1173 new FileChooseActionListener(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1175 final GroupLayout gl = new GroupLayout(this);
1177 gl.setHorizontalGroup(
1178 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1179 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1181 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1182 .addComponent(lblVideoFileNamepattern)
1183 .addComponent(lblVideoDir))
1184 .addPreferredGap(ComponentPlacement.RELATED)
1185 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1186 .addGroup(gl.createSequentialGroup()
1187 .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1188 .addPreferredGap(ComponentPlacement.RELATED)
1189 .addComponent(btnDir))
1190 .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1191 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1192 .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1193 .addComponent(cbLocal)))
1196 gl.setVerticalGroup(
1197 gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1198 .addGroup(gl.createSequentialGroup()
1199 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1200 .addComponent(lblVideoDir)
1201 .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1202 .addComponent(btnDir))
1203 .addPreferredGap(ComponentPlacement.RELATED)
1204 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1205 .addComponent(lblVideoFileNamepattern)
1206 .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1207 .addComponent(cbLocal))
1208 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))