diff --git a/app/controller/sdl/Abstract/Controller.js b/app/controller/sdl/Abstract/Controller.js index 8f94cac55..8e2bb850a 100644 --- a/app/controller/sdl/Abstract/Controller.js +++ b/app/controller/sdl/Abstract/Controller.js @@ -192,18 +192,54 @@ SDL.SDLController = Em.Object.extend( openCommandsList: function() { SDL.OptionsView.activate(); }, + /** - * Notification of deactivation of current application model initiated in - * StateManager + * Function for enable\disable progress bar tracking */ - deactivateApp: function() { - if (this.model) { - SDL.SDLModel.onDeactivateApp(SDL.States.nextState, this.model.appID); + seekBarActive: function() { + if(SDL.SDLController.model === null) { + return; } + var seekBar = SDL.SDLController.model.seekBar; + SDL.SDLController.model.set('seekBarStyle', seekBar ? "progressBarWithSeek" : "progressBarWithoutSeek"); + }.observes('SDL.SDLController.model.seekBar'), + + /** + * Deactivate current application + */ + deactivateApp: function() { + SDL.SDLModel.onDeactivateApp(SDL.States.nextState, this.model.appID); SDL.SDLController.onSubMenu('top'); SDL.SDLController.model.set('tbtActivate', false); this.set('model', null); }, + + /** + * seekTracking function for a tracking progress bar + */ + seekTracking: function(event){ + if(event.type == 'change'){ + SDL.SDLController.model.set('pause', true); + var percent = event.currentTarget.value; + SDL.SDLController.model.set('valueOfSeekBar',percent); + var currentTime = 0; + if(SDL.SDLController.model.countUp){ + currentTime = parseInt((SDL.SDLController.model.endTime - SDL.SDLController.model.duration) * percent/100); + } + else { + currentTime = parseInt((SDL.SDLController.model.duration - SDL.SDLController.model.endTime) * percent/100); + } + SDL.SDLController.model.set('currTime', currentTime); + var number = SDL.SDLController.model.duration + SDL.SDLController.model.currTime; + var params = {}; + params.appID = SDL.SDLController.model.appID; + params.hrs = parseInt(number / 3600); // hours + params.min = parseInt(number / 60) % 60; // minutes + params.sec = number % 60; // seconds + FFW.UI.onSeekMediaClockTimerNotification(params); + SDL.SDLController.model.set('pause',false); + } + }, /** * Notification to SDL about triggered events on HMI * @param reason @@ -616,9 +652,6 @@ SDL.SDLController = Em.Object.extend( if (methodName == 'UI.Slider') { SDL.SliderView.deactivate(true); } - // if (SDL.VRHelpListView.active) { - // SDL.VRHelpListView.deactivate(); - // } }, /** * Method to close InteractionChoices view diff --git a/app/controller/sdl/MediaController.js b/app/controller/sdl/MediaController.js index 6fe2dfb2b..046343b1b 100644 --- a/app/controller/sdl/MediaController.js +++ b/app/controller/sdl/MediaController.js @@ -65,10 +65,7 @@ SDL.SDLMediaController = Em.Object.create( }, /** Switching on Application */ activateApp: function(applicationModel) { - - // store active application id this.set('currentAppId', applicationModel.appID); - // set active model SDL.SDLController.set('model', applicationModel); SDL.MediaController.turnOnSDL(); }, diff --git a/app/model/sdl/Abstract/AppModel.js b/app/model/sdl/Abstract/AppModel.js index beff386b7..8310869a2 100644 --- a/app/model/sdl/Abstract/AppModel.js +++ b/app/model/sdl/Abstract/AppModel.js @@ -58,6 +58,10 @@ SDL.ABSAppModel = Em.Object.extend( * depends on BC.SubscribeButton request */ TUNEDOWN: false, + /** + * Flag to display/hide seek bar on media screen + */ + seekBar: false, /** * mediaPlayerIndicator flag for SDL.SDLMediaControlls view */ @@ -90,6 +94,18 @@ SDL.ABSAppModel = Em.Object.extend( * @type {Number} */ appID: null, + /** + * Current value of seek bar + * + * @type {Number} + */ + valueOfSeekBar: null, + /** + * Style for progress bar + * + * @type {String} + */ + seekBarStyle: "", /** * Application name * diff --git a/app/model/sdl/MediaModel.js b/app/model/sdl/MediaModel.js index bd47c704e..1c90a1f9f 100644 --- a/app/model/sdl/MediaModel.js +++ b/app/model/sdl/MediaModel.js @@ -80,12 +80,14 @@ SDL.SDLMediaModel = SDL.ABSAppModel.extend({ this.set('VRCommands', []); this.set('tbtActivate', false); this.set('isPlaying', true); + this.set('seekBar', false); + this.set('seekBarStyle', 'progressBarWithoutSeek'); + this.set('valueOfSeekBar', 0); this.set('globalProperties.helpPrompt', []); this.set('globalProperties.timeoutPrompt', []); this.set('globalProperties.keyboardProperties', Em.Object.create()); this.set('globalProperties.keyboardProperties.keyboardLayout', 'QWERTY'); this.set('globalProperties.keyboardProperties.limitedCharacterList', []); - this.set('commandsList', {'top': []}); this.set('softButtons', []); }, @@ -133,6 +135,14 @@ SDL.SDLMediaModel = SDL.ABSAppModel.extend({ maxTimeValue: 68400, // 19 hours duration: 0, currTime: 0, + endTime: 0, + + /** + * Flag for progress bar show/hide state + * + * @param {Boolean} + */ + disabled: true, /** * Method hides sdl activation button and sdl application @@ -178,6 +188,14 @@ SDL.SDLMediaModel = SDL.ABSAppModel.extend({ } }.observes('this.pause'), + /** + * Hide/display progress bar call back function + * which handle a seekBar Boolean parameter + */ + hideDisplayProgressBar: function() { + this.set('disabled', !this.seekBar); + }.observes('this.seekBar'), + stopTimer: function() { clearInterval(this.timer); @@ -188,10 +206,26 @@ SDL.SDLMediaModel = SDL.ABSAppModel.extend({ setDuration: function() { var number, str = '', hrs = 0, min = 0, sec = 0; + var divisor = (this.countUp ? + this.endTime - this.duration : + this.duration - this.endTime); + var progress = this.currTime / divisor * 100; + this.valueOfSeekBar = progress; + if (this.countUp) { + + if(this.currTime != (this.endTime - this.duration)){ + number = this.duration + this.currTime; + + } else { + clearInterval(this.timer); + this.currTime = 0; + return; + } } else { - if (this.duration <= this.currTime) { + if (this.duration <= this.currTime || + this.endTime != 0 && (this.duration - this.endTime) <= this.currTime) { clearInterval(this.timer); this.currTime = 0; this.appInfo.set('mediaClock', '00:00:00'); @@ -218,7 +252,7 @@ SDL.SDLMediaModel = SDL.ABSAppModel.extend({ } }.observes('this.currTime'), - + changeDuration: function() { clearInterval(this.timer); @@ -259,6 +293,20 @@ SDL.SDLMediaModel = SDL.ABSAppModel.extend({ params.startTime.hours * 3600 + params.startTime.minutes * 60 + params.startTime.seconds ); + if(params.endTime) { + this.set('endTime', null); + this.set('endTime', + params.endTime.hours * 3600 + params.endTime.minutes * 60 + + params.endTime.seconds + ); + if(params.enableSeek !== undefined){ + this.set('seekBar', params.enableSeek); + } + else this.set('seekBar', false); + } + else { + this.set('seekBar', false); + } } this.set('pause', false); } diff --git a/app/view/media/sdl/controllsView.js b/app/view/media/sdl/controllsView.js index c615ebf52..f8dece847 100644 --- a/app/view/media/sdl/controllsView.js +++ b/app/view/media/sdl/controllsView.js @@ -49,15 +49,20 @@ SDL.SDLMediaControlls = Em.ContainerView.create( template: Em.Handlebars .compile( '{{#with view}}' + - '