1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/* jshint -W041 */
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console */
angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope', '$rootScope', '$ionicModal', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', '$ionicHistory','$state', 'SecuredPopups', function ($scope, $rootScope, $ionicModal, zm, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, $ionicHistory, $state, SecuredPopups) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
// $scope.this.will.crash = 1;
};
//----------------------------------------------------------------
// Alarm notification handling
//----------------------------------------------------------------
$scope.handleAlarms = function()
{
$rootScope.isAlarm=!$rootScope.isAlarm;
if (!$rootScope.isAlarm)
{
$rootScope.alarmCount="0";
$ionicHistory.nextViewOptions({disableBack: true});
ZMDataModel.$state.("events", {"id": 0}, { reload: true });
}
};
//----------------------------------------------------------------
// Save anyway when you exit
//----------------------------------------------------------------
$scope.$on('$ionicView.beforeLeave', function () {
saveDevOptions();
});
//-------------------------------------------------------------------------
// Lets make sure we set screen dim properly as we enter
// The problem is we enter other states before we leave previous states
// from a callback perspective in ionic, so we really can't predictably
// reset power state on exit as if it is called after we enter another
// state, that effectively overwrites current view power management needs
//------------------------------------------------------------------------
$scope.$on('$ionicView.enter', function () {
//console.log("**VIEW ** DevOptions Ctrl Entered");
$scope.loginData = ZMDataModel.getLogin();
ZMDataModel.setAwake(false);
});
//------------------------------------------------------------------
// Perform the login action when the user submits the login form
//------------------------------------------------------------------
function saveDevOptions()
{
ZMDataModel.zmDebug("SaveDevOptions: called");
/*if (parseInt($scope.loginData.maxMontage) > zm.safeMontageLimit) {
$rootScope.zmPopup= SecuredPopups.show('alert',{
title: 'Note',
template: 'You have selected to view more than 10 monitors in the Montage screen. Note that this is very resource intensive and may load the server or cause issues in the application. If you are not sure, please consider limiting this value to 10'
});
ZMDataModel.zmDebug("SaveDevOptions: " + $scope.loginData.maxMontage +
" monitors for montage");
}*/
if ((parseInt($scope.loginData.maxFPS) < 0) || (parseInt($scope.loginData.maxFPS) > zm.maxFPS)) {
$scope.loginData.maxFPS = zm.defaultFPS.toString();
}
if (parseInt($scope.loginData.refreshSec) <= 0) {
ZMDataModel.zmDebug("SaveDevOptions: refresh sec was too low at " +
$scope.loginData.refreshSec + " reset to 1");
$scope.loginData.refreshSec = 1;
}
if ((parseInt($scope.loginData.montageQuality) < zm.safeMontageLimit) ||
(parseInt($scope.loginData.montageQuality) > 70)) {
$scope.loginData.montageQuality = 70;
}
if ((parseInt($scope.loginData.singleImageQuality) < zm.safeImageQuality) ||
(parseInt($scope.loginData.singleImageQuality) > 100)) {
$scope.loginData.singleImageQuality = zm.safeImageQuality.toString();
}
ZMDataModel.zmDebug("SaveDevOptions: Saving to disk");
ZMDataModel.setLogin($scope.loginData);
}
$scope.saveDevOptions = function () {
saveDevOptions();
// $rootScope.zmPopup.close();
$rootScope.zmPopup= SecuredPopups.show('alert',{
title: 'Settings Saved',
template: 'Please explore the menu and enjoy zmNinja!'
}).then(function (res) {
$ionicSideMenuDelegate.toggleLeft();
});
};
//------------------------------------------------------------------
// controller main
//------------------------------------------------------------------
}]);
|