OSDN Git Service

Merge branch テーブルのtooltipにサムネイル情報を表示する機能
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / MainFrame.java
index 4f7fcf6..f22e5b5 100644 (file)
@@ -5,60 +5,65 @@
  */
 package yukihane.inqubus.gui;
 
+import java.awt.Dimension;
 import java.awt.Image;
 import java.awt.ItemSelectable;
+import java.awt.Point;
 import java.awt.Toolkit;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.File;
-import java.io.FilenameFilter;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.Set;
+import java.util.SortedSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import javax.swing.BorderFactory;
+import javax.swing.DefaultComboBoxModel;
 import javax.swing.DropMode;
 import javax.swing.GroupLayout;
 import javax.swing.GroupLayout.Alignment;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
 import javax.swing.JTable;
 import javax.swing.JTextField;
 import javax.swing.KeyStroke;
 import javax.swing.LayoutStyle.ComponentPlacement;
 import javax.swing.SwingUtilities;
-import javax.swing.TransferHandler;
 import javax.swing.WindowConstants;
-import org.apache.commons.lang.StringUtils;
+import javax.swing.border.BevelBorder;
+import javax.swing.table.TableModel;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import saccubus.MainFrame_AboutBox;
 import saccubus.util.WayBackTimeParser;
-import saccubus.worker.impl.convert.ConvertProgress;
-import saccubus.worker.impl.download.DownloadProgress;
-import saccubus.worker.WorkerListener;
-import saccubus.worker.impl.convert.ConvertResult;
-import saccubus.worker.impl.download.DownloadResult;
 import saccubus.worker.profile.CommentProfile;
-import saccubus.worker.profile.ConvertProfile;
 import saccubus.worker.profile.DownloadProfile;
 import saccubus.worker.profile.FfmpegProfile;
 import saccubus.worker.profile.GeneralProfile;
@@ -67,7 +72,16 @@ import saccubus.worker.profile.OutputProfile;
 import saccubus.worker.profile.ProxyProfile;
 import saccubus.worker.profile.VideoProfile;
 import yukihane.Util;
-import yukihane.inqubus.Config;
+import yukihane.inqubus.config.Config;
+import yukihane.inqubus.config.ConfigCommentProfile;
+import yukihane.inqubus.config.ConfigConvertProfile;
+import yukihane.inqubus.config.ConfigFfmpegProfile;
+import yukihane.inqubus.config.ConfigGeneralProfile;
+import yukihane.inqubus.config.ConfigLoginProfile;
+import yukihane.inqubus.config.ConfigOutputProfile;
+import yukihane.inqubus.config.ConfigProxyProfile;
+import yukihane.inqubus.filewatch.FileWatch;
+import yukihane.inqubus.filewatch.FileWatchUtil;
 import yukihane.inqubus.manager.RequestProcess;
 import yukihane.inqubus.manager.TaskKind;
 import yukihane.inqubus.manager.TaskManage;
@@ -75,6 +89,8 @@ import yukihane.inqubus.manager.TaskManageListener;
 import yukihane.inqubus.manager.TaskStatus;
 import yukihane.inqubus.model.Target;
 import yukihane.inqubus.model.TargetsTableModel;
