[Slim-Checkins] r12592 - in /trunk/server/HTML/Maestro: html/main.js status_header.html

mherger at svn.slimdevices.com mherger at svn.slimdevices.com
Fri Aug 17 09:37:32 PDT 2007


Author: mherger
Date: Fri Aug 17 09:37:31 2007
New Revision: 12592

URL: http://svn.slimdevices.com?rev=12592&view=rev
Log:
Bug: n/a
Description: press and hold the volume buttons to increas gradually - to be refined

Modified:
    trunk/server/HTML/Maestro/html/main.js
    trunk/server/HTML/Maestro/status_header.html

Modified: trunk/server/HTML/Maestro/html/main.js
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/html/main.js?rev=12592&r1=12591&r2=12592&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/html/main.js (original)
+++ trunk/server/HTML/Maestro/html/main.js Fri Aug 17 09:37:31 2007
@@ -55,6 +55,7 @@
 	var pollTimer;
 	var playTimeTimer;
 	var playTime = 0;
+	var volumeClicked = 0;
 
 	var playerStatus = {
 		power: null,
@@ -69,6 +70,56 @@
 			Ext.Ajax.method = 'POST';
 			Ext.Ajax.url = '/jsonrpc.js'; 
 			Ext.Ajax.timeout = 4000;
+
+			volumeUp = new Ext.util.ClickRepeater('ctrlVolumeUp', {
+				accelerate: true
+			});
+
+			// volume buttons can be held
+			volumeUp.on({
+				'click': {
+					fn: function(){
+						volumeClicked++;
+						if (volumeClicked > 4) {
+							this.setVolume(volumeClicked, '+');
+							volumeClicked = 0;
+						}
+					},
+					scope: this
+				},
+				'mouseup': {
+					fn: function(){
+						this.setVolume(volumeClicked, '+');
+						volumeClicked = 0;
+					},
+					scope: this
+				}
+			});
+
+			volumeDown = new Ext.util.ClickRepeater('ctrlVolumeDown', {
+				accelerate: true
+			});
+			
+			volumeDown.on({
+				'click': {
+					fn: function(){
+						volumeClicked++;
+						if (volumeClicked > 4) {
+							this.setVolume(volumeClicked, '-');
+							volumeClicked = 0;
+						}
+					},
+					scope: this
+				},
+				'mouseup': {
+					fn: function(){
+						this.setVolume(volumeClicked, '-');
+						volumeClicked = 0;
+					},
+					scope: this
+				}
+			});
+
 
 // TODO: set volume when clicking on volume bar - broken in FF&Safari, getting negative values :-(
 /*			Ext.get('ctrlVolume').on('click', function(ev, target){
@@ -271,7 +322,13 @@
 		},
 
 		// values could be adjusted if not enough
-		volumeUp : function(){ this.playerControl(['mixer', 'volume', '+2.5']) },
-		volumeDown : function(){ this.playerControl(['mixer', 'volume', '-2.5']) }
+		volumeUp : function(){ this.setVolume(1, '+') },
+		volumeDown : function(){ this.setVolume(1, '-') },
+		setVolume : function(amount, d){
+			amount *= 2.5;
+			if (d)
+				amount = d + amount;
+			this.playerControl(['mixer', 'volume', amount]);
+		}
 	}
 }();

Modified: trunk/server/HTML/Maestro/status_header.html
URL: http://svn.slimdevices.com/trunk/server/HTML/Maestro/status_header.html?rev=12592&r1=12591&r2=12592&view=diff
==============================================================================
--- trunk/server/HTML/Maestro/status_header.html (original)
+++ trunk/server/HTML/Maestro/status_header.html Fri Aug 17 09:37:31 2007
@@ -54,15 +54,15 @@
 					<td align="right">
 						<table border="0" cellspacing="0" cellpadding="0">
 							<tr>
-								<td onclick="Player.volumeDown();"><img src="[% webroot %]html/images/btn_volume_low_normal.png" alt="" height="22" width="22" border="0" /></td>
+								<td id="ctrlVolumeDown"><img src="[% webroot %]html/images/btn_volume_low_normal.png" alt="" height="22" width="22" border="0" /></td>
 								<td><img src="[% webroot %]html/images/spacer.gif" alt="" height="10" width="5" border="0" /></td>
 								<td id="ctrlVolume"><img src="[% webroot %]html/images/level_5.png" alt="" height="22" width="57" border="0" /></td>
 								<td><img src="[% webroot %]html/images/spacer.gif" alt="" height="10" width="5" border="0" /></td>
-								<td onclick="Player.volumeUp();"><img src="[% webroot %]html/images/btn_volume_hi_normal.png" alt="" height="22" width="22" border="0" /></td>
+								<td id="ctrlVolumeUp"><img src="[% webroot %]html/images/btn_volume_hi_normal.png" alt="" height="22" width="22" border="0" /></td>
 							</tr>
 						</table>
 					</td>
-					<td align="right"><img src="[% webroot %]html/images/btn_power_normal.png" alt="" height="24" width="24" border="0" /></td>
+					<td align="right" id="ctrlPower"><img src="[% webroot %]html/images/btn_power_normal.png" alt="" height="24" width="24" border="0" /></td>
 				</tr>
 				<tr>
 					<td><img src="[% webroot %]html/images/spacer.gif" alt="" height="8" width="32" border="0" /></td>



More information about the checkins mailing list