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