[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot Makefile.am dic/dic.h dic/dic_search.cpp ...
From: |
eliot-dev |
Subject: |
[Eliot-dev] eliot Makefile.am dic/dic.h dic/dic_search.cpp ... |
Date: |
Wed, 27 Aug 2008 21:20:18 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 08/08/27 21:20:18
Modified files:
. : Makefile.am
dic : dic.h dic_search.cpp
qt : Makefile.am main_window.cpp main_window.h
qt/ui : main_window.ui prefs_dialog.ui
test : regexp.ref
Added files:
qt : dic_tools_widget.cpp dic_tools_widget.h
qt/ui : dic_tools_widget.ui
Log message:
Dic:
- regexp search results are now in uppercase, like other results
- the regexp search indicates if there are more results than the
maximum
allowed
Qt interface:
- new window with some dictionary tools: check word, word+1 and regexp
search
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/Makefile.am?cvsroot=eliot&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/dic.h?cvsroot=eliot&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/dic_search.cpp?cvsroot=eliot&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/Makefile.am?cvsroot=eliot&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/main_window.cpp?cvsroot=eliot&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/main_window.h?cvsroot=eliot&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/dic_tools_widget.cpp?cvsroot=eliot&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/dic_tools_widget.h?cvsroot=eliot&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/ui/main_window.ui?cvsroot=eliot&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/ui/prefs_dialog.ui?cvsroot=eliot&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/ui/dic_tools_widget.ui?cvsroot=eliot&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/eliot/test/regexp.ref?cvsroot=eliot&r1=1.3&r2=1.4
Patches:
Index: Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Makefile.am 20 Jan 2008 18:40:12 -0000 1.7
+++ Makefile.am 27 Aug 2008 21:20:03 -0000 1.8
@@ -18,7 +18,7 @@
mkdir -p $(WIN32_PACKAGE_DIR)
# Copy the binaries and strip them
- cp $(top_builddir)/wxwin/eliot$(EXEEXT)
$(top_builddir)/dic/compdic$(EXEEXT) $(top_builddir)/dic/listdic$(EXEEXT)
$(WIN32_PACKAGE_DIR)
+ cp $(top_builddir)/wxwin/eliot$(EXEEXT)
$(top_builddir)/dic/compdic$(EXEEXT) $(top_builddir)/dic/listdic$(EXEEXT)
$(top_builddir)/qt/qeliot$(EXEEXT) $(WIN32_PACKAGE_DIR)
$(STRIP) $(WIN32_PACKAGE_DIR)/*
# Copy the i18n files
Index: dic/dic.h
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/dic.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- dic/dic.h 27 Jul 2008 13:32:47 -0000 1.17
+++ dic/dic.h 27 Aug 2008 21:20:06 -0000 1.18
@@ -223,8 +223,11 @@
* @param oWordList: results
* @param iList: parameters for the search (?)
* @param iMaxResults: maximum number of returned results (0 means no
limit)
+ * @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)
*/
- void searchRegExp(const wstring &iRegexp,
+ bool searchRegExp(const wstring &iRegexp,
vector<wstring> &oWordList,
unsigned int iMinLength,
unsigned int iMaxLength,
Index: dic/dic_search.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/dic_search.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- dic/dic_search.cpp 28 Jul 2008 18:37:09 -0000 1.9
+++ dic/dic_search.cpp 27 Aug 2008 21:20:09 -0000 1.10
@@ -489,7 +489,7 @@
if (next_state)
{
params->word[params->wordlen] =
- towlower(getHeader().getCharFromCode(current->chr));
+ getHeader().getCharFromCode(current->chr);
params->wordlen ++;
searchRegexpRecTempl(params, next_state, current, oWordList,
iMaxResults);
params->wordlen --;
@@ -536,16 +536,18 @@
}
-void Dictionary::searchRegExp(const wstring &iRegexp,
+bool Dictionary::searchRegExp(const wstring &iRegexp,
vector<wstring> &oWordList,
unsigned int iMinLength,
unsigned int iMaxLength,
unsigned int iMaxResults) const
{
+ // XXX: throw an exception?
if (iRegexp == L"")
- return;
+ return true;
// Allocate room for all the results
+ // XXX: is it really a good idea?
if (iMaxResults)
oWordList.reserve(iMaxResults);
else
@@ -560,9 +562,9 @@
if (!parsingOk)
{
- // TODO
+ // TODO: throw an exception
delete root;
- return;
+ return true;
}
int ptl[REGEXP_MAX+1];
@@ -594,16 +596,27 @@
if (getHeader().getVersion() == 0)
{
searchRegexpRecTempl(¶ms, a->getInitId(),
- getEdgeAt<DicEdgeOld>(getRoot()), oWordList,
iMaxResults);
+ getEdgeAt<DicEdgeOld>(getRoot()), oWordList,
+ iMaxResults ? iMaxResults + 1 : 0);
}
else
{
searchRegexpRecTempl(¶ms, a->getInitId(),
- getEdgeAt<DicEdge>(getRoot()), oWordList,
iMaxResults);
+ getEdgeAt<DicEdge>(getRoot()), oWordList,
+ iMaxResults ? iMaxResults + 1 : 0);
}
delete a;
}
delete root;
+
+ // Check whether the maximum number of results was reached
+ if (iMaxResults && oWordList.size() > iMaxResults)
+ {
+ oWordList.pop_back();
+ return false;
+ }
+ else
+ return true;
}
Index: qt/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- qt/Makefile.am 25 Jan 2008 18:42:59 -0000 1.3
+++ qt/Makefile.am 27 Aug 2008 21:20:16 -0000 1.4
@@ -31,7 +31,8 @@
ui/new_game.ui \
ui/training_widget.ui \
ui/prefs_dialog.ui \
- ui/player_widget.ui
+ ui/player_widget.ui \
+ ui/dic_tools_widget.ui
BUILT_SOURCES = \
ui/main_window.ui.h \
@@ -39,7 +40,9 @@
ui/player_widget.ui.h \
ui/training_widget.ui.h \
ui/prefs_dialog.ui.h \
+ ui/dic_tools_widget.ui.h \
new_game.moc.cpp \
+ dic_tools_widget.moc.cpp \
bag_widget.moc.cpp \
score_widget.moc.cpp \
board_widget.moc.cpp \
@@ -53,6 +56,7 @@
qeliot_SOURCES = \
qtcommon.h \
bag_widget.cpp bag_widget.h \
+ dic_tools_widget.cpp dic_tools_widget.h \
new_game.cpp new_game.h \
score_widget.cpp score_widget.h \
board_widget.cpp board_widget.h \
Index: qt/main_window.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/main_window.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- qt/main_window.cpp 26 Jan 2008 23:03:34 -0000 1.7
+++ qt/main_window.cpp 27 Aug 2008 21:20:17 -0000 1.8
@@ -26,6 +26,9 @@
#include <QtGui/QFileDialog>
#include <QtGui/QDockWidget>
#include <QtGui/QCloseEvent>
+#include <QtGui/QPrintDialog>
+#include <QtGui/QPrinter>
+#include <QtGui/QPainter>
#include <QtCore/QSettings>
#include "main_window.h"
@@ -44,6 +47,7 @@
#include "score_widget.h"
#include "player_widget.h"
#include "history_widget.h"
+#include "dic_tools_widget.h"
#include "training_widget.h"
#include "aux_window.h"
#include "qtcommon.h"
@@ -55,7 +59,7 @@
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_historyWindow(NULL), m_dicToolsWindow(NULL)
{
m_ui.setupUi(this);
QObject::connect(this, SIGNAL(gameChanged(const Game*)),
@@ -68,12 +72,16 @@
QObject::connect(this, SIGNAL(gameUpdated()),
boardWidget, SLOT(refresh()));
+ QHBoxLayout *hlayout = new QHBoxLayout;
+#if 0
QDockWidget *dock = new QDockWidget;
dock->setWidget(boardWidget);
boardWidget->setWindowTitle(_q("Board"));
- QHBoxLayout *hlayout = new QHBoxLayout;
hlayout->addWidget(dock);
+#else
+ hlayout->addWidget(boardWidget);
+#endif
m_ui.groupBoxTest->setLayout(hlayout);
@@ -138,6 +146,7 @@
delete m_bagWindow;
delete m_boardWindow;
delete m_historyWindow;
+ delete m_dicToolsWindow;
delete m_game;
delete m_dic;
}
@@ -165,11 +174,13 @@
if (iGame == NULL)
{
m_ui.action_GameSaveAs->setEnabled(false);
+ m_ui.action_GamePrint->setEnabled(false);
setWindowTitle(_q("No game") + " - Eliot");
}
else
{
m_ui.action_GameSaveAs->setEnabled(true);
+ m_ui.action_GamePrint->setEnabled(true);
if (iGame->getMode() == Game::kTRAINING)
{
setWindowTitle(_q("Training mode") + " - Eliot");
@@ -210,6 +221,8 @@
m_boardWindow->close();
if (m_historyWindow)
m_historyWindow->close();
+ if (m_dicToolsWindow)
+ m_dicToolsWindow->close();
event->accept();
}
@@ -289,6 +302,63 @@
}
+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);
+
+ double scale = printer.pageRect().width() / double(TOTAL_WIDTH);
+ painter.scale(scale, scale);
+
+ QPen pen(painter.pen());
+ pen.setWidth(1);
+ painter.setPen(pen);
+
+ //QFont font(painter.font(), &painter);
+ QFont font("Times", 12);
+ painter.setFont(font);
+
+ int maxRight = 0;
+ for (int i = 0; i < numCols; ++i)
+ maxRight += colWidths[i];
+ int maxBottom = LINE_HEIGHT * (1 + history.getSize());
+
+ // 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));
+
+ // Draw the vertical lines
+ painter.drawLine(0, 0, 0, maxBottom);
+ int curWidth = 0;
+ for (int i = 0; i < numCols; ++i)
+ {
+ curWidth += colWidths[i];
+ painter.drawLine(curWidth, 0, curWidth, maxBottom);
+ }
+
+ painter.drawText(190, 4, "SOLUTION");
+ }
+}
+
+
void MainWindow::on_action_SettingsPreferences_triggered()
{
if (m_prefsDialog == NULL)
@@ -324,7 +394,7 @@
Dictionary *dic = new Dictionary(qtl(fileName));
delete m_dic;
m_dic = dic;
- emit dicChanged(fileName, qfw(m_dic->getHeader().getName()));
+ emit dicChanged(m_dic);
displayInfoMsg(QString("Loaded dictionary '%1'").arg(fileName));
// Save the location of the dictionary in the preferences
@@ -394,6 +464,24 @@
}
+void MainWindow::on_action_WindowsDicTools_triggered()
+{
+ if (m_dicToolsWindow == NULL)
+ {
+ // Create the window
+ DicToolsWidget *dicTools = new DicToolsWidget(NULL);
+ m_dicToolsWindow = new AuxWindow(*dicTools, _q("Dictionary tools"),
"DicTools",
+ m_ui.action_WindowsDicTools);
+ QObject::connect(this, SIGNAL(dicChanged(const Dictionary*)),
+ dicTools, SLOT(setDic(const Dictionary*)));
+ // Fake a dictionary selection
+ dicTools->setDic(m_dic);
+ dicTools->setFocus();
+ }
+ m_dicToolsWindow->toggleVisibility();
+}
+
+
void MainWindow::on_action_HelpAbout_triggered()
{
QString msg;
Index: qt/main_window.h
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/main_window.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- qt/main_window.h 26 Jan 2008 23:03:34 -0000 1.7
+++ qt/main_window.h 27 Aug 2008 21:20:17 -0000 1.8
@@ -44,7 +44,7 @@
~MainWindow();
signals:
- void dicChanged(QString iDicFile, QString iDicName);
+ void dicChanged(const Dictionary *iDic);
void gameChanged(const Game *iGame);
void gameChangedNonConst(Game *iGame);
void gameUpdated();
@@ -62,11 +62,13 @@
void on_action_GameNew_triggered();
void on_action_GameLoad_triggered();
void on_action_GameSaveAs_triggered();
+ void on_action_GamePrint_triggered();
void on_action_SettingsChooseDic_triggered();
void on_action_SettingsPreferences_triggered();
void on_action_WindowsBag_triggered();
void on_action_WindowsBoard_triggered();
void on_action_WindowsHistory_triggered();
+ void on_action_WindowsDicTools_triggered();
void on_action_HelpAbout_triggered();
/**
@@ -96,6 +98,7 @@
AuxWindow *m_bagWindow;
AuxWindow *m_boardWindow;
AuxWindow *m_historyWindow;
+ AuxWindow *m_dicToolsWindow;
//@}
/// Destroy the current game (if any) and the associated widgets
Index: qt/ui/main_window.ui
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/ui/main_window.ui,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- qt/ui/main_window.ui 26 Jan 2008 23:03:35 -0000 1.6
+++ qt/ui/main_window.ui 27 Aug 2008 21:20:17 -0000 1.7
@@ -13,9 +13,18 @@
<string>Eliot</string>
</property>
<property name="windowIcon" >
- <iconset>../../../bzr-cppdic/wxwin/eliot.xpm</iconset>
+ <iconset>
+
<normaloff>../../../bzr-cppdic/wxwin/eliot.xpm</normaloff>../../../bzr-cppdic/wxwin/eliot.xpm</iconset>
</property>
<widget class="QWidget" name="centralwidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>37</y>
+ <width>747</width>
+ <height>557</height>
+ </rect>
+ </property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
@@ -63,7 +72,7 @@
<x>0</x>
<y>0</y>
<width>747</width>
- <height>29</height>
+ <height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile" >
@@ -71,15 +80,17 @@
<string>_("&Game")</string>
</property>
<addaction name="action_GameNew" />
- <addaction name="action_GameLoad" />
<addaction name="separator" />
+ <addaction name="action_GameLoad" />
<addaction name="action_GameSaveAs" />
<addaction name="separator" />
+ <addaction name="action_GamePrint" />
+ <addaction name="separator" />
<addaction name="action_GameQuit" />
</widget>
<widget class="QMenu" name="menuHelp" >
<property name="title" >
- <string>&Settings</string>
+ <string>_("&Settings")</string>
</property>
<addaction name="action_SettingsChooseDic" />
<addaction name="action_SettingsPreferences" />
@@ -98,14 +109,32 @@
<addaction name="action_WindowsBag" />
<addaction name="action_WindowsBoard" />
<addaction name="action_WindowsHistory" />
+ <addaction name="action_WindowsDicTools" />
</widget>
<addaction name="menuFile" />
<addaction name="menuHelp" />
<addaction name="menu_Windows" />
<addaction name="menu_Help" />
</widget>
- <widget class="QStatusBar" name="statusbar" />
+ <widget class="QStatusBar" name="statusbar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>594</y>
+ <width>747</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
<widget class="QToolBar" name="toolBar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>26</y>
+ <width>747</width>
+ <height>11</height>
+ </rect>
+ </property>
<property name="windowTitle" >
<string>toolBar</string>
</property>
@@ -120,24 +149,33 @@
<property name="text" >
<string>_("Choose dictionary...")</string>
</property>
+ <property name="statusTip" >
+ <string>_("Select a new dictionary")</string>
+ </property>
</action>
<action name="action_HelpAbout" >
<property name="text" >
<string>_("&About...")</string>
</property>
<property name="statusTip" >
- <string>About Eliot</string>
+ <string>_("About Eliot")</string>
</property>
</action>
<action name="action_GameQuit" >
<property name="text" >
<string>_("&Quit")</string>
</property>
+ <property name="statusTip" >
+ <string>_("Quit Eliot")</string>
+ </property>
</action>
<action name="action_GameNew" >
<property name="text" >
<string>_("New...")</string>
</property>
+ <property name="statusTip" >
+ <string>_("Start a new game")</string>
+ </property>
<property name="shortcut" >
<string>Ctrl+N</string>
</property>
@@ -149,6 +187,9 @@
<property name="text" >
<string>_("&Bag")</string>
</property>
+ <property name="statusTip" >
+ <string>_("Show/hide the remaining tiles in the bag")</string>
+ </property>
<property name="shortcut" >
<string>Ctrl+B</string>
</property>
@@ -157,8 +198,11 @@
<property name="text" >
<string>_("Preferences...")</string>
</property>
+ <property name="statusTip" >
+ <string>_("Edit the preferences")</string>
+ </property>
<property name="shortcut" >
- <string>Ctrl+P</string>
+ <string>Ctrl+Q</string>
</property>
</action>
<action name="action_GameSave" >
@@ -173,6 +217,9 @@
<property name="text" >
<string>_("Load...")</string>
</property>
+ <property name="statusTip" >
+ <string>_("Load an existing game")</string>
+ </property>
<property name="shortcut" >
<string>Ctrl+O</string>
</property>
@@ -181,6 +228,9 @@
<property name="text" >
<string>_("Save as...")</string>
</property>
+ <property name="statusTip" >
+ <string>_("Save the current game")</string>
+ </property>
<property name="shortcut" >
<string>Ctrl+S</string>
</property>
@@ -190,7 +240,10 @@
<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>
</property>
</action>
<action name="action_WindowsHistory" >
@@ -198,12 +251,40 @@
<bool>true</bool>
</property>
<property name="text" >
- <string>_("History")</string>
+ <string>_("&History")</string>
+ </property>
+ <property name="statusTip" >
+ <string>_("Show/hide the game history")</string>
</property>
<property name="shortcut" >
<string>Ctrl+H</string>
</property>
</action>
+ <action name="action_GamePrint" >
+ <property name="text" >
+ <string>_("Print...")</string>
+ </property>
+ <property name="statusTip" >
+ <string>_("Print the current game")</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+P</string>
+ </property>
+ </action>
+ <action name="action_WindowsDicTools" >
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>_("&Dictionary tools")</string>
+ </property>
+ <property name="statusTip" >
+ <string>_("Show/hide the dictionary tools")</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+D</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections>
Index: qt/ui/prefs_dialog.ui
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/ui/prefs_dialog.ui,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- qt/ui/prefs_dialog.ui 26 Jan 2008 16:58:47 -0000 1.2
+++ qt/ui/prefs_dialog.ui 27 Aug 2008 21:20:17 -0000 1.3
@@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>365</width>
+ <width>343</width>
<height>418</height>
</rect>
</property>
@@ -29,19 +29,6 @@
</widget>
</item>
<item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<widget class="QLineEdit" name="lineEditIntfDicPath" >
<property name="toolTip" >
<string>_("Enter the dictionary path (mandatory to start a
game)")</string>
Index: test/regexp.ref
===================================================================
RCS file: /cvsroot/eliot/eliot/test/regexp.ref,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- test/regexp.ref 7 Jul 2008 17:30:02 -0000 1.3
+++ test/regexp.ref 27 Aug 2008 21:20:18 -0000 1.4
@@ -1,590 +1,590 @@
[?] pour l'aide
commande> x a.* 50
search for a.* (50,1,15)
-aa
-aalenien
-aalenienne
-aaleniennes
-aaleniens
-aas
-abaca
-abacas
-abacost
-abacosts
-abacule
-abacules
-abaissa
-abaissable
-abaissables
-abaissai
-abaissaient
-abaissais
-abaissait
-abaissames
-abaissant
-abaissante
-abaissantes
-abaissants
-abaissas
-abaissasse
-abaissassent
-abaissasses
-abaissassiez
-abaissassions
-abaissat
-abaissates
-abaisse
-abaissee
-abaissees
-abaissement
-abaissements
-abaissent
-abaisser
-abaissera
-abaisserai
-abaisseraient
-abaisserais
-abaisserait
-abaisseras
-abaisserent
-abaisserez
-abaisseriez
-abaisserions
-abaisserons
+AA
+AALENIEN
+AALENIENNE
+AALENIENNES
+AALENIENS
+AAS
+ABACA
+ABACAS
+ABACOST
+ABACOSTS
+ABACULE
+ABACULES
+ABAISSA
+ABAISSABLE
+ABAISSABLES
+ABAISSAI
+ABAISSAIENT
+ABAISSAIS
+ABAISSAIT
+ABAISSAMES
+ABAISSANT
+ABAISSANTE
+ABAISSANTES
+ABAISSANTS
+ABAISSAS
+ABAISSASSE
+ABAISSASSENT
+ABAISSASSES
+ABAISSASSIEZ
+ABAISSASSIONS
+ABAISSAT
+ABAISSATES
+ABAISSE
+ABAISSEE
+ABAISSEES
+ABAISSEMENT
+ABAISSEMENTS
+ABAISSENT
+ABAISSER
+ABAISSERA
+ABAISSERAI
+ABAISSERAIENT
+ABAISSERAIS
+ABAISSERAIT
+ABAISSERAS
+ABAISSERENT
+ABAISSEREZ
+ABAISSERIEZ
+ABAISSERIONS
+ABAISSERONS
50 printed results
commande> x a.* 200
search for a.* (200,1,15)
-aa
-aalenien
-aalenienne
-aaleniennes
-aaleniens
-aas
-abaca
-abacas
-abacost
-abacosts
-abacule
-abacules
-abaissa
-abaissable
-abaissables
-abaissai
-abaissaient
-abaissais
-abaissait
-abaissames
-abaissant
-abaissante
-abaissantes
-abaissants
-abaissas
-abaissasse
-abaissassent
-abaissasses
-abaissassiez
-abaissassions
-abaissat
-abaissates
-abaisse
-abaissee
-abaissees
-abaissement
-abaissements
-abaissent
-abaisser
-abaissera
-abaisserai
-abaisseraient
-abaisserais
-abaisserait
-abaisseras
-abaisserent
-abaisserez
-abaisseriez
-abaisserions
-abaisserons
-abaisseront
-abaisses
-abaisseur
-abaisseurs
-abaisseuse
-abaisseuses
-abaissez
-abaissiez
-abaissions
-abaissons
-abajoue
-abajoues
-abalone
-abalones
-abandon
-abandonna
-abandonnai
-abandonnaient
-abandonnais
-abandonnait
-abandonnames
-abandonnant
-abandonnas
-abandonnasse
-abandonnassent
-abandonnasses
-abandonnassiez
-abandonnassions
-abandonnat
-abandonnataire
-abandonnataires
-abandonnates
-abandonnateur
-abandonnateurs
-abandonnatrice
-abandonnatrices
-abandonne
-abandonnee
-abandonnees
-abandonnement
-abandonnements
-abandonnent
-abandonner
-abandonnera
-abandonnerai
-abandonneraient
-abandonnerais
-abandonnerait
-abandonneras
-abandonnerent
-abandonnerez
-abandonneriez
-abandonnerions
-abandonnerons
-abandonneront
-abandonnes
-abandonnez
-abandonniez
-abandonnions
-abandonnique
-abandonniques
-abandonnons
-abandons
-abaque
-abaques
-abasie
-abasies
-abasourdi
-abasourdie
-abasourdies
-abasourdimes
-abasourdir
-abasourdira
-abasourdirai
-abasourdiraient
-abasourdirais
-abasourdirait
-abasourdiras
-abasourdirent
-abasourdirez
-abasourdiriez
-abasourdirions
-abasourdirons
-abasourdiront
-abasourdis
-abasourdissais
-abasourdissait
-abasourdissant
-abasourdissante
-abasourdissants
-abasourdisse
-abasourdissent
-abasourdisses
-abasourdissez
-abasourdissiez
-abasourdissions
-abasourdissons
-abasourdit
-abasourdites
-abat
-abatage
-abatages
-abatant
-abatants
-abatardi
-abatardie
-abatardies
-abatardimes
-abatardir
-abatardira
-abatardirai
-abatardiraient
-abatardirais
-abatardirait
-abatardiras
-abatardirent
-abatardirez
-abatardiriez
-abatardirions
-abatardirons
-abatardiront
-abatardis
-abatardissaient
-abatardissais
-abatardissait
-abatardissant
-abatardisse
-abatardissement
-abatardissent
-abatardisses
-abatardissez
-abatardissiez
-abatardissions
-abatardissons
-abatardit
-abatardites
-abatee
-abatees
-abatis
-abats
-abattable
-abattables
-abattage
-abattages
-abattaient
-abattais
-abattait
-abattant
-abattants
-abatte
+AA
+AALENIEN
+AALENIENNE
+AALENIENNES
+AALENIENS
+AAS
+ABACA
+ABACAS
+ABACOST
+ABACOSTS
+ABACULE
+ABACULES
+ABAISSA
+ABAISSABLE
+ABAISSABLES
+ABAISSAI
+ABAISSAIENT
+ABAISSAIS
+ABAISSAIT
+ABAISSAMES
+ABAISSANT
+ABAISSANTE
+ABAISSANTES
+ABAISSANTS
+ABAISSAS
+ABAISSASSE
+ABAISSASSENT
+ABAISSASSES
+ABAISSASSIEZ
+ABAISSASSIONS
+ABAISSAT
+ABAISSATES
+ABAISSE
+ABAISSEE
+ABAISSEES
+ABAISSEMENT
+ABAISSEMENTS
+ABAISSENT
+ABAISSER
+ABAISSERA
+ABAISSERAI
+ABAISSERAIENT
+ABAISSERAIS
+ABAISSERAIT
+ABAISSERAS
+ABAISSERENT
+ABAISSEREZ
+ABAISSERIEZ
+ABAISSERIONS
+ABAISSERONS
+ABAISSERONT
+ABAISSES
+ABAISSEUR
+ABAISSEURS
+ABAISSEUSE
+ABAISSEUSES
+ABAISSEZ
+ABAISSIEZ
+ABAISSIONS
+ABAISSONS
+ABAJOUE
+ABAJOUES
+ABALONE
+ABALONES
+ABANDON
+ABANDONNA
+ABANDONNAI
+ABANDONNAIENT
+ABANDONNAIS
+ABANDONNAIT
+ABANDONNAMES
+ABANDONNANT
+ABANDONNAS
+ABANDONNASSE
+ABANDONNASSENT
+ABANDONNASSES
+ABANDONNASSIEZ
+ABANDONNASSIONS
+ABANDONNAT
+ABANDONNATAIRE
+ABANDONNATAIRES
+ABANDONNATES
+ABANDONNATEUR
+ABANDONNATEURS
+ABANDONNATRICE
+ABANDONNATRICES
+ABANDONNE
+ABANDONNEE
+ABANDONNEES
+ABANDONNEMENT
+ABANDONNEMENTS
+ABANDONNENT
+ABANDONNER
+ABANDONNERA
+ABANDONNERAI
+ABANDONNERAIENT
+ABANDONNERAIS
+ABANDONNERAIT
+ABANDONNERAS
+ABANDONNERENT
+ABANDONNEREZ
+ABANDONNERIEZ
+ABANDONNERIONS
+ABANDONNERONS
+ABANDONNERONT
+ABANDONNES
+ABANDONNEZ
+ABANDONNIEZ
+ABANDONNIONS
+ABANDONNIQUE
+ABANDONNIQUES
+ABANDONNONS
+ABANDONS
+ABAQUE
+ABAQUES
+ABASIE
+ABASIES
+ABASOURDI
+ABASOURDIE
+ABASOURDIES
+ABASOURDIMES
+ABASOURDIR
+ABASOURDIRA
+ABASOURDIRAI
+ABASOURDIRAIENT
+ABASOURDIRAIS
+ABASOURDIRAIT
+ABASOURDIRAS
+ABASOURDIRENT
+ABASOURDIREZ
+ABASOURDIRIEZ
+ABASOURDIRIONS
+ABASOURDIRONS
+ABASOURDIRONT
+ABASOURDIS
+ABASOURDISSAIS
+ABASOURDISSAIT
+ABASOURDISSANT
+ABASOURDISSANTE
+ABASOURDISSANTS
+ABASOURDISSE
+ABASOURDISSENT
+ABASOURDISSES
+ABASOURDISSEZ
+ABASOURDISSIEZ
+ABASOURDISSIONS
+ABASOURDISSONS
+ABASOURDIT
+ABASOURDITES
+ABAT
+ABATAGE
+ABATAGES
+ABATANT
+ABATANTS
+ABATARDI
+ABATARDIE
+ABATARDIES
+ABATARDIMES
+ABATARDIR
+ABATARDIRA
+ABATARDIRAI
+ABATARDIRAIENT
+ABATARDIRAIS
+ABATARDIRAIT
+ABATARDIRAS
+ABATARDIRENT
+ABATARDIREZ
+ABATARDIRIEZ
+ABATARDIRIONS
+ABATARDIRONS
+ABATARDIRONT
+ABATARDIS
+ABATARDISSAIENT
+ABATARDISSAIS
+ABATARDISSAIT
+ABATARDISSANT
+ABATARDISSE
+ABATARDISSEMENT
+ABATARDISSENT
+ABATARDISSES
+ABATARDISSEZ
+ABATARDISSIEZ
+ABATARDISSIONS
+ABATARDISSONS
+ABATARDIT
+ABATARDITES
+ABATEE
+ABATEES
+ABATIS
+ABATS
+ABATTABLE
+ABATTABLES
+ABATTAGE
+ABATTAGES
+ABATTAIENT
+ABATTAIS
+ABATTAIT
+ABATTANT
+ABATTANTS
+ABATTE
200 printed results
commande> x .*a.*e.*i.*o.*u.* 50 10
search for .*a.*e.*i.*o.*u.* (50,10,15)
-ameliorateur
-ameliorateurs
-aperiodique
-aperiodiques
-archiepiscopaux
-arseniosulfure
-arseniosulfures
-arteriosclereux
-bacteriologique
-caleidoscopique
-kaleidoscopique
+AMELIORATEUR
+AMELIORATEURS
+APERIODIQUE
+APERIODIQUES
+ARCHIEPISCOPAUX
+ARSENIOSULFURE
+ARSENIOSULFURES
+ARTERIOSCLEREUX
+BACTERIOLOGIQUE
+CALEIDOSCOPIQUE
+KALEIDOSCOPIQUE
11 printed results
commande> x .*a.*e.*i.*o.*u.* 50 13
search for .*a.*e.*i.*o.*u.* (50,13,15)
-ameliorateurs
-archiepiscopaux
-arseniosulfure
-arseniosulfures
-arteriosclereux
-bacteriologique
-caleidoscopique
-kaleidoscopique
+AMELIORATEURS
+ARCHIEPISCOPAUX
+ARSENIOSULFURE
+ARSENIOSULFURES
+ARTERIOSCLEREUX
+BACTERIOLOGIQUE
+CALEIDOSCOPIQUE
+KALEIDOSCOPIQUE
8 printed results
commande> x .*a.*e.*i.*o.*u.* 50 13 13
search for .*a.*e.*i.*o.*u.* (50,13,13)
-ameliorateurs
+AMELIORATEURS
1 printed results
commande> x .*hop.* 50
search for .*hop.* (50,1,15)
-achoppa
-achoppai
-achoppaient
-achoppais
-achoppait
-achoppames
-achoppant
-achoppas
-achoppasse
-achoppassent
-achoppasses
-achoppassiez
-achoppassions
-achoppat
-achoppates
-achoppe
-achoppee
-achoppees
-achoppement
-achoppements
-achoppent
-achopper
-achoppera
-achopperai
-achopperaient
-achopperais
-achopperait
-achopperas
-achopperent
-achopperez
-achopperiez
-achopperions
-achopperons
-achopperont
-achoppes
-achoppez
-achoppiez
-achoppions
-achoppons
-anthophage
-anthophages
-bishop
-bishops
-bronchopathie
-bronchopathies
-cenesthopathie
-cenesthopathies
-chop
-chopa
-chopai
+ACHOPPA
+ACHOPPAI
+ACHOPPAIENT
+ACHOPPAIS
+ACHOPPAIT
+ACHOPPAMES
+ACHOPPANT
+ACHOPPAS
+ACHOPPASSE
+ACHOPPASSENT
+ACHOPPASSES
+ACHOPPASSIEZ
+ACHOPPASSIONS
+ACHOPPAT
+ACHOPPATES
+ACHOPPE
+ACHOPPEE
+ACHOPPEES
+ACHOPPEMENT
+ACHOPPEMENTS
+ACHOPPENT
+ACHOPPER
+ACHOPPERA
+ACHOPPERAI
+ACHOPPERAIENT
+ACHOPPERAIS
+ACHOPPERAIT
+ACHOPPERAS
+ACHOPPERENT
+ACHOPPEREZ
+ACHOPPERIEZ
+ACHOPPERIONS
+ACHOPPERONS
+ACHOPPERONT
+ACHOPPES
+ACHOPPEZ
+ACHOPPIEZ
+ACHOPPIONS
+ACHOPPONS
+ANTHOPHAGE
+ANTHOPHAGES
+BISHOP
+BISHOPS
+BRONCHOPATHIE
+BRONCHOPATHIES
+CENESTHOPATHIE
+CENESTHOPATHIES
+CHOP
+CHOPA
+CHOPAI
50 printed results
commande> x a.*b 50
search for a.*b (50,1,15)
-acheb
-aeroclub
-aplomb
+ACHEB
+AEROCLUB
+APLOMB
3 printed results
commande> x [abc].*b
search for [abc].*b (50,1,15)
-acheb
-aeroclub
-aplomb
-baobab
-bob
-bulb
-cab
-cheb
-cineclub
-club
-cob
-coulomb
-crib
-cuproplomb
+ACHEB
+AEROCLUB
+APLOMB
+BAOBAB
+BOB
+BULB
+CAB
+CHEB
+CINECLUB
+CLUB
+COB
+COULOMB
+CRIB
+CUPROPLOMB
14 printed results
commande> x [abc]*b
search for [abc]*b (50,1,15)
-cab
+CAB
1 printed results
commande> x [abc]*.b
search for [abc]*.b (50,1,15)
-bob
-cab
-cob
+BOB
+CAB
+COB
3 printed results
commande> x .*(cba)*b
search for .*(cba)*b (50,1,15)
-acheb
-aeroclub
-aplomb
-baobab
-bob
-bulb
-cab
-cheb
-cineclub
-club
-cob
-coulomb
-crib
-cuproplomb
-dab
-deb
-dub
-fob
-guib
-hidjab
-hijab
-hub
-jab
-job
-kebab
-kob
-lamb
-lob
-mahaleb
-mihrab
-mob
-nabab
-nib
-plomb
-pub
-rab
-rabab
-radoub
-rebab
-rhumb
-rob
-rumb
-sahib
-scrub
-serdab
-snob
-stilb
-surplomb
-toubab
-toubib
+ACHEB
+AEROCLUB
+APLOMB
+BAOBAB
+BOB
+BULB
+CAB
+CHEB
+CINECLUB
+CLUB
+COB
+COULOMB
+CRIB
+CUPROPLOMB
+DAB
+DEB
+DUB
+FOB
+GUIB
+HIDJAB
+HIJAB
+HUB
+JAB
+JOB
+KEBAB
+KOB
+LAMB
+LOB
+MAHALEB
+MIHRAB
+MOB
+NABAB
+NIB
+PLOMB
+PUB
+RAB
+RABAB
+RADOUB
+REBAB
+RHUMB
+ROB
+RUMB
+SAHIB
+SCRUB
+SERDAB
+SNOB
+STILB
+SURPLOMB
+TOUBAB
+TOUBIB
50 printed results
commande> x .*(cba)+b
search for .*(cba)+b (50,1,15)
0 printed results
commande> x .*(nn)+.*
search for .*(nn)+.* (50,1,15)
-aalenienne
-aaleniennes
-abandonna
-abandonnai
-abandonnaient
-abandonnais
-abandonnait
-abandonnames
-abandonnant
-abandonnas
-abandonnasse
-abandonnassent
-abandonnasses
-abandonnassiez
-abandonnassions
-abandonnat
-abandonnataire
-abandonnataires
-abandonnates
-abandonnateur
-abandonnateurs
-abandonnatrice
-abandonnatrices
-abandonne
-abandonnee
-abandonnees
-abandonnement
-abandonnements
-abandonnent
-abandonner
-abandonnera
-abandonnerai
-abandonneraient
-abandonnerais
-abandonnerait
-abandonneras
-abandonnerent
-abandonnerez
-abandonneriez
-abandonnerions
-abandonnerons
-abandonneront
-abandonnes
-abandonnez
-abandonniez
-abandonnions
-abandonnique
-abandonniques
-abandonnons
-abbevillienne
+AALENIENNE
+AALENIENNES
+ABANDONNA
+ABANDONNAI
+ABANDONNAIENT
+ABANDONNAIS
+ABANDONNAIT
+ABANDONNAMES
+ABANDONNANT
+ABANDONNAS
+ABANDONNASSE
+ABANDONNASSENT
+ABANDONNASSES
+ABANDONNASSIEZ
+ABANDONNASSIONS
+ABANDONNAT
+ABANDONNATAIRE
+ABANDONNATAIRES
+ABANDONNATES
+ABANDONNATEUR
+ABANDONNATEURS
+ABANDONNATRICE
+ABANDONNATRICES
+ABANDONNE
+ABANDONNEE
+ABANDONNEES
+ABANDONNEMENT
+ABANDONNEMENTS
+ABANDONNENT
+ABANDONNER
+ABANDONNERA
+ABANDONNERAI
+ABANDONNERAIENT
+ABANDONNERAIS
+ABANDONNERAIT
+ABANDONNERAS
+ABANDONNERENT
+ABANDONNEREZ
+ABANDONNERIEZ
+ABANDONNERIONS
+ABANDONNERONS
+ABANDONNERONT
+ABANDONNES
+ABANDONNEZ
+ABANDONNIEZ
+ABANDONNIONS
+ABANDONNIQUE
+ABANDONNIQUES
+ABANDONNONS
+ABBEVILLIENNE
50 printed results
commande> x .*(nn)+.*x 200
search for .*(nn)+.*x (200,1,15)
-actionnariaux
-annaux
-anneaux
-baronniaux
-biennaux
-bonneteaux
-boutonneux
-buissonneux
-cartonneux
-centennaux
-chaponneaux
-charbonneux
-confessionnaux
-conneaux
-cotonneux
-couenneux
-coulonneux
-decennaux
-dindonneaux
-enneagonaux
-ennuyeux
-faisanneaux
-fauconneaux
-floconneux
-gazonneux
-goudronneux
-haillonneux
-heronneaux
-jambonneaux
-jargonneux
-mangonneaux
-molletonneux
-moutonneux
-panneaux
-paonneaux
-pigeonneaux
-pitonneux
-poissonneux
-precautionneux
-processionnaux
-quadriennaux
-quinquennaux
-ramponneaux
-ronchonneaux
-sablonneux
-savonneux
-septennaux
-sexennaux
-soupconneux
-stanneux
-tonneaux
-tricennaux
-triennaux
-tyranneaux
-vallonneux
-vanneaux
-vicennaux
+ACTIONNARIAUX
+ANNAUX
+ANNEAUX
+BARONNIAUX
+BIENNAUX
+BONNETEAUX
+BOUTONNEUX
+BUISSONNEUX
+CARTONNEUX
+CENTENNAUX
+CHAPONNEAUX
+CHARBONNEUX
+CONFESSIONNAUX
+CONNEAUX
+COTONNEUX
+COUENNEUX
+COULONNEUX
+DECENNAUX
+DINDONNEAUX
+ENNEAGONAUX
+ENNUYEUX
+FAISANNEAUX
+FAUCONNEAUX
+FLOCONNEUX
+GAZONNEUX
+GOUDRONNEUX
+HAILLONNEUX
+HERONNEAUX
+JAMBONNEAUX
+JARGONNEUX
+MANGONNEAUX
+MOLLETONNEUX
+MOUTONNEUX
+PANNEAUX
+PAONNEAUX
+PIGEONNEAUX
+PITONNEUX
+POISSONNEUX
+PRECAUTIONNEUX
+PROCESSIONNAUX
+QUADRIENNAUX
+QUINQUENNAUX
+RAMPONNEAUX
+RONCHONNEAUX
+SABLONNEUX
+SAVONNEUX
+SEPTENNAUX
+SEXENNAUX
+SOUPCONNEUX
+STANNEUX
+TONNEAUX
+TRICENNAUX
+TRIENNAUX
+TYRANNEAUX
+VALLONNEUX
+VANNEAUX
+VICENNAUX
57 printed results
commande> x ne.
search for ne. (50,1,15)
-nee
-nef
-nem
-neo
-nes
-net
-ney
-nez
+NEE
+NEF
+NEM
+NEO
+NES
+NET
+NEY
+NEZ
8 printed results
commande> x ne:v:
search for ne:v: (50,1,15)
-nee
-neo
-ney
+NEE
+NEO
+NEY
3 printed results
commande> x ne:v:?
search for ne:v:? (50,1,15)
-ne
-nee
-neo
-ney
+NE
+NEE
+NEO
+NEY
4 printed results
commande> x ne:c:s
search for ne:c:s (50,1,15)
-nefs
-nems
-nets
-news
-neys
+NEFS
+NEMS
+NETS
+NEWS
+NEYS
5 printed results
commande> x (ass)+..
search for (ass)+.. (50,1,15)
-assai
-assassin
-assec
-asses
-assez
-assis
-assit
+ASSAI
+ASSASSIN
+ASSEC
+ASSES
+ASSEZ
+ASSIS
+ASSIT
7 printed results
commande> x c:v:+p
search for c:v:+p (50,1,15)
-cap
-cep
-coup
+CAP
+CEP
+COUP
3 printed results
commande> q
Index: qt/dic_tools_widget.cpp
===================================================================
RCS file: qt/dic_tools_widget.cpp
diff -N qt/dic_tools_widget.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ qt/dic_tools_widget.cpp 27 Aug 2008 21:20:16 -0000 1.1
@@ -0,0 +1,302 @@
+/*****************************************************************************
+ * Eliot
+ * Copyright (C) 2008 Olivier Teulière
+ * Authors: Olivier Teulière <ipkiss @@ gmail.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *****************************************************************************/
+
+#include "config.h"
+
+#include <map>
+#include <vector>
+#include <QtGui/QTreeView>
+#include <QtGui/QStandardItemModel>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QLineEdit>
+#include <QtGui/QToolTip>
+#include <QtCore/QString>
+
+#include "dic_tools_widget.h"
+#include "qtcommon.h"
+#include "dic.h"
+
+using namespace std;
+
+
+/// Validator used for the line edits accepting only dictionary characters
+class DicRackValidator: public QValidator
+{
+public:
+ explicit DicRackValidator(QObject *parent,
+ const Dictionary *iDic);
+ virtual State validate(QString &input, int &pos) const;
+
+private:
+ const Dictionary *m_dic;
+};
+
+
+/// Validator used for the regexp line edit
+class RegexpValidator: public QValidator
+{
+public:
+ explicit RegexpValidator(QObject *parent,
+ const Dictionary *iDic);
+ virtual State validate(QString &input, int &pos) const;
+
+private:
+ const Dictionary *m_dic;
+};
+
+
+DicToolsWidget::DicToolsWidget(QWidget *parent)
+ : QWidget(parent), m_dic(NULL)
+{
+ setupUi(this);
+
+ redPalette = labelCheck->palette();
+ redPalette.setColor(QPalette::Foreground, Qt::red);
+ greenPalette = labelCheck->palette();
+ greenPalette.setColor(QPalette::Foreground, Qt::darkGreen);
+
+ labelLimitReached->hide();
+
+ // Create connections
+ QObject::connect(lineEditCheck, SIGNAL(textChanged(const QString&)), this,
SLOT(refreshCheck()));
+ QObject::connect(lineEditPlus1, SIGNAL(returnPressed()), this,
SLOT(refreshPlus1()));
+ QObject::connect(lineEditRegexp, SIGNAL(returnPressed()), this,
SLOT(refreshRegexp()));
+
+ // Create models
+ m_plus1Model = new QStandardItemModel(this);
+ treeViewPlus1->setModel(m_plus1Model);
+ m_plus1Model->setColumnCount(1);
+ m_plus1Model->setHeaderData(0, Qt::Horizontal, _q("Rack:"),
Qt::DisplayRole);
+
+ m_regexpModel = new QStandardItemModel(this);
+ treeViewRegexp->setModel(m_regexpModel);
+ m_regexpModel->setColumnCount(1);
+ m_regexpModel->setHeaderData(0, Qt::Horizontal, _q("Rack:"),
Qt::DisplayRole);
+}
+
+
+void DicToolsWidget::setDic(const Dictionary *iDic)
+{
+ if (m_dic != iDic)
+ {
+ m_dic = iDic;
+ // Reset the letters
+ lineEditCheck->clear();
+ lineEditPlus1->clear();
+ lineEditRegexp->clear();
+ // Create new validators
+ lineEditCheck->setValidator(new DicRackValidator(this, m_dic));
+ lineEditPlus1->setValidator(new DicRackValidator(this, m_dic));
+ lineEditRegexp->setValidator(new RegexpValidator(this, m_dic));
+ // Refresh
+ refreshCheck();
+ refreshPlus1();
+ refreshRegexp();
+ }
+}
+
+
+void DicToolsWidget::refreshCheck()
+{
+ QLineEdit *rack = lineEditCheck;
+ if (m_dic == NULL)
+ {
+ labelCheck->setText(_q("Please select a dictionary"));
+ return;
+ }
+
+ if (rack->text() == "")
+ labelCheck->setText("");
+ else
+ {
+ bool res = m_dic->searchWord(qtw(rack->text()));
+ if (res)
+ {
+ labelCheck->setText(_q("The word '%1'
exists").arg(rack->text().toUpper()));
+ labelCheck->setPalette(greenPalette);
+ }
+ else
+ {
+ labelCheck->setText(_q("The word '%1' does not
exist").arg(rack->text().toUpper()));
+ labelCheck->setPalette(redPalette);
+ }
+ }
+}
+
+
+void DicToolsWidget::refreshPlus1()
+{
+ QStandardItemModel *model = m_plus1Model;
+ QTreeView *treeView = treeViewPlus1;
+ QLineEdit *rack = lineEditPlus1;
+
+ model->removeRows(0, model->rowCount());
+ if (m_dic == NULL)
+ {
+ model->setHeaderData(0, Qt::Horizontal,
+ _q("Please select a dictionary"),
+ Qt::DisplayRole);
+ return;
+ }
+ else
+ {
+ model->setHeaderData(0, Qt::Horizontal,
+ _q("Rack: %1").arg(rack->text().toUpper()),
+ Qt::DisplayRole);
+ }
+
+ if (rack->text() != "")
+ {
+ map<wchar_t, vector<wstring> > wordList;
+ m_dic->search7pl1(qtw(rack->text()), wordList, false);
+
+ int rowNum = 0;
+ map<wchar_t, vector<wstring> >::const_iterator it;
+ for (it = wordList.begin(); it != wordList.end(); it++)
+ {
+ // Create the header line
+ model->insertRow(rowNum);
+ const QModelIndex &index = model->index(rowNum, 0);
+ if (it->first)
+ model->setData(index, qfw(wstring(1, it->first)));
+ else
+ model->setData(index, _q("Anagrams"));
+ treeView->setExpanded(index, true);
+ ++rowNum;
+
+ // Create the result lines
+ model->insertColumn(0, index);
+ model->insertRows(0, it->second.size(), index);
+ const vector<wstring> &results = it->second;
+ for (unsigned i = 0; i < results.size(); ++i)
+ {
+ model->setData(model->index(i, 0, index),
+ qfw(results[i]));
+ }
+ }
+ }
+}
+
+
+void DicToolsWidget::refreshRegexp()
+{
+ QStandardItemModel *model = m_regexpModel;
+ QLineEdit *rack = lineEditRegexp;
+
+ model->removeRows(0, model->rowCount());
+ if (m_dic == NULL)
+ {
+ model->setHeaderData(0, Qt::Horizontal,
+ _q("Please select a dictionary"),
+ Qt::DisplayRole);
+ return;
+ }
+ else
+ {
+ model->setHeaderData(0, Qt::Horizontal,
+ _q("Regular expression:
%1").arg(rack->text().toUpper()),
+ Qt::DisplayRole);
+ }
+
+ if (rack->text() != "")
+ {
+ unsigned lmin = spinBoxMinLength->value();
+ unsigned lmax = spinBoxMaxLength->value();
+ // FIXME: this value should not be hardcoded,
+ // 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);
+
+ int rowNum = 0;
+ 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;
+ }
+ if (res)
+ labelLimitReached->hide();
+ else
+ labelLimitReached->show();
+ }
+}
+
+
+
+DicRackValidator::DicRackValidator(QObject *parent,
+ const Dictionary *iDic)
+ : QValidator(parent), m_dic(iDic)
+{
+}
+
+
+QValidator::State DicRackValidator::validate(QString &input, int &) const
+{
+ if (m_dic == NULL)
+ return Invalid;
+
+ if (input == "")
+ return Intermediate;
+
+ //input = input.toUpper();
+
+ // The string is invalid if it contains characters not present
+ // in the dictionary or if it contains a '?'
+ if (!m_dic->validateLetters(qtw(input)) || input.contains('?'))
+ return Invalid;
+ return Acceptable;
+}
+
+
+
+RegexpValidator::RegexpValidator(QObject *parent,
+ const Dictionary *iDic)
+ : QValidator(parent), m_dic(iDic)
+{
+}
+
+
+QValidator::State RegexpValidator::validate(QString &input, int &) const
+{
+ if (m_dic == NULL)
+ return Invalid;
+
+ if (input == "")
+ return Intermediate;
+
+ // Strip regular expression characters
+ QString copy(input);
+ QString authorizedChars = ".[]()*+?:^";
+ for (int i = 0; i < authorizedChars.size(); ++i)
+ {
+ copy.remove(authorizedChars[i]);
+ }
+
+ // The string is invalid if it contains characters not present
+ // in the dictionary
+ if (!m_dic->validateLetters(qtw(copy)))
+ return Invalid;
+ return Acceptable;
+}
+
Index: qt/dic_tools_widget.h
===================================================================
RCS file: qt/dic_tools_widget.h
diff -N qt/dic_tools_widget.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ qt/dic_tools_widget.h 27 Aug 2008 21:20:17 -0000 1.1
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Eliot
+ * Copyright (C) 2008 Olivier Teulière
+ * Authors: Olivier Teulière <ipkiss @@ gmail.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *****************************************************************************/
+
+#ifndef DIC_TOOLS_WIDGET_H_
+#define DIC_TOOLS_WIDGET_H_
+
+#include <string>
+#include <QtGui/QWidget>
+#include <QtGui/QPalette>
+#include "ui/dic_tools_widget.ui.h"
+
+class QStandardItemModel;
+class QString;
+class Dictionary;
+
+class DicToolsWidget: public QWidget, private Ui::DicToolsWidget
+{
+ Q_OBJECT;
+
+public:
+ explicit DicToolsWidget(QWidget *parent = 0);
+
+public slots:
+ void setDic(const Dictionary *iDic);
+
+private:
+ /// Dictionary in which the searches are done
+ const Dictionary *m_dic;
+
+ /// Model of the tree view for the "plus 1" search
+ QStandardItemModel *m_plus1Model;
+ /// Model of the tree view for the "regexp" search
+ QStandardItemModel *m_regexpModel;
+
+ /// Palette to write text in red
+ QPalette redPalette;
+ /// Palette to write text in green
+ QPalette greenPalette;
+
+private slots:
+ /// Force synchronizing the model with the "check" results
+ void refreshCheck();
+ /// Force synchronizing the model with the "plus 1" results
+ void refreshPlus1();
+ /// Force synchronizing the model with the "regexp" results
+ void refreshRegexp();
+};
+
+#endif
+
Index: qt/ui/dic_tools_widget.ui
===================================================================
RCS file: qt/ui/dic_tools_widget.ui
diff -N qt/ui/dic_tools_widget.ui
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ qt/ui/dic_tools_widget.ui 27 Aug 2008 21:20:17 -0000 1.1
@@ -0,0 +1,172 @@
+<ui version="4.0" >
+ <class>DicToolsWidget</class>
+ <widget class="QWidget" name="DicToolsWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>462</width>
+ <height>354</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QTabWidget" name="tabWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tabCheck" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>440</width>
+ <height>308</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>_("Check")</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_5" >
+ <item>
+ <widget class="QLineEdit" name="lineEditCheck" />
+ </item>
+ <item>
+ <widget class="QLabel" name="labelCheck" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabPlus1" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>440</width>
+ <height>308</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>_("Plus 1")</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <item>
+ <widget class="QLineEdit" name="lineEditPlus1" />
+ </item>
+ <item>
+ <widget class="QTreeView" name="treeViewPlus1" >
+ <property name="editTriggers" >
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabRegexp" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>440</width>
+ <height>308</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>_("Regular expressions")</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QLineEdit" name="lineEditRegexp" />
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>_("Minimum length :")</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBoxMinLength" >
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>15</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>_("Maximum length :")</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBoxMaxLength" >
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>15</number>
+ </property>
+ <property name="value" >
+ <number>15</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTreeView" name="treeViewRegexp" >
+ <property name="editTriggers" >
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="rootIsDecorated" >
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelLimitReached" >
+ <property name="text" >
+ <string>_("Note: only the 1000 first results have been
displayed")</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot Makefile.am dic/dic.h dic/dic_search.cpp ...,
eliot-dev <=