OSDN Git Service

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