File indexing completed on 2024-04-28 16:08:38
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2017 by Linuxstopmotion contributors; * 0003 * see the AUTHORS file for details. * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #ifndef QTFRONTEND_H 0021 #define QTFRONTEND_H 0022 0023 #include "src/presentation/frontends/frontend.h" 0024 0025 #include <QObject> 0026 0027 class PreferencesTool; 0028 class QApplication; 0029 class MainWindowGUI; 0030 class QProgressDialog; 0031 class QProgressBar; 0032 class QLabel; 0033 class QTimer; 0034 class UiException; 0035 0036 /** 0037 * Frontend for using the program through a GUI developed with the QT library. 0038 * 0039 * @author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad 0040 */ 0041 class QtFrontend : public QObject, public Frontend { 0042 Q_OBJECT 0043 public: 0044 0045 /** 0046 * Initializing the frontend. 0047 * @param argc the argc argument from the environment through main 0048 * @param argv argv the argv arguments from the environment through main 0049 */ 0050 QtFrontend(int &argc, char **argv); 0051 0052 /** 0053 * Deallocates allocated memory and sets the pointers to NULL. 0054 */ 0055 virtual ~QtFrontend(); 0056 0057 /** 0058 * The run function for starting the application. 0059 * @param argc the argc argument from the environment through main. 0060 * @param argv the argv arguments from the environment through main. 0061 * @return the return status on exit 0062 */ 0063 int run(int argc, char **argv); 0064 0065 void showProgress(ProgressMessage message, int numOperations); 0066 void hideProgress(); 0067 void updateProgress(int numOperationsDone); 0068 void setProgressInfo(const char *infoText); 0069 bool isOperationAborted(); 0070 void processEvents(); 0071 bool askQuestion(Question question); 0072 int runExternalCommand(const char *command); 0073 void handleException(UiException&); 0074 void reportWarning(const char *message); 0075 0076 /** 0077 * Set the Undo and Redo actions to be enabled or disabled according to the 0078 * state of the command history. 0079 */ 0080 void setUndoRedoEnabled(); 0081 0082 void openProject(const char* file); 0083 protected slots: 0084 void updateProgressBar(); 0085 0086 private: 0087 QApplication *stApp; 0088 MainWindowGUI *mw; 0089 QProgressDialog *progressDialog; 0090 QProgressBar *progressBar; 0091 QLabel *infoText; 0092 QTimer *timer; 0093 static const char* VERSION; 0094 0095 void initializePreferences(); 0096 void setDefaultPreferences(PreferencesTool *prefs); 0097 void updateOldPreferences(PreferencesTool *prefs); 0098 bool loadPreferencesFrom(PreferencesTool* prefs, const char* path); 0099 }; 0100 0101 #endif