eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot/qt play_word_mediator.cpp player_widget.cpp


From: Olivier Teulière
Subject: [Eliot-dev] eliot/qt play_word_mediator.cpp player_widget.cpp
Date: Mon, 10 Jan 2011 22:06:10 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       11/01/10 22:06:10

Modified files:
        qt             : play_word_mediator.cpp player_widget.cpp 

Log message:
        Improved error messages when changing letters and/or passing

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/play_word_mediator.cpp?cvsroot=eliot&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/player_widget.cpp?cvsroot=eliot&r1=1.17&r2=1.18

Patches:
Index: play_word_mediator.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/play_word_mediator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- play_word_mediator.cpp      22 Oct 2010 16:58:37 -0000      1.4
+++ play_word_mediator.cpp      10 Jan 2011 22:06:10 -0000      1.5
@@ -146,50 +146,49 @@
     else
     {
         // Try to be as explicit as possible concerning the error
-        QString msg = _q("Cannot play '%1' at position '%2':\n")
+        QString msg = _q("Cannot play '%1' at position '%2':\n%3")
             .arg(m_lineEditPlay.text()).arg(coords);
         switch (res)
         {
             case 1:
-                msg += _q("Some letters are not valid for the current 
dictionary");
+                msg = msg.arg(_q("Some letters are not valid for the current 
dictionary"));
                 break;
             case 2:
-                msg += _q("Invalid coordinates");
+                msg = msg.arg(_q("Invalid coordinates"));
                 break;
             case 3:
-                msg += _q("The word does not exist");
+                msg = msg.arg(_q("The word does not exist"));
                 break;
             case 4:
-                msg += _q("The rack doesn't contain the letters needed to play 
this word");
+                msg = msg.arg(_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");
+                msg = msg.arg(_q("The word is part of a longer one"));
                 break;
             case 6:
-                msg += _q("The word tries to replace an existing letter");
+                msg = msg.arg(_q("The word tries to replace an existing 
letter"));
                 break;
             case 7:
-                msg += _q("An orthogonal word is not valid");
+                msg = msg.arg(_q("An orthogonal word is not valid"));
                 break;
             case 8:
-                msg += _q("The word is already present on the board at these 
coordinates");
+                msg = msg.arg(_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)");
+                msg = msg.arg(_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");
+                msg = msg.arg(_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");
+                msg = msg.arg(_q("The first word of the game must cover the H8 
square"));
                 break;
             case 12:
-                msg += _q("The word is going out of the board");
+                msg = msg.arg(_q("The word is going out of the board"));
                 break;
             default:
-                msg += _q("Incorrect or misplaced word (%1)").arg(1);
+                msg = msg.arg(_q("Incorrect or misplaced word"));
         }
-        // FIXME: the error is too generic
         emit notifyProblem(msg);
     }
 }

Index: player_widget.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/player_widget.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- player_widget.cpp   3 Jul 2009 21:40:15 -0000       1.17
+++ player_widget.cpp   10 Jan 2011 22:06:10 -0000      1.18
@@ -159,12 +159,21 @@
         emit gameUpdated();
     else
     {
-        // FIXME: the error is too generic
         QString msg;
         if (inputLetters == "")
-            msg = _q("Cannot pass turn (%1)").arg(res);
+            msg = _q("Cannot pass turn:\n%1");
         else
-            msg = _q("Cannot change letters '%1' 
(%2)").arg(inputLetters).arg(res);
+            msg = _q("Cannot change letters '%1':\n%2").arg(inputLetters);
+        if (res == 1)
+            msg = msg.arg(_q("Changing letters is not allowed when there are 
less than 7 tiles left in the bag"));
+        else if (res == 2)
+            msg = msg.arg(_q("The rack of the current player does not contain 
all the listed letters"));
+        else if (res == 3)
+            msg = msg.arg(_q("The game is already finished!"));
+        else if (res == 3)
+            msg = msg.arg(_q("Some letters are invalid for the current 
dictionary"));
+        else
+            msg = msg.arg(_q("Unknwon error"));
         emit notifyProblem(msg);
     }
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]