Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYApplication.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
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 
156  static void setCurrentQtDir();
157 
163  {
164  return _saved;
165  }
166 
171  void setIsCurrentFileSaved(const bool& saved)
172  {
173  _saved = saved;
174  }
175 
181 
182 public slots:
187  void setCurProjet(LPTYProjet pProjet);
192  void setCurSiteNode(LPTYSiteNode pSiteNode);
193 
194 signals:
199  void curProjetChanged(LPTYProjet pCurProjet);
204  void curSiteNodeChanged(LPTYSiteNode pCurSiteNode);
205 
206 protected:
209 
212 
215 
218 
221 
224 
227 
230 
233 
235  bool _saved;
236 
237 public:
239  static const QString& getOriginalCurrentDirPath();
240 
242  static void setOriginalCurrentDirPath(const QString&);
243 
245  static const QString& getSettingsDir();
246 
248  static void setSettingsDir(const QString&);
249 
250 private:
251  bool createMainWnd();
252  bool createProgressMngr();
253  bool createMessageMngr();
254  bool loadTextures();
255  bool loadPlugins();
256  bool createCalculMngr();
257  bool loadSettings();
258  bool createCacheDir();
259  bool createWorkDir();
260 
261 private:
263  static QString* _originalCurrentDirPath;
264 
266  static QString* _settingsDir;
267 
269  static QString* _currentFileName;
270 
272  static QString* _currentDirName;
273 };
274 
279 
281 void writeOutputMsg(QString msg);
282 
284 void writeDebugMsg(QString msg);
285 
290 void signalHandler(int signum);
291 
292 #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.
static TYSpectreForm currentProjectSpectreForm()
Retourne la forme d’affichage Ã&#160; utiliser pour le projet courant.
bool init()
Initialise l'application et charges toutes les ressources.
static void setCurrentQtDir()
Indique Ã&#160; Qt le chemin du répertoire courant.
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 fichier 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...
Main window of the Tympan application.
Definition: TYMainWindow.h:50
Classe utilitaire pour la gestion des messages dans Tympan.
TYSpectreForm
Spectrum representation.
Definition: spectre.h:36