OSDN Git Service

ツールチップ記述修正
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / MainFrame.java
index c642a7d..3ef11c5 100644 (file)
@@ -39,8 +39,10 @@ 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;
@@ -48,9 +50,12 @@ import javax.swing.LayoutStyle.ComponentPlacement;
 import javax.swing.SwingUtilities;
 import javax.swing.TransferHandler;
 import javax.swing.WindowConstants;
+import javax.swing.border.BevelBorder;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.builder.ToStringBuilder;
+import saccubus.FfmpegOption;
 import saccubus.MainFrame_AboutBox;
+import saccubus.OptionComboBoxModel;
 import saccubus.util.WayBackTimeParser;
 import saccubus.worker.impl.convert.ConvertProgress;
 import saccubus.worker.impl.download.DownloadProgress;
@@ -86,10 +91,10 @@ public class MainFrame extends JFrame {
     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 final TargetsTableModel targetModel = new TargetsTableModel();
@@ -111,6 +116,7 @@ public class MainFrame extends JFrame {
         tblDisplay = new JTable(targetModel, new TargetsColumnModel());
         tblDisplay.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         final JPanel pnlButton = new JPanel();
+        final JTabbedPane tbpInput = new JTabbedPane();
         final JPanel pnlInputMain = new JPanel();
         final JLabel lblId = new JLabel();
         fldId.setToolTipText(ID_FIELD_TOOLTIP);
@@ -119,7 +125,6 @@ public class MainFrame extends JFrame {
         cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
         fldVideo = new JTextField();
         fldVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
-        btnVideo = new JButton();
         final JLabel lblComment = new JLabel();
 
         fldBackLog.setToolTipText("YYYY/MM/DD hh:mm:ss形式、あるいは1970/01/01からの経過秒を入力します。");
@@ -155,7 +160,6 @@ public class MainFrame extends JFrame {
         });
         fldComment = new JTextField();
         fldComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
-        btnComment = new JButton();
         final JLabel lblOutput = new JLabel();
         cbOutputEnable = new JCheckBox();
         fldOutput = new JTextField();
@@ -197,8 +201,6 @@ public class MainFrame extends JFrame {
                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
         );
 
-        pnlInputMain.setBorder(BorderFactory.createEtchedBorder());
-
         lblId.setText("ID");
 
         fldId.addFocusListener(new java.awt.event.FocusAdapter() {
@@ -218,8 +220,6 @@ public class MainFrame extends JFrame {
             }
         });
 
-        btnVideo.setText("...");
-
         lblComment.setText("コメント");
 
         cbCommentLocal.setText("local");
@@ -230,8 +230,6 @@ public class MainFrame extends JFrame {
             }
         });
 
-        btnComment.setText("...");
-
         lblOutput.setText("出力");
 
         cbOutputEnable.setText("変換");
