1 /************************************************************************
\r
3 ** Copyright (C) 2010 Strahinja Markovic
\r
5 ** This file is part of FlightCrew.
\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
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
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
20 *************************************************************************/
\r
23 #ifndef MAINWINDOW_H
\r
24 #define MAINWINDOW_H
\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
32 #include <QtGui/QMainWindow>
\r
33 #include "ui_Form.h"
\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
42 #include <flightcrew.h>
\r
43 namespace fc = FlightCrew;
\r
45 class MainWindow : public QMainWindow
\r
54 * @param parent The window's parent object.
\r
55 * @param flags The flags used to modify window behavior.
\r
57 MainWindow( QWidget *parent = 0, Qt::WFlags flags = 0 );
\r
67 * Handles drag events. In our case, this func only
\r
68 * allows file drags.
\r
69 * @note Overridden from QMainWindow.
\r
71 * @param event The drag event.
\r
73 void dragEnterEvent( QDragEnterEvent *event );
\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
80 * @param event The drop event.
\r
82 void dropEvent( QDropEvent *event );
\r
87 * Validates the epub file listed in the combo box.
\r
89 void StartValidation();
\r
92 * Opens a file browsing dialog so that the user
\r
93 * can select a file to validate.
\r
95 void BrowseForEpub();
\r
100 * Displays the validation results in the table.
\r
102 * @param results The validation results we got from FlightCrew.
\r
104 void DisplayResults( const std::vector< fc::Result > &results );
\r
107 * Informs the user that no problems were found.
\r
109 void DisplayNoProblemsMessage();
\r
112 * Adds a filename to the combo box and makes in the
\r
113 * currently selected item.
\r
115 * @param filename The file to add to the combo.
\r
117 void AddFilenameToComboBox( const QString &filename );
\r
120 * Reads all the stored application settings like
\r
121 * window position, geometry etc.
\r
123 void ReadSettings();
\r
126 * Writes all the stored application settings like
\r
127 * window position, geometry etc.
\r
129 void WriteSettings();
\r
132 * Confirgures the table for presenting validation results.
\r
134 void ConfigureTableForResults();
\r
137 * Connects all the required signals to their slots.
\r
139 void ConnectSignalsToSlots();
\r
142 ///////////////////////////////
\r
143 // PRIVATE MEMBER VARIABLES
\r
144 ///////////////////////////////
\r
148 * The last folder from which the user opened a file.
\r
150 QString m_LastFolderOpen;
\r
153 * Holds all the widgets Qt Designer created for us.
\r
158 #endif // MAINWINDOW_H