Commit 021d3584 authored by Denis Kuplyakov's avatar Denis Kuplyakov
Browse files

Documented all QML classes and files

parent 87a2b284
......@@ -18,26 +18,75 @@
import QtQuick 1.1
import "globals.js" as Globals
/**
* Board
*
* Represents board with chips.
*/
Item {
id: boardContainer
/**
* Is board showing labels or not
*/
property bool isShowingLabels: false
/**
* Chips image's ID prefix at SVG theme file to use.
*/
property string chipsImagePrefix: "chip_bw"
/**
* Duration of chip's turning animation
*/
property int chipsAnimationTime: 25 * 12
/**
* Emitted when user clicks (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
*/
signal cellClicked(int row, int column)
/**
* Enables/disables hint at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c true show hint
* @c false hide hint
*/
function setHint(row, column, value) {
cells.itemAt(row * Globals.COLUMN_COUNT + column).isHint = value
}
/**
* Enables/disables legal marker at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c true show legal marker
* @c false hide legal marker
*/
function setLegal(row, column, value) {
cells.itemAt(row * Globals.COLUMN_COUNT + column).isLegal = value
}
/**
* Turn chip to White/Black at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c "Black" turn chip to black
* @c "White turn chip to white
* @c "" (empty string) hide chip
*/
function setChipState(row, column, value) {
cells.itemAt(row * Globals.COLUMN_COUNT + column).chipState = value
}
/**
* Enables/disables last move marker at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c true show last move marker
* @c false hide last move marker
*/
function setLastMove(row, column, value) {
cells.itemAt(row * Globals.COLUMN_COUNT + column).isLastMove = value
}
......
......@@ -24,6 +24,12 @@
import QtQuick 1.1
import org.kde.games.core 0.1 as KgCore
/**
* CanvasItem
*
* Wrapper used for central access to themeProvider class.
*/
KgCore.KgItem {
provider: themeProvider
}
......@@ -17,14 +17,44 @@
import QtQuick 1.1
/**
* Cell
*
* Represents board's single cell.
*/
Item {
id: cellContainer
/**
* Emitted when user clicks this cell
*/
signal clicked
/**
* Is cell showing last move marker or not
*/
property bool isLastMove: false
/**
* Is cell showing legal move marker or not
*/
property bool isLegal: false
/**
* Is cell showing hint move marker or not
*/
property bool isHint: false
/**
* Chips image's ID prefix at SVG theme file to use.
*/
property string chipImagePrefix: "chip_bw"
/**
* Duration of chip's turning animation
*/
property int chipAnimationTime: 25 * 12
/**
* Chips state:
* "Black" turns chip to black side
* "White" turns chip to white side
* "" (empty string) hides chip
*/
property string chipState: ""
CanvasItem {
......
......@@ -17,13 +17,42 @@
import QtQuick 1.1
/**
* Chip
*
* Represents chip on cell.
* Set state to:
* "Black" to show black chip
* "White" to show white chip
* "" (empty string) to hide chip
*/
Item {
id: chipContainer
//TODO export it to globals
/**
* Number of chip's animation framesCount
*/
property int framesCount: 12
/**
* Current chip's frame
*/
property int currentFrame: 1
/**
* Chips image's ID prefix at SVG theme file to use.
* Should already contain '_' at end of it.
*/
property string imagePrefix: "chip_bw_"
/**
* Duration of chip's turning animation
*/
property int animationTime: 25 * 12
//TODO export it to Cell
/**
* Emitted when user clicks this chip
*/
signal clicked
CanvasItem {
......
/*
Copyright 2007 Dmitry Suzdalev <dimsuz@gmail.com>
Copyright 2012 Viranch Mehta <viranch.mehta@gmail.com
Copyright 2013 Denis Kuplyakov <dener.kup@gmail.com>
......@@ -20,28 +21,93 @@ import QtQuick 1.1
import ColorScheme 1.0
import KColorScheme 1.0
/**
* Popup
*
* Represents popup. It's analog of KGamePopupItem.
*
* TODO: move it to libkdegames
*/
Rectangle {
id: popup
// constants
/**
* Margin on the sides of message box
*/
property int marginOnSides: 15
/**
* Space between pixmap and text
*/
property int marginIconText: 10
// API properties
property int timeout: 3000
// TODO: If item is hovered with mouse it will hide only after user moves the mouse away
/**
* The amount of time the item will stay visible on screen before it goes away.
* By default item is shown for 2000 msec.
*/
property int timeout: 2000
/**
* The popup angles sharpness
*/
property alias sharpness: popup.radius
//TODO: if iconName == "" show no icon and get rid of showIcon
/**
* Name of the icon to show at popup
*/
property string iconName: "dialog-information"
/**
* Show icon on message or not
*/
property alias showIcon: icon.visible
/**
* Sets whether to hide this popup item on mouse click.
*
* By default a mouse click will cause an item to hide
*/
property alias hideOnMouseClick: mouseArea.enabled
/**
* Sets default color for unformatted text.
* By default system-default color is used.
*/
property alias textColor: text.color
/**
* Sets default color for background.
* By default system-default color is used.
*/
property alias backgroundColor: popup.color
/**
* Sets whether to use custom border color or system-default one.
* By default system-default color is used.
*/
property bool useCustomBorderColor: false
/**
* Border's color.
* By default system-default color is used.
*/
property color borderColor: popup.border.color
/**
* Border's width in pixels.
* By default it's equals 1
*/
property int borderWidth: 1
/**
* Sets whether new message is replacing already showing one or ignored
*/
property bool isReplacing: false
// API signals
/**
* Emitted when user clicks on a link in item.
*/
signal linkActivated(string link)
/**
* Emitted when popup hides.
*/
signal hidden()
// private properties
......
......@@ -18,32 +18,79 @@
import QtQuick 1.1
import "globals.js" as Globals
/**
* Table
*
* Represents table with board
*/
Item {
id: tableContainer
anchors.fill: parent
/**
* Is board showing labels or not
*/
property bool isBoardShowingLabels: false
/**
* Chips image's ID prefix at SVG theme file to use.
*/
property string chipsImagePrefix: "chip_bw"
/**
* Duration of chip's turning animation
*/
property int chipsAnimationTime: 25 * 12
/**
* Emitted when user clicks (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
*/
signal cellClicked(int row, int column)
/**
* Enables/disables legal marker at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c true show legal marker
* @c false hide legal marker
*/
function setLegal(row, column, value) {
board.setLegal(row, column, value);
}
/**
* Turn chip to White/Black at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c "Black" turn chip to black
* @c "White turn chip to white
* @c "" (empty string) hide chip
*/
function setChipState(row, column, value) {
board.setChipState(row, column, value);
}
/**
* Enables/disables hint at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c true show hint
* @c false hide hint
*/
function setHint(row, col, show) {
board.setHint(row, col, show);
}
/**
* Enables/disables last move marker at (row, column) cell
* @param row row index of cell (starting from 0)
* @param column column index of cell (starting from 0)
* @param value @c true show last move marker
* @c false hide last move marker
*/
function setLastMove(row, column, value) {
board.setLastMove(row, column, value)
}
/**
* Shows popup with specified text
* @param text Text to show
*/
function showPopup(text) {
popup.show(text, "SHOWING");
}
......
/*
Copyright 2013 Denis Kuplyakov <dener.kup@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Number of columns on board
*/
var COLUMN_COUNT = 8;
/**
* Number of rows on board
*/
var ROW_COUNT = 8;
/*
TODO: this is theme specific constants. It will be good to connect
TODO: this is theme specific constants below. It will be good to connect
them with theme
*/
/**
* X-coordinate offset in percents of playable area from beginning of board's image
*/
var GRID_OFFSET_X_PERCENT = 0.1;
/**
* Y-coordinate offset in percents of playable area from beginning of board's image
*/
var GRID_OFFSET_Y_PERCENT = 0.1;
/**
* Playable area's width part of board's image's width
*/
var GRID_WIDTH_PERCENT = 0.8;
/**
* Playable area's height part of board's image's height
*/
var GRID_HEIGHT_PERCENT = 0.8;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment