X-Git-Url: http://git.maemo.org/git/?p=mverbiste;a=blobdiff_plain;f=mainwindow.cpp;h=2ae5a601b09f2ae39971cd5ab90bb00bc4cd9871;hp=f194fc11923be74874cd2433c12033017fc6305d;hb=e2b4937b435d4973f9151b07503ef1fb869b43a4;hpb=fc65a0926de9cbfb2f55dd167860170ecc11a3c5 diff --git a/mainwindow.cpp b/mainwindow.cpp index f194fc1..2ae5a60 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,7 +13,6 @@ MainWindow::MainWindow(QWidget *parent) #endif ui->setupUi(this); setupcodedUI(); - initverbiste(); } void MainWindow::setupcodedUI() @@ -43,12 +42,28 @@ void MainWindow::setupcodedUI() connect(wordinput, SIGNAL(returnPressed()), this, SLOT(startLookup())); connect(btnLookup, SIGNAL(clicked()), this, SLOT(startLookup())); + + /* Icon */ + QIcon *icon = new QIcon(); + icon->addFile(ICONFILE); + setWindowIcon(*icon); + + /* About Dialog */ + aboutDialog = new AboutDialog(ICONFILE, "MVerbiste"); + aboutDialog->setIntro(trUtf8("A French conjugation utility for Maemo and MeeGo")); + aboutDialog->addAuthor(QString::fromUtf8("Nguyễn Hồng Quân \nPierre Sarrazin ")); + + /* Menu */ + QMenu *menu = ui->menuBar->addMenu(tr("Top menu")); + QAction *act_about = menu->addAction(tr("About")); + connect(act_about, SIGNAL(triggered()), aboutDialog, SLOT(show())); } MainWindow::~MainWindow() { delete ui; delete freVerbDic; + delete aboutDialog; } void MainWindow::setOrientation(ScreenOrientation orientation) @@ -103,6 +118,7 @@ void MainWindow::showExpanded() #else show(); #endif + initverbiste(); wordinput->setFocus(); } @@ -144,6 +160,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 +191,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 +214,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 +241,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("");