5 new, 10 updated patches.
[webos-internals:justyns-modifications.git] / top-bar / top-bar-media-volume-in-device-menu.patch
1 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
2 index 335a73c..874d2f8 100644
3 --- a/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
4 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/devicemenu-assistant.js
5 @@ -40,12 +40,14 @@ var DevicemenuAssistant = Class.create({
6                 this.modesModel = {scrollbars: false, mode: "vertical"},
7                 this.controller.setupWidget('devicescroller', {}, this.modesModel);
8                 this.menuscroller = this.controller.get('devicescroller');
9 +               this.controller.setupWidget('mvolSlider', {minValue: 0, maxValue: 100}, this.mvolModel = { value: 50});
10                 
11                 this.drawerModel = {myOpenProperty:false};
12                 this.controller.setupWidget('wifidetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
13                 this.controller.setupWidget('btdetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
14                 this.wifidrawer = this.controller.get('wifidetails');
15                 this.btdrawer = this.controller.get('btdetails');
16 +               this.controller.setupWidget('mvoldetails', {modelProperty:'myOpenProperty'}, this.drawerModel);
17                 
18                 this.wifiListModel = {
19                         items: this.wifiAPList
20 @@ -124,6 +126,8 @@ var DevicemenuAssistant = Class.create({
21                 this.controller.get('dm_airplanemode').addEventListener(Mojo.Event.tap, this.toggleAirplaneMode.bindAsEventListener(this));
22                 this.controller.get('wifilist').addEventListener(Mojo.Event.listTap,this.handleWiFiTap.bindAsEventListener(this));
23                 this.controller.get('btlist').addEventListener(Mojo.Event.listTap,this.handleBTTap.bindAsEventListener(this));          
24 +               this.controller.get('mvolSlider').addEventListener(Mojo.Event.propertyChange, this.handleMvolSlider.bindAsEventListener(this));
25 +               this.controller.get('mvolRow').addEventListener(Mojo.Event.tap, this.handleMvolTap.bindAsEventListener(this));
26                 this.controller.get('dm_wifi').addEventListener(Mojo.Event.tap, this.togglewifiList.bindAsEventListener(this));
27                 this.controller.get('dm_bluetooth').addEventListener(Mojo.Event.tap, this.togglebluetoothList.bindAsEventListener(this));
28                 this.controller.get('wifi_radio').addEventListener(Mojo.Event.tap, this.toggleWifiRadio.bindAsEventListener(this));
29 @@ -138,6 +142,18 @@ var DevicemenuAssistant = Class.create({
30         cleanup: function() {
31                 Mojo.Log.error("Device Menu - Clean up called");                                
32         },      
33 +       
34 +       handleMvolTap: function(event) {
35 +               this.controller.get('mvoldetails').mojo.setOpenState(!this.controller.get('mvoldetails').mojo.getOpenState());
36 +       },
37 +       
38 +       handleMvolSlider: function(event) {
39 +               this.controller.serviceRequest('palm://com.palm.audio/media', {
40 +                       method: 'setVolume',
41 +                       parameters:{volume:Math.round(event.value)}
42 +               });
43 +               this.controller.get('dm_mvol').innerText = "Media Volume = " + Math.round(event.value);
44 +       },
45                         
46         wifiAPList: [],
47         btdeviceList: [],
48 @@ -1032,6 +1048,7 @@ var DevicemenuAssistant = Class.create({
49                 if(this.isVisible){
50                         this.toggleDeviceMenu();
51                 }
52 +               this.controller.get('mvoldetails').mojo.setOpenState(false);
53                 this.menuscroller.mojo.revealTop(0);
54         },
55         
56 @@ -1078,6 +1095,19 @@ var DevicemenuAssistant = Class.create({
57                                 this.btspinnerModel.spinning = true;
58                                 this.controller.modelChanged(this.btspinnerModel);
59                         }
60 +                       this.controller.serviceRequest('palm://com.palm.audio/media', {
61 +                               method: 'getVolume',
62 +                               parameters:{},
63 +                               onSuccess: function(response) {
64 +                                       if(response.volume != undefined) {
65 +                                               this.mvolModel.value = parseInt(response.volume);
66 +                                               this.controller.modelChanged(this.mvolModel);
67 +                                               this.controller.get('dm_mvol').innerText = "Media Volume = " + response.volume;
68 +                                       } else {
69 +                                               this.controller.get('dm_mvol').innerText = "Media Volume = unknown";
70 +                                       }
71 +                               }.bind(this)
72 +                       });
73                         this.controller.stageController.activate();
74                         
75                         var animateDialog = function(){
76 diff --git a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
77 index d153a8d..ab4139c 100644
78 --- a/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
79 +++ b/usr/lib/luna/system/luna-systemui/app/views/devicemenu/devicemenu-scene.html
80 @@ -26,6 +26,20 @@
81                                 </div></div> 
82                                 
83                                 <div class="palm-section-divider">
84 +                               </div> 
85 +
86 +                               <div class="palm-row first" id="mvolRow" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">
87 +                                       <div id="dm_mvol" class="title">&nbsp;
88 +                                       </div>
89 +                               </div></div>
90 +
91 +                               <div id="mvoldetails" x-mojo-element="Drawer">
92 +                                       <div class="palm-row first"><div class="palm-row-wrapper">
93 +                                               <div x-mojo-element="Slider" id="mvolSlider" style="padding-top: 30px; height: 50px;"></div>
94 +                                       </div></div>
95 +                               </div>
96 +
97 +                               <div class="palm-section-divider">
98                                 </div>               
99                                 
100                                 <div class="palm-row" id="dm_wifi" x-mojo-tap-highlight='momentary'><div class="palm-row-wrapper">