Start to use lib verbiste.
authorNguyễn Hồng Quân <ng.hong.quan@gmail.com>
Sat, 27 Oct 2012 02:20:40 +0000 (09:20 +0700)
committerNguyễn Hồng Quân <ng.hong.quan@gmail.com>
Sat, 27 Oct 2012 02:21:56 +0000 (09:21 +0700)
deployment.pri
mainwindow.cpp
mainwindow.h
mverbiste.pro

index cc21b2b..d65eb3b 100644 (file)
@@ -123,4 +123,5 @@ export (TARGET.EPOCHEAPSIZE)
 export (TARGET.CAPABILITY)
 export (LIBS)
 export (QMAKE_EXTRA_TARGETS)
+export (installPrefix)
 }
index e82ebff..31fed0c 100644 (file)
@@ -12,6 +12,7 @@ MainWindow::MainWindow(QWidget *parent)
 #endif
     ui->setupUi(this);
     setupcodedUI();
+    initverbiste();
 }
 
 void MainWindow::setupcodedUI()
@@ -109,6 +110,31 @@ void MainWindow::showExpanded()
 
 void MainWindow::startLookup()
 {
-    QString text = wordinput->text();
-    labVerb->setText(text);
+    const std::set<std::string> *templateSet = NULL;
+    QString input = wordinput->text();
+    labVerb->setText(input);
+    FrenchVerbDictionary::Language lang = FrenchVerbDictionary::parseLanguageCode(langCode);
+    if (lang != FrenchVerbDictionary::FRENCH)
+    {
+        //wordinput->setText(QString("Fr"));
+    }
+    /*
+    std::string conjFileName, verbsFileName;
+    FrenchVerbDictionary::getXMLFilenames(conjFileName, verbsFileName, lang);
+    */
+    freVerbDic = new FrenchVerbDictionary(false);
+    const std::string word = input.toUtf8().constData();
+    templateSet = &freVerbDic->getVerbTemplateSet(word);
+    for (std::set<std::string>::const_iterator it = templateSet->begin();
+         it != templateSet->end(); ++it)
+       {
+           const std::string &tname = *it;
+
+           FrenchVerbDictionary::getRadical(word, tname);
+       }
+}
+
+void  MainWindow::initverbiste()
+{
+    langCode = "fr";
 }
index 30fdaec..476ecee 100644 (file)
@@ -9,6 +9,13 @@
 #include <QtGui/QScrollArea>
 #include <QtGui/QLabel>
 
+/* Verbiste */
+#include <iostream>
+#include <vector>
+#include <string.h>
+#include <verbiste/FrenchVerbDictionary.h>
+using namespace verbiste;
+
 namespace Ui {
     class MainWindow;
 }
@@ -33,6 +40,7 @@ public:
     void setOrientation(ScreenOrientation orientation);
 
     void showExpanded();
+    void initverbiste();
 
 public slots:
     void startLookup();
@@ -46,6 +54,8 @@ private:
     QLineEdit   *wordinput;          //  Word input
     QPushButton *btnLookup;          // Lookup button
     QLabel      *labVerb;
+    std::string langCode;
+    FrenchVerbDictionary *freVerbDic;
 };
 
 #endif // MAINWINDOW_H
index 0fce4f5..24554c8 100644 (file)
@@ -2,7 +2,8 @@
 # by adapting the examples below.
 # file1.source = myfile
 # dir1.source = mydir
-DEPLOYMENTFOLDERS = # file1 dir1
+DEPLOYMENTFOLDERS = xmldata # file1 dir1
+xmldata.source = data
 
 symbian:TARGET.UID3 = 0xE214283E
 
@@ -26,12 +27,14 @@ SOURCES += main.cpp mainwindow.cpp \
     verbiste/Trie.cpp \
     verbiste/misc-types.cpp \
     verbiste/FrenchVerbDictionary.cpp \
-    verbiste/c-api.cpp
+    verbiste/c-api.cpp \
+    gui/conjugation.cpp
 HEADERS += mainwindow.h \
     verbiste/Trie.h \
     verbiste/misc-types.h \
     verbiste/FrenchVerbDictionary.h \
-    verbiste/c-api.h
+    verbiste/c-api.h \
+    gui/conjugation.h
 FORMS += mainwindow.ui
 
 # Please do not modify the following two lines. Required for deployment.
@@ -55,15 +58,13 @@ OTHER_FILES += \
     verbiste/verbiste.dox \
     verbiste/Makefile.in \
     verbiste/Makefile.am \
-    data/verbs-it.xml \
-    data/verbs-fr.xml \
-    data/verbs-el.xml \
-    data/conjugation-it.xml \
-    data/conjugation-fr.xml \
-    data/conjugation-el.xml \
-    data/check-data.pl
+    gui/Makefile.in \
+    gui/Makefile.am
 
 # To build verbiste
 unix: CONFIG += link_pkgconfig
 unix: PKGCONFIG += libxml-2.0
-QMAKE_CXXFLAGS += -DLIBDATADIR=\\\"data\\\" -DICONV_CONST= -DVERBSFRXML=\\\"data/verbs-fr.xml\\\"
+
+DEFINES += ICONV_CONST=
+# installPrefix must be explicitly exported from deployment.pri first
+DEFINES += LIBDATADIR=\\\"$${installPrefix}/data\\\"