Improve speed of conjugating.
[mverbiste] / mainwindow.h
index 476ecee..cb38a10 100644 (file)
@@ -8,18 +8,41 @@
 #include <QtGui/QLineEdit>
 #include <QtGui/QScrollArea>
 #include <QtGui/QLabel>
+#include <QtGui/QTableWidget>
 
 /* Verbiste */
 #include <iostream>
 #include <vector>
 #include <string.h>
 #include <verbiste/FrenchVerbDictionary.h>
+#include "gui/conjugation.h"
+
+#ifndef QT_NO_DEBUG
+#include <QDebug>
+#include <QElapsedTimer>
+#endif
+
 using namespace verbiste;
 
 namespace Ui {
     class MainWindow;
+    class ResultPage;
 }
 
+class ResultPage
+{
+public:
+    QScrollArea *page;
+    QGridLayout *grid;
+
+    ResultPage();
+    // No destructor because this object does not own the two widgets.
+    void packContent();
+
+private:
+    QWidget *immediate;
+};
+
 class MainWindow : public QMainWindow
 {
     Q_OBJECT
@@ -41,6 +64,10 @@ public:
 
     void showExpanded();
     void initverbiste();
+    QVBoxLayout* makeResultCell(const VVS &tenseIterator,
+                                     const std::string &tenseName,
+                                     const std::string &inputWord,
+                                     FrenchVerbDictionary *verbDict);
 
 public slots:
     void startLookup();
@@ -49,13 +76,23 @@ private:
     Ui::MainWindow *ui;
     QWidget     *cent;               // Central widget
     QVBoxLayout *mlayout;            // Main layout
+    QTabWidget  *resultPages;
     QHBoxLayout *btlayout;           // Layout to pack the functional buttons
     QPushButton *btnClear;           // Clear button
     QLineEdit   *wordinput;          //  Word input
     QPushButton *btnLookup;          // Lookup button
-    QLabel      *labVerb;
     std::string langCode;
     FrenchVerbDictionary *freVerbDic;
+
+    ResultPage* addResultPage(const std::string &labelText);
+#ifndef QT_NO_DEBUG
+    QElapsedTimer timer;
+#endif
+
+private slots:
+    void clearResults();
+    void startAgain();
 };
 
+
 #endif // MAINWINDOW_H