OSDN Git Service

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