mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:03:23 +00:00
Do a better job finding Marble Google Sat files
First try if Google Sat is already installed as a provider (and just use it if it is). Then use the executable path to make an educated guess where these files might be found as part of Subsurface. We now install the necessary directory tree under $(DESTDIR)/usr/share/subsurface/marbledata Still far from perfect - but this should work at least on Linux. MacOS will need a different modifier for the path and Windows I haven't even thought about, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7b75cfa808
commit
ae2c132a26
4 changed files with 36 additions and 3 deletions
|
@ -8,6 +8,7 @@ XSLCONFIG=xslt-config
|
|||
QMAKE=qmake
|
||||
MOC=moc
|
||||
UIC=uic
|
||||
TAR=tar
|
||||
|
||||
CONFIGFILE = config.cache
|
||||
ifeq ($(CONFIGURING),1)
|
||||
|
|
1
Makefile
1
Makefile
|
@ -21,6 +21,7 @@ ICONPATH = $(DATADIR)/icons/hicolor
|
|||
ICONDIR = $(ICONPATH)/scalable/apps
|
||||
MANDIR = $(DATADIR)/man/man1
|
||||
XSLTDIR = $(DATADIR)/$(NAME)/xslt
|
||||
MARBLEDIR = marbledata/maps/earth/googlesat
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(ICONPATH)
|
||||
|
||||
ICONFILE = $(NAME)-icon.svg
|
||||
|
|
4
Rules.mk
4
Rules.mk
|
@ -70,6 +70,10 @@ install: all
|
|||
$(INSTALL) -d -m 755 $(XSLTDIR); \
|
||||
$(INSTALL) -m 644 $(XSLTFILES) $(XSLTDIR); \
|
||||
fi
|
||||
@-if test ! -z "$(MARBLEDIR)"; then \
|
||||
$(INSTALL) -d -m 755 $(DATADIR)/$(NAME)/$(MARBLEDIR); \
|
||||
$(TAR) cf - $(MARBLEDIR) | ( cd $(DATADIR)/$(NAME); $(TAR) xf - ); \
|
||||
fi
|
||||
for LOC in $(wildcard share/locale/*/LC_MESSAGES); do \
|
||||
$(INSTALL) -d $(prefix)/$$LOC; \
|
||||
$(INSTALL) -m 644 $$LOC/$(NAME).mo $(prefix)/$$LOC/$(NAME).mo; \
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <marble/GeoDataDocument.h>
|
||||
#include <marble/MarbleModel.h>
|
||||
#include <marble/MarbleDirs.h>
|
||||
#include <marble/MapThemeManager.h>
|
||||
#if INCOMPLETE_MARBLE
|
||||
#include "marble/GeoDataTreeModel.h"
|
||||
#else
|
||||
|
@ -19,9 +20,35 @@
|
|||
|
||||
GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0)
|
||||
{
|
||||
// this will find the Google maps when running from your build directory
|
||||
// TODO: all the magic to find the install path (and actually install/bundle these files)
|
||||
MarbleDirs::setMarbleDataPath(QDir("./marbledata").absolutePath());
|
||||
// check if Google Sat Maps are installed
|
||||
// if not, check if they are in a known location
|
||||
MapThemeManager mtm;
|
||||
QStringList list = mtm.mapThemeIds();
|
||||
QString theme, execdir;
|
||||
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;
|
||||
}
|
||||
}
|
||||
messageWidget = new KMessageWidget(this);
|
||||
messageWidget->setCloseButtonVisible(false);
|
||||
messageWidget->setHidden(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue