Skip to content

Commit 0b2e8e7

Browse files
author
wonder
committedNov 18, 2007
- 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
1 parent 1b4d963 commit 0b2e8e7

File tree

3 files changed

+11
-38
lines changed

3 files changed

+11
-38
lines changed
 

‎CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ ELSE (WIN32)
181181

182182
IF (UNIX AND NOT APPLE)
183183
ADD_DEFINITIONS(-DPREFIX=\\"${CMAKE_INSTALL_PREFIX}\\")
184-
ADD_DEFINITIONS(-DPLUGINPATH=\\"${QGIS_PLUGIN_DIR}\\")
185-
ADD_DEFINITIONS(-DPKGDATAPATH=\\"${QGIS_DATA_DIR}\\")
186184
ENDIF (UNIX AND NOT APPLE)
187185

188186
ENDIF (WIN32)

‎src/helpviewer/qgshelpviewer.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
#include "qgshelpviewer.h"
3434

35+
#include "qgsapplication.h"
36+
3537
QgsHelpViewer::QgsHelpViewer(const QString &contextId, QWidget *parent,
3638
Qt::WFlags fl)
3739
: QDialog(parent, fl)
@@ -63,16 +65,7 @@ void QgsHelpViewer::loadContext(const QString &contextId)
6365
if(contextId != QString::null)
6466
{
6567
// set up the path to the help file
66-
QString helpFilesPath =
67-
#ifdef Q_OS_MACX
68-
// remove bin/qgis_help.app/Contents/MacOS to get to share/qgis
69-
qApp->applicationDirPath() + "/../../../../share/qgis" +
70-
#elif WIN32
71-
qApp->applicationDirPath() + "/share/qgis"
72-
#else
73-
QString(PKGDATAPATH) +
74-
#endif
75-
"/resources/context_help/";
68+
QString helpFilesPath = QgsApplication::pkgDataPath() + "/resources/context_help/";
7669
/*
7770
* determine the locale and create the file name from
7871
* the context id
@@ -137,16 +130,7 @@ void QgsHelpViewer::loadContextFromSqlite(const QString &contextId)
137130
if(contextId != QString::null)
138131
{
139132
// connect to the database
140-
QString helpDbPath =
141-
#ifdef Q_OS_MACX
142-
// remove bin/qgis_help.app/Contents/MacOS to get to share/qgis
143-
qApp->applicationDirPath() + "/../../../../share/qgis" +
144-
#elif WIN32
145-
qApp->applicationDirPath() +
146-
#else
147-
QString(PKGDATAPATH) +
148-
#endif
149-
"/resources/qgis_help.db";
133+
QString helpDbPath = QgsApplication::pkgDataPath() + "/resources/qgis_help.db";
150134
int rc = connectDb(helpDbPath);
151135
// get the help content and title from the database
152136

‎tools/mapserver_export/qgsmapserverexport.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ email : sherman at mrcc.com
2929
#include <qstring.h>
3030
#include <QWidget>
3131
#include <QApplication>
32-
#include "../../src/core/qgscontexthelp.h"
3332
#include "qgsmapserverexport.h"
3433

34+
// from CORE library
35+
#include "qgsapplication.h"
36+
#include "qgscontexthelp.h"
37+
3538

3639
// constructor
3740
QgsMapserverExport::QgsMapserverExport(QWidget * parent, Qt::WFlags fl)
@@ -114,21 +117,9 @@ void QgsMapserverExport::apply()
114117
//TODO Need to append the path to the qgis python files using the path to the
115118
// Python files in the QGIS install directory
116119
PyRun_SimpleString("import sys");
117-
QString prefixPath = QApplication::applicationDirPath();
118-
// Setup up path to the python script directory based on platform
119-
#ifdef Q_WS_MACX
120-
QString dataPath = prefixPath + "/../../../../share/qgis";
121-
#elif WIN32
122-
# ifndef _MSC_VER
123-
QString dataPath = prefixPath + "/share/qgis";
124-
# else
125-
QString dataPath = prefixPath;
126-
# endif
127-
#else
128-
QString dataPath ( PKGDATAPATH );
129-
#endif
130-
dataPath = dataPath.trimmed();
131-
QString scriptDir = dataPath + QDir::separator() + "python";
120+
121+
// Setup up path to the python script directory
122+
QString scriptDir = QgsApplication::pkgDataPath() + QDir::separator() + "python";
132123
qDebug("Python scripts directory: " + scriptDir.toLocal8Bit());
133124
//QString curdir = "/home/gsherman/development/qgis_qt_port/tools/mapserver_export";
134125
QString sysCmd = QString("sys.path.append('%1')").arg(scriptDir);

0 commit comments

Comments
 (0)