OSDN Git Service

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