diff --git a/Motus/Main.qml b/Motus/Main.qml index 9e8c40b426c20f3bbd7a67bbbef3af5c1deb402b..bd86eb827dfd5a3938857c20a8fff60bc7383340 100644 --- a/Motus/Main.qml +++ b/Motus/Main.qml @@ -5,7 +5,7 @@ Window { height: Screen.height visible: true visibility: Window.Maximized - title: qsTr("Hello World") + title: qsTr("Motus") property var caseArray: [ _case_1_1, _case_1_2, _case_1_3, _case_1_4, _case_1_5, @@ -43,651 +43,196 @@ Window { Rectangle { id: rectangle - x: 0 - y: 0 - width: Screen.width - height: Screen.height + anchors.fill: parent color: "#323232" focus: true - Grid { - id: grid - y: 206 - width: 370 - height: 445 - anchors.horizontalCenter: parent.horizontalCenter - spacing: 5 - rows: 6 - columns: 5 - - Case { - id: _case_1_1 - focus: true - } - - Case { - id: _case_1_2 - } - - Case { - id: _case_1_3 - } - - Case { - id: _case_1_4 - } - - Case { - id: _case_1_5 - } - - Case { - id: _case_2_1 - } - - Case { - id: _case_2_2 - } - - Case { - id: _case_2_3 - } - - Case { - id: _case_2_4 - } - - Case { - id: _case_2_5 - } - - Case { - id: _case_3_1 - } - - Case { - id: _case_3_2 - } - - Case { - id: _case_3_3 - } - - Case { - id: _case_3_4 - } - - Case { - id: _case_3_5 - } - - Case { - id: _case_4_1 - } - - Case { - id: _case_4_2 - } + // Bouton "Générer un mot" + Choosebutton { + id: choosebutton + anchors.top: parent.top + anchors.left: parent.left + anchors.topMargin: height * 0.03 + anchors.leftMargin: width * 0.03 + _textText: "Générer un mot" Case { - id: _case_4_3 + id: case3 + _textText: "mot test" } - Case { - id: _case_4_4 - } - - Case { - id: _case_4_5 + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + let mot = motusGame.getRandomWord(); + motusGame.startTimer(); + case3._textText = mot; + } } + } - Case { - id: _case_5_1 - } + // Choix du nombre de lettres (en haut à droite) + Rectangle { + id: rectangle_combobox + width: parent.width * 0.15 + height: parent.height * 0.15 + anchors.top: parent.top + anchors.right: parent.right + anchors.topMargin: height * 0.03 + anchors.rightMargin: width * 0.03 + color: "#323232" + radius: 10 + border.color: "#ffffff" + border.width: 3 - Case { - id: _case_5_2 - } + Column { + anchors.fill: parent + anchors.margins: 10 + spacing: 10 - Case { - id: _case_5_3 - } + Text { + text: qsTr("Nombre de lettres / \n Number of letters") + font.pixelSize: 18 + color: "white" + horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + } - Case { - id: _case_5_4 + NumberLetterButton { + width: parent.width * 0.9 + height: parent.height * 0.5 + anchors.horizontalCenter: parent.horizontalCenter + } } + } - Case { - id: _case_5_5 - } + // Fenêtre pour les langages (en dessous du bouton générer) + Rectangle { + id: big_rectangle_langue + width: parent.width * 0.15 + height: parent.height * 0.25 + anchors.top: choosebutton.bottom + anchors.left: choosebutton.left + anchors.topMargin: height * 0.03 + color: "#323232" + radius: 10 + border.color: "#ffffff" + border.width: 3 - Case { - id: _case_6_1 - } + Column { + anchors.fill: parent + anchors.margins: 10 + spacing: 10 - Case { - id: _case_6_2 - } - - Case { - id: _case_6_3 - } + Text { + text: qsTr("Language/Langage") + font.pixelSize: 20 + color: "white" + horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + } - Case { - id: _case_6_4 - } + LangageButton { + _textText: "Français" + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: motusGame.dictionnaryChoosed = "Motus\\mots_francais.txt" + } + } - Case { - id: _case_6_5 + LangageButton { + _textText: "English" + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: motusGame.dictionnaryChoosed = "Motus\\words_alpha.txt" + } + } } } + // Texte MOTUS Text { id: _text2 - y: 20 - width: 200 - height: 80 - color: "#ffffff" text: qsTr("MOTUS") font.pixelSize: 50 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - anchors.horizontalCenterOffset: 0 + color: "white" font.family: "Tahoma" - font.styleName: "Bold" + font.bold: true + horizontalAlignment: Text.AlignHCenter anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: height * 0.2 } - - } - - Choosebutton { - id: choosebutton - x: 57 - y: 102 - _textText: "Générer un mot" - - - Case { - id: case3 - _textText: "mot test" - } - - - Keys.onPressed: (event) => { - if (event.key === Qt.Key_A) { - case1._textText = qsTr("C"); - console.log(event.key + " /// " + event.text); - event.accepted = true; - } - } - MouseArea { - id: mouseArea1 - x: 0 - y: 0 - width: 300 - height: 200 - cursorShape: Qt.PointingHandCursor - onClicked: { - let mot = motusGame.getRandomWord(); - console.log("Mot choisi :", mot); - motusGame.startTimer(); // 🕒 démarre le chrono - case3._textText = mot; - onClicked: case3._textColor="#51c3e1"; - } - } - } - - MotusTimer { - id: motusTimer - x: 1539 - y: 926 - } - - Rectangle { - id: rectangle_combobox - x: 224 - y: 131 - width: 250 - height: 180 - color: "#323232" - radius: 10 - border.color: "#ffffff" - border.width: 5 - anchors.horizontalCenterOffset: 577 - anchors.horizontalCenter: parent.horizontalCenter - - - NumberLetterButton - { - id: numberLetterButton - x: -8 - y: 80 - width: 250 - height: 100 - - anchors.horizontalCenterOffset: 0 + // Grille de jeu juste en dessous de MOTUS + Grid { + id: grid + anchors.top: _text2.bottom + anchors.topMargin: height * 0.02 anchors.horizontalCenter: parent.horizontalCenter - } + width: parent.width * 0.25 + height: parent.height * 0.3 + spacing: 5 + rows: 6 + columns: 5 - Text { - id: _text1 - x: 0 - y: 0 - width: 250 - height: 84 - color: "#ffffff" - text: qsTr("Nombre de lettres / \n Number of letters") - font.pixelSize: 23 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.family: "Tahoma" + Repeater { + model: 30 + delegate: Case {} + } } - } - - Rectangle{ - - id: big_rectangle_langue - x: 64 - y: 362 - width: 270 - height: 340 - color: "#323232" - radius: 10 - border.color: "#ffffff" - border.width: 5 - + // Clavier en bas centré Rectangle { - id: rectangle_langue - x: 100 - y: 60 - width: 270 - height: 280 + id: rectangle1 + width: parent.width * 0.9 + height: parent.height * 0.25 + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottomMargin: height * 0.03 color: "#323232" radius: 10 border.color: "#ffffff" border.width: 5 - anchors.horizontalCenterOffset: 0 - anchors.horizontalCenter: parent.horizontalCenter - - LangageButton { - id: langageButton - x: 33 - y: 31 - _textText: "Français" - - MouseArea { - id: mouseArea2 - x: 0 - y: 0 - width: 200 - height: 100 - cursorShape: Qt.PointingHandCursor - onClicked: motusGame.dictionnaryChoosed="Motus\\mots_francais.txt" - - } - - - } - - LangageButton { - id: langageButton1 - x: 33 - y: 152 - _textText: "English" - - MouseArea { - id: mouseArea3 - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: motusGame.dictionnaryChoosed="Motus\\words_alpha.txt" + Column { + anchors.fill: parent + anchors.margins: 10 + spacing: 10 + + Repeater { + model: [ + ["A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P"], + ["Q", "S", "D", "F", "G", "H", "J", "K", "L"], + ["Entrée", "W", "X", "C", "V", "B", "N", "M", "<"] + ] + delegate: Row { + spacing: 5 + anchors.horizontalCenter: parent.horizontalCenter + + Repeater { + model: modelData + delegate: Key { + width: modelData === "Entrée" || modelData === "<" ? 80 : 50 + height: 60 + labelText: modelData + scale: 0.8 + } + } + } } - } } - Text { - id: _text - x: 0 - y: 0 - width: 270 - height: 63 - color: "#ffffff" - text: qsTr("Language/Langage") - font.pixelSize: 30 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.family: "Tahoma" + // Timer en bas à droite + MotusTimer { + id: motusTimer + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 10 } - - } - - Rectangle { - id: rectangle1 - x: 342 - y: 762 - width: 640 - height: 280 - color: "#323232" - radius: 10 - border.color: "#ffffff" - border.width: 5 - anchors.horizontalCenterOffset: 0 - anchors.horizontalCenter: parent.horizontalCenter - - Column { - id: column - width: (10 * 50) + (9 * 5) - spacing: 5 - height: 2*spacing + 80*3 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - - Row { - id: row1 - height: 80 - anchors.horizontalCenter: parent.horizontalCenter - spacing: 5 - width: (10 * 50) + (9 * spacing) - - Key { - id: key - x: 0 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - scale: 0.8 - } - - Key { - id: key1 - x: 70 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "Z" - scale: 0.8 - } - - Key { - id: key2 - x: 140 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "E" - antialiasing: true - scale: 0.8 - } - - Key { - id: key3 - x: 210 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "R" - scale: 0.8 - } - - Key { - id: key4 - x: 280 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "T" - scale: 0.8 - } - - Key { - id: key5 - x: 350 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "Y" - scale: 0.8 - } - - Key { - id: key6 - x: 420 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "U" - scale: 0.8 - } - - Key { - id: key7 - x: 490 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "I" - scale: 0.8 - } - - Key { - id: key8 - x: 560 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "O" - scale: 0.8 - } - - Key { - id: key9 - x: 630 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "P" - scale: 0.8 - } - } - - Row { - id: row2 - width: (9 * 50) + (8 * spacing) - height: 80 - anchors.horizontalCenter: parent.horizontalCenter - spacing: 5 - - Key { - id: key12 - x: 140 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "Q" - scale: 0.8 - } - - Key { - id: key13 - x: 210 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "S" - scale: 0.8 - } - - Key { - id: key14 - x: 280 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "D" - scale: 0.8 - } - - Key { - id: key15 - x: 350 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "F" - scale: 0.8 - } - - Key { - id: key16 - x: 420 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "G" - scale: 0.8 - } - - Key { - id: key17 - x: 490 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "H" - scale: 0.8 - } - - Key { - id: key18 - x: 560 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "J" - scale: 0.8 - } - - Key { - id: key19 - x: 630 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "K" - scale: 0.8 - } - - Key { - id: key20 - x: 630 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "L" - scale: 0.8 - } - } - - Row { - id: row3 - width: (7 * 50) + (10 * spacing) + (100 * 2) - height: 80 - anchors.horizontalCenter: parent.horizontalCenter - spacing: 5 - - Key { - id: key23 - x: 140 - width: 100 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelFontstyleName: "Bold" - labelFontpixelSize: 25 - labelText: "Entrée" - scale: 0.8 - } - - Key { - id: key24 - x: 210 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: 'W' - scale: 0.8 - } - - Key { - id: key25 - x: 280 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "X" - scale: 0.8 - } - - Key { - id: key26 - x: 350 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "C" - scale: 0.8 - } - - Key { - id: key27 - x: 420 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "V" - scale: 0.8 - } - - Key { - id: key28 - x: 490 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - labelText: "B" - scale: 0.8 - } - - Key { - id: key29 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - scale: 0.8 - labelText: "N" - } - - Key { - id: key30 - width: 50 - height: 70 - anchors.verticalCenter: parent.verticalCenter - scale: 0.8 - labelText: "M" - } - - BackKey { - id: backKey - anchors.verticalCenter: parent.verticalCenter - - } - } - } - - } - } -