[PATCH] Make Marble optional

Anton Lundin glance at acc.umu.se
Sat Mar 1 05:19:38 PST 2014


On 01 March, 2014 - Alberto wrote:

> From: Alberto Corona <albcoron at gmail.com>
> 
> Implemented some changes suggested by glance
> Building could now be done without having to have Marble installed
> Fixes #394
> 
> Signed-off-by: Alberto Corona <albcoron at gmail.com>

I would suggest not taking this patch. The reason why i never submitted
this patch is that is a crud hack to get things to build without marble.

A proper patch would remote the whole panel from the ui, not leaving
dead space there as this one does.

The original patch doesn't carry a sob thus never formally approved for
release, so just don't grab someone else code and submit it as yours.
Adding some whitespace damage doesn't count as making it yours.

If you grab someone else patch and rewrite it, check that they approved
there code for release and give credit where credits due.


//Anton


> ---
>  qt-ui/globe.cpp          | 11 +++++++++++
>  qt-ui/globe.h            | 21 +++++++++++++++++++++
>  qt-ui/mainwindow.h       |  1 +
>  subsurface-configure.pri | 10 +++++++---
>  subsurface.pro           |  2 +-
>  5 files changed, 41 insertions(+), 4 deletions(-)
> 
> diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
> index 496afb4..7837ae7 100644
> --- a/qt-ui/globe.cpp
> +++ b/qt-ui/globe.cpp
> @@ -1,4 +1,5 @@
>  #include "globe.h"
> +#ifndef NO_MARBLE
>  #include "kmessagewidget.h"
>  #include "mainwindow.h"
>  #include "ui_mainwindow.h"
> @@ -297,3 +298,13 @@ void GlobeGPS::resizeEvent(QResizeEvent *event)
>  		messageWidget->setGeometry(5, 5, size - 10, 0);
>  	messageWidget->setMaximumHeight(500);
>  }
> +
> +#else
> +
> +GlobeGPS::GlobeGPS(QWidget *parent) {}
> +void GlobeGPS::repopulateLabels() {}
> +void GlobeGPS::centerOn(dive *dive) {}
> +void GlobeGPS::prepareForGetDiveCoordinates() {}
> +void GlobeGPS::reload() {}
> +bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev) {}
> +#endif
> diff --git a/qt-ui/globe.h b/qt-ui/globe.h
> index 80d9613..e25f244 100644
> --- a/qt-ui/globe.h
> +++ b/qt-ui/globe.h
> @@ -1,5 +1,6 @@
>  #ifndef GLOBE_H
>  #define GLOBE_H
> +#ifndef NO_MARBLE
>  
>  #include <marble/MarbleWidget.h>
>  #include <marble/GeoDataCoordinates.h>
> @@ -41,4 +42,24 @@ slots:
>  	void prepareForGetDiveCoordinates();
>  };
>  
> +#else
> +
> +#include <QWidget>
> +
> +struct dive;
> +
> +class GlobeGPS : public QWidget {
> +        Q_OBJECT
> +public:
> +        GlobeGPS(QWidget *parent);
> +        void reload();
> +        void repopulateLabels();
> +        void centerOn(struct dive *dive);
> +        bool eventFilter(QObject *, QEvent *);
> +public
> +slots:
> +        void prepareForGetDiveCoordinates();
> +};
> +
> +#endif
>  #endif // GLOBE_H
> diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
> index 1db3d5a..65a532c 100644
> --- a/qt-ui/mainwindow.h
> +++ b/qt-ui/mainwindow.h
> @@ -9,6 +9,7 @@
>  
>  #include <QMainWindow>
>  #include <QAction>
> +#include <QSettings>
>  #include <QUrl>
>  
>  #include "ui_mainwindow.h"
> diff --git a/subsurface-configure.pri b/subsurface-configure.pri
> index 8e6aead..fb48185 100644
> --- a/subsurface-configure.pri
> +++ b/subsurface-configure.pri
> @@ -116,7 +116,6 @@ isEmpty(XML2_CFLAGS)|isEmpty(XML2_LIBS): \
>  isEmpty(XSLT_CFLAGS)|isEmpty(XSLT_LIBS): \
>  	error("Could not find libxslt. Did you forget to install it?")
>  
> -
>  QMAKE_CFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS
>  QMAKE_CXXFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS
>  LIBS *= $$XSLT_LIBS $$XML2_LIBS
> @@ -131,14 +130,19 @@ link_pkgconfig: PKGCONFIG += libzip sqlite3
>  # Add libiconv if needed
>  link_pkgconfig: packagesExist(libiconv): PKGCONFIG += libiconv
>  
> +# Add Marble if present
> +link_pkgconfig: packagesExist(libmarlbe): DEFINES += NO_MARBLE
> +
>  #
>  # Find libmarble
>  #
>  # Before Marble 4.9, the GeoDataTreeModel.h header wasn't installed
>  # Check if it's present by trying to compile
>  # ### FIXME: implement that
> -win32: CONFIG(debug, debug|release): LIBS += -lmarblewidgetd
> -else: LIBS += -lmarblewidget
> +!contains(DEFINES, NO_MARBLE) {
> +        win32: CONFIG(debug, debug|release): LIBS += -lmarblewidgetd
> +        else: LIBS += -lmarblewidget
> +}
>  
>  #
>  # Platform-specific changes
> diff --git a/subsurface.pro b/subsurface.pro
> index 81cb906..49865d7 100644
> --- a/subsurface.pro
> +++ b/subsurface.pro
> @@ -4,7 +4,7 @@ QT = core gui network svg
>  lessThan(QT_MAJOR_VERSION, 5) {
>  	QT += webkit
>  } else {
> -	QT += webkitwidgets
> +	!android: QT += webkitwidgets
>  }
>  INCLUDEPATH += qt-ui $$PWD
>  DEPENDPATH += qt-ui
> -- 
> 1.8.5.3
> 
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list