mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-13 20:03:23 +01:00
Dic:
- Throw an exception if a regular expresison is invalid - Handle the exception in callers code Game: - Fixed a bug in setRackRandom() Qt interface: - Display the dictionary name in the status bar - Implemented printing - Translation of the interface into French. The menus have temporarily lost their accelerator keys in English.
This commit is contained in:
parent
a32f1b7aaf
commit
75a67b28a5
22 changed files with 1437 additions and 393 deletions
|
@ -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<wstring> &oWordList,
|
||||
|
|
|
@ -34,3 +34,9 @@ const char *DicException::what() const throw()
|
|||
return m_message.c_str();
|
||||
}
|
||||
|
||||
|
||||
InvalidRegexpException::InvalidRegexpException(const string &iMessage)
|
||||
: DicException(iMessage)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <cwctype>
|
||||
|
||||
#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];
|
||||
|
|
|
@ -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<wstring> wordList;
|
||||
dic.searchRegExp(convertToWc(line), wordList, 1, 15);
|
||||
|
||||
cout << _("result:") << endl;
|
||||
vector<wstring>::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<wstring>::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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
718
po/eliot.pot
718
po/eliot.pot
File diff suppressed because it is too large
Load diff
|
@ -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<wstring> 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<wstring>::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;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QDockWidget>
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#ifndef QT_COMMON_H_
|
||||
#define QT_COMMON_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(String) gettext(String)
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>_("Minimum length :")</string>
|
||||
<string>_("Minimum length:")</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -119,7 +119,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>_("Maximum length :")</string>
|
||||
<string>_("Maximum length:")</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
</property>
|
||||
<widget class="QMenu" name="menuFile" >
|
||||
<property name="title" >
|
||||
<string>_("&Game")</string>
|
||||
<string>_("Game")</string>
|
||||
</property>
|
||||
<addaction name="action_GameNew" />
|
||||
<addaction name="separator" />
|
||||
|
@ -90,21 +90,21 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuHelp" >
|
||||
<property name="title" >
|
||||
<string>_("&Settings")</string>
|
||||
<string>_("Settings")</string>
|
||||
</property>
|
||||
<addaction name="action_SettingsChooseDic" />
|
||||
<addaction name="action_SettingsPreferences" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Help" >
|
||||
<property name="title" >
|
||||
<string>_("&Help")</string>
|
||||
<string>_("Help")</string>
|
||||
</property>
|
||||
<addaction name="action_HelpAbout" />
|
||||
<addaction name="separator" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Windows" >
|
||||
<property name="title" >
|
||||
<string>_("&Windows")</string>
|
||||
<string>_("Windows")</string>
|
||||
</property>
|
||||
<addaction name="action_WindowsBag" />
|
||||
<addaction name="action_WindowsBoard" />
|
||||
|
@ -155,7 +155,7 @@
|
|||
</action>
|
||||
<action name="action_HelpAbout" >
|
||||
<property name="text" >
|
||||
<string>_("&About...")</string>
|
||||
<string>_("About...")</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>_("About Eliot")</string>
|
||||
|
@ -163,7 +163,7 @@
|
|||
</action>
|
||||
<action name="action_GameQuit" >
|
||||
<property name="text" >
|
||||
<string>_("&Quit")</string>
|
||||
<string>_("Quit")</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>_("Quit Eliot")</string>
|
||||
|
@ -185,7 +185,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>_("&Bag")</string>
|
||||
<string>_("Bag")</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>_("Show/hide the remaining tiles in the bag")</string>
|
||||
|
@ -201,9 +201,6 @@
|
|||
<property name="statusTip" >
|
||||
<string>_("Edit the preferences")</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_GameSave" >
|
||||
<property name="text" >
|
||||
|
@ -240,7 +237,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>_("&External board")</string>
|
||||
<string>_("External board")</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>_("Show/hide the external board")</string>
|
||||
|
@ -251,7 +248,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>_("&History")</string>
|
||||
<string>_("History")</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>_("Show/hide the game history")</string>
|
||||
|
@ -276,7 +273,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>_("&Dictionary tools")</string>
|
||||
<string>_("Dictionary tools")</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>_("Show/hide the dictionary tools")</string>
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>26</height>
|
||||
|
@ -80,7 +80,7 @@
|
|||
<item>
|
||||
<widget class="QTreeView" name="treeViewPlayers" >
|
||||
<property name="editTriggers" >
|
||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::NoEditTriggers</set>
|
||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||
</property>
|
||||
<property name="rootIsDecorated" >
|
||||
<bool>false</bool>
|
||||
|
@ -119,7 +119,7 @@
|
|||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>_("AI")</string>
|
||||
<string>_("Computer")</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
@ -140,7 +140,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -169,7 +169,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>343</width>
|
||||
<height>418</height>
|
||||
<height>432</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
|
@ -50,7 +50,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxIntfAlignHistory" >
|
||||
<property name="toolTip" >
|
||||
<string>_("If checked, the game and player histories will diaplay the rack and the corresponding solution on the same line")</string>
|
||||
<string>_("If checked, the game and player histories will display the rack and the corresponding solution on the same line")</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>_("Align the rack and the solution in history")</string>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<item>
|
||||
<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>
|
||||
<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>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>_("Refuse to play invalid moves")</string>
|
||||
|
@ -93,7 +93,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -127,7 +127,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -159,7 +159,7 @@
|
|||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxFreeRefuseInvalid" >
|
||||
<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>
|
||||
<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>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>_("Refuse to play invalid moves")</string>
|
||||
|
@ -178,7 +178,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>_("Nothing yet")</string>
|
||||
<string>Nothing yet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -191,7 +191,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="pushButtonRack" >
|
||||
<property name="text" >
|
||||
<string>_("New Rack")</string>
|
||||
<string>_("New rack")</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -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<wstring> 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<wstring>::const_iterator it;
|
||||
for (it = wordList.begin(); it != wordList.end(); it++)
|
||||
|
|
|
@ -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<wstring> 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;
|
||||
|
|
Loading…
Reference in a new issue