X-Git-Url: http://git.sourceforge.jp/view?p=coroid%2Finqubus.git;a=blobdiff_plain;f=frontend%2Fsrc%2Fsaccubus%2FMainFrame.java;h=9d8fce0f7fa8af8439b944d71a7c7d141969d32c;hp=68a06dc8af3f790ad27585db118ccbd69fa3488c;hb=4ce1ef3e72f1ee825cdff5b5092a9e41f0d7c1b2;hpb=107d0da4f0990c4ed751b8a1437ad2535888bb38 diff --git a/frontend/src/saccubus/MainFrame.java b/frontend/src/saccubus/MainFrame.java index 68a06dc..9d8fce0 100644 --- a/frontend/src/saccubus/MainFrame.java +++ b/frontend/src/saccubus/MainFrame.java @@ -18,8 +18,11 @@ import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; +import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; @@ -35,8 +38,10 @@ import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.JTabbedPane; import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.SwingUtilities; import nicobrowser.entity.NicoContent; +import nicobrowser.main.Main; import org.apache.commons.lang.StringUtils; import saccubus.ConvertStopFlag.State; import saccubus.converter.profile.FfmpegOption; @@ -56,31 +61,32 @@ import yukihane.nicovideo.NicoDBFinder; /** *

- * ƒ^ƒCƒgƒ‹: ‚³‚«‚ã‚΂· + * タイトル: さきゅばす *

- * + * *

- * à–¾: ƒjƒRƒjƒR“®‰æ‚Ì“®‰æ‚ðƒRƒƒ“ƒg‚‚«‚Å•Û‘¶ + * 説明: ニコニコ動画の動画をコメントつきで保存 *

- * + * *

- * ’˜ìŒ : Copyright (c) 2007 PSI + * 著作権: Copyright (c) 2007 PSI *

- * + * *

- * ‰ïŽÐ–¼: + * 会社名: *

