OSDN Git Service

ネットワークタブ内の項目表示準変更
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / ConfigDialog.java
1 /*
2  * Properties.java
3  *
4  * Created on 2011/08/20, 16:33:03
5  */
6 package yukihane.inqubus.gui;
7
8 import static javax.swing.GroupLayout.DEFAULT_SIZE;
9 import static javax.swing.GroupLayout.PREFERRED_SIZE;
10
11 import java.awt.event.ActionEvent;
12 import java.awt.event.ActionListener;
13 import java.io.File;
14 import java.util.List;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17 import javax.swing.BorderFactory;
18 import javax.swing.ButtonGroup;
19 import javax.swing.ComboBoxModel;
20 import javax.swing.DefaultComboBoxModel;
21 import javax.swing.GroupLayout;
22 import javax.swing.GroupLayout.Alignment;
23 import javax.swing.JButton;
24 import javax.swing.JCheckBox;
25 import javax.swing.JComboBox;
26 import javax.swing.JDialog;
27 import javax.swing.JFileChooser;
28 import javax.swing.JFrame;
29 import javax.swing.JLabel;
30 import javax.swing.JPanel;
31 import javax.swing.JPasswordField;
32 import javax.swing.JRadioButton;
33 import javax.swing.JSpinner;
34 import javax.swing.JTabbedPane;
35 import javax.swing.JTextField;
36 import javax.swing.LayoutStyle.ComponentPlacement;
37 import javax.swing.SpinnerNumberModel;
38 import javax.swing.WindowConstants;
39 import org.apache.commons.configuration.ConfigurationException;
40 import yukihane.inqubus.config.Config;
41
42 /**
43  *
44  * @author yuki
45  */
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 = "設定を有効にするにはいんきゅばすの再起動が必要です";
50
51     /** Creates new form Properties */
52     public ConfigDialog() {
53         this(null);
54     }
55
56     public ConfigDialog(JFrame owner){
57         super(owner);
58
59         final JTabbedPane tabbedPane = new JTabbedPane();
60         final JPanel pnlNetwork = new JPanel();
61         final JPanel pnlAccount = new JPanel();
62         final JLabel lblMail = new JLabel();
63         fldMail = new JTextField();
64         fldPassword.setEchoChar('*');
65         final JLabel lblPassword = new JLabel();
66         final JPanel pnlProxy = new JPanel();
67         cbProxyUse = new JCheckBox();
68         final JLabel lblProxyHost = new JLabel();
69         final JLabel lblProxyPort = new JLabel();
70         final JPanel pnlFile = new JPanel();
71         final JPanel pnlFileOutput = new JPanel();
72         final JLabel lblOutputDir = new JLabel();
73         final JLabel lblOutputFileNamePattern = new JLabel();
74         fldOutputDir = new JTextField();
75         fldOutputFileNamePattern = new JTextField();
76         cbOutputEnable = new JCheckBox();
77         cbOutputCommentOverlay = new JCheckBox();
78         cbOutputDisplayProgress = new JCheckBox();
79         final JPanel pnlComment = new JPanel();
80         final JPanel pnlCommentStandard = new JPanel();
81         final JLabel lblCommentSize = new JLabel();
82         final JLabel lblCommentSizeManual = new JLabel();
83         final JLabel lblCommentMinSize = new JLabel();
84         final JLabel lblCommentMinSizeManual = new JLabel();
85         final JLabel lblCommentDisplayMax = new JLabel();
86         final JLabel lblCommentDisplayMaxManual = new JLabel();
87         final JPanel pnlCommentAdvanced = new JPanel();
88         final JLabel lblFontPath = new JLabel();
89         cbFontSizeArrangeDisable = new JCheckBox();
90         cbCommentOpaque = new JCheckBox();
91         fldFontPath = new JTextField();
92         final JLabel lblFontIndex = new JLabel();
93         final JLabel lblFontShadow = new JLabel();
94         fldFontIndex = new JTextField();
95         final JPanel pnlFfmpeg = new JPanel();
96         final JPanel pnlFfmpegBinPath = new JPanel();
97         final JLabel lblFfmpegPath = new JLabel("ffmpeg");
98         final JLabel lblFfmpegDllPath = new JLabel("拡張ライブラリ");
99         final JLabel lblMediaInfoPath = new JLabel("MediaInfo");
100         final JPanel pnlNgSetting = new JPanel();
101         final JPanel pnlSearch = new JPanel();
102
103         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
104
105         pnlNetwork.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
106
107         pnlAccount.setBorder(BorderFactory.createTitledBorder("アカウント"));
108
109         lblMail.setText("ID(メールアドレス)");
110
111         lblPassword.setText("パスワード");
112
113         GroupLayout gl_pnlAccount = new GroupLayout(pnlAccount);
114         pnlAccount.setLayout(gl_pnlAccount);
115         gl_pnlAccount.setHorizontalGroup(
116             gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
117             .addGroup(gl_pnlAccount.createSequentialGroup()
118                 .addContainerGap()
119                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
120                     .addComponent(lblMail)
121                     .addComponent(lblPassword))
122                 .addPreferredGap(ComponentPlacement.RELATED)
123                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
124                     .addComponent(fldPassword, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
125                     .addComponent(fldMail, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE))
126                 .addContainerGap())
127         );
128         gl_pnlAccount.setVerticalGroup(
129             gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
130             .addGroup(gl_pnlAccount.createSequentialGroup()
131                 .addContainerGap()
132                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
133                     .addComponent(lblMail)
134                     .addComponent(fldMail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
135                 .addPreferredGap(ComponentPlacement.RELATED)
136                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
137                     .addComponent(lblPassword)
138                     .addComponent(fldPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
139                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
140         );
141
142
143         final JCheckBox cbxCookie = new JCheckBox("ブラウザのログイン情報を使用してアクセスする");
144         final JRadioButton btnCookieIe = new JRadioButton("IE(7以降) (Windows)");
145         final JRadioButton btnCookieFirefox = new JRadioButton("Firefox(4以降) (Windows)");
146         final JRadioButton btnCookieChrome = new JRadioButton("Google Chrome (Windows)");
147         final JRadioButton btnCookieChromium = new JRadioButton("Chrome派生ブラウザ (Windows)");
148         final JRadioButton btnCookieOpera = new JRadioButton("Opera (Windows)");
149         final JRadioButton btnCookieOther = new JRadioButton("上記以外 - cookie保存ディレクトリを次に入力");
150         final JTextField fldCookie = new JTextField();
151         final JButton btnCookie = new JButton("...");
152         btnCookie.addActionListener(new FileChooseActionListener(this, JFileChooser.DIRECTORIES_ONLY, fldCookie));
153
154         final ButtonGroup grpCookie = new ButtonGroup();
155         grpCookie.add(btnCookieIe);
156         grpCookie.add(btnCookieFirefox);
157         grpCookie.add(btnCookieChrome);
158         grpCookie.add(btnCookieChromium);
159         grpCookie.add(btnCookieOpera);
160         grpCookie.add(btnCookieOther);
161
162         final JPanel pnlCookie = new JPanel();
163         pnlCookie.setBorder(BorderFactory.createTitledBorder("cookie"));
164         final GroupLayout glCookie = new GroupLayout(pnlCookie);
165         pnlCookie.setLayout(glCookie);
166         glCookie.setAutoCreateContainerGaps(true);
167         glCookie.setAutoCreateGaps(true);
168
169         glCookie.setHorizontalGroup(glCookie.createParallelGroup()
170             .addComponent(cbxCookie)
171             .addGroup(glCookie.createSequentialGroup()
172                 .addGap(10)
173                 .addGroup(glCookie.createParallelGroup()
174                     .addComponent(btnCookieIe)
175                     .addComponent(btnCookieFirefox)
176                     .addComponent(btnCookieChrome)
177                     .addComponent(btnCookieChromium)
178                     .addComponent(btnCookieOpera)
179                     .addComponent(btnCookieOther)
180                     .addGroup(glCookie.createSequentialGroup()
181                         .addComponent(fldCookie)
182                         .addComponent(btnCookie)
183                     )
184                 )
185             )
186         );
187
188         glCookie.setVerticalGroup(glCookie.createSequentialGroup()
189             .addComponent(cbxCookie)
190             .addComponent(btnCookieIe)
191             .addComponent(btnCookieFirefox)
192             .addComponent(btnCookieChrome)
193             .addComponent(btnCookieChromium)
194             .addComponent(btnCookieOpera)
195             .addComponent(btnCookieOther)
196             .addGroup(glCookie.createParallelGroup(Alignment.BASELINE)
197                 .addComponent(fldCookie)
198                 .addComponent(btnCookie)
199             )
200         );
201
202
203         pnlProxy.setBorder(BorderFactory.createTitledBorder("プロキシ"));
204
205         cbProxyUse.setText("プロキシを使用する");
206
207         lblProxyHost.setText("ホスト名");
208
209         lblProxyPort.setText("ポート番号");
210
211         GroupLayout gl_pnlProxy = new GroupLayout(pnlProxy);
212         pnlProxy.setLayout(gl_pnlProxy);
213         gl_pnlProxy.setHorizontalGroup(
214             gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
215             .addGroup(gl_pnlProxy.createSequentialGroup()
216                 .addContainerGap()
217                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
218                     .addComponent(cbProxyUse)
219                     .addGroup(gl_pnlProxy.createSequentialGroup()
220                         .addComponent(lblProxyHost)
221                         .addGap(18, 18, 18)
222                         .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
223                     .addGroup(gl_pnlProxy.createSequentialGroup()
224                         .addComponent(lblProxyPort)
225                         .addPreferredGap(ComponentPlacement.RELATED)
226                         .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
227                 .addContainerGap(181, Short.MAX_VALUE))
228         );
229         gl_pnlProxy.setVerticalGroup(
230             gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
231             .addGroup(gl_pnlProxy.createSequentialGroup()
232                 .addContainerGap()
233                 .addComponent(cbProxyUse)
234                 .addPreferredGap(ComponentPlacement.RELATED)
235                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
236                     .addComponent(lblProxyHost)
237                     .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
238                 .addPreferredGap(ComponentPlacement.RELATED)
239                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
240                     .addComponent(lblProxyPort)
241                     .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
242                 .addContainerGap())
243         );
244
245
246         GroupLayout gl_pnlNetwork = new GroupLayout(pnlNetwork);
247         pnlNetwork.setLayout(gl_pnlNetwork);
248         gl_pnlNetwork.setHorizontalGroup(
249             gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
250             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNetwork.createSequentialGroup()
251                 .addContainerGap()
252                 .addGroup(gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.TRAILING)
253                     .addComponent(pnlAccount, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
254                     .addComponent(pnlCookie, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
255                     .addComponent(pnlProxy, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
256                 )
257                 .addContainerGap())
258         );
259         gl_pnlNetwork.setVerticalGroup(
260             gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
261             .addGroup(gl_pnlNetwork.createSequentialGroup()
262                 .addContainerGap()
263                 .addComponent(pnlAccount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
264                 .addPreferredGap(ComponentPlacement.RELATED)
265                 .addComponent(pnlCookie, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
266                 .addPreferredGap(ComponentPlacement.RELATED)
267                 .addComponent(pnlProxy, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
268                 .addContainerGap()
269             )
270         );
271
272         tabbedPane.addTab("ネットワーク", pnlNetwork);
273
274         pnlFileVideo.setBorder(BorderFactory.createTitledBorder("動画"));
275
276         pnlFileComment.setBorder(BorderFactory.createTitledBorder("コメント"));
277
278         pnlFileOutput.setBorder(BorderFactory.createTitledBorder("変換動画"));
279
280         lblOutputDir.setText("保存フォルダ");
281
282         lblOutputFileNamePattern.setText("ファイル名規則");
283
284         btnOutputDir.addActionListener(
285                 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldOutputDir));
286
287         cbOutputEnable.setText("変換");
288
289         cbOutputCommentOverlay.setText("コメント付与");
290
291         cbOutputDisplayProgress.setText("変換中動画表示");
292
293         GroupLayout gl_pnlFileOutput = new GroupLayout(pnlFileOutput);
294         pnlFileOutput.setLayout(gl_pnlFileOutput);
295         gl_pnlFileOutput.setHorizontalGroup(
296             gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
297             .addGroup(gl_pnlFileOutput.createSequentialGroup()
298                 .addContainerGap()
299                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
300                     .addComponent(lblOutputFileNamePattern)
301                     .addComponent(lblOutputDir))
302                 .addPreferredGap(ComponentPlacement.RELATED)
303                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
304                     .addGroup(gl_pnlFileOutput.createSequentialGroup()
305                         .addComponent(fldOutputDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
306                         .addPreferredGap(ComponentPlacement.RELATED)
307                         .addComponent(btnOutputDir)
308                         .addContainerGap())
309                     .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileOutput.createSequentialGroup()
310                         .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
311                         .addPreferredGap(ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
312                         .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
313                             .addComponent(cbOutputDisplayProgress)
314                             .addGroup(gl_pnlFileOutput.createSequentialGroup()
315                                 .addComponent(cbOutputEnable)
316                                 .addPreferredGap(ComponentPlacement.RELATED)
317                                 .addComponent(cbOutputCommentOverlay))))))
318         );
319         gl_pnlFileOutput.setVerticalGroup(
320             gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
321             .addGroup(gl_pnlFileOutput.createSequentialGroup()
322                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
323                     .addComponent(lblOutputDir)
324                     .addComponent(fldOutputDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
325                     .addComponent(btnOutputDir))
326                 .addPreferredGap(ComponentPlacement.RELATED)
327                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
328                     .addComponent(lblOutputFileNamePattern)
329                     .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
330                     .addComponent(cbOutputCommentOverlay)
331                     .addComponent(cbOutputEnable))
332                 .addPreferredGap(ComponentPlacement.RELATED)
333                 .addComponent(cbOutputDisplayProgress)
334                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
335         );
336
337         final JPanel pnlFileProhibit = new JPanel();
338         pnlFileProhibit.setBorder(BorderFactory.createTitledBorder("禁則文字"));
339         final JLabel lblReplaceFrom = new JLabel("置換対象文字");
340         final JLabel lblReplaceTo = new JLabel("置換後文字");
341
342         final GroupLayout glProhibit = new GroupLayout(pnlFileProhibit);
343         glProhibit.setAutoCreateContainerGaps(true);
344         glProhibit.setAutoCreateGaps(true);
345         pnlFileProhibit.setLayout(glProhibit);
346
347         glProhibit.setHorizontalGroup(glProhibit.createSequentialGroup()
348             .addGroup(glProhibit.createParallelGroup()
349                 .addComponent(lblReplaceFrom)
350                 .addComponent(lblReplaceTo)
351             )
352             .addGroup(glProhibit.createParallelGroup()
353                 .addComponent(fldReplaceFrom)
354                 .addComponent(fldReplaceTo)
355             )
356         );
357
358         glProhibit.setVerticalGroup(glProhibit.createSequentialGroup()
359             .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
360                 .addComponent(lblReplaceFrom)
361                 .addComponent(fldReplaceFrom)
362             )
363             .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
364                 .addComponent(lblReplaceTo)
365                 .addComponent(fldReplaceTo)
366             )
367         );
368
369         GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
370         pnlFile.setLayout(gl_pnlFile);
371         gl_pnlFile.setHorizontalGroup(
372             gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
373             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
374                 .addContainerGap()
375                 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
376                     .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
377                     .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
378                     .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
379                     .addComponent(pnlFileProhibit, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
380                 )
381                 .addContainerGap())
382         );
383         gl_pnlFile.setVerticalGroup(
384             gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
385             .addGroup(gl_pnlFile.createSequentialGroup()
386                 .addContainerGap()
387                 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
388                 .addPreferredGap(ComponentPlacement.RELATED)
389                 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
390                 .addPreferredGap(ComponentPlacement.RELATED)
391                 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
392                 .addPreferredGap(ComponentPlacement.RELATED)
393                 .addComponent(pnlFileProhibit, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
394                 .addContainerGap())
395         );
396
397         tabbedPane.addTab("ファイル", pnlFile);
398
399         pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
400
401         lblCommentSize.setText("再生時間に応じたコメントの取得数");
402
403         lblCommentSizeManual.setText("手動取得");
404
405         lblCommentMinSize.setText("1分当たりのコメント取得数");
406
407         lblCommentMinSizeManual.setText("手動取得");
408
409         lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
410
411         lblCommentDisplayMaxManual.setText("手動設定");
412
413         GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
414         pnlCommentStandard.setLayout(gl_pnlCommentStandard);
415         gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
416         gl_pnlCommentStandard.setAutoCreateGaps(true);
417         gl_pnlCommentStandard.setHorizontalGroup(
418             gl_pnlCommentStandard.createSequentialGroup()
419                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
420                     .addComponent(lblCommentSize)
421                     .addComponent(lblCommentMinSize)
422                     .addComponent(lblCommentDisplayMax))
423                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
424                     .addComponent(cbCommentSizeAuto)
425                     .addComponent(cbCommentMinDisable)
426                     .addComponent(cbCommentMinSizeAuto)
427                     .addComponent(cbCommentDisplaySizeDefault))
428                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
429                     .addComponent(lblCommentSizeManual)
430                     .addComponent(lblCommentMinSizeManual)
431                     .addComponent(lblCommentDisplayMaxManual))
432                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
433                     .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
434                     .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
435                     .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
436         );
437         gl_pnlCommentStandard.setVerticalGroup(
438             gl_pnlCommentStandard.createSequentialGroup()
439                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
440                     .addComponent(lblCommentSize)
441                     .addComponent(cbCommentSizeAuto)
442                     .addComponent(lblCommentSizeManual)
443                     .addComponent(fldCommentSizeManual))
444                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
445                     .addComponent(lblCommentMinSize)
446                     .addComponent(cbCommentMinDisable)
447                 )
448                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
449                     .addComponent(cbCommentMinSizeAuto)
450                     .addComponent(lblCommentMinSizeManual)
451                     .addComponent(fldCommentMinSizeManual))
452                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
453                     .addComponent(lblCommentDisplayMax)
454                     .addComponent(cbCommentDisplaySizeDefault)
455                     .addComponent(lblCommentDisplayMaxManual)
456                     .addComponent(fldCommentDisplaySizeManual))
457         );
458
459         pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
460
461         lblFontPath.setText("フォントパス");
462
463         cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
464
465         cbCommentOpaque.setText("コメント透明化を行わない");
466
467         final JButton btnFontPath = new JButton("...");
468         btnFontPath.addActionListener(
469                 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
470
471         lblFontIndex.setText("フォント番号");
472
473         lblFontShadow.setText("影の種類");
474         final ComboBoxModel<String> cbmFontShadow
475                 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
476         cmbFontShadow.setModel(cbmFontShadow);
477
478         GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
479         pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
480         gl_pnlCommentAdvanced.setHorizontalGroup(
481             gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
482             .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
483                 .addContainerGap()
484                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
485                     .addComponent(cbCommentOpaque)
486                     .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
487                         .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
488                             .addComponent(lblFontPath)
489                             .addComponent(lblFontIndex)
490                             .addComponent(lblFontShadow))
491                         .addGap(18, 18, 18)
492                         .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
493                             .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
494                             .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
495                                 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
496                                 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
497                         .addPreferredGap(ComponentPlacement.RELATED)
498                         .addComponent(btnFontPath))
499                     .addComponent(cbFontSizeArrangeDisable))
500                 .addContainerGap())
501         );
502         gl_pnlCommentAdvanced.setVerticalGroup(
503             gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
504             .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
505                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
506                     .addComponent(lblFontPath)
507                     .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
508                     .addComponent(btnFontPath))
509                 .addPreferredGap(ComponentPlacement.RELATED)
510                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
511                     .addComponent(lblFontIndex)
512                     .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
513                 .addPreferredGap(ComponentPlacement.RELATED)
514                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
515                     .addComponent(lblFontShadow)
516                     .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
517                 .addPreferredGap(ComponentPlacement.RELATED)
518                 .addComponent(cbFontSizeArrangeDisable)
519                 .addPreferredGap(ComponentPlacement.RELATED)
520                 .addComponent(cbCommentOpaque)
521                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
522         );
523
524         GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
525         pnlComment.setLayout(gl_pnlComment);
526         gl_pnlComment.setHorizontalGroup(
527             gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
528             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
529                 .addContainerGap()
530                 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
531                     .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
532                     .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
533                 .addContainerGap())
534         );
535         gl_pnlComment.setVerticalGroup(
536             gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
537             .addGroup(gl_pnlComment.createSequentialGroup()
538                 .addContainerGap()
539                 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
540                 .addPreferredGap(ComponentPlacement.RELATED)
541                 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
542                 .addContainerGap(168, Short.MAX_VALUE))
543         );
544
545         tabbedPane.addTab("コメント", pnlComment);
546
547         pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
548
549         final JButton btnFfmpegPath = new JButton("...");
550         btnFfmpegPath.addActionListener(
551                 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
552
553         final JButton btnFfmpegDllPath = new JButton("...");
554         btnFfmpegDllPath.addActionListener(
555                 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
556
557         final JButton btnMediaInfoPath = new JButton("...");
558         btnMediaInfoPath.addActionListener(
559                 new FileChooseActionListener(ConfigDialog.this, JFileChooser.FILES_ONLY, fldMediaInfoPath));
560
561         GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath);
562         pnlFfmpegBinPath.setLayout(gl_jPanel10);
563         gl_jPanel10.setHorizontalGroup(
564             gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
565             .addGroup(gl_jPanel10.createSequentialGroup()
566                 .addContainerGap()
567                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
568                     .addComponent(lblFfmpegPath)
569                     .addComponent(lblFfmpegDllPath)
570                     .addComponent(lblMediaInfoPath)
571                 )
572                 .addPreferredGap(ComponentPlacement.RELATED)
573                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
574                     .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
575                     .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
576                     .addComponent(fldMediaInfoPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
577                 )
578                 .addPreferredGap(ComponentPlacement.RELATED)
579                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
580                     .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
581                     .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING)
582                     .addComponent(btnMediaInfoPath, GroupLayout.Alignment.TRAILING)
583                 )
584                 .addContainerGap())
585         );
586         gl_jPanel10.setVerticalGroup(
587             gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
588             .addGroup(gl_jPanel10.createSequentialGroup()
589                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
590                     .addComponent(lblFfmpegPath)
591                     .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
592                     .addComponent(btnFfmpegPath))
593                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
594                     .addComponent(lblFfmpegDllPath)
595                     .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
596                     .addComponent(btnFfmpegDllPath))
597                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
598                     .addComponent(lblMediaInfoPath)
599                     .addComponent(fldMediaInfoPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
600                     .addComponent(btnMediaInfoPath))
601             )
602         );
603
604         pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
605
606         // ffmpeg - その他
607         final JPanel pnlFffmpegEtc = new JPanel();
608         pnlFffmpegEtc.setBorder(BorderFactory.createTitledBorder("その他"));
609         final GroupLayout glFfmpegEtc = new GroupLayout(pnlFffmpegEtc);
610         glFfmpegEtc.setAutoCreateContainerGaps(true);
611         glFfmpegEtc.setAutoCreateGaps(true);
612         pnlFffmpegEtc.setLayout(glFfmpegEtc);
613
614         glFfmpegEtc.setHorizontalGroup(glFfmpegEtc.createParallelGroup()
615             .addComponent(cbDisplayConverting)
616             .addComponent(cbDllDisabled)
617         );
618         glFfmpegEtc.setVerticalGroup(glFfmpegEtc.createSequentialGroup()
619             .addComponent(cbDisplayConverting)
620             .addComponent(cbDllDisabled)
621         );
622
623         final GroupLayout glFfmpeg = new GroupLayout(pnlFfmpeg);
624         glFfmpeg.setAutoCreateContainerGaps(true);
625         pnlFfmpeg.setLayout(glFfmpeg);
626         glFfmpeg.setHorizontalGroup(glFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
627             .addComponent(pnlFfmpegBinPath)
628             .addComponent(pnlFfmpegParam)
629             .addComponent(pnlFffmpegEtc)
630         );
631         glFfmpeg.setVerticalGroup(glFfmpeg.createSequentialGroup()
632             .addComponent(pnlFfmpegBinPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
633             .addPreferredGap(ComponentPlacement.RELATED)
634             .addComponent(pnlFfmpegParam)
635             .addComponent(pnlFffmpegEtc)
636         );
637
638         tabbedPane.addTab("ffmpeg", pnlFfmpeg);
639
640         pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
641         pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
642
643         GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
644         pnlNgSetting.setLayout(gl_pnlNgSetting);
645         gl_pnlNgSetting.setHorizontalGroup(
646             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
647             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
648                 .addContainerGap()
649                 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
650                     .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
651                     .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
652                 .addContainerGap())
653         );
654         gl_pnlNgSetting.setVerticalGroup(
655             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
656             .addGroup(gl_pnlNgSetting.createSequentialGroup()
657                 .addContainerGap()
658                 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
659                 .addPreferredGap(ComponentPlacement.RELATED)
660                 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
661                 .addContainerGap())
662         );
663
664         tabbedPane.addTab("NG設定", pnlNgSetting);
665
666         pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
667         pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
668
669         final JLabel lblSearchNeedReboot = new JLabel(NEED_REBOOT);
670
671         GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
672         pnlSearch.setLayout(gl_pnlSearch);
673         gl_pnlSearch.setHorizontalGroup(
674             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
675             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
676                 .addContainerGap()
677                 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
678                     .addComponent(lblSearchNeedReboot, Alignment.CENTER)
679                     .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
680                     .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
681                 .addContainerGap())
682         );
683         gl_pnlSearch.setVerticalGroup(
684             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
685             .addGroup(gl_pnlSearch.createSequentialGroup()
686                 .addContainerGap()
687                 .addComponent(lblSearchNeedReboot)
688                 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
689                 .addPreferredGap(ComponentPlacement.RELATED)
690                 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
691                 .addContainerGap()
692             )
693         );
694
695         tabbedPane.addTab("検索", pnlSearch);
696
697         final JButton btnOk = new JButton("保存");
698         btnOk.addActionListener(new ActionListener() {
699
700             @Override
701             public void actionPerformed(ActionEvent e) {
702                 saveConfig();
703                 dispose();
704             }
705         });
706         final JButton btnCancel = new JButton("取消");
707         btnCancel.addActionListener(new ActionListener() {
708
709             @Override
710             public void actionPerformed(ActionEvent e) {
711                 dispose();
712             }
713         });
714         final JPanel pnlButton = new JPanel();
715
716         final GroupLayout glButton = new GroupLayout(pnlButton);
717         pnlButton.setLayout(glButton);
718         glButton.setHorizontalGroup(glButton.createSequentialGroup()
719             .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
720             .addComponent(btnOk)
721             .addPreferredGap(ComponentPlacement.UNRELATED)
722             .addComponent(btnCancel)
723             .addContainerGap()
724         );
725         glButton.setVerticalGroup(glButton.createSequentialGroup()
726             .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
727                 .addComponent(btnOk)
728                 .addComponent(btnCancel)
729             )
730         );
731
732         GroupLayout layout = new GroupLayout(getContentPane());
733         layout.setAutoCreateContainerGaps(true);
734         getContentPane().setLayout(layout);
735         layout.setHorizontalGroup(
736             layout.createParallelGroup(GroupLayout.Alignment.LEADING)
737             .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
738             .addComponent(pnlButton)
739         );
740         layout.setVerticalGroup(
741             layout.createSequentialGroup()
742                 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
743                 .addComponent(pnlButton)
744         );
745
746         final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
747         final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
748         final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
749         final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
750         final JButton btnSystemTempDir = new JButton("...");
751         btnSystemTempDir.addActionListener(
752                 new FileChooseActionListener(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
753
754         mdlSystemThreadDownload.setMinimum(1);
755         final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
756         mdlSystemWaitDownload.setMinimum(0);
757         final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
758         mdlSystemThreadConvert.setMinimum(1);
759         final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
760
761         final JPanel pnlSystemGeneral = new JPanel();
762         pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
763         final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
764         glSystemGenegal.setAutoCreateGaps(true);
765         glSystemGenegal.setAutoCreateContainerGaps(true);
766         pnlSystemGeneral.setLayout(glSystemGenegal);
767
768         glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
769             .addGroup(glSystemGenegal.createSequentialGroup()
770                 .addGroup(glSystemGenegal.createParallelGroup()
771                     .addComponent(lblSystemThreadDownload)
772                     .addComponent(lblSystemWaitDownload)
773                     .addComponent(lblSystemThreadConvert))
774                 .addGroup(glSystemGenegal.createParallelGroup()
775                     .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
776                     .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
777                     .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
778                 )
779             )
780             .addGroup(glSystemGenegal.createSequentialGroup()
781                 .addComponent(lblSystemTempDir)
782                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
783                 .addComponent(btnSystemTempDir)
784                 )
785             );
786
787         glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
788             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
789                 .addComponent(lblSystemThreadDownload)
790                 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
791             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
792                 .addComponent(lblSystemWaitDownload)
793                 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
794             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
795                 .addComponent(lblSystemThreadConvert)
796                 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
797             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
798                 .addComponent(lblSystemTempDir)
799                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
800                 .addComponent(btnSystemTempDir)
801             )
802         );
803
804         final JLabel lblSystemNeedReboot = new JLabel("設定を有効にするにはいんきゅばすの再起動が必要です");
805
806         final JPanel pnlSystem = new JPanel();
807         pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
808         final GroupLayout glSystem = new GroupLayout(pnlSystem);
809         glSystem.setAutoCreateGaps(true);
810         glSystem.setAutoCreateContainerGaps(true);
811         pnlSystem.setLayout(glSystem);
812
813         glSystem.setHorizontalGroup(glSystem.createParallelGroup()
814             .addComponent(lblSystemNeedReboot, Alignment.CENTER)
815             .addComponent(pnlSystemGeneral));
816
817         glSystem.setVerticalGroup(glSystem.createSequentialGroup()
818             .addComponent(lblSystemNeedReboot)
819             .addComponent(pnlSystemGeneral));
820
821         tabbedPane.add("システム", pnlSystem);
822
823         pack();
824         setMinimumSize(getSize());
825         loadConfig();
826     }
827
828     // ネットワーク
829     // ネットワーク - アカウント
830     private final JTextField fldMail;
831     private final JPasswordField fldPassword = new JPasswordField();
832     // ネットワーク - プロキシ
833     private final JCheckBox cbProxyUse;
834     private final JTextField fldProxyHost = new JTextField();
835     private final NumberFormattedTextField fldProxyPort = new NumberFormattedTextField();
836     // ファイル
837     // ファイル - 動画
838     private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
839     // ファイル - コメント
840     private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
841     // ファイル - 変換動画
842     private final JTextField fldOutputDir;
843     private final JTextField fldOutputFileNamePattern;
844     private final JButton btnOutputDir = new JButton("...");
845     private final JCheckBox cbOutputEnable;
846     private final JCheckBox cbOutputCommentOverlay;
847     private final JCheckBox cbOutputDisplayProgress;
848     // ファイル - 禁則文字
849     private final JTextField fldReplaceFrom = new JTextField();
850     private final JTextField fldReplaceTo = new JTextField();
851     // コメント
852     // コメント
853     private final JCheckBox cbCommentSizeAuto = new JCheckBox("自動調整");
854     private final NumberFormattedTextField fldCommentSizeManual = new NumberFormattedTextField();
855     private final JCheckBox cbCommentMinDisable = new JCheckBox("少コメ");
856     private final JCheckBox cbCommentMinSizeAuto = new JCheckBox("自動調整");
857     private final NumberFormattedTextField fldCommentMinSizeManual = new NumberFormattedTextField();
858     private final JCheckBox cbCommentDisplaySizeDefault = new JCheckBox("標準(30)");
859     private final NumberFormattedTextField fldCommentDisplaySizeManual = new NumberFormattedTextField();
860     // コメント - 高度な設定
861     private final JTextField fldFontPath;
862     private final JTextField fldFontIndex;
863     private final JComboBox<String> cmbFontShadow = new JComboBox<>();
864     private final JCheckBox cbFontSizeArrangeDisable;
865     private final JCheckBox cbCommentOpaque;
866     // ffmpeg
867     // ffmpeg - ファイルパス
868     private final JTextField fldFfmpegPath = new JTextField();
869     private final JTextField fldFfmpegDllPath = new JTextField();
870     private final JTextField fldMediaInfoPath = new JTextField();
871     // ffmpeg - ffmpegパラメータ
872     private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
873     // ffmpeg - その他
874     private final JCheckBox cbDisplayConverting = new JCheckBox("変換中動画表示");
875     private final JCheckBox cbDllDisabled = new JCheckBox("拡張DLL無効化(デバッグ用)");
876     // NG設定
877     // NG設定 - NGワード
878     private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
879     // NG設定 - NGID
880     private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
881     // 検索
882     // 検索 - 動画検索対象フォルダ
883     private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
884     // 検索 - コメント検索対象フォルダ
885     private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
886     // システム
887     private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
888     private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
889     private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
890     private final JTextField fldSystemTempDir = new JTextField();
891
892
893     // End of variables declaration//GEN-END:variables
894
895     private void loadConfig() {
896         final Config p = Config.INSTANCE;
897
898         /*
899          * ネットワーク - アカウント
900          */
901         fldMail.setText(p.getId());
902         fldPassword.setText(p.getPassword());
903
904         /*
905          * ネットワーク - プロキシ
906          */
907         cbProxyUse.setSelected(p.getProxyUse());
908         fldProxyHost.setText(p.getProxyHost());
909         fldProxyPort.setText(p.getProxyPort());
910
911         /*
912          * ファイル - 動画
913          */
914         pnlFileVideo.fldDir.setText(p.getVideoDir());
915         pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
916         pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
917
918         /*
919          * ファイル - コメント
920          */
921         pnlFileComment.fldDir.setText(p.getCommentDir());
922         pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
923         pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
924
925         /*
926          * ファイル - 変換動画
927          */
928         fldOutputDir.setText(p.getOutputDir());
929         fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
930         cbOutputEnable.setSelected(p.getOutputEnable());
931         cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
932         cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
933
934         /*
935          * ファイル - 禁則文字
936          */
937         fldReplaceFrom.setText(p.getReplaceFrom());
938         fldReplaceTo.setText(p.getReplaceTo());
939
940         /**
941          * コメント
942          */
943         cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
944         fldCommentSizeManual.setText(p.getCommentSizeManual());
945         cbCommentMinDisable.setSelected(p.getCommentMinDisabled());
946         cbCommentMinSizeAuto.setSelected(p.getCommentMinSizeAutosize());
947         fldCommentSizeManual.setText(p.getCommentMinSizeManual());
948         cbCommentDisplaySizeDefault.setSelected(p.getCommentDisplaySizeDefault());
949         fldCommentDisplaySizeManual.setText(p.getCommentDisplaySizeManual());
950
951         /**
952          * コメント - 高度な設定
953          */
954         fldFontPath.setText(p.getFontPath());
955         fldFontIndex.setText(p.getFontIndex());
956         cmbFontShadow.setSelectedIndex(p.getFontShadow());
957         cbFontSizeArrangeDisable.setSelected(p.getFontSizeArrangeDisable());
958         cbCommentOpaque.setSelected(p.getCommentOpaque());
959
960         /*
961          * ffmpeg - ファイルパス
962          */
963         fldFfmpegPath.setText(p.getFfmpegPath());
964         fldFfmpegDllPath.setText(p.getFfmpegDllPath());
965         fldMediaInfoPath.setText(p.getMediaInfoPath());
966
967         /*
968          * ffmpeg - ffmpegパラメータ
969          */
970         pnlFfmpegParam.init(p);
971
972         /*
973          * ffmpeg - その他
974          */
975         cbDisplayConverting.setSelected(p.getFfmpegDisplayConverting());
976         cbDllDisabled.setSelected(p.getFfmpegDllDisabled());
977
978         /*
979          * NG 設定
980          */
981         final List<String> ngWords = p.getNgWords();
982         pnlNgWord.init(ngWords);
983         final List<String> ngIds = p.getNgIds();
984         pnlNgId.init(ngIds);
985
986         /*
987          * 検索
988          */
989         pnlSearchVideo.init(p.getSearchVideoDirs());
990         pnlSearchComment.init(p.getSearchCommentDirs());
991
992         /*
993          * システム
994          */
995         mdlSystemThreadDownload.setValue(p.getSystemDownloadThread());
996         mdlSystemWaitDownload.setValue(p.getSystemDownloadWait());
997         mdlSystemThreadConvert.setValue(p.getSystemConvertThread());
998         fldSystemTempDir.setText(p.getSystemTempDir());
999     }
1000
1001     private void saveConfig() {
1002         final Config p = Config.INSTANCE;
1003
1004         /*
1005          * ネットワーク - アカウント
1006          */
1007
1008         p.setId(fldMail.getText());
1009         p.setPassword(String.valueOf(fldPassword.getPassword()));
1010
1011         /*
1012          * ネットワーク - プロキシ
1013          */
1014         p.setProxyUse(cbProxyUse.isSelected());
1015         p.setProxyHost(fldProxyHost.getText());
1016         p.setProxyPort(fldProxyPort.getText());
1017
1018         /*
1019          * ファイル - 動画
1020          */
1021         p.setVideoDir(pnlFileVideo.fldDir.getText());
1022         p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
1023         p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
1024
1025         /*
1026          * ファイル - コメント
1027          */
1028         p.setCommentDir(pnlFileComment.fldDir.getText());
1029         p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
1030         p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
1031
1032         /*
1033          * ファイル - 変換動画
1034          */
1035         p.setOutputDir(fldOutputDir.getText());
1036         p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
1037         p.setOutputEnable(cbOutputEnable.isSelected());
1038         p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
1039         p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
1040
1041         /*
1042          * ファイル - 禁則文字
1043          */
1044         p.setReplaceFrom(fldReplaceFrom.getText());
1045         p.setReplaceTo(fldReplaceTo.getText());
1046
1047         /*
1048          * コメント
1049          */
1050         p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1051         p.setCommentSizeManual(fldCommentSizeManual.getText());
1052         p.setCommentMinDisabled(cbCommentMinDisable.isSelected());
1053         p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1054         p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1055         p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1056         p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1057
1058         /**
1059          * コメント - 高度な設定
1060          */
1061         p.setFontPath(fldFontPath.getText());
1062         p.setFontIndex(fldFontIndex.getText());
1063         p.setFontShadow(cmbFontShadow.getSelectedIndex());
1064         p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1065         p.setCommentOpaque(cbCommentOpaque.isSelected());
1066
1067         /*
1068          * ffmpeg - ファイルパス
1069          */
1070         p.setFfmpegPath(fldFfmpegPath.getText());
1071         p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1072         p.setMediaInfoPath(fldMediaInfoPath.getText());
1073
1074         /*
1075          * ffmpeg - ffmpegパラメータ
1076          */
1077         final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1078         p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1079         p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1080         p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1081         p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1082         p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1083         p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1084         p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1085         p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1086         p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1087         p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1088
1089         /*
1090          * ffmpeg - その他
1091          */
1092         p.setFfmpegDisplayConverting(cbDisplayConverting.isSelected());
1093         p.setFfmpegDllDisabled(cbDllDisabled.isSelected());
1094
1095         /*
1096          * NG 設定
1097          */
1098         p.setNgWords(pnlNgWord.getAllElements());
1099         p.setNgIds(pnlNgId.getAllElements());
1100
1101         /*
1102          * 検索
1103          */
1104         p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1105         p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1106
1107         /*
1108          * システム
1109          */
1110         p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
1111         p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
1112         p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
1113         p.setSystemTempDir(fldSystemTempDir.getText());
1114
1115         try {
1116             p.save();
1117         } catch (ConfigurationException ex) {
1118             logger.error("コンフィグファイル保存に失敗", ex);
1119         }
1120     }
1121 }
1122
1123 class DownloadLocationPanel extends JPanel {
1124
1125     private static final long serialVersionUID = 1L;
1126     final JTextField fldDir = new JTextField();
1127     final JTextField fldFileNamePattern = new JTextField();
1128     final JCheckBox cbLocal = new JCheckBox("local");
1129
1130     DownloadLocationPanel(){
1131         super();
1132
1133         final JLabel lblVideoDir = new JLabel("保存フォルダ");
1134         final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1135
1136         final JButton btnDir = new JButton("...");
1137         btnDir.addActionListener(
1138                 new FileChooseActionListener(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1139
1140         final GroupLayout gl = new GroupLayout(this);
1141         setLayout(gl);
1142         gl.setHorizontalGroup(
1143             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1144             .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1145                 .addContainerGap()
1146                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1147                     .addComponent(lblVideoFileNamepattern)
1148                     .addComponent(lblVideoDir))
1149                 .addPreferredGap(ComponentPlacement.RELATED)
1150                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1151                     .addGroup(gl.createSequentialGroup()
1152                         .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1153                         .addPreferredGap(ComponentPlacement.RELATED)
1154                         .addComponent(btnDir))
1155                     .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1156                         .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1157                         .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1158                         .addComponent(cbLocal)))
1159                 .addContainerGap())
1160         );
1161         gl.setVerticalGroup(
1162             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1163             .addGroup(gl.createSequentialGroup()
1164                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1165                     .addComponent(lblVideoDir)
1166                     .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1167                     .addComponent(btnDir))
1168                 .addPreferredGap(ComponentPlacement.RELATED)
1169                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1170                     .addComponent(lblVideoFileNamepattern)
1171                     .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1172                     .addComponent(cbLocal))
1173                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1174         );
1175
1176     }
1177 }