diff --git a/dic/dic.h b/dic/dic.h index 31187fe..d96102c 100644 --- a/dic/dic.h +++ b/dic/dic.h @@ -226,6 +226,7 @@ public: * @return true if all the matching words were returned, false otherwise * (i.e. if the maximum number of results was reached, and there are * additional results) + * @throw InvalidRegexpException When the regular expression cannot be parsed */ bool searchRegExp(const wstring &iRegexp, vector &oWordList, diff --git a/dic/dic_exception.cpp b/dic/dic_exception.cpp index 556b043..dabc84c 100644 --- a/dic/dic_exception.cpp +++ b/dic/dic_exception.cpp @@ -34,3 +34,9 @@ const char *DicException::what() const throw() return m_message.c_str(); } + +InvalidRegexpException::InvalidRegexpException(const string &iMessage) + : DicException(iMessage) +{ +} + diff --git a/dic/dic_exception.h b/dic/dic_exception.h index 2ecf790..77fee0a 100644 --- a/dic/dic_exception.h +++ b/dic/dic_exception.h @@ -41,4 +41,12 @@ class DicException: public std::exception std::string m_message; }; + +class InvalidRegexpException : public DicException +{ + public: + InvalidRegexpException(const std::string &iMessage); + ~InvalidRegexpException() throw() {} +}; + #endif diff --git a/dic/dic_search.cpp b/dic/dic_search.cpp index f5f9f05..28f5b52 100644 --- a/dic/dic_search.cpp +++ b/dic/dic_search.cpp @@ -25,6 +25,7 @@ #include #include "dic_internals.h" +#include "dic_exception.h" #include "dic.h" #include "header.h" #include "encoding.h" @@ -562,9 +563,8 @@ bool Dictionary::searchRegExp(const wstring &iRegexp, if (!parsingOk) { - // TODO: throw an exception delete root; - return true; + throw InvalidRegexpException(convertToMb(iRegexp)); } int ptl[REGEXP_MAX+1]; diff --git a/dic/regexpmain.cpp b/dic/regexpmain.cpp index 9bfd120..514f21f 100644 --- a/dic/regexpmain.cpp +++ b/dic/regexpmain.cpp @@ -40,6 +40,7 @@ #endif #include "dic.h" +#include "dic_exception.h" #include "header.h" #include "encoding.h" @@ -85,13 +86,19 @@ int main(int argc, char* argv[]) /* Automaton */ vector wordList; - dic.searchRegExp(convertToWc(line), wordList, 1, 15); - - cout << _("result:") << endl; - vector::const_iterator it; - for (it = wordList.begin(); it != wordList.end(); it++) + try { - cerr << convertToMb(*it) << endl; + dic.searchRegExp(convertToWc(line), wordList, 1, 15); + cout << _("result:") << endl; + vector::const_iterator it; + for (it = wordList.begin(); it != wordList.end(); it++) + { + cout << convertToMb(*it) << endl; + } + } + catch (InvalidRegexpException &e) + { + cout << _("Invalid regular expression: ") << e.what() << endl; } cout << "**************************************************************" << endl; cout << "**************************************************************" << endl; diff --git a/game/game.cpp b/game/game.cpp index c0eded9..fa43685 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -397,6 +397,9 @@ int Game::helperSetRackRandom(unsigned int p, bool iCheck, set_rack_mode mode) // Do not mark the rack as rejected if it was empty if (nold > 0) pld.setReject(); + // Reset the number of required vowels and consonants + neededVowels = min; + neededConsonants = min; // Restore the joker if we are in a joker game if (jokerAdded) @@ -449,7 +452,7 @@ int Game::helperSetRackRandom(unsigned int p, bool iCheck, set_rack_mode mode) pld.shuffleNew(); // Post-condition check. This should never fail, of course :) - ASSERT(pld.checkRack(min, min), "helperSetRackRandom() is buggy!") + ASSERT(pld.checkRack(min, min), "helperSetRackRandom() is buggy!"); // Until now we didn't modify anything except local variables. // Let's "commit" the changes diff --git a/po/POTFILES.in b/po/POTFILES.in index 3419bff..937370e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -76,6 +76,8 @@ qt/bag_widget.cpp qt/bag_widget.h qt/board_widget.cpp qt/board_widget.h +qt/dic_tools_widget.cpp +qt/dic_tools_widget.h qt/history_widget.cpp qt/history_widget.h qt/main_window.cpp @@ -87,6 +89,11 @@ qt/player_widget.cpp qt/player_widget.h qt/score_widget.cpp qt/score_widget.h +qt/training_widget.cpp +qt/training_widget.h +qt/ui/dic_tools_widget.ui +qt/ui/main_window.ui qt/ui/new_game.ui qt/ui/player_widget.ui -qt/ui/main_window.ui +qt/ui/prefs_dialog.ui +qt/ui/training_widget.ui diff --git a/po/eliot.pot b/po/eliot.pot index 45ab8c2..aeb4fcd 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-01-12 21:14+0100\n" +"POT-Creation-Date: 2008-08-31 12:51+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,199 +16,205 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: dic/header.cpp:318 dic/header.cpp:319 +#: dic/header.cpp:319 dic/header.cpp:320 msgid "Unknown (old format)" msgstr "" -#: dic/header.cpp:493 +#: dic/header.cpp:494 #, c-format msgid "dictionary name: %s\n" msgstr "" -#: dic/header.cpp:498 +#: dic/header.cpp:499 #, c-format msgid "compressed on: %s\n" msgstr "" -#: dic/header.cpp:502 +#: dic/header.cpp:503 #, c-format msgid "compressed on: Unknown date (old format)\n" msgstr "" -#: dic/header.cpp:504 +#: dic/header.cpp:505 #, c-format msgid "compressed using a binary compiled by: %s\n" msgstr "" -#: dic/header.cpp:505 +#: dic/header.cpp:506 #, c-format msgid "dictionary type: %s\n" msgstr "" -#: dic/header.cpp:506 +#: dic/header.cpp:507 #, c-format msgid "letters: %s\n" msgstr "" -#: dic/header.cpp:507 +#: dic/header.cpp:508 #, c-format msgid "number of letters: %lu\n" msgstr "" -#: dic/header.cpp:508 +#: dic/header.cpp:509 #, c-format msgid "number of words: %d\n" msgstr "" -#: dic/header.cpp:511 +#: dic/header.cpp:512 #, c-format msgid "header size: %lu bytes\n" msgstr "" -#: dic/header.cpp:512 +#: dic/header.cpp:513 #, c-format msgid "root: %d (edge)\n" msgstr "" -#: dic/header.cpp:513 +#: dic/header.cpp:514 #, c-format msgid "nodes: %d used + %d saved\n" msgstr "" -#: dic/header.cpp:514 +#: dic/header.cpp:515 #, c-format msgid "edges: %d used + %d saved\n" msgstr "" -#: dic/header.cpp:516 +#: dic/header.cpp:517 #, c-format msgid "letter | points | frequency | vowel | consonant\n" msgstr "" -#: dic/compdic.cpp:393 +#: dic/compdic.cpp:405 msgid "Mandatory options:" msgstr "" -#: dic/compdic.cpp:394 +#: dic/compdic.cpp:406 msgid " -d, --dicname Set the dictionary name and version" msgstr "" -#: dic/compdic.cpp:395 +#: dic/compdic.cpp:407 msgid "" " -l, --letters Path to the file containing the letters (see below)" msgstr "" -#: dic/compdic.cpp:396 +#: dic/compdic.cpp:408 msgid "" " -i, --input Path to the uncompressed dictionary file (encoded " "in UTF-8)" msgstr "" -#: dic/compdic.cpp:397 +#: dic/compdic.cpp:409 +msgid "" +" The words must be in alphabetical order, without " +"duplicates" +msgstr "" + +#: dic/compdic.cpp:410 msgid "" " -o, --output , Navigate in a box line by line" msgstr "" -#: utils/ncurses.cpp:450 +#: utils/ncurses.cpp:471 msgid " , Navigate in a box page by page" msgstr "" -#: utils/ncurses.cpp:451 +#: utils/ncurses.cpp:472 msgid " Ctrl-l Refresh the screen" msgstr "" -#: utils/ncurses.cpp:462 wxwin/auxframes.cc:148 +#: utils/ncurses.cpp:483 wxwin/auxframes.cc:147 qt/main_window.cpp:518 +#: qt/ui/main_window.ui:188 msgid "Bag" msgstr "" -#: utils/ncurses.cpp:469 +#: utils/ncurses.cpp:490 msgid " LETTER | POINTS | FREQUENCY | REMAINING" msgstr "" -#: utils/ncurses.cpp:522 +#: utils/ncurses.cpp:543 msgid "Play a word" msgstr "" @@ -416,180 +432,180 @@ msgstr "" #. "Coordinates:". For example: #. Pl. word : #. Coordinates: -#: utils/ncurses.cpp:523 utils/ncurses.cpp:531 +#: utils/ncurses.cpp:544 utils/ncurses.cpp:552 msgid "Played word:" msgstr "" -#: utils/ncurses.cpp:524 utils/ncurses.cpp:532 +#: utils/ncurses.cpp:545 utils/ncurses.cpp:553 msgid "Coordinates:" msgstr "" -#: utils/ncurses.cpp:546 +#: utils/ncurses.cpp:567 msgid "Incorrect or misplaced word" msgstr "" -#: utils/ncurses.cpp:556 +#: utils/ncurses.cpp:577 msgid "Dictionary" msgstr "" -#: utils/ncurses.cpp:557 +#: utils/ncurses.cpp:578 msgid "Enter the word to check:" msgstr "" -#: utils/ncurses.cpp:566 +#: utils/ncurses.cpp:587 #, c-format msgid "The word '%ls' exists" msgstr "" -#: utils/ncurses.cpp:568 +#: utils/ncurses.cpp:589 #, c-format msgid "The word '%ls' does not exist" msgstr "" -#: utils/ncurses.cpp:578 wxwin/mainframe.cc:475 wxwin/mainframe.cc:483 +#: utils/ncurses.cpp:599 wxwin/mainframe.cc:475 wxwin/mainframe.cc:483 msgid "Save the game" msgstr "" -#: utils/ncurses.cpp:579 utils/ncurses.cpp:609 +#: utils/ncurses.cpp:600 utils/ncurses.cpp:630 msgid "Enter the file name:" msgstr "" -#: utils/ncurses.cpp:589 +#: utils/ncurses.cpp:610 #, c-format msgid "Cannot open file %ls for writing" msgstr "" -#: utils/ncurses.cpp:597 +#: utils/ncurses.cpp:618 #, c-format msgid "Game saved in '%ls'" msgstr "" -#: utils/ncurses.cpp:608 wxwin/mainframe.cc:275 wxwin/mainframe.cc:405 -#: wxwin/mainframe.cc:429 +#: utils/ncurses.cpp:629 wxwin/mainframe.cc:275 wxwin/mainframe.cc:405 +#: wxwin/mainframe.cc:429 qt/main_window.cpp:287 msgid "Load a game" msgstr "" -#: utils/ncurses.cpp:619 +#: utils/ncurses.cpp:640 #, c-format msgid "Cannot open file '%ls' for reading" msgstr "" -#: utils/ncurses.cpp:627 +#: utils/ncurses.cpp:648 #, c-format msgid "Invalid saved game" msgstr "" -#: utils/ncurses.cpp:632 +#: utils/ncurses.cpp:653 qt/main_window.cpp:301 #, c-format msgid "Game loaded" msgstr "" -#: utils/ncurses.cpp:647 +#: utils/ncurses.cpp:668 msgid "Pass your turn" msgstr "" -#: utils/ncurses.cpp:648 +#: utils/ncurses.cpp:669 msgid "Enter the letters to change:" msgstr "" -#: utils/ncurses.cpp:657 +#: utils/ncurses.cpp:678 msgid "Cannot pass the turn" msgstr "" -#: utils/ncurses.cpp:667 +#: utils/ncurses.cpp:688 msgid "Set rack" msgstr "" -#: utils/ncurses.cpp:668 +#: utils/ncurses.cpp:689 msgid "Enter the new letters:" msgstr "" -#: utils/ncurses.cpp:677 +#: utils/ncurses.cpp:698 msgid "Cannot take these letters from the bag" msgstr "" -#: utils/ncurses.cpp:1071 +#: utils/ncurses.cpp:1092 qt/main_window.cpp:193 qt/ui/prefs_dialog.ui:175 msgid "Training mode" msgstr "" -#: utils/ncurses.cpp:1073 +#: utils/ncurses.cpp:1094 qt/ui/prefs_dialog.ui:156 msgid "Free game mode" msgstr "" -#: utils/ncurses.cpp:1075 +#: utils/ncurses.cpp:1096 qt/ui/prefs_dialog.ui:69 msgid "Duplicate mode" msgstr "" -#: utils/ncurses.cpp:1078 +#: utils/ncurses.cpp:1099 qt/ui/new_game.ui:67 msgid "Joker game" msgstr "" -#: utils/ncurses.cpp:1079 +#: utils/ncurses.cpp:1100 msgid "[h for help]" msgstr "" -#: wxwin/auxframes.cc:123 +#: wxwin/auxframes.cc:122 msgid "Grid" msgstr "" -#: wxwin/auxframes.cc:203 +#: wxwin/auxframes.cc:202 qt/ui/training_widget.ui:52 msgid "Search" msgstr "" -#: wxwin/auxframes.cc:234 +#: wxwin/auxframes.cc:233 qt/ui/dic_tools_widget.ui:31 msgid "Check" msgstr "" -#: wxwin/auxframes.cc:239 +#: wxwin/auxframes.cc:238 msgid "Word to check" msgstr "" -#: wxwin/auxframes.cc:257 wxwin/configdb.cc:203 wxwin/searchpanel.cc:107 +#: wxwin/auxframes.cc:256 wxwin/configdb.cc:203 wxwin/searchpanel.cc:107 msgid "No dictionary" msgstr "" -#: wxwin/auxframes.cc:261 +#: wxwin/auxframes.cc:260 msgid "exists" msgstr "" -#: wxwin/auxframes.cc:263 +#: wxwin/auxframes.cc:262 msgid "doesn't exist" msgstr "" -#: wxwin/auxframes.cc:304 +#: wxwin/auxframes.cc:303 msgid "Copy" msgstr "" -#: wxwin/auxframes.cc:348 wxwin/mainframe.cc:502 wxwin/mainframe.cc:522 +#: wxwin/auxframes.cc:347 wxwin/mainframe.cc:502 wxwin/mainframe.cc:522 #: wxwin/mainframe.cc:553 msgid "No on going game" msgstr "" -#: wxwin/auxframes.cc:363 wxwin/searchpanel.cc:119 +#: wxwin/auxframes.cc:362 wxwin/searchpanel.cc:119 msgid "No result" msgstr "" -#: wxwin/auxframes.cc:373 +#: wxwin/auxframes.cc:372 msgid "Rack + 1" msgstr "" -#: wxwin/auxframes.cc:415 +#: wxwin/auxframes.cc:414 msgid "Rack: " msgstr "" -#: wxwin/auxframes.cc:436 +#: wxwin/auxframes.cc:435 msgid "Benjamins" msgstr "" -#: wxwin/auxframes.cc:477 +#: wxwin/auxframes.cc:476 msgid "Extensions" msgstr "" -#: wxwin/auxframes.cc:543 wxwin/mainframe.cc:325 +#: wxwin/auxframes.cc:542 wxwin/mainframe.cc:325 msgid "Game history" msgstr "" -#: wxwin/auxframes.cc:575 wxwin/mainframe.cc:327 +#: wxwin/auxframes.cc:574 wxwin/mainframe.cc:327 msgid "Results" msgstr "" @@ -701,7 +717,7 @@ msgstr "" msgid "Nb" msgstr "" -#: wxwin/configdb.cc:323 wxwin/mainframe.cc:174 +#: wxwin/configdb.cc:323 wxwin/mainframe.cc:174 qt/history_widget.cpp:52 msgid "Rack" msgstr "" @@ -729,7 +745,7 @@ msgstr "" msgid "Cancel last changes" msgstr "" -#: wxwin/gfxresult.cc:67 +#: wxwin/gfxresult.cc:67 qt/history_widget.cpp:53 qt/training_widget.cpp:58 msgid "Word" msgstr "" @@ -781,7 +797,7 @@ msgstr "" msgid "&New game\tCtrl+N" msgstr "" -#: wxwin/mainframe.cc:272 +#: wxwin/mainframe.cc:272 qt/ui/main_window.ui:177 msgid "Start a new game" msgstr "" @@ -801,7 +817,7 @@ msgstr "" msgid "&Save as...\tCtrl+S" msgstr "" -#: wxwin/mainframe.cc:276 +#: wxwin/mainframe.cc:276 qt/ui/main_window.ui:229 msgid "Save the current game" msgstr "" @@ -833,7 +849,7 @@ msgstr "" msgid "&Quit\tCtrl+Q" msgstr "" -#: wxwin/mainframe.cc:284 +#: wxwin/mainframe.cc:284 qt/ui/main_window.ui:169 msgid "Quit Eliot" msgstr "" @@ -841,7 +857,7 @@ msgstr "" msgid "&Dictionary...\tCtrl+D" msgstr "" -#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 +#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 qt/main_window.cpp:485 msgid "Choose a dictionary" msgstr "" @@ -949,7 +965,7 @@ msgstr "" msgid "Font for the search" msgstr "" -#: wxwin/mainframe.cc:310 wxwin/mainframe.cc:334 +#: wxwin/mainframe.cc:310 wxwin/mainframe.cc:334 qt/history_widget.cpp:177 msgid "&Game" msgstr "" @@ -1049,7 +1065,8 @@ msgstr "" msgid "&About..." msgstr "" -#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 +#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 qt/main_window.cpp:596 +#: qt/ui/main_window.ui:161 msgid "About Eliot" msgstr "" @@ -1078,7 +1095,7 @@ msgstr "" msgid "Cannot open " msgstr "" -#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 +#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 qt/main_window.cpp:294 msgid "Error while loading the game" msgstr "" @@ -1169,22 +1186,435 @@ msgstr "" msgid "The search is limited to %d letters" msgstr "" -#: wxwin/searchpanel.cc:301 +#: wxwin/searchpanel.cc:249 msgid "Minimum length" msgstr "" -#: wxwin/searchpanel.cc:303 +#: wxwin/searchpanel.cc:251 msgid "Maximum length" msgstr "" -#: wxwin/searchpanel.cc:366 +#: wxwin/searchpanel.cc:320 msgid "Cross words" msgstr "" -#: wxwin/searchpanel.cc:367 +#: wxwin/searchpanel.cc:321 qt/ui/dic_tools_widget.ui:69 msgid "Plus 1" msgstr "" -#: wxwin/searchpanel.cc:368 +#: wxwin/searchpanel.cc:322 qt/ui/dic_tools_widget.ui:94 msgid "Regular expressions" msgstr "" + +#: qt/bag_widget.cpp:49 +msgid "Letter" +msgstr "" + +#: qt/bag_widget.cpp:50 qt/history_widget.cpp:55 qt/training_widget.cpp:60 +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 +msgid "Rack:" +msgstr "" + +#: qt/dic_tools_widget.cpp:122 qt/dic_tools_widget.cpp:155 +#: qt/dic_tools_widget.cpp:208 +msgid "Please select a dictionary" +msgstr "" + +#: qt/dic_tools_widget.cpp:133 +msgid "The word '%1' exists" +msgstr "" + +#: qt/dic_tools_widget.cpp:138 +msgid "The word '%1' does not exist" +msgstr "" + +#: qt/dic_tools_widget.cpp:162 +msgid "Rack: %1" +msgstr "" + +#: qt/dic_tools_widget.cpp:181 +msgid "Anagrams" +msgstr "" + +#: qt/dic_tools_widget.cpp:215 +msgid "Regular expression: %1" +msgstr "" + +#: qt/dic_tools_widget.cpp:238 +msgid "Invalid regular expression: %1" +msgstr "" + +#: qt/history_widget.cpp:51 +msgid "Turn" +msgstr "" + +#: qt/history_widget.cpp:54 qt/training_widget.cpp:59 +msgid "Ref" +msgstr "" + +#: qt/history_widget.cpp:87 qt/new_game.cpp:49 qt/score_widget.cpp:46 +#: qt/ui/new_game.ui:102 +msgid "Player" +msgstr "" + +#: qt/main_window.cpp:91 qt/main_window.cpp:536 qt/ui/main_window.ui:40 +msgid "Board" +msgstr "" + +#: qt/main_window.cpp:144 +msgid "Cannot load dictionary '%1' indicated in the preferences" +msgstr "" + +#: qt/main_window.cpp:185 +msgid "No game" +msgstr "" + +#: qt/main_window.cpp:197 +msgid "Duplicate game" +msgstr "" + +#: qt/main_window.cpp:201 qt/new_game.cpp:88 qt/new_game.cpp:145 +#: qt/ui/new_game.ui:41 +msgid "Free game" +msgstr "" + +#: qt/main_window.cpp:250 qt/main_window.cpp:283 +msgid "You have to select a dictionary first!" +msgstr "" + +#: qt/main_window.cpp:275 +msgid "Game started" +msgstr "" + +#: qt/main_window.cpp:311 +msgid "Save a game" +msgstr "" + +#: qt/main_window.cpp:316 +msgid "Game saved" +msgstr "" + +#: qt/main_window.cpp:343 +msgid "N." +msgstr "" + +#: qt/main_window.cpp:343 +msgid "RACK" +msgstr "" + +#: qt/main_window.cpp:343 +msgid "SOLUTION" +msgstr "" + +#: qt/main_window.cpp:343 +msgid "REF" +msgstr "" + +#: qt/main_window.cpp:343 +msgid "PTS" +msgstr "" + +#: qt/main_window.cpp:476 +msgid "Stop current game?" +msgstr "" + +#: qt/main_window.cpp:477 +msgid "" +"Loading a dictionary will stop the current game. Do you want to continue?" +msgstr "" + +#: qt/main_window.cpp:554 qt/ui/main_window.ui:53 qt/ui/main_window.ui:251 +msgid "History" +msgstr "" + +#: qt/main_window.cpp:571 qt/ui/main_window.ui:276 +msgid "Dictionary tools" +msgstr "" + +#: qt/main_window.cpp:588 +msgid "" +"Copyright (C) 1999-2008 - Antoine Fraboulet & Olivier Teuliere\n" +"\n" +"This program is free software; you can redistribute it and/or modify it " +"under the terms of the GNU General Public License as published by the Free " +"Software Foundation; either version 2 of the License, or (at your option) " +"any later version." +msgstr "" + +#: qt/new_game.cpp:36 qt/ui/new_game.ui:117 +msgid "Human" +msgstr "" + +#: qt/new_game.cpp:37 qt/ui/new_game.ui:122 +msgid "Computer" +msgstr "" + +#: qt/new_game.cpp:47 +msgid "Name" +msgstr "" + +#: qt/new_game.cpp:48 +msgid "Type" +msgstr "" + +#: qt/new_game.cpp:51 +msgid "Eliot" +msgstr "" + +#: qt/new_game.cpp:101 +msgid "Player %1" +msgstr "" + +#: qt/new_game.cpp:144 qt/ui/new_game.ui:36 +msgid "Duplicate" +msgstr "" + +#: qt/player_widget.cpp:156 +msgid "Cannot play '%1' at position '%2': incorrect or misplaced word (%3)" +msgstr "" + +#: qt/player_widget.cpp:179 +msgid "Cannot pass turn (%1)" +msgstr "" + +#: qt/player_widget.cpp:181 +msgid "Cannot change letters '%1' (%2)" +msgstr "" + +#: qt/score_widget.cpp:47 +msgid "Score" +msgstr "" + +#: qt/training_widget.cpp:194 +msgid "Warning: Cannot set the rack to '%1'" +msgstr "" + +#: qt/ui/dic_tools_widget.ui:105 +msgid "Minimum length:" +msgstr "" + +#: qt/ui/dic_tools_widget.ui:122 +msgid "Maximum length:" +msgstr "" + +#: qt/ui/dic_tools_widget.ui:157 +msgid "Note: only the 1000 first results have been displayed" +msgstr "" + +#: qt/ui/main_window.ui:62 qt/ui/new_game.ui:77 +msgid "Players" +msgstr "" + +#: qt/ui/main_window.ui:80 +msgid "Game" +msgstr "" + +#: qt/ui/main_window.ui:93 +msgid "Settings" +msgstr "" + +#: qt/ui/main_window.ui:107 +msgid "Windows" +msgstr "" + +#: qt/ui/main_window.ui:150 +msgid "Choose dictionary..." +msgstr "" + +#: qt/ui/main_window.ui:153 +msgid "Select a new dictionary" +msgstr "" + +#: qt/ui/main_window.ui:158 +msgid "About..." +msgstr "" + +#: qt/ui/main_window.ui:166 +msgid "Quit" +msgstr "" + +#: qt/ui/main_window.ui:174 +msgid "New..." +msgstr "" + +#: qt/ui/main_window.ui:191 +msgid "Show/hide the remaining tiles in the bag" +msgstr "" + +#: qt/ui/main_window.ui:199 +msgid "Preferences..." +msgstr "" + +#: qt/ui/main_window.ui:202 +msgid "Edit the preferences" +msgstr "" + +#: qt/ui/main_window.ui:207 +msgid "Save" +msgstr "" + +#: qt/ui/main_window.ui:215 +msgid "Load..." +msgstr "" + +#: qt/ui/main_window.ui:218 +msgid "Load an existing game" +msgstr "" + +#: qt/ui/main_window.ui:226 +msgid "Save as..." +msgstr "" + +#: qt/ui/main_window.ui:240 +msgid "External board" +msgstr "" + +#: qt/ui/main_window.ui:243 +msgid "Show/hide the external board" +msgstr "" + +#: qt/ui/main_window.ui:254 +msgid "Show/hide the game history" +msgstr "" + +#: qt/ui/main_window.ui:262 +msgid "Print..." +msgstr "" + +#: qt/ui/main_window.ui:265 +msgid "Print the current game" +msgstr "" + +#: qt/ui/main_window.ui:279 +msgid "Show/hide the dictionary tools" +msgstr "" + +#: qt/ui/new_game.ui:13 +msgid "New game" +msgstr "" + +#: qt/ui/new_game.ui:22 +msgid "Game type" +msgstr "" + +#: qt/ui/new_game.ui:28 +msgid "Mode:" +msgstr "" + +#: qt/ui/new_game.ui:95 +msgid "Name:" +msgstr "" + +#: qt/ui/new_game.ui:109 +msgid "Type:" +msgstr "" + +#: qt/ui/new_game.ui:134 +msgid "Add player" +msgstr "" + +#: qt/ui/new_game.ui:157 +msgid "Remove player" +msgstr "" + +#: qt/ui/player_widget.ui:36 +msgid "Shuffle" +msgstr "" + +#: qt/ui/player_widget.ui:43 +msgid "Play a word:" +msgstr "" + +#: qt/ui/player_widget.ui:50 qt/ui/player_widget.ui:53 +msgid "" +"To play a word, enter the word (case sensitive) and its coordinates. E.g.: " +"WORD H4" +msgstr "" + +#: qt/ui/player_widget.ui:63 qt/ui/training_widget.ui:62 +msgid "Play" +msgstr "" + +#: qt/ui/player_widget.ui:70 +msgid "Change letters:" +msgstr "" + +#: qt/ui/player_widget.ui:77 +msgid "Enter the letters you want to change" +msgstr "" + +#: qt/ui/player_widget.ui:87 +msgid "Change" +msgstr "" + +#: qt/ui/player_widget.ui:94 +msgid "Pass" +msgstr "" + +#: qt/ui/prefs_dialog.ui:19 +msgid "Interface" +msgstr "" + +#: qt/ui/prefs_dialog.ui:27 +msgid "Dictionary path:" +msgstr "" + +#: qt/ui/prefs_dialog.ui:34 +msgid "Enter the dictionary path (mandatory to start a game)" +msgstr "" + +#: qt/ui/prefs_dialog.ui:41 +msgid "Open a browser window to choose the dictionary" +msgstr "" + +#: qt/ui/prefs_dialog.ui:44 +msgid "Browse..." +msgstr "" + +#: qt/ui/prefs_dialog.ui:53 +msgid "" +"If checked, the game and player histories will display the rack and the " +"corresponding solution on the same line" +msgstr "" + +#: qt/ui/prefs_dialog.ui:56 +msgid "Align the rack and the solution in history" +msgstr "" + +#: qt/ui/prefs_dialog.ui:75 qt/ui/prefs_dialog.ui:162 +msgid "" +"If checked, playing an invalid or misplaced word will not be possible. If " +"unchecked, you will get 0 point and lose your turn" +msgstr "" + +#: qt/ui/prefs_dialog.ui:78 qt/ui/prefs_dialog.ui:165 +msgid "Refuse to play invalid moves" +msgstr "" + +#: qt/ui/prefs_dialog.ui:87 +msgid "Min. players for a solo:" +msgstr "" + +#: qt/ui/prefs_dialog.ui:107 +msgid "Minimum number of players needed to take into account the solo bonus" +msgstr "" + +#: qt/ui/prefs_dialog.ui:121 +msgid "Solo value:" +msgstr "" + +#: qt/ui/prefs_dialog.ui:141 +msgid "Value of the solo bonus. Set it to 0 if you don't want solo bonus" +msgstr "" + +#: qt/ui/training_widget.ui:35 +msgid "New rack" +msgstr "" + +#: qt/ui/training_widget.ui:42 +msgid "Complement" +msgstr "" diff --git a/po/fr.po b/po/fr.po index 76a0b3e..3db1797 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,10 +6,10 @@ # msgid "" msgstr "" -"Project-Id-Version: eliot 1.4\n" +"Project-Id-Version: eliot 1.7\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-01-12 21:14+0100\n" -"PO-Revision-Date: 2005-02-06 20:03+0100\n" +"POT-Creation-Date: 2008-08-31 12:51+0200\n" +"PO-Revision-Date: 2008-08-31 10:43+0100\n" "Last-Translator: Olivier Teuliere \n" "Language-Team: French \n" "MIME-Version: 1.0\n" @@ -17,91 +17,91 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: dic/header.cpp:318 dic/header.cpp:319 +#: dic/header.cpp:319 dic/header.cpp:320 msgid "Unknown (old format)" msgstr "Inconnu (vieux format)" -#: dic/header.cpp:493 +#: dic/header.cpp:494 #, c-format msgid "dictionary name: %s\n" msgstr "Nom du dictionnaire : %s\n" -#: dic/header.cpp:498 +#: dic/header.cpp:499 #, c-format msgid "compressed on: %s\n" msgstr "Compressé le : %s\n" -#: dic/header.cpp:502 +#: dic/header.cpp:503 #, c-format msgid "compressed on: Unknown date (old format)\n" msgstr "Compressé le : Date inconnue (vieux format)\n" -#: dic/header.cpp:504 +#: dic/header.cpp:505 #, c-format msgid "compressed using a binary compiled by: %s\n" msgstr "Compressé avec un binaire compilé par : %s\n" -#: dic/header.cpp:505 +#: dic/header.cpp:506 #, c-format msgid "dictionary type: %s\n" msgstr "Type de dictionnaire : %s\n" -#: dic/header.cpp:506 +#: dic/header.cpp:507 #, c-format msgid "letters: %s\n" msgstr "Lettres : %s\n" -#: dic/header.cpp:507 +#: dic/header.cpp:508 #, c-format msgid "number of letters: %lu\n" msgstr "Nombre de lettres : %lu\n" -#: dic/header.cpp:508 +#: dic/header.cpp:509 #, c-format msgid "number of words: %d\n" msgstr "Nombre de mots : %d\n" -#: dic/header.cpp:511 +#: dic/header.cpp:512 #, c-format msgid "header size: %lu bytes\n" msgstr "Taille du header : %lu octets\n" -#: dic/header.cpp:512 +#: dic/header.cpp:513 #, c-format msgid "root: %d (edge)\n" msgstr "Racine : %d (arcs)\n" -#: dic/header.cpp:513 +#: dic/header.cpp:514 #, c-format msgid "nodes: %d used + %d saved\n" msgstr "Noeuds : %d utilisés + %d évités\n" -#: dic/header.cpp:514 +#: dic/header.cpp:515 #, c-format msgid "edges: %d used + %d saved\n" msgstr "Arcs : %d utilisés + %d évités\n" -#: dic/header.cpp:516 +#: dic/header.cpp:517 #, c-format msgid "letter | points | frequency | vowel | consonant\n" msgstr "lettre | points | frequence | voye. | consonne\n" -#: dic/compdic.cpp:393 +#: dic/compdic.cpp:405 msgid "Mandatory options:" msgstr "Options obligatoires :" -#: dic/compdic.cpp:394 +#: dic/compdic.cpp:406 msgid " -d, --dicname Set the dictionary name and version" msgstr " -d, --dicname Choisir le nom et la version du dictionnaire" -#: dic/compdic.cpp:395 +#: dic/compdic.cpp:407 msgid "" " -l, --letters Path to the file containing the letters (see below)" msgstr "" " -l, --letters Chemin vers un fichier contenant les lettres (voir " "ci-dessous)" -#: dic/compdic.cpp:396 +#: dic/compdic.cpp:408 msgid "" " -i, --input Path to the uncompressed dictionary file (encoded " "in UTF-8)" @@ -109,56 +109,64 @@ msgstr "" " -i, --input Chemin vers le fichier de dictionnaire non " "compressé (encodé en UTF-8)" -#: dic/compdic.cpp:397 +#: dic/compdic.cpp:409 +msgid "" +" The words must be in alphabetical order, without " +"duplicates" +msgstr "" +" Les mots doivent être triés par ordre alphabétique," +"sans doublons" + +#: dic/compdic.cpp:410 msgid "" " -o, --output , Navigate in a box line by line" msgstr " , Naviguer dans une boîte ligne par ligne" -#: utils/ncurses.cpp:450 +#: utils/ncurses.cpp:471 msgid " , Navigate in a box page by page" msgstr " , Naviguer dans une boîte page par page" -#: utils/ncurses.cpp:451 +#: utils/ncurses.cpp:472 msgid " Ctrl-l Refresh the screen" msgstr " Ctrl-l Rafraîchir l'écran" -#: utils/ncurses.cpp:462 wxwin/auxframes.cc:148 +#: utils/ncurses.cpp:483 wxwin/auxframes.cc:147 qt/main_window.cpp:518 +#: qt/ui/main_window.ui:188 msgid "Bag" msgstr "Sac" -#: utils/ncurses.cpp:469 +#: utils/ncurses.cpp:490 msgid " LETTER | POINTS | FREQUENCY | REMAINING" msgstr " LETTRE | POINTS | FREQUENCE | RESTANT" -#: utils/ncurses.cpp:522 +#: utils/ncurses.cpp:543 msgid "Play a word" msgstr "Jouer un mot" @@ -437,180 +455,180 @@ msgstr "Jouer un mot" #. "Coordinates:". For example: #. Pl. word : #. Coordinates: -#: utils/ncurses.cpp:523 utils/ncurses.cpp:531 +#: utils/ncurses.cpp:544 utils/ncurses.cpp:552 msgid "Played word:" msgstr "Mot joué :" -#: utils/ncurses.cpp:524 utils/ncurses.cpp:532 +#: utils/ncurses.cpp:545 utils/ncurses.cpp:553 msgid "Coordinates:" msgstr "Coordonnées :" -#: utils/ncurses.cpp:546 +#: utils/ncurses.cpp:567 msgid "Incorrect or misplaced word" msgstr "Mot incorrect ou mal placé" -#: utils/ncurses.cpp:556 +#: utils/ncurses.cpp:577 msgid "Dictionary" msgstr "Dictionnaire" -#: utils/ncurses.cpp:557 +#: utils/ncurses.cpp:578 msgid "Enter the word to check:" msgstr "Entrer le mot à vérifier:" -#: utils/ncurses.cpp:566 +#: utils/ncurses.cpp:587 #, c-format msgid "The word '%ls' exists" msgstr "Le mot '%ls' existe" -#: utils/ncurses.cpp:568 +#: utils/ncurses.cpp:589 #, c-format msgid "The word '%ls' does not exist" msgstr "Le mot '%ls' n'existe pas" -#: utils/ncurses.cpp:578 wxwin/mainframe.cc:475 wxwin/mainframe.cc:483 +#: utils/ncurses.cpp:599 wxwin/mainframe.cc:475 wxwin/mainframe.cc:483 msgid "Save the game" msgstr "Sauvegarder la partie" -#: utils/ncurses.cpp:579 utils/ncurses.cpp:609 +#: utils/ncurses.cpp:600 utils/ncurses.cpp:630 msgid "Enter the file name:" msgstr "Entrer le nom du fichier :" -#: utils/ncurses.cpp:589 +#: utils/ncurses.cpp:610 #, c-format msgid "Cannot open file %ls for writing" msgstr "Impossible d'ouvrir le fichier %ls en écriture" -#: utils/ncurses.cpp:597 +#: utils/ncurses.cpp:618 #, c-format msgid "Game saved in '%ls'" msgstr "Partie sauvée dans '%ls'" -#: utils/ncurses.cpp:608 wxwin/mainframe.cc:275 wxwin/mainframe.cc:405 -#: wxwin/mainframe.cc:429 +#: utils/ncurses.cpp:629 wxwin/mainframe.cc:275 wxwin/mainframe.cc:405 +#: wxwin/mainframe.cc:429 qt/main_window.cpp:287 msgid "Load a game" msgstr "Charger une partie" -#: utils/ncurses.cpp:619 +#: utils/ncurses.cpp:640 #, c-format msgid "Cannot open file '%ls' for reading" msgstr "Impossible d'ouvrir le fichier '%ls' en lecture" -#: utils/ncurses.cpp:627 +#: utils/ncurses.cpp:648 #, c-format msgid "Invalid saved game" msgstr "Partie sauvée invalide" -#: utils/ncurses.cpp:632 +#: utils/ncurses.cpp:653 qt/main_window.cpp:301 #, c-format msgid "Game loaded" msgstr "Partie chargée" -#: utils/ncurses.cpp:647 +#: utils/ncurses.cpp:668 msgid "Pass your turn" msgstr "Passer son tour" -#: utils/ncurses.cpp:648 +#: utils/ncurses.cpp:669 msgid "Enter the letters to change:" msgstr "Entrer les lettres à changer:" -#: utils/ncurses.cpp:657 +#: utils/ncurses.cpp:678 msgid "Cannot pass the turn" msgstr "Impossible de passer le tour" -#: utils/ncurses.cpp:667 +#: utils/ncurses.cpp:688 msgid "Set rack" msgstr "Choix du tirage" -#: utils/ncurses.cpp:668 +#: utils/ncurses.cpp:689 msgid "Enter the new letters:" msgstr "Entrer les nouvelles lettres:" -#: utils/ncurses.cpp:677 +#: utils/ncurses.cpp:698 msgid "Cannot take these letters from the bag" msgstr "Impossible de retirer ces lettres du sac" -#: utils/ncurses.cpp:1071 +#: utils/ncurses.cpp:1092 qt/main_window.cpp:193 qt/ui/prefs_dialog.ui:175 msgid "Training mode" msgstr "Mode entraînement" -#: utils/ncurses.cpp:1073 +#: utils/ncurses.cpp:1094 qt/ui/prefs_dialog.ui:156 msgid "Free game mode" msgstr "Mode partie libre" -#: utils/ncurses.cpp:1075 +#: utils/ncurses.cpp:1096 qt/ui/prefs_dialog.ui:69 msgid "Duplicate mode" msgstr "Mode duplicate" -#: utils/ncurses.cpp:1078 +#: utils/ncurses.cpp:1099 qt/ui/new_game.ui:67 msgid "Joker game" msgstr "Partie joker" -#: utils/ncurses.cpp:1079 +#: utils/ncurses.cpp:1100 msgid "[h for help]" msgstr "[h pour l'aide]" -#: wxwin/auxframes.cc:123 +#: wxwin/auxframes.cc:122 msgid "Grid" msgstr "Grille" -#: wxwin/auxframes.cc:203 +#: wxwin/auxframes.cc:202 qt/ui/training_widget.ui:52 msgid "Search" msgstr "Recherche" -#: wxwin/auxframes.cc:234 +#: wxwin/auxframes.cc:233 qt/ui/dic_tools_widget.ui:31 msgid "Check" msgstr "Vérification" -#: wxwin/auxframes.cc:239 +#: wxwin/auxframes.cc:238 msgid "Word to check" msgstr "Mot à vérifier" -#: wxwin/auxframes.cc:257 wxwin/configdb.cc:203 wxwin/searchpanel.cc:107 +#: wxwin/auxframes.cc:256 wxwin/configdb.cc:203 wxwin/searchpanel.cc:107 msgid "No dictionary" msgstr "Pas de dictionnaire" -#: wxwin/auxframes.cc:261 +#: wxwin/auxframes.cc:260 msgid "exists" msgstr "existe" -#: wxwin/auxframes.cc:263 +#: wxwin/auxframes.cc:262 msgid "doesn't exist" msgstr "n'existe pas" -#: wxwin/auxframes.cc:304 +#: wxwin/auxframes.cc:303 msgid "Copy" msgstr "Copier" -#: wxwin/auxframes.cc:348 wxwin/mainframe.cc:502 wxwin/mainframe.cc:522 +#: wxwin/auxframes.cc:347 wxwin/mainframe.cc:502 wxwin/mainframe.cc:522 #: wxwin/mainframe.cc:553 msgid "No on going game" msgstr "Pas de partie en cours" -#: wxwin/auxframes.cc:363 wxwin/searchpanel.cc:119 +#: wxwin/auxframes.cc:362 wxwin/searchpanel.cc:119 msgid "No result" msgstr "Pas de résultat" -#: wxwin/auxframes.cc:373 +#: wxwin/auxframes.cc:372 msgid "Rack + 1" msgstr "Tirage + 1" -#: wxwin/auxframes.cc:415 +#: wxwin/auxframes.cc:414 msgid "Rack: " msgstr "Tirage :" -#: wxwin/auxframes.cc:436 +#: wxwin/auxframes.cc:435 msgid "Benjamins" msgstr "Benjamins" -#: wxwin/auxframes.cc:477 +#: wxwin/auxframes.cc:476 msgid "Extensions" msgstr "Raccords" -#: wxwin/auxframes.cc:543 wxwin/mainframe.cc:325 +#: wxwin/auxframes.cc:542 wxwin/mainframe.cc:325 msgid "Game history" msgstr "Historique de la partie" -#: wxwin/auxframes.cc:575 wxwin/mainframe.cc:327 +#: wxwin/auxframes.cc:574 wxwin/mainframe.cc:327 msgid "Results" msgstr "Résultats" @@ -722,7 +740,7 @@ msgstr "Sauvegarder les changements" msgid "Nb" msgstr "Num" -#: wxwin/configdb.cc:323 wxwin/mainframe.cc:174 +#: wxwin/configdb.cc:323 wxwin/mainframe.cc:174 qt/history_widget.cpp:52 msgid "Rack" msgstr "Tirage" @@ -750,7 +768,7 @@ msgstr "Vérifier la validité du tirage" msgid "Cancel last changes" msgstr "Annuler les derniers changements" -#: wxwin/gfxresult.cc:67 +#: wxwin/gfxresult.cc:67 qt/history_widget.cpp:53 qt/training_widget.cpp:58 msgid "Word" msgstr "Mot" @@ -802,7 +820,7 @@ msgstr "Jouer le mot selectionné" msgid "&New game\tCtrl+N" msgstr "&Nouvelle partie\tCtrl+N" -#: wxwin/mainframe.cc:272 +#: wxwin/mainframe.cc:272 qt/ui/main_window.ui:177 msgid "Start a new game" msgstr "Démarrer une nouvelle partie" @@ -822,7 +840,7 @@ msgstr "&Charger...\tCtrl+O" msgid "&Save as...\tCtrl+S" msgstr "&Enregistrer sous...\tCtrl+S" -#: wxwin/mainframe.cc:276 +#: wxwin/mainframe.cc:276 qt/ui/main_window.ui:229 msgid "Save the current game" msgstr "Sauvegarder la partie en cours" @@ -854,7 +872,7 @@ msgstr "Imprimer dans un fichier PostScript" msgid "&Quit\tCtrl+Q" msgstr "&Quitter\tCtrl+Q" -#: wxwin/mainframe.cc:284 +#: wxwin/mainframe.cc:284 qt/ui/main_window.ui:169 msgid "Quit Eliot" msgstr "Quitter Eliot" @@ -862,7 +880,7 @@ msgstr "Quitter Eliot" msgid "&Dictionary...\tCtrl+D" msgstr "&Dictionnaire...\tCtrl+D" -#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 +#: wxwin/mainframe.cc:287 wxwin/mainframe.cc:604 qt/main_window.cpp:485 msgid "Choose a dictionary" msgstr "Choisir un dictionnaire" @@ -970,7 +988,7 @@ msgstr "&Lettres de recherche..." msgid "Font for the search" msgstr "Police de caractères pour la recherche" -#: wxwin/mainframe.cc:310 wxwin/mainframe.cc:334 +#: wxwin/mainframe.cc:310 wxwin/mainframe.cc:334 qt/history_widget.cpp:177 msgid "&Game" msgstr "&Partie" @@ -1070,7 +1088,8 @@ msgstr "Ré&sultats" msgid "&About..." msgstr "À &propos..." -#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 +#: wxwin/mainframe.cc:331 wxwin/mainframe.cc:733 qt/main_window.cpp:596 +#: qt/ui/main_window.ui:161 msgid "About Eliot" msgstr "À propos d'Eliot" @@ -1099,7 +1118,7 @@ msgstr "Eliot : erreur" msgid "Cannot open " msgstr "Impossible d'ouvrir " -#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 +#: wxwin/mainframe.cc:440 wxwin/mainframe.cc:449 qt/main_window.cpp:294 msgid "Error while loading the game" msgstr "Erreur pendant le chargement de la partie" @@ -1197,35 +1216,478 @@ msgstr "Le tirage a été modifié manuellement" msgid "The search is limited to %d letters" msgstr "La recherche est limitée à %d lettres" -#: wxwin/searchpanel.cc:301 +#: wxwin/searchpanel.cc:249 msgid "Minimum length" msgstr "Longueur minimum" -#: wxwin/searchpanel.cc:303 +#: wxwin/searchpanel.cc:251 msgid "Maximum length" msgstr "Longueur maximum" -#: wxwin/searchpanel.cc:366 +#: wxwin/searchpanel.cc:320 msgid "Cross words" msgstr "Mots croisés" -#: wxwin/searchpanel.cc:367 +#: wxwin/searchpanel.cc:321 qt/ui/dic_tools_widget.ui:69 msgid "Plus 1" msgstr "Plus 1" -#: wxwin/searchpanel.cc:368 +#: wxwin/searchpanel.cc:322 qt/ui/dic_tools_widget.ui:94 msgid "Regular expressions" msgstr "Expressions régulières" +#: qt/bag_widget.cpp:49 +msgid "Letter" +msgstr "Lettre" + +#: qt/bag_widget.cpp:50 qt/history_widget.cpp:55 qt/training_widget.cpp:60 +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 +msgid "Rack:" +msgstr "Tirage :" + +#: qt/dic_tools_widget.cpp:122 qt/dic_tools_widget.cpp:155 +#: qt/dic_tools_widget.cpp:208 +msgid "Please select a dictionary" +msgstr "Choisir un dictionnaire" + +#: qt/dic_tools_widget.cpp:133 +msgid "The word '%1' exists" +msgstr "Le mot '%1' existe" + +#: qt/dic_tools_widget.cpp:138 +msgid "The word '%1' does not exist" +msgstr "Le mot '%1' n'existe pas" + +#: qt/dic_tools_widget.cpp:162 +msgid "Rack: %1" +msgstr "Tirage : %1" + +#: qt/dic_tools_widget.cpp:181 +msgid "Anagrams" +msgstr "Anagrammes" + +#: qt/dic_tools_widget.cpp:215 +msgid "Regular expression: %1" +msgstr "Expression régulière : %1" + +#: qt/dic_tools_widget.cpp:238 +msgid "Invalid regular expression: %1" +msgstr "Expression régulière invalide : %1" + +#: qt/history_widget.cpp:51 +msgid "Turn" +msgstr "Coup" + +#: qt/history_widget.cpp:54 qt/training_widget.cpp:59 +msgid "Ref" +msgstr "Ref" + +#: qt/history_widget.cpp:87 qt/new_game.cpp:49 qt/score_widget.cpp:46 +#: qt/ui/new_game.ui:102 +msgid "Player" +msgstr "Joueur" + +#: qt/main_window.cpp:91 qt/main_window.cpp:536 qt/ui/main_window.ui:40 +msgid "Board" +msgstr "Grille" + +#: qt/main_window.cpp:144 +msgid "Cannot load dictionary '%1' indicated in the preferences" +msgstr "" +"Impossible de charger le dictionnaire '%1' indiqué dans les préférences" + +#: qt/main_window.cpp:185 +msgid "No game" +msgstr "Pas de partie en cours" + +#: qt/main_window.cpp:197 +msgid "Duplicate game" +msgstr "Partie duplicate" + +#: qt/main_window.cpp:201 qt/new_game.cpp:88 qt/new_game.cpp:145 +#: qt/ui/new_game.ui:41 +msgid "Free game" +msgstr "Partie libre" + +#: qt/main_window.cpp:250 qt/main_window.cpp:283 +msgid "You have to select a dictionary first!" +msgstr "Vous devez d'abord choisir un dictionnaire !" + +#: qt/main_window.cpp:275 +msgid "Game started" +msgstr "Partie démarrée" + +#: qt/main_window.cpp:311 +msgid "Save a game" +msgstr "Sauvegarder la partie" + +#: qt/main_window.cpp:316 +msgid "Game saved" +msgstr "Partie enregistrée" + +#: qt/main_window.cpp:343 +msgid "N." +msgstr "N." + +#: qt/main_window.cpp:343 +msgid "RACK" +msgstr "TIRAGE" + +#: qt/main_window.cpp:343 +msgid "SOLUTION" +msgstr "SOLUTION" + +#: qt/main_window.cpp:343 +msgid "REF" +msgstr "REF" + +#: qt/main_window.cpp:343 +msgid "PTS" +msgstr "PTS" + +#: qt/main_window.cpp:476 +msgid "Stop current game?" +msgstr "Arrêter la partie en cours ?" + +#: qt/main_window.cpp:477 +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:554 qt/ui/main_window.ui:53 qt/ui/main_window.ui:251 +msgid "History" +msgstr "Historique" + +#: qt/main_window.cpp:571 qt/ui/main_window.ui:276 +msgid "Dictionary tools" +msgstr "Dictionnaire" + +#: qt/main_window.cpp:588 +msgid "" +"Copyright (C) 1999-2008 - Antoine Fraboulet & Olivier Teuliere\n" +"\n" +"This program is free software; you can redistribute it and/or modify it " +"under the terms of the GNU General Public License as published by the Free " +"Software Foundation; either version 2 of the License, or (at your option) " +"any later version." +msgstr "" +"Copyright (C) 1999-2008 - Antoine Fraboulet & Olivier Teulière\n" +"\n" +"Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le " +"modifier selon les termes de la licence \"GNU General Public License\" " +"publiée par la Free Software Fundation ; soit la version 2 de la Licence, " +"soit (comme vous le préférez), n'importe quelle version ultérieure." + +#: qt/new_game.cpp:36 qt/ui/new_game.ui:117 +msgid "Human" +msgstr "Humain" + +#: qt/new_game.cpp:37 qt/ui/new_game.ui:122 +msgid "Computer" +msgstr "Ordinateur" + +#: qt/new_game.cpp:47 +msgid "Name" +msgstr "Nom" + +#: qt/new_game.cpp:48 +msgid "Type" +msgstr "Type" + +#: qt/new_game.cpp:51 +msgid "Eliot" +msgstr "Eliot" + +#: qt/new_game.cpp:101 +msgid "Player %1" +msgstr "Joueur %1" + +#: qt/new_game.cpp:144 qt/ui/new_game.ui:36 +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:179 +msgid "Cannot pass turn (%1)" +msgstr "Impossible de passer le tour (%1)" + +#: qt/player_widget.cpp:181 +msgid "Cannot change letters '%1' (%2)" +msgstr "Impossible de changer les lettres '%1' (%2)" + +#: qt/score_widget.cpp:47 +msgid "Score" +msgstr "Score" + +#: qt/training_widget.cpp:194 +msgid "Warning: Cannot set the rack to '%1'" +msgstr "Attention : Impossible de choisir le tirage '%1'" + +#: qt/ui/dic_tools_widget.ui:105 +msgid "Minimum length:" +msgstr "Longueur minimum :" + +#: qt/ui/dic_tools_widget.ui:122 +msgid "Maximum length:" +msgstr "Longueur maximum :" + +#: qt/ui/dic_tools_widget.ui:157 +msgid "Note: only the 1000 first results have been displayed" +msgstr "Note : seuls les 1000 premiers résultats ont été affichés" + +#: qt/ui/main_window.ui:62 qt/ui/new_game.ui:77 +msgid "Players" +msgstr "Joueurs" + +#: qt/ui/main_window.ui:80 +msgid "Game" +msgstr "&Partie" + +#: qt/ui/main_window.ui:93 +msgid "Settings" +msgstr "Para&mètres" + +#: qt/ui/main_window.ui:107 +msgid "Windows" +msgstr "&Fenêtres" + +#: qt/ui/main_window.ui:150 +msgid "Choose dictionary..." +msgstr "Choisir un &dictionnaire..." + +#: qt/ui/main_window.ui:153 +msgid "Select a new dictionary" +msgstr "Choisir un nouveau dictionnaire" + +#: qt/ui/main_window.ui:158 +msgid "About..." +msgstr "À &propos..." + +#: qt/ui/main_window.ui:166 +msgid "Quit" +msgstr "&Quitter" + +#: qt/ui/main_window.ui:174 +msgid "New..." +msgstr "&Nouvelle partie..." + +#: qt/ui/main_window.ui:191 +msgid "Show/hide the remaining tiles in the bag" +msgstr "Afficher/cacher les lettres restantes dans le sac" + +#: qt/ui/main_window.ui:199 +msgid "Preferences..." +msgstr "&Préférences..." + +#: qt/ui/main_window.ui:202 +msgid "Edit the preferences" +msgstr "Modifier les préférences" + +#: qt/ui/main_window.ui:207 +msgid "Save" +msgstr "Sauver" + +#: qt/ui/main_window.ui:215 +msgid "Load..." +msgstr "&Charger..." + +#: qt/ui/main_window.ui:218 +msgid "Load an existing game" +msgstr "Charger une partie existante" + +#: qt/ui/main_window.ui:226 +msgid "Save as..." +msgstr "&Enregistrer sous..." + +#: qt/ui/main_window.ui:240 +msgid "External board" +msgstr "&Plateau de jeu externe" + +#: qt/ui/main_window.ui:243 +msgid "Show/hide the external board" +msgstr "Afficher/cacher le plateau de jeu externe" + +#: qt/ui/main_window.ui:254 +msgid "Show/hide the game history" +msgstr "Afficher/cacher l'historique de la partie" + +#: qt/ui/main_window.ui:262 +msgid "Print..." +msgstr "&Impression..." + +#: qt/ui/main_window.ui:265 +msgid "Print the current game" +msgstr "Imprimer la partie en cours" + +#: qt/ui/main_window.ui:279 +msgid "Show/hide the dictionary tools" +msgstr "Afficher/cacher les outils de recherche dans le dictionnaire" + +#: qt/ui/new_game.ui:13 +msgid "New game" +msgstr "Nouvelle partie" + +#: qt/ui/new_game.ui:22 +msgid "Game type" +msgstr "Type de partie" + +#: qt/ui/new_game.ui:28 +msgid "Mode:" +msgstr "Mode :" + +#: qt/ui/new_game.ui:95 +msgid "Name:" +msgstr "Nom :" + +#: qt/ui/new_game.ui:109 +msgid "Type:" +msgstr "Type :" + +#: qt/ui/new_game.ui:134 +msgid "Add player" +msgstr "Ajouter un joueur" + +#: qt/ui/new_game.ui:157 +msgid "Remove player" +msgstr "Supprimer un joueur" + +#: qt/ui/player_widget.ui:36 +msgid "Shuffle" +msgstr "Mélanger" + +#: qt/ui/player_widget.ui:43 +msgid "Play a word:" +msgstr "Jouer le mot :" + +#: qt/ui/player_widget.ui:50 qt/ui/player_widget.ui:53 +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" + +#: qt/ui/player_widget.ui:63 qt/ui/training_widget.ui:62 +msgid "Play" +msgstr "Jouer" + +#: qt/ui/player_widget.ui:70 +msgid "Change letters:" +msgstr "Lettres à changer :" + +#: qt/ui/player_widget.ui:77 +msgid "Enter the letters you want to change" +msgstr "Entrer les lettres à changer" + +#: qt/ui/player_widget.ui:87 +msgid "Change" +msgstr "Changer" + +#: qt/ui/player_widget.ui:94 +msgid "Pass" +msgstr "Passer" + +#: qt/ui/prefs_dialog.ui:19 +msgid "Interface" +msgstr "Interface" + +#: qt/ui/prefs_dialog.ui:27 +msgid "Dictionary path:" +msgstr "Chemin du dictionnaire :" + +#: qt/ui/prefs_dialog.ui:34 +msgid "Enter the dictionary path (mandatory to start a game)" +msgstr "Entrer le chemin du dictionnaire (obligatoire pour jouer une partie)" + +#: qt/ui/prefs_dialog.ui:41 +msgid "Open a browser window to choose the dictionary" +msgstr "Ouvre une fenêtre de sélection du dictionnaire" + +#: qt/ui/prefs_dialog.ui:44 +msgid "Browse..." +msgstr "Parcourir..." + +#: qt/ui/prefs_dialog.ui:53 +msgid "" +"If checked, the game and player histories will display the rack and the " +"corresponding solution on the same line" +msgstr "" +"Si la case est cochée, les historiques de la partie et des joueurs " +"afficheront le tirage et la solution correspondante sur la même ligne" + +#: qt/ui/prefs_dialog.ui:56 +msgid "Align the rack and the solution in history" +msgstr "Aligner tirages et solutions dans l'historique" + +#: qt/ui/prefs_dialog.ui:75 qt/ui/prefs_dialog.ui:162 +msgid "" +"If checked, playing an invalid or misplaced word will not be possible. If " +"unchecked, you will get 0 point and lose your turn" +msgstr "" +"Si la case est cochée, jouer un mot invalide ou mal placé sera impossible. " +"Sinon, un tel mot apportera 0 point et vous perdrez votre tour" + +#: qt/ui/prefs_dialog.ui:78 qt/ui/prefs_dialog.ui:165 +msgid "Refuse to play invalid moves" +msgstr "Refuser de jouer des mots invalides" + +#: qt/ui/prefs_dialog.ui:87 +msgid "Min. players for a solo:" +msgstr "Nombre minimal de joueurs pour un solo :" + +#: qt/ui/prefs_dialog.ui:107 +msgid "Minimum number of players needed to take into account the solo bonus" +msgstr "Nombre minimal de joueurs pour prendre en compte la prime de solo" + +#: qt/ui/prefs_dialog.ui:121 +msgid "Solo value:" +msgstr "Valeur du solo :" + +#: qt/ui/prefs_dialog.ui:141 +msgid "Value of the solo bonus. Set it to 0 if you don't want solo bonus" +msgstr "" +"Valeur de la prime de solo. Mettez 0 pour désactiver les primes de solo." + +#: qt/ui/training_widget.ui:35 +msgid "New rack" +msgstr "Nouveau tirage" + +#: qt/ui/training_widget.ui:42 +msgid "Complement" +msgstr "Complément" + +#~ msgid "AI" +#~ msgstr "IA" + +#~ msgid "&Game" +#~ msgstr "&Partie" + +#~ msgid "&Settings" +#~ msgstr "&Paramètres" + +#~ msgid "&Help" +#~ msgstr "&Aide" + +#~ msgid "&Windows" +#~ msgstr "&Fenêtres" + +#~ msgid "HumanPlayer" +#~ msgstr "JoueurHumain" + #~ msgid "R&accords" #~ msgstr "R&accords" #~ msgid "Raccords on a word of the search" #~ msgstr "Raccords sur un mot de la recherche" -#~ msgid "&Quit" -#~ msgstr "&Quitter" - #~ msgid "Ba&g" #~ msgstr "&Sac" @@ -1250,9 +1712,6 @@ msgstr "Expressions régulières" #~ msgid "&Configuration" #~ msgstr "&Configuration" -#~ msgid "Game" -#~ msgstr "Partie" - #~ msgid "Word counts double..." #~ msgstr "Mot compte double..." @@ -1271,26 +1730,14 @@ msgstr "Expressions régulières" #~ msgid "Color of the \"letter counts triple\" squares" #~ msgstr "Couleur des cases \"lettre compte triple\"" -#, fuzzy -#~ msgid "Fonte des lettres" -#~ msgstr "Entrer les nouvelles lettres:" - -#~ msgid "Game..." -#~ msgstr "Partie..." - -#, fuzzy #~ msgid "Results..." -#~ msgstr "Résultat" +#~ msgstr "Résultats..." -#, fuzzy #~ msgid "Dictionnaire" -#~ msgstr " Dictionnaire " +#~ msgstr "Dictionnaire" #~ msgid "Usage: eliotcurses /path/to/ods4.dawg\n" #~ msgstr "Usage: eliotcurses /chemin vers/ods4.dawg\n" #~ msgid "Played word: " -#~ msgstr "Mot joué :" - -#~ msgid "Duplicate" -#~ msgstr "Duplicate" +#~ msgstr "Mot joué :" diff --git a/qt/dic_tools_widget.cpp b/qt/dic_tools_widget.cpp index 0ca6772..71dcd8a 100644 --- a/qt/dic_tools_widget.cpp +++ b/qt/dic_tools_widget.cpp @@ -32,6 +32,7 @@ #include "dic_tools_widget.h" #include "qtcommon.h" #include "dic.h" +#include "dic_exception.h" using namespace std; @@ -223,14 +224,25 @@ void DicToolsWidget::refreshRegexp() // or a warning should appear when it is reached unsigned limit = 1000; vector wordList; - bool res = m_dic->searchRegExp(qtw(rack->text()), wordList, - lmin, lmax, limit); - + bool res = true; int rowNum = 0; + try + { + res = m_dic->searchRegExp(qtw(rack->text()), wordList, + lmin, lmax, limit); + } + catch (InvalidRegexpException &e) + { + model->insertRow(rowNum); + model->setData(model->index(rowNum, 0), + _q("Invalid regular expression: %1").arg(qfl(e.what()))); + model->setData(model->index(rowNum, 0), + QBrush(Qt::red), Qt::ForegroundRole); + } + vector::const_iterator it; for (it = wordList.begin(); it != wordList.end(); it++) { - // Create the header line model->insertRow(rowNum); model->setData(model->index(rowNum, 0), qfw(*it)); ++rowNum; diff --git a/qt/main_window.cpp b/qt/main_window.cpp index 4c5a0af..0432d83 100644 --- a/qt/main_window.cpp +++ b/qt/main_window.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -39,6 +40,9 @@ #include "game.h" #include "freegame.h" #include "player.h" +#include "history.h" +#include "turn.h" +#include "move.h" #include "debug.h" #include "new_game.h" #include "prefs_dialog.h" @@ -59,12 +63,20 @@ MainWindow::MainWindow(QWidget *iParent) : QMainWindow(iParent), m_dic(NULL), m_game(NULL), m_newGameDialog(NULL), m_prefsDialog(NULL), m_bagWindow(NULL), m_boardWindow(NULL), - m_historyWindow(NULL), m_dicToolsWindow(NULL) + m_historyWindow(NULL), m_dicToolsWindow(NULL), m_dicNameLabel(NULL) { m_ui.setupUi(this); QObject::connect(this, SIGNAL(gameChanged(const Game*)), this, SLOT(updateForGame(const Game*))); + // Status bar + statusBar()->addWidget(new QLabel, 1); + m_dicNameLabel = new QLabel; + m_dicNameLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel); + statusBar()->addPermanentWidget(m_dicNameLabel); + QObject::connect(this, SIGNAL(dicChanged(const Dictionary*)), + this, SLOT(updateStatusBar(const Dictionary*))); + // Board BoardWidget *boardWidget = new BoardWidget; QObject::connect(this, SIGNAL(gameChanged(const Game*)), @@ -121,12 +133,7 @@ MainWindow::MainWindow(QWidget *iParent) // Load dictionary QSettings qs(ORGANIZATION, PACKAGE_NAME); QString dicPath = qs.value(PrefsDialog::kINTF_DIC_PATH, "").toString(); - // FIXME: the messages are not displayed anymore when the window is shown - if (dicPath == "") - { - displayInfoMsg(_q("No dictionary selected")); - } - else + if (dicPath != "") { try { @@ -134,10 +141,10 @@ MainWindow::MainWindow(QWidget *iParent) } catch (...) { - displayInfoMsg(_q("No dictionary selected")); displayErrorMsg(_q("Cannot load dictionary '%1' indicated in the preferences").arg(dicPath)); } } + emit dicChanged(m_dic); } @@ -197,6 +204,15 @@ void MainWindow::updateForGame(const Game *iGame) } +void MainWindow::updateStatusBar(const Dictionary *iDic) +{ + if (iDic == NULL) + m_dicNameLabel->setText("No dictionary"); + else + m_dicNameLabel->setText(qfw(m_dic->getHeader().getName())); +} + + void MainWindow::displayErrorMsg(QString iMsg, QString iContext) { if (iContext == "") @@ -302,59 +318,141 @@ void MainWindow::on_action_GameSaveAs_triggered() } +// Printing parameters +#define TOTAL_WIDTH 500 +#define LINE_HEIGHT 20 +#define FONT_SIZE 12 +#define PEN_WIDTH 2 +#define TEXT_OFFSET 10 +#define SHOULD_ALIGN false + void MainWindow::on_action_GamePrint_triggered() { if (m_game == NULL) return; - displayErrorMsg("Not yet implemented!"); - return; - QPrinter printer(QPrinter::HighResolution); printer.setOutputFileName("/home/ipkiss/dev/eliot/qt-intf/linux/print.pdf"); QPrintDialog printDialog(&printer, this); if (printDialog.exec() == QDialog::Accepted) { - // TODO QPainter painter(&printer); const History &history = m_game->getHistory(); -#define TOTAL_WIDTH 500 -#define LINE_HEIGHT 20 const int colWidths[] = { 30, 150, 150, 70, 70 }; - const int numCols = sizeof(colWidths) / sizeof(int); + const char *colTitles[] = { _("N."), _("RACK"), _("SOLUTION"), _("REF"), _("PTS") }; + const unsigned int nbCols = sizeof(colWidths) / sizeof(int); + const unsigned int nbRows = history.getSize() + (SHOULD_ALIGN ? 1 : 2); double scale = printer.pageRect().width() / double(TOTAL_WIDTH); painter.scale(scale, scale); QPen pen(painter.pen()); - pen.setWidth(1); + pen.setWidth(PEN_WIDTH); painter.setPen(pen); + QFont font; + font.setPixelSize(FONT_SIZE); //QFont font(painter.font(), &painter); - QFont font("Times", 12); painter.setFont(font); int maxRight = 0; - for (int i = 0; i < numCols; ++i) + for (unsigned int i = 0; i < nbCols; ++i) maxRight += colWidths[i]; - int maxBottom = LINE_HEIGHT * (1 + history.getSize()); + int maxBottom = LINE_HEIGHT * (nbRows + 1); // Draw the horizontal lines - painter.drawLine(0, 0, maxRight, 0); - for (unsigned int i = 0; i <= history.getSize(); ++i) - painter.drawLine(0, LINE_HEIGHT * (i + 1), maxRight, LINE_HEIGHT * (i + 1)); + for (unsigned int i = 0; i <= nbRows + 1; ++i) + painter.drawLine(0, LINE_HEIGHT * i, maxRight, LINE_HEIGHT * i); // Draw the vertical lines painter.drawLine(0, 0, 0, maxBottom); int curWidth = 0; - for (int i = 0; i < numCols; ++i) + for (unsigned int i = 0; i < nbCols; ++i) { curWidth += colWidths[i]; painter.drawLine(curWidth, 0, curWidth, maxBottom); } - painter.drawText(190, 4, "SOLUTION"); + // Draw the titles + QFontMetrics fm = painter.fontMetrics(); + int textHeight = fm.boundingRect('A').height(); + curWidth = 0; + int curHeight = (LINE_HEIGHT + textHeight + 1) / 2; + for (unsigned int i = 0; i < nbCols; ++i) + { + int textWidth = fm.width(colTitles[i]); + painter.drawText(curWidth + (colWidths[i] - textWidth) / 2, + curHeight, colTitles[i]); + curWidth += colWidths[i]; + } + + // Draw the history of the game + int score = 0; + int nextHeight; + if (SHOULD_ALIGN) + nextHeight = curHeight; + else + nextHeight = curHeight + LINE_HEIGHT; + for (unsigned int i = 0; i < history.getSize(); ++i) + { + const Turn &t = history.getTurn(i); + const Move &m = t.getMove(); + + curWidth = TEXT_OFFSET; + curHeight += LINE_HEIGHT; + nextHeight += LINE_HEIGHT; + + // Turn number + painter.drawText(curWidth, curHeight, QString("%1").arg(i + 1)); + curWidth += colWidths[0]; + + // Rack + painter.drawText(curWidth, curHeight, + qfw(t.getPlayedRack().toString())); + curWidth += colWidths[1]; + + // Word and coordinates + if (m.getType() == Move::VALID_ROUND) + { + const Round &r = m.getRound(); + painter.drawText(curWidth, nextHeight, qfw(r.getWord())); + curWidth += colWidths[2]; + painter.drawText(curWidth, nextHeight, + qfw(r.getCoord().toString())); + curWidth += colWidths[3]; + } + else if (m.getType() == Move::INVALID_WORD) + { + painter.drawText(curWidth, nextHeight, + "<" + qfw(m.getBadWord()) + ">"); + curWidth += colWidths[2]; + painter.drawText(curWidth, nextHeight, qfw(m.getBadCoord())); + curWidth += colWidths[3]; + } + else if (m.getType() == Move::PASS) + { + painter.drawText(curWidth, nextHeight, _q("(PASS)")); + curWidth += colWidths[2]; + curWidth += colWidths[3]; + } + else + { + painter.drawText(curWidth, nextHeight, + "[-" + qfw(m.getChangedLetters()) + "]"); + curWidth += colWidths[2]; + curWidth += colWidths[3]; + } + + // Score + painter.drawText(curWidth, nextHeight, + QString("%1").arg(m.getScore())); + score += m.getScore(); + } + + // Total score + curHeight += LINE_HEIGHT; + painter.drawText(curWidth, nextHeight, QString("%1").arg(score)); } } diff --git a/qt/main_window.h b/qt/main_window.h index fd376ed..d1529e6 100644 --- a/qt/main_window.h +++ b/qt/main_window.h @@ -34,6 +34,7 @@ class Game; class NewGame; class PrefsDialog; class AuxWindow; +class QLabel; class MainWindow: public QMainWindow { @@ -77,6 +78,9 @@ private slots: */ void updateForGame(const Game *iGame); + /// Update the status bar contents + void updateStatusBar(const Dictionary *iDic); + private: /// Current dictionary const Dictionary *m_dic; @@ -101,6 +105,9 @@ private: AuxWindow *m_dicToolsWindow; //@} + /// Label indicationg the name of the current dictionary + QLabel *m_dicNameLabel; + /// Destroy the current game (if any) and the associated widgets void destroyCurrentGame(); diff --git a/qt/new_game.cpp b/qt/new_game.cpp index 33dc585..2838df1 100644 --- a/qt/new_game.cpp +++ b/qt/new_game.cpp @@ -33,8 +33,8 @@ #include "ai_percent.h" -const QString NewGame::kHUMAN = _q("Human"); -const QString NewGame::kAI = _q("AI"); +const char * NewGame::kHUMAN = _("Human"); +const char * NewGame::kAI = _("Computer"); NewGame::NewGame(QWidget *iParent) @@ -46,10 +46,10 @@ NewGame::NewGame(QWidget *iParent) m_model = new QStandardItemModel(2, 2, this); m_model->setHeaderData(0, Qt::Horizontal, _q("Name"), Qt::DisplayRole); m_model->setHeaderData(1, Qt::Horizontal, _q("Type"), Qt::DisplayRole); - m_model->setData(m_model->index(0, 0), _q("HumanPlayer")); - m_model->setData(m_model->index(0, 1), kHUMAN); + m_model->setData(m_model->index(0, 0), _q("Player")); + m_model->setData(m_model->index(0, 1), _q(kHUMAN)); m_model->setData(m_model->index(1, 0), _q("Eliot")); - m_model->setData(m_model->index(1, 1), kAI); + m_model->setData(m_model->index(1, 1), _q(kAI)); // Initialize the QTreeView with the model we just created treeViewPlayers->setModel(m_model); @@ -113,7 +113,7 @@ Game * NewGame::createGame(const Dictionary &iDic) const QString type = m_model->data(m_model->index(num, 1)).toString(); Player *player; - if (type == kHUMAN) + if (type == _q(kHUMAN)) player = new HumanPlayer; else player = new AIPercent(1); @@ -197,8 +197,8 @@ QWidget *PlayersDelegate::createEditor(QWidget *parent, const QModelIndex &) const { QComboBox *editor = new QComboBox(parent); - editor->addItem(NewGame::kHUMAN); - editor->addItem(NewGame::kAI); + editor->addItem(_q(NewGame::kHUMAN)); + editor->addItem(_q(NewGame::kAI)); return editor; } diff --git a/qt/new_game.h b/qt/new_game.h index 2487067..279583a 100644 --- a/qt/new_game.h +++ b/qt/new_game.h @@ -39,8 +39,8 @@ public: explicit NewGame(QWidget *iParent = 0); /// Possible values for the player type - static const QString kHUMAN; - static const QString kAI; + static const char * kHUMAN; + static const char * kAI; /** * Create and return a game object from the information of the dialog. diff --git a/qt/qtcommon.h b/qt/qtcommon.h index 55a8f29..58d0f8b 100644 --- a/qt/qtcommon.h +++ b/qt/qtcommon.h @@ -21,6 +21,8 @@ #ifndef QT_COMMON_H_ #define QT_COMMON_H_ +#include "config.h" + #if ENABLE_NLS # include # define _(String) gettext(String) diff --git a/qt/ui/dic_tools_widget.ui b/qt/ui/dic_tools_widget.ui index 74131ba..53758d2 100644 --- a/qt/ui/dic_tools_widget.ui +++ b/qt/ui/dic_tools_widget.ui @@ -102,7 +102,7 @@ - _("Minimum length :") + _("Minimum length:") @@ -119,7 +119,7 @@ - _("Maximum length :") + _("Maximum length:") diff --git a/qt/ui/main_window.ui b/qt/ui/main_window.ui index 1b647eb..21b0565 100644 --- a/qt/ui/main_window.ui +++ b/qt/ui/main_window.ui @@ -77,7 +77,7 @@ - _("&Game") + _("Game") @@ -90,21 +90,21 @@ - _("&Settings") + _("Settings") - _("&Help") + _("Help") - _("&Windows") + _("Windows") @@ -155,7 +155,7 @@ - _("&About...") + _("About...") _("About Eliot") @@ -163,7 +163,7 @@ - _("&Quit") + _("Quit") _("Quit Eliot") @@ -185,7 +185,7 @@ true - _("&Bag") + _("Bag") _("Show/hide the remaining tiles in the bag") @@ -201,9 +201,6 @@ _("Edit the preferences") - - Ctrl+Q - @@ -240,7 +237,7 @@ true - _("&External board") + _("External board") _("Show/hide the external board") @@ -251,7 +248,7 @@ true - _("&History") + _("History") _("Show/hide the game history") @@ -276,7 +273,7 @@ true - _("&Dictionary tools") + _("Dictionary tools") _("Show/hide the dictionary tools") diff --git a/qt/ui/new_game.ui b/qt/ui/new_game.ui index b875d40..03d01a2 100644 --- a/qt/ui/new_game.ui +++ b/qt/ui/new_game.ui @@ -53,7 +53,7 @@ Qt::Horizontal - + 16 26 @@ -80,7 +80,7 @@ - QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::NoEditTriggers + QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed false @@ -119,7 +119,7 @@ - _("AI") + _("Computer") @@ -140,7 +140,7 @@ Qt::Horizontal - + 40 20 @@ -169,7 +169,7 @@ Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::Ok diff --git a/qt/ui/prefs_dialog.ui b/qt/ui/prefs_dialog.ui index 22db497..4903c4a 100644 --- a/qt/ui/prefs_dialog.ui +++ b/qt/ui/prefs_dialog.ui @@ -6,11 +6,11 @@ 0 0 343 - 418 + 432 - Dialog + Preferences @@ -50,7 +50,7 @@ - _("If checked, the game and player histories will diaplay the rack and the corresponding solution on the same line") + _("If checked, the game and player histories will display the rack and the corresponding solution on the same line") _("Align the rack and the solution in history") @@ -72,7 +72,7 @@ - _("If checked, playing an invalid or misplaced word will not be possible. If unchecked, you will get 0 point and lose your turn.") + _("If checked, playing an invalid or misplaced word will not be possible. If unchecked, you will get 0 point and lose your turn") _("Refuse to play invalid moves") @@ -93,7 +93,7 @@ Qt::Horizontal - + 40 20 @@ -127,7 +127,7 @@ Qt::Horizontal - + 40 20 @@ -159,7 +159,7 @@ - _("If checked, playing an invalid or misplaced word will not be possible. If unchecked, you will get 0 point and lose your turn.") + _("If checked, playing an invalid or misplaced word will not be possible. If unchecked, you will get 0 point and lose your turn") _("Refuse to play invalid moves") @@ -178,7 +178,7 @@ - _("Nothing yet") + Nothing yet @@ -191,7 +191,7 @@ Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::Ok diff --git a/qt/ui/training_widget.ui b/qt/ui/training_widget.ui index 2137d4f..6630e5e 100644 --- a/qt/ui/training_widget.ui +++ b/qt/ui/training_widget.ui @@ -32,7 +32,7 @@ - _("New Rack") + _("New rack") diff --git a/utils/eliottxt.cpp b/utils/eliottxt.cpp index 9229377..8791dd8 100644 --- a/utils/eliottxt.cpp +++ b/utils/eliottxt.cpp @@ -35,6 +35,7 @@ #endif #include "dic.h" +#include "dic_exception.h" #include "game_io.h" #include "game_factory.h" #include "training.h" @@ -819,7 +820,15 @@ void eliot_regexp(const Dictionary& iDic, wchar_t __attribute__((unused)) *cmd, nres, lmin, lmax); vector wordList; - iDic.searchRegExp(regexp, wordList, lmin, lmax, nres); + try + { + iDic.searchRegExp(regexp, wordList, lmin, lmax, nres); + } + catch (InvalidRegexpException &e) + { + printf("Invalid regular expression: %s\n", e.what()); + return; + } vector::const_iterator it; for (it = wordList.begin(); it != wordList.end(); it++) diff --git a/wxwin/searchpanel.cc b/wxwin/searchpanel.cc index df82609..f3bbb70 100644 --- a/wxwin/searchpanel.cc +++ b/wxwin/searchpanel.cc @@ -29,6 +29,7 @@ #include "ewx.h" #include "dic.h" +#include "dic_exception.h" #include "searchpanel.h" #include "tile.h" #include "configdb.h" @@ -286,7 +287,16 @@ PRegExp::compute_enter(wxCommandEvent&) debug("\n"); vector wordList; - dic->searchRegExp(regexp, wordList, lmin, lmax); + try + { + dic->searchRegExp(regexp, wordList, lmin, lmax); + } + catch (InvalidRegexpException &e) + { + wxString msg = _("Invalid regular expression: ") + wxU(e.what()); + l->Append(msg); + return; + } wxString *res = new wxString[wordList.size()]; int resnum = 0;