[QGIS Commit] r8472 - in trunk/qgis: . cmake_templates src/app src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon May 19 16:52:54 EDT 2008


Author: timlinux
Date: 2008-05-19 16:52:54 -0400 (Mon, 19 May 2008)
New Revision: 8472

Modified:
   trunk/qgis/CMakeLists.txt
   trunk/qgis/cmake_templates/qgsconfig.h.in
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/core/qgsapplication.cpp
   trunk/qgis/src/core/qgsapplication.h
Log:
Dont use PREFIX on linux (or anywhere else). On linux assume prefix is appdirpath/.
This fixes issues where qgis is nor relocatable after building, and removes cmake warnings about duplicate definition of PREFIX. Note that to be relocatable you should not build using rpath support..


Modified: trunk/qgis/CMakeLists.txt
===================================================================
--- trunk/qgis/CMakeLists.txt	2008-05-19 16:44:56 UTC (rev 8471)
+++ trunk/qgis/CMakeLists.txt	2008-05-19 20:52:54 UTC (rev 8472)
@@ -229,10 +229,6 @@
   SET (DEFAULT_PLUGIN_SUBDIR  lib/qgis)
   SET (DEFAULT_INCLUDE_SUBDIR include/qgis)
 
-  IF (UNIX AND NOT APPLE)
-    ADD_DEFINITIONS(-DPREFIX=${CMAKE_INSTALL_PREFIX})
-  ENDIF (UNIX AND NOT APPLE)
-
 ENDIF (WIN32)
 
 

Modified: trunk/qgis/cmake_templates/qgsconfig.h.in
===================================================================
--- trunk/qgis/cmake_templates/qgsconfig.h.in	2008-05-19 16:44:56 UTC (rev 8471)
+++ trunk/qgis/cmake_templates/qgsconfig.h.in	2008-05-19 20:52:54 UTC (rev 8472)
@@ -15,8 +15,6 @@
 //used in main.cpp and anywhere else where the release name is needed
 #define RELEASE_NAME "${RELEASE_NAME}"
 
-#define PREFIX "${CMAKE_INSTALL_PREFIX}"
-
 #define QGIS_PLUGIN_SUBDIR "${QGIS_PLUGIN_SUBDIR}"
 #define QGIS_DATA_SUBDIR "${QGIS_DATA_SUBDIR}"
 

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2008-05-19 16:44:56 UTC (rev 8471)
+++ trunk/qgis/src/app/qgisapp.cpp	2008-05-19 20:52:54 UTC (rev 8472)
@@ -1198,7 +1198,14 @@
   QString myIconPath = QgsApplication::themePath();
   myProjPixmap.load(myIconPath+"/mIconProjectionDisabled.png");
   mOnTheFlyProjectionStatusButton->setPixmap(myProjPixmap);
-  assert(!myProjPixmap.isNull());
+  QgsDebugMsg("Icon Path: " + myIconPath.toLocal8Bit());
+  if (myProjPixmap.isNull())
+  {
+    QMessageBox::critical(this, tr("Resource Location Error"), 
+        tr("Error reading icon resources from: \n %1\n Quitting...").arg(myIconPath));
+
+    exit(0);
+  }
   mOnTheFlyProjectionStatusButton->setWhatsThis(tr("This icon shows whether on the fly projection is enabled or not. Click the icon to bring up the project properties dialog to alter this behaviour."));
   mOnTheFlyProjectionStatusButton->setToolTip(tr("Projection status - Click to open projection dialog"));
   connect(mOnTheFlyProjectionStatusButton, SIGNAL(clicked()),
@@ -1624,6 +1631,7 @@
 {
   QSettings mySettings;
 
+  QgsDebugMsg("\n\n*************************************************");
   QgsDebugMsg("Restoring plugins from last session " + thePluginDirString);
   
 #ifdef WIN32
@@ -1664,6 +1672,10 @@
 
             loadPlugin(myName(), myDescription(), myFullPath);
           }
+          else
+          {
+            QgsDebugMsg("Plugin was not active last session, leaving disabled: " + myEntryName);
+          }
         }
         else
         {
@@ -1718,6 +1730,8 @@
     }
   }
 #endif
+  QgsDebugMsg("Loading plugins completed");
+  QgsDebugMsg("*************************************************\n\n");
 }
 
 

Modified: trunk/qgis/src/core/qgsapplication.cpp
===================================================================
--- trunk/qgis/src/core/qgsapplication.cpp	2008-05-19 16:44:56 UTC (rev 8471)
+++ trunk/qgis/src/core/qgsapplication.cpp	2008-05-19 20:52:54 UTC (rev 8472)
@@ -21,6 +21,7 @@
 #include <QDir>
 
 #include <qgsconfig.h>
+#include <qgslogger.h>
 
 // for htonl
 #ifdef WIN32
