diff --git a/game/settings.cpp b/game/settings.cpp index 1487d80..e2287d1 100644 --- a/game/settings.cpp +++ b/game/settings.cpp @@ -63,7 +63,7 @@ Settings::Settings() // If true, Eliot complains when the player does something illegal // If false, the word is accepted (with a score of 0) and the player does // not get a second chance - m_boolHandler.addOption("duplicate-reject-invalid", false); + m_boolHandler.addOption("duplicate-reject-invalid", true); // ============== Freegame mode options ============== @@ -73,7 +73,7 @@ Settings::Settings() // not get a second chance. // Trying to change letters or to pass the turn in an incorrect way will // be rejected in any case. - m_boolHandler.addOption("freegame-reject-invalid", false); + m_boolHandler.addOption("freegame-reject-invalid", true); } diff --git a/po/eliot.pot b/po/eliot.pot index c4471f1..aac8ed9 100644 --- a/po/eliot.pot +++ b/po/eliot.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-09-07 10:38+0200\n" +"POT-Creation-Date: 2008-09-07 22:31+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -309,7 +309,7 @@ msgstr "" msgid " N | RACK | SOLUTION | REF | PTS | P | BONUS" msgstr "" -#: utils/ncurses.cpp:414 qt/history_widget.cpp:143 qt/main_window.cpp:545 +#: utils/ncurses.cpp:414 qt/history_widget.cpp:143 qt/main_window.cpp:560 msgid "(PASS)" msgstr "" @@ -415,7 +415,7 @@ msgstr "" msgid " Ctrl-l Refresh the screen" msgstr "" -#: utils/ncurses.cpp:486 wxwin/auxframes.cc:147 qt/main_window.cpp:628 +#: utils/ncurses.cpp:486 wxwin/auxframes.cc:147 qt/main_window.cpp:643 #: qt/ui/main_window.ui:94 msgid "Bag" msgstr "" @@ -481,7 +481,7 @@ msgid "Game saved in '%ls'" msgstr "" #: utils/ncurses.cpp:632 wxwin/mainframe.cc:275 wxwin/mainframe.cc:405 -#: wxwin/mainframe.cc:429 qt/main_window.cpp:390 +#: wxwin/mainframe.cc:429 qt/main_window.cpp:405 msgid "Load a game" msgstr "" @@ -495,7 +495,7 @@ msgstr "" msgid "Invalid saved game" msgstr "" -#: utils/ncurses.cpp:656 qt/main_window.cpp:404 +#: utils/ncurses.cpp:656 qt/main_window.cpp:419 #, c-format msgid "Game loaded" msgstr "" @@ -797,7 +797,7 @@ msgstr "" msgid "&New game\tCtrl+N" msgstr "" -#: wxwin/mainframe.cc:272 qt/main_window.cpp:308 +#: wxwin/mainframe.cc:272 qt/main_window.cpp:323 msgid "Start a new game" msgstr "" @@ -817,7 +817,7 @@ msgstr "" msgid "&Save as...\tCtrl+S" msgstr "" -#: wxwin/mainframe.cc:276 qt/main_window.cpp:313 +#: wxwin/mainframe.cc:276 qt/main_window.cpp:328 msgid "Save the current game" msgstr "" @@ -849,7 +849,7 @@ msgstr "" msgid "&Quit\tCtrl+Q" msgstr "" -#: wxwin/mainframe.cc:284 qt/main_window.cpp:319 +#: wxwin/mainframe.cc:284 qt/main_window.cpp:334 msgid "Quit Eliot" msgstr "" @@ -857,7 +857,7 @@ msgstr "" msgid "&Dictionary...\tCtrl+D" msgstr "" -#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 qt/main_window.cpp:595 +#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 qt/main_window.cpp:610 msgid "Choose a dictionary" msgstr "" @@ -966,7 +966,7 @@ msgid "Font for the search" msgstr "" #: wxwin/mainframe.cc:310 wxwin/mainframe.cc:334 qt/history_widget.cpp:177 -#: qt/main_window.cpp:306 +#: qt/main_window.cpp:321 msgid "&Game" msgstr "" @@ -1062,24 +1062,24 @@ msgstr "" msgid "R&esults" msgstr "" -#: wxwin/mainframe.cc:331 qt/main_window.cpp:344 +#: wxwin/mainframe.cc:331 qt/main_window.cpp:359 msgid "&About..." msgstr "" -#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 qt/main_window.cpp:345 -#: qt/main_window.cpp:706 +#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 qt/main_window.cpp:360 +#: qt/main_window.cpp:721 msgid "About Eliot" msgstr "" -#: wxwin/mainframe.cc:335 qt/main_window.cpp:323 +#: wxwin/mainframe.cc:335 qt/main_window.cpp:338 msgid "&Settings" msgstr "" -#: wxwin/mainframe.cc:336 qt/main_window.cpp:331 +#: wxwin/mainframe.cc:336 qt/main_window.cpp:346 msgid "&Windows" msgstr "" -#: wxwin/mainframe.cc:337 qt/main_window.cpp:343 +#: wxwin/mainframe.cc:337 qt/main_window.cpp:358 msgid "&Help" msgstr "" @@ -1096,7 +1096,7 @@ msgstr "" msgid "Cannot open " msgstr "" -#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 qt/main_window.cpp:397 +#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 qt/main_window.cpp:412 msgid "Error while loading the game" msgstr "" @@ -1216,7 +1216,7 @@ msgid "Points" msgstr "" #: qt/dic_tools_widget.cpp:87 qt/dic_tools_widget.cpp:92 -#: qt/ui/player_widget.ui:19 qt/ui/training_widget.ui:21 +#: qt/ui/player_widget.ui:16 qt/ui/training_widget.ui:21 msgid "Rack:" msgstr "" @@ -1261,7 +1261,7 @@ msgstr "" msgid "Player" msgstr "" -#: qt/main_window.cpp:109 qt/main_window.cpp:646 qt/ui/main_window.ui:40 +#: qt/main_window.cpp:109 qt/main_window.cpp:661 qt/ui/main_window.ui:40 msgid "Board" msgstr "" @@ -1282,185 +1282,205 @@ msgstr "" msgid "Free game" msgstr "" -#: qt/main_window.cpp:237 -msgid "%1 error" +#: qt/main_window.cpp:233 +msgid "Dictionary: %1" msgstr "" -#: qt/main_window.cpp:307 +#: qt/main_window.cpp:238 +msgid "Dictionary: Unknown (old format)" +msgstr "" + +#: qt/main_window.cpp:239 +msgid "" +"The dictionary name cannot be retrieved, because you are using an old " +"dictionary format.\n" +"You can probably download a newer version of the dictionary on http://www." +"nongnu.org/eliot/" +msgstr "" + +#: qt/main_window.cpp:252 +msgid "Eliot - Error" +msgstr "" + +#: qt/main_window.cpp:322 msgid "&New..." msgstr "" -#: qt/main_window.cpp:307 +#: qt/main_window.cpp:322 msgid "Ctrl+N" msgstr "" -#: qt/main_window.cpp:310 +#: qt/main_window.cpp:325 msgid "&Load..." msgstr "" -#: qt/main_window.cpp:310 +#: qt/main_window.cpp:325 msgid "Ctrl+O" msgstr "" -#: qt/main_window.cpp:311 +#: qt/main_window.cpp:326 msgid "Load an existing game" msgstr "" -#: qt/main_window.cpp:312 +#: qt/main_window.cpp:327 msgid "&Save as..." msgstr "" -#: qt/main_window.cpp:312 +#: qt/main_window.cpp:327 msgid "Ctrl+S" msgstr "" -#: qt/main_window.cpp:315 +#: qt/main_window.cpp:330 msgid "&Print..." msgstr "" -#: qt/main_window.cpp:315 +#: qt/main_window.cpp:330 msgid "Ctrl+P" msgstr "" -#: qt/main_window.cpp:316 +#: qt/main_window.cpp:331 msgid "Print the current game" msgstr "" -#: qt/main_window.cpp:318 +#: qt/main_window.cpp:333 msgid "&Quit" msgstr "" -#: qt/main_window.cpp:318 +#: qt/main_window.cpp:333 msgid "Ctrl+Q" msgstr "" -#: qt/main_window.cpp:324 +#: qt/main_window.cpp:339 msgid "&Choose dictionary..." msgstr "" -#: qt/main_window.cpp:325 +#: qt/main_window.cpp:339 +msgid "Ctrl+C" +msgstr "" + +#: qt/main_window.cpp:340 msgid "Select a new dictionary" msgstr "" -#: qt/main_window.cpp:326 +#: qt/main_window.cpp:341 msgid "&Preferences..." msgstr "" -#: qt/main_window.cpp:326 +#: qt/main_window.cpp:341 msgid "Ctrl+F" msgstr "" -#: qt/main_window.cpp:327 +#: qt/main_window.cpp:342 msgid "Edit the preferences" msgstr "" -#: qt/main_window.cpp:332 +#: qt/main_window.cpp:347 msgid "&Bag" msgstr "" -#: qt/main_window.cpp:332 +#: qt/main_window.cpp:347 msgid "Ctrl+B" msgstr "" -#: qt/main_window.cpp:333 qt/ui/main_window.ui:97 +#: qt/main_window.cpp:348 qt/ui/main_window.ui:97 msgid "Show/hide the remaining tiles in the bag" msgstr "" -#: qt/main_window.cpp:334 +#: qt/main_window.cpp:349 msgid "&External board" msgstr "" -#: qt/main_window.cpp:334 +#: qt/main_window.cpp:349 msgid "Ctrl+E" msgstr "" -#: qt/main_window.cpp:335 qt/ui/main_window.ui:111 +#: qt/main_window.cpp:350 qt/ui/main_window.ui:111 msgid "Show/hide the external board" msgstr "" -#: qt/main_window.cpp:336 +#: qt/main_window.cpp:351 msgid "&History" msgstr "" -#: qt/main_window.cpp:336 +#: qt/main_window.cpp:351 msgid "Ctrl+H" msgstr "" -#: qt/main_window.cpp:337 qt/ui/main_window.ui:125 +#: qt/main_window.cpp:352 qt/ui/main_window.ui:125 msgid "Show/hide the game history" msgstr "" -#: qt/main_window.cpp:338 +#: qt/main_window.cpp:353 msgid "&Dictionary tools" msgstr "" -#: qt/main_window.cpp:338 +#: qt/main_window.cpp:353 msgid "Ctrl+D" msgstr "" -#: qt/main_window.cpp:339 qt/ui/main_window.ui:139 +#: qt/main_window.cpp:354 qt/ui/main_window.ui:139 msgid "Show/hide the dictionary tools" msgstr "" -#: qt/main_window.cpp:344 +#: qt/main_window.cpp:359 msgid "Ctrl+A" msgstr "" -#: qt/main_window.cpp:353 qt/main_window.cpp:386 +#: qt/main_window.cpp:368 qt/main_window.cpp:401 msgid "You have to select a dictionary first!" msgstr "" -#: qt/main_window.cpp:378 +#: qt/main_window.cpp:393 msgid "Game started" msgstr "" -#: qt/main_window.cpp:414 +#: qt/main_window.cpp:429 msgid "Save a game" msgstr "" -#: qt/main_window.cpp:419 +#: qt/main_window.cpp:434 msgid "Game saved" msgstr "" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "N." msgstr "" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "RACK" msgstr "" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "SOLUTION" msgstr "" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "REF" msgstr "" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "PTS" msgstr "" -#: qt/main_window.cpp:586 +#: qt/main_window.cpp:601 msgid "Stop current game?" msgstr "" -#: qt/main_window.cpp:587 +#: qt/main_window.cpp:602 msgid "" "Loading a dictionary will stop the current game. Do you want to continue?" msgstr "" -#: qt/main_window.cpp:664 qt/ui/main_window.ui:53 qt/ui/main_window.ui:122 +#: qt/main_window.cpp:679 qt/ui/main_window.ui:53 qt/ui/main_window.ui:122 msgid "History" msgstr "" -#: qt/main_window.cpp:681 qt/ui/dic_tools_widget.ui:13 +#: qt/main_window.cpp:696 qt/ui/dic_tools_widget.ui:13 #: qt/ui/main_window.ui:136 msgid "Dictionary tools" msgstr "" -#: qt/main_window.cpp:698 +#: qt/main_window.cpp:713 msgid "" "Copyright (C) 1999-2008 - Antoine Fraboulet & Olivier Teuliere\n" "\n" @@ -1503,15 +1523,82 @@ msgstr "" msgid "Duplicate" msgstr "" -#: qt/player_widget.cpp:156 -msgid "Cannot play '%1' at position '%2': incorrect or misplaced word (%3)" +#: qt/player_widget.cpp:81 +msgid "" +"Enter the word to play (case-insensitive).\n" +"A joker from the rack must be written in parentheses.\n" +"E.g.: w(o)rd or W(O)RD" msgstr "" -#: qt/player_widget.cpp:179 +#: qt/player_widget.cpp:84 +msgid "" +"Enter the coordinates of the word.\n" +"Specify the row before the column for horizontal words,\n" +"and the column before the row for vertical words.\n" +"E.g.: H4 or 4H" +msgstr "" + +#: qt/player_widget.cpp:173 +msgid "Cannot play word: misplaced parentheses" +msgstr "" + +#: qt/player_widget.cpp:194 +msgid "Cannot play '%1' at position '%2':\n" +msgstr "" + +#: qt/player_widget.cpp:198 +msgid "Some letters are not valid for the current dictionary" +msgstr "" + +#: qt/player_widget.cpp:201 +msgid "Invalid coordinates" +msgstr "" + +#: qt/player_widget.cpp:204 +msgid "The word does not exist" +msgstr "" + +#: qt/player_widget.cpp:207 +msgid "The rack doesn't contain the letters needed to play this word" +msgstr "" + +#: qt/player_widget.cpp:210 +msgid "The word is part of a longer one" +msgstr "" + +#: qt/player_widget.cpp:213 +msgid "The word tries to replace an existing letter" +msgstr "" + +#: qt/player_widget.cpp:216 +msgid "The word is going out of the board, or an orthogonal word is not valid" +msgstr "" + +#: qt/player_widget.cpp:219 +msgid "The word is already present on the board at these coordinates" +msgstr "" + +#: qt/player_widget.cpp:222 +msgid "A word cannot be isolated (not connected to the placed words)" +msgstr "" + +#: qt/player_widget.cpp:225 +msgid "The first word of the game must be horizontal" +msgstr "" + +#: qt/player_widget.cpp:228 +msgid "The first word of the game must cover the H8 square" +msgstr "" + +#: qt/player_widget.cpp:231 +msgid "Incorrect or misplaced word (%1)" +msgstr "" + +#: qt/player_widget.cpp:255 msgid "Cannot pass turn (%1)" msgstr "" -#: qt/player_widget.cpp:181 +#: qt/player_widget.cpp:257 msgid "Cannot change letters '%1' (%2)" msgstr "" @@ -1575,40 +1662,59 @@ msgstr "" msgid "Remove player" msgstr "" -#: qt/ui/player_widget.ui:36 +#: qt/ui/player_widget.ui:33 msgid "Shuffle" msgstr "" -#: qt/ui/player_widget.ui:43 +#: qt/ui/player_widget.ui:40 msgid "Play a word:" msgstr "" -#: qt/ui/player_widget.ui:50 qt/ui/player_widget.ui:53 +#: qt/ui/player_widget.ui:52 msgid "" -"To play a word, enter the word (case sensitive) and its coordinates. E.g.: " -"WORD H4" +"Enter the word to play (case-insensitive). A joker from the rack must be " +"written in parentheses. E.g.: w(o)rd or W(O)RD" msgstr "" -#: qt/ui/player_widget.ui:63 qt/ui/training_widget.ui:62 +#: qt/ui/player_widget.ui:80 +msgid "" +"Enter the coordinates of the word. Specify the row before the column for " +"horizontal words, and the column before the row for vertical words. E.g.: H4 " +"or 4H" +msgstr "" + +#: qt/ui/player_widget.ui:87 qt/ui/training_widget.ui:62 msgid "Play" msgstr "" -#: qt/ui/player_widget.ui:70 +#: qt/ui/player_widget.ui:94 msgid "Change letters:" msgstr "" -#: qt/ui/player_widget.ui:77 +#: qt/ui/player_widget.ui:101 msgid "Enter the letters you want to change" msgstr "" -#: qt/ui/player_widget.ui:87 +#: qt/ui/player_widget.ui:111 msgid "Change" msgstr "" -#: qt/ui/player_widget.ui:94 +#: qt/ui/player_widget.ui:118 msgid "Pass" msgstr "" +#: qt/ui/player_widget.ui:125 +msgid "Ref.:" +msgstr "" + +#: qt/ui/player_widget.ui:74 +msgid "Enter the coordinates of the word." +msgstr "" + +#: qt/ui/player_widget.ui:47 +msgid "Enter the word to play (case-insensitive)." +msgstr "" + #: qt/ui/prefs_dialog.ui:13 msgid "Preferences" msgstr "" diff --git a/po/fr.po b/po/fr.po index 5739b0a..07dd2a1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: eliot 1.7\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-09-07 10:38+0200\n" +"POT-Creation-Date: 2008-09-07 22:31+0200\n" "PO-Revision-Date: 2008-08-31 10:43+0100\n" "Last-Translator: Olivier Teuliere \n" "Language-Team: French \n" @@ -327,7 +327,7 @@ msgstr "Historique de la partie" msgid " N | RACK | SOLUTION | REF | PTS | P | BONUS" msgstr " N | TIRAGE | SOLUTION | REF | PTS | J | BONUS" -#: utils/ncurses.cpp:414 qt/history_widget.cpp:143 qt/main_window.cpp:545 +#: utils/ncurses.cpp:414 qt/history_widget.cpp:143 qt/main_window.cpp:560 msgid "(PASS)" msgstr "(PASSE)" @@ -438,7 +438,7 @@ msgstr " , Naviguer dans une boîte page par page" msgid " Ctrl-l Refresh the screen" msgstr " Ctrl-l Rafraîchir l'écran" -#: utils/ncurses.cpp:486 wxwin/auxframes.cc:147 qt/main_window.cpp:628 +#: utils/ncurses.cpp:486 wxwin/auxframes.cc:147 qt/main_window.cpp:643 #: qt/ui/main_window.ui:94 msgid "Bag" msgstr "Sac" @@ -504,7 +504,7 @@ msgid "Game saved in '%ls'" msgstr "Partie sauvée dans '%ls'" #: utils/ncurses.cpp:632 wxwin/mainframe.cc:275 wxwin/mainframe.cc:405 -#: wxwin/mainframe.cc:429 qt/main_window.cpp:390 +#: wxwin/mainframe.cc:429 qt/main_window.cpp:405 msgid "Load a game" msgstr "Charger une partie" @@ -518,7 +518,7 @@ msgstr "Impossible d'ouvrir le fichier '%ls' en lecture" msgid "Invalid saved game" msgstr "Partie sauvée invalide" -#: utils/ncurses.cpp:656 qt/main_window.cpp:404 +#: utils/ncurses.cpp:656 qt/main_window.cpp:419 #, c-format msgid "Game loaded" msgstr "Partie chargée" @@ -820,7 +820,7 @@ msgstr "Jouer le mot selectionné" msgid "&New game\tCtrl+N" msgstr "&Nouvelle partie\tCtrl+N" -#: wxwin/mainframe.cc:272 qt/main_window.cpp:308 +#: wxwin/mainframe.cc:272 qt/main_window.cpp:323 msgid "Start a new game" msgstr "Démarrer une nouvelle partie" @@ -840,7 +840,7 @@ msgstr "&Charger...\tCtrl+O" msgid "&Save as...\tCtrl+S" msgstr "&Enregistrer sous...\tCtrl+S" -#: wxwin/mainframe.cc:276 qt/main_window.cpp:313 +#: wxwin/mainframe.cc:276 qt/main_window.cpp:328 msgid "Save the current game" msgstr "Sauvegarder la partie en cours" @@ -872,7 +872,7 @@ msgstr "Imprimer dans un fichier PostScript" msgid "&Quit\tCtrl+Q" msgstr "&Quitter\tCtrl+Q" -#: wxwin/mainframe.cc:284 qt/main_window.cpp:319 +#: wxwin/mainframe.cc:284 qt/main_window.cpp:334 msgid "Quit Eliot" msgstr "Quitter Eliot" @@ -880,7 +880,7 @@ msgstr "Quitter Eliot" msgid "&Dictionary...\tCtrl+D" msgstr "&Dictionnaire...\tCtrl+D" -#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 qt/main_window.cpp:595 +#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 qt/main_window.cpp:610 msgid "Choose a dictionary" msgstr "Choisir un dictionnaire" @@ -989,7 +989,7 @@ msgid "Font for the search" msgstr "Police de caractères pour la recherche" #: wxwin/mainframe.cc:310 wxwin/mainframe.cc:334 qt/history_widget.cpp:177 -#: qt/main_window.cpp:306 +#: qt/main_window.cpp:321 msgid "&Game" msgstr "&Partie" @@ -1085,24 +1085,24 @@ msgstr "&Historique de la partie\tCtrl+H" msgid "R&esults" msgstr "Ré&sultats" -#: wxwin/mainframe.cc:331 qt/main_window.cpp:344 +#: wxwin/mainframe.cc:331 qt/main_window.cpp:359 msgid "&About..." msgstr "À &propos..." -#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 qt/main_window.cpp:345 -#: qt/main_window.cpp:706 +#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 qt/main_window.cpp:360 +#: qt/main_window.cpp:721 msgid "About Eliot" msgstr "À propos d'Eliot" -#: wxwin/mainframe.cc:335 qt/main_window.cpp:323 +#: wxwin/mainframe.cc:335 qt/main_window.cpp:338 msgid "&Settings" msgstr "Para&mètres" -#: wxwin/mainframe.cc:336 qt/main_window.cpp:331 +#: wxwin/mainframe.cc:336 qt/main_window.cpp:346 msgid "&Windows" msgstr "&Fenêtres" -#: wxwin/mainframe.cc:337 qt/main_window.cpp:343 +#: wxwin/mainframe.cc:337 qt/main_window.cpp:358 msgid "&Help" msgstr "&Aide" @@ -1119,7 +1119,7 @@ msgstr "Eliot : erreur" msgid "Cannot open " msgstr "Impossible d'ouvrir " -#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 qt/main_window.cpp:397 +#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 qt/main_window.cpp:412 msgid "Error while loading the game" msgstr "Erreur pendant le chargement de la partie" @@ -1246,7 +1246,7 @@ msgid "Points" msgstr "Points" #: qt/dic_tools_widget.cpp:87 qt/dic_tools_widget.cpp:92 -#: qt/ui/player_widget.ui:19 qt/ui/training_widget.ui:21 +#: qt/ui/player_widget.ui:16 qt/ui/training_widget.ui:21 msgid "Rack:" msgstr "Tirage :" @@ -1291,7 +1291,7 @@ msgstr "Ref" msgid "Player" msgstr "Joueur" -#: qt/main_window.cpp:109 qt/main_window.cpp:646 qt/ui/main_window.ui:40 +#: qt/main_window.cpp:109 qt/main_window.cpp:661 qt/ui/main_window.ui:40 msgid "Board" msgstr "Grille" @@ -1313,186 +1313,210 @@ msgstr "Partie duplicate" msgid "Free game" msgstr "Partie libre" -#: qt/main_window.cpp:237 -msgid "%1 error" -msgstr "Erreur %1" +#: qt/main_window.cpp:233 +msgid "Dictionary: %1" +msgstr "Dictionnaire : %1" -#: qt/main_window.cpp:307 +#: qt/main_window.cpp:238 +msgid "Dictionary: Unknown (old format)" +msgstr "Dictionnaire : Inconnu (vieux format)" + +#: qt/main_window.cpp:239 +msgid "" +"The dictionary name cannot be retrieved, because you are using an old " +"dictionary format.\n" +"You can probably download a newer version of the dictionary on http://www." +"nongnu.org/eliot/" +msgstr "" +"Le nom du dictionnaire ne peut pas être récupéré, car vous utilisez un vieux " +"format de dictionnaire.\n" +"Vous ouvez probablement télécharger une nouvelle version du dictionnaire sur " +"http://www.nongnu.org/eliot/" + +#: qt/main_window.cpp:252 +msgid "Eliot - Error" +msgstr "Eliot - erreur" + +#: qt/main_window.cpp:322 msgid "&New..." msgstr "&Nouvelle partie..." -#: qt/main_window.cpp:307 +#: qt/main_window.cpp:322 msgid "Ctrl+N" msgstr "Ctrl+N" -#: qt/main_window.cpp:310 +#: qt/main_window.cpp:325 msgid "&Load..." msgstr "&Charger..." -#: qt/main_window.cpp:310 +#: qt/main_window.cpp:325 msgid "Ctrl+O" msgstr "Ctrl-O" -#: qt/main_window.cpp:311 +#: qt/main_window.cpp:326 msgid "Load an existing game" msgstr "Charger une partie existante" -#: qt/main_window.cpp:312 +#: qt/main_window.cpp:327 msgid "&Save as..." msgstr "&Enregistrer sous..." -#: qt/main_window.cpp:312 +#: qt/main_window.cpp:327 msgid "Ctrl+S" msgstr "Ctrl+S" -#: qt/main_window.cpp:315 +#: qt/main_window.cpp:330 msgid "&Print..." msgstr "Im&primer..." -#: qt/main_window.cpp:315 +#: qt/main_window.cpp:330 msgid "Ctrl+P" msgstr "Ctrl+P" -#: qt/main_window.cpp:316 +#: qt/main_window.cpp:331 msgid "Print the current game" msgstr "Imprimer la partie en cours" -#: qt/main_window.cpp:318 +#: qt/main_window.cpp:333 msgid "&Quit" msgstr "&Quitter" -#: qt/main_window.cpp:318 +#: qt/main_window.cpp:333 msgid "Ctrl+Q" msgstr "Ctrl+Q" -#: qt/main_window.cpp:324 +#: qt/main_window.cpp:339 msgid "&Choose dictionary..." msgstr "Choisir un &dictionnaire..." -#: qt/main_window.cpp:325 +#: qt/main_window.cpp:339 +msgid "Ctrl+C" +msgstr "Ctrl+C" + +#: qt/main_window.cpp:340 msgid "Select a new dictionary" msgstr "Choisir un nouveau dictionnaire" -#: qt/main_window.cpp:326 +#: qt/main_window.cpp:341 msgid "&Preferences..." msgstr "&Préférences..." -#: qt/main_window.cpp:326 +#: qt/main_window.cpp:341 msgid "Ctrl+F" msgstr "Ctrl+F" -#: qt/main_window.cpp:327 +#: qt/main_window.cpp:342 msgid "Edit the preferences" msgstr "Modifier les préférences" -#: qt/main_window.cpp:332 +#: qt/main_window.cpp:347 msgid "&Bag" msgstr "&Sac" -#: qt/main_window.cpp:332 +#: qt/main_window.cpp:347 msgid "Ctrl+B" msgstr "Ctrl+B" -#: qt/main_window.cpp:333 qt/ui/main_window.ui:97 +#: qt/main_window.cpp:348 qt/ui/main_window.ui:97 msgid "Show/hide the remaining tiles in the bag" msgstr "Afficher/cacher les lettres restantes dans le sac" -#: qt/main_window.cpp:334 +#: qt/main_window.cpp:349 msgid "&External board" msgstr "&Plateau de jeu externe" -#: qt/main_window.cpp:334 +#: qt/main_window.cpp:349 msgid "Ctrl+E" msgstr "Ctrl+E" -#: qt/main_window.cpp:335 qt/ui/main_window.ui:111 +#: qt/main_window.cpp:350 qt/ui/main_window.ui:111 msgid "Show/hide the external board" msgstr "Afficher/cacher le plateau de jeu externe" -#: qt/main_window.cpp:336 +#: qt/main_window.cpp:351 msgid "&History" msgstr "&Historique" -#: qt/main_window.cpp:336 +#: qt/main_window.cpp:351 msgid "Ctrl+H" msgstr "Ctrl+H" -#: qt/main_window.cpp:337 qt/ui/main_window.ui:125 +#: qt/main_window.cpp:352 qt/ui/main_window.ui:125 msgid "Show/hide the game history" msgstr "Afficher/cacher l'historique de la partie" -#: qt/main_window.cpp:338 +#: qt/main_window.cpp:353 msgid "&Dictionary tools" msgstr "Outils du &dictionnaire" -#: qt/main_window.cpp:338 +#: qt/main_window.cpp:353 msgid "Ctrl+D" msgstr "Ctrl+D" -#: qt/main_window.cpp:339 qt/ui/main_window.ui:139 +#: qt/main_window.cpp:354 qt/ui/main_window.ui:139 msgid "Show/hide the dictionary tools" msgstr "Afficher/cacher les outils de recherche dans le dictionnaire" -#: qt/main_window.cpp:344 +#: qt/main_window.cpp:359 msgid "Ctrl+A" msgstr "Ctrl+A" -#: qt/main_window.cpp:353 qt/main_window.cpp:386 +#: qt/main_window.cpp:368 qt/main_window.cpp:401 msgid "You have to select a dictionary first!" msgstr "Vous devez d'abord choisir un dictionnaire !" -#: qt/main_window.cpp:378 +#: qt/main_window.cpp:393 msgid "Game started" msgstr "Partie démarrée" -#: qt/main_window.cpp:414 +#: qt/main_window.cpp:429 msgid "Save a game" msgstr "Sauvegarder la partie" -#: qt/main_window.cpp:419 +#: qt/main_window.cpp:434 msgid "Game saved" msgstr "Partie enregistrée" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "N." msgstr "N." -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "RACK" msgstr "TIRAGE" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "SOLUTION" msgstr "SOLUTION" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "REF" msgstr "REF" -#: qt/main_window.cpp:453 +#: qt/main_window.cpp:468 msgid "PTS" msgstr "PTS" -#: qt/main_window.cpp:586 +#: qt/main_window.cpp:601 msgid "Stop current game?" msgstr "Arrêter la partie en cours ?" -#: qt/main_window.cpp:587 +#: qt/main_window.cpp:602 msgid "" "Loading a dictionary will stop the current game. Do you want to continue?" msgstr "" "Charger un dictionnaire arrêtera la partie en cours. Voulez-vous continuer ?" -#: qt/main_window.cpp:664 qt/ui/main_window.ui:53 qt/ui/main_window.ui:122 +#: qt/main_window.cpp:679 qt/ui/main_window.ui:53 qt/ui/main_window.ui:122 msgid "History" msgstr "Historique" -#: qt/main_window.cpp:681 qt/ui/dic_tools_widget.ui:13 +#: qt/main_window.cpp:696 qt/ui/dic_tools_widget.ui:13 #: qt/ui/main_window.ui:136 msgid "Dictionary tools" msgstr "Outils du dictionnaire" -#: qt/main_window.cpp:698 +#: qt/main_window.cpp:713 msgid "" "Copyright (C) 1999-2008 - Antoine Fraboulet & Olivier Teuliere\n" "\n" @@ -1541,15 +1565,90 @@ msgstr "Eliot" msgid "Duplicate" msgstr "Duplicate" -#: qt/player_widget.cpp:156 -msgid "Cannot play '%1' at position '%2': incorrect or misplaced word (%3)" -msgstr "Impossible de jouer '%1' en '%2' : mot incorrect ou mal placé (%3)" +#: qt/player_widget.cpp:81 +msgid "" +"Enter the word to play (case-insensitive).\n" +"A joker from the rack must be written in parentheses.\n" +"E.g.: w(o)rd or W(O)RD" +msgstr "" +"Entrer le mot à jouer (insensible à la casse).\n" +"Un joker provenant du chevalet doit être écrit entre parenthèses.\n" +"Ex. : m(o)( ou M(O)T" -#: qt/player_widget.cpp:179 +#: qt/player_widget.cpp:84 +msgid "" +"Enter the coordinates of the word.\n" +"Specify the row before the column for horizontal words,\n" +"and the column before the row for vertical words.\n" +"E.g.: H4 or 4H" +msgstr "" +"Entrer les coordonnées du mot.\n" +"Spécifier la rangée avant la colonne pour les mots horizontaux,\n" +"et la colonne avant la rangée pour les mots verticaux.\n" +"Ex. : H4 ou 4H" + +#: qt/player_widget.cpp:173 +msgid "Cannot play word: misplaced parentheses" +msgstr "Impossible de jouer le mot : parenthèses mal placées" + +#: qt/player_widget.cpp:194 +msgid "Cannot play '%1' at position '%2':\n" +msgstr "Impossible de jouer '%1' en '%2' :\n" + +#: qt/player_widget.cpp:198 +msgid "Some letters are not valid for the current dictionary" +msgstr "" +"Le tirage contient des lettres incorrectes pour le dictionnaire courant" + +#: qt/player_widget.cpp:201 +msgid "Invalid coordinates" +msgstr "Coordonnées invalides" + +#: qt/player_widget.cpp:204 +msgid "The word does not exist" +msgstr "Le mot n'existe pas" + +#: qt/player_widget.cpp:207 +msgid "The rack doesn't contain the letters needed to play this word" +msgstr "Le chevalet ne contient pas les lettres permettant de jouer ce mot" + +#: qt/player_widget.cpp:210 +msgid "The word is part of a longer one" +msgstr "Le mot fait partie d'un autre mot plus long" + +#: qt/player_widget.cpp:213 +msgid "The word tries to replace an existing letter" +msgstr "Le mot remplace une lettre existante" + +#: qt/player_widget.cpp:216 +msgid "The word is going out of the board, or an orthogonal word is not valid" +msgstr "Le mot sort de la grille, ou un mot orthogonal est invalide" + +#: qt/player_widget.cpp:219 +msgid "The word is already present on the board at these coordinates" +msgstr "Le mot est déjà présent sur la grille à cette position" + +#: qt/player_widget.cpp:222 +msgid "A word cannot be isolated (not connected to the placed words)" +msgstr "Un mot ne peut pas être isolé (non connecté aux autres mots placés)" + +#: qt/player_widget.cpp:225 +msgid "The first word of the game must be horizontal" +msgstr "Le premier mot de la partie doit être horizontal" + +#: qt/player_widget.cpp:228 +msgid "The first word of the game must cover the H8 square" +msgstr "Le premier mot de la partie doit couvrir la case H8" + +#: qt/player_widget.cpp:231 +msgid "Incorrect or misplaced word (%1)" +msgstr "Mot incorrect ou mal placé (%1)" + +#: qt/player_widget.cpp:255 msgid "Cannot pass turn (%1)" msgstr "Impossible de passer le tour (%1)" -#: qt/player_widget.cpp:181 +#: qt/player_widget.cpp:257 msgid "Cannot change letters '%1' (%2)" msgstr "Impossible de changer les lettres '%1' (%2)" @@ -1613,42 +1712,64 @@ msgstr "Ajouter un joueur" msgid "Remove player" msgstr "Supprimer un joueur" -#: qt/ui/player_widget.ui:36 +#: qt/ui/player_widget.ui:33 msgid "Shuffle" msgstr "Mélanger" -#: qt/ui/player_widget.ui:43 +#: qt/ui/player_widget.ui:40 msgid "Play a word:" msgstr "Jouer le mot :" -#: qt/ui/player_widget.ui:50 qt/ui/player_widget.ui:53 +#: qt/ui/player_widget.ui:52 msgid "" -"To play a word, enter the word (case sensitive) and its coordinates. E.g.: " -"WORD H4" +"Enter the word to play (case-insensitive). A joker from the rack must be " +"written in parentheses. E.g.: w(o)rd or W(O)RD" msgstr "" -"Pour jouer un mot, entrer le mot (sensible à la casse) puis ses coordonnées. " -"Par exemple : MOT H7" +"Entrer le mot à jouer (insensible à la casse). Un joker provenant du " +"chevalet doit être écrit entre parenthèses. Ex. : m(o)( ou M(O)T" -#: qt/ui/player_widget.ui:63 qt/ui/training_widget.ui:62 +#: qt/ui/player_widget.ui:80 +msgid "" +"Enter the coordinates of the word. Specify the row before the column for " +"horizontal words, and the column before the row for vertical words. E.g.: H4 " +"or 4H" +msgstr "" +"Entrer les coordonnées du mot. Spécifier la rangée avant la colonne pour les " +"mots horizontaux, et la colonne avant la rangée pour les mots verticaux. " +"Ex. : H4 ou 4H" + +#: qt/ui/player_widget.ui:87 qt/ui/training_widget.ui:62 msgid "Play" msgstr "Jouer" -#: qt/ui/player_widget.ui:70 +#: qt/ui/player_widget.ui:94 msgid "Change letters:" msgstr "Lettres à changer :" -#: qt/ui/player_widget.ui:77 +#: qt/ui/player_widget.ui:101 msgid "Enter the letters you want to change" msgstr "Entrer les lettres à changer" -#: qt/ui/player_widget.ui:87 +#: qt/ui/player_widget.ui:111 msgid "Change" msgstr "Changer" -#: qt/ui/player_widget.ui:94 +#: qt/ui/player_widget.ui:118 msgid "Pass" msgstr "Passer" +#: qt/ui/player_widget.ui:125 +msgid "Ref.:" +msgstr "Ref. :" + +#: qt/ui/player_widget.ui:74 +msgid "Enter the coordinates of the word." +msgstr "Entrer les coordonnées du mot." + +#: qt/ui/player_widget.ui:47 +msgid "Enter the word to play (case-insensitive)." +msgstr "Entrer le mot à jouer (non sensible à la casse)." + #: qt/ui/prefs_dialog.ui:13 msgid "Preferences" msgstr "Préférences" @@ -1722,6 +1843,16 @@ msgstr "Nouveau tirage" msgid "Complement" msgstr "Complément" +#~ msgid "%1 error" +#~ msgstr "Erreur %1" + +#~ msgid "" +#~ "To play a word, enter the word (case sensitive) and its coordinates. E." +#~ "g.: WORD H4" +#~ msgstr "" +#~ "Pour jouer un mot, entrer le mot (sensible à la casse) puis ses " +#~ "coordonnées. Par exemple : MOT H7" + #~ msgid "Choose dictionary..." #~ msgstr "Choisir un &dictionnaire..." diff --git a/qt/board_widget.cpp b/qt/board_widget.cpp index 248db88..c549a48 100644 --- a/qt/board_widget.cpp +++ b/qt/board_widget.cpp @@ -38,6 +38,8 @@ const QColor BoardWidget::W2Colour(255, 147, 196); const QColor BoardWidget::W3Colour(240, 80, 94); const QColor BoardWidget::TileColour(255, 235, 205); const QColor BoardWidget::PreviewColour(183, 183, 123); +const QColor BoardWidget::NormalColour(0, 0, 0); +const QColor BoardWidget::JokerColour(255, 0, 0); BoardWidget::BoardWidget(QWidget *parent) @@ -114,12 +116,13 @@ void BoardWidget::paintEvent(QPaintEvent *) { wchar_t chr = m_game->getBoard().getTile(row, col).toChar(); if (m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER) - chr = towlower(chr); + painter.setPen(JokerColour); painter.drawText((col - BOARD_MIN + 1) * squareSize, (row - BOARD_MIN + 1) * squareSize + 1, squareSize, squareSize, Qt::AlignCenter, qfw(wstring(1, chr))); + painter.setPen(NormalColour); } } } diff --git a/qt/board_widget.h b/qt/board_widget.h index 465b6ba..8f08bf2 100644 --- a/qt/board_widget.h +++ b/qt/board_widget.h @@ -57,6 +57,8 @@ private: static const QColor W3Colour; static const QColor TileColour; static const QColor PreviewColour; + static const QColor NormalColour; + static const QColor JokerColour; //@} }; diff --git a/qt/main_window.cpp b/qt/main_window.cpp index f799d91..f3a62a7 100644 --- a/qt/main_window.cpp +++ b/qt/main_window.cpp @@ -226,15 +226,30 @@ void MainWindow::updateStatusBar(const Dictionary *iDic) { if (iDic == NULL) m_dicNameLabel->setText("No dictionary"); - else - m_dicNameLabel->setText(qfw(m_dic->getHeader().getName())); + else { + if (iDic->getHeader().getVersion() != 0) + { + QString dicName = qfw(m_dic->getHeader().getName()); + m_dicNameLabel->setText(_q("Dictionary: %1").arg(dicName)); + m_dicNameLabel->setToolTip(""); + } + else + { + m_dicNameLabel->setText(_q("Dictionary: Unknown (old format)")); + QString warning = _q("The dictionary name cannot be " + "retrieved, because you are using an old dictionary format.\n" + "You can probably download a newer version of the dictionary " + "on http://www.nongnu.org/eliot/"); + m_dicNameLabel->setToolTip(warning); + } + } } void MainWindow::displayErrorMsg(QString iMsg, QString iContext) { if (iContext == "") - iContext = _q("%1 error").arg(PACKAGE_NAME); + iContext = _q("Eliot - Error"); QMessageBox::warning(this, iContext, iMsg); } @@ -321,7 +336,7 @@ void MainWindow::createMenu() QMenu *menuSettings = new QMenu(m_ui.menubar); m_ui.menubar->addAction(menuSettings->menuAction()); menuSettings->setTitle(_q("&Settings")); - addMenuAction(menuSettings, _q("&Choose dictionary..."), QString(""), + addMenuAction(menuSettings, _q("&Choose dictionary..."), _q("Ctrl+C"), _q("Select a new dictionary"), SLOT(onSettingsChooseDic())); addMenuAction(menuSettings, _q("&Preferences..."), _q("Ctrl+F"), _q("Edit the preferences"), SLOT(onSettingsPreferences())); diff --git a/qt/player_widget.cpp b/qt/player_widget.cpp index 6e7358f..9a361e2 100644 --- a/qt/player_widget.cpp +++ b/qt/player_widget.cpp @@ -50,7 +50,7 @@ private: }; -/// Validator used for the "change letters" line edit +/// Validator used for the "play word" line edit class PlayWordValidator: public QValidator { public: @@ -63,14 +63,33 @@ private: }; +/// Validator used for the "coords" line edit +class CoordsValidator: public QValidator +{ +public: + explicit CoordsValidator(QObject *parent); + virtual State validate(QString &input, int &pos) const; +}; + + PlayerWidget::PlayerWidget(QWidget *parent, unsigned int iPlayerNb, Game *iGame) : QWidget(parent), m_game(iGame), m_player(iPlayerNb) { setupUi(this); + lineEditPlay->setFocus(); + // These strings cannot be in the .ui file, because of the newlines + lineEditPlay->setToolTip(_q("Enter the word to play (case-insensitive).\n" + "A joker from the rack must be written in parentheses.\n" + "E.g.: w(o)rd or W(O)RD")); + lineEditCoords->setToolTip(_q("Enter the coordinates of the word.\n" + "Specify the row before the column for horizontal words,\n" + "and the column before the row for vertical words.\n" + "E.g.: H4 or 4H")); if (m_game) { lineEditPlay->setValidator(new PlayWordValidator(this, m_game->getDic())); + lineEditCoords->setValidator(new CoordsValidator(this)); // Do not allow messing with AI players if (!m_game->getPlayer(m_player).isHuman()) @@ -104,8 +123,6 @@ QSize PlayerWidget::sizeHint() const void PlayerWidget::refresh() { - lineEditPlay->clear(); - if (m_game == NULL) { lineEditRack->clear(); @@ -115,6 +132,7 @@ void PlayerWidget::refresh() const PlayedRack &pld = m_game->getPlayer(m_player).getCurrentRack(); lineEditRack->setText(qfw(pld.toString(PlayedRack::RACK_EXTRA))); lineEditPlay->clear(); + lineEditCoords->clear(); lineEditChange->clear(); } @@ -127,7 +145,8 @@ void PlayerWidget::on_pushButtonShuffle_clicked() void PlayerWidget::on_lineEditPlay_textChanged() { - pushButtonPlay->setEnabled(lineEditPlay->hasAcceptableInput()); + pushButtonPlay->setEnabled(lineEditPlay->hasAcceptableInput() && + lineEditCoords->hasAcceptableInput()); } @@ -141,20 +160,78 @@ void PlayerWidget::on_lineEditChange_textChanged() void PlayerWidget::on_lineEditPlay_returnPressed() { - QStringList items = lineEditPlay->text().split(' ', QString::SkipEmptyParts); - ASSERT(items.size() == 2, "Bug found in the validator"); + // Convert the jokers to lowercase + QString word = lineEditPlay->text().toUpper(); + int pos; + while ((pos = word.indexOf('(')) != -1) + { + if (word.size() < pos + 3 || word[pos + 2] != ')' || + !m_game->getDic().validateLetters(qtw(QString(word[pos + 1])))) + { + // Bug in validate()! + // This should never happen + QString msg = _q("Cannot play word: misplaced parentheses"); + emit notifyProblem(msg); + break; + } + else + { + QChar chr = word[pos + 1].toLower(); + word.remove(pos, 3); + word.insert(pos, chr); + } + } - // Play the word - int res = m_game->play(qtw(items[1]), qtw(items[0])); + QString coords = lineEditCoords->text(); + int res = m_game->play(qtw(coords), qtw(word)); if (res == 0) { emit gameUpdated(); } else { + // Try to be as explicit as possible concerning the error + QString msg = _q("Cannot play '%1' at position '%2':\n") + .arg(lineEditPlay->text()).arg(coords); + switch (res) + { + case 1: + msg += _q("Some letters are not valid for the current dictionary"); + break; + case 2: + msg += _q("Invalid coordinates"); + break; + case 3: + msg += _q("The word does not exist"); + break; + case 4: + msg += _q("The rack doesn't contain the letters needed to play this word"); + break; + case 5: + msg += _q("The word is part of a longer one"); + break; + case 6: + msg += _q("The word tries to replace an existing letter"); + break; + case 7: + msg += _q("The word is going out of the board, or an orthogonal word is not valid"); + break; + case 8: + msg += _q("The word is already present on the board at these coordinates"); + break; + case 9: + msg += _q("A word cannot be isolated (not connected to the placed words)"); + break; + case 10: + msg += _q("The first word of the game must be horizontal"); + break; + case 11: + msg += _q("The first word of the game must cover the H8 square"); + break; + default: + msg += _q("Incorrect or misplaced word (%1)").arg(1); + } // FIXME: the error is too generic - QString msg = _q("Cannot play '%1' at position '%2': incorrect or misplaced word (%3)") - .arg(items[0]).arg(items[1]).arg(res); emit notifyProblem(msg); } } @@ -223,18 +300,54 @@ QValidator::State PlayWordValidator::validate(QString &input, int &) const if (input == "") return Intermediate; - QStringList items = input.split(' ', QString::SkipEmptyParts); - + QString copy(input); + // Strip parentheses + copy.remove('('); + copy.remove(')'); // The string is invalid if it contains characters not present // in the dictionary - if (!m_dic.validateLetters(qtw(items[0]))) + if (!m_dic.validateLetters(qtw(copy))) return Invalid; - if (items.size() != 2 || items[0].size() < 2) + // Check the parentheses pairs + copy = input; + int pos; + while ((pos = copy.indexOf('(')) != -1) + { + if (copy.size() < pos + 3 || copy[pos + 2] != ')' || + !m_dic.validateLetters(qtw(QString(copy[pos + 1])))) + { + return Intermediate; + } + else + { + copy.remove(pos, 3); + } + } + if (copy.indexOf(')') != -1) return Intermediate; + return Acceptable; +} + + + +CoordsValidator::CoordsValidator(QObject *parent) + : QValidator(parent) +{ +} + + +QValidator::State CoordsValidator::validate(QString &input, int &) const +{ + // Only authorize characters part of a valid coordinate + wstring copy = qtw(input.toUpper()); + wstring authorized = L"ABCDEFGHIJKLMNO1234567890"; + if (copy.find_first_not_of(authorized) != wstring::npos) + return Invalid; + // Check coordinates - Coord c(qtw(items[1])); + Coord c(qtw(input)); if (!c.isValid()) return Intermediate; diff --git a/qt/player_widget.h b/qt/player_widget.h index 6db7c0b..fe9ba06 100644 --- a/qt/player_widget.h +++ b/qt/player_widget.h @@ -54,8 +54,10 @@ private slots: void on_pushButtonChange_clicked() { on_lineEditChange_returnPressed(); } void on_pushButtonPass_clicked() { on_lineEditChange_returnPressed(); } void on_lineEditPlay_textChanged(); + void on_lineEditCoords_textChanged() { on_lineEditPlay_textChanged(); } void on_lineEditChange_textChanged(); void on_lineEditPlay_returnPressed(); + void on_lineEditCoords_returnPressed() { on_lineEditPlay_returnPressed(); } void on_lineEditChange_returnPressed(); private: diff --git a/qt/ui/player_widget.ui b/qt/ui/player_widget.ui index 4e79ab3..204c365 100644 --- a/qt/ui/player_widget.ui +++ b/qt/ui/player_widget.ui @@ -6,13 +6,10 @@ 0 0 460 - 125 + 148 - - - -1 - + @@ -20,14 +17,14 @@ - + true - + false @@ -44,13 +41,15 @@ - + - _("To play a word, enter the word (case sensitive) and its coordinates. E.g.: WORD H4") + _("Enter the word to play (case-insensitive). +A joker from the rack must be written in parentheses. +E.g.: w(o)rd or W(O)RD") - _("To play a word, enter the word (case sensitive) and its coordinates. E.g.: WORD H4") + _("Enter the word to play (case-insensitive). A joker from the rack must be written in parentheses. E.g.: w(o)rd or W(O)RD") dummy @@ -58,6 +57,31 @@ + + + + 0 + 0 + + + + + 45 + 16777215 + + + + _("Enter the coordinates of the word. +Specify the row before the column for horizontal words, + and the column before the row for vertical words. +E.g.: H4 or 4H") + + + _("Enter the coordinates of the word. Specify the row before the column for horizontal words, and the column before the row for vertical words. E.g.: H4 or 4H") + + + + _("Play") @@ -81,20 +105,27 @@ - + _("Change") - + _("Pass") + + + + _("Ref.:") + + +