+import yukihane.inqubus.thumbnail.Repository;
+import yukihane.inqubus.thumbnail.Thumbnail;
 
 /**
  *
@@ -83,43 +99,97 @@ import yukihane.inqubus.model.TargetsTableModel;
 public class MainFrame extends JFrame {
 
     private static final long serialVersionUID = 1L;
-    private static final Logger logger = Logger.getLogger(MainFrame.class.getName());
-    private static final String ID_FIELD_TOOLTIP = "動画のIDまたはURLを入力します。";
-    private static final String FILE_LOCALBUTTON_TOOLTIP
-            = "ダウンロードする場合はチェックを外します。ローカルファイルを使用する場合はチェックを入れます。";
-    private static final String FILE_INPUTFIELD_TOOLTIP
-            = "ダウンロードする場合はファイル命名規則を入力します。"
-            + "ローカルファイルを使用する場合はパスを含むファイル名を入力します。";
-    private static final String FILE_OUTPUTFIELD_TOOLTIP
-            = "ファイル命名規則入力します。";
+    private static final Logger logger = LoggerFactory.getLogger(MainFrame.class);
+    private final Repository thumbRepository = new Repository();
     private final TargetsTableModel targetModel = new TargetsTableModel();
     private final TaskManage taskManager;
+    private final Thread videoFileWatcherThread;
+    private final FileWatch videoFileWatcher;
+    private final Thread commentFileWatcherThread;
+    private final FileWatch commentFileWatcher;
+
 
     /** Creates new form MainFrame */
     public MainFrame() {
+        super();
+        addWindowListener(new MainFrameWindowListener());
+
+        final Config p = Config.INSTANCE;
+
+        // ワーカスレッド生成
+        final int thDownload = p.getSystemDownloadThread();
+        final int secDownload = p.getSystemDownloadWait();
+        final int thConvert = p.getSystemConvertThread();
+        taskManager = new TaskManage(thDownload, secDownload, thConvert, new GuiTaskManageListener());
+
+        // ディレクトリ監視スレッド生成
+        final FileSystem fs = FileSystems.getDefault();
+
+        final List<String> videoSearchDirs = p.getSearchVideoDirs();
+        videoSearchDirs.add(p.getVideoDir());
+        final Set<Path> videoPaths = new HashSet<>(videoSearchDirs.size());
+        for (String s : videoSearchDirs) {
+            videoPaths.add(fs.getPath(s));
+        }
+        videoFileWatcher = new FileWatch(videoPaths);
+        this.videoFileWatcherThread = new Thread(videoFileWatcher);
+        this.videoFileWatcherThread.setDaemon(true);
+
+        final List<String> commentSearchDirs = p.getSearchCommentDirs();
+        commentSearchDirs.add(p.getCommentDir());
+        final Set<Path> commentPaths = new HashSet<>(commentSearchDirs.size());
+        for(String s : commentSearchDirs) {
+            commentPaths.add(fs.getPath(s));
+        }
+        commentFileWatcher = new FileWatch(commentPaths);
+        this.commentFileWatcherThread = new Thread(commentFileWatcher);
+        this.commentFileWatcherThread.setDaemon(true);
+
         final URL url = MainFrame_AboutBox.class.getResource("icon.png");
         final Image icon1 = Toolkit.getDefaultToolkit().createImage(url);
         final URL url32 = MainFrame_AboutBox.class.getResource("icon32.png");
         final Image icon2 = Toolkit.getDefaultToolkit().createImage(url32);
-        final List<Image> images = new ArrayList<Image>(2);
+        final List<Image> images = new ArrayList<>(2);
         images.add(icon1);
         images.add(icon2);
         setIconImages(images);
 
         final JPanel pnlMain = new JPanel();
         final JScrollPane scrDisplay = new JScrollPane();
-        tblDisplay = new JTable(targetModel, new TargetsColumnModel());
+        tblDisplay = new JTable(targetModel, new TargetsColumnModel()) {
+
+            @Override
+            public String getToolTipText(MouseEvent e) {
+                int row = convertRowIndexToModel(rowAtPoint(e.getPoint()));
+                TableModel m = getModel();
+                final String videoId = (String) m.getValueAt(row, 0);
+                try {
+                    final Thumbnail thumbnail = thumbRepository.getThumnail(videoId);
+                    if (thumbnail == null) {
+                        return videoId + ": 動画情報未取得";
+                    }
+
+                    final URL imageUrl = thumbnail.getImageFile().toURI().toURL();
+
+                    return "<html>" + videoId + ": " + thumbnail.getTitle()
+                            + " (" + thumbnail.getLength() + ")" + "<br/>"
+                            + "<img src=\"" + imageUrl + "\"/>"
+                            + "</html>";
+                } catch (Throwable ex) {
+                    logger.warn(null, ex);
+                    return videoId + ": 情報取得できません";
+                }
+            }
+        };
         tblDisplay.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         final JPanel pnlButton = new JPanel();
         final JPanel pnlInputMain = new JPanel();
         final JLabel lblId = new JLabel();
-        fldId.setToolTipText(ID_FIELD_TOOLTIP);
         final JLabel lblVideo = new JLabel();
         cbVideoLocal = new JCheckBox();
-        cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
-        fldVideo = new JTextField();
-        fldVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
-        btnVideo = new JButton();
+        btnVideo.addActionListener(
+                new FileChooseActionListener(MainFrame.this, JFileChooser.FILES_ONLY, fldVideo));
+        fldVideo.setTransferHandler(new ContentTransferHandler(fldVideo.getTransferHandler(), cbVideoLocal));
         final JLabel lblComment = new JLabel();
 
         fldBackLog.setToolTipText("YYYY/MM/DD hh:mm:ss形式、あるいは1970/01/01からの経過秒を入力します。");
@@ -143,7 +213,6 @@ public class MainFrame extends JFrame {
         cbBackLogReduce.setToolTipText("「コメントの量を減らす」場合はチェックを付けます。");
 
         cbCommentLocal = new JCheckBox();
-        cbCommentLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
         cbCommentLocal.addItemListener(new ItemListener() {
 
             @Override
@@ -153,18 +222,25 @@ public class MainFrame extends JFrame {
                 cbBackLog.setEnabled(!selected);
             }
         });
-        fldComment = new JTextField();
-        fldComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
-        btnComment = new JButton();
+        btnComment.addActionListener(
+                new FileChooseActionListener(MainFrame.this, JFileChooser.FILES_ONLY, fldComment));
+        fldComment.setTransferHandler(new ContentTransferHandler(fldComment.getTransferHandler(), cbCommentLocal));
         final JLabel lblOutput = new JLabel();
         cbOutputEnable = new JCheckBox();
         fldOutput = new JTextField();
-        fldOutput.setToolTipText(FILE_OUTPUTFIELD_TOOLTIP);
 
         setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 
         btnStop.addActionListener(new StopActionListener());
-        btnApply.addActionListener(new ApplyActionListener());
+        final ApplyActionListener applyListener = new ApplyActionListener();
+        btnApply.addActionListener(applyListener);
+        btnClear.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                initInputPanel();
+            }
+        });
 
         pnlMain.setBorder(BorderFactory.createEtchedBorder());
 
@@ -179,11 +255,9 @@ public class MainFrame extends JFrame {
             gl_pnlButton.createParallelGroup(Alignment.LEADING)
             .addGroup(gl_pnlButton.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(btnStart)
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addComponent(btnStop)
                 .addPreferredGap(ComponentPlacement.RELATED, 250, Short.MAX_VALUE)
-                .addComponent(btnDeselect)
                 .addContainerGap())
         );
         gl_pnlButton.setVerticalGroup(
@@ -191,17 +265,18 @@ public class MainFrame extends JFrame {
             .addGroup(gl_pnlButton.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(gl_pnlButton.createParallelGroup(Alignment.BASELINE)
-                    .addComponent(btnStart)
                     .addComponent(btnStop)
-                    .addComponent(btnDeselect))
-                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                )
+                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+            )
         );
 
-        pnlInputMain.setBorder(BorderFactory.createEtchedBorder());
-
         lblId.setText("ID");
 
-        fldId.addFocusListener(new java.awt.event.FocusAdapter() {
+
+        cmbId = new IdComboBox(videoFileWatcher);
+        cmbId.getEditorComponent().addActionListener(applyListener);
+        cmbId.getEditorComponent().addFocusListener(new java.awt.event.FocusAdapter() {
 
             public void focusLost(java.awt.event.FocusEvent evt) {
                 idFieldFocusLost(evt);
@@ -218,8 +293,6 @@ public class MainFrame extends JFrame {
             }
         });
 
-        btnVideo.setText("...");
-
         lblComment.setText("コメント");
 
         cbCommentLocal.setText("local");
@@ -230,8 +303,6 @@ public class MainFrame extends JFrame {
             }
         });
 
-        btnComment.setText("...");
-
         lblOutput.setText("出力");
 
         cbOutputEnable.setText("変換");
@@ -243,80 +314,166 @@ public class MainFrame extends JFrame {
         });
 
 
