]> git.donarmstrong.com Git - flightcrew.git/blob - src/FlightCrew-gui/MainWindow.h
debian/patches/*: fix quilt-patch-missing-description lintian tag
[flightcrew.git] / src / FlightCrew-gui / MainWindow.h
1 /************************************************************************\r
2 **\r
3 **  Copyright (C) 2010  Strahinja Markovic\r
4 **\r
5 **  This file is part of FlightCrew.\r
6 **\r
7 **  FlightCrew is free software: you can redistribute it and/or modify\r
8 **  it under the terms of the GNU Lesser General Public License as published\r
9 **  by the Free Software Foundation, either version 3 of the License, or\r
10 **  (at your option) any later version.\r
11 **\r
12 **  FlightCrew is distributed in the hope that it will be useful,\r
13 **  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 **  GNU Lesser General Public License for more details.\r
16 **\r
17 **  You should have received a copy of the GNU Lesser General Public License\r
18 **  along with FlightCrew.  If not, see <http://www.gnu.org/licenses/>.\r
19 **\r
20 *************************************************************************/\r
21 \r
22 #pragma once\r
23 #ifndef MAINWINDOW_H\r
24 #define MAINWINDOW_H\r
25 \r
26 // We set the MSVC warning level down to 3\r
27 // for code that we have no control over\r
28 #if defined(_MSC_VER)\r
29 #   pragma warning( push, 3 )\r
30 #endif\r
31 \r
32 #include <QtGui/QMainWindow>\r
33 #include "ui_Form.h"\r
34 \r
35 // ... and then we reset the warning level\r
36 // back to normal (warning level 4)\r
37 #if defined(_MSC_VER)\r
38 #   pragma warning( pop )\r
39 #endif\r
40 \r
41 #include <vector>\r
42 #include <flightcrew.h>\r
43 namespace fc = FlightCrew;\r
44 \r
45 class MainWindow : public QMainWindow\r
46 {\r
47     Q_OBJECT\r
48 \r
49 public:\r
50 \r
51     /**\r
52      * Constructor. \r
53      *\r
54      * @param parent The window's parent object.\r
55      * @param flags The flags used to modify window behavior.\r
56      */\r
57     MainWindow( QWidget *parent = 0, Qt::WFlags flags = 0 );\r
58 \r
59     /**\r
60      * Destructor.\r
61      */\r
62     ~MainWindow();\r
63 \r
64 protected:\r
65 \r
66     /**\r
67      * Handles drag events. In our case, this func only \r
68      * allows file drags.\r
69      * @note Overridden from QMainWindow.\r
70      *\r
71      * @param event The drag event.\r
72      */\r
73     void dragEnterEvent( QDragEnterEvent *event );\r
74 \r
75     /**\r
76      * Handles drop events. In our case, file drop events.\r
77      * The file is then validated.\r
78      * @note Overridden from QMainWindow.\r
79      *\r
80      * @param event The drop event.\r
81      */\r
82     void dropEvent( QDropEvent *event );\r
83 \r
84 private slots:\r
85 \r
86     /**\r
87      * Validates the epub file listed in the combo box. \r
88      */\r
89     void StartValidation();\r
90 \r
91     /**\r
92      * Opens a file browsing dialog so that the user\r
93      * can select a file to validate.\r
94      */\r
95     void BrowseForEpub();\r
96 \r
97 private:\r
98 \r
99     /**\r
100      * Displays the validation results in the table.\r
101      *\r
102      * @param results The validation results we got from FlightCrew.\r
103      */\r
104     void DisplayResults( const std::vector< fc::Result > &results );\r
105 \r
106      /**\r
107       * Informs the user that no problems were found.\r
108       */\r
109     void DisplayNoProblemsMessage();\r
110 \r
111     /**\r
112      * Adds a filename to the combo box and makes in the \r
113      * currently selected item.\r
114      *\r
115      * @param filename The file to add to the combo.\r
116      */\r
117     void AddFilenameToComboBox( const QString &filename );\r
118 \r
119      /**\r
120      * Reads all the stored application settings like \r
121      * window position, geometry etc.\r
122      */\r
123     void ReadSettings();\r
124 \r
125     /**\r
126      * Writes all the stored application settings like \r
127      * window position, geometry etc.\r
128      */\r
129     void WriteSettings();\r
130 \r
131      /**\r
132       * Confirgures the table for presenting validation results.\r
133       */\r
134     void ConfigureTableForResults();\r
135 \r
136     /**\r
137      * Connects all the required signals to their slots.\r
138      */\r
139     void ConnectSignalsToSlots();\r
140     \r
141 \r
142     ///////////////////////////////\r
143     // PRIVATE MEMBER VARIABLES\r
144     ///////////////////////////////\r
145 \r
146 \r
147     /**\r
148      * The last folder from which the user opened a file.\r
149      */\r
150     QString m_LastFolderOpen;\r
151 \r
152     /**\r
153      * Holds all the widgets Qt Designer created for us.\r
154      */\r
155     Ui::MainWindow ui;\r
156 };\r
157 \r
158 #endif // MAINWINDOW_H