Warning, /sdk/cutehmi/extensions/CuteHMI/LockScreen.2/LockImage.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.12
0002 import QtQuick.Layouts 1.3
0003 import QtQuick.Controls 2.1
0004 
0005 import CuteHMI.LockScreen 2.0
0006 
0007 LockItem {
0008         id: root
0009 
0010         background: backgroundImage
0011 
0012         contentItem: Item {
0013                 transform: [
0014                         Scale {
0015                                 xScale: root.backgroundImage.paintedWidth / root.backgroundImage.sourceSize.width
0016                                 yScale: root.backgroundImage.paintedHeight / root.backgroundImage.sourceSize.height
0017                         },
0018 
0019                         Translate {
0020                                 x: (root.backgroundImage.width - root.backgroundImage.paintedWidth) * 0.5
0021                                 y: (root.backgroundImage.height - root.backgroundImage.paintedHeight) * 0.5
0022                         }
0023                 ]
0024         }
0025 
0026         property Image backgroundImage: Image {
0027                 fillMode: Image.PreserveAspectFit
0028         }
0029 
0030         property Animation wrongPasswordAnimation: SequentialAnimation {
0031                 loops: 4
0032 
0033                 property int duration: 10
0034 
0035                 property real amplitude: 10.0
0036 
0037                 NumberAnimation {
0038                         target: root.background
0039                         property: "x"
0040                         from: 0
0041                         to: root.wrongPasswordAnimation.amplitude
0042                         duration: root.wrongPasswordAnimation.duration
0043                 }
0044 
0045                 NumberAnimation {
0046                         target: root.background
0047                         property: "x"
0048                         from: root.wrongPasswordAnimation.amplitude
0049                         to: -root.wrongPasswordAnimation.amplitude
0050                         duration: 2 * root.wrongPasswordAnimation.duration
0051                 }
0052 
0053                 NumberAnimation {
0054                         target: root.background
0055                         property: "x"
0056                         from: -root.wrongPasswordAnimation.amplitude
0057                         to: 0
0058                         duration: root.wrongPasswordAnimation.duration
0059                 }
0060         }
0061 
0062         Binding {
0063                 target: root.passwordInput
0064                 property: "width"
0065                 value: root.backgroundImage.sourceSize.width
0066         }
0067 
0068         Binding {
0069                 target: root.passwordInput
0070                 property: "height"
0071                 value: root.backgroundImage.sourceSize.height
0072         }
0073 
0074         Connections {
0075                 target: root.passwordInput
0076 
0077                 function onAccepted() {
0078                         if (!root.gatekeeper.authenticate())
0079                                 root.wrongPasswordAnimation.restart()
0080                 }
0081         }
0082 }
0083 
0084 //(c)C: Copyright © 2021, Michał Policht <michal@policht.pl>. All rights reserved.
0085 //(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
0086 //(c)C: This file is a part of CuteHMI.
0087 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
0088 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
0089 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI.  If not, see <https://www.gnu.org/licenses/>.
0090 //(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
0091 //(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
0092 //(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
0093 //(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.