OSDN Git Service

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