Verder gewerkt aan VLC speler, werkt nog steeds niet. Soms worden acties meerder malen achter elkaar uitgevoerd?!?!
Panel aangepast met nieuwe knoppen. Er moet nog verder gekeken worden welke sliders enz. wel en niet nodig zijn.
This commit is contained in:
@@ -52,23 +52,23 @@ public class Main extends EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initialise() throws DeviceInitialiseException {
|
public void initialise() throws DeviceInitialiseException {
|
||||||
add(new JIntellitypeDevice());
|
//add(new JIntellitypeDevice());
|
||||||
//add(new PlayerDevice());
|
//add(new PlayerDevice());
|
||||||
add(new RumblepadDevice());
|
add(new RumblepadDevice());
|
||||||
//add(new WiimoteDevice());
|
//add(new WiimoteDevice());
|
||||||
//add(new GUIDevice());
|
//add(new GUIDevice());
|
||||||
//add(new TextDevice());
|
//add(new TextDevice());
|
||||||
//add(new PanelDevice());
|
add(new PanelDevice());
|
||||||
//add(new LanTextDevice());
|
//add(new LanTextDevice());
|
||||||
//add(new Extreme3DDevice());
|
//add(new Extreme3DDevice());
|
||||||
startDevices();
|
startDevices();
|
||||||
|
|
||||||
//add(new ExampleApplication());
|
add(new ExampleApplication());
|
||||||
//add(new WMPApplication());
|
//add(new WMPApplication());
|
||||||
//add(new GomPlayerApplication());
|
//add(new GomPlayerApplication());
|
||||||
//add(new WinampApplication());
|
//add(new WinampApplication());
|
||||||
//add(new iTunesApplication());
|
//add(new iTunesApplication());
|
||||||
add(new VLCApplication());
|
//add(new VLCApplication());
|
||||||
//add(new MPCApplication());
|
//add(new MPCApplication());
|
||||||
startApplications();
|
startApplications();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class VLCApplication extends CMDApplication {
|
|||||||
protected static final int POSTION_CHANGE_RATE = 1;
|
protected static final int POSTION_CHANGE_RATE = 1;
|
||||||
protected static final int VOLUME_CHANGE_RATE = 20;
|
protected static final int VOLUME_CHANGE_RATE = 20;
|
||||||
|
|
||||||
protected static final String HOST = "192.168.1.105"; // localhost
|
protected static final String HOST = "127.0.0.1"; // localhost
|
||||||
protected static final int PORT = 8080;
|
protected static final int PORT = 8080;
|
||||||
protected Socket socket;
|
protected Socket socket;
|
||||||
PrintStream output;
|
PrintStream output;
|
||||||
@@ -43,9 +43,9 @@ public class VLCApplication extends CMDApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void command(String command) {
|
public void command(String command) {
|
||||||
String request = "GET /requests/status.xml?command=" + command + " /HTTP/1.1\r\n\n";
|
//String request = "GET /requests/status.xml?command=" + command + " /HTTP/1.1\r\n\n";
|
||||||
output.println(request);
|
output.println(request);
|
||||||
//System.out.printf("Kijk eens VLC: %s\n", request);
|
//System.out.printf("%s", request);
|
||||||
/*System.out.println(request);
|
/*System.out.println(request);
|
||||||
try {
|
try {
|
||||||
Scanner feedback = new Scanner(socket.getInputStream());
|
Scanner feedback = new Scanner(socket.getInputStream());
|
||||||
@@ -68,6 +68,9 @@ public class VLCApplication extends CMDApplication {
|
|||||||
case PLAY:
|
case PLAY:
|
||||||
command("pl_pause");
|
command("pl_pause");
|
||||||
break;
|
break;
|
||||||
|
case PAUSE:
|
||||||
|
command("pl_pause");
|
||||||
|
break;
|
||||||
case NEXT:
|
case NEXT:
|
||||||
command("pl_next");
|
command("pl_next");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -36,14 +36,16 @@ public class Panel extends JFrame implements ChangeListener, HoldButtonListener
|
|||||||
protected JSlider positionSlider;
|
protected JSlider positionSlider;
|
||||||
protected JSlider volumeSlider;
|
protected JSlider volumeSlider;
|
||||||
|
|
||||||
protected JButton previousChapterButton;
|
protected JButton previousButton;
|
||||||
protected JButton rewindButton;
|
protected JButton rewindButton;
|
||||||
protected JButton stopButton;
|
protected JButton stopButton;
|
||||||
protected JButton pauseButton;
|
protected JButton pauseButton;
|
||||||
protected JButton playButton;
|
protected JButton playButton;
|
||||||
protected JButton fastForwardButton;
|
protected JButton forwardButton;
|
||||||
protected JButton nextChapterButton;
|
protected JButton nextButton;
|
||||||
protected JButton toggleMuteButton;
|
protected JButton volumeDownButton;
|
||||||
|
protected JButton muteButton;
|
||||||
|
protected JButton volumeUpButton;
|
||||||
protected boolean setPositionValue;
|
protected boolean setPositionValue;
|
||||||
|
|
||||||
Panel(PanelButtonListener panelButtonListener) {
|
Panel(PanelButtonListener panelButtonListener) {
|
||||||
@@ -87,23 +89,25 @@ public class Panel extends JFrame implements ChangeListener, HoldButtonListener
|
|||||||
volumeSlider.setPreferredSize(new Dimension(100, 40));
|
volumeSlider.setPreferredSize(new Dimension(100, 40));
|
||||||
volumeSlider.setToolTipText("Change volume");
|
volumeSlider.setToolTipText("Change volume");
|
||||||
|
|
||||||
previousChapterButton = getButton("icons/control_start_blue.png", "Go to previous chapter");
|
previousButton = getButton("icons/previous.png", "Go to previous track");
|
||||||
rewindButton = getButton("icons/control_rewind_blue.png", "Skip back");
|
rewindButton = getButton("icons/rewind.png", "Skip backward");
|
||||||
stopButton = getButton("icons/control_stop_blue.png", "Stop");
|
stopButton = getButton("icons/stop.png", "Stop");
|
||||||
pauseButton = getButton("icons/control_pause_blue.png", "Play/pause");
|
pauseButton = getButton("icons/pause.png", "Play/pause");
|
||||||
playButton = getButton("icons/control_play_blue.png", "Play");
|
playButton = getButton("icons/play.png", "Play/pause");
|
||||||
fastForwardButton = getButton("icons/control_fastforward_blue.png", "Skip forward");
|
forwardButton = getButton("icons/forward.png", "Skip forward");
|
||||||
nextChapterButton = getButton("icons/control_end_blue.png", "Go to next chapter");
|
nextButton = getButton("icons/next.png", "Go to next track");
|
||||||
toggleMuteButton = getButton("icons/sound_mute.png", "Toggle Mute");
|
volumeDownButton = getButton("icons/volumeDown.png", "Decrease volume");
|
||||||
|
muteButton = getButton("icons/mute.png", "Toggle Mute");
|
||||||
|
volumeUpButton = getButton("icons/volumeUp.png", "Increase volume");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void layoutControls() {
|
protected void layoutControls() {
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
JPanel positionPanel = new JPanel();
|
JPanel positionPanel = new JPanel();
|
||||||
positionPanel.setLayout(new GridLayout(2, 1));
|
positionPanel.setLayout(new GridLayout(1, 1)); // was 2, 1
|
||||||
positionPanel.add(positionProgressBar);
|
//positionPanel.add(positionProgressBar);
|
||||||
positionPanel.add(positionSlider);
|
//positionPanel.add(positionSlider);
|
||||||
|
|
||||||
JPanel topPanel = new JPanel();
|
JPanel topPanel = new JPanel();
|
||||||
topPanel.setLayout(new BorderLayout(8, 0));
|
topPanel.setLayout(new BorderLayout(8, 0));
|
||||||
@@ -116,20 +120,22 @@ public class Panel extends JFrame implements ChangeListener, HoldButtonListener
|
|||||||
JPanel bottomPanel = new JPanel();
|
JPanel bottomPanel = new JPanel();
|
||||||
bottomPanel.setLayout(new FlowLayout());
|
bottomPanel.setLayout(new FlowLayout());
|
||||||
|
|
||||||
bottomPanel.add(previousChapterButton);
|
bottomPanel.add(previousButton);
|
||||||
bottomPanel.add(rewindButton);
|
bottomPanel.add(rewindButton);
|
||||||
bottomPanel.add(stopButton);
|
bottomPanel.add(stopButton);
|
||||||
bottomPanel.add(pauseButton);
|
bottomPanel.add(pauseButton);
|
||||||
bottomPanel.add(playButton);
|
bottomPanel.add(playButton);
|
||||||
bottomPanel.add(fastForwardButton);
|
bottomPanel.add(forwardButton);
|
||||||
bottomPanel.add(nextChapterButton);
|
bottomPanel.add(nextButton);
|
||||||
bottomPanel.add(volumeSlider);
|
bottomPanel.add(volumeDownButton);
|
||||||
bottomPanel.add(toggleMuteButton);
|
bottomPanel.add(muteButton);
|
||||||
|
bottomPanel.add(volumeUpButton);
|
||||||
|
//bottomPanel.add(volumeSlider);
|
||||||
|
|
||||||
add(bottomPanel, BorderLayout.SOUTH);
|
add(bottomPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
positionSlider.addChangeListener(this);
|
//positionSlider.addChangeListener(this);
|
||||||
volumeSlider.addChangeListener(this);
|
//volumeSlider.addChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Listeners */
|
/* Listeners */
|
||||||
@@ -146,8 +152,8 @@ public class Panel extends JFrame implements ChangeListener, HoldButtonListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void buttonPressed(HoldButton button) {
|
public void buttonPressed(HoldButton button) {
|
||||||
if (button.equals(previousChapterButton)) {
|
if (button.equals(previousButton)) {
|
||||||
panelButtonListener.buttonPressed(PanelButton.PREVIOUS_CHAPTER);
|
panelButtonListener.buttonPressed(PanelButton.PREVIOUS);
|
||||||
} else if (button.equals(rewindButton)) {
|
} else if (button.equals(rewindButton)) {
|
||||||
panelButtonListener.buttonPressed(PanelButton.REWIND);
|
panelButtonListener.buttonPressed(PanelButton.REWIND);
|
||||||
} else if (button.equals(stopButton)) {
|
} else if (button.equals(stopButton)) {
|
||||||
@@ -156,18 +162,22 @@ public class Panel extends JFrame implements ChangeListener, HoldButtonListener
|
|||||||
panelButtonListener.buttonPressed(PanelButton.PAUSE);
|
panelButtonListener.buttonPressed(PanelButton.PAUSE);
|
||||||
} else if (button.equals(playButton)) {
|
} else if (button.equals(playButton)) {
|
||||||
panelButtonListener.buttonPressed(PanelButton.PLAY);
|
panelButtonListener.buttonPressed(PanelButton.PLAY);
|
||||||
} else if (button.equals(fastForwardButton)) {
|
} else if (button.equals(forwardButton)) {
|
||||||
panelButtonListener.buttonPressed(PanelButton.FAST_FORWARD);
|
panelButtonListener.buttonPressed(PanelButton.FORWARD);
|
||||||
} else if (button.equals(nextChapterButton)) {
|
} else if (button.equals(nextButton)) {
|
||||||
panelButtonListener.buttonPressed(PanelButton.NEXT_CHAPTER);
|
panelButtonListener.buttonPressed(PanelButton.NEXT);
|
||||||
} else if (button.equals(toggleMuteButton)) {
|
} else if (button.equals(volumeDownButton)) {
|
||||||
panelButtonListener.buttonPressed(PanelButton.TOGGLE_MUTE);
|
panelButtonListener.buttonPressed(PanelButton.VOLUME_DOWN);
|
||||||
|
} else if (button.equals(muteButton)) {
|
||||||
|
panelButtonListener.buttonPressed(PanelButton.MUTE);
|
||||||
|
} else if (button.equals(volumeUpButton)) {
|
||||||
|
panelButtonListener.buttonPressed(PanelButton.VOLUME_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buttonReleased(HoldButton button) {
|
public void buttonReleased(HoldButton button) {
|
||||||
if (button.equals(previousChapterButton)) {
|
if (button.equals(previousButton)) {
|
||||||
panelButtonListener.buttonReleased(PanelButton.PREVIOUS_CHAPTER);
|
panelButtonListener.buttonReleased(PanelButton.PREVIOUS);
|
||||||
} else if (button.equals(rewindButton)) {
|
} else if (button.equals(rewindButton)) {
|
||||||
panelButtonListener.buttonReleased(PanelButton.REWIND);
|
panelButtonListener.buttonReleased(PanelButton.REWIND);
|
||||||
} else if (button.equals(stopButton)) {
|
} else if (button.equals(stopButton)) {
|
||||||
@@ -176,12 +186,16 @@ public class Panel extends JFrame implements ChangeListener, HoldButtonListener
|
|||||||
panelButtonListener.buttonReleased(PanelButton.PAUSE);
|
panelButtonListener.buttonReleased(PanelButton.PAUSE);
|
||||||
} else if (button.equals(playButton)) {
|
} else if (button.equals(playButton)) {
|
||||||
panelButtonListener.buttonReleased(PanelButton.PLAY);
|
panelButtonListener.buttonReleased(PanelButton.PLAY);
|
||||||
} else if (button.equals(fastForwardButton)) {
|
} else if (button.equals(forwardButton)) {
|
||||||
panelButtonListener.buttonReleased(PanelButton.FAST_FORWARD);
|
panelButtonListener.buttonReleased(PanelButton.FORWARD);
|
||||||
} else if (button.equals(nextChapterButton)) {
|
} else if (button.equals(nextButton)) {
|
||||||
panelButtonListener.buttonReleased(PanelButton.NEXT_CHAPTER);
|
panelButtonListener.buttonReleased(PanelButton.NEXT);
|
||||||
} else if (button.equals(toggleMuteButton)) {
|
} else if (button.equals(volumeDownButton)) {
|
||||||
panelButtonListener.buttonReleased(PanelButton.TOGGLE_MUTE);
|
panelButtonListener.buttonReleased(PanelButton.VOLUME_DOWN);
|
||||||
|
} else if (button.equals(muteButton)) {
|
||||||
|
panelButtonListener.buttonReleased(PanelButton.MUTE);
|
||||||
|
} else if (button.equals(volumeUpButton)) {
|
||||||
|
panelButtonListener.buttonReleased(PanelButton.VOLUME_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package pm.device.panel;
|
|||||||
import pm.Button;
|
import pm.Button;
|
||||||
|
|
||||||
public enum PanelButton implements Button {
|
public enum PanelButton implements Button {
|
||||||
PREVIOUS_CHAPTER,
|
PREVIOUS,
|
||||||
REWIND,
|
REWIND,
|
||||||
STOP,
|
STOP,
|
||||||
PAUSE,
|
PAUSE,
|
||||||
PLAY,
|
PLAY,
|
||||||
FAST_FORWARD,
|
FORWARD,
|
||||||
NEXT_CHAPTER,
|
NEXT,
|
||||||
TOGGLE_MUTE;
|
VOLUME_DOWN,
|
||||||
|
MUTE,
|
||||||
|
VOLUME_UP;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user