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");
256 QColor splashColor(4, 34, 245);
257 _pSplash->
setStatus(
"Creation de l'espace de travail...", Qt::AlignLeft, splashColor);
267 QColor splashColor(4, 34, 245);
268 _pSplash->
setStatus(
"Initialisation du gestionnaire de progression...", Qt::AlignLeft, splashColor);
278 QColor splashColor(4, 34, 245);
279 _pSplash->
setStatus(
"Initialisation du gestionnaire de message...", Qt::AlignLeft, splashColor);
290 QColor splashColor(4, 34, 245);
300 QMessageBox::critical(NULL,
"Tympan fatal error",
"Image loading failed!");
310 QColor splashColor(4, 34, 245);
326 QMessageBox::critical(NULL,
"Tympan fatal error",
"Plugin loading failed!");
336 QColor splashColor(4, 34, 245);
337 _pSplash->
setStatus(
"Initialisation du gestionnaire de calcul...", Qt::AlignLeft, splashColor);
349 QColor splashColor(4, 34, 245);
350 _pSplash->
setStatus(
"Chargement des preferences utilisateur...", Qt::AlignLeft, splashColor);
357 QMessageBox::critical(NULL,
"Tympan fatal error",
"Settings loading failed!");
367 QColor splashColor(4, 34, 245);
368 _pSplash->
setStatus(
"Definition du dossier temporaire de travail...", Qt::AlignLeft, splashColor);
372 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
373 QDir tympanCacheDir(tympanCachePath);
374 if (!tympanCacheDir.exists())
376 tympanCacheDir.mkdir(tympanCachePath);
386 QColor splashColor(4, 34, 245);
387 _pSplash->
setStatus(
"Initialisation du dossier de travail...", Qt::AlignLeft, splashColor);
390 tympanExchangePath = QDir::toNativeSeparators(tympanExchangePath);
392 QDir tympanExchangeDir(tympanExchangePath);
393 if (!tympanExchangeDir.exists())
395 tympanExchangeDir.mkdir(tympanExchangePath);
398 QDir::setCurrent(tympanExchangePath);
426 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
427 QDir tympanCacheDir(tympanCachePath);
428 for (
unsigned int i = 0; i < tympanCacheDir.count(); i++)
430 tympanCacheDir.remove(tympanCacheDir[i]);
474 return QString{
"dB(Z)"};
505 char* path =
nullptr;
507 _dupenv_s(&path, &sz,
"TYMPANUSERDIR");
509 char* path = getenv(
"TYMPANUSERDIR");
511 dir = QString::fromLatin1(path);
513 if (dir.isEmpty() || !QFile::exists(dir))
515 dir = QDir::home().path() +
"/TYMPAN";
518 if (!tympanDir.exists())
520 tympanDir.mkdir(dir);
524 if (dir.isEmpty() || !QFile::exists(dir))
527 _dupenv_s(&path, &sz,
"TEMP");
529 path = getenv(
"TEMP");
531 dir = QString::fromLatin1(path);
535 if (dir.isEmpty() || !QFile::exists(dir))
538 _dupenv_s(&path, &sz,
"TEMP");
540 path = getenv(
"TMP");
542 dir = QString::fromLatin1(path);
545 if (dir.isEmpty() || !QFile::exists(dir))
564 QString dirName = dir.absolutePath();
565 QDir::setCurrent(dirName);
570 signal(signum, SIG_DFL);
571 qDebug() <<
"Ooops ! Tympan just crashed, sorry ... Please warn support and relaunch application.";
572 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.
static QString currentProjectSpectrePond()
Retourne la pondération dâaffichage à utiliser pour le projet courant.
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)
QString getSpectrePond() const
Get/Set de la pondération du spectre à afficher pour le projet.
const bool displaySpectrumInOctaveForm()
static void setTopoFilePath(const QString &path)
TYSpectreForm
Spectrum representation.