btlayout = new QHBoxLayout;
resultPages = new QTabWidget;
- resultPages->setTabPosition(QTabWidget::West);
+ resultPages->setStyleSheet("QTabBar::tab { height: 50px }");
mlayout->addWidget(resultPages);
- btnClear = new QPushButton;
+ btnPron = new QCheckBox();
+ btnPron->setIcon(QIcon("/usr/share/icons/hicolor/48x48/hildon/general_conference_avatar.png"));
+ btnClear = new QPushButton; /* Clearbutton */
btnClear->setIcon(QIcon("/usr/share/icons/hicolor/64x64/hildon/general_delete.png"));
- wordinput = new QLineEdit;
+ wordinput = new QLineEdit; /* Word input */
+ btlayout->addWidget(btnPron);
btlayout->addWidget(btnClear);
btlayout->addWidget(wordinput);
- btnLookup = new QPushButton; // Lookup button
+ btnLookup = new QPushButton; /* Lookup button */
btnLookup->setIcon(QIcon("/usr/share/icons/hicolor/64x64/hildon/general_search.png"));
btlayout->addWidget(btnLookup);
connect(wordinput, SIGNAL(returnPressed()), this, SLOT(startLookup()));
connect(btnLookup, SIGNAL(clicked()), this, SLOT(startLookup()));
+ connect(btnPron, SIGNAL(clicked()), this, SLOT(startLookup()));
/* Icon */
QIcon *icon = new QIcon();
QMenu *menu = ui->menuBar->addMenu(tr("Top menu"));
QAction *act_about = menu->addAction(tr("About"));
connect(act_about, SIGNAL(triggered()), aboutDialog, SLOT(show()));
+ /* Menu filters */
+ QActionGroup *filterGroup = new QActionGroup(this);
+ filterGroup->setExclusive(true);
+ filFrench = new QAction(tr("Search French"), filterGroup);
+ filFrench->setCheckable(true);
+ filFrench->setChecked(true);
+ filItalian = new QAction(tr("Search Italian"), filterGroup);
+ filItalian->setCheckable(true);
+ menu->addActions(filterGroup->actions());
+ connect(filItalian, SIGNAL(changed()), this, SLOT(switchLang()));
+ connect(filFrench, SIGNAL(changed()), this, SLOT(switchLang()));
}
MainWindow::~MainWindow()
freVerbDic = new FrenchVerbDictionary(true);
}
+void MainWindow::switchLang()
+{
+ FrenchVerbDictionary::Language curlang = freVerbDic->getLanguage();
+ FrenchVerbDictionary::Language targetlang = filItalian->isChecked() ? FrenchVerbDictionary::ITALIAN
+ : FrenchVerbDictionary::FRENCH;
+ if (curlang == targetlang) {
+ return;
+ }
+ /* If lang change */
+ std::string conjFN, verbsFN;
+ FrenchVerbDictionary::getXMLFilenames(conjFN, verbsFN, targetlang);
+ delete freVerbDic;
+ freVerbDic = new FrenchVerbDictionary(conjFN, verbsFN, true, targetlang);
+}
+
void MainWindow::startLookup()
{
QString input = wordinput->text().trimmed();
* obtain its complete conjugation.
*/
std::vector<InflectionDesc> infles;
- bool includePronouns = FALSE; // TODO: Will get this value from external
- bool isItalian = FALSE; // TODO: Will get this value from external
+ bool includePronouns = btnPron->isChecked();
+ bool isItalian = filItalian->isChecked(); // TODO: Will get this value from external
#ifndef QT_NO_DEBUG
timer.start();
#include <QtGui/QMainWindow>
#include <QtGui/QTextEdit>
#include <QtGui/QPushButton>
+#include <QtGui/QCheckBox>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLineEdit>
#include <QtGui/QScrollArea>
#include <QtGui/QLabel>
#include <QtGui/QTableWidget>
#include <QtGui/QMessageBox>
+#include <QtGui/QActionGroup>
+
+#if defined(Q_WS_MAEMO_5)
+#include <QtMaemo5>
+#endif
/* Verbiste */
#include <iostream>
public slots:
void startLookup();
+ void switchLang();
private:
Ui::MainWindow *ui;
QTabWidget *resultPages;
QHBoxLayout *btlayout; // Layout to pack the functional buttons
QPushButton *btnClear; // Clear button
+ QCheckBox *btnPron;
QLineEdit *wordinput; // Word input
QPushButton *btnLookup; // Lookup button
+ QAction *filFrench;
+ QAction *filItalian;
QMessageBox *msgbox;
std::string langCode;
FrenchVerbDictionary *freVerbDic;