@@ -50,42 +51,69 @@
 QgsApplication::QgsApplication(int & argc, char ** argv, bool GUIenabled)
 : QApplication(argc, argv, GUIenabled)
 {
+  QgsDebugMsg("\n**********************************");
+  QgsDebugMsg("\nInitialising QgsApplication...");
 #if defined(Q_WS_MACX) || defined(Q_WS_WIN32) || defined(WIN32)
-  setPrefixPath(applicationDirPath(), TRUE);
+  setPrefixPath(applicationDirPath(), true);
 #else
-  setPrefixPath(PREFIX, TRUE);
+  QDir myDir(applicationDirPath());
+  myDir.cdUp();
+  QString myPrefix = myDir.absolutePath();
+  QgsDebugMsg("Prefix: " +  myPrefix.toLocal8Bit());
+  setPrefixPath(myPrefix, true);
 #endif
+  QgsDebugMsg("\nPlugin Path:" + mPluginPath);
+  QgsDebugMsg("\nPkgData Path:" + mPkgDataPath);
+  QgsDebugMsg("\nTheme Path:" + mThemePath);
+  QgsDebugMsg("\n**********************************\n");
 }
 
 QgsApplication::~QgsApplication()
 {}
 
-void QgsApplication::setPrefixPath(const QString& thePrefixPath, bool useDefaultPaths)
+void QgsApplication::setPrefixPath(const QString thePrefixPath, bool useDefaultPaths)
 {
   mPrefixPath = thePrefixPath;
   if (useDefaultPaths)
   {
-    setPluginPath(mPrefixPath + QString("/") + QString(QGIS_PLUGIN_SUBDIR));
-    setPkgDataPath(mPrefixPath + QString("/") + QString(QGIS_DATA_SUBDIR));
+    setPluginPath(mPrefixPath + QDir::separator() + QString(QGIS_PLUGIN_SUBDIR));
+    setPkgDataPath(mPrefixPath + QDir::separator() + QString(QGIS_DATA_SUBDIR));
   }
 }
 
-void QgsApplication::setPluginPath(const QString& thePluginPath)
+void QgsApplication::setPluginPath(const QString thePluginPath)
 {
   mPluginPath = thePluginPath;
+  QgsDebugMsg("\n\n\n\n\n +++++++++++++++++++++++\n plugin path changed\n" + mPluginPath + "\n +++++++++++++++++ \n\n\n\n");
 }
 
-void QgsApplication::setPkgDataPath(const QString& thePkgDataPath)
+void QgsApplication::setPkgDataPath(const QString thePkgDataPath)
 {
   mPkgDataPath = thePkgDataPath;
   mThemePath = mPkgDataPath + QString("/themes/default/");
 }
 
+const QString QgsApplication::prefixPath() 
+{ 
+  return mPrefixPath; 
+}
+const QString QgsApplication::pluginPath() 
+{ 
+  return mPluginPath; 
+}
+const QString QgsApplication::pkgDataPath() 
+{ 
+  return mPkgDataPath; 
+}
+const QString QgsApplication::themePath() 
+{ 
+  return mThemePath; 
+}
 
 /*!
   Set the theme path to the specified theme.
 */
-void QgsApplication::selectTheme(const QString& theThemeName)
+void QgsApplication::selectTheme(const QString theThemeName)
 {
   mThemePath = mPkgDataPath + QString("/themes/") + theThemeName + QString("/");
 }

Modified: trunk/qgis/src/core/qgsapplication.h
===================================================================
--- trunk/qgis/src/core/qgsapplication.h	2008-05-19 16:44:56 UTC (rev 8471)
+++ trunk/qgis/src/core/qgsapplication.h	2008-05-19 20:52:54 UTC (rev 8472)
@@ -25,7 +25,7 @@
     virtual ~QgsApplication();
 
     //! Set the theme path to the specified theme.
-    static void selectTheme(const QString& theThemeName);
+    static void selectTheme(const QString theThemeName);
 
     //! Returns the path to the authors file.
     static const QString authorsFilePath();
@@ -67,25 +67,25 @@
     static const QString svgPath();
 
     //! Returns the path to the application prefix directory.
-    static const QString& prefixPath() { return mPrefixPath; }
+    static const QString prefixPath(); 
 
     //! Returns the path to the application plugin directory.
-    static const QString& pluginPath() { return mPluginPath; }
+    static const QString pluginPath(); 
 
     //! Returns the common root path of all application data directories.
-    static const QString& pkgDataPath() { return mPkgDataPath; }
+    static const QString pkgDataPath(); 
 
     //! Returns the path to the current theme directory.
-    static const QString& themePath() { return mThemePath; }
+    static const QString themePath(); 
     
     //! Alters prefix path - used by 3rd party apps
-    static void setPrefixPath(const QString& thePrefixPath, bool useDefaultPaths = FALSE);
+    static void setPrefixPath(const QString thePrefixPath, bool useDefaultPaths = FALSE);
     
     //! Alters plugin path - used by 3rd party apps
-    static void setPluginPath(const QString& thePluginPath);
+    static void setPluginPath(const QString thePluginPath);
 
     //! Alters pkg data path - used by 3rd party apps
-    static void setPkgDataPath(const QString& thePkgDataPath);
+    static void setPkgDataPath(const QString thePkgDataPath);
     
     //! loads providers
     static void initQgis();



More information about the QGIS-commit mailing list