From 68de2c4bdab84ae56ddad0db48c48b40f0ca536c Mon Sep 17 00:00:00 2001 From: thlo Date: Tue, 27 Aug 2013 22:08:08 +0200 Subject: New Overlay Menu for RecCmd Handling Make YouTube entry optional (Select Screen option is configurable through widget.conf) First 3D iter function for 3D TVs and 3D BDs. --- smarttv-client/Javascript/Comm.js | 3 +- smarttv-client/Javascript/Config.js | 9 +- smarttv-client/Javascript/Data.js | 60 +++++++++ smarttv-client/Javascript/Display.js | 24 +--- smarttv-client/Javascript/Main.js | 38 ++++-- smarttv-client/Javascript/OverlayMenu.js | 202 ++++++++++++++++++++++++++---- smarttv-client/Javascript/Player.js | 84 ++++++++++++- smarttv-client/Javascript/SelectScreen.js | 145 +++++++++++++++++++++ smarttv-client/Javascript/Server.js | 58 ++++++++- smarttv-client/config.xml | 2 +- smarttv-client/index.html | 16 +-- 11 files changed, 577 insertions(+), 64 deletions(-) create mode 100644 smarttv-client/Javascript/SelectScreen.js diff --git a/smarttv-client/Javascript/Comm.js b/smarttv-client/Javascript/Comm.js index eb548a2..b6e216f 100644 --- a/smarttv-client/Javascript/Comm.js +++ b/smarttv-client/Javascript/Comm.js @@ -147,7 +147,8 @@ Comm.onMessageReceived = function(message, context) { } break; case "MESG": - Notify.showNotify(msg.payload, true); + if (msg.payload != "") + Notify.showNotify(msg.payload, true); break; }; // switch diff --git a/smarttv-client/Javascript/Config.js b/smarttv-client/Javascript/Config.js index 2d4cf52..e32b74a 100755 --- a/smarttv-client/Javascript/Config.js +++ b/smarttv-client/Javascript/Config.js @@ -340,6 +340,7 @@ function VdrServers() { this.serverUrlList = []; this.activeServers = []; this.responses = 0; + this.retries = 0; this.instanceName = ""; }; @@ -362,7 +363,13 @@ VdrServers.prototype.handleResponse = function () { Main.log ("handle responses: Done. Active Servers= " + this.activeServers.length); switch (this.activeServers.length) { case 0: - Display.showPopup("Please start your VDR server"); + this.retries ++; + if (this.retries <2) { + this.checkServers(); + } + else + Display.showPopup("Please start your VDR server"); + break; case 1: Config.serverAddr = this.activeServers[0].addr; diff --git a/smarttv-client/Javascript/Data.js b/smarttv-client/Javascript/Data.js index d2673fe..7933de6 100755 --- a/smarttv-client/Javascript/Data.js +++ b/smarttv-client/Javascript/Data.js @@ -112,6 +112,66 @@ Data.getVideoCount = function() { Data.deleteElm = function (pos) { Data.getCurrentItem().childs.remove(pos); }; + +//-------------------------------------------------- +//--------------------- RecCmds -------------------- +//-------------------------------------------------- + +var RecCmds = { + cmds : new Item, + folderList : [], +}; + +RecCmds.reset = function() { + this.cmds = null; + this.cmds = new Item; + this.folderList = []; + Main.log("RecCmds.reset: folderList.push. this.folderList.length= " + this.folderList.length); +}; + +RecCmds.completed= function() { + this.folderList.push({item : this.cmds, id: 0}); + Main.log("---------- completed ------------"); + Main.log("RecCmds.completed: Data.folderList.length= " + this.folderList.length); +}; + +RecCmds.selectFolder = function (idx, first_idx) { + this.folderList.push({item : this.getCurrentItem().childs[idx], id: idx, first:first_idx}); + Main.log("RecCmds.selectFolder: folderList.push. this.folderList.length= " + this.folderList.length); +}; + +RecCmds.folderUp = function () { + itm = this.folderList.pop(); + Main.log("RecCmds.folderUp: folderList.pop. this.folderList.length= " + this.folderList.length); + return itm; +}; + +RecCmds.isRootFolder = function() { + Main.log("RecCmds.isRootFolder: this.folderList.length= " + this.folderList.length); + if (this.folderList.length == 1) + return true; + else + return false; +}; + +RecCmds.addItem = function(t_list, pyld) { + this.cmds.addChild(t_list, pyld, 0); +}; + +RecCmds.dumpFolderStruct = function(){ + Main.log("---------- RecCmds.dumpFolderStruct ------------"); + this.cmds.print(0); + Main.log("---------- RecCmds.dumpFolderStruct Done -------"); +}; + +RecCmds.getCurrentItem = function () { + return this.folderList[this.folderList.length-1].item; +}; + +RecCmds.getVideoCount = function() { + return this.folderList[this.folderList.length-1].item.childs.length; +}; + //----------------------------------------- function Item() { this.title = "root"; diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js index 1406970..a8eb758 100755 --- a/smarttv-client/Javascript/Display.js +++ b/smarttv-client/Javascript/Display.js @@ -62,6 +62,7 @@ Display.init = function() "overflow": "hidden", "text-overflow":"ellipsis", "white-space": "nowrap", "height": "14px"})); } + /* var done = false; var i = 0; @@ -77,6 +78,7 @@ Display.init = function() elm.style.marginBottom= " 5px"; elm.style.textAlign = "center"; } + */ Display.resetDescription(); Main.log("Display initialized" ); return success; @@ -438,13 +440,6 @@ Display.handleDescription =function (selected) { d_str = hour + ":" + min; -/* msg += title + "
"; - msg += ""+ prog + "
"; - msg += "
Start: " + d_str + "
"; - msg += "Duration: " + Display.durationString(length) + "h
"; - msg += "Remaining: " + Display.durationString((itm.payload.start + length - now)); - msg += "