- * - * @author –¢“ü—Í + * + * @author 未入力 * @version 1.0 */ public class MainFrame extends JFrame { private static final long serialVersionUID = 2564486741331062989L; - public static final String VERSION = "1.22r NicoBrowserŠg’£ 1.4.1"; + public static final String PRODUCT_NAME = "いんきゅばす"; + public static final String VERSION = "1.7.1 (NicoBrowser" + Main.VERSION + ")"; public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource( "icon32.png")); - // TODO GUI‚ª–³‚¢‚½‚߃tƒB[ƒ‹ƒh‚É•ÛŽ. + // TODO GUIが無いためフィールドに保持. private File tempDir; JPanel contentPane; BorderLayout borderLayout1 = new BorderLayout(); @@ -90,27 +96,70 @@ public class MainFrame extends JFrame { JMenu jMenuHelp = new JMenu(); JMenuItem jMenuHelpAbout = new JMenuItem(); JLabel statusBar = new JLabel(); - JTabbedPane MainTabbedPane = new JTabbedPane(); + JTabbedPane mainTabbedPane = new JTabbedPane(); JPanel SavingInfoTabPanel = new JPanel(); JPanel FFMpegTabPanel = new JPanel(); - JPanel VideoInfoPanel = new JPanel(); - JTextField VideoID_TextField = new JTextField(); - JButton DoButton = new JButton(); - public static final String DoButtonDefString = "•ÏŠ·"; - public static final String DoButtonStopString = "’âŽ~"; - public static final String DoButtonWaitString = "‘Ò‹@"; + // メインウィンドウ + private JPanel videoInfoPanel = new JPanel(); + private JPanel opPanel = new JPanel(); + private JLabel videoIdLabel = new JLabel(); + private JTextField videoIdField = new JTextField(); + private JLabel wayBackLabel = new JLabel(); + private JTextField wayBackField = new JTextField(); + private JButton doButton = new JButton(); + public static final String DoButtonDefString = "変換"; + public static final String DoButtonStopString = "停止"; + public static final String DoButtonWaitString = "待機"; JPanel UserInfoPanel = new JPanel(); GridBagLayout gridBagLayout3 = new GridBagLayout(); - JLabel MailAddrLabel = new JLabel(); - JTextField MailAddrField = new JTextField(); - JLabel PasswordLabel = new JLabel(); - JPasswordField PasswordField = new JPasswordField(); + // ユーザ設定 + JLabel mailAddressLabel = new JLabel(); + JTextField mailAddressField = new JTextField(); + JLabel passwordLabel = new JLabel(); + JPasswordField passwordField = new JPasswordField(); GridBagLayout gridBagLayout4 = new GridBagLayout(); GridBagLayout gridBagLayout6 = new GridBagLayout(); ButtonGroup CommentSaveButtonGroup = new ButtonGroup(); ButtonGroup ConvSaveButtonGroup = new ButtonGroup(); + private class FfmpegOptionCheckBoxListener implements ActionListener{ + + @Override + public void actionPerformed(ActionEvent e) { + setFFMpegOptionCheckbox(); + } + } + private final FfmpegOptionCheckBoxListener ffmpegOptionCheckBoxListener = new FfmpegOptionCheckBoxListener(); + + private void setFFMpegOptionCheckbox() { + boolean resizable = (resizeCheckBox.isEnabled() && resizeCheckBox.isSelected()); + resizeWidthField.setEnabled(resizable); + resizeHeigitField.setEnabled(resizable); + adjustRatioCheckBox.setEnabled(resizable); + + } + + private void setNames() { + mainTabbedPane.setName("mainTabbedPane"); + + mailAddressField.setName("mailAddressField"); + passwordField.setName("passwordField"); + + ffmpegPathField.setName("ffmpegPathField"); + vhookPathField.setName("vhookPathField"); + + mainOptionField.setName("mainOptionField"); + inputOptionField.setName("inputOptionField"); + outputOptionField.setName("outputOptionField"); + + fontPathField.setName("fontPathField"); + fontIndexField.setName("fontIndexField"); + showConvVideoCheckBox.setName("showConvVideoCheckBox"); + } + public MainFrame() { + setNames(); + videoSaveInfoPanel = savePanel.getVideoSaveInfoPanel(); try { @@ -126,12 +175,60 @@ public class MainFrame extends JFrame { } } + private void initVideoInfoPanel() { + + videoIdLabel.setText("URL/ID"); + wayBackLabel.setText("過去ログ"); + videoIdField.setText("http://www.nicovideo.jp/watch/"); + + final GroupLayout oppLayout = new GroupLayout(opPanel); + opPanel.setLayout(oppLayout); + + oppLayout.setHorizontalGroup(oppLayout.createSequentialGroup() + .addGroup(oppLayout.createParallelGroup() + .addComponent(videoIdLabel) + .addComponent(wayBackLabel)) + .addGroup(oppLayout.createParallelGroup() + .addComponent(videoIdField) + .addGroup(oppLayout.createSequentialGroup() + .addComponent(wayBackField))) + ); + + oppLayout.setVerticalGroup(oppLayout.createSequentialGroup() + .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(videoIdLabel) + .addComponent(videoIdField)) + .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(wayBackLabel) + .addComponent(wayBackField)) + ); + + doButton.setText(DoButtonDefString); + doButton.addActionListener(new MainFrame_DoButton_actionAdapter(this)); + + videoInfoPanel.setLayout(gridBagLayout1); + videoInfoPanel.add(opPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, + 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(0, 0, 0, 0), 0, 0)); + + final GridBagConstraints gridBagConstraints71 = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, + GridBagConstraints.CENTER, + GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 6); + gridBagConstraints71.fill = GridBagConstraints.BOTH; + gridBagConstraints71.ipady = 0; + + videoInfoPanel.add(doButton, gridBagConstraints71); + } + /** - * ƒRƒ“ƒ|[ƒlƒ“ƒg‚̏‰Šú‰»B + * コンポーネントの初期化。 * * @throws java.lang.Exception */ private void jbInit() throws Exception { + + initVideoInfoPanel(); + GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0); gridBagConstraints74.gridwidth = 2; @@ -150,41 +247,8 @@ public class MainFrame extends JFrame { gridBagConstraints72.gridwidth = 1; gridBagConstraints72.gridy = 6; ShadowKindLabel = new JLabel(); - ShadowKindLabel.setText("‰e‚ÌŽí—Þ"); + ShadowKindLabel.setText("影の種類"); ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED); - GridBagConstraints gridBagConstraints71 = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, - GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 6); - gridBagConstraints71.fill = GridBagConstraints.BOTH; - gridBagConstraints71.ipady = 0; - GridBagConstraints gridBagConstraints70 = new GridBagConstraints(); - gridBagConstraints70.fill = GridBagConstraints.HORIZONTAL; - gridBagConstraints70.gridy = 1; - gridBagConstraints70.ipadx = 0; - gridBagConstraints70.ipady = 0; - gridBagConstraints70.weightx = 1.0; - gridBagConstraints70.insets = new Insets(0, 0, 0, 0); - gridBagConstraints70.gridx = 1; - GridBagConstraints gridBagConstraints69 = new GridBagConstraints(); - gridBagConstraints69.gridx = 0; - gridBagConstraints69.ipadx = 0; - gridBagConstraints69.ipady = 0; - gridBagConstraints69.insets = new Insets(0, 5, 0, 5); - gridBagConstraints69.anchor = GridBagConstraints.WEST; - gridBagConstraints69.gridy = 1; - GridBagConstraints gridBagConstraints68 = new GridBagConstraints(); - gridBagConstraints68.fill = GridBagConstraints.BOTH; - gridBagConstraints68.gridy = 0; - gridBagConstraints68.ipady = 0; - gridBagConstraints68.weightx = 1.0; - gridBagConstraints68.insets = new Insets(0, 0, 0, 0); - gridBagConstraints68.gridx = 1; - GridBagConstraints gridBagConstraints67 = new GridBagConstraints(); - gridBagConstraints67.gridx = 0; - gridBagConstraints67.ipadx = 0; - gridBagConstraints67.ipady = 0; - gridBagConstraints67.insets = new Insets(0, 5, 0, 5); - gridBagConstraints67.anchor = GridBagConstraints.WEST; - gridBagConstraints67.gridy = 0; GridBagConstraints gridBagConstraints66 = new GridBagConstraints(); gridBagConstraints66.gridx = 0; gridBagConstraints66.insets = new Insets(0, 5, 5, 5); @@ -192,7 +256,7 @@ public class MainFrame extends JFrame { gridBagConstraints66.gridwidth = 2; gridBagConstraints66.gridy = 1; ViewCommentLabel = new JLabel(); - ViewCommentLabel.setText("•\Ž¦ƒRƒƒ“ƒg”"); + ViewCommentLabel.setText("表示コメント数"); GridBagConstraints gridBagConstraints65 = new GridBagConstraints(); gridBagConstraints65.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints65.gridy = 1; @@ -254,63 +318,10 @@ public class MainFrame extends JFrame { gridBagConstraints58.weightx = 1.0; gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints58.gridy = 0; - GridBagConstraints gridBagConstraints57 = new GridBagConstraints(); - gridBagConstraints57.fill = GridBagConstraints.BOTH; - gridBagConstraints57.gridy = 2; - gridBagConstraints57.weightx = 1.0; - gridBagConstraints57.insets = new Insets(0, 0, 5, 5); - gridBagConstraints57.gridx = 1; - GridBagConstraints gridBagConstraints56 = new GridBagConstraints(); - gridBagConstraints56.gridx = 0; - gridBagConstraints56.insets = new Insets(0, 5, 5, 5); - gridBagConstraints56.anchor = GridBagConstraints.WEST; - gridBagConstraints56.gridy = 2; - ExtOptionLabel = new JLabel(); - ExtOptionLabel.setText("o—Í“®‰æ‚ÌŠg’£Žq"); - GridBagConstraints gridBagConstraints55 = new GridBagConstraints(); - gridBagConstraints55.gridx = 0; - gridBagConstraints55.fill = GridBagConstraints.HORIZONTAL; - gridBagConstraints55.weightx = 1.0; - gridBagConstraints55.gridwidth = 2; - gridBagConstraints55.gridy = 1; - GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2, - 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, + + GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0); gridBagConstraints54.gridwidth = 3; - GridBagConstraints gridBagConstraints53 = new GridBagConstraints(1, 3, - 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, - GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0); - gridBagConstraints53.gridy = 5; - gridBagConstraints53.gridheight = 1; - gridBagConstraints53.weightx = 1.0; - gridBagConstraints53.gridwidth = 1; - GridBagConstraints gridBagConstraints52 = new GridBagConstraints(2, 2, - 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, - GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0); - gridBagConstraints52.gridy = 4; - gridBagConstraints52.gridwidth = 1; - gridBagConstraints52.weightx = 1.0; - gridBagConstraints52.gridx = 1; - GridBagConstraints gridBagConstraints51 = new GridBagConstraints(2, 1, - 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, - GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0); - gridBagConstraints51.gridy = 3; - gridBagConstraints51.gridwidth = 1; - gridBagConstraints51.weightx = 1.0; - gridBagConstraints51.gridx = 1; - GridBagConstraints gridBagConstraints50 = new GridBagConstraints(0, 3, - 1, 1, 0.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0); - gridBagConstraints50.gridy = 5; - GridBagConstraints gridBagConstraints49 = new GridBagConstraints(0, 2, - 2, 1, 0.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0); - gridBagConstraints49.gridy = 4; - gridBagConstraints49.gridwidth = 1; - GridBagConstraints gridBagConstraints48 = new GridBagConstraints(0, 1, - 1, 1, 0.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0); - gridBagConstraints48.gridy = 3; GridBagConstraints gridBagConstraints33 = new GridBagConstraints(); gridBagConstraints33.gridx = 0; @@ -346,63 +357,61 @@ public class MainFrame extends JFrame { gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints1.anchor = GridBagConstraints.NORTH; gridBagConstraints1.weighty = 1.0; + this.setIconImage(WinIcon); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); setSize(new Dimension(400, 450)); - setTitle("‚³‚«‚ã‚΂· " + VERSION); + setTitle(PRODUCT_NAME + " " + VERSION); this.addWindowListener(new MainFrame_this_windowAdapter(this)); statusBar.setText(" "); - jMenuFile.setText("ƒtƒ@ƒCƒ‹"); - jMenuFileExit.setText("I—¹"); + jMenuFile.setText("ファイル"); + jMenuFileExit.setText("終了"); jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter( this)); - jMenuHelp.setText("ƒwƒ‹ƒv"); - jMenuHelpAbout.setText("ƒo[ƒWƒ‡ƒ“î•ñ"); + jMenuHelp.setText("ヘルプ"); + jMenuHelpAbout.setText("バージョン情報"); jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter( this)); - VideoInfoPanel.setLayout(gridBagLayout1); - VideoID_TextField.setText("http://www.nicovideo.jp/watch/"); - DoButton.setText(DoButtonDefString); - DoButton.addActionListener(new MainFrame_DoButton_actionAdapter(this)); SavingInfoTabPanel.setLayout(new GridLayout()); - UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ƒ†[ƒUÝ’è")); + UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定")); UserInfoPanel.setLayout(gridBagLayout3); - MailAddrLabel.setText("ƒ[ƒ‹ƒAƒhƒŒƒX"); - PasswordLabel.setText("ƒpƒXƒ[ƒh"); + mailAddressLabel.setText("メールアドレス"); + passwordLabel.setText("パスワード"); setListenerToSavePanelButton(); FFMpegTabPanel.setLayout(gridBagLayout6); PathSettingPanel.setBorder(BorderFactory.createTitledBorder( - BorderFactory.createEtchedBorder(), "ƒvƒƒOƒ‰ƒ€‚̈ʒu‚̐ݒè")); + BorderFactory.createEtchedBorder(), "プログラムの位置の設定")); PathSettingPanel.setLayout(gridBagLayout7); FFmpegPathLabel.setText("FFmpeg"); - SettingFFmpegPathButton.setText("ŽQÆ"); + SettingFFmpegPathButton.setText("参照"); SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter( this)); - VhookPathLabel.setText("Šg’£vhookƒ‰ƒCƒuƒ‰ƒŠ"); - SettingVhookPathButton.setText("ŽQÆ"); + VhookPathLabel.setText("拡張vhookライブラリ"); + SettingVhookPathButton.setText("参照"); SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter( this)); VhookSettingPanel.setLayout(gridBagLayout8); VhookSettingPanel.setBorder(BorderFactory.createTitledBorder( - BorderFactory.createEtchedBorder(), "Šg’£vhookƒ‰ƒCƒuƒ‰ƒŠ‚̐ݒè")); + BorderFactory.createEtchedBorder(), "拡張vhookライブラリの設定")); FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder( - BorderFactory.createEtchedBorder(), "FFmpeg‚̐ݒè")); - FFmpegSettingPanel.setLayout(gridBagLayout9); - FontPathLabel.setText("ƒtƒHƒ“ƒgƒpƒX"); - SettingFontPathButton.setText("ŽQÆ"); + BorderFactory.createEtchedBorder(), "FFmpegの設定")); + FFmpegSettingPanel.setLayout(gblFFmpegSettingPanel); + FontPathLabel.setText("フォントパス"); + SettingFontPathButton.setText("参照"); SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter( this)); - ShowConvVideoCheckBox.setText("•ÏŠ·’†‚̉摜‚ð•\Ž¦‚·‚é"); - InLabel.setText("“ü—̓IƒvƒVƒ‡ƒ“"); - OutLabel.setText("o—̓IƒvƒVƒ‡ƒ“"); - MainOptionLabel.setText("ƒƒCƒ“ƒIƒvƒVƒ‡ƒ“"); - FontIndexLabel.setText("ƒtƒHƒ“ƒg”ԍ†"); - VideoID_Label.setText("URL/ID"); - WayBackLabel.setText("‰ß‹ŽƒƒO"); - OpPanel.setLayout(new GridBagLayout()); + showConvVideoCheckBox.setText("変換中の画像を表示する"); + + extOptionLabel.setText("出力動画の拡張子"); + inputOptionLabel.setText("入力オプション"); + outputOptionLabel.setText("出力オプション"); + mainOptionLabel.setText("メインオプション"); + avfilterOptionLabel.setText("avfilterオプション"); + + FontIndexLabel.setText("フォント番号"); BasicInfoTabPanel.setLayout(gridBagLayout12); jMenuBar1.add(jMenuFile); @@ -412,64 +421,124 @@ public class MainFrame extends JFrame { setJMenuBar(jMenuBar1); contentPane.add(statusBar, BorderLayout.SOUTH); - contentPane.add(MainTabbedPane, java.awt.BorderLayout.CENTER); - contentPane.add(VideoInfoPanel, java.awt.BorderLayout.NORTH); - UserInfoPanel.add(PasswordField, new GridBagConstraints(1, 1, 1, 1, + contentPane.add(mainTabbedPane, java.awt.BorderLayout.CENTER); + contentPane.add(videoInfoPanel, java.awt.BorderLayout.NORTH); + UserInfoPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); - UserInfoPanel.add(MailAddrField, new GridBagConstraints(1, 0, 1, 1, + UserInfoPanel.add(mailAddressField, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); - UserInfoPanel.add(PasswordLabel, new GridBagConstraints(0, 1, 1, 1, + UserInfoPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 0), 0, 0)); - UserInfoPanel.add(MailAddrLabel, new GridBagConstraints(0, 0, 1, 1, + UserInfoPanel.add(mailAddressLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 0), 0, 0)); - PathSettingPanel.add(FFmpegPathField, new GridBagConstraints(0, 1, 1, + PathSettingPanel.add(ffmpegPathField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0)); PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74); PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); - PathSettingPanel.add(VhookPathField, new GridBagConstraints(0, 3, 1, 1, + PathSettingPanel.add(vhookPathField, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); PathSettingPanel.add(VhookPathLabel, gridBagConstraints54); - FFmpegSettingPanel.add(CommandLineOutOptionField, gridBagConstraints53); - FFmpegSettingPanel.add(CommandLineInOptionField, gridBagConstraints52); - FFmpegSettingPanel.add(MainOptionField, gridBagConstraints51); - FFmpegSettingPanel.add(MainOptionLabel, gridBagConstraints48); - FFmpegSettingPanel.add(InLabel, gridBagConstraints49); - FFmpegSettingPanel.add(OutLabel, gridBagConstraints50); - FFmpegSettingPanel.add(getFFmpegOptionComboBoxPanel(), - gridBagConstraints55); - FFmpegSettingPanel.add(ExtOptionLabel, gridBagConstraints56); - FFmpegSettingPanel.add(getExtOptionField(), gridBagConstraints57); - VideoInfoPanel.add(DoButton, gridBagConstraints71); - VideoInfoPanel.add(OpPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, - 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(0, 0, 0, 0), 0, 0)); - OpPanel.add(VideoID_Label, gridBagConstraints67); - OpPanel.add(VideoID_TextField, gridBagConstraints68); - OpPanel.add(WayBackLabel, gridBagConstraints69); - OpPanel.add(WayBackField, gridBagConstraints70); - - MainTabbedPane.add(BasicInfoTabPanel, "Šî–{Ý’è"); - MainTabbedPane.add(SavingInfoTabPanel, "•Û‘¶Ý’è"); - MainTabbedPane.add(FFMpegTabPanel, "“®‰æÝ’è"); - MainTabbedPane.addTab("•ÏŠ·Ý’è", null, getConvertingSettingPanel(), null); + + + final GroupLayout layout = new GroupLayout(FFmpegSettingPanel); + FFmpegSettingPanel.setLayout(layout); + + layout.setHorizontalGroup(layout.createParallelGroup() + .addComponent(getFFmpegOptionComboBoxPanel()) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup() + .addComponent(extOptionLabel) + .addComponent(mainOptionLabel) + .addComponent(inputOptionLabel) + .addComponent(outputOptionLabel) + .addComponent(avfilterOptionLabel) + ) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup() + .addComponent(extOptionField) + .addComponent(mainOptionField) + .addComponent(inputOptionField) + .addComponent(outputOptionField) + .addComponent(avfilterOptionField) + ) + ) + .addGroup(layout.createParallelGroup() + .addGroup(layout.createSequentialGroup() + .addComponent(resizeCheckBox) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(resizeWidthLabel) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(resizeWidthField) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(resizeHeightLabel) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(resizeHeigitField) + ) + ) + .addGroup(layout.createSequentialGroup() + .addGap(10) + .addComponent(adjustRatioCheckBox)) + .addGroup(layout.createSequentialGroup() + .addGap(20) + ) + ); + + layout.setVerticalGroup(layout.createSequentialGroup() + .addComponent(getFFmpegOptionComboBoxPanel()) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(extOptionLabel) + .addComponent(extOptionField)) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(mainOptionLabel) + .addComponent(mainOptionField)) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(inputOptionLabel) + .addComponent(inputOptionField)) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(outputOptionLabel) + .addComponent(outputOptionField)) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(avfilterOptionLabel) + .addComponent(avfilterOptionField)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(resizeCheckBox) + .addComponent(resizeWidthLabel) + .addComponent(resizeWidthField) + .addComponent(resizeHeightLabel) + .addComponent(resizeHeigitField)) + .addComponent(adjustRatioCheckBox) + ) + ); + + resizeCheckBox.addActionListener(ffmpegOptionCheckBoxListener); + adjustRatioCheckBox.addActionListener(ffmpegOptionCheckBoxListener); + setFFMpegOptionCheckbox(); + + + + mainTabbedPane.add(BasicInfoTabPanel, "基本設定"); + mainTabbedPane.add(SavingInfoTabPanel, "保存設定"); + mainTabbedPane.add(FFMpegTabPanel, "動画設定"); + mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null); SavingInfoTabPanel.add(savePanel); BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7); BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6); VhookSettingPanel.add(FontPathLabel, gridBagConstraints59); - VhookSettingPanel.add(ShowConvVideoCheckBox, gridBagConstraints63); - VhookSettingPanel.add(FontPathField, gridBagConstraints60); - VhookSettingPanel.add(FontIndexField, gridBagConstraints62); + VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63); + VhookSettingPanel.add(fontPathField, gridBagConstraints60); + VhookSettingPanel.add(fontIndexField, gridBagConstraints62); VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61); VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64); VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14); @@ -487,7 +556,7 @@ public class MainFrame extends JFrame { } /** - * •Û‘¶Ý’èƒpƒlƒ‹“à‚̃{ƒ^ƒ“‚ɃAƒNƒVƒ‡ƒ“ƒŠƒXƒi‚ðŠ„‚è“–‚Ä‚é. + * 保存設定パネル内のボタンにアクションリスナを割り当てる. */ private void setListenerToSavePanelButton() { ActionListener al; @@ -511,12 +580,12 @@ public class MainFrame extends JFrame { } private void setPopup() { - MainOptionField.addMouseListener(new PopupRightClick( - this.MainOptionField)); - CommandLineInOptionField.addMouseListener(new PopupRightClick( - this.CommandLineInOptionField)); - CommandLineOutOptionField.addMouseListener(new PopupRightClick( - this.CommandLineOutOptionField)); + mainOptionField.addMouseListener(new PopupRightClick( + this.mainOptionField)); + inputOptionField.addMouseListener(new PopupRightClick( + this.inputOptionField)); + outputOptionField.addMouseListener(new PopupRightClick( + this.outputOptionField)); savePanel.getCommentNumField().addMouseListener(new PopupRightClick( savePanel.getCommentNumField())); @@ -537,27 +606,27 @@ public class MainFrame extends JFrame { videoSaveInfoPanel.getNibrFileField().addMouseListener( new PopupRightClick(videoSaveInfoPanel.getNibrFileField())); - FFmpegPathField.addMouseListener(new PopupRightClick( - this.FFmpegPathField)); - VhookPathField.addMouseListener(new PopupRightClick(this.VhookPathField)); - VideoID_TextField.addMouseListener(new PopupRightClick( - this.VideoID_TextField)); - ViewCommentField.addMouseListener(new PopupRightClick( - this.ViewCommentField)); - FontPathField.addMouseListener(new PopupRightClick(this.FontPathField)); - MailAddrField.addMouseListener(new PopupRightClick(this.MailAddrField)); - PasswordField.addMouseListener(new PopupRightClick(this.PasswordField)); - WayBackField.addMouseListener(new PopupRightClick(this.WayBackField)); - - ProxyTextField.addMouseListener(new PopupRightClick(this.ProxyTextField)); - ProxyPortTextField.addMouseListener(new PopupRightClick( - this.ProxyPortTextField)); - - FontIndexField.addMouseListener(new PopupRightClick(this.FontIndexField)); - - NGWordTextField.addMouseListener(new PopupRightClick( - this.NGWordTextField)); - NGIDTextField.addMouseListener(new PopupRightClick(this.NGIDTextField)); + ffmpegPathField.addMouseListener(new PopupRightClick( + this.ffmpegPathField)); + vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField)); + videoIdField.addMouseListener(new PopupRightClick( + this.videoIdField)); + viewCommentField.addMouseListener(new PopupRightClick( + this.viewCommentField)); + fontPathField.addMouseListener(new PopupRightClick(this.fontPathField)); + mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField)); + passwordField.addMouseListener(new PopupRightClick(this.passwordField)); + wayBackField.addMouseListener(new PopupRightClick(this.wayBackField)); + + proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField)); + proxyPortTextField.addMouseListener(new PopupRightClick( + this.proxyPortTextField)); + + fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField)); + + ngWordTextField.addMouseListener(new PopupRightClick( + this.ngWordTextField)); + ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField)); } private void setDropTarget() { @@ -571,40 +640,39 @@ public class MainFrame extends JFrame { addTarget(savePanel.getConvertedVideoSavedFileField(), false); addTarget(savePanel.getConvertedVideoSavedFolderField(), true); - addTarget(FFmpegPathField, false); - addTarget(VhookPathField, false); - addTarget(FontPathField, false); + addTarget(ffmpegPathField, false); + addTarget(vhookPathField, false); + addTarget(fontPathField, false); } /** - * ƒeƒLƒXƒgƒtƒB[ƒ‹ƒh‚ɑ΂µƒhƒƒbƒv‚ðs‚Á‚½ê‡‚Ƀtƒ@ƒCƒ‹‚à‚µ‚­‚̓fƒBƒŒƒNƒgƒŠ‚Ì•¶Žš—ñ‚ðÝ’è‚Å‚«‚é‚悤‚É‚·‚é. - * @param c Ý’è‘Ώۂ̃eƒLƒXƒgƒtƒB[ƒ‹ƒhƒIƒuƒWƒFƒNƒg. - * @param isDir ƒfƒBƒŒƒNƒgƒŠ‚ðÝ’è‚·‚éê‡‚Ítrue, ƒtƒ@ƒCƒ‹‚̏ꍇ‚Ífalse. - * @return ƒhƒƒbƒvƒ^[ƒQƒbƒg(—p“r–³‚µ). + * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする. + * @param c 設定対象のテキストフィールドオブジェクト. + * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse. + * @return ドロップターゲット(用途無し). */ private DropTarget addTarget(JTextField c, boolean isDir) { return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget( c, isDir), true); } private File CurrentDir = new File("."); - JPanel PathSettingPanel = new JPanel(); - JLabel FFmpegPathLabel = new JLabel(); - GridBagLayout gridBagLayout7 = new GridBagLayout(); - JTextField FFmpegPathField = new JTextField(); - JButton SettingFFmpegPathButton = new JButton(); - JLabel VhookPathLabel = new JLabel(); - JTextField VhookPathField = new JTextField(); - JButton SettingVhookPathButton = new JButton(); - JPanel VhookSettingPanel = new JPanel(); - GridBagLayout gridBagLayout8 = new GridBagLayout(); - JPanel FFmpegSettingPanel = new JPanel(); - GridBagLayout gridBagLayout9 = new GridBagLayout(); - JLabel FontPathLabel = new JLabel(); - JTextField FontPathField = new JTextField(); - JButton SettingFontPathButton = new JButton(); - JCheckBox ShowConvVideoCheckBox = new JCheckBox(); - JTextField CommandLineOutOptionField = new JTextField(); + private JPanel PathSettingPanel = new JPanel(); + private JLabel FFmpegPathLabel = new JLabel(); + private GridBagLayout gridBagLayout7 = new GridBagLayout(); + private JTextField ffmpegPathField = new JTextField(); + private JButton SettingFFmpegPathButton = new JButton(); + private JLabel VhookPathLabel = new JLabel(); + private JTextField vhookPathField = new JTextField(); + private JButton SettingVhookPathButton = new JButton(); + private JPanel VhookSettingPanel = new JPanel(); + private GridBagLayout gridBagLayout8 = new GridBagLayout(); + private JPanel FFmpegSettingPanel = new JPanel(); + private GridBagLayout gblFFmpegSettingPanel = new GridBagLayout(); + private JLabel FontPathLabel = new JLabel(); + private JTextField fontPathField = new JTextField(); + private JButton SettingFontPathButton = new JButton(); + private JCheckBox showConvVideoCheckBox = new JCheckBox(); private void showSaveDialog(String title, JTextField field, boolean isSave, boolean isDir) { @@ -621,7 +689,7 @@ public class MainFrame extends JFrame { } if (code == JFileChooser.APPROVE_OPTION) { if (isDir) { - CurrentDir = chooser.getCurrentDirectory(); + CurrentDir = chooser.getSelectedFile(); field.setText(CurrentDir.getAbsolutePath()); } else { File selected = chooser.getSelectedFile(); @@ -644,26 +712,26 @@ public class MainFrame extends JFrame { } /** - * Ý’è‚ð‰æ–Ê‚É”½‰f‚·‚é. - * @param setting ”½‰f‚·‚éÝ’è. + * 設定を画面に反映する. + * @param setting 反映する設定. */ private void setSetting(SProperties setting) { - // Šî–{Ý’è + // 基本設定 final BasicSetting basic = setting.getBasicSetting(); tempDir = basic.getTempDir(); - MailAddrField.setText(basic.getUser().getMail()); - PasswordField.setText(basic.getUser().getPassword()); - // ƒvƒƒLƒVŠÖ˜A - UseProxyCheckBox.setSelected(basic.isProxyUse()); - ProxyTextField.setText(basic.getProxyHost()); + mailAddressField.setText(basic.getUser().getMail()); + passwordField.setText(basic.getUser().getPassword()); + // プロキシ関連 + useProxyCheckBox.setSelected(basic.isProxyUse()); + proxyTextField.setText(basic.getProxyHost()); int proxy_port = basic.getProxyPort(); if (proxy_port >= 0 && proxy_port <= 65535) { - ProxyPortTextField.setText(Integer.toString(proxy_port)); + proxyPortTextField.setText(Integer.toString(proxy_port)); } else { - ProxyPortTextField.setText(""); + proxyPortTextField.setText(""); } - // •Û‘¶Ý’è - “ü—Í“®‰æ + // 保存設定 - 入力動画 final InputVideoSetting inVideo = setting.getInputVideoSetting(); JRadioButton activeButton; switch (inVideo.getProcessKind()) { @@ -688,7 +756,7 @@ public class MainFrame extends JFrame { videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName); videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath()); - // •Û‘¶Ý’è - “ü—̓Rƒƒ“ƒg + // 保存設定 - 入力コメント final InputCommentSetting inputComment = setting.getInputCommentSetting(); savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind()); savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath()); @@ -700,7 +768,7 @@ public class MainFrame extends JFrame { savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName); savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName); - // “ŠeŽÒƒRƒƒ“ƒg + // 投稿者コメント InputTcommentSetting tcom = setting.getInputTcommentSetting(); savePanel.setTcommentDownload(tcom.getProcessKind()); savePanel.setTcommentDelete(tcom.isDeleteAfterConvert()); @@ -708,7 +776,7 @@ public class MainFrame extends JFrame { savePanel.setTcommentDirectoryName(tcom.getFolder().getPath()); savePanel.setTcommentFileName(tcom.getFile().getPath()); - // •Û‘¶Ý’è - o—̓Rƒƒ“ƒg•t‚«“®‰æ + // 保存設定 - 出力コメント付き動画 final OutputVideoSetting outputVideo = setting.getOutputVideoSetting(); savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind()); savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment()); @@ -720,44 +788,53 @@ public class MainFrame extends JFrame { savePanel.getConvSaveFileRadioButton().setSelected(!convFixName); savePanel.getConvSaveFolderRadioButton().setSelected(convFixName); - // “®‰æÝ’è + // 動画設定 final MovieSetting movie = setting.getMovieSetting(); - FFmpegPathField.setText(movie.getFfmpeg().toString()); - VhookPathField.setText(movie.getVhook().toString()); - ExtOptionField.setText(movie.getFfmpegOption().getExtOption()); - MainOptionField.setText(movie.getFfmpegOption().getMainOption()); - CommandLineOutOptionField.setText(movie.getFfmpegOption().getOutOption()); - CommandLineInOptionField.setText(movie.getFfmpegOption().getInOption()); + ffmpegPathField.setText(movie.getFfmpeg().toString()); + vhookPathField.setText(movie.getVhook().toString()); + extOptionField.setText(movie.getFfmpegOption().getExtOption()); + mainOptionField.setText(movie.getFfmpegOption().getMainOption()); + inputOptionField.setText(movie.getFfmpegOption().getInOption()); + outputOptionField.setText(movie.getFfmpegOption().getOutOption()); + avfilterOptionField.setText(movie.getFfmpegOption().getAvfilterOption()); + resizeCheckBox.setSelected(movie.getFfmpegOption().isResize()); + resizeWidthField.setText(Integer.toString(movie.getFfmpegOption().getResizeWidth())); + resizeHeigitField.setText(Integer.toString(movie.getFfmpegOption().getResizeHeight())); + adjustRatioCheckBox.setSelected(movie.getFfmpegOption().isAdjustRatio()); FFmpegOptionModel.reload(movie.getOptionFile()); - // •ÏŠ·Ý’è + // 変換設定 final ConvertSetting conv = setting.getConvertSetting(); - NotUseVhookCheckBox.setSelected(conv.isVhookDisabled()); - ViewCommentField.setText(Integer.toString(conv.getMaxNumOfComment())); - FontPathField.setText(conv.getFont().toString()); - FontIndexField.setText(Integer.toString(conv.getFontIndex())); - ShadowComboBox.setSelectedIndex(conv.getShadowIndex()); - ShowConvVideoCheckBox.setSelected(conv.isShowConverting()); - FixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize()); - OpaqueCommentCheckBox.setSelected(conv.isCommentOpaque()); - NGWordTextField.setText(conv.getNgSetting().getWord()); - NGIDTextField.setText(conv.getNgSetting().getId()); + disableVhookCheckBox.setSelected(conv.isVhookDisabled()); + viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment())); + fontPathField.setText(conv.getFont().toString()); + fontIndexField.setText(Integer.toString(conv.getFontIndex())); + shadowComboBox.setSelectedIndex(conv.getShadowIndex()); + showConvVideoCheckBox.setSelected(conv.isShowConverting()); + fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize()); + opaqueCommentCheckBox.setSelected(conv.isCommentOpaque()); + ngWordTextField.setText(conv.getNgSetting().getWord()); + ngIdTextField.setText(conv.getNgSetting().getId()); } /** - * [ƒtƒ@ƒCƒ‹|I—¹] ƒAƒNƒVƒ‡ƒ“‚ªŽÀs‚³‚ê‚Ü‚µ‚½B + * [ファイル|終了] アクションが実行されました。 * * @param actionEvent * ActionEvent */ void jMenuFileExit_actionPerformed(ActionEvent actionEvent) { - SProperties setting = getSetting(); - SProperties.saveSetting(setting); + try { + SProperties setting = getSetting(); + SProperties.saveSetting(setting); + } catch (Throwable t) { + Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, "設定保存に失敗", t); + } System.exit(0); } /** - * [ƒwƒ‹ƒv|ƒo[ƒWƒ‡ƒ“î•ñ] ƒAƒNƒVƒ‡ƒ“‚ªŽÀs‚³‚ê‚Ü‚µ‚½B + * [ヘルプ|バージョン情報] アクションが実行されました。 * * @param actionEvent * ActionEvent @@ -769,39 +846,47 @@ public class MainFrame extends JFrame { dlg.setVisible(true); } - /* •ÏŠ·E•Û‘¶‚·‚é */ - Converter Converter = null; - JTextField CommandLineInOptionField = new JTextField(); - JLabel InLabel = new JLabel(); - JLabel OutLabel = new JLabel(); - JLabel MainOptionLabel = new JLabel(); - JTextField MainOptionField = new JTextField(); - JLabel FontIndexLabel = new JLabel(); - JTextField FontIndexField = new JTextField(); - JLabel VideoID_Label = new JLabel(); - JLabel WayBackLabel = new JLabel(); - JTextField WayBackField = new JTextField(); - GridBagLayout gridBagLayout10 = new GridBagLayout(); - GridBagLayout gridBagLayout11 = new GridBagLayout(); - GridBagLayout gridBagLayout1 = new GridBagLayout(); - JPanel OpPanel = new JPanel(); - GridLayout gridLayout1 = new GridLayout(); - JPanel BasicInfoTabPanel = new JPanel(); - GridBagLayout gridBagLayout12 = new GridBagLayout(); + /* 変換・保存する */ + private Converter Converter = null; + // FFmpegの設定 ここから + private final JLabel extOptionLabel = new JLabel(); + private final JTextField extOptionField = new JTextField(); + private JLabel mainOptionLabel = new JLabel(); + private JTextField mainOptionField = new JTextField(); + private JLabel inputOptionLabel = new JLabel(); + private JTextField inputOptionField = new JTextField(); + private JLabel outputOptionLabel = new JLabel(); + private JTextField outputOptionField = new JTextField(); + private final JLabel avfilterOptionLabel = new JLabel(); + private final JTextField avfilterOptionField = new JTextField(); + private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるよう縮小(-s)"); + private final JLabel resizeWidthLabel = new JLabel("横"); + private final JTextField resizeWidthField = new NumberFormattedTextField(); + private final JLabel resizeHeightLabel = new JLabel("縦"); + private final JTextField resizeHeigitField = new NumberFormattedTextField(); + private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持"); + // FFmpegの設定 ここまで + private JLabel FontIndexLabel = new JLabel(); + private JTextField fontIndexField = new JTextField(); + private GridBagLayout gridBagLayout1 = new GridBagLayout(); + private JPanel BasicInfoTabPanel = new JPanel(); + private GridBagLayout gridBagLayout12 = new GridBagLayout(); private JPanel ConvertingSettingPanel = null; private JPanel NGWordSettingPanel = null; - private JLabel NGWordLavel = null; - private JTextField NGWordTextField = null; + private JLabel NGWordLabel = null; + private JTextField ngWordTextField = null; private JLabel NGIDLabel = null; - private JTextField NGIDTextField = null; + private JTextField ngIdTextField = null; + // プロキシ設定 private JPanel ProxyInfoPanel = null; - private JLabel ProxyLabel = null; - private JTextField ProxyTextField = null; - private JLabel ProxyPortLabel = null; - private JTextField ProxyPortTextField = null; - private JCheckBox UseProxyCheckBox = null; - private JCheckBox FixFontSizeCheckBox = null; - private JCheckBox OpaqueCommentCheckBox = null; + private JCheckBox useProxyCheckBox = null; + private JLabel proxyLabel = null; + private JTextField proxyTextField = null; + private JLabel proxyPortLabel = null; + private JTextField proxyPortTextField = null; + // + private JCheckBox fixFontSizeCheckBox = null; + private JCheckBox opaqueCommentCheckBox = null; private final SavePanel savePanel = new SavePanel(); private final VideoSaveInfoPanel videoSaveInfoPanel; private JComboBox FFmpegOptionComboBox = null; @@ -815,14 +900,14 @@ public class MainFrame extends JFrame { } catch (Exception ex) { String text = ex.getMessage(); if (StringUtils.isEmpty(text)) { - text = "—\Šú‚µ‚È‚¢ƒGƒ‰[‚Ì‚½‚ß’†’f‚µ‚Ü‚µ‚½B"; + text = "予期しないエラーのため中断しました。"; } ex.printStackTrace(); statusBar.setText(text); } - } else { /* ŠJŽn‚µ‚Ä‚¢‚é‚̂ŁAƒXƒgƒbƒv‚·‚éB */ + } else { /* 開始しているので、ストップする。 */ final ConvertStopFlag flag = Converter.getStopFlag(); - if (!flag.needStop()) { /* ‚Ü‚¾ƒXƒgƒbƒv‚µ‚Ä‚¢‚È‚¢B */ + if (!flag.needStop()) { /* まだストップしていない。 */ flag.requestStop(); } } @@ -831,7 +916,7 @@ public class MainFrame extends JFrame { private void executeConvert() throws IOException { String url; - // NicoBrowserƒtƒ@ƒCƒ‹‚ð—˜—p‚·‚éê‡‚́Aƒtƒ@ƒCƒ‹–¼‚©‚çƒrƒfƒIID‚ð“Á’è. + // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定. if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) { try { String fileName = videoSaveInfoPanel.getNibrFileField().getText(); @@ -843,11 +928,11 @@ public class MainFrame extends JFrame { url = ""; } } catch (Exception ex) { - JOptionPane.showMessageDialog(this, ex.getMessage(), "ƒGƒ‰[", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE); return; } } else { - url = VideoID_TextField.getText(); + url = videoIdField.getText(); } TextProgressListener sl = new TextProgressListener() { @@ -870,34 +955,34 @@ public class MainFrame extends JFrame { public void run() { switch (s) { case STOPPING: - DoButton.setText(DoButtonWaitString); + doButton.setText(DoButtonWaitString); break; case FINISHED: - DoButton.setText(DoButtonDefString); + doButton.setText(DoButtonDefString); } } }); } }; - Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl, + Converter = new Converter(url, wayBackField.getText(), getSetting().toProfile(), sl, new ConvertStopFlag(scl)); - DoButton.setText(DoButtonStopString); + doButton.setText(DoButtonStopString); new Thread(Converter).start(); } - /* FFmpeg‚ւ̃pƒX */ + /* FFmpegへのパス */ public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) { - showSaveDialog("FFmpeg‚ւ̃pƒX", FFmpegPathField, false, false); + showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false); } public void SettingVhookPathButton_actionPerformed(ActionEvent e) { - showSaveDialog("Šg’£vhookƒ‰ƒCƒuƒ‰ƒŠ‚ւ̃pƒX", VhookPathField, false, false); + showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false); } public void SettingFontPathButton_actionPerformed(ActionEvent e) { - showSaveDialog("ƒtƒHƒ“ƒg‚ւ̃pƒX", FontPathField, false, false); + showSaveDialog("フォントへのパス", fontPathField, false, false); } public void this_windowClosing(WindowEvent e) { @@ -965,13 +1050,13 @@ public class MainFrame extends JFrame { gridBagConstraints2.gridx = 0; gridBagConstraints2.insets = new Insets(0, 5, 5, 0); gridBagConstraints2.gridy = 0; - NGWordLavel = new JLabel(); - NGWordLavel.setText("NGƒ[ƒh"); + NGWordLabel = new JLabel(); + NGWordLabel.setText("NGワード"); NGWordSettingPanel = new JPanel(); NGWordSettingPanel.setLayout(new GridBagLayout()); NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null, - "NGƒ[ƒhEIDÝ’è")); - NGWordSettingPanel.add(NGWordLavel, gridBagConstraints2); + "NGワード・ID設定(半角スペース区切りで複数入力)")); + NGWordSettingPanel.add(NGWordLabel, gridBagConstraints2); NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3); NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4); NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5); @@ -985,10 +1070,11 @@ public class MainFrame extends JFrame { * @return javax.swing.JTextField */ private JTextField getNGWordTextField() { - if (NGWordTextField == null) { - NGWordTextField = new JTextField(); + if (ngWordTextField == null) { + ngWordTextField = new JTextField(); + ngWordTextField.setName("ngWordTextField"); } - return NGWordTextField; + return ngWordTextField; } /** @@ -997,10 +1083,11 @@ public class MainFrame extends JFrame { * @return javax.swing.JTextField */ private JTextField getNGIDTextField() { - if (NGIDTextField == null) { - NGIDTextField = new JTextField(); + if (ngIdTextField == null) { + ngIdTextField = new JTextField(); + ngIdTextField.setName("ngIdTextField"); } - return NGIDTextField; + return ngIdTextField; } /** @@ -1027,8 +1114,8 @@ public class MainFrame extends JFrame { gridBagConstraints10.gridx = 0; gridBagConstraints10.insets = new Insets(5, 5, 5, 5); gridBagConstraints10.gridy = 2; - ProxyPortLabel = new JLabel(); - ProxyPortLabel.setText("ƒ|[ƒg”ԍ†"); + proxyPortLabel = new JLabel(); + proxyPortLabel.setText("ポート番号"); GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.fill = GridBagConstraints.BOTH; gridBagConstraints9.gridy = 1; @@ -1041,15 +1128,15 @@ public class MainFrame extends JFrame { gridBagConstraints8.fill = GridBagConstraints.NONE; gridBagConstraints8.anchor = GridBagConstraints.EAST; gridBagConstraints8.gridy = 1; - ProxyLabel = new JLabel(); - ProxyLabel.setText("ƒvƒƒLƒV"); + proxyLabel = new JLabel(); + proxyLabel.setText("プロキシ"); ProxyInfoPanel = new JPanel(); ProxyInfoPanel.setLayout(new GridBagLayout()); ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null, - "ƒvƒƒLƒVÝ’è")); - ProxyInfoPanel.add(ProxyLabel, gridBagConstraints8); + "プロキシ設定")); + ProxyInfoPanel.add(proxyLabel, gridBagConstraints8); ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9); - ProxyInfoPanel.add(ProxyPortLabel, gridBagConstraints10); + ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10); ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12); ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13); } @@ -1062,10 +1149,11 @@ public class MainFrame extends JFrame { * @return javax.swing.JTextField */ private JTextField getProxyTextField() { - if (ProxyTextField == null) { - ProxyTextField = new JTextField(); + if (proxyTextField == null) { + proxyTextField = new JTextField(); + proxyTextField.setName("proxyTextField"); } - return ProxyTextField; + return proxyTextField; } /** @@ -1074,10 +1162,11 @@ public class MainFrame extends JFrame { * @return javax.swing.JTextField */ private JTextField getProxyPortTextField() { - if (ProxyPortTextField == null) { - ProxyPortTextField = new JTextField(); + if (proxyPortTextField == null) { + proxyPortTextField = new JTextField(); + proxyPortTextField.setName("proxyPortTextField"); } - return ProxyPortTextField; + return proxyPortTextField; } /** @@ -1086,11 +1175,12 @@ public class MainFrame extends JFrame { * @return javax.swing.JCheckBox */ private JCheckBox getUseProxyCheckBox() { - if (UseProxyCheckBox == null) { - UseProxyCheckBox = new JCheckBox(); - UseProxyCheckBox.setText("ƒvƒƒLƒV‚ðŽg‚¤"); + if (useProxyCheckBox == null) { + useProxyCheckBox = new JCheckBox(); + useProxyCheckBox.setText("プロキシを使う"); + useProxyCheckBox.setName("useProxyCheckBox"); } - return UseProxyCheckBox; + return useProxyCheckBox; } /** @@ -1099,11 +1189,12 @@ public class MainFrame extends JFrame { * @return javax.swing.JCheckBox */ private JCheckBox getFixFontSizeCheckBox() { - if (FixFontSizeCheckBox == null) { - FixFontSizeCheckBox = new JCheckBox(); - FixFontSizeCheckBox.setText("ƒtƒHƒ“ƒgƒTƒCƒY‚ð‰æ–Ê‚É‚ ‚킹‚ÄŽ©“®’²®‚·‚é"); + if (fixFontSizeCheckBox == null) { + fixFontSizeCheckBox = new JCheckBox(); + fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する"); + fixFontSizeCheckBox.setName("fixFontSizeCheckBox"); } - return FixFontSizeCheckBox; + return fixFontSizeCheckBox; } /** @@ -1112,11 +1203,12 @@ public class MainFrame extends JFrame { * @return javax.swing.JCheckBox */ private JCheckBox getOpaqueCommentCheckBox() { - if (OpaqueCommentCheckBox == null) { - OpaqueCommentCheckBox = new JCheckBox(); - OpaqueCommentCheckBox.setText("‘S‚ẴRƒƒ“ƒg‚ð•s“§–¾‚É‚·‚é"); + if (opaqueCommentCheckBox == null) { + opaqueCommentCheckBox = new JCheckBox(); + opaqueCommentCheckBox.setText("全てのコメントを不透明にする"); + opaqueCommentCheckBox.setName("opaqueCommentCheckBox"); } - return OpaqueCommentCheckBox; + return opaqueCommentCheckBox; } /** * This method initializes FFmpegOptionComboBox @@ -1124,13 +1216,11 @@ public class MainFrame extends JFrame { * @return javax.swing.JComboBox */ private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel(); - private JLabel ExtOptionLabel = null; - private JTextField ExtOptionField = null; - private JCheckBox NotUseVhookCheckBox = null; - private JTextField ViewCommentField = null; + private JCheckBox disableVhookCheckBox = null; + private JTextField viewCommentField = null; private JLabel ViewCommentLabel = null; private JLabel ShadowKindLabel = null; - private JComboBox ShadowComboBox = null; + private JComboBox shadowComboBox = null; private JComboBox getFFmpegOptionComboBox() { if (FFmpegOptionComboBox == null) { @@ -1138,18 +1228,25 @@ public class MainFrame extends JFrame { FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - if (FFmpegOptionModel.isFile()) {// ƒtƒ@ƒCƒ‹ - ExtOptionField.setEnabled(false); - MainOptionField.setEnabled(false); - CommandLineInOptionField.setEnabled(false); - CommandLineOutOptionField.setEnabled(false); - } else {// ƒtƒ@ƒCƒ‹‚Å‚È‚¢ - ExtOptionField.setEnabled(true); - MainOptionField.setEnabled(true); - CommandLineInOptionField.setEnabled(true); - CommandLineOutOptionField.setEnabled(true); + if (FFmpegOptionModel.isFile()) {// ファイル + setFFMpegOptionEnabled(false); + } else {// ファイルでない + setFFMpegOptionEnabled(true); + setFFMpegOptionCheckbox(); } } + + private void setFFMpegOptionEnabled(boolean enable) { + extOptionField.setEnabled(enable); + mainOptionField.setEnabled(enable); + inputOptionField.setEnabled(enable); + outputOptionField.setEnabled(enable); + avfilterOptionField.setEnabled(enable); + resizeCheckBox.setEnabled(enable); + resizeWidthField.setEnabled(enable); + resizeHeigitField.setEditable(enable); + adjustRatioCheckBox.setEnabled(enable); + } }); } return FFmpegOptionComboBox; @@ -1163,7 +1260,7 @@ public class MainFrame extends JFrame { private JButton getFFmpegOptionReloadButton() { if (FFmpegOptionReloadButton == null) { FFmpegOptionReloadButton = new JButton(); - FFmpegOptionReloadButton.setText("XV"); + FFmpegOptionReloadButton.setText("更新"); FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { @@ -1204,28 +1301,17 @@ public class MainFrame extends JFrame { } /** - * This method initializes ExtOptionField - * - * @return javax.swing.JTextField - */ - private JTextField getExtOptionField() { - if (ExtOptionField == null) { - ExtOptionField = new JTextField(); - } - return ExtOptionField; - } - - /** * This method initializes NotUseVhookCheckBox * * @return javax.swing.JCheckBox */ private JCheckBox getNotUseVhookCheckBox() { - if (NotUseVhookCheckBox == null) { - NotUseVhookCheckBox = new JCheckBox(); - NotUseVhookCheckBox.setText("Šg’£vhookƒ‰ƒCƒuƒ‰ƒŠ‚𖳌ø‚É‚·‚éiƒfƒoƒbƒO—pj"); + if (disableVhookCheckBox == null) { + disableVhookCheckBox = new JCheckBox(); + disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)"); + disableVhookCheckBox.setName("disableVhookCheckBox"); } - return NotUseVhookCheckBox; + return disableVhookCheckBox; } /** @@ -1234,10 +1320,11 @@ public class MainFrame extends JFrame { * @return javax.swing.JTextField */ private JTextField getViewCommentField() { - if (ViewCommentField == null) { - ViewCommentField = new JTextField(); + if (viewCommentField == null) { + viewCommentField = new JTextField(); + viewCommentField.setName("viewCommentField"); } - return ViewCommentField; + return viewCommentField; } /** @@ -1246,24 +1333,25 @@ public class MainFrame extends JFrame { * @return javax.swing.JComboBox */ private JComboBox getShadowComboBox() { - if (ShadowComboBox == null) { - ShadowComboBox = new JComboBox(SProperties.ShadowKindArray); + if (shadowComboBox == null) { + shadowComboBox = new JComboBox(SProperties.ShadowKindArray); + shadowComboBox.setName("shadowComboBox"); } - return ShadowComboBox; + return shadowComboBox; } private BasicSetting getBasicSetting() { - String mail = MailAddrField.getText(); - String pass = String.valueOf(PasswordField.getPassword()); - boolean proxyUse = UseProxyCheckBox.isSelected(); - String proxyHost = ProxyTextField.getText(); + String mail = mailAddressField.getText(); + String pass = String.valueOf(passwordField.getPassword()); + boolean proxyUse = useProxyCheckBox.isSelected(); + String proxyHost = proxyTextField.getText(); int proxyPort; try { - proxyPort = Integer.parseInt(ProxyPortTextField.getText()); + proxyPort = Integer.parseInt(proxyPortTextField.getText()); } catch (NumberFormatException e) { proxyPort = -1; } - // TODO ì‹Æ—pƒfƒBƒŒƒNƒgƒŠ‚̐ݒèGUI–³‚µ + // TODO 作業用ディレクトリの設定GUI無し return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort); } @@ -1304,8 +1392,8 @@ public class MainFrame extends JFrame { } /** - * ‰æ–Ê“ü—Í’l‚©‚ç“ŠeŽÒƒRƒƒ“ƒgÝ’è‚ðì¬‚·‚é. - * @return ì¬‚µ‚½“ŠeŽÒƒRƒƒ“ƒgÝ’è. + * 画面入力値から投稿者コメント設定を作成する. + * @return 作成した投稿者コメント設定. */ private InputTcommentSetting getTcommentSetting() { boolean down = savePanel.isTcommentDownload(); @@ -1330,32 +1418,37 @@ public class MainFrame extends JFrame { } private MovieSetting getMovieSetting() { - String ffmpeg = FFmpegPathField.getText(); - String vhook = VhookPathField.getText(); - String ext = ExtOptionField.getText(); - String main = MainOptionField.getText(); - String in = CommandLineInOptionField.getText(); - String out = CommandLineOutOptionField.getText(); + String ffmpeg = ffmpegPathField.getText(); + String vhook = vhookPathField.getText(); + String ext = extOptionField.getText(); + String main = mainOptionField.getText(); + String in = inputOptionField.getText(); + String out = outputOptionField.getText(); + String avfilter = avfilterOptionField.getText(); + boolean resize = resizeCheckBox.isSelected(); + String width = resizeWidthField.getText(); + String height = resizeHeigitField.getText(); + boolean adjust = adjustRatioCheckBox.isSelected(); File optionFile = FFmpegOptionModel.getSelectedFile(); - FfmpegOption opt = new FfmpegOption(ext, main, in, out); + FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust); return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt); } private ConvertSetting getConvertSetting() { - boolean vhookDisabled = NotUseVhookCheckBox.isSelected(); + boolean vhookDisabled = disableVhookCheckBox.isSelected(); int maxComment = 30; try { - maxComment = Integer.parseInt(ViewCommentField.getText()); + maxComment = Integer.parseInt(viewCommentField.getText()); } catch (NumberFormatException ex) { } - File font = new File(FontPathField.getText()); - int fontIndex = Integer.parseInt(FontIndexField.getText()); - int shadowIndex = ShadowComboBox.getSelectedIndex(); - boolean showConv = ShowConvVideoCheckBox.isSelected(); - boolean adjustFont = FixFontSizeCheckBox.isSelected(); - boolean commentOpaque = OpaqueCommentCheckBox.isSelected(); - NgSetting ngSetting = new NgSetting(NGWordTextField.getText(), NGIDTextField.getText()); + File font = new File(fontPathField.getText()); + int fontIndex = Integer.parseInt(fontIndexField.getText()); + int shadowIndex = shadowComboBox.getSelectedIndex(); + boolean showConv = showConvVideoCheckBox.isSelected(); + boolean adjustFont = fixFontSizeCheckBox.isSelected(); + boolean commentOpaque = opaqueCommentCheckBox.isSelected(); + NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText()); return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont, commentOpaque, ngSetting); @@ -1372,17 +1465,17 @@ public class MainFrame extends JFrame { boolean isDir; if (source == panel.getShowSavingVideoFolderDialogButton()) { - title = "“®‰æ‚Ì•Û‘¶æ(ƒtƒHƒ‹ƒ_)"; + title = "動画の保存先(フォルダ)"; field = panel.getVideoSavedFolderField(); isSave = true; isDir = true; } else if (source == panel.getShowSavingVideoFileDialogButton()) { - title = "“®‰æ‚Ì•Û‘¶æ(ƒtƒ@ƒCƒ‹)"; + title = "動画の保存先(ファイル)"; field = panel.getVideoSavedFileField(); isSave = true; isDir = false; } else if (source == panel.getNibrFileChooserButton()) { - title = "NicoBrowserƒtƒ@ƒCƒ‹‘I‘ð"; + title = "NicoBrowserファイル選択"; field = panel.getNibrFileField(); isSave = false; isDir = false; @@ -1402,12 +1495,12 @@ public class MainFrame extends JFrame { boolean isSave; boolean isDir; if (source == savePanel.getShowSavingCommentFolderDialogButton()) { - title = "ƒRƒƒ“ƒg‚Ì•Û‘¶æ(ƒtƒHƒ‹ƒ_)"; + title = "コメントの保存先(フォルダ)"; field = savePanel.getCommentSavedFolderField(); isSave = true; isDir = true; - } else if (source == savePanel.getShowSavingCommentFolderDialogButton()) { - title = "ƒRƒƒ“ƒg‚Ì•Û‘¶æ(ƒtƒ@ƒCƒ‹)"; + } else if (source == savePanel.getShowSavingCommentFileDialogButton()) { + title = "コメントの保存先(ファイル)"; field = savePanel.getCommentSavedFileField(); isSave = true; isDir = false; @@ -1427,12 +1520,12 @@ public class MainFrame extends JFrame { boolean isSave; boolean isDir; if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) { - title = "ƒRƒƒ“ƒg•t‚«“®‰æ‚Ì•Û‘¶æ(ƒtƒHƒ‹ƒ_)"; + title = "コメント付き動画の保存先(フォルダ)"; field = savePanel.getConvertedVideoSavedFolderField(); isSave = true; isDir = true; } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) { - title = "ƒRƒƒ“ƒg•t‚«“®‰æ‚Ì•Û‘¶æ(ƒtƒ@ƒCƒ‹)"; + title = "コメント付き動画の保存先(ファイル)"; field = savePanel.getConvertedVideoSavedFileField(); isSave = true; isDir = false; @@ -1464,7 +1557,7 @@ public class MainFrame extends JFrame { private void mask(boolean b) { final VideoSaveInfoPanel panel = videoSaveInfoPanel; - VideoID_TextField.setEditable(b); + videoIdField.setEditable(b); panel.getDelVideoCheckBox().setEnabled(b); panel.getSaveFolderRadioButton().setEnabled(b);