diff --git a/app/css/app.css b/app/css/app.css index 2bc96074..36d81933 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -614,8 +614,6 @@ a.tg_radio_on:hover i.icon-radio { } - - .tg_form_group { padding: 8px 0; } @@ -2534,6 +2532,75 @@ img.chat_modal_participant_photo { } +.tg_range_wrap { + line-height: 18px; +} +input.tg_range { + cursor: pointer; + outline: none !important; + -webkit-appearance: none; + width: 100%; + max-width: 362px; + display: inline-block; + background: #c7c7c7; + margin: 0; + height: 3px; + line-height: 18px; + vertical-align: top; + margin: 8px 0; + border-radius: 2px; +} + +input.tg_range::-webkit-slider-thumb { + -webkit-appearance: none; + background: #568cb5; + width: 12px; + height: 12px; + border-radius: 6px; + overflow: hidden; +} + +.icon-volume-outer { + display: inline-block; + background: #c7c7c7; + border-radius: 10px; + overflow: hidden; + height: 18px; + padding: 5px 8px; + margin: 0 9px 0 0; + width: 32px; +} +.icon-volume-inner { + display: block; + background: #fff; + float: left; + width: 2px; + vertical-align: bottom; + margin: 0 1px 0; + height: 8px; +} +.icon-volume-inner1 { + height: 2px; + margin-top: 6px; +} +.icon-volume-inner2 { + height: 4px; + margin-top: 4px; +} +.icon-volume-inner3 { + height: 6px; + margin-top: 2px; +} + +.icon-volume-outer1 .icon-volume-inner2, +.icon-volume-outer1 .icon-volume-inner3, +.icon-volume-outer1 .icon-volume-inner4, +.icon-volume-outer2 .icon-volume-inner3, +.icon-volume-outer2 .icon-volume-inner4, +.icon-volume-outer3 .icon-volume-inner4 { + display: none; +} + /* Contacts modal */ .contacts_modal_window .modal-dialog { max-width: 506px; diff --git a/app/js/controllers.js b/app/js/controllers.js index 17ac8a0d..152a37df 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1485,45 +1485,65 @@ angular.module('myApp.controllers', []) }); }; - AppConfigManager.get('notify_nodesktop', 'notify_nosound', 'send_ctrlenter').then(function (settings) { + AppConfigManager.get('notify_nodesktop', 'notify_nosound', 'send_ctrlenter', 'notify_volume').then(function (settings) { $scope.notify.desktop = !settings[0]; - $scope.notify.sound = !settings[1]; $scope.send.enter = settings[2] ? '' : '1'; - $scope.$watch('notify.sound', function(newValue, oldValue) { - if (newValue === oldValue) { - return false; + if (settings[1]) { + $scope.notify.volume = 0; + } else { + $scope.notify.volume = settings[3] > 0 && Math.ceil(settings[3] * 10) || 0; + } + + $scope.notify.volumeOf4 = function () { + return 1 + Math.ceil(($scope.notify.volume - 1) / 3.3); + }; + + $scope.toggleSound = function () { + if ($scope.notify.volume) { + $scope.notify.volume = 0; + } else { + $scope.notify.volume = 5; } - if (newValue) { + } + + var testSoundPromise; + $scope.$watch('notify.volume', function (newValue, oldValue) { + if (newValue !== oldValue) { + var storeVolume = newValue / 10; + AppConfigManager.set({notify_volume: storeVolume}); AppConfigManager.remove('notify_nosound'); - } else { - AppConfigManager.set({notify_nosound: true}); NotificationsManager.clear(); + + if (testSoundPromise) { + $timeout.cancel(testSoundPromise); + } + testSoundPromise = $timeout(function () { + NotificationsManager.testSound(storeVolume); + }, 500); } }); - $scope.$watch('notify.desktop', function(newValue, oldValue) { - if (newValue === oldValue) { - return false; - } - if (newValue) { + $scope.toggleDesktop = function () { + $scope.notify.desktop = !$scope.notify.desktop; + + if ($scope.notify.desktop) { AppConfigManager.remove('notify_nodesktop'); } else { AppConfigManager.set({notify_nodesktop: true}); } - }); + } - $scope.$watch('send.enter', function(newValue, oldValue) { - if (newValue === oldValue) { - return false; - } - if (newValue) { + $scope.toggleCtrlEnter = function (newValue) { + $scope.send.enter = newValue; + + if ($scope.send.enter) { AppConfigManager.remove('send_ctrlenter'); } else { AppConfigManager.set({send_ctrlenter: true}); } $rootScope.$broadcast('settings_changed'); - }); + } }); }) diff --git a/app/js/directives.js b/app/js/directives.js index ad01ddc0..65f1d430 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -922,7 +922,6 @@ angular.module('myApp.directives', ['myApp.filters']) console.log('dl progress', progress); $scope.document.progress.done = progress.done; $scope.document.progress.percent = Math.max(1, Math.floor(100 * progress.done / progress.total)); - $rootScope.$broadcast('history_update'); }) } } diff --git a/app/js/services.js b/app/js/services.js index 9b699058..6ecf5043 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3123,7 +3123,8 @@ angular.module('myApp.services', []) getPeerSettings: getPeerSettings, getPeerMuted: getPeerMuted, savePeerSettings: savePeerSettings, - updatePeerSettings: updatePeerSettings + updatePeerSettings: updatePeerSettings, + testSound: playSound }; function getPeerSettings (peerID) { @@ -3199,9 +3200,9 @@ angular.module('myApp.services', []) return false; } - AppConfigManager.get('notify_nosound').then(function (noSound) { - if (!noSound) { - playSound(); + AppConfigManager.get('notify_nosound', 'notify_volume').then(function (settings) { + if (!settings[0] && settings[1] === false || settings[1] > 0) { + playSound(settings[1] || 0.5); } }) @@ -3240,9 +3241,13 @@ angular.module('myApp.services', []) }); }; - function playSound () { + function playSound (volume) { var filename = 'img/sound_a.wav'; - $('#notify_sound').html(''); + var obj = $('#notify_sound').html(''); + obj.find('audio')[0].volume = volume; } function notificationCancel (key) { diff --git a/app/partials/settings_modal.html b/app/partials/settings_modal.html index 5264b733..6bc7bcdc 100644 --- a/app/partials/settings_modal.html +++ b/app/partials/settings_modal.html @@ -59,26 +59,36 @@