50
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2016 by ETH Zürich |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 * |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=2) |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * See LICENSE.txt for details. |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 /** @file The Main UI class. |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 * |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 * Parent class of all dialogs and graphical user interaction. |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 #include <QMainWindow> |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 #include <QSettings> |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 class QPushButton; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 class QLineEdit; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 class QCheckBox; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 class FileNameRequester; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 /** |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 * @class MainWindow |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 * @brief The mainwindow of the application. |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 * @details Holds the input fields and export options. |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 class MainWindow : public QMainWindow |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 { |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 Q_OBJECT |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 public: |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 MainWindow(); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 protected: |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 /** @brief UI setup */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 void setupGUI(); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 /** @brief Cleanup and save the current state */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 virtual void closeEvent(QCloseEvent *event); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 /** @brief Restores the last window state */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 void readSettings(); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 public slots: |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
45 /** @brief directly set an input file. */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 void setInputFile(const QString& file); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
48 /** @brief Prefill title with @title. */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
49 void setTitle(const QString& title); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 protected slots: |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 /** @brief Show an error dialog to the user. */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
53 void showErrorMessage(const QString& errMsg); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
54 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
55 /** @brief check if all mandataory fields are set. */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
56 void checkCompleted(); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
57 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
58 /** @brief Do the actual conversion. */ |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
59 void doConvert(); |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
61 private: |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
62 QSettings mSettings; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
63 |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
64 FileNameRequester* mInputRequester; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
65 FileNameRequester* mOutRequester; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
66 QLineEdit *mTitleEdit; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
67 QPushButton *mConvertBtn; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
68 QCheckBox *mPdfChk, |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
69 *mXlsxChk, |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
70 *mHtmlChk; |
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
71 }; |