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-gui.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-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index 2d5e409b3..1d9f9cad3 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -263,4 +263,30 @@ void set_default_dive_computer_device(const char *name) s.endGroup(); } +QString getSubsurfaceDataPath(QString folderToFind) +{ + QString execdir; + QDir folder; + + // first check if we are running in the build dir, so this + // is just subdirectory of the current directory + execdir = QCoreApplication::applicationDirPath(); + folder = QDir(execdir.append(QDir::separator()).append(folderToFind)); + if (folder.exists()) + return folder.absolutePath(); + + // next check for the Linux typical $(prefix)/share/subsurface + execdir = QCoreApplication::applicationDirPath(); + folder = QDir(execdir.replace("bin", "share/subsurface/").append(folderToFind)); + if (folder.exists()) + return folder.absolutePath(); + + // then look for the usual location on a Mac + execdir = QCoreApplication::applicationDirPath(); + folder = QDir(execdir.append("/../Resources/share/").append(folderToFind)); + if (folder.exists()) + return folder.absolutePath(); + return QString(""); +} + #include "qt-gui.moc" |