Warning, /education/gcompris/src/activities/chess/TakenPiecesList.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - TakenPiecesList.qml
0002 *
0003 * SPDX-FileCopyrightText: 2018 Smit S. Patil <smit17av@gmail.com>
0004 *
0005 * Authors:
0006 * Smit S. Patil <smit17av@gmail.com>
0007 *
0008 * SPDX-License-Identifier: GPL-3.0-or-later
0009 */
0010 import QtQuick 2.12
0011 import "chess.js" as Activity
0012
0013 Rectangle {
0014 id: listBG
0015 property alias takenPiecesModel: pieceList
0016 property var pushedLast: []
0017 property bool open: false
0018
0019 // left = false, right = true
0020 property bool edge
0021
0022 height: parent.height
0023 color: edge ? "#88EEEEEE" : "#88111111"
0024
0025 anchors {
0026 right: edge ? undefined : parent.left
0027 left: edge ? parent.right : undefined
0028 rightMargin: edge ? 0 : (open ? -listBG.width : 0)
0029 leftMargin: edge ? (open ? -listBG.width : 0) : 0
0030 Behavior on leftMargin {
0031 NumberAnimation { duration: 200 }
0032 }
0033 Behavior on rightMargin {
0034 NumberAnimation { duration: 200 }
0035 }
0036 }
0037
0038 Flow {
0039 anchors.fill:parent
0040 layoutDirection: edge ? Qt.RightToLeft : Qt.LeftToRight
0041
0042 Repeater {
0043 model: ListModel { id:pieceList }
0044 Piece {
0045 id: piece
0046 sourceSize.width: width
0047 width: Math.min(listBG.height / 18, listBG.width)
0048 height: width
0049 source: img ? Activity.url + img + '.svg' : ''
0050 img: model.img
0051 newPos: model.pos
0052 }
0053 }
0054 }
0055
0056 MouseArea {
0057 anchors.fill: parent
0058 onClicked: {
0059 whiteTakenPieces.open = false
0060 blackTakenPieces.open = false
0061 }
0062 }
0063 }