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