OSDN Git Service

add Override annotation
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / MainFrame.java
index 5f70895..1749f7a 100644 (file)
@@ -10,20 +10,19 @@ 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;
@@ -33,9 +32,8 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.SortedSet;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import javax.swing.BorderFactory;
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.DropMode;
@@ -58,22 +56,14 @@ 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 javax.swing.border.BevelBorder;
+import javax.swing.table.TableModel;
 import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.builder.ToStringBuilder;
-import saccubus.FfmpegOption;
 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;
@@ -82,7 +72,14 @@ 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;
@@ -92,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;
 
 /**
  *
@@ -100,15 +99,8 @@ 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
-            = "<html>ダウンロードする場合はチェックを外します。<br/>ローカルファイルを使用する場合はチェックを入れます。</html>";
-    private static final String FILE_INPUTFIELD_TOOLTIP
-            = "<html>ダウンロードする場合はファイル命名規則を入力します。<br/>"
-            + "ローカルファイルを使用する場合はパスを含むファイル名を入力します。</html>";
-    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;
@@ -121,6 +113,7 @@ public class MainFrame extends JFrame {
     public MainFrame() {
         super();
         addWindowListener(new MainFrameWindowListener());
+        setTitle(MainFrame_AboutBox.VERSION);
 
         final Config p = Config.INSTANCE;
 
@@ -164,17 +157,41 @@ public class MainFrame extends JFrame {
 
         final JPanel pnlMain = new JPanel();
         final JScrollPane scrDisplay = new JScrollPane();
-        tblDisplay = new JTable(targetModel, new TargetsColumnModel());
+        tblDisplay = new JTable(targetModel, new TargetsColumnModel()) {
+            private static final long serialVersionUID = 1L;
+
+            @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();
         final JLabel lblVideo = new JLabel();
         cbVideoLocal = new JCheckBox();
-        cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
-        cmbVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
         btnVideo.addActionListener(
-                new FileChooseAction(MainFrame.this, JFileChooser.FILES_ONLY, fldVideo));
+                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からの経過秒を入力します。");
@@ -198,7 +215,6 @@ public class MainFrame extends JFrame {
         cbBackLogReduce.setToolTipText("「コメントの量を減らす」場合はチェックを付けます。");
 
         cbCommentLocal = new JCheckBox();
-        cbCommentLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
         cbCommentLocal.addItemListener(new ItemListener() {
 
             @Override
@@ -208,13 +224,12 @@ public class MainFrame extends JFrame {
                 cbBackLog.setEnabled(!selected);
             }
         });
-        cmbComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
         btnComment.addActionListener(
-                new FileChooseAction(MainFrame.this, JFileChooser.FILES_ONLY, fldComment));
+                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);
 
@@ -262,10 +277,10 @@ public class MainFrame extends JFrame {
 
 
         cmbId = new IdComboBox(videoFileWatcher);
-        cmbId.setToolTipText(ID_FIELD_TOOLTIP);
         cmbId.getEditorComponent().addActionListener(applyListener);
         cmbId.getEditorComponent().addFocusListener(new java.awt.event.FocusAdapter() {
 
+            @Override
             public void focusLost(java.awt.event.FocusEvent evt) {
                 idFieldFocusLost(evt);
             }
@@ -276,6 +291,7 @@ public class MainFrame extends JFrame {
         cbVideoLocal.setText("local");
         cbVideoLocal.addItemListener(new java.awt.event.ItemListener() {
 
+            @Override
             public void itemStateChanged(java.awt.event.ItemEvent evt) {
                 useMovieLocalCheckBoxItemStateChanged(evt);
             }
@@ -286,6 +302,7 @@ public class MainFrame extends JFrame {
         cbCommentLocal.setText("local");
         cbCommentLocal.addItemListener(new java.awt.event.ItemListener() {
 
+            @Override
             public void itemStateChanged(java.awt.event.ItemEvent evt) {
                 useMovieLocalCheckBoxItemStateChanged(evt);
             }
@@ -296,6 +313,7 @@ public class MainFrame extends JFrame {
         cbOutputEnable.setText("変換");
         cbOutputEnable.addItemListener(new java.awt.event.ItemListener() {
 
+            @Override
             public void itemStateChanged(java.awt.event.ItemEvent evt) {
                 outputConvertCheckBoxItemStateChanged(evt);
             }
@@ -517,10 +535,11 @@ public class MainFrame extends JFrame {
             setSize(windowWidth, windowHeight);
         }
 
-        // TODO 最大化した状態で終了した場合の考慮
         final int windowPosX = p.getSystemWindowPosX();
         final int windowPosY = p.getSystemWindowPosY();
-        if (windowPosX > 1024 && windowPosY > 1024) {
+        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);
@@ -536,8 +555,6 @@ public class MainFrame extends JFrame {
         }
 
         initInputPanel();
-        pnlMain.setTransferHandler(new DownloadListTransferHandler());
-        tblDisplay.setTransferHandler(new TableTransferHandler());
     }
 
     public void startWatcher() {
@@ -578,7 +595,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, "キャンセル");
             }
@@ -593,14 +610,18 @@ public class MainFrame extends JFrame {
                 final DownloadProfile downProf = new InqubusDownloadProfile();
                 final String id = Util.getVideoId(cmbId.getText());
                 final InqubusConvertProfile convProf = new InqubusConvertProfile();
-                logger.log(Level.INFO, downProf.toString());
-                logger.log(Level.INFO, convProf.toString());
+                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.log(Level.SEVERE, null, th);
+                logger.error(null, th);
                 JOptionPane.showMessageDialog(MainFrame.this, th.getMessage(), "中断しました", JOptionPane.ERROR_MESSAGE);
             }
         }
@@ -689,8 +710,11 @@ public class MainFrame extends JFrame {
         final Config p = Config.INSTANCE;
 
         cmbId.setText("");
-        fldBackLog.setEnabled(false);
+        cbBackLogReduce.setSelected(p.getCommentMinDisabled());
         cbBackLog.setEnabled(true);
+        cbBackLog.setSelected(false);
+        fldBackLog.setEnabled(false);
+        fldBackLog.setText("");
 
         final boolean videoLocal = p.getVideoUseLocal();
         cbVideoLocal.setSelected(videoLocal);
@@ -724,20 +748,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
@@ -770,127 +794,21 @@ 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.");
-        }
-
-        @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 {
-
-        private static final long serialVersionUID = 1L;
-        private final Pattern movieIdPattern = Pattern.compile("(\\w\\w\\d+)");
-
-        @Override
-        public boolean canImport(TransferHandler.TransferSupport support) {
-            Transferable transferable = support.getTransferable();
-            if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)
-                    || transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
-                return true;
-            }
-            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);
-        }
-    }
-
     private class MainFrameWindowListener extends WindowAdapter {
         @Override
         public void windowClosing(WindowEvent e) {
             final Config p = Config.INSTANCE;
 
-            final Dimension size = getSize();
-            p.setSystemWindowWidth(size.width);
-            p.setSystemWindowHeight(size.height);
+            // 保存するのは最大化していない場合だけ
+            if (JFrame.NORMAL == getExtendedState()) {
+                final Dimension size = getSize();
+                p.setSystemWindowWidth(size.width);
+                p.setSystemWindowHeight(size.height);
 
-            final Point pos = getLocation();
-            p.setSystemWindowPosX(pos.x);
-            p.setSystemWindowPosY(pos.y);
+                final Point pos = getLocation();
+                p.setSystemWindowPosX(pos.x);
+                p.setSystemWindowPosY(pos.y);
+            }
 
             p.setSystemColumnId(tblDisplay.getColumnModel().getColumn(0).getWidth());
             p.setSystemColumnVideo(tblDisplay.getColumnModel().getColumn(1).getWidth());
@@ -900,7 +818,7 @@ public class MainFrame extends JFrame {
             try {
                 p.save();
             } catch (ConfigurationException ex) {
-                logger.log(Level.SEVERE, "コンフィグ保存失敗", ex);
+                logger.error("コンフィグ保存失敗", ex);
             }
         }
     }
@@ -908,7 +826,6 @@ public class MainFrame extends JFrame {
     /*
      * ここからDownloadProfile作成用クラスの定義
      */
