eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot TODO qt/board_widget.cpp qt/prefs_dialog....


From: Olivier Teulière
Subject: [Eliot-dev] eliot TODO qt/board_widget.cpp qt/prefs_dialog....
Date: Sun, 04 Jan 2009 17:39:27 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       09/01/04 17:39:27

Modified files:
        .              : TODO 
        qt             : board_widget.cpp prefs_dialog.cpp 
                         prefs_dialog.h 
        qt/ui          : prefs_dialog.ui 

Log message:
         - TODO update
         - Allow displaying letter points on the board with an option (on by 
default)
         - Fixed the tab order on the preferences window
         - Improved the behaviour and default size of the preferences window

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/TODO?cvsroot=eliot&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/board_widget.cpp?cvsroot=eliot&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/prefs_dialog.cpp?cvsroot=eliot&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/prefs_dialog.h?cvsroot=eliot&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/ui/prefs_dialog.ui?cvsroot=eliot&r1=1.8&r2=1.9

Patches:
Index: TODO
===================================================================
RCS file: /cvsroot/eliot/eliot/TODO,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- TODO        8 Jan 2008 13:52:32 -0000       1.7
+++ TODO        4 Jan 2009 17:39:27 -0000       1.8
@@ -1,33 +1,29 @@
+TODO
+====
 
-* ==================
-* Next Eliot version
-* ==================
-
+ - unit tests for the navigation handling, in each mode
  - Improve error handling (use exceptions more)
  - Correct game save/load functions: Advanced format
    file saving for freegames and duplicate need a serious
    rewrite. We need to specify a file format that can handle
    all the information contained in a multiplayer game.
- - rack shuffling
- - new wxWidgets or QT interface
-   - support of the different modes
-   - ability to choose the number and type of the players
-   - ability to display the history and score of all the players
-     -- partly done: history is now a separate class
+ - getopt support for all the interfaces (only ncurses is done)?
  - detection of blocked positions?
- - getopt support for all the interfaces (only ncurses is done)
+ - distinguish misplaced and incorrect words?
 
-* =============
-* Not so urgent
-* =============
+Implementation details
+======================
+
+ - game.h included in board.cpp!
+ - board.h included in coord.cpp!
+ - use Boost.Format?
+ - compile with -ansi -pedantic by default?
+
+Not so urgent
+=============
 
- - network support
  - add timers
+ - network support
  - implement the dictionary as a GADDAG:
    
http://www.cs.ubc.ca/local/reading/proceedings/spe91-95/spe/vol24/issue2/spe880.pdf
 
-
-%%% Local Variables:
-%%% mode: outline
-%%% End:
-

Index: qt/board_widget.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/board_widget.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- qt/board_widget.cpp 30 Nov 2008 20:53:45 -0000      1.7
+++ qt/board_widget.cpp 4 Jan 2009 17:39:27 -0000       1.8
@@ -21,8 +21,10 @@
 #include <math.h>
 #include <QtGui/QPainter>
 #include <QtGui/QPaintEvent>
+#include <QtCore/QSettings>
 
 #include "board_widget.h"
+#include "prefs_dialog.h"
 #include "qtcommon.h"
 #include "public_game.h"
 #include "tile.h"
@@ -71,16 +73,22 @@
     return QSize(400, 400);
 }
 
