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.JTabbedPane;
31 import javax.swing.JTextField;
32 import javax.swing.LayoutStyle.ComponentPlacement;
33 import javax.swing.UIManager;
34 import javax.swing.UnsupportedLookAndFeelException;
35 import javax.swing.WindowConstants;
36 import org.apache.commons.configuration.ConfigurationException;
37 import yukihane.inqubus.Config;
38
39 /**
40  *
41  * @author yuki
42  */
43 public class ConfigDialog extends JDialog {
44     private static final long serialVersionUID = 1L;
45     private static final Logger logger = Logger.getLogger(ConfigDialog.class.getName());
46
47     /** Creates new form Properties */
48     public ConfigDialog() {
49         this(null);
50     }
51
52     public ConfigDialog(JFrame owner){
53         super(owner);
54
55         final JTabbedPane tabbedPane = new JTabbedPane();
56         final JPanel pnlNetwork = new JPanel();
57         final JPanel pnlAccount = new JPanel();
58         final JLabel lblMail = new JLabel();
59         fldMail = new JTextField();
60         final JLabel lblPassword = new JLabel();
61         fldPassword = new JTextField();
62         final JPanel pnlProxy = new JPanel();
63         cbProxyUse = new JCheckBox();
64         final JLabel lblProxyHost = new JLabel();
65         final JLabel lblProxyPort = new JLabel();
66         fldProxyHost = new JTextField();
67         fldProxyPort = new JTextField();
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         cbCommentSizeAuto = new JCheckBox();
81         final JLabel lblCommentSizeManual = new JLabel();
82         fldCommentSizeManual = new JTextField();
83         final JLabel lblCommentMinSize = new JLabel();
84         cbCommentMinSizeAuto = new JCheckBox();
85         fldCommentMinSizeManual = new JTextField();
86         final JLabel lblCommentMinSizeManual = new JLabel();
87         final JLabel lblCommentDisplayMax = new JLabel();
88         cbCommentDisplaySizeDefault = new JCheckBox();
89         final JLabel lblCommentDisplayMaxManual = new JLabel();
90         fldCommentDisplaySizeManual = new JTextField();
91         final JPanel pnlCommentAdvanced = new JPanel();
92         final JLabel lblFontPath = new JLabel();
93         cbFontSizeArrangeDisable = new JCheckBox();
94         cbCommentOpaque = new JCheckBox();
95         fldFontPath = new JTextField();
96         final JLabel lblFontIndex = new JLabel();
97         final JLabel lblFontShadow = new JLabel();
98         fldFontIndex = new JTextField();
99         final JPanel pnlFfmpeg = new JPanel();
100         final JPanel jPanel10 = new JPanel();
101         final JLabel lblFfmpegPath = new JLabel();
102         final JLabel lblFfmpegDllPath = new JLabel();
103         fldFfmpegPath = new JTextField();
104         fldFfmpegDllPath = new JTextField();
105         final JPanel pnlNgSetting = new JPanel();
106         final JPanel pnlSearch = new JPanel();
107         final JPanel pnlSearchCache = new JPanel();
108         final JLabel lblSearchCache = new JLabel();
109         fldSearchCache = new JTextField();
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         jPanel10.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(jPanel10);
506         jPanel10.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
542
543         GroupLayout gl_pnlFfmpeg = new GroupLayout(pnlFfmpeg);
544         pnlFfmpeg.setLayout(gl_pnlFfmpeg);
545         gl_pnlFfmpeg.setHorizontalGroup(
546             gl_pnlFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
547             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFfmpeg.createSequentialGroup()
548                 .addContainerGap()
549                 .addGroup(gl_pnlFfmpeg.createParallelGroup(GroupLayout.Alignment.TRAILING)
550                     .addComponent(pnlFfmpegParam, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
551                     .addComponent(jPanel10, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
552                 .addContainerGap())
553         );
554         gl_pnlFfmpeg.setVerticalGroup(
555             gl_pnlFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
556             .addGroup(gl_pnlFfmpeg.createSequentialGroup()
557                 .addContainerGap()
558                 .addComponent(jPanel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
559                 .addPreferredGap(ComponentPlacement.RELATED)
560                 .addComponent(pnlFfmpegParam, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
561                 .addContainerGap())
562         );
563
564         tabbedPane.addTab("ffmpeg", pnlFfmpeg);
565
566         pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
567         pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
568
569         GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
570         pnlNgSetting.setLayout(gl_pnlNgSetting);
571         gl_pnlNgSetting.setHorizontalGroup(
572             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
573             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
574                 .addContainerGap()
575                 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
576                     .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
577                     .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
578                 .addContainerGap())
579         );
580         gl_pnlNgSetting.setVerticalGroup(
581             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
582             .addGroup(gl_pnlNgSetting.createSequentialGroup()
583                 .addContainerGap()
584                 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
585                 .addPreferredGap(ComponentPlacement.RELATED)
586                 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
587                 .addContainerGap())
588         );
589
590         tabbedPane.addTab("NG設定", pnlNgSetting);
591
592         pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
593         pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
594
595         pnlSearchCache.setBorder(BorderFactory.createEtchedBorder());
596
597         lblSearchCache.setText("キャッシュ更新(秒)");
598
599         GroupLayout gl_pnlSearchCache = new GroupLayout(pnlSearchCache);
600         pnlSearchCache.setLayout(gl_pnlSearchCache);
601         gl_pnlSearchCache.setHorizontalGroup(
602             gl_pnlSearchCache.createParallelGroup(GroupLayout.Alignment.LEADING)
603             .addGroup(gl_pnlSearchCache.createSequentialGroup()
604                 .addContainerGap()
605                 .addComponent(lblSearchCache)
606                 .addPreferredGap(ComponentPlacement.RELATED)
607                 .addComponent(fldSearchCache, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
608                 .addContainerGap(269, Short.MAX_VALUE))
609         );
610         gl_pnlSearchCache.setVerticalGroup(
611             gl_pnlSearchCache.createParallelGroup(GroupLayout.Alignment.LEADING)
612             .addGroup(gl_pnlSearchCache.createSequentialGroup()
613                 .addContainerGap()
614                 .addGroup(gl_pnlSearchCache.createParallelGroup(GroupLayout.Alignment.BASELINE)
615                     .addComponent(lblSearchCache)
616                     .addComponent(fldSearchCache, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
617                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
618         );
619
620         GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
621         pnlSearch.setLayout(gl_pnlSearch);
622         gl_pnlSearch.setHorizontalGroup(
623             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
624             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
625                 .addContainerGap()
626                 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
627                     .addComponent(pnlSearchCache, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
628                     .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
629                     .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
630                 .addContainerGap())
631         );
632         gl_pnlSearch.setVerticalGroup(
633             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
634             .addGroup(gl_pnlSearch.createSequentialGroup()
635                 .addContainerGap()
636                 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
637                 .addPreferredGap(ComponentPlacement.RELATED)
638                 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
639                 .addPreferredGap(ComponentPlacement.RELATED)
640                 .addComponent(pnlSearchCache, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
641                 .addContainerGap(27, Short.MAX_VALUE))
642         );
643
644         tabbedPane.addTab("検索", pnlSearch);
645
646         final JButton btnOk = new JButton("保存");
647         btnOk.addActionListener(new ActionListener() {
648
649             @Override
650             public void actionPerformed(ActionEvent e) {
651                 saveConfig();
652                 dispose();
653             }
654         });
655         final JButton btnCancel = new JButton("取消");
656         btnCancel.addActionListener(new ActionListener() {
657
658             @Override
659             public void actionPerformed(ActionEvent e) {
660                 dispose();
661             }
662         });
663         final JPanel pnlButton = new JPanel();
664
665         final GroupLayout glButton = new GroupLayout(pnlButton);
666         pnlButton.setLayout(glButton);
667         glButton.setHorizontalGroup(glButton.createSequentialGroup()
668             .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
669             .addComponent(btnOk)
670             .addPreferredGap(ComponentPlacement.UNRELATED)
671             .addComponent(btnCancel)
672             .addContainerGap()
673         );
674         glButton.setVerticalGroup(glButton.createSequentialGroup()
675             .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
676                 .addComponent(btnOk)
677                 .addComponent(btnCancel)
678             )
679         );
680
681         GroupLayout layout = new GroupLayout(getContentPane());
682         layout.setAutoCreateContainerGaps(true);
683         getContentPane().setLayout(layout);
684         layout.setHorizontalGroup(
685             layout.createParallelGroup(GroupLayout.Alignment.LEADING)
686             .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
687             .addComponent(pnlButton)
688         );
689         layout.setVerticalGroup(
690             layout.createSequentialGroup()
691                 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
692                 .addComponent(pnlButton)
693         );
694
695         final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
696         final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
697         final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
698         final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
699
700         final JPanel pnlSystemGeneral = new JPanel();
701         pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
702         final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
703         glSystemGenegal.setAutoCreateGaps(true);
704         glSystemGenegal.setAutoCreateContainerGaps(true);
705         pnlSystemGeneral.setLayout(glSystemGenegal);
706
707         glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
708             .addGroup(glSystemGenegal.createSequentialGroup()
709                 .addGroup(glSystemGenegal.createParallelGroup()
710                     .addComponent(lblSystemThreadDownload)
711                     .addComponent(lblSystemWaitDownload)
712                     .addComponent(lblSystemThreadConvert))
713                 .addGroup(glSystemGenegal.createParallelGroup()
714                     .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 40, PREFERRED_SIZE)
715                     .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 40, PREFERRED_SIZE)
716                     .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 40, PREFERRED_SIZE)
717                 )
718             )
719             .addGroup(glSystemGenegal.createSequentialGroup()
720                 .addComponent(lblSystemTempDir)
721                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
722                 )
723             );
724
725         glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
726             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
727                 .addComponent(lblSystemThreadDownload)
728                 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
729             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
730                 .addComponent(lblSystemWaitDownload)
731                 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
732             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
733                 .addComponent(lblSystemThreadConvert)
734                 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
735             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
736                 .addComponent(lblSystemTempDir)
737                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)));
738
739         final JPanel pnlSystem = new JPanel();
740         pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
741         final GroupLayout glSystem = new GroupLayout(pnlSystem);
742         glSystem.setAutoCreateGaps(true);
743         glSystem.setAutoCreateContainerGaps(true);
744         pnlSystem.setLayout(glSystem);
745
746         glSystem.setHorizontalGroup(glSystem.createParallelGroup()
747             .addComponent(pnlSystemGeneral));
748
749         glSystem.setVerticalGroup(glSystem.createSequentialGroup()
750             .addComponent(pnlSystemGeneral));
751
752         tabbedPane.add("システム", pnlSystem);
753
754         pack();
755         setMinimumSize(getSize());
756         loadConfig();
757     }
758
759     /**
760      * @param args the command line arguments
761      */
762     public static void main(String args[]) {
763         /* Set the Nimbus look and feel */
764         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
765          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
766          */
767         try {
768             for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
769                 if ("Nimbus".equals(info.getName())) {
770                     UIManager.setLookAndFeel(info.getClassName());
771                     break;
772                 }
773             }
774         } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
775             java.util.logging.Logger.getLogger(ConfigDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
776         }
777
778         /* Create and display the form */
779         java.awt.EventQueue.invokeLater(new Runnable() {
780
781             @Override
782             public void run() {
783                 new ConfigDialog().setVisible(true);
784             }
785         });
786     }
787     // Variables declaration - do not modify//GEN-BEGIN:variables
788
789     // ネットワーク
790     // ネットワーク - アカウント
791     private final JTextField fldMail;
792     private final JTextField fldPassword;
793     // ネットワーク - プロキシ
794     private final JCheckBox cbProxyUse;
795     private final JTextField fldProxyHost;
796     private final JTextField fldProxyPort;
797     // ファイル
798     // ファイル - 動画
799     private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
800     // ファイル - コメント
801     private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
802     // ファイル - 変換動画
803     private final JTextField fldOutputDir;
804     private final JTextField fldOutputFileNamePattern;
805     private final JButton btnOutputDir = new JButton("...");
806     private final JCheckBox cbOutputEnable;
807     private final JCheckBox cbOutputCommentOverlay;
808     private final JCheckBox cbOutputDisplayProgress;
809     // ファイル - 禁則文字
810     private final JTextField fldReplaceFrom = new JTextField();
811     private final JTextField fldReplaceTo = new JTextField();
812     // コメント
813     // コメント
814     private final JCheckBox cbCommentSizeAuto;
815     private final JTextField fldCommentSizeManual;
816     private final JCheckBox cbCommentMinSizeAuto;
817     private final JTextField fldCommentMinSizeManual;
818     private final JCheckBox cbCommentDisplaySizeDefault;
819     private final JTextField fldCommentDisplaySizeManual;
820     // コメント - 高度な設定
821     private final JTextField fldFontPath;
822     private final JTextField fldFontIndex;
823     private final JComboBox<String> cmbFontShadow = new JComboBox<>();
824     private final JCheckBox cbFontSizeArrangeDisable;
825     private final JCheckBox cbCommentOpaque;
826     // ffmpeg
827     // ffmpeg - ファイルパス
828     private final JTextField fldFfmpegPath;
829     private final JTextField fldFfmpegDllPath;
830     // ffmpeg - ffmpegパラメータ
831     private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
832     // NG設定
833     // NG設定 - NGワード
834     private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
835     // NG設定 - NGID
836     private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
837     // 検索
838     // 検索 - 動画検索対象フォルダ
839     private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
840     // 検索 - コメント検索対象フォルダ
841     private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
842     // 検索 - キャッシュ更新(秒)
843     private final JTextField fldSearchCache;
844     // システム
845     private final JTextField fldSystemThreadDownload = new JTextField();
846     private final JTextField fldSystemWaitDownload = new JTextField();
847     private final JTextField fldSystemThreadConvert = new JTextField();
848     private final JTextField fldSystemTempDir = new JTextField();
849
850
851     // End of variables declaration//GEN-END:variables
852
853     private void loadConfig() {
854         final Config p = Config.INSTANCE;
855
856         /*
857          * ネットワーク - アカウント
858          */
859         fldMail.setText(p.getId());
860         fldPassword.setText(p.getPassword());
861
862         /*
863          * ネットワーク - プロキシ
864          */
865         cbProxyUse.setSelected(p.getProxyUse());
866         fldProxyHost.setText(p.getProxyHost());
867         fldProxyPort.setText(p.getProxyPort());
868
869         /*
870          * ファイル - 動画
871          */
872         pnlFileVideo.fldDir.setText(p.getVideoDir());
873         pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
874         pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
875
876         /*
877          * ファイル - コメント
878          */
879         pnlFileComment.fldDir.setText(p.getCommentDir());
880         pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
881         pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
882
883         /*
884          * ファイル - 変換動画
885          */
886         fldOutputDir.setText(p.getOutputDir());
887         fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
888         cbOutputEnable.setSelected(p.getOutputEnable());
889         cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
890         cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
891
892         /*
893          * ファイル - 禁則文字
894          */
895         fldReplaceFrom.setText(p.getReplaceFrom());
896         fldReplaceTo.setText(p.getReplaceTo());
897
898         /**
899          * コメント
900          */
901         cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
902         fldCommentSizeManual.setText(p.getCommentSizeManual());
903         cbCommentMinSizeAuto.setSelected(p.getCommentMinSizeAutosize());
904         fldCommentSizeManual.setText(p.getCommentMinSizeManual());
905         cbCommentDisplaySizeDefault.setSelected(p.getCommentDisplaySizeDefault());
906         fldCommentDisplaySizeManual.setText(p.getCommentDisplaySizeManual());
907
908         /**
909          * コメント - 高度な設定
910          */
911         fldFontPath.setText(p.getFontPath());
912         fldFontIndex.setText(p.getFontIndex());
913         cmbFontShadow.setSelectedIndex(p.getFontShadow());
914         cbFontSizeArrangeDisable.setSelected(p.getFontSizeArrangeDisable());
915         cbCommentOpaque.setSelected(p.getCommentOpaque());
916
917         /*
918          * ffmpeg - ファイルパス
919          */
920         fldFfmpegPath.setText(p.getFfmpegPath());
921         fldFfmpegDllPath.setText(p.getFfmpegDllPath());
922
923         /*
924          * ffmpeg - ffmpegパラメータ
925          */
926         pnlFfmpegParam.init(p);
927
928         /*
929          * NG 設定
930          */
931         final List<String> ngWords = p.getNgWords();
932         pnlNgWord.init(ngWords);
933         final List<String> ngIds = p.getNgIds();
934         pnlNgId.init(ngIds);
935
936         /*
937          * 検索
938          */
939         pnlSearchVideo.init(p.getSearchVideoDirs());
940         pnlSearchComment.init(p.getSearchCommentDirs());
941
942         /*
943          * システム
944          */
945         fldSystemThreadDownload.setText(Integer.toString(p.getSystemDownloadThread()));
946         fldSystemWaitDownload.setText(Integer.toString(p.getSystemDownloadWait()));
947         fldSystemThreadConvert.setText(Integer.toString(p.getSystemConvertThread()));
948         fldSystemTempDir.setText(p.getSystemTempDir());
949     }
950
951     private void saveConfig() {
952         final Config p = Config.INSTANCE;
953
954         /*
955          * ネットワーク - アカウント
956          */
957
958         p.setId(fldMail.getText());
959         p.setPassword(fldPassword.getText());
960
961         /*
962          * ネットワーク - プロキシ
963          */
964         p.setProxyUse(cbProxyUse.isSelected());
965         p.setProxyHost(fldProxyHost.getText());
966         p.setProxyPort(fldProxyPort.getText());
967
968         /*
969          * ファイル - 動画
970          */
971         p.setVideoDir(pnlFileVideo.fldDir.getText());
972         p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
973         p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
974
975         /*
976          * ファイル - コメント
977          */
978         p.setCommentDir(pnlFileComment.fldDir.getText());
979         p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
980         p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
981
982         /*
983          * ファイル - 変換動画
984          */
985         p.setOutputDir(fldOutputDir.getText());
986         p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
987         p.setOutputEnable(cbOutputEnable.isSelected());
988         p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
989         p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
990
991         /*
992          * ファイル - 禁則文字
993          */
994         p.setReplaceFrom(fldReplaceFrom.getText());
995         p.setReplaceTo(fldReplaceTo.getText());
996
997         /*
998          * コメント
999          */
1000         p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1001         p.setCommentSizeManual(fldCommentSizeManual.getText());
1002         p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1003         p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1004         p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1005         p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1006
1007         /**
1008          * コメント - 高度な設定
1009          */
1010         p.setFontPath(fldFontPath.getText());
1011         p.setFontIndex(fldFontIndex.getText());
1012         p.setFontShadow(cmbFontShadow.getSelectedIndex());
1013         p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1014         p.setCommentOpaque(cbCommentOpaque.isSelected());
1015
1016         /*
1017          * ffmpeg - ファイルパス
1018          */
1019         p.setFfmpegPath(fldFfmpegPath.getText());
1020         p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1021
1022         /*
1023          * ffmpeg - ffmpegパラメータ
1024          */
1025         final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1026         p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1027         p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1028         p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1029         p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1030         p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1031         p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1032         p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1033         p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1034         p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1035         p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1036
1037         /*
1038          * NG 設定
1039          */
1040         p.setNgWords(pnlNgWord.getAllElements());
1041         p.setNgIds(pnlNgId.getAllElements());
1042
1043         /*
1044          * 検索
1045          */
1046         p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1047         p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1048
1049         /*
1050          * システム
1051          */
1052         p.setSystemDownloadThread(Integer.parseInt(fldSystemThreadDownload.getText()));
1053         p.setSystemDownloadWait(Integer.parseInt(fldSystemWaitDownload.getText()));
1054         p.setSystemConvertThread(Integer.parseInt(fldSystemThreadConvert.getText()));
1055         p.setSystemTempDir(fldSystemTempDir.getText());
1056
1057         try {
1058             p.save();
1059         } catch (ConfigurationException ex) {
1060             logger.log(Level.SEVERE, "コンフィグファイル保存に失敗", ex);
1061         }
1062     }
1063 }
1064
1065 class DownloadLocationPanel extends JPanel {
1066     final JTextField fldDir = new JTextField();
1067     final JTextField fldFileNamePattern = new JTextField();
1068     final JCheckBox cbLocal = new JCheckBox("local");
1069
1070     DownloadLocationPanel(){
1071         super();
1072
1073         final JLabel lblVideoDir = new JLabel("保存フォルダ");
1074         final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1075
1076         final JButton btnDir = new JButton("...");
1077         btnDir.addActionListener(
1078                 new FileChooseAction(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1079
1080         final GroupLayout gl = new GroupLayout(this);
1081         setLayout(gl);
1082         gl.setHorizontalGroup(
1083             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1084             .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1085                 .addContainerGap()
1086                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1087                     .addComponent(lblVideoFileNamepattern)
1088                     .addComponent(lblVideoDir))
1089                 .addPreferredGap(ComponentPlacement.RELATED)
1090                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1091                     .addGroup(gl.createSequentialGroup()
1092                         .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1093                         .addPreferredGap(ComponentPlacement.RELATED)
1094                         .addComponent(btnDir))
1095                     .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1096                         .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1097                         .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1098                         .addComponent(cbLocal)))
1099                 .addContainerGap())
1100         );
1101         gl.setVerticalGroup(
1102             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1103             .addGroup(gl.createSequentialGroup()
1104                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1105                     .addComponent(lblVideoDir)
1106                     .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1107                     .addComponent(btnDir))
1108                 .addPreferredGap(ComponentPlacement.RELATED)
1109                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1110                     .addComponent(lblVideoFileNamepattern)
1111                     .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1112                     .addComponent(cbLocal))
1113                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1114         );
1115
1116     }
1117 }