Difference between revisions of "Camera Mod Alternate Sound Disable"

From WebOS Internals
Jump to navigation Jump to search
Line 131: Line 131:
  
 
[http://www.youtube.com/v/lRIRCdPfjxM&hl Youtube Video Example]
 
[http://www.youtube.com/v/lRIRCdPfjxM&hl Youtube Video Example]
 
 
 
 
 
= [[using-volume-buttons-to-take-a-picture|Use Volume Keys to Take a Picture]]=
 
 
As requested in [[tweak-ideas|community ideas]] section.
 

Revision as of 18:00, 29 July 2009

The Palm Pre comes shipped with a Camera application that has basic functionality, but lacks several advanced features.

Several camera modifications are now available.

Until an automated modification installer is available, the installation process takes a fairly knowledgeable user. In order to protect Palm's intellectual property, full copies of the applications source code can not be provided. Instead, the modifications are provided as diffs to the 1.0.2 firmware version of the application.

Always back up your applications before modifying them.

To make these modifications, you will need to have root access to your phone, and be familiar with the unix patch command and/or diff output.

To remove the phone shutter sound, no matter what audio setting the rest of your phone has, you must comment out the shutter sound request.

Alternate Sound Disable Make the following modification: (if anyone can find a way to disable it for a single shot it will be useful in a tracker app, I prefer audible confirmation myself. Update (Wiz1999): See the Shutter On/Off Button Mod below.)

/usr/palm/applications/com.palm.app.camera/camera-prefs-defaults.json

'SOUNDS': 'disabled',

You can also enable the GPS Accuracy meter in the upper right by making the following change:

'GPS-ACCURACY-METER': 'enabled',

Both of these require rebooting the phone to enable.

Adding the delay timer takes a little more effort, requiring you to add a new button resource, and make that button resource call a new function written that adds a timer function to call the original capture function.

For the adventurous, the full diff of the camera application modifications are here:

Preliminaries Don't forget to first make the root filesystem read/writeable (use mount -o remount,rw / OR /usr/sbin/rootfs_open)


diff -ur original/com.palm.app.camera/app/controllers/capture-assistant.js modified/com.palm.app.camera/app/controllers/capture-assistant.js
--- original/com.palm.app.camera/app/controllers/capture-assistant.js	2009-05-22 14:13:50.000000000 -0700
+++ modified/com.palm.app.camera/app/controllers/capture-assistant.js	2009-06-10 20:46:41.000000000 -0700
@@ -70,6 +70,11 @@
 			}
 		}).bind(this));
 		
+		this.controller.get('captureTimerButton').observe(Mojo.Event.tap, function(){
+			this.cameraControl.captureTimer();			
+			//this.cameraControl.capture();
+		}.bind(this));
+		
 		this.controller.get('captureButton').observe(Mojo.Event.tap, function(){
 			this.cameraControl.capture();			
 		}.bind(this));
diff -ur original/com.palm.app.camera/app/views/capture/capture-scene.html modified/com.palm.app.camera/app/views/capture/capture-scene.html
--- original/com.palm.app.camera/app/views/capture/capture-scene.html	2009-05-22 14:13:50.000000000 -0700
+++ modified/com.palm.app.camera/app/views/capture/capture-scene.html	2009-06-10 20:10:07.000000000 -0700
@@ -14,6 +14,8 @@
 		<div id="captureSpinner" class="capture-spinner" x-mojo-element="Spinner"></div>		
 		<div class="capture-button" id="captureButton">
 		</div>
+		<div class="capture-button capture-timer-button" id="captureTimerButton">
+		</div>
 		<div class="flash-button flash-off" id="flashButtonState">
 		</div>
 	</div>
Only in modified/com.palm.app.camera/images: menu-capture-timer.png
diff -ur original/com.palm.app.camera/javascripts/camera-control.js modified/com.palm.app.camera/javascripts/camera-control.js
--- original/com.palm.app.camera/javascripts/camera-control.js	2009-06-11 16:38:43.000000000 -0700
+++ modified/com.palm.app.camera/javascripts/camera-control.js	2009-06-11 16:55:32.000000000 -0700
@@ -23,6 +23,16 @@
 	},
 
 	/**
+	 * Perform capture with timer delay
+	 *
+	 * @return   Returns true if the capture started successfully.
+	 */
+	captureTimer: function(){
+		this.scene.controller.window.setTimeout( function(){ this.capture(); }.bind(this), 2500 );
+	},
+
+
+	/**
 	 * Perform still capture.
 	 * 
 	 * @return   Returns true if the capture started successfully.
@@ -746,7 +756,8 @@
 			else if (Camera.Event.CAPTURESTART == event.type){
 				// play the shutter sound.
 				if ('disabled' != this.prefs[CameraControl.PREFS.SOUNDS]){
-					SystemSoundsService.play(SystemSoundsService.SHUTTER_SOUND, this.scene.controller);
+					//Do not ever play the sound!  -scm6079
+					//SystemSoundsService.play(SystemSoundsService.SHUTTER_SOUND, this.scene.controller);
 				}	
 
 				CameraControl.removeEventListenerWrapper(cam, Camera.Event.CAPTURESTART, cb, false, session);
diff -ur original/com.palm.app.camera/stylesheets/camera.css modified/com.palm.app.camera/stylesheets/camera.css
--- original/com.palm.app.camera/stylesheets/camera.css	2009-05-22 14:13:50.000000000 -0700
+++ modified/com.palm.app.camera/stylesheets/camera.css	2009-06-10 20:46:03.000000000 -0700
@@ -46,12 +46,19 @@
 		background: url(../images/menu-bezel.png) center center no-repeat;
 }
 
+.capture-timer-button {
+		background: url(../images/menu-capture-timer.png) top left no-repeat;
+		left: 155px;
+}
 .capture-button {
 		width: 80px;
 		height: 80px;
 		background: url(../images/menu-capture.png) top left no-repeat;
 		position: absolute;
-		left: 120px;
+		left: 85px;
 }
 

Additionally, a new file, menu-capture-timer.png, must be created in the images sub folder. You may simply copy the existing menu-capture.png to menu-capture-timer.png to have the code function. Optionally, you may modify the file in Photoshop or your favorite png image editor to change the icons for the self-timer function.

To modify the time that the self timer waits, find the line:

this.scene.controller.window.setTimeout( function(){ this.capture(); }.bind(this), 2500 );

and modify the last parameter (2500). The current value is 2.5 seconds.

You may view a preview of the camera application after these modification here:

Youtube Video Example