OSDN Git Service

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