diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-31 06:26:08 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-31 06:26:56 +0900 |
commit | c972c7cbd9461041cc2cf8689e32f9a8fd04f66f (patch) | |
tree | 77daba276706bd112e9370bfc43b4e20ab654bde /qt-ui/globe.cpp | |
parent | 422e0f94d6f7657e48752da267dd9a02c96d8fc4 (diff) | |
download | subsurface-c972c7cbd9461041cc2cf8689e32f9a8fd04f66f.tar.gz |
Display the Subsurface manual in the help widget
This adds a helper function to determine the Subsurface data directory
(are we running from build directory? installed on Linux? installed on
Mac? - still need to add support for Windows). This same function is
then used by both the setup for Marble and for the help browser.
This assumes that the user-manual.html file has actually been built and
installed (which we don't do by default with the current Makefile).
Right now there are rendering issues with our manual in the help browser
widget - I'm sure this can be fixed...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/globe.cpp')
-rw-r--r-- | qt-ui/globe.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index 4b065c12d..bf2369862 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -1,6 +1,7 @@ #include "globe.h" #include "kmessagewidget.h" #include "../dive.h" +#include "../helpers.h" #include <QDebug> @@ -24,39 +25,16 @@ GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0) // if not, check if they are in a known location MapThemeManager mtm; QStringList list = mtm.mapThemeIds(); - QString theme, execdir; + QString theme, subsurfaceDataPath; QDir marble; bool foundGoogleMap = false; Q_FOREACH(theme, list) if (theme == "earth/googlesat/googlesat.dgml") foundGoogleMap = true; if (!foundGoogleMap) { - // first check if we are running from the build directory - execdir = QCoreApplication::applicationDirPath(); - marble = QDir(execdir.append("/marbledata")); - if (marble.exists()) { - MarbleDirs::setMarbleDataPath(marble.absolutePath()); - foundGoogleMap = true; - } - } - if (!foundGoogleMap) { - // next check if we can guess an installed location by replacing - // "bin" with "share/subsurface" - so /usr/local/bin/subsurface would - // have us check /usr/local/share/subsurface/marbledata - marble = execdir.replace("bin", "share/subsurface"); - if (marble.exists()) { - MarbleDirs::setMarbleDataPath(marble.absolutePath()); - foundGoogleMap = true; - } - } - if (!foundGoogleMap) { - // then check if we're running as an app on MacOSX - execdir = QCoreApplication::applicationDirPath(); - marble = QDir(execdir.append("/../Resources/share/marbledata")); - if (marble.exists()) { - MarbleDirs::setMarbleDataPath(marble.absolutePath()); - foundGoogleMap = true; - } + subsurfaceDataPath = getSubsurfaceDataPath("marbledata"); + if (subsurfaceDataPath != "") + MarbleDirs::setMarbleDataPath(subsurfaceDataPath); } messageWidget = new KMessageWidget(this); messageWidget->setCloseButtonVisible(false); |