Author: jerome
Date: 2009-01-27 10:33:12 +0100 (Tue, 27 Jan 2009)
New Revision: 3533
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/Playlist/RemotePlaylist.java
Log:
Fixed : #113 ?\226?\128?\148 remote function issue just after cc startup.
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2009-01-27 08:15:35 UTC (rev 3532)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2009-01-27 09:33:12 UTC (rev 3533)
@@ -138,7 +138,8 @@
public boolean playflag = true;
public boolean fromSheduler = true;
- public boolean initialized = false;
+ public boolean initialized = false;
+ public boolean canPlayFromRemote = false;
/** CcInterface menus and popup menus **/
private JPopupMenu popupFileMenu, popupmenu1, popupmenu2, popupHelpMenu;
@@ -204,16 +205,7 @@
CcCommons.tux.event.handler.register(TuxAPIConst.ST_NAME_RADIO_STATE, this,
"onRadioConnected", "True", null);
CcCommons.tux.event.handler.register(TuxAPIConst.ST_NAME_DONGLE_PLUG, this,
"onRadioDisconnected", "False", null);
CcCommons.tux.event.handler.register(TuxAPIConst.ST_NAME_RADIO_STATE, this,
"onRadioDisconnected", "False", null);
- CcCommons.tux.server.registerEventOnConnected(this,
"onTuxServerConnected");
-
- //Register remote control functions.
- CcCommons.remoteControl = new CCRemoteActions(true, this);
- CcCommons.remoteControl.onOkRemoteButton("playFromRemote");
- CcCommons.remoteControl.onStopRemoteButton("stopFromRemote");
- CcCommons.remoteControl.setStaticStopEvent("stopFromRemote");
-
CcCommons.remoteControl.onDownRemoteButton("remoteListNextEntry");
-
CcCommons.remoteControl.onUpRemoteButton("remoteListPreviousEntry");
- CcCommons.remoteControl.onExitRemoteButton("exitCc");
+ CcCommons.tux.server.registerEventOnConnected(this,
"onTuxServerConnected");
interfaceMenusLang = new TuxLanguagesMenu();
this.helpPanels = new TuxHelpPanel();
@@ -331,9 +323,12 @@
remotePlaylist = new RemotePlaylist();
if(CcCommons.settings.haveRemoteList()){
remotePlaylist.setDatas(CcCommons.settings.getRemoteListDatas());
+ remotePlaylist.setSelected(0);
+ this.canPlayFromRemote = false;
}
remotePlaylist.addPropertyChangeListener(this);
+
alertPlaylist = new AlertPlaylist();
if(CcCommons.settings.haveAlertList())
@@ -352,17 +347,29 @@
jFrame.setLocationRelativeTo(null);
alertPlaylist.addPropertyChangeListener(this);
- CcCommons.dispatcher.addPropertyChangeListener(this);
+ CcCommons.dispatcher.addPropertyChangeListener(this);
+
+ //Initialize the remote control.
+ //Register remote control functions.
+ CcCommons.remoteControl = new CCRemoteActions(true,
this);
+
CcCommons.remoteControl.onOkRemoteButton("playFromRemote");
+
CcCommons.remoteControl.onStopRemoteButton("stopFromRemote");
+
CcCommons.remoteControl.setStaticStopEvent("stopFromRemote");
+
CcCommons.remoteControl.onDownRemoteButton("remoteListNextEntry");
+
CcCommons.remoteControl.onUpRemoteButton("remoteListPreviousEntry");
+ CcCommons.remoteControl.onExitRemoteButton("exitCc");
}
return jFrame;
}
public void remoteListNextEntry(String value, Double delay){
+ this.canPlayFromRemote = true;
if(CcCommons.type != CcConstants.TYPE_REMOTELIST)
this.showPlaylist(1);
new SThread(this, "Say", remotePlaylist.next()).start();
}
public void remoteListPreviousEntry(String value, Double delay){
+ this.canPlayFromRemote = true;
if(CcCommons.type != CcConstants.TYPE_REMOTELIST)
this.showPlaylist(1);
new SThread(this, "Say", remotePlaylist.previous()).start();
}
@@ -386,6 +393,9 @@
public void stopFromRemote(String value, Double delay){
+ if(!this.canPlayFromRemote)
+ return;
+
fileBrowser.getFramework().stopCurrentGadget();
playflag = !playflag;
CCRemoteActions.restoreContext();
@@ -397,6 +407,32 @@
public void playFromRemote(String value, Double delay){
+
+ if(!this.canPlayFromRemote)
+ {
+ this.showPlaylist(1);
+
+ if(remotePlaylist.playlist.getRowCount() > 0)
+ {
+ remotePlaylist.setSelected(0);
+ this.canPlayFromRemote = true;
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ if(CcCommons.type != CcConstants.TYPE_REMOTELIST)
+ {
+ this.showPlaylist(1);
+ }
+
+ if(!(remotePlaylist.playlist.getRowCount() > 0))
+ {
+ return;
+ }
+
playflag = !playflag;
CCRemoteActions.deleteContext();
if (!playflag) {
@@ -404,9 +440,11 @@
playB.setIcon(new
ImageIcon(CcCommons.targetClass.getResource("images/buttons/stop_down.png")));
setPlayerControlsConsistants(false);
if(remotePlaylist.getPath().endsWith(".att")){
+ System.out.println(remotePlaylist.getPath());
fileBrowser.playAttituneFromPath(remotePlaylist.getPath());
}
else{
+ System.out.println("hello, the problem is
here...");
fileBrowser.playGadget(this.currentGadget,
this.currentGadgetParameters.getValues(), "run");
}
}
@@ -2117,7 +2155,7 @@
UUID uid =
UUID.randomUUID();
config[5] = uid;
- try {//XXX
+ try {
CcCommons.settings.registerAlertConfiguration(config,
alertPlaylist.getSelectedAlertIndex());
CcCommons.settings.registerGadgetParameter(uid.toString(),
parameters.getValues(), gdg);
if(!type.equals("disable")) //then start scheduler task.
@@ -2650,9 +2688,11 @@
private class playListener extends java.awt.event.MouseAdapter{
public void mouseClicked(java.awt.event.MouseEvent e) {
- if(playB.isEnabled()){
+ if(playB.isEnabled())
+ {
playflag = !playflag;
- if (!playflag) {
+ if (!playflag)
+ {
CCRemoteActions.deleteContext();
setFrameworkBusy(true); //Set the framework busy.
playB.setIcon(new
ImageIcon(CcCommons.targetClass.getResource("images/buttons/stop_down.png")));
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/Playlist/RemotePlaylist.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/Playlist/RemotePlaylist.java
2009-01-27 08:15:35 UTC (rev 3532)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/Playlist/RemotePlaylist.java
2009-01-27 09:33:12 UTC (rev 3533)
@@ -229,10 +229,15 @@
public void setSelected(int row){
try{
if((row == -1) || (row == this.datas.length))
+ {
this.playlist.setRowSelectionInterval(0, 0);
-
+ this.valueChanged(null);
+ }
else
+ {
this.playlist.setRowSelectionInterval(row, row);
+ this.valueChanged(null);
+ }
}catch(Exception except){}
}
@@ -271,7 +276,6 @@
dat[1] = this.getPath();
dat[2] =
this.playlist.getValueAt(this.playlist.getSelectedRow(), 1);
this.firePropertyChange("Remote-Value-Changed", null,
dat);
-
this.checkForEdition();
}
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn