diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/.DS_Store | bin | 6148 -> 6148 bytes | |||
| -rw-r--r-- | www/css/style.css | 3 | ||||
| -rw-r--r-- | www/js/ModalCtrl.js | 10 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 61 | ||||
| -rw-r--r-- | www/js/app.js | 3 | ||||
| -rw-r--r-- | www/templates/events.html | 4 | ||||
| -rw-r--r-- | www/templates/monitors-modal.html | 4 | ||||
| -rw-r--r-- | www/templates/montage.html | 3 |
8 files changed, 67 insertions, 21 deletions
diff --git a/www/.DS_Store b/www/.DS_Store Binary files differindex 9585136d..ba1f286a 100644 --- a/www/.DS_Store +++ b/www/.DS_Store diff --git a/www/css/style.css b/www/css/style.css index b239d043..7dce7682 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -84,7 +84,8 @@ Credit: https://css-tricks.com/snippets/css/a-guide-to-flexbox/ .main { text-align: center; - background: #5a5a5a; + /*background: #5a5a5a;*/ + background: #1f1e1e; margin: 0px; padding: 0px; /*padding:2px;*/ diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js index 1e90130c..87ec4b54 100644 --- a/www/js/ModalCtrl.js +++ b/www/js/ModalCtrl.js @@ -10,6 +10,7 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco console.log("**** INSIDE MODAL CTRL, recomputing rand *****"); $scope.rand = Math.floor((Math.random() * 100000) + 1); + $rootScope.rand = Math.floor((Math.random() * 100000) + 1); //$state.go($state.current, {}, {reload: true}); // This holds the PTZ menu control @@ -28,7 +29,8 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco $scope.showModalRangeSider = true; console.log ("****SHOWING SLIDER"); },2000); - + + $scope.radialMenuOptions = { content: '', @@ -337,6 +339,12 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco } }; + +$scope.reloadView = function() +{ + ZMDataModel.zmLog ("Reloading view for modal view, recomputing rand"); + $rootScope.rand = Math.floor((Math.random() * 100000) + 1); +}; $scope.scaleImage = function() { console.log ("Switching image style"); diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 281ca84d..7210b52d 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -4,7 +4,7 @@ /* global cordova,StatusBar,angular,console,ionic */ -angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '$rootScope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$ionicPopup', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', 'zm', '$ionicPopover', '$controller', function ($scope, $rootScope, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $ionicPopup, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, zm,$ionicPopover,$controller) { +angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '$rootScope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$ionicPopup', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', 'zm', '$ionicPopover', '$controller', 'imageLoadingDataShare', function ($scope, $rootScope, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $ionicPopup, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, zm,$ionicPopover,$controller, imageLoadingDataShare) { $controller('zmApp.BaseController', { $scope: $scope }); //--------------------------------------------------------------------- @@ -171,13 +171,30 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' function loadNotifications() { // randomval is appended to img src, so after each interval the image reloads - $scope.randomval = (new Date()).getTime(); - $rootScope.rand = Math.floor((Math.random() * 100000) + 1); - // console.log ("*** Montage timer"); + // let's make sure no image is loading + //if (imageLoadingDataShare.get() == 0) + // { + //$scope.randomval = (new Date()).getTime(); + + + $rootScope.rand = Math.floor((Math.random() * 100000) + 1); + console.log ("Montage Random...."); + + //} + //else + //{ + // console.log ("Not generating rand as image is loading"); + // } + + // console.log ("*** REMOVE ME Montage timer: "+$rootScope.rand); // console.log ("New " + $scope.randomval); } var intervalHandle ; + var isModalActive = false; + var modalIntervalHandle; + + @@ -413,15 +430,24 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' //--------------------------------------------------------------------- $scope.openModal = function (mid, controllable, controlid) { console.log("Open Monitor Modal with monitor Id=" + mid + " and Controllable:" + controllable + " with control ID:" + controlid); - + isModalActive = true; // Note: no need to setAwake(true) as its already awake // in montage view - $interval.cancel(intervalHandle); + ZMDataModel.zmLog("Cancelling montage timer, opening Modal"); + // ZMDataModel.zmLog("Starting Modal timer"); + $interval.cancel(intervalHandle); + + // let's start modal timer + // modalIntervalHandle= $interval(function () { + // modalLoadNotifications(); + // console.log ("Refreshing Image..."); + // }.bind(this), 1000); + $scope.monitorId = mid; $scope.LoginData = ZMDataModel.getLogin(); - $rootScope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; + $rootScope.modalRand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; $scope.ptzMoveCommand = ""; // This is a modal to show the monitor footage @@ -473,17 +499,23 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' $scope.closeModal = function () { console.log("Close & Destroy Monitor Modal"); + isModalActive = false; // Note: no need to setAwake(false) as needs to be awake // in montage view $scope.modal.remove(); $rootScope.rand = Math.floor((Math.random() * 100000) + 1); - console.log ("Restarting montage timer..."); - - intervalHandle= $interval(function () { + ZMDataModel.zmLog("Restarting montage timer, closing Modal..."); + + $interval.cancel(intervalHandle); + intervalHandle= $interval(function () { loadNotifications(); // console.log ("Refreshing Image..."); }.bind(this), 1000); + + //$interval.cancel(modalIntervalHandle); + + }; @@ -550,6 +582,8 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' console.log("*** Moving to Background ***"); // Handle the pause event console.log("*** CANCELLING INTERVAL ****"); $interval.cancel(intervalHandle); + // $interval.cancel(modalIntervalHandle); + // FIXME: Do I need to setAwake(false) here? } @@ -584,7 +618,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' }); $scope.$on('$ionicView.enter', function () { - console.log("**VIEW ** Montage Ctrl Entered"); + console.log("**VIEW ** Montage Ctrl Entered, Starting loadNotifications"); console.log("Setting Awake to " + ZMDataModel.getKeepAwake()); ZMDataModel.setAwake(ZMDataModel.getKeepAwake()); @@ -670,8 +704,11 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' $scope.doRefresh = function () { - console.log("***Pull to Refresh"); + console.log("***Pull to Refresh, recomputing Rand"); + ZMDataModel.zmLog ("Reloading view for montage view, recomputing rand"); + $rootScope.rand = Math.floor((Math.random() * 100000) + 1); $scope.monitors = []; + imageLoadingDataShare.set(0); var refresh = ZMDataModel.getMonitors(1); diff --git a/www/js/app.js b/www/js/app.js index b10536ec..89e85f59 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -124,9 +124,8 @@ angular.module('zmApp', [ }); - // show an image-missing image FIXME: never seems to get called + // show an image-missing image $element.bind('error',function () { - loader.remove(); imageLoadingDataShare.set(0); diff --git a/www/templates/events.html b/www/templates/events.html index 2d0d7bdc..bf02fd8a 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -33,10 +33,10 @@ <ion-content on-tap="tapped();" delegate-handle="mainScroll" lazy-scroll has-subheader="true"> - <ion-refresher + <!--<ion-refresher pulling-text="Tap <i class='ion-android-more-vertical'></i> and <i class='ion-refresh'></i> to refresh" spinner="bubbles" on-refresh="dummyDoRefresh();"> - </ion-refresher> + </ion-refresher>--> <!-- lets make sure the events list is not empty as collection repeat needs height --> <div ng-if = "!eventsBeingLoaded"> diff --git a/www/templates/monitors-modal.html b/www/templates/monitors-modal.html index 18556b10..04596dca 100644 --- a/www/templates/monitors-modal.html +++ b/www/templates/monitors-modal.html @@ -10,10 +10,10 @@ direction="xy" style="width: 100%; "> <!-- android needs this 100vh - otherwise max- does not work --> - <div style="height: 100vh;"> + <div style="height: 100vh;" class="main"> <img imageonload="finishedLoadingImage()" image-spinner-loader="lines" - image-spinner-src="{{LoginData.streamingurl}}/cgi-bin/zms?mode=jpeg&monitor={{monitorId}}&maxfps={{LoginData.maxFPS}}&buffer=1000&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{$root.rand}}" ng-class="{'zm-image-fit':imageFit==true, 'zm-image-crop':imageFit==false}" on-swipe-left="onSwipeLeft(monitorId,-1)" on-swipe-right="onSwipeRight(monitorId,1)" /> + image-spinner-src="{{LoginData.streamingurl}}/cgi-bin/zms?mode=single&monitor={{monitorId}}&maxfps={{LoginData.maxFPS}}&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{$root.modalRand}}" ng-class="{'zm-image-fit':imageFit==true, 'zm-image-crop':imageFit==false}" on-swipe-left="onSwipeLeft(monitorId,-1)" on-swipe-right="onSwipeRight(monitorId,1)" /> </div> </ion-scroll> </ion-content> diff --git a/www/templates/montage.html b/www/templates/montage.html index eee66555..fa95234f 100644 --- a/www/templates/montage.html +++ b/www/templates/montage.html @@ -44,7 +44,8 @@ <!-- back to ng-src. spinner was not updating when rand changes--> <!-- FIXME: Scale is 50% hardcoded --> - <img id="img-$index" image-spinner-src="{{LoginData.streamingurl}}/cgi-bin/zms?mode=single&monitor={{monitor.Monitor.Id}}&maxfps={{LoginData.maxFPS}}&scale=50&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{$root.rand}}" width="{{((devWidth)/(7-monitorSize[$index]))}}px;" + <!-- moving to single so I can rely on rand for reloads --> + <img id="img-$index" image-spinner-src="{{LoginData.streamingurl}}/cgi-bin/zms?mode=jpeg&monitor={{monitor.Monitor.Id}}&maxfps={{LoginData.maxFPS}}&scale=50&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{$root.rand}}" width="{{((devWidth)/(7-monitorSize[$index]))}}px;" ng-click="openModal(monitor.Monitor.Id, monitor.Monitor.Controllable, monitor.Monitor.ControlId)" on-hold="onHold($index)" on-release="onRelease($index)" |
