2 * Copyright (C) 2015 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 // The only public property
25 readonly property real pushThreshold:
26 d.minPushThreshold + ((d.maxPushThreshold - d.minPushThreshold) * (1.0 - d.sensitivity))
28 onPushThresholdChanged: {
29 // Avoid calling d.printSettings() directly as it would spam the console during initialization
30 d.printSettingsTimer.start();
33 property QtObject priv: QtObject {
36 property Timer printSettingsTimer: Timer {
38 onTriggered: d.printSettings();
40 function printSettings() {
41 console.log("EdgeBarrierSettings: min="+(minPushThreshold/units.gu(1))+"gu("+minPushThreshold+"px)"
42 +", max="+(maxPushThreshold/units.gu(1))+"gu("+maxPushThreshold+"px)"
43 +", sensitivity="+sensitivity
44 +", threshold="+(pushThreshold/units.gu(1))+"gu("+pushThreshold+"px)"
48 property real defaultMinPushThreshold: units.gu(2)
49 property real minPushThreshold: gsettings.edgeBarrierMinPush ? units.gu(gsettings.edgeBarrierMinPush) : defaultMinPushThreshold
50 property real maxPushThreshold: {
51 if (gsettings.edgeBarrierMaxPush && units.gu(gsettings.edgeBarrierMaxPush) > minPushThreshold) {
52 return units.gu(gsettings.edgeBarrierMaxPush);
53 } else if (minPushThreshold == defaultMinPushThreshold) {
56 return minPushThreshold * 10.0;
59 // Value range is [0.0, 1.0]
60 readonly property real sensitivity: gsettings.edgeBarrierSensitivity
61 ? Math.min(Math.max(0, gsettings.edgeBarrierSensitivity), 100) / 100
64 property var gsettings: GSettings { schema.id: "com.lomiri.Shell" }