diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2005-01-11 19:39:24 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2005-01-11 19:39:24 (GMT) |
commit | 2b2cf3ee82f7d5433780d6ade2504700c32c84fc (patch) | |
tree | 54c695c7de59dfcbeb32cf134b82f5e4d0eeb460 /addon/doxywizard/doxywizard.cpp | |
parent | 7355f4bc5940e13f89fc98e0bf102e31c73eaa99 (diff) | |
download | Doxygen-2b2cf3ee82f7d5433780d6ade2504700c32c84fc.zip Doxygen-2b2cf3ee82f7d5433780d6ade2504700c32c84fc.tar.gz Doxygen-2b2cf3ee82f7d5433780d6ade2504700c32c84fc.tar.bz2 |
Release-1.4.1
Diffstat (limited to 'addon/doxywizard/doxywizard.cpp')
-rw-r--r-- | addon/doxywizard/doxywizard.cpp | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp index 97ff827..83ae3b6 100644 --- a/addon/doxywizard/doxywizard.cpp +++ b/addon/doxywizard/doxywizard.cpp @@ -32,7 +32,6 @@ #include "expert.h" #include "config.h" - const int messageTimeout = 5000; //!< status bar message timeout in millisec. #if defined(Q_OS_MACX) @@ -46,6 +45,34 @@ QCString getResourcePath() result+="/Contents/Resources/"; return result; } + +#define GRAPHVIZ_PATH "/Applications/Graphviz.app" +#define DOT_PATH GRAPHVIZ_PATH "/Contents/MacOS" +#define DOT_LOCATION DOT_PATH "/dot" + +bool checkIfDotInstalled() +{ + QFileInfo fi(GRAPHVIZ_PATH); + if (fi.exists() && fi.isDir()) + { + fi.setFile(DOT_LOCATION); + if (fi.exists() && fi.isFile()) + { + return TRUE; + } + } + return FALSE; +} + +void setDotPath() +{ + if (checkIfDotInstalled()) + { + Config_getString("DOT_PATH")=DOT_PATH; + Config_getBool("HAVE_DOT")=TRUE; + } +} + #endif @@ -651,10 +678,7 @@ MainWidget::MainWidget(QWidget *parent) Config::instance()->init(); Config::instance()->check(); #if defined(Q_OS_MACX) - // we bundle dot with doxywizard on the Mac so we can safely enable - // it here - Config_getString("DOT_PATH")=getResourcePath(); - Config_getBool("HAVE_DOT")=TRUE; + setDotPath(); #endif QWidget *w = new QWidget(this); @@ -1079,7 +1103,10 @@ void MainWidget::launchWizard() break; } #if defined(Q_OS_MACX) - Config_getString("DOT_PATH")=getResourcePath(); + if (Config_getBool("HAVE_DOT")) + { + setDotPath(); + } #endif setConfigSaved(FALSE); } @@ -1098,9 +1125,11 @@ void MainWidget::loadConfigFromFile(const QString &fn) { Config::instance()->convertStrToVal(); #if defined(Q_OS_MACX) - if (Config_getString("DOT_PATH")!=getResourcePath()) + if (checkIfDotInstalled() && + qstricmp(Config_getString("DOT_PATH"),DOT_PATH)!=0 + ) { - Config_getString("DOT_PATH")=getResourcePath(); + Config_getString("DOT_PATH")=DOT_PATH; setConfigSaved(FALSE); } else @@ -1134,12 +1163,9 @@ void MainWidget::launchExpert() expert.init(); expert.exec(); #if defined(Q_OS_MACX) - // we bundle dot with doxywizard on the Mac so we can safely enable - // it here - Config_getString("DOT_PATH")=getResourcePath(); - Config_getBool("HAVE_DOT")=TRUE; + setDotPath(); #endif - setConfigSaved(FALSE); + if (expert.hasChanged()) setConfigSaved(FALSE); } void MainWidget::saveDefaults() @@ -1191,10 +1217,7 @@ void MainWidget::resetConfig() // initialize config settings Config::instance()->init(); #if defined(Q_OS_MACX) - // we bundle dot with doxywizard on the Mac so we can safely enable - // it here - Config_getString("DOT_PATH")=getResourcePath(); - Config_getBool("HAVE_DOT")=TRUE; + setDotPath(); #endif m_configFileName = ""; |