OSDN Git Service

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