- 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@7455 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
wonder 2007-11-18 18:08:01 +00:00
parent 1b4d963107
commit 0b2e8e7c73
3 changed files with 11 additions and 38 deletions

View File

@ -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)

View File

@ -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

View File

@ -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);