Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The rules include castling, en passant, all four promotion choices, checkmate, s
| F | Flip board |
| R | Reset camera |
| 1–4 | Switch piece set |
| Tab | Show or hide the interface |
| S | Settings |
| ? | Show shortcuts |
| Q | Quit |
Expand Down
7 changes: 0 additions & 7 deletions src/BoardView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,4 @@ Item {
}
onWheel: wheel => { board.distance = Math.max(10.5, Math.min(board.farthest, board.distance - wheel.angleDelta.y / 600)) }
}
Row {
anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
spacing: 24
Text { text: qsTr("Right-drag to orbit"); color: board.design === 3 ? "#30232c" : "#eee3cc"; opacity: .65; font.pixelSize: 11 }
Text { text: qsTr("Scroll to zoom"); color: board.design === 3 ? "#30232c" : "#eee3cc"; opacity: .65; font.pixelSize: 11 }
Text { text: qsTr("F · Flip board"); color: board.design === 3 ? "#30232c" : "#eee3cc"; opacity: .65; font.pixelSize: 11 }
}
}
13 changes: 9 additions & 4 deletions src/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ApplicationWindow {
property var setDescriptions: [qsTr("Across the stars"),qsTr("Wood, ivory & brass"),qsTr("A woodland tale"),qsTr("A little sweetness")]
property var setColors: ["#d9ad69","#c99b6b","#93a775","#db9eb2"]
property var difficultyNames: [qsTr("Casual"),qsTr("Thoughtful"),qsTr("Challenging")]
// Tab clears the header and sidebar away so only the board is left; it comes back with every launch.
property bool chrome: true
property bool modalOpen: newGameDialog.visible || settingsDialog.visible || helpDialog.visible || promotionDialog.visible || setMenu.visible
function statusText() {
if (backend.outcome === "white-wins") return qsTr("White wins by checkmate")
Expand Down Expand Up @@ -85,6 +87,8 @@ ApplicationWindow {
anchors.fill: parent
spacing: 0
Rectangle {
objectName: "header"
visible: window.chrome
Layout.fillWidth: true
Layout.preferredHeight: 70
color: theme.background
Expand Down Expand Up @@ -202,16 +206,16 @@ ApplicationWindow {
}
}
}
Rectangle { Layout.fillWidth: true; height: 1; color: window.line }
Rectangle { Layout.fillWidth: true; height: 1; color: window.line; visible: window.chrome }
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 0
BoardView { id: board; objectName: "board"; Layout.fillWidth: true; Layout.fillHeight: true }
Rectangle { Layout.fillHeight: true; width: 1; color: window.line; visible: backend.sidebar }
Rectangle { Layout.fillHeight: true; width: 1; color: window.line; visible: backend.sidebar && window.chrome }
Rectangle {
objectName: "sidebar"
visible: backend.sidebar
visible: backend.sidebar && window.chrome
Layout.preferredWidth: window.width < 1100 ? 264 : 298
Layout.fillHeight: true
color: Qt.alpha(theme.foreground,.018)
Expand Down Expand Up @@ -369,7 +373,7 @@ ApplicationWindow {
Material.roundedScale: theme.radius
contentItem: Label {
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
text: qsTr("Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.")
text: qsTr("Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nTab · Show or hide the interface\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.")
wrapMode: Text.WordWrap
lineHeight: 1.4
}
Expand Down Expand Up @@ -420,6 +424,7 @@ ApplicationWindow {
Shortcut { sequence: "3"; enabled: !window.modalOpen; onActivated: backend.pieceSet = 2 }
Shortcut { sequence: "4"; enabled: !window.modalOpen; onActivated: backend.pieceSet = 3 }
Shortcut { sequence: "B"; enabled: !window.modalOpen; onActivated: backend.sidebar = !backend.sidebar }
Shortcut { sequence: "Tab"; enabled: !window.modalOpen; onActivated: window.chrome = !window.chrome }
Shortcut { sequence: "R"; enabled: !window.modalOpen; onActivated: board.resetCamera() }
Shortcut { sequence: "Escape"; enabled: !window.modalOpen; onActivated: backend.cancelSelection() }
Shortcut { sequences: ["Space","Return"]; enabled: !window.modalOpen; onActivated: board.keyboardSelect() }
Expand Down
5 changes: 1 addition & 4 deletions src/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"Draw · fifty-move rule": "تعادل · قاعدة الخمسين نقلة",
"Draw · insufficient material": "تعادل · قطع غير كافية",
"Draw · threefold repetition": "تعادل · تكرار الوضع ثلاث مرات",
"F · Flip board": "F · قلب الرقعة",
"Keyboard shortcuts": "اختصارات لوحة المفاتيح",
"Knight": "حصان",
"MOVE HISTORY": "سجل النقلات",
Expand All @@ -40,10 +39,8 @@
"Queen": "وزير",
"Reduced motion": "تقليل الحركة",
"Reset camera": "إعادة ضبط الكاميرا",
"Right-drag to orbit": "اسحب بالزر الأيمن للتدوير",
"Rook": "رخ",
"Saved automatically · No time limit": "حفظ تلقائي · دون حد زمني",
"Scroll to zoom": "مرر للتكبير والتصغير",
"Settings": "الإعدادات",
"Starting a new match replaces the saved game.": "بدء مباراة جديدة يستبدل اللعبة المحفوظة.",
"TWO PLAYERS": "لاعبان",
Expand All @@ -69,7 +66,7 @@
"Moss & Myth": "Moss & Myth",
"Candy Kingdom": "Candy Kingdom",
"Every great game starts\nwith a single move.": "كل مباراة رائعة تبدأ\nبنقلة واحدة.",
"Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.": "انقر على قطعة ثم على مربع مميز.\n\nمفاتيح الأسهم · التنقل على الرقعة\nSpace / Enter · اختيار أو تحريك\nEscape · إلغاء الاختيار\nCtrl+Z · تراجع\nN · لعبة جديدة\nF · قلب الرقعة\nR · إعادة ضبط الكاميرا\n1–4 · مجموعة القطع\nB · إظهار الشريط الجانبي أو إخفاؤه\nS · الإعدادات\n? · الاختصارات\nQ · خروج (تحفظ اللعبة)\n\nاسحب بالزر الأيمن للتدوير ومرر للتكبير.",
"Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nTab · Show or hide the interface\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.": "انقر على قطعة ثم على مربع مميز.\n\nمفاتيح الأسهم · التنقل على الرقعة\nSpace / Enter · اختيار أو تحريك\nEscape · إلغاء الاختيار\nCtrl+Z · تراجع\nN · لعبة جديدة\nF · قلب الرقعة\nR · إعادة ضبط الكاميرا\n1–4 · مجموعة القطع\nB · إظهار الشريط الجانبي أو إخفاؤه\nTab · إظهار الواجهة أو إخفاؤها\nS · الإعدادات\n? · الاختصارات\nQ · خروج (تحفظ اللعبة)\n\nاسحب بالزر الأيمن للتدوير ومرر للتكبير.",
"Piece set": "مجموعة القطع",
"Hide sidebar": "إخفاء الشريط الجانبي",
"Show sidebar": "إظهار الشريط الجانبي"
Expand Down
5 changes: 1 addition & 4 deletions src/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"Draw · fifty-move rule": "Remis · 50-træksreglen",
"Draw · insufficient material": "Remis · utilstrækkeligt materiale",
"Draw · threefold repetition": "Remis · tredobbelt gentagelse",
"F · Flip board": "F · Vend brættet",
"Keyboard shortcuts": "Tastaturgenveje",
"Knight": "Springer",
"MOVE HISTORY": "TRÆKHISTORIK",
Expand All @@ -40,10 +39,8 @@
"Queen": "Dronning",
"Reduced motion": "Reduceret bevægelse",
"Reset camera": "Nulstil kamera",
"Right-drag to orbit": "Træk med højre museknap for at rotere",
"Rook": "Tårn",
"Saved automatically · No time limit": "Gemmes automatisk · Ingen tidsgrænse",
"Scroll to zoom": "Rul for at zoome",
"Settings": "Indstillinger",
"Starting a new match replaces the saved game.": "Et nyt parti erstatter det gemte spil.",
"TWO PLAYERS": "TO SPILLERE",
Expand All @@ -69,7 +66,7 @@
"Moss & Myth": "Moss & Myth",
"Candy Kingdom": "Candy Kingdom",
"Every great game starts\nwith a single move.": "Ethvert stort parti begynder\nmed et enkelt træk.",
"Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.": "Klik på en brik og derefter på et markeret felt.\n\nPiletaster · Naviger på brættet\nSpace / Enter · Vælg eller flyt\nEscape · Annuller valg\nCtrl+Z · Fortryd\nN · Nyt spil\nF · Vend brættet\nR · Nulstil kamera\n1–4 · Briksæt\nB · Vis eller skjul sidepanelet\nS · Indstillinger\n? · Tastaturgenveje\nQ · Afslut (spillet gemmes)\n\nTræk med højre museknap for at rotere. Rul for at zoome.",
"Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nTab · Show or hide the interface\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.": "Klik på en brik og derefter på et markeret felt.\n\nPiletaster · Naviger på brættet\nSpace / Enter · Vælg eller flyt\nEscape · Annuller valg\nCtrl+Z · Fortryd\nN · Nyt spil\nF · Vend brættet\nR · Nulstil kamera\n1–4 · Briksæt\nB · Vis eller skjul sidepanelet\nTab · Vis eller skjul brugerfladen\nS · Indstillinger\n? · Tastaturgenveje\nQ · Afslut (spillet gemmes)\n\nTræk med højre museknap for at rotere. Rul for at zoome.",
"Piece set": "Briksæt",
"Hide sidebar": "Skjul sidepanel",
"Show sidebar": "Vis sidepanel"
Expand Down
5 changes: 1 addition & 4 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"Challenging": "Challenging",
"Choose your opponent and settle in.": "Choose your opponent and settle in.",
"Choose your promotion": "Choose your promotion",
"Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.": "Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.",
"Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nTab · Show or hide the interface\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.": "Click a piece, then a highlighted square.\n\nArrow keys · Navigate the board\nSpace / Enter · Select or move\nEscape · Cancel selection\nCtrl+Z · Undo\nN · New game\nF · Flip board\nR · Reset camera\n1–4 · Piece set\nB · Show or hide the sidebar\nTab · Show or hide the interface\nS · Settings\n? · Keyboard shortcuts\nQ · Quit (your game is saved)\n\nRight-drag to orbit. Scroll to zoom.",
"Close": "Close",
"Computer": "Computer",
"Considering the next move…": "Considering the next move…",
Expand All @@ -30,7 +30,6 @@
"Draw · insufficient material": "Draw · insufficient material",
"Draw · threefold repetition": "Draw · threefold repetition",
"Every great game starts\nwith a single move.": "Every great game starts\nwith a single move.",
"F · Flip board": "F · Flip board",
"Game is not being saved": "Game is not being saved",
"Keyboard shortcuts": "Keyboard shortcuts",
"Knight": "Knight",
Expand All @@ -48,10 +47,8 @@
"Queen": "Queen",
"Reduced motion": "Reduced motion",
"Reset camera": "Reset camera",
"Right-drag to orbit": "Right-drag to orbit",
"Rook": "Rook",
"Saved automatically · No time limit": "Saved automatically · No time limit",
"Scroll to zoom": "Scroll to zoom",
"Settings": "Settings",
"Start game": "Start game",
"Starting a new match replaces the saved game.": "Starting a new match replaces the saved game.",
Expand Down
15 changes: 15 additions & 0 deletions tests/checkmate_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,21 @@ private slots:
QTest::keyClick(window,Qt::Key_B);
QVERIFY(backend.sidebar());
QTRY_COMPARE(board->width(),narrow);
// Tab clears the header and sidebar away for a bare board, and brings them back.
auto *header=window->findChild<QQuickItem *>("header");
QVERIFY(header && header->isVisible());
const qreal low=board->height();
QTest::keyClick(window,Qt::Key_Tab);
QTRY_VERIFY(!header->isVisible());
QVERIFY(!sidebar->isVisible());
QVERIFY(backend.sidebar());
QTRY_COMPARE(board->width(),qreal(window->width()));
QTRY_COMPARE(board->height(),qreal(window->height()));
QTest::keyClick(window,Qt::Key_Tab);
QTRY_VERIFY(header->isVisible());
QVERIFY(sidebar->isVisible());
QTRY_COMPARE(board->width(),narrow);
QTRY_COMPARE(board->height(),low);
}
board->setProperty("cursorSquare",28);
QTest::keyClick(window,Qt::Key_F);
Expand Down
Loading