Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYApplication.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
27 #ifndef __TY_APPLICATION__
28 #define __TY_APPLICATION__
29 
30 #include <qapplication.h>
31 
32 #include "TYCalculManager.h"
33 #include "TYActionManager.h"
34 #include "TYMainWindow.h"
35 
36 class TYImageManager;
37 class TYPluginManager;
38 class OSplashScreen;
39 class TYMessageManager;
40 
45 class TYApplication : public QApplication
46 {
47  Q_OBJECT
48 
49 public:
54  TYApplication(int& argc, char** argv);
59  virtual ~TYApplication();
60 
65  bool init();
70  bool run();
75  bool close();
76 
82  {
83  return _pMainWnd;
84  }
85 
91  {
92  return &_actionManager;
93  }
94 
100  {
101  return _pCalculManager;
102  }
103 
109  {
110  return _pCurProjet;
111  }
117  {
118  return _pCurSiteNode;
119  }
120 
128  static QString tympanUserDir();
129 
134  static const QString& getCurrentFileName();
135 
140  static void setCurrentFileName(const QString& fileName);
141 
143  static void setCurrentDirName(const QString& dirName);
144  static const QString& getCurrentDirName();
145 
150  static QString tympanAppDir();
151 
157  {
158  return _saved;
159  }
160 
165  void setIsCurrentFileSaved(const bool& saved)
166  {
167  _saved = saved;
168  }
169 
170 public slots:
175  void setCurProjet(LPTYProjet pProjet);
180  void setCurSiteNode(LPTYSiteNode pSiteNode);
181 
182 signals:
187  void curProjetChanged(LPTYProjet pCurProjet);
192  void curSiteNodeChanged(LPTYSiteNode pCurSiteNode);
193 
194 protected:
197 
200 
203 
206 
209 
212 
215 
218 
221 
223  bool _saved;
224 
225 public:
227  static const QString& getOriginalCurrentDirPath();
228 
230  static void setOriginalCurrentDirPath(const QString&);
231 
233  static const QString& getSettingsDir();
234 
236  static void setSettingsDir(const QString&);
237 
238 private:
239  bool createMainWnd();
240  bool createProgressMngr();
241  bool createMessageMngr();
242  bool loadTextures();
243  bool loadPlugins();
244  bool createCalculMngr();
245  bool loadSettings();
246  bool createCacheDir();
247  bool createWorkDir();
248 
249 private:
251  static QString* _originalCurrentDirPath;
252 
254  static QString* _settingsDir;
255 
257  static QString* _currentFileName;
258 
260  static QString* _currentDirName;
261 };
262 
267 
269 void writeOutputMsg(QString msg);
270 
272 void writeDebugMsg(QString msg);
273 
278 void signalHandler(int signum);
279 
280 #endif //__TY_APPLICATION__
Gere les undos (fichier header)
void writeOutputMsg(QString msg)
Affiche un message dans la fenetre de sortie.
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
void writeDebugMsg(QString msg)
Affiche un message de debug dans la fenetre de sortie.
void signalHandler(int signum)
Handle segmentation fault and warn user before app terminates.
TYMainWindow * getTYMainWnd()
Retourne le pointeur sur la fenetre principale.
Gestionnaire des calculs acoustiques. Il fait l'interface entre l'IHM et le gestionnaire de donnees p...
Fenetre principale de l'application Tympan (fichier header)
Gere les undos.
Classe principale pour l'application Tympan.
Definition: TYApplication.h:46
TYActionManager _actionManager
Le gestionnaire d'actions (historique pour les undos).
void setCurSiteNode(LPTYSiteNode pSiteNode)
Set/Get du site node courant.
bool init()
Initialise l'application et charges toutes les ressources.
static const QString & getOriginalCurrentDirPath()
Get Chemin d'origine de l'application. (singleton)
static const QString & getCurrentDirName()
bool createCalculMngr()
LPTYProjet getCurProjet()
Set/Get du projet courant.
static QString tympanAppDir()
Retourne le chemin du dossier de l'application.
static QString * _currentDirName
Nom du repertoire de travail courant.
bool createMessageMngr()
OSplashScreen * _pSplash
Splash screen.
TYMainWindow * getMainWnd()
Get de la fenetre principale.
Definition: TYApplication.h:81
TYMainWindow * _pMainWnd
La fenetre principale de l'application.
static void setOriginalCurrentDirPath(const QString &)
Set Chemin d'origine de l'application.
TYCalculManager * getCalculManager()
Get du gestionnaire de calculs.
Definition: TYApplication.h:99
static QString * _currentFileName
Nom du fichier de travail courant.
static void setSettingsDir(const QString &)
Set chemin des preferences utilisateur.
TYActionManager * getActionManager()
Get du gestionnaire d'actions (historique pour les undos).
Definition: TYApplication.h:90
bool close()
Ferme l'application et libere toutes les ressources.
bool _saved
Indicateur de l'etat de sauvegarde du fichier courant.
TYApplication(int &argc, char **argv)
Constructeur par defaut.
static const QString & getCurrentFileName()
Retourne le nom du fichier en cours d'utilisation.
static const QString & getSettingsDir()
Get chemin des preferences utilisateur.
void curSiteNodeChanged(LPTYSiteNode pCurSiteNode)
Signal que le site node courant a change.
LPTYProjet _pCurProjet
Pointeur sur le projet courant.
static QString * _originalCurrentDirPath
Chemin d'origine de l'application.
void curProjetChanged(LPTYProjet pCurProjet)
Signal que le projet courant a change.
LPTYSiteNode _pCurSiteNode
Pointeur sur le site node courant.
static void setCurrentFileName(const QString &fileName)
Enregistre le nom du ficgier de travail courant.
TYMessageManager * _pMessageManager
Le gestionnaire de messages d'erreurs.
bool getIsCurrentFileSaved()
Get/Set de l'indicateur d'etat de sauvegarde du fichier courant.
static QString tympanUserDir()
Retourne le chemin du dossier de sauvegarde de l'utilisateur courant. Celui-ci est donne par la varia...
bool run()
Lance l'application.
TYCalculManager * _pCalculManager
Le gestionnaire de calculs.
virtual ~TYApplication()
Destructeur.
void setIsCurrentFileSaved(const bool &saved)
Get/Set de l'indicateur d'etat de sauvegarde du fichier courant.
TYPluginManager * _pPluginManager
Le gestionnaire de plugins.
void setCurProjet(LPTYProjet pProjet)
Set/Get du projet courant.
static void setCurrentDirName(const QString &dirName)
Get/Set du repertoire de travail courant.
TYImageManager * _pImageManager
Le gestionnaire d'image.
static QString * _settingsDir
Chemin des parametres utilisateur de l'application.
LPTYSiteNode getCurSiteNode()
Set/Get du site node courant.
bool createProgressMngr()
Gestionnaire des calculs acoustiques. Il fait l'interface entre l'IHM et le gestionnaire de donnees p...
Fenetre principale de l'application Tympan.
Definition: TYMainWindow.h:53
Classe utilitaire pour la gestion des messages dans Tympan.