Skip to content
Permalink
Browse files

- removed PKGDATAPATH and PLUGINPATH definitions: use QgsApplication …

…instead

- use QgsApplication to detect data path in help viewer and mapserver export


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7455 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 18, 2007
1 parent 465d54e commit a469913c89e9ab7ac5c2869a2e58d64dcb077da1
Showing with 11 additions and 38 deletions.
  1. +0 −2 CMakeLists.txt
  2. +4 −20 src/helpviewer/qgshelpviewer.cpp
  3. +7 −16 tools/mapserver_export/qgsmapserverexport.cpp
@@ -181,8 +181,6 @@ ELSE (WIN32)

IF (UNIX AND NOT APPLE)
ADD_DEFINITIONS(-DPREFIX=\\"${CMAKE_INSTALL_PREFIX}\\")
ADD_DEFINITIONS(-DPLUGINPATH=\\"${QGIS_PLUGIN_DIR}\\")
ADD_DEFINITIONS(-DPKGDATAPATH=\\"${QGIS_DATA_DIR}\\")
ENDIF (UNIX AND NOT APPLE)

ENDIF (WIN32)
@@ -32,6 +32,8 @@

#include "qgshelpviewer.h"

#include "qgsapplication.h"

QgsHelpViewer::QgsHelpViewer(const QString &contextId, QWidget *parent,
Qt::WFlags fl)
: QDialog(parent, fl)
@@ -63,16 +65,7 @@ void QgsHelpViewer::loadContext(const QString &contextId)
if(contextId != QString::null)
{
// set up the path to the help file
QString helpFilesPath =
#ifdef Q_OS_MACX
// remove bin/qgis_help.app/Contents/MacOS to get to share/qgis
qApp->applicationDirPath() + "/../../../../share/qgis" +
#elif WIN32
qApp->applicationDirPath() + "/share/qgis"
#else
QString(PKGDATAPATH) +
#endif
"/resources/context_help/";
QString helpFilesPath = QgsApplication::pkgDataPath() + "/resources/context_help/";
/*
* determine the locale and create the file name from
* the context id
@@ -137,16 +130,7 @@ void QgsHelpViewer::loadContextFromSqlite(const QString &contextId)
if(contextId != QString::null)
{
// connect to the database
QString helpDbPath =
#ifdef Q_OS_MACX
// remove bin/qgis_help.app/Contents/MacOS to get to share/qgis
qApp->applicationDirPath() + "/../../../../share/qgis" +
#elif WIN32
qApp->applicationDirPath() +
#else
QString(PKGDATAPATH) +
#endif
"/resources/qgis_help.db";
QString helpDbPath = QgsApplication::pkgDataPath() + "/resources/qgis_help.db";
int rc = connectDb(helpDbPath);
// get the help content and title from the database

@@ -29,9 +29,12 @@ email : sherman at mrcc.com
#include <qstring.h>
#include <QWidget>
#include <QApplication>
#include "../../src/core/qgscontexthelp.h"
#include "qgsmapserverexport.h"

// from CORE library
#include "qgsapplication.h"
#include "qgscontexthelp.h"


// constructor
QgsMapserverExport::QgsMapserverExport(QWidget * parent, Qt::WFlags fl)
@@ -114,21 +117,9 @@ void QgsMapserverExport::apply()
//TODO Need to append the path to the qgis python files using the path to the
// Python files in the QGIS install directory
PyRun_SimpleString("import sys");
QString prefixPath = QApplication::applicationDirPath();
// Setup up path to the python script directory based on platform
#ifdef Q_WS_MACX
QString dataPath = prefixPath + "/../../../../share/qgis";
#elif WIN32
# ifndef _MSC_VER
QString dataPath = prefixPath + "/share/qgis";
# else
QString dataPath = prefixPath;
# endif
#else
QString dataPath ( PKGDATAPATH );
#endif
dataPath = dataPath.trimmed();
QString scriptDir = dataPath + QDir::separator() + "python";

// Setup up path to the python script directory
QString scriptDir = QgsApplication::pkgDataPath() + QDir::separator() + "python";
qDebug("Python scripts directory: " + scriptDir.toLocal8Bit());
//QString curdir = "/home/gsherman/development/qgis_qt_port/tools/mapserver_export";
QString sysCmd = QString("sys.path.append('%1')").arg(scriptDir);

0 comments on commit a469913

Please sign in to comment.
You can’t perform that action at this time.