From ef24f48c1da708bea7db12266d037758cf85ca4d Mon Sep 17 00:00:00 2001 From: yukihane Date: Wed, 17 Aug 2011 12:52:38 +0900 Subject: [PATCH] =?utf8?q?=E5=85=A5=E5=8A=9B=E3=83=91=E3=83=8D=E3=83=AB?= =?utf8?q?=E3=81=AE=E8=B5=B7=E5=8B=95=E6=99=82=E3=81=AE=E5=88=9D=E6=9C=9F?= =?utf8?q?=E7=8A=B6=E6=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/yukihane/inqubus/conifg/Properties.java | 21 ++++++++ frontend/src/yukihane/inqubus/gui/MainFrame.form | 21 +++++--- frontend/src/yukihane/inqubus/gui/MainFrame.java | 61 +++++++++++++++++++--- 3 files changed, 90 insertions(+), 13 deletions(-) diff --git a/frontend/src/yukihane/inqubus/conifg/Properties.java b/frontend/src/yukihane/inqubus/conifg/Properties.java index 3ab532a..97924be 100644 --- a/frontend/src/yukihane/inqubus/conifg/Properties.java +++ b/frontend/src/yukihane/inqubus/conifg/Properties.java @@ -1,5 +1,6 @@ package yukihane.inqubus.conifg; +import java.io.File; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -185,4 +186,24 @@ public enum Properties implements Config { field.setAccessible(true); return (String) field.get(this); } + + public boolean getUseMovieFileLocal() { + // TODO + return false; + } + + public boolean getCommentFileLocal() { + // TODO + return false; + } + + public boolean getOutputConvert() { + // TODO + return true; + } + + public File getOutputFile() { + // TODO + return new File("out/_converted"); + } } diff --git a/frontend/src/yukihane/inqubus/gui/MainFrame.form b/frontend/src/yukihane/inqubus/gui/MainFrame.form index 7e9fff5..6649dde 100644 --- a/frontend/src/yukihane/inqubus/gui/MainFrame.form +++ b/frontend/src/yukihane/inqubus/gui/MainFrame.form @@ -228,13 +228,11 @@ - - - - - - - + + + + + @@ -267,6 +265,9 @@ + + + @@ -284,6 +285,9 @@ + + + @@ -301,6 +305,9 @@ + + + diff --git a/frontend/src/yukihane/inqubus/gui/MainFrame.java b/frontend/src/yukihane/inqubus/gui/MainFrame.java index 8ea8227..0fc7e92 100644 --- a/frontend/src/yukihane/inqubus/gui/MainFrame.java +++ b/frontend/src/yukihane/inqubus/gui/MainFrame.java @@ -7,6 +7,7 @@ package yukihane.inqubus.gui; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; +import java.awt.event.ItemEvent; import java.io.File; import java.util.Collection; import java.util.List; @@ -15,6 +16,7 @@ import java.util.regex.Pattern; import javax.swing.TransferHandler; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; +import org.apache.commons.io.FilenameUtils; import yukihane.inqubus.conifg.Properties; import yukihane.inqubus.model.Target; import yukihane.inqubus.model.TargetsTableModel; @@ -119,18 +121,33 @@ public class MainFrame extends javax.swing.JFrame { movieLabel.setText("動画"); useMovieLocalCheckBox.setText("local"); + useMovieLocalCheckBox.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + useMovieLocalCheckBoxItemStateChanged(evt); + } + }); movieFileSelectButton.setText("..."); commentLabel.setText("コメント"); useCommentLocalCheckBox.setText("local"); + useCommentLocalCheckBox.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + useCommentLocalCheckBoxItemStateChanged(evt); + } + }); commentFileSelectButton.setText("..."); outputLabel.setText("出力"); outputConvertCheckBox.setText("変換"); + outputConvertCheckBox.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + outputConvertCheckBoxItemStateChanged(evt); + } + }); outputFileSelectButton.setText("..."); @@ -187,11 +204,10 @@ public class MainFrame extends javax.swing.JFrame { .addComponent(movieFileSelectButton) .addComponent(useMovieLocalCheckBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(commentLabel) - .addComponent(commentFileField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(commentFileSelectButton)) + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(commentLabel) + .addComponent(commentFileField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(commentFileSelectButton) .addComponent(useCommentLocalCheckBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -250,6 +266,22 @@ public class MainFrame extends javax.swing.JFrame { pack(); }// //GEN-END:initComponents +private void useMovieLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useMovieLocalCheckBoxItemStateChanged + final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED); + movieFileSelectButton.setEnabled(useLocal); +}//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged + +private void useCommentLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useCommentLocalCheckBoxItemStateChanged + final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED); + commentFileSelectButton.setEnabled(useLocal); +}//GEN-LAST:event_useCommentLocalCheckBoxItemStateChanged + +private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged + final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED); + outputFileField.setEnabled(convert); + outputFileSelectButton.setEnabled(convert); +}//GEN-LAST:event_outputConvertCheckBoxItemStateChanged + /** * @param args the command line arguments */ @@ -304,7 +336,24 @@ public class MainFrame extends javax.swing.JFrame { // End of variables declaration//GEN-END:variables private void initInputPanel() { -// Properties.INSTANCE.getUseMovieFileLocal(); + idField.setText(""); + + final Properties p = Properties.INSTANCE; + + final boolean movieLocal = p.getUseMovieFileLocal(); + useMovieLocalCheckBox.setSelected(movieLocal); + movieFileSelectButton.setEnabled(movieLocal); + + final boolean commentLocal = p.getCommentFileLocal(); + useCommentLocalCheckBox.setSelected(commentLocal); + commentFileSelectButton.setEnabled(commentLocal); + + final boolean convert = p.getOutputConvert(); + outputConvertCheckBox.setSelected(convert); + outputFileField.setEnabled(convert); + outputFileField.setText(p.getOutputFile().toString()); + outputFileSelectButton.setEnabled(convert); + } private class DownloadListTransferHandler extends TransferHandler { -- 2.11.0