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