-        GroupLayout gl_pnlInputMain = new GroupLayout(pnlInputMain);
-        pnlInputMain.setLayout(gl_pnlInputMain);
-        gl_pnlInputMain.setHorizontalGroup(
-            gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
-            .addGroup(gl_pnlInputMain.createSequentialGroup()
+        final GroupLayout glInputMain = new GroupLayout(pnlInputMain);
+        pnlInputMain.setLayout(glInputMain);
+        glInputMain.setHorizontalGroup(
+            glInputMain.createParallelGroup(Alignment.LEADING)
+            .addGroup(glInputMain.createSequentialGroup()
                 .addContainerGap()
-                .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
-                    .addGroup(gl_pnlInputMain.createSequentialGroup()
-                        .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
-                            .addComponent(lblComment)
-                            .addComponent(lblVideo)
-                            .addComponent(lblId)
-                            .addComponent(lblOutput))
-                        .addPreferredGap(ComponentPlacement.RELATED)
-                        .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
-                            .addGroup(gl_pnlInputMain.createSequentialGroup()
-                                .addComponent(cbVideoLocal)
-                                .addPreferredGap(ComponentPlacement.RELATED)
-                                .addComponent(fldVideo, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)
-                                .addPreferredGap(ComponentPlacement.RELATED)
-                                .addComponent(btnVideo))
-                            .addGroup(gl_pnlInputMain.createSequentialGroup()
-                                .addComponent(fldId, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
-                                .addPreferredGap(ComponentPlacement.UNRELATED)
-                                .addComponent(cbBackLogReduce)
-                                .addComponent(cbBackLog)
-                                .addComponent(fldBackLog, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
-                            )
-                            .addGroup(Alignment.TRAILING, gl_pnlInputMain.createSequentialGroup()
-                                .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.TRAILING)
-                                    .addGroup(Alignment.LEADING, gl_pnlInputMain.createSequentialGroup()
-                                        .addComponent(cbOutputEnable)
-                                        .addPreferredGap(ComponentPlacement.RELATED)
-                                        .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
-                                    .addGroup(gl_pnlInputMain.createSequentialGroup()
-                                        .addComponent(cbCommentLocal)
-                                        .addPreferredGap(ComponentPlacement.RELATED)
-                                        .addComponent(fldComment, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)))
-                                .addPreferredGap(ComponentPlacement.RELATED)
-                                .addComponent(btnComment))))
-                    .addComponent(btnApply, Alignment.TRAILING))
-                .addContainerGap())
+                .addComponent(lblId)
+                .addPreferredGap(ComponentPlacement.RELATED)
+                .addComponent(cmbId, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE)
+                .addPreferredGap(ComponentPlacement.UNRELATED)
+                .addComponent(cbBackLogReduce)
+                .addPreferredGap(ComponentPlacement.UNRELATED)
+                .addComponent(cbBackLog)
+                .addPreferredGap(ComponentPlacement.RELATED)
+                .addComponent(fldBackLog, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
+                .addContainerGap()
+            )
+            .addGroup(glInputMain.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(glInputMain.createParallelGroup(Alignment.LEADING)
+                    .addComponent(lblVideo)
+                    .addComponent(lblComment)
+                    .addComponent(lblOutput)
+                )
+                .addPreferredGap(ComponentPlacement.RELATED)
+                .addGroup(glInputMain.createParallelGroup(Alignment.LEADING)
+                    .addComponent(cbVideoLocal)
+                    .addComponent(cbCommentLocal)
+                    .addComponent(cbOutputEnable)
+                )
+                .addPreferredGap(ComponentPlacement.RELATED)
+                .addGroup(glInputMain.createParallelGroup(Alignment.LEADING)
+                    .addComponent(cmbVideo, 300, 300, Short.MAX_VALUE)
+                    .addComponent(cmbComment, 300, 300, Short.MAX_VALUE)
+                    .addComponent(fldOutput, 300, 300, Short.MAX_VALUE)
+                )
+                .addGroup(glInputMain.createParallelGroup()
+                    .addComponent(btnVideo)
+                    .addComponent(btnComment)
+                )
+                .addContainerGap()
+            )
         );
