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.JPasswordField;
31 import javax.swing.JSpinner;
32 import javax.swing.JTabbedPane;
33 import javax.swing.JTextField;
34 import javax.swing.LayoutStyle.ComponentPlacement;
35 import javax.swing.SpinnerNumberModel;
36 import javax.swing.UIManager;
37 import javax.swing.UnsupportedLookAndFeelException;
38 import javax.swing.WindowConstants;
39 import org.apache.commons.configuration.ConfigurationException;
40 import yukihane.inqubus.config.Config;
41
42 /**
43  *
44  * @author yuki
45  */
46 public class ConfigDialog extends JDialog {
47     private static final long serialVersionUID = 1L;
48     private static final Logger logger = Logger.getLogger(ConfigDialog.class.getName());
49     private static final String NEED_REBOOT = "設定を有効にするにはいんきゅばすの再起動が必要です";
50
51     /** Creates new form Properties */
52     public ConfigDialog() {
53         this(null);
54     }
55
56     public ConfigDialog(JFrame owner){
57         super(owner);
58
59         final JTabbedPane tabbedPane = new JTabbedPane();
60         final JPanel pnlNetwork = new JPanel();
61         final JPanel pnlAccount = new JPanel();
62         final JLabel lblMail = new JLabel();
63         fldMail = new JTextField();
64         fldPassword.setEchoChar('*');
65         final JLabel lblPassword = new JLabel();
66         final JPanel pnlProxy = new JPanel();
67         cbProxyUse = new JCheckBox();
68         final JLabel lblProxyHost = new JLabel();
69         final JLabel lblProxyPort = new JLabel();
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         final JLabel lblCommentSizeManual = new JLabel();
83         final JLabel lblCommentMinSize = new JLabel();
84         final JLabel lblCommentMinSizeManual = new JLabel();
85         final JLabel lblCommentDisplayMax = new JLabel();
86         final JLabel lblCommentDisplayMaxManual = new JLabel();
87         final JPanel pnlCommentAdvanced = new JPanel();
88         final JLabel lblFontPath = new JLabel();
89         cbFontSizeArrangeDisable = new JCheckBox();
90         cbCommentOpaque = new JCheckBox();
91         fldFontPath = new JTextField();
92         final JLabel lblFontIndex = new JLabel();
93         final JLabel lblFontShadow = new JLabel();
94         fldFontIndex = new JTextField();
95         final JPanel pnlFfmpeg = new JPanel();
96         final JPanel pnlFfmpegBinPath = new JPanel();
97         final JLabel lblFfmpegPath = new JLabel();
98         final JLabel lblFfmpegDllPath = new JLabel();
99         fldFfmpegPath = new JTextField();
100         fldFfmpegDllPath = new JTextField();
101         final JPanel pnlNgSetting = new JPanel();
102         final JPanel pnlSearch = new JPanel();
103
104         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
105
106         pnlNetwork.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
107
108         pnlAccount.setBorder(BorderFactory.createTitledBorder("アカウント"));
109
110         lblMail.setText("ID(メールアドレス)");
111
112         lblPassword.setText("パスワード");
113
114         GroupLayout gl_pnlAccount = new GroupLayout(pnlAccount);
115         pnlAccount.setLayout(gl_pnlAccount);
116         gl_pnlAccount.setHorizontalGroup(
117             gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
118             .addGroup(gl_pnlAccount.createSequentialGroup()
119                 .addContainerGap()
120                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
121                     .addComponent(lblMail)
122                     .addComponent(lblPassword))
123                 .addPreferredGap(ComponentPlacement.RELATED)
124                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
125                     .addComponent(fldPassword, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
126                     .addComponent(fldMail, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE))
127                 .addContainerGap())
128         );
129         gl_pnlAccount.setVerticalGroup(
130             gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
131             .addGroup(gl_pnlAccount.createSequentialGroup()
132                 .addContainerGap()
133                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
134                     .addComponent(lblMail)
135                     .addComponent(fldMail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
136                 .addPreferredGap(ComponentPlacement.RELATED)
137                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
138                     .addComponent(lblPassword)
139                     .addComponent(fldPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
140                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
141         );
142
143         pnlProxy.setBorder(BorderFactory.createTitledBorder("プロキシ"));
144
145         cbProxyUse.setText("プロキシを使用する");
146
147         lblProxyHost.setText("ホスト名");
148
149         lblProxyPort.setText("ポート番号");
150
151         GroupLayout gl_pnlProxy = new GroupLayout(pnlProxy);
152         pnlProxy.setLayout(gl_pnlProxy);
153         gl_pnlProxy.setHorizontalGroup(
154             gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
155             .addGroup(gl_pnlProxy.createSequentialGroup()
156                 .addContainerGap()
157                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
158                     .addComponent(cbProxyUse)
159                     .addGroup(gl_pnlProxy.createSequentialGroup()
160                         .addComponent(lblProxyHost)
161                         .addGap(18, 18, 18)
162                         .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
163                     .addGroup(gl_pnlProxy.createSequentialGroup()
164                         .addComponent(lblProxyPort)
165                         .addPreferredGap(ComponentPlacement.RELATED)
166                         .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
167                 .addContainerGap(181, Short.MAX_VALUE))
168         );
169         gl_pnlProxy.setVerticalGroup(
170             gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
171             .addGroup(gl_pnlProxy.createSequentialGroup()
172                 .addContainerGap()
173                 .addComponent(cbProxyUse)
174                 .addPreferredGap(ComponentPlacement.RELATED)
175                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
176                     .addComponent(lblProxyHost)
177                     .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
178                 .addPreferredGap(ComponentPlacement.RELATED)
179                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
180                     .addComponent(lblProxyPort)
181                     .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
182                 .addContainerGap(39, Short.MAX_VALUE))
183         );
184
185         GroupLayout gl_pnlNetwork = new GroupLayout(pnlNetwork);
186         pnlNetwork.setLayout(gl_pnlNetwork);
187         gl_pnlNetwork.setHorizontalGroup(
188             gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
189             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNetwork.createSequentialGroup()
190                 .addContainerGap()
191                 .addGroup(gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.TRAILING)
192                     .addComponent(pnlProxy, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
193                     .addComponent(pnlAccount, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
194                 .addContainerGap())
195         );
196         gl_pnlNetwork.setVerticalGroup(
197             gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
198             .addGroup(gl_pnlNetwork.createSequentialGroup()
199                 .addContainerGap()
200                 .addComponent(pnlAccount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
201                 .addPreferredGap(ComponentPlacement.RELATED)
202                 .addComponent(pnlProxy, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
203                 .addContainerGap(178, Short.MAX_VALUE))
204         );
205
206         tabbedPane.addTab("ネットワーク", pnlNetwork);
207
208         pnlFileVideo.setBorder(BorderFactory.createTitledBorder("動画"));
209
210         pnlFileComment.setBorder(BorderFactory.createTitledBorder("コメント"));
211
212         pnlFileOutput.setBorder(BorderFactory.createTitledBorder("変換動画"));
213
214         lblOutputDir.setText("保存フォルダ");
215
216         lblOutputFileNamePattern.setText("ファイル名規則");
217
218         btnOutputDir.addActionListener(
219                 new FileChooseAction(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldOutputDir));
220
221         cbOutputEnable.setText("変換");
222
223         cbOutputCommentOverlay.setText("コメント付与");
224
225         cbOutputDisplayProgress.setText("変換中動画表示");
226
227         GroupLayout gl_pnlFileOutput = new GroupLayout(pnlFileOutput);
228         pnlFileOutput.setLayout(gl_pnlFileOutput);
229         gl_pnlFileOutput.setHorizontalGroup(
230             gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
231             .addGroup(gl_pnlFileOutput.createSequentialGroup()
232                 .addContainerGap()
233                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
234                     .addComponent(lblOutputFileNamePattern)
235                     .addComponent(lblOutputDir))
236                 .addPreferredGap(ComponentPlacement.RELATED)
237                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
238                     .addGroup(gl_pnlFileOutput.createSequentialGroup()
239                         .addComponent(fldOutputDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
240                         .addPreferredGap(ComponentPlacement.RELATED)
241                         .addComponent(btnOutputDir)
242                         .addContainerGap())
243                     .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileOutput.createSequentialGroup()
244                         .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
245                         .addPreferredGap(ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
246                         .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
247                             .addComponent(cbOutputDisplayProgress)
248                             .addGroup(gl_pnlFileOutput.createSequentialGroup()
249                                 .addComponent(cbOutputEnable)
250                                 .addPreferredGap(ComponentPlacement.RELATED)
251                                 .addComponent(cbOutputCommentOverlay))))))
252         );
253         gl_pnlFileOutput.setVerticalGroup(
254             gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
255             .addGroup(gl_pnlFileOutput.createSequentialGroup()
256                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
257                     .addComponent(lblOutputDir)
258                     .addComponent(fldOutputDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
259                     .addComponent(btnOutputDir))
260                 .addPreferredGap(ComponentPlacement.RELATED)
261                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
262                     .addComponent(lblOutputFileNamePattern)
263                     .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
264                     .addComponent(cbOutputCommentOverlay)
265                     .addComponent(cbOutputEnable))
266                 .addPreferredGap(ComponentPlacement.RELATED)
267                 .addComponent(cbOutputDisplayProgress)
268                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
269         );
270
271         final JPanel pnlFileProhibit = new JPanel();
272         pnlFileProhibit.setBorder(BorderFactory.createTitledBorder("禁則文字"));
273         final JLabel lblReplaceFrom = new JLabel("置換対象文字");
274         final JLabel lblReplaceTo = new JLabel("置換後文字");
275
276         final GroupLayout glProhibit = new GroupLayout(pnlFileProhibit);
277         glProhibit.setAutoCreateContainerGaps(true);
278         glProhibit.setAutoCreateGaps(true);
279         pnlFileProhibit.setLayout(glProhibit);
280
281         glProhibit.setHorizontalGroup(glProhibit.createSequentialGroup()
282             .addGroup(glProhibit.createParallelGroup()
283                 .addComponent(lblReplaceFrom)
284                 .addComponent(lblReplaceTo)
285             )
286             .addGroup(glProhibit.createParallelGroup()
287                 .addComponent(fldReplaceFrom)
288                 .addComponent(fldReplaceTo)
289             )
290         );
291
292         glProhibit.setVerticalGroup(glProhibit.createSequentialGroup()
293             .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
294                 .addComponent(lblReplaceFrom)
295                 .addComponent(fldReplaceFrom)
296             )
297             .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
298                 .addComponent(lblReplaceTo)
299                 .addComponent(fldReplaceTo)
300             )
301         );
302
303         GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
304         pnlFile.setLayout(gl_pnlFile);
305         gl_pnlFile.setHorizontalGroup(
306             gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
307             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
308                 .addContainerGap()
309                 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
310                     .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
311                     .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
312                     .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
313                     .addComponent(pnlFileProhibit, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
314                 )
315                 .addContainerGap())
316         );
317         gl_pnlFile.setVerticalGroup(
318             gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
319             .addGroup(gl_pnlFile.createSequentialGroup()
320                 .addContainerGap()
321                 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
322                 .addPreferredGap(ComponentPlacement.RELATED)
323                 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
324                 .addPreferredGap(ComponentPlacement.RELATED)
325                 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
326                 .addPreferredGap(ComponentPlacement.RELATED)
327                 .addComponent(pnlFileProhibit, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
328                 .addContainerGap())
329         );
330
331         tabbedPane.addTab("ファイル", pnlFile);
332
333         pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
334
335         lblCommentSize.setText("再生時間に応じたコメントの取得数");
336
337         lblCommentSizeManual.setText("手動取得");
338
339         lblCommentMinSize.setText("1分当たりのコメント取得数");
340
341         lblCommentMinSizeManual.setText("手動取得");
342
343         lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
344
345         lblCommentDisplayMaxManual.setText("手動設定");
346
347         GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
348         pnlCommentStandard.setLayout(gl_pnlCommentStandard);
349         gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
350         gl_pnlCommentStandard.setAutoCreateGaps(true);
351         gl_pnlCommentStandard.setHorizontalGroup(
352             gl_pnlCommentStandard.createSequentialGroup()
353                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
354                     .addComponent(lblCommentSize)
355                     .addComponent(lblCommentMinSize)
356                     .addComponent(lblCommentDisplayMax))
357                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
358                     .addComponent(cbCommentSizeAuto)
359                     .addComponent(cbCommentMinDisable)
360                     .addComponent(cbCommentMinSizeAuto)
361                     .addComponent(cbCommentDisplaySizeDefault))
362                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
363                     .addComponent(lblCommentSizeManual)
364                     .addComponent(lblCommentMinSizeManual)
365                     .addComponent(lblCommentDisplayMaxManual))
366                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
367                     .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
368                     .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
369                     .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
370         );
371         gl_pnlCommentStandard.setVerticalGroup(
372             gl_pnlCommentStandard.createSequentialGroup()
373                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
374                     .addComponent(lblCommentSize)
375                     .addComponent(cbCommentSizeAuto)
376                     .addComponent(lblCommentSizeManual)
377                     .addComponent(fldCommentSizeManual))
378                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
379                     .addComponent(lblCommentMinSize)
380                     .addComponent(cbCommentMinDisable)
381                 )
382                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
383                     .addComponent(cbCommentMinSizeAuto)
384                     .addComponent(lblCommentMinSizeManual)
385                     .addComponent(fldCommentMinSizeManual))
386                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
387                     .addComponent(lblCommentDisplayMax)
388                     .addComponent(cbCommentDisplaySizeDefault)
389                     .addComponent(lblCommentDisplayMaxManual)
390                     .addComponent(fldCommentDisplaySizeManual))
391         );
392
393         pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
394
395         lblFontPath.setText("フォントパス");
396
397         cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
398
399         cbCommentOpaque.setText("コメント透明化を行わない");
400
401         final JButton btnFontPath = new JButton("...");
402         btnFontPath.addActionListener(
403                 new FileChooseAction(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
404
405         lblFontIndex.setText("フォント番号");
406
407         lblFontShadow.setText("影の種類");
408         final ComboBoxModel<String> cbmFontShadow
409                 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
410         cmbFontShadow.setModel(cbmFontShadow);
411
412         GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
413         pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
414         gl_pnlCommentAdvanced.setHorizontalGroup(
415             gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
416             .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
417                 .addContainerGap()
418                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
419                     .addComponent(cbCommentOpaque)
420                     .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
421                         .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
422                             .addComponent(lblFontPath)
423                             .addComponent(lblFontIndex)
424                             .addComponent(lblFontShadow))
425                         .addGap(18, 18, 18)
426                         .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
427                             .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
428                             .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
429                                 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
430                                 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
431                         .addPreferredGap(ComponentPlacement.RELATED)
432                         .addComponent(btnFontPath))
433                     .addComponent(cbFontSizeArrangeDisable))
434                 .addContainerGap())
435         );
436         gl_pnlCommentAdvanced.setVerticalGroup(
437             gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
438             .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
439                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
440                     .addComponent(lblFontPath)
441                     .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
442                     .addComponent(btnFontPath))
443                 .addPreferredGap(ComponentPlacement.RELATED)
444                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
445                     .addComponent(lblFontIndex)
446                     .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
447                 .addPreferredGap(ComponentPlacement.RELATED)
448                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
449                     .addComponent(lblFontShadow)
450                     .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
451                 .addPreferredGap(ComponentPlacement.RELATED)
452                 .addComponent(cbFontSizeArrangeDisable)
453                 .addPreferredGap(ComponentPlacement.RELATED)
454                 .addComponent(cbCommentOpaque)
455                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
456         );
457
458         GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
459         pnlComment.setLayout(gl_pnlComment);
460         gl_pnlComment.setHorizontalGroup(
461             gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
462             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
463                 .addContainerGap()
464                 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
465                     .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
466                     .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
467                 .addContainerGap())
468         );
469         gl_pnlComment.setVerticalGroup(
470             gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
471             .addGroup(gl_pnlComment.createSequentialGroup()
472                 .addContainerGap()
473                 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
474                 .addPreferredGap(ComponentPlacement.RELATED)
475                 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
476                 .addContainerGap(168, Short.MAX_VALUE))
477         );
478
479         tabbedPane.addTab("コメント", pnlComment);
480
481         pnlFfmpegBinPath.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
482
483         lblFfmpegPath.setText("ffmpeg");
484
485         lblFfmpegDllPath.setText("拡張ライブラリ");
486
487         final JButton btnFfmpegPath = new JButton("...");
488         btnFfmpegPath.addActionListener(
489                 new FileChooseAction(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
490
491         final JButton btnFfmpegDllPath = new JButton("...");
492         btnFfmpegDllPath.addActionListener(
493                 new FileChooseAction(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
494
495
496         GroupLayout gl_jPanel10 = new GroupLayout(pnlFfmpegBinPath);
497         pnlFfmpegBinPath.setLayout(gl_jPanel10);
498         gl_jPanel10.setHorizontalGroup(
499             gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
500             .addGroup(gl_jPanel10.createSequentialGroup()
501                 .addContainerGap()
502                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
503                     .addComponent(lblFfmpegDllPath)
504                     .addComponent(lblFfmpegPath))
505                 .addPreferredGap(ComponentPlacement.RELATED)
506                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
507                     .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
508                     .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE))
509                 .addPreferredGap(ComponentPlacement.RELATED)
510                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
511                     .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
512                     .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING))
513                 .addContainerGap())
514         );
515         gl_jPanel10.setVerticalGroup(
516             gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
517             .addGroup(gl_jPanel10.createSequentialGroup()
518                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
519                     .addComponent(lblFfmpegPath)
520                     .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
521                     .addComponent(btnFfmpegPath))
522                 .addPreferredGap(ComponentPlacement.RELATED)
523                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
524                     .addComponent(lblFfmpegDllPath)
525                     .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
526                     .addComponent(btnFfmpegDllPath))
527                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
528         );
529
530         pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
531
532         final GroupLayout glFfmpeg = new GroupLayout(pnlFfmpeg);
533         glFfmpeg.setAutoCreateContainerGaps(true);
534         pnlFfmpeg.setLayout(glFfmpeg);
535         glFfmpeg.setHorizontalGroup(glFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
536             .addComponent(pnlFfmpegBinPath)
537             .addComponent(pnlFfmpegParam)
538         );
539         glFfmpeg.setVerticalGroup(glFfmpeg.createSequentialGroup()
540             .addComponent(pnlFfmpegBinPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
541             .addPreferredGap(ComponentPlacement.RELATED)
542             .addComponent(pnlFfmpegParam)
543         );
544
545         tabbedPane.addTab("ffmpeg", pnlFfmpeg);
546
547         pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
548         pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
549
550         GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
551         pnlNgSetting.setLayout(gl_pnlNgSetting);
552         gl_pnlNgSetting.setHorizontalGroup(
553             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
554             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
555                 .addContainerGap()
556                 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
557                     .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
558                     .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
559                 .addContainerGap())
560         );
561         gl_pnlNgSetting.setVerticalGroup(
562             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
563             .addGroup(gl_pnlNgSetting.createSequentialGroup()
564                 .addContainerGap()
565                 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
566                 .addPreferredGap(ComponentPlacement.RELATED)
567                 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
568                 .addContainerGap())
569         );
570
571         tabbedPane.addTab("NG設定", pnlNgSetting);
572
573         pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
574         pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
575
576         final JLabel lblSearchNeedReboot = new JLabel(NEED_REBOOT);
577
578         GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
579         pnlSearch.setLayout(gl_pnlSearch);
580         gl_pnlSearch.setHorizontalGroup(
581             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
582             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
583                 .addContainerGap()
584                 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
585                     .addComponent(lblSearchNeedReboot, Alignment.CENTER)
586                     .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
587                     .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
588                 .addContainerGap())
589         );
590         gl_pnlSearch.setVerticalGroup(
591             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
592             .addGroup(gl_pnlSearch.createSequentialGroup()
593                 .addContainerGap()
594                 .addComponent(lblSearchNeedReboot)
595                 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
596                 .addPreferredGap(ComponentPlacement.RELATED)
597                 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
598                 .addContainerGap()
599             )
600         );
601
602         tabbedPane.addTab("検索", pnlSearch);
603
604         final JButton btnOk = new JButton("保存");
605         btnOk.addActionListener(new ActionListener() {
606
607             @Override
608             public void actionPerformed(ActionEvent e) {
609                 saveConfig();
610                 dispose();
611             }
612         });
613         final JButton btnCancel = new JButton("取消");
614         btnCancel.addActionListener(new ActionListener() {
615
616             @Override
617             public void actionPerformed(ActionEvent e) {
618                 dispose();
619             }
620         });
621         final JPanel pnlButton = new JPanel();
622
623         final GroupLayout glButton = new GroupLayout(pnlButton);
624         pnlButton.setLayout(glButton);
625         glButton.setHorizontalGroup(glButton.createSequentialGroup()
626             .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
627             .addComponent(btnOk)
628             .addPreferredGap(ComponentPlacement.UNRELATED)
629             .addComponent(btnCancel)
630             .addContainerGap()
631         );
632         glButton.setVerticalGroup(glButton.createSequentialGroup()
633             .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
634                 .addComponent(btnOk)
635                 .addComponent(btnCancel)
636             )
637         );
638
639         GroupLayout layout = new GroupLayout(getContentPane());
640         layout.setAutoCreateContainerGaps(true);
641         getContentPane().setLayout(layout);
642         layout.setHorizontalGroup(
643             layout.createParallelGroup(GroupLayout.Alignment.LEADING)
644             .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
645             .addComponent(pnlButton)
646         );
647         layout.setVerticalGroup(
648             layout.createSequentialGroup()
649                 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
650                 .addComponent(pnlButton)
651         );
652
653         final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
654         final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
655         final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
656         final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
657         final JButton btnSystemTempDir = new JButton("...");
658         btnSystemTempDir.addActionListener(
659                 new FileChooseAction(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
660
661         mdlSystemThreadDownload.setMinimum(1);
662         final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
663         mdlSystemWaitDownload.setMinimum(0);
664         final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
665         mdlSystemThreadConvert.setMinimum(1);
666         final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
667
668         final JPanel pnlSystemGeneral = new JPanel();
669         pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
670         final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
671         glSystemGenegal.setAutoCreateGaps(true);
672         glSystemGenegal.setAutoCreateContainerGaps(true);
673         pnlSystemGeneral.setLayout(glSystemGenegal);
674
675         glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
676             .addGroup(glSystemGenegal.createSequentialGroup()
677                 .addGroup(glSystemGenegal.createParallelGroup()
678                     .addComponent(lblSystemThreadDownload)
679                     .addComponent(lblSystemWaitDownload)
680                     .addComponent(lblSystemThreadConvert))
681                 .addGroup(glSystemGenegal.createParallelGroup()
682                     .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
683                     .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
684                     .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
685                 )
686             )
687             .addGroup(glSystemGenegal.createSequentialGroup()
688                 .addComponent(lblSystemTempDir)
689                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
690                 .addComponent(btnSystemTempDir)
691                 )
692             );
693
694         glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
695             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
696                 .addComponent(lblSystemThreadDownload)
697                 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
698             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
699                 .addComponent(lblSystemWaitDownload)
700                 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
701             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
702                 .addComponent(lblSystemThreadConvert)
703                 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
704             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
705                 .addComponent(lblSystemTempDir)
706                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
707                 .addComponent(btnSystemTempDir)
708             )
709         );
710
711         final JLabel lblSystemNeedReboot = new JLabel("設定を有効にするにはいんきゅばすの再起動が必要です");
712
713         final JPanel pnlSystem = new JPanel();
714         pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
715         final GroupLayout glSystem = new GroupLayout(pnlSystem);
716         glSystem.setAutoCreateGaps(true);
717         glSystem.setAutoCreateContainerGaps(true);
718         pnlSystem.setLayout(glSystem);
719
720         glSystem.setHorizontalGroup(glSystem.createParallelGroup()
721             .addComponent(lblSystemNeedReboot, Alignment.CENTER)
722             .addComponent(pnlSystemGeneral));
723
724         glSystem.setVerticalGroup(glSystem.createSequentialGroup()
725             .addComponent(lblSystemNeedReboot)
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 JPasswordField fldPassword = new JPasswordField();
769     // ネットワーク - プロキシ
770     private final JCheckBox cbProxyUse;
771     private final JTextField fldProxyHost = new JTextField();
772     private final NumberFormattedTextField fldProxyPort = new NumberFormattedTextField();
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 = new JCheckBox("自動調整");
791     private final NumberFormattedTextField fldCommentSizeManual = new NumberFormattedTextField();
792     private final JCheckBox cbCommentMinDisable = new JCheckBox("少コメ");
793     private final JCheckBox cbCommentMinSizeAuto = new JCheckBox("自動調整");
794     private final NumberFormattedTextField fldCommentMinSizeManual = new NumberFormattedTextField();
795     private final JCheckBox cbCommentDisplaySizeDefault = new JCheckBox("標準(30)");
796     private final NumberFormattedTextField fldCommentDisplaySizeManual = new NumberFormattedTextField();
797     // コメント - 高度な設定
798     private final JTextField fldFontPath;
799     private final JTextField fldFontIndex;
800     private final JComboBox<String> cmbFontShadow = new JComboBox<>();
801     private final JCheckBox cbFontSizeArrangeDisable;
802     private final JCheckBox cbCommentOpaque;
803     // ffmpeg
804     // ffmpeg - ファイルパス
805     private final JTextField fldFfmpegPath;
806     private final JTextField fldFfmpegDllPath;
807     // ffmpeg - ffmpegパラメータ
808     private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
809     // NG設定
810     // NG設定 - NGワード
811     private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
812     // NG設定 - NGID
813     private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
814     // 検索
815     // 検索 - 動画検索対象フォルダ
816     private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
817     // 検索 - コメント検索対象フォルダ
818     private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
819     // システム
820     private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
821     private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
822     private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
823     private final JTextField fldSystemTempDir = new JTextField();
824
825
826     // End of variables declaration//GEN-END:variables
827
828     private void loadConfig() {
829         final Config p = Config.INSTANCE;
830
831         /*
832          * ネットワーク - アカウント
833          */
834         fldMail.setText(p.getId());
835         fldPassword.setText(p.getPassword());
836
837         /*
838          * ネットワーク - プロキシ
839          */
840         cbProxyUse.setSelected(p.getProxyUse());
841         fldProxyHost.setText(p.getProxyHost());
842         fldProxyPort.setText(p.getProxyPort());
843
844         /*
845          * ファイル - 動画
846          */
847         pnlFileVideo.fldDir.setText(p.getVideoDir());
848         pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
849         pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
850
851         /*
852          * ファイル - コメント
853          */
854         pnlFileComment.fldDir.setText(p.getCommentDir());
855         pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
856         pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
857
858         /*
859          * ファイル - 変換動画
860          */
861         fldOutputDir.setText(p.getOutputDir());
862         fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
863         cbOutputEnable.setSelected(p.getOutputEnable());
864         cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
865         cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
866
867         /*
868          * ファイル - 禁則文字
869          */
870         fldReplaceFrom.setText(p.getReplaceFrom());
871         fldReplaceTo.setText(p.getReplaceTo());
872
873         /**
874          * コメント
875          */
876         cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
877         fldCommentSizeManual.setText(p.getCommentSizeManual());
878         cbCommentMinDisable.setSelected(p.getCommentMinDisabled());
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(String.valueOf(fldPassword.getPassword()));
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.setCommentMinDisabled(cbCommentMinDisable.isSelected());
979         p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
980         p.setCommentMinSizeManual(fldCommentSizeManual.getText());
981         p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
982         p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
983
984         /**
985          * コメント - 高度な設定
986          */
987         p.setFontPath(fldFontPath.getText());
988         p.setFontIndex(fldFontIndex.getText());
989         p.setFontShadow(cmbFontShadow.getSelectedIndex());
990         p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
991         p.setCommentOpaque(cbCommentOpaque.isSelected());
992
993         /*
994          * ffmpeg - ファイルパス
995          */
996         p.setFfmpegPath(fldFfmpegPath.getText());
997         p.setFfmpegDllPath(fldFfmpegDllPath.getText());
998
999         /*
1000          * ffmpeg - ffmpegパラメータ
1001          */
1002         final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1003         p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1004         p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1005         p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1006         p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1007         p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1008         p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1009         p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1010         p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1011         p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1012         p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1013
1014         /*
1015          * NG 設定
1016          */
1017         p.setNgWords(pnlNgWord.getAllElements());
1018         p.setNgIds(pnlNgId.getAllElements());
1019
1020         /*
1021          * 検索
1022          */
1023         p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1024         p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1025
1026         /*
1027          * システム
1028          */
1029         p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
1030         p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
1031         p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
1032         p.setSystemTempDir(fldSystemTempDir.getText());
1033
1034         try {
1035             p.save();
1036         } catch (ConfigurationException ex) {
1037             logger.log(Level.SEVERE, "コンフィグファイル保存に失敗", ex);
1038         }
1039     }
1040 }
1041
1042 class DownloadLocationPanel extends JPanel {
1043     final JTextField fldDir = new JTextField();
1044     final JTextField fldFileNamePattern = new JTextField();
1045     final JCheckBox cbLocal = new JCheckBox("local");
1046
1047     DownloadLocationPanel(){
1048         super();
1049
1050         final JLabel lblVideoDir = new JLabel("保存フォルダ");
1051         final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1052
1053         final JButton btnDir = new JButton("...");
1054         btnDir.addActionListener(
1055                 new FileChooseAction(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1056
1057         final GroupLayout gl = new GroupLayout(this);
1058         setLayout(gl);
1059         gl.setHorizontalGroup(
1060             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1061             .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1062                 .addContainerGap()
1063                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1064                     .addComponent(lblVideoFileNamepattern)
1065                     .addComponent(lblVideoDir))
1066                 .addPreferredGap(ComponentPlacement.RELATED)
1067                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1068                     .addGroup(gl.createSequentialGroup()
1069                         .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1070                         .addPreferredGap(ComponentPlacement.RELATED)
1071                         .addComponent(btnDir))
1072                     .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1073                         .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1074                         .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1075                         .addComponent(cbLocal)))
1076                 .addContainerGap())
1077         );
1078         gl.setVerticalGroup(
1079             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1080             .addGroup(gl.createSequentialGroup()
1081                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1082                     .addComponent(lblVideoDir)
1083                     .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1084                     .addComponent(btnDir))
1085                 .addPreferredGap(ComponentPlacement.RELATED)
1086                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1087                     .addComponent(lblVideoFileNamepattern)
1088                     .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1089                     .addComponent(cbLocal))
1090                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1091         );
1092
1093     }
1094 }