"+ desc; - */ $("#descProg").show(); $("#descRemaining").show(); @@ -458,12 +453,6 @@ Display.handleDescription =function (selected) { break; case Main.eREC: d_str = mon + "/" + day + " " + hour + ":" + min; -/* - msg += "" + title + ""; - msg += "

" + d_str; - msg += " Duration: " + Display.durationString(length) + "h"; - msg += "

"+ desc; -*/ $("#descTitle").text(title); $("#descStart").text("Start: " + d_str); $("#descDuration").text("Duration: " + Display.durationString(length) + "h"); @@ -472,7 +461,7 @@ Display.handleDescription =function (selected) { $("#descImg").show(); $("#descImg") .error(function() { $("#descImg").hide();}) - .attr('src', Data.getCurrentItem().childs[selected].payload.link + "/preview_vdr.png"); + .attr('src', Data.getCurrentItem().childs[selected].payload.link + "/preview_vdr.png?"+Math.random()); break; case Main.eMED: @@ -563,13 +552,6 @@ Display.setVideoListPosition = function(position, move) { } }; -/* -Display.setDescription = function(description) { - var descriptionElement = document.getElementById("description"); - - Display.putInnerHTML(descriptionElement, description); -}; -*/ Display.getDisplayTitle = function(item) { var res = {c1:"", c2:"", c3:""}; switch (Main.state) { diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js index 241666c..e7c06ae 100755 --- a/smarttv-client/Javascript/Main.js +++ b/smarttv-client/Javascript/Main.js @@ -6,6 +6,7 @@ try { widgetAPI = new Common.API.Widget(); tvKey = new Common.API.TVKeyValue(); pluginObj = new Common.API.Plugin(); + } catch (e) { } @@ -96,8 +97,9 @@ Main.onLoad = function() { $.ajaxSetup ({ cache: false }); + Display.init(); - Display.selectItem(document.getElementById("selectItem1")); +// Display.selectItem(document.getElementById("selectItem1")); Notify.init(); Spinner.init(); Helpbar.init(); @@ -130,6 +132,8 @@ showHandler = function() { // Called by Config, when done Main.init = function () { + Main.log("Main.init()"); + if (Config.debug == true) { Main.logToServer = function (msg) { if (Config.serverUrl == "" ) @@ -142,9 +146,8 @@ Main.init = function () { } this.state = Main.eMAIN; + SelectScreen.init(); - Main.log("Main.init()"); - Buttons.init(); if ( Player.init() && Server.init() ) { @@ -187,9 +190,14 @@ Main.init = function () { Comm.init(); -// window.setTimeout(function() {Config.updateContext("192.168.1.142:8000"); }, (10*1000)); - + Main.log("ProductInfo= " + deviceapis.tv.info.getProduct()); + Main.logToServer("ProductInfo= " + deviceapis.tv.info.getProduct()); + Main.logToServer("isBdPlayer= " + Main.isBdPlayer()); + Main.logToServer("TimeZone= " + deviceapis.tv.info.getTimeZone()); +// TestHandler.showMenu(20); + + // window.setTimeout(function() {Config.updateContext("192.168.1.142:8000"); }, (10*1000)); // DirectAccess.show(); // Timers.init(); @@ -248,6 +256,13 @@ Main.testUrls = function () { }; +Main.isBdPlayer = function () { + if (deviceapis.tv.info.getProduct() == 2) //deviceapis.tv.info.PRODUCT_TYPE_BD + return true; + else + return false; +}; + Main.changeState = function (state) { Main.log("change state: OldState= " + this.state + " NewState= " + state); var old_state = this.state; @@ -843,6 +858,11 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (event) { case tvKey.KEY_YELLOW: Player.nextSubtitleTrack(); break; + case 1089: + case tvKey.KEY_3D: + case tvKey.KEY_GREEN: + Player.toggle3DEffectMode(); + break; break; default: Main.log("Calling Default Key Hanlder"); @@ -1121,7 +1141,9 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) { } break; - + case tvKey.KEY_RED: + RecCmdHandler.showMenu(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid); + break; case tvKey.KEY_YELLOW: if (Main.state == Main.eURLS) { Buttons.ynShow(); @@ -1209,7 +1231,7 @@ cMenuKeyHndl.prototype.handleKeyDown = function (event) { } }; - +/* //--------------------------------------------------- // Select Menu Key Handler //--------------------------------------------------- @@ -1293,7 +1315,7 @@ cSelectMenuKeyHndl.prototype.handleKeyDown = function (event) { break; } }; - +*/ //--------------------------------------------------- // Default Key Handler diff --git a/smarttv-client/Javascript/OverlayMenu.js b/smarttv-client/Javascript/OverlayMenu.js index 14d237a..64a7eba 100644 --- a/smarttv-client/Javascript/OverlayMenu.js +++ b/smarttv-client/Javascript/OverlayMenu.js @@ -1,21 +1,18 @@ var OverlayMenu = { - menu : [] + menu : [], + scrollDur : 300, + scrollFlip : 100 }; OverlayMenu.init = function () { - // initiate the overlay menue - - // should get an Array with Title and Command as input -// OverlayMenu.menu.push ({title: "Teefax", func : undefined}); -// OverlayMenu.menu.push ({title: "Verleihnix", func : undefined}); - + // initiate the overlay menu OverlayMenu.createStyleSheet(); - this.elmName = "#olm-"; this.masterElm = "#overlayMenu"; this.inputElm = "#overlayMenu-anchor"; this.btnSelected = 0; + this.scrolling = false; var elem = document.getElementById('overlayMenu-anchor'); elem.setAttribute('onkeydown', 'OverlayMenu.onInput();'); @@ -26,14 +23,16 @@ OverlayMenu.init = function () { OverlayMenu.show = function() { Main.log("***** OverlayMenu.show *****"); + this.scrolling = false; OverlayMenu.createMenu(); // this.menuHandler.show(); Main.log("OverlayMenu.show(): masterElm= " +this.masterElm + " inputElm= " + this.inputElm); $(this.masterElm).show(); + OverlayMenu.tuneMenu(); + $(this.inputElm).focus(); this.reset (); - }; OverlayMenu.hide = function() { @@ -50,7 +49,7 @@ OverlayMenu.createStyleSheet = function () { var sheet = $("