renames
[webos-internals:adamrmcd-modifications.git] / camera / camera-sound-toggle.patch
1 diff --git a/usr/palm/applications/com.palm.app.camera/app/controllers/capture-assistant.js b/usr/palm/applications/com.palm.app.camera/app/controllers/capture-assistant.js
2 index 2952de4..f11abf1 100644
3 --- a/usr/palm/applications/com.palm.app.camera/app/controllers/capture-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.camera/app/controllers/capture-assistant.js
5 @@ -79,6 +79,10 @@ CaptureAssistant = Class.create({
6                         this._handleFlashButton();
7                 }.bind(this));
8  
9 +               this.controller.get('shutterSoundButtonState').observe(Mojo.Event.tap, function(){
10 +                       this._handleShutterSoundButton();
11 +               }.bind(this));
12 +
13                 this.onKeyPressHandler = this.onKeyPress.bindAsEventListener(this);
14                 Mojo.listen(this.controller.sceneElement, Mojo.Event.keydown, this.onKeyPressHandler);
15                 Mojo.listen(this.controller.sceneElement, Mojo.Event.keyup, this.onKeyPressHandler);
16 @@ -140,6 +144,11 @@ CaptureAssistant = Class.create({
17                         this.setFlashState(prefFlashState);
18                 }               
19  
20 +               if (undefined === this.shutterSoundState){
21 +                       var prefShutterSoundState = this.cameraControl.prefs[CameraControl.PREFS.SOUNDS];
22 +                       this.setShutterSoundState(prefShutterSoundState);
23 +               }       
24 +
25                 try {
26                         var initialOrientation = PalmSystem.screenOrientation;
27                         this.orientationChanged(initialOrientation);
28 @@ -629,6 +638,45 @@ CaptureAssistant = Class.create({
29         },
30  
31         /**
32 +        * Click handler for the shutter sound button.
33 +        *  
34 +        * @param {Event} event  The click event
35 +        */
36 +       _handleShutterSoundButton: function(event){
37 +               if (this.shutterSoundState == 'enabled'){
38 +                       this.shutterSoundState = 'disabled';
39 +               }
40 +               else {
41 +                       this.shutterSoundState = 'enabled';
42 +               }
43 +
44 +               this.setShutterSoundState(this.shutterSoundState);
45 +       },
46 +               
47 +       setShutterSoundState: function(state){
48 +               if ((state != 'disabled') && (state != 'enabled')) {
49 +                       /*
50 +                       var elemC = this.controller.get('sagar_console');
51 +                       if (elemC) {
52 +                               elemC.innerHTML = state;
53 +                       }
54 +                       */
55 +                       llog("Requested shutter sound state is out of range ("+state+")");
56 +                       return;
57 +               }
58 +
59 +               this.shutterSoundState = state;
60 +               CameraPrefs.updatePref(this.cameraControl.prefs, CameraControl.PREFS.SOUNDS, state);
61 +       
62 +               if (this.shutterSoundState == 'enabled') {
63 +                       this.controller.get('shutterSoundButtonState').className = "shutter-sound-button shutter-sound-on";
64 +               }
65 +               else if (this.shutterSoundState == 'disabled') {
66 +                       this.controller.get('shutterSoundButtonState').className = "shutter-sound-button shutter-sound-off";
67 +               }
68 +       },
69 +
70 +       /**
71          * Handler for click of photoroll button.
72          * 
73          * The photoroll scene will be pushed on.
74 diff --git a/usr/palm/applications/com.palm.app.camera/app/views/capture/capture-scene.html b/usr/palm/applications/com.palm.app.camera/app/views/capture/capture-scene.html
75 index a586aba..e8243d2 100644
76 --- a/usr/palm/applications/com.palm.app.camera/app/views/capture/capture-scene.html
77 +++ b/usr/palm/applications/com.palm.app.camera/app/views/capture/capture-scene.html
78 @@ -14,6 +14,8 @@
79                 <div id="captureSpinner" class="capture-spinner" x-mojo-element="Spinner"></div>                
80                 <div class="capture-button" id="captureButton">
81                 </div>
82 +               <div class="shutter-sound-button shutter-sound-off" id="shutterSoundButtonState">
83 +               </div>
84                 <div class="flash-button flash-off" id="flashButtonState">
85                 </div>
86         </div>
87 @@ -23,7 +25,7 @@
88                         
89                 </div>
90         </div>
91 -       <!-- <div id="sagar_console" style="z-index: 100; position: fixed; top: 10px; left: 10px; width: 90px; height: 20px; background-color: #000000; color: #8080ff; font-family: sans-serif; font-size: 12px; display: none;" >Hello!</div> -->
92 +       <!--<div id="sagar_console" style="z-index: 100; position: fixed; top: 10px; left: 10px; width: 90px; height: 20px; background-color: #000000; color: #8080ff; font-family: sans-serif; font-size: 12px; display: none;" >Hello!</div> -->
93         <div id="gpsMeter" style="z-index: 100; position: fixed; top: 10px; right: 10px; width: 90px; height: 20px; background-color: #a0a0a0; display: none" ></div> -->
94         
95         <div id="palmScrim" class="palm-scrim" style="z-index: 1001; display: none;">
96 diff --git a/usr/palm/applications/com.palm.app.camera/stylesheets/camera.css b/usr/palm/applications/com.palm.app.camera/stylesheets/camera.css
97 index 9480ffa..f0e242d 100644
98 --- a/usr/palm/applications/com.palm.app.camera/stylesheets/camera.css
99 +++ b/usr/palm/applications/com.palm.app.camera/stylesheets/camera.css
100 @@ -119,6 +119,28 @@ body.palm-default {
101                 z-index: 20;
102  }
103  
104 +.shutter-sound-button,
105 +.shutter-sound-button.shutter-sound-off {
106 +               width: 50px;
107 +               height: 50px;
108 +               background: url(../images/menu-shutter-sound.png) 0 0 no-repeat;
109 +               position: absolute;
110 +               left: 188px;
111 +               top: 15px;
112 +}
113 +
114 +.shutter-sound-button.shutter-sound-on:active {
115 +               background-position: 0px -50px;
116 +}
117 +
118 +.shutter-sound-button.shutter-sound-on {
119 +               background-position: 0px -100px;
120 +}
121 +
122 +.shutter-sound-button.shutter-sound-on:active {
123 +               background-position: 0px -150px;
124 +}
125 +
126  /* Photo Roll */
127  
128  .photo-roll {