OSDN Git Service

リストへのDnD機能はやめる
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / MainFrame.java
index 6347856..47ae215 100644 (file)
@@ -22,7 +22,6 @@ 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.URL;
 import java.nio.file.FileSystem;
@@ -32,10 +31,12 @@ import java.util.ArrayList;
 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 javax.swing.BorderFactory;
+import javax.swing.DefaultComboBoxModel;
 import javax.swing.DropMode;
 import javax.swing.GroupLayout;
 import javax.swing.GroupLayout.Alignment;
@@ -60,16 +61,9 @@ import javax.swing.TransferHandler;
 import javax.swing.WindowConstants;
 import javax.swing.border.BevelBorder;
 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;
@@ -80,8 +74,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;
@@ -110,6 +112,9 @@ public class MainFrame extends JFrame {
     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() {
@@ -124,10 +129,11 @@ public class MainFrame extends JFrame {
         final int thConvert = p.getSystemConvertThread();
         taskManager = new TaskManage(thDownload, secDownload, thConvert, new GuiTaskManageListener());
 
-        // TODO ディレクトリ監視スレッド生成
+        // ディレクトリ監視スレッド生成
+        final FileSystem fs = FileSystems.getDefault();
+
         final List<String> videoSearchDirs = p.getSearchVideoDirs();
         videoSearchDirs.add(p.getVideoDir());
-        final FileSystem fs = FileSystems.getDefault();
         final Set<Path> videoPaths = new HashSet<>(videoSearchDirs.size());
         for (String s : videoSearchDirs) {
             videoPaths.add(fs.getPath(s));
@@ -136,6 +142,16 @@ public class MainFrame extends JFrame {
         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");
@@ -247,7 +263,7 @@ public class MainFrame extends JFrame {
         cmbId = new IdComboBox(videoFileWatcher);
         cmbId.setToolTipText(ID_FIELD_TOOLTIP);
         cmbId.getEditorComponent().addActionListener(applyListener);
-        cmbId.addFocusListener(new java.awt.event.FocusAdapter() {
+        cmbId.getEditorComponent().addFocusListener(new java.awt.event.FocusAdapter() {
 
             public void focusLost(java.awt.event.FocusEvent evt) {
                 idFieldFocusLost(evt);
@@ -317,9 +333,9 @@ public class MainFrame extends JFrame {
                 )
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addGroup(glInputMain.createParallelGroup(Alignment.LEADING)
-                    .addComponent(cmbVideo, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
-                    .addComponent(cmbComment, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
-                    .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
+                    .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)
@@ -500,10 +516,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);
@@ -519,12 +536,22 @@ public class MainFrame extends JFrame {
         }
 
         initInputPanel();
-        pnlMain.setTransferHandler(new DownloadListTransferHandler());
-        tblDisplay.setTransferHandler(new TableTransferHandler());
     }
 
     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 {
@@ -577,31 +604,6 @@ public class MainFrame extends JFrame {
         }
     }
 
-    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();
-            }
-        });
-
-        if (lists.length == 1) {
-            return lists[0];
-        } else if (lists.length > 1) {
-            throw new UnsupportedOperationException();
-        } else {
-            return null;
-        }
-    }
-
     /**
      * 動画, コメントの"local"チェックボックス更新時の処理.
      */
@@ -611,36 +613,27 @@ public class MainFrame extends JFrame {
         final ItemSelectable source = evt.getItemSelectable();
 
         JButton button;
-        JTextField field;
-        File dir;
+        FileComboBox combo;
+        Set<Path> allFiles;
+        String pattern;
         if (source == cbVideoLocal) {
             button = btnVideo;
-            field = fldVideo;
-            dir = new File(p.getVideoDir());
+            combo = cmbVideo;
+            allFiles = videoFileWatcher.getFiles();
+            pattern = p.getVideoFileNamePattern();
         } else {
             button = btnComment;
-            field = fldComment;
-            dir = new File(p.getCommentDir());
+            combo = cmbComment;
+            allFiles = commentFileWatcher.getFiles();
+            pattern = p.getCommentFileNamePattern();
         }
 
         final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
 
         button.setEnabled(useLocal);
+        createFieldInfo(combo, useLocal, cmbId.getText(), pattern, allFiles);
 
-        String text;
-        if (useLocal) {
-            final File f = searchFileMatchId(dir, cmbId.getText());
-            if (f != null) {
-                text = f.getPath();
-            } else {
-                text = "";
-            }
-        } else {
-            text = p.getVideoFileNamePattern();
-        }
-        field.setText(text);
-
-    }//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged
+    }
 
     private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged
         final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED);
@@ -650,26 +643,9 @@ 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 = cmbId.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());
-            }
-        }
 
+        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;
@@ -711,8 +687,9 @@ public class MainFrame extends JFrame {
         final Config p = Config.INSTANCE;
 
         cmbId.setText("");
-        fldBackLog.setEnabled(false);
+        cbBackLogReduce.setSelected(p.getCommentMinDisabled());
         cbBackLog.setEnabled(true);
+        fldBackLog.setEnabled(false);
 
         final boolean videoLocal = p.getVideoUseLocal();
         cbVideoLocal.setSelected(videoLocal);
@@ -746,20 +723,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
@@ -792,127 +769,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());
@@ -930,7 +801,6 @@ public class MainFrame extends JFrame {
     /*
      * ここからDownloadProfile作成用クラスの定義
      */
-
     private class InqubusDownloadProfile implements DownloadProfile {
 
         private final LoginProfile loginProfile;
@@ -940,15 +810,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;
         }
 
@@ -978,66 +848,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;
@@ -1084,17 +894,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) {
@@ -1118,10 +928,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
@@ -1145,21 +951,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;
         }
@@ -1170,75 +966,28 @@ 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
@@ -1262,86 +1011,19 @@ 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(){
+        private InqubusOutputProfile() {
             final Config p = Config.INSTANCE;
-            this.dir = new File(p.getOutputDir());
             this.fileName = fldOutput.getText();
             // TODO この時点でのID/Titleはどうするか…
             this.videoId = "";
@@ -1349,11 +1031,6 @@ public class MainFrame extends JFrame {
         }
 
         @Override
-        public File getDir() {
-            return this.dir;
-        }
-
-        @Override
         public String getFileName() {
             return this.fileName;
         }
@@ -1386,29 +1063,15 @@ 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();
-            }
+            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();
         }
 
         @Override
@@ -1461,24 +1124,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);
-        }
-    }
 }