-
 void BoardWidget::paintEvent(QPaintEvent *)
 {
-    int size = std::min(width(), height());
-    int squareSize = (int)floor((size - 1) / (BOARD_MAX - BOARD_MIN + 2));
+    const int size = std::min(width(), height());
+    const int squareSize = (int)floor((size - 1) / (BOARD_MAX - BOARD_MIN + 
2));
 
     // The font must grow with the square size
-    QFont f = font();
-    f.setPixelSize(squareSize * 2 / 3);
-    setFont(f);
+    QFont letterFont = font();
+    letterFont.setPixelSize(squareSize * 2 / 3);
+
+    QFont pointsFont = font();
+    const double pointsCoeff = 8. / 25.;
+    pointsFont.setPixelSize(squareSize * pointsCoeff);
+
+    // Should we display the tiles points?
+    QSettings qs(ORGANIZATION, PACKAGE_NAME);
+    bool showPoints = qs.value(PrefsDialog::kINTF_SHOW_TILES_POINTS, 
true).toBool();
 
     // XXX: Naive implementation: we repaint everything every time
     QPainter painter(this);
@@ -117,18 +125,32 @@
                 wchar_t chr = m_game->getBoard().getTile(row, col).toChar();
                 if (m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER)
                     painter.setPen(JokerColour);
+                painter.setFont(letterFont);
                 painter.drawText((col - BOARD_MIN + 1) * squareSize,
                                  (row - BOARD_MIN + 1) * squareSize + 1,
                                  squareSize, squareSize,
                                  Qt::AlignCenter,
                                  qfw(wstring(1, chr)));
                 painter.setPen(NormalColour);
+
+                // Draw the points of the tile
+                if (showPoints &&
+                    !m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER)
+                {
+                    painter.setFont(pointsFont);
+                    painter.drawText((col - BOARD_MIN + 1) * squareSize + 
squareSize * (1 - pointsCoeff),
+                                     (row - BOARD_MIN + 1) * squareSize + 
squareSize * (1 - pointsCoeff) + 1,
+                                     squareSize * pointsCoeff, squareSize * 
pointsCoeff + 3,
+                                     Qt::AlignRight | Qt::AlignBottom,
+                                     
QString("%1").arg(m_game->getBoard().getTile(row, col).getPoints()));
+                }
             }
         }
     }
     // Draw the coordinates
     for (unsigned x = 1; x <= BOARD_MAX - BOARD_MIN + 1; ++x)
     {
+        painter.setFont(letterFont);
         painter.drawText(x * squareSize, 1,
                          squareSize, squareSize,
                          Qt::AlignCenter,

Index: qt/prefs_dialog.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/prefs_dialog.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- qt/prefs_dialog.cpp 14 Dec 2008 13:20:48 -0000      1.8
+++ qt/prefs_dialog.cpp 4 Jan 2009 17:39:27 -0000       1.9
@@ -31,6 +31,7 @@
 
 const QString PrefsDialog::kINTF_ALIGN_HISTORY = "Interface/AlignHistory";
 const QString PrefsDialog::kINTF_DIC_PATH = "Interface/DicPath";
+const QString PrefsDialog::kINTF_SHOW_TILES_POINTS = 
"Interface/ShowTilesPoints";
 const QString PrefsDialog::kINTF_WARN_REPLAY_TURN = "Interface/WarnReplayTurn";
 const QString PrefsDialog::kINTF_SHOW_TOOLBAR = "Interface/ShowToolBar";
 const QString PrefsDialog::kINTF_LINK_TRAINING_7P1 = 
"Interface/LinkTrainingRackWith7P1";
@@ -47,6 +48,8 @@
         QSettings qs(ORGANIZATION, PACKAGE_NAME);
         lineEditIntfDicPath->setText(qs.value(kINTF_DIC_PATH, "").toString());
         
checkBoxIntfAlignHistory->setChecked(qs.value(kINTF_ALIGN_HISTORY).toBool());
+        bool showPoints = qs.value(kINTF_SHOW_TILES_POINTS, true).toBool();
+        checkBoxIntfShowPoints->setChecked(showPoints);
         bool warnReplayTurn = qs.value(kINTF_WARN_REPLAY_TURN, true).toBool();
         checkBoxIntfWarnReplayTurn->setChecked(warnReplayTurn);
         bool linkTraining7P1 = qs.value(kINTF_LINK_TRAINING_7P1, 
false).toBool();
@@ -68,9 +71,6 @@
         QMessageBox::warning(this, _q("%1 error").arg(PACKAGE_NAME),
                              _q("Cannot load preferences: %1").arg(e.what()));
     }
-
-    // Resize the dialog so that it gets its minimal size
-    resize(10, 10);
 }
 
 
