Mercurial > clickerconvert
diff src/mainwindow.h @ 50:36ee5dd46fd3
Add GUI
New Mainwindow that allows to set output formats and input
files through a GUI.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 19 Jul 2016 12:19:45 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mainwindow.h Tue Jul 19 12:19:45 2016 +0200 @@ -0,0 +1,71 @@ +/* Copyright (C) 2016 by ETH Zürich + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=2) + * and comes with ABSOLUTELY NO WARRANTY! + * See LICENSE.txt for details. + */ + + +/** @file The Main UI class. + * + * Parent class of all dialogs and graphical user interaction. + */ +#include <QMainWindow> +#include <QSettings> + +class QPushButton; +class QLineEdit; +class QCheckBox; +class FileNameRequester; + +/** + * @class MainWindow + * @brief The mainwindow of the application. + * @details Holds the input fields and export options. + */ +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +protected: + /** @brief UI setup */ + void setupGUI(); + + /** @brief Cleanup and save the current state */ + virtual void closeEvent(QCloseEvent *event); + + /** @brief Restores the last window state */ + void readSettings(); + +public slots: + /** @brief directly set an input file. */ + void setInputFile(const QString& file); + + /** @brief Prefill title with @title. */ + void setTitle(const QString& title); + +protected slots: + /** @brief Show an error dialog to the user. */ + void showErrorMessage(const QString& errMsg); + + /** @brief check if all mandataory fields are set. */ + void checkCompleted(); + + /** @brief Do the actual conversion. */ + void doConvert(); + +private: + QSettings mSettings; + + FileNameRequester* mInputRequester; + FileNameRequester* mOutRequester; + QLineEdit *mTitleEdit; + QPushButton *mConvertBtn; + QCheckBox *mPdfChk, + *mXlsxChk, + *mHtmlChk; +};