Added fields to HyperCon for the 3D and screensaver check

Former-commit-id: a84a516c9fce8a56381fcf31852573d041699c4e
This commit is contained in:
johan
2013-12-21 15:06:01 +01:00
parent f598f6e417
commit efcb8ec179
6 changed files with 268 additions and 44 deletions

View File

@@ -41,6 +41,10 @@ public class XbmcPanel extends JPanel {
private JComboBox<String> mPictureCombo;
private JLabel mAudioLabel;
private JComboBox<String> mAudioCombo;
private JLabel mScreensaverLabel;
private JComboBox<String> mScreensaverCombo;
private JLabel mEnable3DLabel;
private JComboBox<String> mEnable3DCombo;
public XbmcPanel(final MiscConfig pMiscConfig) {
super();
@@ -130,6 +134,24 @@ public class XbmcPanel extends JPanel {
mAudioCombo.addActionListener(mActionListener);
add(mAudioCombo);
mScreensaverLabel = new JLabel("Screensaver");
add(mScreensaverLabel);
mScreensaverCombo = new JComboBox<>(new String[] {"On", "Off"});
mScreensaverCombo.setSelectedItem(mMiscConfig.mScreensaverOn? "On": "Off");
mScreensaverCombo.setToolTipText("Enables('On') or disables('Off') the ambi-light when the XBMC screensaver is active");
mScreensaverCombo.addActionListener(mActionListener);
add(mScreensaverCombo);
mEnable3DLabel = new JLabel("3D checking");
add(mEnable3DLabel);
mEnable3DCombo = new JComboBox<>(new String[] {"On", "Off"});
mEnable3DCombo.setSelectedItem(mMiscConfig.m3DCheckingEnabled ? "On": "Off");
mEnable3DCombo.setToolTipText("Enables('On') or disables('Off') switching to 3D mode when a 3D video file is started");
mEnable3DCombo.addActionListener(mActionListener);
add(mEnable3DCombo);
GroupLayout layout = new GroupLayout(this);
layout.setAutoCreateGaps(true);
setLayout(layout);
@@ -143,6 +165,8 @@ public class XbmcPanel extends JPanel {
.addComponent(mVideoLabel)
.addComponent(mPictureLabel)
.addComponent(mAudioLabel)
.addComponent(mScreensaverLabel)
.addComponent(mEnable3DLabel)
)
.addGroup(layout.createParallelGroup()
.addComponent(mXbmcCheck)
@@ -152,6 +176,8 @@ public class XbmcPanel extends JPanel {
.addComponent(mVideoCombo)
.addComponent(mPictureCombo)
.addComponent(mAudioCombo)
.addComponent(mScreensaverCombo)
.addComponent(mEnable3DCombo)
));
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(mXbmcCheck)
@@ -178,6 +204,14 @@ public class XbmcPanel extends JPanel {
.addGroup(layout.createParallelGroup()
.addComponent(mAudioLabel)
.addComponent(mAudioCombo)
)
.addGroup(layout.createParallelGroup()
.addComponent(mScreensaverLabel)
.addComponent(mScreensaverCombo)
)
.addGroup(layout.createParallelGroup()
.addComponent(mEnable3DLabel)
.addComponent(mEnable3DCombo)
));
toggleEnabled(mMiscConfig.mXbmcCheckerEnabled);
@@ -198,6 +232,10 @@ public class XbmcPanel extends JPanel {
mPictureCombo.setEnabled(pEnabled);
mAudioLabel.setEnabled(pEnabled);
mAudioCombo.setEnabled(pEnabled);
mScreensaverLabel.setEnabled(pEnabled);
mScreensaverCombo.setEnabled(pEnabled);
mEnable3DLabel.setEnabled(pEnabled);
mEnable3DCombo.setEnabled(pEnabled);
}
private final ChangeListener mChangeListener = new ChangeListener() {
@@ -216,6 +254,8 @@ public class XbmcPanel extends JPanel {
mMiscConfig.mVideoOn = (mVideoCombo.getSelectedItem() == "On");
mMiscConfig.mPictureOn = (mPictureCombo.getSelectedItem() == "On");
mMiscConfig.mAudioOn = (mAudioCombo.getSelectedItem() == "On");
mMiscConfig.mScreensaverOn = (mScreensaverCombo.getSelectedItem() == "On");
mMiscConfig.m3DCheckingEnabled = (mEnable3DCombo.getSelectedItem() == "On");
toggleEnabled(mMiscConfig.mXbmcCheckerEnabled);
}

View File

@@ -40,6 +40,10 @@ public class MiscConfig {
public boolean mPictureOn = true;
/** Flag indicating that the frame-grabber is on during audio playback */
public boolean mAudioOn = true;
/** Flag indicating that the frame-grabber is on when xbmc is on screensaver */
public boolean mScreensaverOn = true;
/** Flag indicating that the frame-grabber is should take actions when a 3D file is playing */
public boolean m3DCheckingEnabled = true;
/** Flag indicating that the JSON interface is enabled */
public boolean mJsonInterfaceEnabled = true;
@@ -103,12 +107,14 @@ public class MiscConfig {
String xbmcComment =
"The configuration of the XBMC connection used to enable and disable the frame-grabber. Contains the following fields: \n" +
" * xbmcAddress : The IP address of the XBMC-host\n" +
" * xbmcTcpPort : The TCP-port of the XBMC-server\n" +
" * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback\n" +
" * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show\n" +
" * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback\n" +
" * grabMenu : Flag indicating that the frame-grabber is on(true) in the XBMC menu\n";
" * xbmcAddress : The IP address of the XBMC-host\n" +
" * xbmcTcpPort : The TCP-port of the XBMC-server\n" +
" * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback\n" +
" * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show\n" +
" * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback\n" +
" * grabMenu : Flag indicating that the frame-grabber is on(true) in the XBMC menu\n" +
" * grabScreensaver : Flag indicating that the frame-grabber is on(true) when XBMC is on screensaver\n" +
" * enable3DDetection : Flag indicating that the frame-grabber should switch to a 3D compatible modus if a 3D video is playing\n";
strBuf.writeComment(xbmcComment);
strBuf.toggleComment(!mXbmcCheckerEnabled);
@@ -118,7 +124,9 @@ public class MiscConfig {
strBuf.addValue("grabVideo", mVideoOn, false);
strBuf.addValue("grabPictures", mPictureOn, false);
strBuf.addValue("grabAudio", mAudioOn, false);
strBuf.addValue("grabMenu", mMenuOn, true);
strBuf.addValue("grabMenu", mMenuOn, false);
strBuf.addValue("grabScreensaver", mScreensaverOn, false);
strBuf.addValue("enable3DDetection", m3DCheckingEnabled, true);
strBuf.stopObject();
strBuf.toggleComment(false);