23 #include <qmessagebox.h>
26 #include "Tympan/core/config.h"
43 #define TR(id) OLocalizator::getString("TYApplication", (id))
91 if (!_originalCurrentDirPath)
93 _originalCurrentDirPath =
new QString(QDir::currentPath());
94 return *_originalCurrentDirPath;
97 return *_originalCurrentDirPath;
102 if (_originalCurrentDirPath)
104 *_originalCurrentDirPath = newValue;
108 _originalCurrentDirPath =
new QString(newValue);
114 if (_currentFileName)
116 return *_currentFileName;
120 _currentFileName =
new QString(
"");
121 return *_currentFileName;
127 if (_currentFileName)
129 *_currentFileName = newValue;
133 _currentFileName =
new QString(newValue);
141 return *_currentDirName;
145 *_currentDirName = tympanUserDir();
146 return *_currentDirName;
154 *_currentDirName = newValue;
158 _currentDirName =
new QString(newValue);
170 QStringList args = this->arguments();
187 ressourcePath = QDir::toNativeSeparators(ressourcePath);
191 QPixmap pix(ressourcePath +
"Splash.png");
195 pix = QPixmap(230, 368);
199 QString version = TY_PRODUCT_VERSION_;
200 _pSplash =
new OSplashScreen(pix,
"<font color=\"#09367A\"><i><b>TYMPAN " + version +
"</i></b></font>");
202 QColor splashColor(4, 34, 245);
217 QMessageBox::critical(NULL,
"Tympan fatal error",
"Resources file not found : Language.xml");
251 QColor splashColor(4, 34, 245);
252 _pSplash->
setStatus(
"Creation de l'espace de travail...", AlignLeft, splashColor);
262 QColor splashColor(4, 34, 245);
263 _pSplash->
setStatus(
"Initialisation du gestionnaire de progression...", AlignLeft, splashColor);
273 QColor splashColor(4, 34, 245);
274 _pSplash->
setStatus(
"Initialisation du gestionnaire de message...", AlignLeft, splashColor);
285 QColor splashColor(4, 34, 245);
295 QMessageBox::critical(NULL,
"Tympan fatal error",
"Image loading failed!");
305 QColor splashColor(4, 34, 245);
321 QMessageBox::critical(NULL,
"Tympan fatal error",
"Plugin loading failed!");
331 QColor splashColor(4, 34, 245);
332 _pSplash->
setStatus(
"Initialisation du gestionnaire de calcul...", AlignLeft, splashColor);
344 QColor splashColor(4, 34, 245);
345 _pSplash->
setStatus(
"Chargement des preferences utilisateur...", AlignLeft, splashColor);
355 QColor splashColor(4, 34, 245);
356 _pSplash->
setStatus(
"Definition du dossier temporaire de travail...", AlignLeft, splashColor);
360 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
361 QDir tympanCacheDir(tympanCachePath);
362 if (!tympanCacheDir.exists())
364 tympanCacheDir.mkdir(tympanCachePath);
374 QColor splashColor(4, 34, 245);
375 _pSplash->
setStatus(
"Initialisation du dossier de travail...", AlignLeft, splashColor);
378 tympanExchangePath = QDir::toNativeSeparators(tympanExchangePath);
380 QDir tympanExchangeDir(tympanExchangePath);
381 if (!tympanExchangeDir.exists())
383 tympanExchangeDir.mkdir(tympanExchangePath);
386 QDir::setCurrent(tympanExchangePath);
414 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
415 QDir tympanCacheDir(tympanCachePath);
416 for (
unsigned int i = 0; i < tympanCacheDir.count(); i++)
418 tympanCacheDir.remove(tympanCacheDir[i]);
472 char* path =
nullptr;
474 _dupenv_s(&path, &sz,
"LD_LIBRARY_PATH");
475 dir = QString::fromLatin1(path);
477 if (dir.isEmpty() || !QFile::exists(dir))
479 dir = QDir::home().path() +
"/TYMPAN";
482 if (!tympanDir.exists())
484 tympanDir.mkdir(dir);
488 if (dir.isEmpty() || !QFile::exists(dir))
490 _dupenv_s(&path, &sz,
"TEMP");
491 dir = QString::fromLatin1(path);
495 if (dir.isEmpty() || !QFile::exists(dir))
497 _dupenv_s(&path, &sz,
"TMP");
498 dir = QString::fromLatin1(path);
501 if (dir.isEmpty() || !QFile::exists(dir))
519 signal(signum, SIG_DFL);
520 qDebug() <<
"Ooops ! Tympan just crashed, sorry ... Please warn support and relaunch application.";
521 QMessageBox::critical(
nullptr,
TR(
"id_crash_msg_title"),
TR(
"id_crash_msg_text"));
Splash screen widget (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.
pour l'application Tympan (fichier header)
#define TYDIRPREFERENCEMANAGER
Fenetre principale de l'application Tympan (fichier header)
utilitaire pour la gestion des messages dans Tympan (fichier header)
Frame pour les messages de retour (fichier header)
Frame pour la gestion de projet (fichier header)
static void setRessourcePath(const QString &path)
static bool setRessourceFile(const QString &filename)
void setStatus(const QString &message, int alignment=Qt::AlignLeft, const QColor &color=Qt::black)
Affiche un nouveau message indiquant le status de l'application.
void finish(QWidget *pMainWin)
Indique que le chargement de l'application est termine.
Classe principale pour l'application Tympan.
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()
static QString tympanAppDir()
Retourne le chemin du dossier de l'application.
static QString * _currentDirName
Nom du repertoire de travail courant.
OSplashScreen * _pSplash
Splash screen.
TYMainWindow * getMainWnd()
Get de la fenetre principale.
TYMainWindow * _pMainWnd
La fenetre principale de l'application.
static void setOriginalCurrentDirPath(const QString &)
Set Chemin d'origine de l'application.
static QString * _currentFileName
Nom du fichier de travail courant.
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.
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.
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.
bool createProgressMngr()
Gestionnaire des calculs acoustiques. Il fait l'interface entre l'IHM et le gestionnaire de donnees p...
void setCurrent(LPTYCalcul pCalcul)
Set du Calcul et Projet courant.
Fenetre principale de l'application Tympan.
TYOutputFrame * getOutputFrame()
bool loadSettings(const QString &fileName)
TYProjetFrame * getProjetFrame()
Classe utilitaire pour la gestion des messages dans Tympan.
void appendMsg(QString msg)
bool loadPlugins(const QString &directory)
Load, check, create and start plugins.
static void create(QWidget *pParent, const char *name=0)
void changeCurrentCalcul(LPTYCalcul pCalcul)
static void setTopoFilePath(const std::string &path)