OSDN Git Service

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