OSDN Git Service

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