Skip to content

Commit

Permalink
- removed PKGDATAPATH and PLUGINPATH definitions: use QgsApplication …
Browse files Browse the repository at this point in the history
…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 committed Nov 18, 2007
1 parent 465d54e commit a469913
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 38 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Expand Up @@ -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)
Expand Down
24 changes: 4 additions & 20 deletions src/helpviewer/qgshelpviewer.cpp
Expand Up @@ -32,6 +32,8 @@

#include "qgshelpviewer.h"

#include "qgsapplication.h"

QgsHelpViewer::QgsHelpViewer(const QString &contextId, QWidget *parent,
Qt::WFlags fl)
: QDialog(parent, fl)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
23 changes: 7 additions & 16 deletions tools/mapserver_export/qgsmapserverexport.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a469913

Please sign in to comment.