From 71e4befa76e91721df2baeab99fff1b4987b0cdb Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 10 Apr 2020 14:12:38 +0200 Subject: Added chess notation converter --- harbour-sailchess.pro.user | 48 ++++++++++++++++++++++++++++++---------------- qml/Functions.qml | 7 +++++++ 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/harbour-sailchess.pro.user b/harbour-sailchess.pro.user index 7ac6205..42ac1ca 100644 --- a/harbour-sailchess.pro.user +++ b/harbour-sailchess.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -8,7 +8,7 @@ ProjectExplorer.Project.ActiveTarget - 0 + 1 ProjectExplorer.Project.EditorSettings @@ -63,7 +63,7 @@ SailfishOS-3.2.1.20-armv7hl (in Sailfish OS Build Engine) SailfishOS-3.2.1.20-armv7hl 0 - 0 + 1 0 /home/melvin/code/build-harbour-sailchess-SailfishOS_3_2_1_20_armv7hl_in_Sailfish_OS_Build_Engine-Debug @@ -278,7 +278,13 @@ QmakeProjectManager.MerRpmBuildStep - 1 + + true + RPM Validation + + QmakeProjectManager.MerRpmValidationStep + + 2 Deploy ProjectExplorer.BuildSteps.Deploy @@ -393,12 +399,14 @@ -1 3 - 2 + 1 - - Custom Executable - - ProjectExplorer.CustomExecutableRunConfiguration + + harbour-sailchess (on Xperia X) + QmakeProjectManager.MerRunConfiguration:/home/melvin/code/harbour-sailchess/harbour-sailchess.pro + 1 + + false 3768 false @@ -419,7 +427,7 @@ SailfishOS-3.2.1.20-i486 (in Sailfish OS Build Engine) SailfishOS-3.2.1.20-i486 0 - 0 + 2 0 /home/melvin/code/build-harbour-sailchess-SailfishOS_3_2_1_20_i486_in_Sailfish_OS_Build_Engine-Debug @@ -634,7 +642,13 @@ QmakeProjectManager.MerRpmBuildStep - 1 + + true + RPM Validation + + QmakeProjectManager.MerRpmValidationStep + + 2 Deploy ProjectExplorer.BuildSteps.Deploy @@ -749,12 +763,14 @@ -1 3 - 2 + 1 - - Custom Executable - - ProjectExplorer.CustomExecutableRunConfiguration + + harbour-sailchess (on Sailfish OS Emulator 3.2.1.20) + QmakeProjectManager.MerRunConfiguration:/home/melvin/code/harbour-sailchess/harbour-sailchess.pro + 1 + + false 3768 false diff --git a/qml/Functions.qml b/qml/Functions.qml index 4b90cc7..dde1cc7 100644 --- a/qml/Functions.qml +++ b/qml/Functions.qml @@ -39,7 +39,14 @@ Item { } } + function convert(i) { + const first = (i % 8) + 'a'.charCodeAt(0); + const second = (7 - parseInt(i / 8)) + '1'.charCodeAt(0); + return String.fromCharCode(first, second); + } + function move(from, to) { + console.log(convert(from) + "-" + convert(to)); board.itemAt(to).piece = board.itemAt(from).piece; board.itemAt(from).piece = ""; selected = []; -- cgit v1.2.3