Rockbox

Tasklist

FS#11084 - Custom variables for WPS

Attached to Project: Rockbox
Opened by Jens Theeß (punkt) - Sunday, 07 March 2010, 18:07 GMT
Last edited by Jonathan Gordon (jdgordon) - Sunday, 27 March 2011, 08:02 GMT
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

This patch adds support for custom variables for the wps. This could be used e.g. to toggle between album art, playlist info and song info.

New tags are:
* %vd|identifier|number of states|
Defines a variable. The value is a number between 0 and number-of-states -1.
* %vg'identifier'
Displays the content of the variable, can be used as a conditional.
* New action for %T: vt'identifier'
Toggles (increases) the variable with the given identifier. If the maximum state for the variable is reached, it is reset to 0.

Currently a variable can only be changed using a touch-region.

Related forum topic: http://forums.rockbox.org/index.php?topic=23083.0

Patch for the manual will follow if there are no objections to this patch.

Attached is a theme used for testing the patch on the Cowon D2.

This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Sunday, 27 March 2011, 08:02 GMT
Reason for closing:  Accepted
Additional comments about closing:  sort of accepted in r29655
Comment by Jonathan Gordon (jdgordon) - Sunday, 07 March 2010, 21:10 GMT
interesting. for consistancy sake the tags shuold be vl and vd (variable load and variable display)
Comment by Jens Theeß (punkt) - Monday, 08 March 2010, 19:05 GMT
Renamed tags, as suggested:
* %vl|identifier|number of states|
Defines a variable. The value is a number between 0 and number-of-states -1.
* %vd'identifier'
Displays the content of the variable, can be used as a conditional.

Renamed the touch action to "vs" (for variable set).

Extended the touch action. You can optionally set the target value instead of toggling:
vs'identifier'[value]

Examples:
%vl|a|3|
%?vda<foo|bar|baz>
%T|0|0|88|20|vsa|
%T|0|0|45|20|vsa0|

Also, I moved the evaluation of the touch action from wps_get_touchaction() to gui_wps_show().
Comment by Jens Theeß (punkt) - Monday, 08 March 2010, 20:35 GMT
Replaced snprintf("%hu", ...) with snprintf("%u", ...). For some reason, %hu worked in the linux simulator.
Comment by Jens Theeß (punkt) - Friday, 12 March 2010, 21:16 GMT
Changed the touch-action, which now has the following format:
vs'identifier'<+|-|number>

+: Increases the variable (with wrap-around)
-: Decreases the variable (with wrap-around)
number: sets the variable to the given number

Examples:
%T|0|0|88|20|vsa+|
%T|0|0|88|20|vsa-|
%T|0|0|88|20|vsa2|
Comment by Jens Theeß (punkt) - Friday, 12 March 2010, 22:29 GMT
That snprintf("%hu", ...) slipped in again.
Comment by Jens Theeß (punkt) - Tuesday, 16 March 2010, 19:22 GMT
Added a description of the new tags to the manual.
I think this patch is about finished now.
Comment by Jonathan Gordon (jdgordon) - Thursday, 18 March 2010, 09:11 GMT
does this make sense for non touchscreen targets? unless we come up with a way to change the var I dont tihnk so, so the code should all be in a #ifdef (maybe #ifdef HAVE_WPS_VARIABLES ? )
Comment by Jens Theeß (punkt) - Thursday, 18 March 2010, 09:57 GMT
Ok, I'll look at it this weekend. Is a separate define necessary, or should I use HAVE_TOUCHSCREEN?
Comment by Jonathan Gordon (jdgordon) - Thursday, 18 March 2010, 10:01 GMT
a new one probbaly so it is easy enough to add button targets if they have a spare button
Comment by Jens Theeß (punkt) - Saturday, 20 March 2010, 14:40 GMT
Put the code into #ifdef HAVE_WPS_VARIABLES blocks. It is defined for all targets with HAVE_TOUCHSCREEN.
Comment by Jens Theeß (punkt) - Monday, 22 March 2010, 22:01 GMT
How about a tag %vs for setting a variable? This way, I can combine variables with %Tl, e.g. show a popup menu using a button and then close it once the %Tl timer runs out. I'll try this in the next couple of days.
Comment by Jens Theeß (punkt) - Sunday, 28 March 2010, 15:55 GMT
I played around with a new tag %vs, but %Tl and wps variables don't work well together. So I just synched the patch to r25371.

Loading...