File: MainWindow.h

package info (click to toggle)
flightcrew 0.9.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 6,748 kB
  • sloc: cpp: 53,736; xml: 2,006; ansic: 275; python: 215; sh: 112; makefile: 8; exp: 8
file content (158 lines) | stat: -rw-r--r-- 4,000 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/************************************************************************
**
**  Copyright (C) 2010  Strahinja Markovic
**
**  This file is part of FlightCrew.
**
**  FlightCrew is free software: you can redistribute it and/or modify
**  it under the terms of the GNU Lesser General Public License as published
**  by the Free Software Foundation, either version 3 of the License, or
**  (at your option) any later version.
**
**  FlightCrew is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**  GNU Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public License
**  along with FlightCrew.  If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/

#pragma once
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

// We set the MSVC warning level down to 3
// for code that we have no control over
#if defined(_MSC_VER)
#   pragma warning( push, 3 )
#endif

#include <QMainWindow>
#include "ui_Form.h"

// ... and then we reset the warning level
// back to normal (warning level 4)
#if defined(_MSC_VER)
#   pragma warning( pop )
#endif

#include <vector>
#include <flightcrew.h>
namespace fc = FlightCrew;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:

    /**
     * Constructor. 
     *
     * @param parent The window's parent object.
     * @param flags The flags used to modify window behavior.
     */
    MainWindow( QWidget *parent = 0, Qt::WindowFlags flags = 0 );

    /**
     * Destructor.
     */
    ~MainWindow();

protected:

    /**
     * Handles drag events. In our case, this func only 
     * allows file drags.
     * @note Overridden from QMainWindow.
     *
     * @param event The drag event.
     */
    void dragEnterEvent( QDragEnterEvent *event );

    /**
     * Handles drop events. In our case, file drop events.
     * The file is then validated.
     * @note Overridden from QMainWindow.
     *
     * @param event The drop event.
     */
    void dropEvent( QDropEvent *event );

private slots:

    /**
     * Validates the epub file listed in the combo box. 
     */
    void StartValidation();

    /**
     * Opens a file browsing dialog so that the user
     * can select a file to validate.
     */
    void BrowseForEpub();

private:

    /**
     * Displays the validation results in the table.
     *
     * @param results The validation results we got from FlightCrew.
     */
    void DisplayResults( const std::vector< fc::Result > &results );

     /**
      * Informs the user that no problems were found.
      */
    void DisplayNoProblemsMessage();

    /**
     * Adds a filename to the combo box and makes in the 
     * currently selected item.
     *
     * @param filename The file to add to the combo.
     */
    void AddFilenameToComboBox( const QString &filename );

     /**
     * Reads all the stored application settings like 
     * window position, geometry etc.
     */
    void ReadSettings();

    /**
     * Writes all the stored application settings like 
     * window position, geometry etc.
     */
    void WriteSettings();

     /**
      * Confirgures the table for presenting validation results.
      */
    void ConfigureTableForResults();

    /**
     * Connects all the required signals to their slots.
     */
    void ConnectSignalsToSlots();
    

    ///////////////////////////////
    // PRIVATE MEMBER VARIABLES
    ///////////////////////////////


    /**
     * The last folder from which the user opened a file.
     */
    QString m_LastFolderOpen;

    /**
     * Holds all the widgets Qt Designer created for us.
     */
    Ui::MainWindow ui;
};

#endif // MAINWINDOW_H