@@ -243,54 +241,51 @@ 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(fldId, 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(fldVideo, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
+                    .addComponent(fldComment, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
+                    .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
+                )
+                .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)
+                .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
                     .addComponent(fldId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                     .addComponent(lblId)
                     .addComponent(cbBackLogReduce)
@@ -298,25 +293,103 @@ public class MainFrame extends JFrame {
                     .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(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(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(btnApply)
+            .addContainerGap()
+        );
+        glInputButton.setVerticalGroup(glInputButton.createSequentialGroup()
+            .addContainerGap()
+            .addGroup(glInputButton.createParallelGroup(Alignment.BASELINE)
+                .addComponent(fldInputMessage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                 .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 +399,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 +413,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()
+            )
         );
 
 
@@ -364,8 +439,6 @@ public class MainFrame extends JFrame {
         tblDisplay.setTransferHandler(new TableTransferHandler());
 
         final Config p = Config.INSTANCE;
-        // TODO コンフィグからスレッド数
-        // TODO downloadの連続処理時待ち時間設定も必要...
         final int thDownload = p.getSystemDownloadThread();
         final int secDownload = p.getSystemDownloadWait();
         final int thConvert = p.getSystemConvertThread();
@@ -391,11 +464,13 @@ public class MainFrame extends JFrame {
 
         @Override
         public void actionPerformed(ActionEvent e) {
-            // FIXME 待機中に停止しても「状態」の表示が変わらない。
             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});
+            if (res) {
+                targetModel.setStatus(t.getRowId(), null, TaskStatus.CANCELLED, -1.0, "キャンセル");
+            }
         }
     }
 
@@ -403,26 +478,22 @@ 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();
+            try {
+                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();
+            } catch (Throwable th) {
+                logger.log(Level.SEVERE, null, th);
+                JOptionPane.showMessageDialog(MainFrame.this, th.getMessage(), "中断しました", JOptionPane.ERROR_MESSAGE);
+            }
         }
     }
-    /** 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 候補は複数返すようにして、その後の対処は呼び出しもとで行ってもらった方が良いかも
@@ -457,21 +528,17 @@ public class MainFrame extends JFrame {
 
         final ItemSelectable source = evt.getItemSelectable();
 
-        JButton btn;
         JTextField field;
         File dir;
         if (source == cbVideoLocal) {
-            btn = btnVideo;
             field = fldVideo;
             dir = new File(p.getVideoDir());
         } else {
-            btn = btnComment;
             field = fldComment;
             dir = new File(p.getCommentDir());
         }
 
         final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
-        btn.setEnabled(useLocal);
 
         String text;
         if (useLocal) {
@@ -523,24 +590,30 @@ public class MainFrame extends JFrame {
     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 JCheckBox cbBackLog = new JCheckBox("過去ログ");
     private final JTextField fldBackLog = new JTextField();
     private final JCheckBox cbVideoLocal;
     private final JTextField fldVideo;
-    private final JButton btnVideo;
     private final JCheckBox cbCommentLocal;
     private final JTextField fldComment;
-    private final JButton btnComment;
     private final JCheckBox cbOutputEnable;
     private final JTextField fldOutput;
+    // 入力領域 - ffmpeg
+    private final FfmpegParamPanel pnlInputFfmpeg = new FfmpegParamPanel();
     // 適用
+    private final JTextField fldInputMessage = new JTextField();
     private final JButton btnApply = new JButton("適用");
     // End of variables declaration//GEN-END:variables
 
     private void initInputPanel() {
+        initMainTab();
+        initFfmpegTab();
+    }
+
+    private void initMainTab() {
         final Config p = Config.INSTANCE;
 
         fldId.setText("");
@@ -549,14 +622,12 @@ public class MainFrame extends JFrame {
 
         final boolean movieLocal = p.getVideoUseLocal();
         cbVideoLocal.setSelected(movieLocal);
-        btnVideo.setEnabled(movieLocal);
         if (!movieLocal) {
             fldVideo.setText(p.getVideoFileNamePattern());
         }
 
         final boolean commentLocal = p.getCommentUseLocal();
         cbCommentLocal.setSelected(commentLocal);
-        btnComment.setEnabled(commentLocal);
         if (!commentLocal) {
             fldComment.setText(p.getCommentFileNamePattern());
         }
@@ -565,7 +636,10 @@ public class MainFrame extends JFrame {
         cbOutputEnable.setSelected(convert);
         fldOutput.setEnabled(convert);
         fldOutput.setText(p.getOutputFileNamePattern());
+    }
 
+    private void initFfmpegTab() {
+        pnlInputFfmpeg.init(Config.INSTANCE);
     }
 
     private JMenuBar initMenuBar() {
@@ -1021,7 +1095,7 @@ public class MainFrame extends JFrame {
         private final int maxNumOfComment;
         private final HideCondition ngSetting;
 
-        private InqubusConvertProfile() {
+        private InqubusConvertProfile() throws IOException {
             final Config p = Config.INSTANCE;
             this.outputProfile = new InqubusOutputProfile();
             this.generalProfile = new InqubusGeneralProfile();
@@ -1032,8 +1106,7 @@ public class MainFrame extends JFrame {
             this.vhookDisabled = false;
             this.commentOverlay = p.getOutputCommentOverlay();
             this.vhook = new File(p.getFfmpegDllPath());
-            // TODO コンフィグに設定なし
-            this.tmpDir = new File(".");
+            this.tmpDir = new File(p.getSystemTempDir());
             this.font = new File(p.getFontPath());
             this.fontIndex = Integer.parseInt(p.getFontIndex());
             this.commentOpaque = p.getCommentOpaque();
@@ -1190,18 +1263,30 @@ 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 {
+            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();
+            }
         }
 
         @Override