OSDN Git Service

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