23 #include <qmessagebox.h>
26 #include "Tympan/core/config.h"
44 #define TR(id) OLocalizator::getString("TYApplication", (id))
171 QStringList args = this->arguments();
188 ressourcePath = QDir::toNativeSeparators(ressourcePath);
192 QPixmap pix(ressourcePath +
"Splash.png");
196 pix = QPixmap(230, 368);
200 QString version = TY_PRODUCT_VERSION_;
201 _pSplash =
new OSplashScreen(pix,
"<font color=\"#09367A\"><i><b>TYMPAN " + version +
"</i></b></font>");
203 QColor splashColor(4, 34, 245);
218 QMessageBox::critical(NULL,
"Tympan fatal error",
"Resources file not found : Language.xml");
254 QColor splashColor(4, 34, 245);
255 _pSplash->
setStatus(
"Creation de l'espace de travail...", Qt::AlignLeft, splashColor);
265 QColor splashColor(4, 34, 245);
266 _pSplash->
setStatus(
"Initialisation du gestionnaire de progression...", Qt::AlignLeft, splashColor);
276 QColor splashColor(4, 34, 245);
277 _pSplash->
setStatus(
"Initialisation du gestionnaire de message...", Qt::AlignLeft, splashColor);
288 QColor splashColor(4, 34, 245);
298 QMessageBox::critical(NULL,
"Tympan fatal error",
"Image loading failed!");
308 QColor splashColor(4, 34, 245);
324 QMessageBox::critical(NULL,
"Tympan fatal error",
"Plugin loading failed!");
334 QColor splashColor(4, 34, 245);
335 _pSplash->
setStatus(
"Initialisation du gestionnaire de calcul...", Qt::AlignLeft, splashColor);
347 QColor splashColor(4, 34, 245);
348 _pSplash->
setStatus(
"Chargement des preferences utilisateur...", Qt::AlignLeft, splashColor);
355 QMessageBox::critical(NULL,
"Tympan fatal error",
"Settings loading failed!");
365 QColor splashColor(4, 34, 245);
366 _pSplash->
setStatus(
"Definition du dossier temporaire de travail...", Qt::AlignLeft, splashColor);
370 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
371 QDir tympanCacheDir(tympanCachePath);
372 if (!tympanCacheDir.exists())
374 tympanCacheDir.mkdir(tympanCachePath);
384 QColor splashColor(4, 34, 245);
385 _pSplash->
setStatus(
"Initialisation du dossier de travail...", Qt::AlignLeft, splashColor);
388 tympanExchangePath = QDir::toNativeSeparators(tympanExchangePath);
390 QDir tympanExchangeDir(tympanExchangePath);
391 if (!tympanExchangeDir.exists())
393 tympanExchangeDir.mkdir(tympanExchangePath);
396 QDir::setCurrent(tympanExchangePath);
424 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
425 QDir tympanCacheDir(tympanCachePath);
426 for (
unsigned int i = 0; i < tympanCacheDir.count(); i++)
428 tympanCacheDir.remove(tympanCacheDir[i]);
491 char* path =
nullptr;
493 _dupenv_s(&path, &sz,
"TYMPANUSERDIR");
495 char* path = getenv(
"TYMPANUSERDIR");
497 dir = QString::fromLatin1(path);
499 if (dir.isEmpty() || !QFile::exists(dir))
501 dir = QDir::home().path() +
"/TYMPAN";
504 if (!tympanDir.exists())
506 tympanDir.mkdir(dir);
510 if (dir.isEmpty() || !QFile::exists(dir))
513 _dupenv_s(&path, &sz,
"TEMP");
515 path = getenv(
"TEMP");
517 dir = QString::fromLatin1(path);
521 if (dir.isEmpty() || !QFile::exists(dir))
524 _dupenv_s(&path, &sz,
"TEMP");
526 path = getenv(
"TMP");
528 dir = QString::fromLatin1(path);
531 if (dir.isEmpty() || !QFile::exists(dir))
550 QString dirName = dir.absolutePath();
551 QDir::setCurrent(dirName);
556 signal(signum, SIG_DFL);
557 qDebug() <<
"Ooops ! Tympan just crashed, sorry ... Please warn support and relaunch application.";
558 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)
SmartPtr< TYProjet > LPTYProjet
Smart pointer sur TYProjet.
#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.
static TYSpectreForm currentProjectSpectreForm()
Retourne la forme dâaffichage à utiliser pour le projet courant.
bool init()
Initialise l'application et charges toutes les ressources.
static void setCurrentQtDir()
Indique à Qt le chemin du répertoire courant.
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 fichier 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.
Main window of the Tympan application.
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)
const bool displaySpectrumInOctaveForm()
static void setTopoFilePath(const QString &path)
TYSpectreForm
Spectrum representation.