Added maximum duration to boot sequence config

Former-commit-id: b390e9431365ffd710e0c4f72143cc65caf55530
This commit is contained in:
T. van der Zwan 2013-12-13 09:05:25 +01:00
parent 91f09eceb0
commit 2eaae36858
4 changed files with 46 additions and 12 deletions

View File

@ -1 +1 @@
ada8097cb71b680dd6fa48cf190ff66c8814ad0b 6a841c91e85de05d2ed4dfed9955cb1c89a9bf03

View File

@ -100,6 +100,6 @@ public class LedString {
pJsonBuf.addRawValue("vscan", String.format(Locale.ENGLISH, "{ %1$cminimum%1$c : %2$.4f, %1$cmaximum%1$c : %3$.4f }", '"', led.mImageRectangle.getMinY(), led.mImageRectangle.getMaxY()), true); pJsonBuf.addRawValue("vscan", String.format(Locale.ENGLISH, "{ %1$cminimum%1$c : %2$.4f, %1$cmaximum%1$c : %3$.4f }", '"', led.mImageRectangle.getMinY(), led.mImageRectangle.getMaxY()), true);
pJsonBuf.stopObject(led.equals(leds.get(leds.size()-1))); pJsonBuf.stopObject(led.equals(leds.get(leds.size()-1)));
} }
pJsonBuf.stopArray(); pJsonBuf.stopArray(false);
} }
} }

View File

@ -9,7 +9,11 @@ import javax.swing.GroupLayout;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
@ -30,6 +34,8 @@ public class EffectEnginePanel extends JPanel {
private JCheckBox mBootSequenceCheck; private JCheckBox mBootSequenceCheck;
private JLabel mBootSequenceLabel; private JLabel mBootSequenceLabel;
private JTextField mBootSequenceField; private JTextField mBootSequenceField;
private JLabel mBootSequenceLengthLabel;
private JSpinner mBootSequenceLengthSpinner;
public EffectEnginePanel(final MiscConfig pMiscConfig) { public EffectEnginePanel(final MiscConfig pMiscConfig) {
super(); super();
@ -125,6 +131,22 @@ public class EffectEnginePanel extends JPanel {
}); });
mBootSequencePanel.add(mBootSequenceField); mBootSequencePanel.add(mBootSequenceField);
mBootSequenceLengthLabel = new JLabel("Length[ms]: ");
mBootSequenceLengthLabel.setMinimumSize(new Dimension(75, 10));
mBootSequenceLengthLabel.setEnabled(mMiscConfig.mBootSequenceEnabled);
mBootSequencePanel.add(mBootSequenceLengthLabel);
mBootSequenceLengthSpinner = new JSpinner(new SpinnerNumberModel(mMiscConfig.mBootSequenceLength_ms, 100, 1500000, 500));
mBootSequenceLengthSpinner.setMaximumSize(new Dimension(1024, 20));
mBootSequenceLengthSpinner.setEnabled(mMiscConfig.mBootSequenceEnabled);
mBootSequenceLengthSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
mMiscConfig.mBootSequenceLength_ms = (Integer)mBootSequenceLengthSpinner.getValue();
}
});
mBootSequencePanel.add(mBootSequenceLengthSpinner);
GroupLayout layout = new GroupLayout(mBootSequencePanel); GroupLayout layout = new GroupLayout(mBootSequencePanel);
mBootSequencePanel.setLayout(layout); mBootSequencePanel.setLayout(layout);
@ -133,14 +155,20 @@ public class EffectEnginePanel extends JPanel {
.addGroup(layout.createParallelGroup() .addGroup(layout.createParallelGroup()
.addComponent(mBootSequenceLabel) .addComponent(mBootSequenceLabel)
.addComponent(mBootSequenceField)) .addComponent(mBootSequenceField))
.addGroup(layout.createParallelGroup()
.addComponent(mBootSequenceLengthLabel)
.addComponent(mBootSequenceLengthSpinner))
); );
layout.setHorizontalGroup(layout.createParallelGroup() layout.setHorizontalGroup(layout.createSequentialGroup()
.addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup()
.addComponent(mBootSequenceCheck)
.addComponent(mBootSequenceLabel) .addComponent(mBootSequenceLabel)
.addComponent(mBootSequenceField)) .addComponent(mBootSequenceLengthLabel))
.addComponent(mBootSequenceCheck)); .addGroup(layout.createParallelGroup()
.addComponent(mBootSequenceCheck)
.addComponent(mBootSequenceField)
.addComponent(mBootSequenceLengthSpinner)));
} }
return mBootSequencePanel; return mBootSequencePanel;
} }

View File

@ -14,6 +14,8 @@ public class MiscConfig {
public boolean mBootSequenceEnabled = true; public boolean mBootSequenceEnabled = true;
/** The effect selected for the boot sequence */ /** The effect selected for the boot sequence */
public String mBootSequenceEffect = "Rainbow swirl fast"; public String mBootSequenceEffect = "Rainbow swirl fast";
/** The (maximum) length of the boot-sequence */
public int mBootSequenceLength_ms = 3000;
/** Flag indicating that the Frame Grabber is enabled */ /** Flag indicating that the Frame Grabber is enabled */
public boolean mFrameGrabberEnabled = true; public boolean mFrameGrabberEnabled = true;
@ -68,12 +70,16 @@ public class MiscConfig {
for (String effectPath : effectPaths) { for (String effectPath : effectPaths) {
strBuf.addArrayElement(effectPath, effectPath == effectPaths[effectPaths.length-1]); strBuf.addArrayElement(effectPath, effectPath == effectPaths[effectPaths.length-1]);
} }
strBuf.stopArray(!mBootSequenceEnabled); strBuf.stopArray(true);
strBuf.toggleComment(!mBootSequenceEnabled);
strBuf.addValue("bootsequence", mBootSequenceEffect, true);
strBuf.toggleComment(false);
strBuf.stopObject(); strBuf.stopObject();
strBuf.toggleComment(!mBootSequenceEnabled);
strBuf.startObject("Bootsequence");
strBuf.addValue("effect", mBootSequenceEffect, false);
strBuf.addValue("duration_ms", mBootSequenceLength_ms, true);
strBuf.stopObject();
strBuf.toggleComment(false);
strBuf.newLine(); strBuf.newLine();
String grabComment = String grabComment =