Build with Qt 4.7. Add some debug directives.
[mverbiste] / mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3
4 #include <QtGui/QMainWindow>
5 #include <QtGui/QTextEdit>
6 #include <QtGui/QPushButton>
7 #include <QtGui/QVBoxLayout>
8 #include <QtGui/QLineEdit>
9 #include <QtGui/QScrollArea>
10 #include <QtGui/QLabel>
11 #include <QtGui/QTableWidget>
12
13 /* Verbiste */
14 #include <iostream>
15 #include <vector>
16 #include <string.h>
17 #include <verbiste/FrenchVerbDictionary.h>
18 #include "gui/conjugation.h"
19
20 #ifndef QT_NO_DEBUG
21 #include <QtCore/QDebug>
22 #include <QtCore/QElapsedTimer>
23 #endif
24
25 using namespace verbiste;
26
27 namespace Ui {
28     class MainWindow;
29     class ResultPage;
30 }
31
32 class ResultPage
33 {
34 public:
35     QScrollArea *page;
36     QGridLayout *grid;
37
38     ResultPage();
39     // No destructor because this object does not own the two widgets.
40     void packContent();
41
42 private:
43     QWidget *immediate;
44 };
45
46 class MainWindow : public QMainWindow
47 {
48     Q_OBJECT
49 public:
50     enum ScreenOrientation {
51         ScreenOrientationLockPortrait,
52         ScreenOrientationLockLandscape,
53         ScreenOrientationAuto
54     };
55
56     explicit MainWindow(QWidget *parent = 0);
57     virtual ~MainWindow();
58
59     // Setup UI by coding, not by QtDesigner
60     void setupcodedUI();
61
62     // Note that this will only have an effect on Symbian and Fremantle.
63     void setOrientation(ScreenOrientation orientation);
64
65     void showExpanded();
66     void initverbiste();
67     QVBoxLayout* makeResultCell(const VVS &tenseIterator,
68                                      const std::string &tenseName,
69                                      const std::string &inputWord,
70                                      FrenchVerbDictionary *verbDict);
71
72 public slots:
73     void startLookup();
74
75 private:
76     Ui::MainWindow *ui;
77     QWidget     *cent;               // Central widget
78     QVBoxLayout *mlayout;            // Main layout
79     QTabWidget  *resultPages;
80     QHBoxLayout *btlayout;           // Layout to pack the functional buttons
81     QPushButton *btnClear;           // Clear button
82     QLineEdit   *wordinput;          //  Word input
83     QPushButton *btnLookup;          // Lookup button
84     std::string langCode;
85     FrenchVerbDictionary *freVerbDic;
86
87     ResultPage* addResultPage(const std::string &labelText);
88 #ifndef QT_NO_DEBUG
89     QElapsedTimer timer;
90 #endif
91
92 private slots:
93     void clearResults();
94     void startAgain();
95 };
96
97
98 #endif // MAINWINDOW_H