Skip to content

Commit

Permalink
Applied patch from ticket #615 to use appropriate search path for hel…
Browse files Browse the repository at this point in the history
…p files

git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6701 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Feb 26, 2007
1 parent c0a0ab1 commit 17765be
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/helpviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ SET (HELP_SRCS
main.cpp
qgshelpserver.cpp
qgshelpviewer.cpp
../core/qgsapplication.cpp
../core/qgslogger.cpp
)

SET (HELP_UIS qgshelpviewerbase.ui)
Expand All @@ -30,6 +32,7 @@ QT4_WRAP_CPP (HELP_MOC_SRCS ${HELP_MOC_HDRS})
ADD_EXECUTABLE (qgis_help MACOSX_BUNDLE ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core
${CMAKE_CURRENT_BINARY_DIR}
${SQLITE3_INCLUDE_DIR}
)
Expand Down
43 changes: 41 additions & 2 deletions src/helpviewer/main.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
#include <iostream>
#include <qapplication.h>
#include <qgsapplication.h>
#include <qstring.h>
#include <QTextCodec>
#include <QTranslator>
#include "qgshelpserver.h"
#include "qgshelpviewer.h"
#include "qgsapplication.h"

int main( int argc, char ** argv )
{
QApplication a( argc, argv );
QgsApplication a( argc, argv, true );
QString context = QString::null;
QString myTranslationCode="";

if(argc == 2)
{
context = argv[1];
}
#ifdef Q_OS_MACX
// If we're on Mac, we have the resource library way above us...
a.setPkgDataPath(QgsApplication::prefixPath()+"/../../../../share/qgis");
#endif

QString i18nPath = QgsApplication::i18nPath();
if (myTranslationCode.isEmpty())
{
myTranslationCode = QTextCodec::locale();
}
#ifdef QGISDEBUG
std::cout << "Setting translation to "
<< i18nPath.toLocal8Bit().data() << "/qgis_" << myTranslationCode.toLocal8Bit().data() << std::endl;
#endif

/* Translation file for Qt.
* The strings from the QMenuBar context section are used by Qt/Mac to shift
* the About, Preferences and Quit items to the Mac Application menu.
* These items must be translated identically in both qt_ and qgis_ files.
*/
QTranslator qttor(0);
if (qttor.load(QString("qt_") + myTranslationCode, i18nPath))
{
a.installTranslator(&qttor);
}

/* Translation file for QGIS.
*/
QTranslator qgistor(0);
if (qgistor.load(QString("qgis_") + myTranslationCode, i18nPath))
{
a.installTranslator(&qgistor);
}

QgsHelpViewer w(context);
w.show();

Expand Down

0 comments on commit 17765be

Please sign in to comment.