-
     private class InqubusDownloadProfile implements DownloadProfile {
 
         private final LoginProfile loginProfile;
@@ -918,15 +835,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;
         }
 
@@ -956,66 +873,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;
@@ -1062,17 +919,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) {
@@ -1096,10 +953,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
@@ -1123,21 +976,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;
         }
@@ -1148,75 +991,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() throws IOException {
-            final Config p = Config.INSTANCE;
             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());
-            this.tmpDir = new File(p.getSystemTempDir());
-            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
@@ -1240,86 +1035,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 = "";
@@ -1327,11 +1054,6 @@ public class MainFrame extends JFrame {
         }
 
         @Override
-        public File getDir() {
-            return this.dir;
-        }
-
-        @Override
         public String getFileName() {
             return this.fileName;
         }
@@ -1364,29 +1086,19 @@ public class MainFrame extends JFrame {
         private final boolean adjustRatio;
 
         private InqubusFfmpegProfile() throws IOException {
-            final File file = pnlInputFfmpeg.mdlFfmpegOption.getSelectedFile();
-            if (file != null) {
-                final FfmpegOption ffop = FfmpegOption.load(file);
-                this.extOption = ffop.getExtOption();
-                this.inOption = ffop.getInOption();
-                this.mainOption = ffop.getMainOption();
-                this.outOption = ffop.getMainOption();
-                this.avOption = ffop.getAvfilterOption();
-                this.resize = ffop.isResize();
-                this.resizeWidth = ffop.getResizeWidth();
-                this.resizeHeight = ffop.getResizeHeight();
-                this.adjustRatio = ffop.isAdjustRatio();
-            } else {
-                this.extOption = pnlInputFfmpeg.fldFfmpegOptionExtension.getText();
-                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();
+            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
@@ -1439,24 +1151,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);
-        }
-    }
 }