Warning, /games/kreversi/src/qml/Cell.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2013 Denis Kuplyakov <dener.kup@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.3
0008 
0009 /**
0010   * Cell
0011   *
0012   * Represents board's single cell.
0013   */
0014 
0015 Item {
0016     id: cellContainer
0017     /**
0018       * Emitted when user clicks this cell
0019       */
0020     signal clicked
0021     /**
0022       * Is cell showing last move marker or not
0023       */
0024     property bool isLastMove: false
0025     /**
0026       * Is cell showing legal move marker or not
0027       */
0028     property bool isLegal: false
0029     /**
0030       * Is cell showing hint move marker or not
0031       */
0032     property bool isHint: false
0033     /**
0034       * Chips image's ID prefix at SVG theme file to use.
0035       */
0036     property string chipImagePrefix: "chip_bw"
0037     /**
0038       * Duration of chip's turning animation
0039       */
0040     property int chipAnimationTime: 25 * 12
0041     /**
0042      * How long to wait before start of animation
0043      */
0044     property int chipPreAnimationTime: 0
0045     /**
0046       * Chips state:
0047       * "Black" turns chip to black side
0048       * "White" turns chip to white side
0049       * "" (empty string) hides chip
0050       */
0051     property string chipState: ""
0052 
0053     CanvasItem {
0054         id: cellLegalImage
0055         anchors.fill: parent
0056         visible: isLegal
0057         spriteKey: "move_hint"
0058     }
0059 
0060     Rectangle {
0061         id: cellLastMoveMarker;
0062         visible: isLastMove
0063         anchors.fill: parent
0064         color: "#AAAAAA"
0065     }
0066 
0067     Chip {
0068         id: reversiChip
0069         anchors.fill: parent
0070 
0071         state: chipState + (isHint ? "_blinking" : "")
0072 
0073         imagePrefix: parent.chipImagePrefix + "_"
0074         animationTime: parent.chipAnimationTime
0075         preAnimationTime: parent.chipPreAnimationTime
0076     }
0077 
0078     MouseArea {
0079         id: mouseArea
0080         anchors.fill: parent
0081         onClicked: cellContainer.clicked()
0082     }
0083 }