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