@@ -99,14 +99,20 @@
         // Interface settings
         QSettings qs(ORGANIZATION, PACKAGE_NAME);
         qs.setValue(kINTF_DIC_PATH, lineEditIntfDicPath->text());
-        if (qs.value(kINTF_ALIGN_HISTORY).toBool() != 
checkBoxIntfAlignHistory->isChecked())
+        if (qs.value(kINTF_ALIGN_HISTORY, true).toBool() != 
checkBoxIntfAlignHistory->isChecked())
         {
             // We need to redraw the history widget
             shouldEmitUpdate = true;
             qs.setValue(kINTF_ALIGN_HISTORY, 
checkBoxIntfAlignHistory->isChecked());
         }
+        if (qs.value(kINTF_SHOW_TILES_POINTS, true).toBool() != 
checkBoxIntfShowPoints->isChecked())
+        {
+            // We need to redraw the board
+            shouldEmitUpdate = true;
+            qs.setValue(kINTF_SHOW_TILES_POINTS, 
checkBoxIntfShowPoints->isChecked());
+        }
         qs.setValue(kINTF_WARN_REPLAY_TURN, 
checkBoxIntfWarnReplayTurn->isChecked());
-        if (qs.value(kINTF_LINK_TRAINING_7P1).toBool() != 
checkBoxIntfLinkTraining7P1->isChecked())
+        if (qs.value(kINTF_LINK_TRAINING_7P1, false).toBool() != 
checkBoxIntfLinkTraining7P1->isChecked())
         {
             // We need to (dis)connect the training widget with the dictionary
             // tools window

Index: qt/prefs_dialog.h
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/prefs_dialog.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- qt/prefs_dialog.h   14 Dec 2008 13:20:48 -0000      1.5
+++ qt/prefs_dialog.h   4 Jan 2009 17:39:27 -0000       1.6
@@ -36,6 +36,7 @@
 
     static const QString kINTF_ALIGN_HISTORY;
     static const QString kINTF_DIC_PATH;
+    static const QString kINTF_SHOW_TILES_POINTS;
     static const QString kINTF_WARN_REPLAY_TURN;
     static const QString kINTF_SHOW_TOOLBAR;
     static const QString kINTF_LINK_TRAINING_7P1;

Index: qt/ui/prefs_dialog.ui
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/ui/prefs_dialog.ui,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- qt/ui/prefs_dialog.ui       14 Dec 2008 13:20:50 -0000      1.8
+++ qt/ui/prefs_dialog.ui       4 Jan 2009 17:39:27 -0000       1.9
@@ -1,14 +1,6 @@
 <ui version="4.0" >
  <class>PrefsDialog</class>
  <widget class="QDialog" name="PrefsDialog" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>508</width>
-    <height>442</height>
-   </rect>
-  </property>
   <property name="windowTitle" >
    <string>_("Preferences")</string>
   </property>
@@ -18,7 +10,7 @@
      <property name="title" >
       <string>_("Interface")</string>
      </property>
-     <layout class="QVBoxLayout" >
+     <layout class="QVBoxLayout" name="verticalLayout_2" >
       <item>
        <layout class="QHBoxLayout" >
         <item>
@@ -32,7 +24,7 @@
          <widget class="QLineEdit" name="lineEditIntfDicPath" >
           <property name="minimumSize" >
            <size>
-            <width>130</width>
+            <width>140</width>
             <height>0</height>
            </size>
           </property>
@@ -54,6 +46,19 @@
        </layout>
       </item>
       <item>
+       <widget class="QCheckBox" name="checkBoxIntfShowPoints" >
+        <property name="toolTip" >
+         <string>_("Show/hide the tiles points on the board.")</string>
+        </property>
+        <property name="text" >
+         <string>_("Display tiles points")</string>
+        </property>
+        <property name="checked" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
        <widget class="QCheckBox" name="checkBoxIntfAlignHistory" >
         <property name="toolTip" >
          <string>_("If checked, the game and player histories will display the 
rack and the corresponding solution on the same line")</string>
@@ -87,8 +92,8 @@
      <property name="title" >
       <string>_("Duplicate mode")</string>
      </property>
-     <layout class="QVBoxLayout" >
-      <item>
+     <layout class="QGridLayout" name="gridLayout" >
+      <item row="0" column="0" colspan="2" >
        <widget class="QCheckBox" name="checkBoxDuplRefuseInvalid" >
         <property name="toolTip" >
          <string>_("If checked, playing an invalid or misplaced word will not 
be possible. If unchecked, you will get 0 point and lose your turn")</string>
@@ -98,51 +103,32 @@
         </property>
        </widget>
       </item>
-      <item>
-       <layout class="QHBoxLayout" >
-        <item>
+      <item row="2" column="0" >
          <widget class="QLabel" name="label_2" >
           <property name="text" >
            <string>_("Min. players for a solo:")</string>
           </property>
          </widget>
         </item>
-        <item>
-         <spacer>
-          <property name="orientation" >
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" stdset="0" >
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
+      <item row="3" column="0" >
+       <widget class="QLabel" name="label_3" >
+        <property name="text" >
+         <string>_("Solo value:")</string>
           </property>
-         </spacer>
+       </widget>
         </item>
-        <item>
-         <widget class="QSpinBox" name="spinBoxDuplSoloPlayers" >
+      <item row="3" column="1" >
+       <widget class="QSpinBox" name="spinBoxDuplSoloValue" >
           <property name="toolTip" >
-           <string>_("Minimum number of players needed to take into account 
the solo bonus")</string>
+         <string>_("Value of the solo bonus. Set it to 0 if you don't want 
solo bonus")</string>
           </property>
           <property name="value" >
-           <number>16</number>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" >
-        <item>
-         <widget class="QLabel" name="label_3" >
-          <property name="text" >
-           <string>_("Solo value:")</string>
+         <number>10</number>
           </property>
          </widget>
         </item>
-        <item>
-         <spacer>
+      <item row="2" column="2" >
+       <spacer name="horizontalSpacer" >
           <property name="orientation" >
            <enum>Qt::Horizontal</enum>
           </property>
@@ -154,19 +140,23 @@
           </property>
          </spacer>
         </item>
-        <item>
-         <widget class="QSpinBox" name="spinBoxDuplSoloValue" >
+      <item row="2" column="1" >
+       <widget class="QSpinBox" name="spinBoxDuplSoloPlayers" >
           <property name="toolTip" >
-           <string>_("Value of the solo bonus. Set it to 0 if you don't want 
solo bonus")</string>
+         <string>_("Minimum number of players needed to take into account the 
solo bonus")</string>
           </property>
           <property name="value" >
-           <number>10</number>
+         <number>16</number>
           </property>
          </widget>
         </item>
        </layout>
-      </item>
-     </layout>
+     <zorder>checkBoxDuplRefuseInvalid</zorder>
+     <zorder>label_2</zorder>
+     <zorder>label_3</zorder>
+     <zorder>spinBoxDuplSoloValue</zorder>
+     <zorder>horizontalSpacer</zorder>
+     <zorder>spinBoxDuplSoloPlayers</zorder>
     </widget>
    </item>
    <item>
@@ -220,11 +210,16 @@
   </layout>
  </widget>
  <tabstops>
+  <tabstop>lineEditIntfDicPath</tabstop>
+  <tabstop>pushButtonIntfDicBrowse</tabstop>
+  <tabstop>checkBoxIntfShowPoints</tabstop>
   <tabstop>checkBoxIntfAlignHistory</tabstop>
+  <tabstop>checkBoxIntfWarnReplayTurn</tabstop>
   <tabstop>checkBoxDuplRefuseInvalid</tabstop>
   <tabstop>spinBoxDuplSoloPlayers</tabstop>
   <tabstop>spinBoxDuplSoloValue</tabstop>
   <tabstop>checkBoxFreeRefuseInvalid</tabstop>
+  <tabstop>checkBoxIntfLinkTraining7P1</tabstop>
   <tabstop>buttonBox</tabstop>
  </tabstops>
  <resources/>




reply via email to

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