From dc026ba96117d25cfccb8a1de30341810bede0b0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?= Date: Mon, 29 Oct 2012 16:53:06 +0700 Subject: [PATCH] Build with Qt 4.7. Add some debug directives. --- gui/conjugation.cpp | 6 ++++++ gui/conjugation.h | 12 +++++++++--- mainwindow.cpp | 24 ++++++++++++++++++++---- mainwindow.h | 4 ++-- mverbiste.pro | 7 +++++-- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/gui/conjugation.cpp b/gui/conjugation.cpp index b37ed8a..781a76a 100644 --- a/gui/conjugation.cpp +++ b/gui/conjugation.cpp @@ -38,8 +38,14 @@ getConjugation(const FrenchVerbDictionary &fvd, const string &infinitive, const string &tname, VVVS &dest, + #ifndef QT_NO_DEBUG + QElapsedTimer &timer, + #endif bool includePronouns) { +#ifndef QT_NO_DEBUG + qDebug() << " *>> Inside getConjugation " << timer.elapsed(); +#endif const TemplateSpec *templ = fvd.getTemplate(tname); if (templ == NULL) return; diff --git a/gui/conjugation.h b/gui/conjugation.h index e9111de..411dcc9 100644 --- a/gui/conjugation.h +++ b/gui/conjugation.h @@ -27,14 +27,17 @@ #include #include -#include -#include +#include +#include typedef std::vector VS; typedef std::vector VVS; typedef std::vector VVVS; - +#ifndef QT_NO_DEBUG +#include +#include +#endif /** Obtains the conjugation of the given infinitive. @param fvd verb dictionary from which to obtain @@ -50,6 +53,9 @@ void getConjugation(const verbiste::FrenchVerbDictionary &fvd, const std::string &infinitive, const std::string &tname, VVVS &dest, + #ifndef QT_NO_DEBUG + QElapsedTimer &timer, + #endif bool includePronouns = false); diff --git a/mainwindow.cpp b/mainwindow.cpp index f194fc1..439641c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,7 +13,6 @@ MainWindow::MainWindow(QWidget *parent) #endif ui->setupUi(this); setupcodedUI(); - initverbiste(); } void MainWindow::setupcodedUI() @@ -104,6 +103,7 @@ void MainWindow::showExpanded() show(); #endif wordinput->setFocus(); + initverbiste(); } void MainWindow::initverbiste() @@ -144,6 +144,10 @@ void MainWindow::startLookup() bool includePronouns = FALSE; // TODO: Will get this value from external bool isItalian = FALSE; // TODO: Will get this value from external +#ifndef QT_NO_DEBUG + timer.start(); + qDebug() << "Start " << timer.elapsed(); +#endif freVerbDic->deconjugate(word, infles); resultPages->setUpdatesEnabled(false); @@ -171,7 +175,18 @@ void MainWindow::startLookup() */ VVVS conjug; - getConjugation(freVerbDic, d.infinitive, d.templateName, conjug, includePronouns); +#ifndef QT_NO_DEBUG + qDebug() << " START getConjugation " << timer.elapsed(); +#endif + getConjugation(freVerbDic, d.infinitive, d.templateName, conjug, + #ifndef QT_NO_DEBUG + timer, + #endif + includePronouns); + +#ifndef QT_NO_DEBUG + qDebug() << " getConjugation() returns: " << timer.elapsed(); +#endif if (conjug.size() == 0 // if no tenses || conjug[0].size() == 0 // if no infinitive tense @@ -183,8 +198,7 @@ void MainWindow::startLookup() std::string utf8Infinitive = conjug[0][0][0]; #ifndef QT_NO_DEBUG - qDebug() << " getConjugation() returns:"; - qDebug() << " Infinitive " << utf8Infinitive.c_str() << " at " << timer.elapsed(); + qDebug() << " Infinitive " << utf8Infinitive.c_str(); qDebug() << " Template " << d.templateName.c_str(); #endif @@ -211,11 +225,13 @@ void MainWindow::startLookup() QVBoxLayout *cell = makeResultCell(*t, utf8TenseName, word, freVerbDic); rsp->grid->addLayout(cell, row, col); } + /* Show the result on GUI */ rsp->packContent(); prevUTF8Infinitive = utf8Infinitive; prevTemplateName = d.templateName; } + /* Enable the button again */ btnLookup->setEnabled(true); btnLookup->setText(""); diff --git a/mainwindow.h b/mainwindow.h index cb38a10..c02a6cb 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -18,8 +18,8 @@ #include "gui/conjugation.h" #ifndef QT_NO_DEBUG -#include -#include +#include +#include #endif using namespace verbiste; diff --git a/mverbiste.pro b/mverbiste.pro index df50c4c..0e6f13e 100644 --- a/mverbiste.pro +++ b/mverbiste.pro @@ -67,8 +67,11 @@ unix: PKGCONFIG += libxml-2.0 DEFINES += ICONV_CONST= -CONFIG(simulator) { # Build to run on simulator. This needs the - # argument CONFIG+=simulator in the config of "Qt Simulator" target. +simulator { + DEFINES += LIBDATADIR=\\\"$$PWD/data\\\" +} + +simulator { # Build to run on simulator. DEFINES += LIBDATADIR=\\\"$$PWD/data\\\" } else { -- 1.7.9.5