-        gl_pnlInputMain.setVerticalGroup(
-            gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
-            .addGroup(gl_pnlInputMain.createSequentialGroup()
+
+        glInputMain.setVerticalGroup(
+            glInputMain.createParallelGroup(Alignment.LEADING)
+            .addGroup(glInputMain.createSequentialGroup()
                 .addContainerGap()
-                .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
-                    .addComponent(fldId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
+                    .addComponent(cmbId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                     .addComponent(lblId)
                     .addComponent(cbBackLogReduce)
                     .addComponent(cbBackLog)
                     .addComponent(fldBackLog)
                 )
                 .addPreferredGap(ComponentPlacement.RELATED)
-                .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
+                .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
                     .addComponent(lblVideo)
-                    .addComponent(fldVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                    .addComponent(cbVideoLocal)
+                    .addComponent(cmbVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                     .addComponent(btnVideo)
-                    .addComponent(cbVideoLocal))
+                )
                 .addPreferredGap(ComponentPlacement.RELATED)
-                .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
+                .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
                     .addComponent(lblComment)
-                    .addComponent(fldComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                    .addComponent(cbCommentLocal)
+                    .addComponent(cmbComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                     .addComponent(btnComment)
-                    .addComponent(cbCommentLocal))
+                )
                 .addPreferredGap(ComponentPlacement.RELATED)
-                .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
+                .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
                     .addComponent(lblOutput)
                     .addComponent(fldOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                    .addComponent(cbOutputEnable))
-                .addPreferredGap(ComponentPlacement.UNRELATED)
+                    .addComponent(cbOutputEnable)
+                )
+            )
+        );
+
+        // ffmpeg入力パネル
+        pnlInputFfmpeg.fldFfmpegOptionResizeWidth.setEnabled(false);
+        pnlInputFfmpeg.fldFfmpegOptionResizeHeight.setEnabled(false);
+        pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(false);
+        pnlInputFfmpeg.cmbFfmpegOptionFile.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                final boolean notFile = !pnlInputFfmpeg.mdlFfmpegOption.isFile();
+                pnlInputFfmpeg.fldFfmpegOptionExtension.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionMain.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionIn.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionOut.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionAv.setEnabled(notFile);
+                pnlInputFfmpeg.cbFfmpegOptionResize.setEnabled(notFile);
+            }
+        });
+        pnlInputFfmpeg.cbFfmpegOptionResize.addItemListener(new ItemListener() {
+
+            @Override
+            public void itemStateChanged(ItemEvent e) {
+                final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
+                pnlInputFfmpeg.fldFfmpegOptionResizeWidth.setEnabled(selected);
+                pnlInputFfmpeg.fldFfmpegOptionResizeHeight.setEnabled(selected);
+                pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(selected);
+            }
+        });
+        pnlInputFfmpeg.cbFfmpegOptionResize.addPropertyChangeListener("enabled", new PropertyChangeListener() {
+
+            @Override
+            public void propertyChange(PropertyChangeEvent evt) {
+                final boolean enabled = ((Boolean) evt.getNewValue()).booleanValue();
+                final boolean fldEnabled = enabled ? pnlInputFfmpeg.cbFfmpegOptionResize.isSelected() : false;
+                pnlInputFfmpeg.fldFfmpegOptionResizeWidth.setEnabled(fldEnabled);
+                pnlInputFfmpeg.fldFfmpegOptionResizeHeight.setEnabled(fldEnabled);
+                pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(fldEnabled);
+            }
+        });
+
+
+        tbpInput.add("メイン", pnlInputMain);
+        tbpInput.add("ffmpeg", pnlInputFfmpeg);
+
+        // 入力部のボタンやメッセージ表示部
+        fldInputMessage.setEditable(false);
+        fldInputMessage.setEnabled(false);
+        fldInputMessage.setBorder(BorderFactory.createEmptyBorder());
+
+        final JPanel pnlInputButton = new JPanel();
+        final GroupLayout glInputButton = new GroupLayout(pnlInputButton);
+        pnlInputButton.setLayout(glInputButton);
+        glInputButton.setHorizontalGroup(glInputButton.createSequentialGroup()
+            .addContainerGap()
+            .addComponent(fldInputMessage, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
+            .addPreferredGap(ComponentPlacement.UNRELATED)
+            .addComponent(btnClear)
+            .addPreferredGap(ComponentPlacement.UNRELATED)
+            .addComponent(btnApply)
+            .addContainerGap()
+        );
+        glInputButton.setVerticalGroup(glInputButton.createSequentialGroup()
+            .addContainerGap()
+            .addGroup(glInputButton.createParallelGroup(Alignment.BASELINE)
+                .addComponent(fldInputMessage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                .addComponent(btnClear)
                 .addComponent(btnApply)
-                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+            )
+            .addContainerGap()
+        );
+
+        // 画面下半分の入力部分
+        final JPanel pnlInputAll = new JPanel();
+        pnlInputAll.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
+        final GroupLayout glInputAll = new GroupLayout(pnlInputAll);
+        pnlInputAll.setLayout(glInputAll);
+        glInputAll.setHorizontalGroup(glInputAll.createParallelGroup()
+            .addComponent(tbpInput)
+            .addComponent(pnlInputButton)
+        );
+        glInputAll.setVerticalGroup(glInputAll.createSequentialGroup()
+            .addComponent(tbpInput)
+            .addComponent(pnlInputButton)
         );
 
         GroupLayout gl_pnlMain = new GroupLayout(pnlMain);
@@ -326,9 +483,10 @@ public class MainFrame extends JFrame {
             .addGroup(Alignment.TRAILING, gl_pnlMain.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(gl_pnlMain.createParallelGroup(Alignment.TRAILING)
-                    .addComponent(pnlInputMain, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                     .addComponent(scrDisplay, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
-                    .addComponent(pnlButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                    .addComponent(pnlButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                    .addComponent(pnlInputAll, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                )
                 .addContainerGap())
         );
         gl_pnlMain.setVerticalGroup(
@@ -339,8 +497,9 @@ public class MainFrame extends JFrame {
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addComponent(pnlButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                 .addPreferredGap(ComponentPlacement.RELATED)
-                .addComponent(pnlInputMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                .addGap(24, 24, 24))
+                .addComponent(pnlInputAll, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                .addContainerGap()
+            )
         );
 
 
@@ -359,15 +518,53 @@ public class MainFrame extends JFrame {
         );
 
         pack();
+        setMinimumSize(getSize());
+
+        /*
+         * 画面のサイズや位置を前回終了時のものに設定する
+         */
+        final int windowWidth = p.getSystemWindowWidth();
+        final int windowHeight = p.getSystemWindowHeight();
+        if (windowWidth > 0 && windowHeight > 0) {
+            setSize(windowWidth, windowHeight);
+        }
+
+        final int windowPosX = p.getSystemWindowPosX();
+        final int windowPosY = p.getSystemWindowPosY();
+        final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        if (windowPosX + windowWidth > 0 && windowPosX < screenSize.width
+                && windowPosY + windowHeight > 0 && windowPosY < screenSize.height) {
+            setLocation(windowPosX, windowPosY);
+        } else {
+            setLocationByPlatform(true);
+        }
+
+        final int colId = p.getSystemColumnId();
+        if(colId > 0) {
+            tblDisplay.getColumnModel().getColumn(0).setPreferredWidth(colId);
+        }
+        final int colStatus = p.getSystemColumnStatus();
+        if(colStatus > 0) {
+            tblDisplay.getColumnModel().getColumn(4).setPreferredWidth(colStatus);
+        }
+
         initInputPanel();
-        pnlMain.setTransferHandler(new DownloadListTransferHandler());
-        tblDisplay.setTransferHandler(new TableTransferHandler());
+    }
 
-        final Config p = Config.INSTANCE;
-        final int thDownload = p.getSystemDownloadThread();
-        final int secDownload = p.getSystemDownloadWait();
-        final int thConvert = p.getSystemConvertThread();
-        taskManager = new TaskManage(thDownload, secDownload,thConvert, new GuiTaskManageListener());
+    public void startWatcher() {
+        videoFileWatcherThread.start();
+        commentFileWatcherThread.start();
+    }
+
+    private static void createFieldInfo( FileComboBox combo,  boolean useLocal,  String text, String pattern,  Set<Path> allFiles) {
+        if (useLocal) {
+            final SortedSet<String> matchFiles = FileWatchUtil.getFileNamesContain(allFiles, text);
+            DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(matchFiles.toArray(new String[0]));
+            combo.setModel(model);
+        } else {
+            combo.setModel(new DefaultComboBoxModel<String>());
+            combo.getEditorComponent().setText(pattern);
+        }
     }
 
     private class GuiTaskManageListener implements TaskManageListener {
@@ -392,7 +589,7 @@ public class MainFrame extends JFrame {
             final int row = tblDisplay.getSelectedRow();
             final Target t = targetModel.getTarget(row);
             final boolean res = taskManager.cancel(t.getRowId());
-            logger.log(Level.FINE, "停止: {0} {1}", new Object[]{t.getVideoId(), res});
+            logger.debug("停止: {} {}", t.getVideoId(), res);
             if (res) {
                 targetModel.setStatus(t.getRowId(), null, TaskStatus.CANCELLED, -1.0, "キャンセル");
             }
@@ -403,49 +600,24 @@ public class MainFrame extends JFrame {
 
         @Override
         public void actionPerformed(ActionEvent e) {
-            final DownloadProfile downProf = new InqubusDownloadProfile();
-            final String id = Util.getVideoId(fldId.getText());
-            final InqubusConvertProfile convProf = new InqubusConvertProfile();
-            logger.log(Level.INFO, downProf.toString());
-            logger.log(Level.INFO, convProf.toString());
-            final RequestProcess rp = new RequestProcess(downProf, id, convProf);
-            taskManager.add(rp);
-            targetModel.addTarget(new Target(rp));
-            initInputPanel();
-        }
-    }
-    /** This method is called from within the constructor to
-     * initialize the form.
-     * WARNING: Do NOT modify this code. The content of this method is
-     * always regenerated by the Form Editor.
-     */
-    @SuppressWarnings("unchecked")
-    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
-    private void initComponents() {
-    }// </editor-fold>//GEN-END:initComponents
-
-    private File searchFileMatchId(final File dir, final String id) {
-        // TODO 候補は複数返すようにして、その後の対処は呼び出しもとで行ってもらった方が良いかも
-        if (id.isEmpty()) {
-            return null;
-        }
-
-        final File[] lists = dir.listFiles(new FilenameFilter() {
-
-            final Pattern pattern = Pattern.compile(id + "\\D");
-
-            @Override
-            public boolean accept(File dir, String name) {
-                return pattern.matcher(name).find();
+            try {
+                final DownloadProfile downProf = new InqubusDownloadProfile();
+                final String id = Util.getVideoId(cmbId.getText());
+                final InqubusConvertProfile convProf = new InqubusConvertProfile();
+                logger.debug(downProf.toString());
+                logger.debug(convProf.toString());
+
+                final File tempDir = new File(Config.INSTANCE.getSystemTempDir());
+                thumbRepository.request(downProf.getProxyProfile(), tempDir, id);
+
+                final RequestProcess rp = new RequestProcess(downProf, id, convProf);
+                taskManager.add(rp);
+                targetModel.addTarget(new Target(rp));
+                initInputPanel();
+            } catch (Throwable th) {
+                logger.error(null, th);
+                JOptionPane.showMessageDialog(MainFrame.this, th.getMessage(), "中断しました", JOptionPane.ERROR_MESSAGE);
             }
-        });
-
-        if (lists.length == 1) {
-            return lists[0];
-        } else if (lists.length > 1) {
-            throw new UnsupportedOperationException();
-        } else {
-            return null;
         }
     }
 
@@ -457,36 +629,28 @@ public class MainFrame extends JFrame {
 
         final ItemSelectable source = evt.getItemSelectable();
 
-        JButton btn;
-        JTextField field;
-        File dir;
+        JButton button;
+        FileComboBox combo;
+        Set<Path> allFiles;
+        String pattern;
         if (source == cbVideoLocal) {
-            btn = btnVideo;
-            field = fldVideo;
-            dir = new File(p.getVideoDir());
+            button = btnVideo;
+            combo = cmbVideo;
+            allFiles = videoFileWatcher.getFiles();
+            pattern = p.getVideoFileNamePattern();
         } else {
-            btn = btnComment;
-            field = fldComment;
-            dir = new File(p.getCommentDir());
+            button = btnComment;
+            combo = cmbComment;
+            allFiles = commentFileWatcher.getFiles();
+            pattern = p.getCommentFileNamePattern();
         }
 
         final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
-        btn.setEnabled(useLocal);
 
-        String text;
-        if (useLocal) {
-            final File f = searchFileMatchId(dir, fldId.getText());
-            if (f != null) {
-                text = f.getPath();
-            } else {
-                text = "";
-            }
-        } else {
-            text = p.getVideoFileNamePattern();
-        }
-        field.setText(text);
+        button.setEnabled(useLocal);
+        createFieldInfo(combo, useLocal, cmbId.getText(), pattern, allFiles);
 
-    }//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged
+    }
 
     private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged
         final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED);
@@ -495,77 +659,79 @@ public class MainFrame extends JFrame {
 
     private void idFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_idFieldFocusLost
         final Config p = Config.INSTANCE;
-        final String id = fldId.getText();
-        if (id.isEmpty()) {
-            return;
-        }
-
-        if (cbVideoLocal.isSelected() && fldVideo.getText().isEmpty()) {
-            final File dir = new File(p.getVideoDir());
-            final File file = searchFileMatchId(dir, id);
-            if (file != null) {
-                fldVideo.setText(file.getPath());
-            }
-        }
-
-        if (cbCommentLocal.isSelected() && fldComment.getText().isEmpty()) {
-            final File dir = new File(p.getCommentDir());
-            final File file = searchFileMatchId(dir, id);
-            if (file != null) {
-                fldComment.setText(file.getPath());
-            }
-        }
+        final String id = cmbId.getText();
 
+        createFieldInfo(cmbVideo, cbVideoLocal.isSelected(), id, p.getVideoFileNamePattern(), videoFileWatcher.getFiles());
+        createFieldInfo(cmbComment, cbCommentLocal.isSelected(), id, p.getCommentFileNamePattern(), commentFileWatcher.getFiles());
     }//GEN-LAST:event_idFieldFocusLost
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private final JTable tblDisplay;
     // ボタン領域
-    private final JButton btnStart = new JButton("開始");
     private final JButton btnStop = new JButton("停止");
-    private final JButton btnDeselect = new JButton("選択解除");
-    //入力領域 - 標準
-    private final JTextField fldId = new JTextField();
-    private final JCheckBox cbBackLogReduce = new JCheckBox("コメ数減少");
+    // 入力領域
+    private final JTabbedPane tbpInput = new JTabbedPane(JTabbedPane.BOTTOM);
+    // 入力領域 - メイン
+    private final IdComboBox cmbId;
+    private final JCheckBox cbBackLogReduce = new JCheckBox("少コメ");
     private final JCheckBox cbBackLog = new JCheckBox("過去ログ");
     private final JTextField fldBackLog = new JTextField();
     private final JCheckBox cbVideoLocal;
-    private final JTextField fldVideo;
-    private final JButton btnVideo;
+    private final FileComboBox cmbVideo = new FileComboBox();
+    private final JTextField fldVideo = cmbVideo.getEditorComponent();
+    private final JButton btnVideo = new JButton("...");
     private final JCheckBox cbCommentLocal;
-    private final JTextField fldComment;
-    private final JButton btnComment;
+    private final FileComboBox cmbComment = new FileComboBox();
+    private final JTextField fldComment = cmbComment.getEditorComponent();
+    private final JButton btnComment = new JButton("...");
     private final JCheckBox cbOutputEnable;
     private final JTextField fldOutput;
+    // 入力領域 - ffmpeg
+    private final FfmpegParamPanel pnlInputFfmpeg = new FfmpegParamPanel();
     // 適用
+    private final JTextField fldInputMessage = new JTextField();
+    private final JButton btnClear = new JButton("クリア");
     private final JButton btnApply = new JButton("適用");
     // End of variables declaration//GEN-END:variables
 
     private void initInputPanel() {
+        initMainTab();
+        initFfmpegTab();
+        tbpInput.setSelectedIndex(0);
+        cmbId.requestFocus();
+    }
+
+    private void initMainTab() {
         final Config p = Config.INSTANCE;
 
-        fldId.setText("");
-        fldBackLog.setEnabled(false);
+        cmbId.setText("");
+        cbBackLogReduce.setSelected(p.getCommentMinDisabled());
         cbBackLog.setEnabled(true);
+        cbBackLog.setSelected(false);
+        fldBackLog.setEnabled(false);
+        fldBackLog.setText("");
 
-        final boolean movieLocal = p.getVideoUseLocal();
-        cbVideoLocal.setSelected(movieLocal);
-        btnVideo.setEnabled(movieLocal);
-        if (!movieLocal) {
+        final boolean videoLocal = p.getVideoUseLocal();
+        cbVideoLocal.setSelected(videoLocal);
+        if (!videoLocal) {
             fldVideo.setText(p.getVideoFileNamePattern());
         }
+        btnVideo.setEnabled(videoLocal);
 
         final boolean commentLocal = p.getCommentUseLocal();
         cbCommentLocal.setSelected(commentLocal);
-        btnComment.setEnabled(commentLocal);
         if (!commentLocal) {
             fldComment.setText(p.getCommentFileNamePattern());
         }
+        btnComment.setEnabled(commentLocal);
 
         final boolean convert = p.getOutputEnable();
         cbOutputEnable.setSelected(convert);
         fldOutput.setEnabled(convert);
         fldOutput.setText(p.getOutputFileNamePattern());
+    }
 
+    private void initFfmpegTab() {
+        pnlInputFfmpeg.init(Config.INSTANCE);
     }
 
     private JMenuBar initMenuBar() {
@@ -576,20 +742,20 @@ public class MainFrame extends JFrame {
 
         final JMenuItem itExit = new JMenuItem("終了(X)", KeyEvent.VK_X);
         itExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
-        itExit.addActionListener(new ActionListener() {
+        final ActionListener exitActionListener = new ActionListener() {
 
             @Override
             public void actionPerformed(ActionEvent e) {
-                throw new UnsupportedOperationException("Not supported yet.");
+                processWindowEvent(new WindowEvent(MainFrame.this, WindowEvent.WINDOW_CLOSING));
             }
-        });
+        };
+        itExit.addActionListener(exitActionListener);
         mnFile.add(itExit);
 
         final JMenu mnTool = new JMenu("ツール(T)");
         menuBar.add(mnTool);
 
         final JMenuItem itOption = new JMenuItem("オプション(O)...", KeyEvent.VK_O);
-        // TODO ショートカットキー
         itOption.addActionListener(new ActionListener() {
 
             @Override
@@ -622,119 +788,38 @@ public class MainFrame extends JFrame {
         return menuBar;
     }
 
-    private class DownloadProgressListener implements WorkerListener<DownloadResult, DownloadProgress> {
-
-        @Override
-        public void process(DownloadProgress progress) {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-
-        @Override
-        public void cancelled() {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-
-        @Override
-        public void done(DownloadResult result) {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-
-        @Override
-        public void error(Throwable th) {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-    }
-
-    private class ConvertProgressListener implements WorkerListener<ConvertResult, ConvertProgress> {
-
-        @Override
-        public void process(ConvertProgress progress) {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-
-        @Override
-        public void cancelled() {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-
+    private class MainFrameWindowListener extends WindowAdapter {
         @Override
-        public void done(ConvertResult result) {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-
-        @Override
-        public void error(Throwable th) {
-            throw new UnsupportedOperationException("Not supported yet.");
-        }
-    }
-
-
-
-    private class DownloadListTransferHandler extends TransferHandler {
+        public void windowClosing(WindowEvent e) {
+            final Config p = Config.INSTANCE;
 
-        private static final long serialVersionUID = 1L;
-        private final Pattern movieIdPattern = Pattern.compile("(\\w\\w\\d+)");
+            // 保存するのは最大化していない場合だけ
+            if (JFrame.NORMAL == getExtendedState()) {
+                final Dimension size = getSize();
+                p.setSystemWindowWidth(size.width);
+                p.setSystemWindowHeight(size.height);
 
-        @Override
-        public boolean canImport(TransferHandler.TransferSupport support) {
-            Transferable transferable = support.getTransferable();
-            if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)
-                    || transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
-                return true;
+                final Point pos = getLocation();
+                p.setSystemWindowPosX(pos.x);
+                p.setSystemWindowPosY(pos.y);
             }
-            return false;
-        }
-
-        @Override
-        public boolean importData(TransferHandler.TransferSupport support) {
-//            try {
-//                Transferable transferable = support.getTransferable();
-//                if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
-//                    @SuppressWarnings("unchecked")
-//                    final List<File> data = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
-//                    Collection<Target> targets = Target.from(data);
-//                    targetModel.addTarget(targets);
-//                } else if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
-//                    String data = (String) transferable.getTransferData(DataFlavor.stringFlavor);
-//                    Matcher matcher = movieIdPattern.matcher(data);
-//                    if (matcher.find()) {
-//                        String movieId = matcher.group(1);
-//                        Target target = Target.fromId(movieId);
-//                        targetModel.addTarget(target);
-//                    } else {
-//                        return false;
-//                    }
-//
-//                }
-//                return false;
-//            } catch (Exception e) {
-//                logger.log(Level.SEVERE, null, e);
-//                return false;
-//            }
-            // TODO 上記実装見直し(Locationは削除された)
-            return false;
-        }
-    }
-
-    private class TableTransferHandler extends DownloadListTransferHandler {
-
-        private static final long serialVersionUID = 1L;
-
-        @Override
-        public boolean canImport(TransferHandler.TransferSupport support) {
-            return super.canImport(support);
-        }
 
-        @Override
-        public boolean importData(TransferHandler.TransferSupport support) {
-            return super.importData(support);
+            p.setSystemColumnId(tblDisplay.getColumnModel().getColumn(0).getWidth());
+            p.setSystemColumnVideo(tblDisplay.getColumnModel().getColumn(1).getWidth());
+            p.setSystemColumnComment(tblDisplay.getColumnModel().getColumn(2).getWidth());
+            p.setSystemColumnConvert(tblDisplay.getColumnModel().getColumn(3).getWidth());
+            p.setSystemColumnStatus(tblDisplay.getColumnModel().getColumn(4).getWidth());
+            try {
+                p.save();
+            } catch (ConfigurationException ex) {
+                logger.error("コンフィグ保存失敗", ex);
+            }
         }
     }
 
     /*
      * ここからDownloadProfile作成用クラスの定義
      */
-
     private class InqubusDownloadProfile implements DownloadProfile {
 
         private final LoginProfile loginProfile;
@@ -744,15 +829,15 @@ public class MainFrame extends JFrame {
         private final GeneralProfile generalProfile;
 
         private InqubusDownloadProfile() {
-            this.loginProfile = new InqubusLoginProfile();
-            this.proxyProfile = new InqubusProxyProfile();
+            this.loginProfile = new ConfigLoginProfile();
+            this.proxyProfile = new ConfigProxyProfile();
             this.videoProfile = new InqubusVideoProfile();
             this.commentProfile = new InqubusCommentProfile();
-            this.generalProfile = new InqubusGeneralProfile();
+            this.generalProfile = new ConfigGeneralProfile();
         }
 
         @Override
-        public LoginProfile getLoginInfo() {
+        public LoginProfile getLoginProfile() {
             return this.loginProfile;
         }
 
@@ -782,66 +867,6 @@ public class MainFrame extends JFrame {
         }
     }
 
-    private class InqubusLoginProfile implements LoginProfile {
-        private final String mail;
-        private final String password;
-
-        private InqubusLoginProfile(){
-            final Config p = Config.INSTANCE;
-            this.mail = p.getId();
-            this.password = p.getPassword();
-        }
-
-        @Override
-        public String getMail() {
-            return this.mail;
-        }
-
-        @Override
-        public String getPassword() {
-            return this.password;
-        }
-
-        @Override
-        public String toString(){
-            return ToStringBuilder.reflectionToString(this);
-        }
-    }
-
-    private class InqubusProxyProfile implements ProxyProfile {
-        private final boolean use;
-        private final String host;
-        private final int port;
-
-        private InqubusProxyProfile(){
-            final Config p = Config.INSTANCE;
-            this.use = p.getProxyUse();
-            this.host = p.getProxyHost();
-            final String pp = p.getProxyPort();
-            this.port = StringUtils.isBlank(pp) ? -1 : Integer.parseInt(pp);
-        }
-
-        @Override
-        public boolean use() {
-            return this.use;
-        }
-
-        @Override
-        public String getHost() {
-            return this.host;
-        }
-
-        @Override
-        public int getPort() {
-            return this.port;
-        }
-
-        @Override
-        public String toString(){
-            return ToStringBuilder.reflectionToString(this);
-        }
-    }
-
     private class InqubusVideoProfile implements VideoProfile {
         private final boolean download;
         private final File dir;
@@ -888,17 +913,17 @@ public class MainFrame extends JFrame {
         }
     }
 
-    private class InqubusCommentProfile implements CommentProfile {
+    private class InqubusCommentProfile extends ConfigCommentProfile {
         private final boolean download;
         private final File dir;
         private final String fileName;
         private final File localFile;
-        private final int lengthRelatedCommentSize;
         private final boolean disablePerMinComment;
-        private final int perMinCommentSize;
         private final long backLogPoint;
 
         private InqubusCommentProfile() {
+            super();
+
             final Config p = Config.INSTANCE;
             this.download = !cbCommentLocal.isSelected();
             if (this.download) {
@@ -922,10 +947,6 @@ public class MainFrame extends JFrame {
             }
 
             this.disablePerMinComment = cbBackLogReduce.isSelected();
-            this.lengthRelatedCommentSize
-                    = (p.getCommentSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentSizeManual());
-            this.perMinCommentSize
-                    = (p.getCommentMinSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentMinSizeManual());
         }
 
         @Override
@@ -949,21 +970,11 @@ public class MainFrame extends JFrame {
         }
 
         @Override
-        public int getLengthRelatedCommentSize() {
-            return this.lengthRelatedCommentSize;
-        }
-
-        @Override
         public boolean isDisablePerMinComment() {
             return this.disablePerMinComment;
         }
 
         @Override
-        public int getPerMinCommentSize() {
-            return this.perMinCommentSize;
-        }
-
-        @Override
         public long getBackLogPoint() {
             return this.backLogPoint;
         }
@@ -974,76 +985,27 @@ public class MainFrame extends JFrame {
         }
     }
 
-    private class InqubusGeneralProfile implements GeneralProfile {
-        private final String replaceFrom;
-        private final String replaceTo;
-        private InqubusGeneralProfile() {
-            final Config p = Config.INSTANCE;
-            this.replaceFrom = p.getReplaceFrom();
-            this.replaceTo = p.getReplaceTo();
-        }
-
-        @Override
-        public String getReplaceFrom() {
-            return this.replaceFrom;
-        }
-
-        @Override
-        public String getReplaceTo() {
-            return this.replaceTo;
-        }
-
-        @Override
-        public String toString(){
-            return ToStringBuilder.reflectionToString(this);
-        }
-    }
-
     /*
      * ここからConvertProfile作成用クラスの定義
      */
-    private class InqubusConvertProfile implements ConvertProfile {
+    private class InqubusConvertProfile extends ConfigConvertProfile {
         private final OutputProfile outputProfile;
         private final GeneralProfile generalProfile;
         private final FfmpegProfile ffmpegProfile;
         private final boolean convert;
-        private final File ffmpeg;
-        private final boolean vhookDisabled;
-        private final boolean commentOverlay;
-        private final File vhook;
-        private final File tmpDir;
-        private final File font;
-        private final int fontIndex;
-        private final boolean commentOpaque;
-        private final boolean disableFontSizeArrange;
-        private final int shadowIndex;
-        private final boolean showConvrting;
-        private final int maxNumOfComment;
-        private final HideCondition ngSetting;
-
-        private InqubusConvertProfile() {
-            final Config p = Config.INSTANCE;
+
+        private InqubusConvertProfile() throws IOException {
             this.outputProfile = new InqubusOutputProfile();
-            this.generalProfile = new InqubusGeneralProfile();
-            this.ffmpegProfile = new InqubusFfmpegProfile();
+            this.generalProfile = new ConfigGeneralProfile();
+
+            final File file = pnlInputFfmpeg.mdlFfmpegOption.getSelectedFile();
+            if (file != null) {
+                this.ffmpegProfile = new ConfigFfmpegProfile();
+            } else {
+                this.ffmpegProfile = new InqubusFfmpegProfile();
+            }
+
             this.convert = cbOutputEnable.isSelected();
-            this.ffmpeg = new File(p.getFfmpegPath());
-            // TODO コンフィグに設定なし
-            this.vhookDisabled = false;
-            this.commentOverlay = p.getOutputCommentOverlay();
-            this.vhook = new File(p.getFfmpegDllPath());
-            // TODO コンフィグに設定なし
-            this.tmpDir = new File(".");
-            this.font = new File(p.getFontPath());
-            this.fontIndex = Integer.parseInt(p.getFontIndex());
-            this.commentOpaque = p.getCommentOpaque();
-            this.disableFontSizeArrange = p.getFontSizeArrangeDisable();
-            this.shadowIndex = p.getFontShadow();
-            // TODO コンフィグに設定なし
-            this.showConvrting = true;
-            this.maxNumOfComment = (p.getCommentDisplaySizeDefault()) ? -1 : Integer.parseInt(p.
-                    getCommentDisplaySizeManual());
-            this.ngSetting = new InqubusHideCondition();
         }
 
         @Override
@@ -1067,86 +1029,18 @@ public class MainFrame extends JFrame {
         }
 
         @Override
-        public File getFfmpeg() {
-            return this.ffmpeg;
-        }
-
-        @Override
-        public boolean isVhookDisabled() {
-            return this.vhookDisabled;
-        }
-
-        @Override
-        public boolean isCommentOverlay() {
-            return this.commentOverlay;
-        }
-
-        @Override
-        public File getVhook() {
-            return this.vhook;
-        }
-
-        @Override
-        public File getTempDir() {
-            return this.tmpDir;
-        }
-
-        @Override
-        public File getFont() {
-            return this.font;
-        }
-
-        @Override
-        public int getFontIndex() {
-            return this.fontIndex;
-        }
-
-        @Override
-        public boolean isCommentOpaque() {
-            return this.commentOpaque;
-        }
-
-        @Override
-        public boolean isDisableFontSizeArrange() {
-            return this.disableFontSizeArrange;
-        }
-
-        @Override
-        public int getShadowIndex() {
-            return this.shadowIndex;
-        }
-
-        @Override
-        public boolean isShowConverting() {
-            return this.showConvrting;
-        }
-
-        @Override
-        public int getMaxNumOfComment() {
-            return this.maxNumOfComment;
-        }
-
-        @Override
-        public HideCondition getNgSetting() {
-            return this.ngSetting;
-        }
-
-        @Override
         public String toString(){
             return ToStringBuilder.reflectionToString(this);
         }
     }
 
-    private class InqubusOutputProfile implements OutputProfile {
-        private final File dir;
+    private class InqubusOutputProfile extends ConfigOutputProfile {
         private final String fileName;
         private final String videoId;
         private final String title;
 
 
-        private InqubusOutputProfile(){
-            final Config p = Config.INSTANCE;
-            this.dir = new File(p.getOutputDir());
+        private InqubusOutputProfile() {
             this.fileName = fldOutput.getText();
             // TODO この時点でのID/Titleはどうするか…
             this.videoId = "";
@@ -1154,11 +1048,6 @@ public class MainFrame extends JFrame {
         }
 
         @Override
-        public File getDir() {
-            return this.dir;
-        }
-
-        @Override
         public String getFileName() {
             return this.fileName;
         }
@@ -1190,18 +1079,20 @@ public class MainFrame extends JFrame {
         private final int resizeHeight;
         private final boolean adjustRatio;
 
-        private InqubusFfmpegProfile() {
-            // TODO FFMPEGオプションは、後でメイン画面でも設定できるようにするかも
-            final Config p = Config.INSTANCE;
-            this.extOption = p.getFfmpegExtension();
-            this.inOption = p.getFfmpegInOption();
-            this.mainOption = p.getFfmpegMainOption();
-            this.outOption = p.getFfmpegOutOption();
-            this.avOption = p.getFfmpegAvOption();
-            this.resize = p.getFfmpegResizeEnable();
-            this.resizeWidth = Integer.parseInt(p.getFfmpegResizeWidth());
-            this.resizeHeight = Integer.parseInt(p.getFfmpegResizeHeight());
-            this.adjustRatio = p.getFfmpegKeepAspect();
+        private InqubusFfmpegProfile() throws IOException {
+            String ext = pnlInputFfmpeg.fldFfmpegOptionExtension.getText();
+            if (!ext.startsWith(".")) {
+                ext = "." + ext;
+            }
+            this.extOption = ext;
+            this.inOption = pnlInputFfmpeg.fldFfmpegOptionIn.getText();
+            this.mainOption = pnlInputFfmpeg.fldFfmpegOptionMain.getText();
+            this.outOption = pnlInputFfmpeg.fldFfmpegOptionOut.getText();
+            this.avOption = pnlInputFfmpeg.fldFfmpegOptionAv.getText();
+            this.resize = pnlInputFfmpeg.cbFfmpegOptionResize.isSelected();
+            this.resizeWidth = Integer.parseInt(pnlInputFfmpeg.fldFfmpegOptionResizeWidth.getText());
+            this.resizeHeight = Integer.parseInt(pnlInputFfmpeg.fldFfmpegOptionResizeHeight.getText());
+            this.adjustRatio = pnlInputFfmpeg.cbFfmpegOptionKeepAspect.isSelected();
         }
 
         @Override
@@ -1254,24 +1145,4 @@ public class MainFrame extends JFrame {
             return ToStringBuilder.reflectionToString(this);
         }
     }
-
-    private class InqubusHideCondition implements ConvertProfile.HideCondition{
-
-        @Override
-        public String getWord() {
-            // TODO
-            return "";
-        }
-
-        @Override
-        public String getId() {
-            // TODO
-            return "";
-        }
-
-        @Override
-        public String toString(){
-            return ToStringBuilder.reflectionToString(this);
-        }
-    }
 }