24 #include <qmessagebox.h> 26 #include "Tympan/core/config.h" 44 #define TR(id) OLocalizator::getString("TYApplication", (id)) 87 if (!_originalCurrentDirPath)
89 _originalCurrentDirPath =
new QString(QDir::currentPath());
90 return *_originalCurrentDirPath;
93 return *_originalCurrentDirPath;
98 if (_originalCurrentDirPath)
100 *_originalCurrentDirPath = newValue;
104 _originalCurrentDirPath =
new QString(newValue);
110 if (_currentFileName)
112 return *_currentFileName;
116 _currentFileName =
new QString(
"");
117 return *_currentFileName;
123 if (_currentFileName)
125 *_currentFileName = newValue;
129 _currentFileName =
new QString(newValue);
137 return *_currentDirName;
141 *_currentDirName = tympanUserDir();
142 return *_currentDirName;
151 *_currentDirName = newValue;
155 _currentDirName =
new QString(newValue);
161 : QApplication(argc, argv), _actionManager(10)
169 QStringList args = this->arguments();
185 ressourcePath = QDir::toNativeSeparators(ressourcePath);
189 QPixmap pix(ressourcePath +
"Splash.png");
193 pix = QPixmap(230, 368);
197 QString version = TY_PRODUCT_VERSION_;
198 _pSplash =
new OSplashScreen(pix,
"<font color=\"#09367A\"><i><b>TYMPAN " + version +
"</i></b></font>");
200 QColor splashColor(4, 34, 245);
215 QMessageBox::critical(NULL,
"Tympan fatal error",
"Resources file not found : Language.xml");
250 QColor splashColor(4, 34, 245);
251 _pSplash->
setStatus(
"Creation de l'espace de travail...", AlignLeft, splashColor);
261 QColor splashColor(4, 34, 245);
262 _pSplash->
setStatus(
"Initialisation du gestionnaire de progression...", AlignLeft, splashColor);
272 QColor splashColor(4, 34, 245);
273 _pSplash->
setStatus(
"Initialisation du gestionnaire de message...", AlignLeft, splashColor);
284 QColor splashColor(4, 34, 245);
294 QMessageBox::critical(NULL,
"Tympan fatal error",
"Image loading failed!");
304 QColor splashColor(4, 34, 245);
320 QMessageBox::critical(NULL,
"Tympan fatal error",
"Plugin loading failed!");
330 QColor splashColor(4, 34, 245);
331 _pSplash->
setStatus(
"Initialisation du gestionnaire de calcul...", AlignLeft, splashColor);
342 QColor splashColor(4, 34, 245);
343 _pSplash->
setStatus(
"Chargement des preferences utilisateur...", AlignLeft, splashColor);
353 QColor splashColor(4, 34, 245);
354 _pSplash->
setStatus(
"Definition du dossier temporaire de travail...", AlignLeft, splashColor);
357 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
358 QDir tympanCacheDir(tympanCachePath);
359 if (!tympanCacheDir.exists())
361 tympanCacheDir.mkdir(tympanCachePath);
371 QColor splashColor(4, 34, 245);
372 _pSplash->
setStatus(
"Initialisation du dossier de travail...", AlignLeft, splashColor);
375 tympanExchangePath = QDir::toNativeSeparators(tympanExchangePath);
377 QDir tympanExchangeDir(tympanExchangePath);
378 if (!tympanExchangeDir.exists())
380 tympanExchangeDir.mkdir(tympanExchangePath);
383 QDir::setCurrent(tympanExchangePath);
411 tympanCachePath = QDir::toNativeSeparators(tympanCachePath);
412 QDir tympanCacheDir(tympanCachePath);
413 for (
unsigned int i = 0; i < tympanCacheDir.count(); i++)
415 tympanCacheDir.remove(tympanCacheDir[i]);
469 dir = QString::fromLatin1(getenv(
"TYMPANUSERDIR"));
472 if (dir.isEmpty() || !QFile::exists(dir))
474 dir = QDir::home().path() +
"/TYMPAN";
477 if (!tympanDir.exists())
479 tympanDir.mkdir(dir);
483 if (dir.isEmpty() || !QFile::exists(dir))
485 dir = QString::fromLatin1(getenv(
"TEMP"));
489 if (dir.isEmpty() || !QFile::exists(dir))
491 dir = QString::fromLatin1(getenv(
"TMP"));
494 if (dir.isEmpty() || !QFile::exists(dir))
static const QString & getCurrentDirName()
void changeCurrentCalcul(LPTYCalcul pCalcul)
Gestionnaire des calculs acoustiques. Il fait l'interface entre l'IHM et le gestionnaire de donnees p...
bool _saved
Indicateur de l'etat de sauvegarde du fichier courant.
TYMainWindow * _pMainWnd
La fenetre principale de l'application.
void setCurrent(LPTYCalcul pCalcul)
Set du Calcul et Projet courant.
static QString * _currentDirName
Nom du repertoire de travail courant.
Splash screen widget (fichier header)
static QString tympanUserDir()
Retourne le chemin du dossier de sauvegarde de l'utilisateur courant. Celui-ci est donne par la varia...
bool init()
Initialise l'application et charges toutes les ressources.
static void setOriginalCurrentDirPath(const QString &)
Set Chemin d'origine de l'application.
void curSiteNodeChanged(LPTYSiteNode pCurSiteNode)
Signal que le site node courant a change.
void writeOutputMsg(QString msg)
Affiche un message dans la fenetre de sortie.
#define TYDIRPREFERENCEMANAGER
static const QString & getSettingsDir()
Get chemin des preferences utilisateur.
void appendMsg(QString msg)
bool close()
Ferme l'application et libere toutes les ressources.
Fenetre principale de l'application Tympan (fichier header)
TYCalculManager * _pCalculManager
Le gestionnaire de calculs.
static const QString & getOriginalCurrentDirPath()
Get Chemin d'origine de l'application. (singleton)
static void setCurrentFileName(const QString &fileName)
Enregistre le nom du ficgier de travail courant.
void setCurProjet(LPTYProjet pProjet)
Set/Get du projet courant.
pour l'application Tympan (fichier header)
static QString * _originalCurrentDirPath
Chemin d'origine de l'application.
TYOutputFrame * getOutputFrame()
bool loadSettings(const QString &fileName)
bool run()
Lance l'application.
Fenetre principale de l'application Tympan.
static bool setRessourceFile(const QString &filename)
TYApplication(int &argc, char **argv)
Constructeur par defaut.
static QString tympanAppDir()
Retourne le chemin du dossier de l'application.
TYProjetFrame * getProjetFrame()
static void setRessourcePath(const QString &path)
virtual ~TYApplication()
Destructeur.
void writeDebugMsg(QString msg)
Affiche un message de debug dans la fenetre de sortie.
void curProjetChanged(LPTYProjet pCurProjet)
Signal que le projet courant a change.
Frame pour les messages de retour (fichier header)
void setCurSiteNode(LPTYSiteNode pSiteNode)
Set/Get du site node courant.
TYImageManager * _pImageManager
Le gestionnaire d'image.
utilitaire pour la gestion des messages dans Tympan (fichier header)
LPTYProjet _pCurProjet
Pointeur sur le projet courant.
static void setCurrentDirName(const QString &dirName)
Get/Set du repertoire de travail courant.
void setStatus(const QString &message, int alignment=Qt::AlignLeft, const QColor &color=Qt::black)
Affiche un nouveau message indiquant le status de l'application.
static QString * _settingsDir
Chemin des parametres utilisateur de l'application.
static QString * _currentFileName
Nom du fichier de travail courant.
LPTYSiteNode _pCurSiteNode
Pointeur sur le site node courant.
OSplashScreen * _pSplash
Splash screen.
void finish(QWidget *pMainWin)
Indique que le chargement de l'application est termine.
Frame pour la gestion de projet (fichier header)
TYMainWindow * getMainWnd()
Get de la fenetre principale.
static void create(QWidget *pParent, const char *name=0)
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
TYPluginManager * _pPluginManager
Le gestionnaire de plugins.
static void setTopoFilePath(const std::string &path)
static const QString & getCurrentFileName()
Retourne le nom du fichier en cours d'utilisation.
TYMessageManager * _pMessageManager
Le gestionnaire de messages d'erreurs.
Classe principale pour l'application Tympan.
Classe utilitaire pour la gestion des messages dans Tympan.
bool loadPlugins(const QString &directory)
Load, check, create and start plugins.
bool createProgressMngr()
TYMainWindow * getTYMainWnd()
Retourne le pointeur sur la fenetre principale.