Warning, /education/gcompris/src/activities/sudoku/SudokuCase.qml is written in an unsupported language. File is not indexed.
0001 /* gcompris - SudokuCase.qml 0002 0003 SPDX-FileCopyrightText: 2014 Johnny Jazeix <jazeix@gmail.com> 0004 0005 2003, 2014: Bruno Coudoin: initial version 0006 2014: Johnny Jazeix: Qt port 0007 0008 SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 import QtQuick 2.12 0011 import "sudoku.js" as Activity 0012 import GCompris 1.0 0013 0014 0015 Rectangle { 0016 id: mCase 0017 property string text 0018 property bool isInitial 0019 property int gridIndex 0020 0021 property int gridLineSize: Math.round(2 * ApplicationInfo.ratio) 0022 0023 signal stop 0024 0025 Component.onCompleted: { 0026 activity.stop.connect(stop); 0027 } 0028 0029 onStop: { 0030 restoreColorTimer.stop(); 0031 } 0032 0033 Rectangle { 0034 id: topWall 0035 color: "#808080" 0036 height: gridLineSize 0037 width: parent.width + gridLineSize 0038 anchors.verticalCenter: parent.top 0039 anchors.horizontalCenter: parent.horizontalCenter 0040 } 0041 Rectangle { 0042 id: leftWall 0043 color: "#808080" 0044 width: gridLineSize 0045 height: parent.height + gridLineSize 0046 anchors.horizontalCenter: parent.left 0047 anchors.verticalCenter: parent.verticalCenter 0048 } 0049 Rectangle { 0050 id: rightWall 0051 color: "#808080" 0052 width: gridLineSize 0053 height: parent.height + gridLineSize 0054 anchors.horizontalCenter: parent.right 0055 anchors.verticalCenter: parent.verticalCenter 0056 } 0057 Rectangle { 0058 id: bottomWall 0059 color: "#808080" 0060 height: gridLineSize 0061 width: parent.width + gridLineSize 0062 anchors.verticalCenter: parent.bottom 0063 anchors.horizontalCenter: parent.horizontalCenter 0064 } 0065 0066 Image { 0067 id: imageId 0068 source: Activity.dataToImageSource(mCase.text) 0069 width: parent.width * 0.75 0070 height: width 0071 sourceSize.height: width 0072 sourceSize.width: width 0073 anchors.centerIn: parent 0074 } 0075 0076 states: [ 0077 State { 0078 name: "default" 0079 PropertyChanges { 0080 target: mCase 0081 color: "#D6F2FC" 0082 } 0083 }, 0084 State { 0085 name: "error" 0086 PropertyChanges { 0087 target: mCase 0088 color: "#EB7878" 0089 } 0090 PropertyChanges { 0091 target: restoreColorTimer 0092 running: true 0093 } 0094 }, 0095 State { 0096 name: "hovered" 0097 PropertyChanges { 0098 target: mCase 0099 color: "#78B4EB" 0100 } 0101 }, 0102 State { 0103 name: "initial" 0104 PropertyChanges { 0105 target: mCase 0106 color: "#EAD9F2" 0107 } 0108 } 0109 ] 0110 0111 Timer { 0112 id: restoreColorTimer 0113 interval: 1500 0114 repeat: false 0115 onTriggered: { 0116 Activity.restoreState(mCase) 0117 } 0118 } 0119 }