Verified Commit 8b510c68 authored by ivan tkachenko's avatar ivan tkachenko
Browse files

[applets/fifteenPuzzle] Port away from plasmoid context property to Plasmoid attached object

parent ab7ab086
......@@ -10,6 +10,7 @@ import QtQuick.Layouts 1.15
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.plasmoid 2.0
Item {
id: main
......@@ -17,7 +18,7 @@ Item {
Layout.minimumWidth: Math.max(boardSize * 10, controlsRow.width)
Layout.preferredWidth: Math.max(boardSize * 10, controlsRow.width)
readonly property int boardSize: plasmoid.configuration.boardSize
readonly property int boardSize: Plasmoid.configuration.boardSize
property Component piece: Piece {}
property var pieces: []
......@@ -203,8 +204,8 @@ Item {
id: solvedImage
anchors.fill: parent
z: 1
source: "image://fifteenpuzzle/" + boardSize + "-all-0-0-" + plasmoid.configuration.imagePath;
visible: plasmoid.configuration.useImage;
source: "image://fifteenpuzzle/" + boardSize + "-all-0-0-" + Plasmoid.configuration.imagePath;
visible: Plasmoid.configuration.useImage;
cache: false
function update() {
var tmp = source;
......@@ -231,7 +232,7 @@ Item {
}
Connections {
target: plasmoid.configuration
target: Plasmoid.configuration
function onBoardSizeChanged() {
main.fillBoard();
solvedImage.update();
......@@ -239,7 +240,7 @@ Item {
}
Connections {
target: plasmoid.configuration
target: Plasmoid.configuration
function onImagePathChanged() {
main.fillBoard();
solvedImage.update();
......
......@@ -9,10 +9,11 @@ import QtQuick.Layouts 1.15
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.plasmoid 2.0
Rectangle {
id: piece
color: plasmoid.configuration.boardColor
color: Plasmoid.configuration.boardColor
border.color: "black"
border.width: 1
radius: 5
......@@ -31,7 +32,7 @@ Rectangle {
signal activated(int position)
readonly property int boardSize: plasmoid.configuration.boardSize
readonly property int boardSize: Plasmoid.configuration.boardSize
readonly property int margin: PlasmaCore.Units.smallSpacing
readonly property int pieceWidth: (parent.width - (margin * boardSize)) / boardSize
readonly property int pieceHeight: (parent.height - (margin * boardSize)) / boardSize
......@@ -58,8 +59,8 @@ Rectangle {
id: pieceNumeral
anchors.centerIn: parent
text: piece.number
color: plasmoid.configuration.numberColor
visible: plasmoid.configuration.showNumerals
color: Plasmoid.configuration.numberColor
visible: Plasmoid.configuration.showNumerals
z: 1
}
......@@ -67,8 +68,8 @@ Rectangle {
id: pieceImage
width: parent.width
height: parent.height
visible: plasmoid.configuration.useImage
source: "image://fifteenpuzzle/" + boardSize + "-" + number + "-" + pieceWidth + "-" + pieceHeight + "-" + plasmoid.configuration.imagePath;
visible: Plasmoid.configuration.useImage
source: "image://fifteenpuzzle/" + boardSize + "-" + number + "-" + pieceWidth + "-" + pieceHeight + "-" + Plasmoid.configuration.imagePath;
cache: false
z: 0
}
......
Supports Markdown
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