diff options
-rw-r--r-- | Configure.mk | 8 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | qt-ui/globe.cpp | 5 | ||||
-rw-r--r-- | qt-ui/marble/GeoDataTreeModel.h | 114 |
5 files changed, 130 insertions, 3 deletions
diff --git a/Configure.mk b/Configure.mk index 3d5e5c978..86b375985 100644 --- a/Configure.mk +++ b/Configure.mk @@ -146,6 +146,13 @@ ZIPFLAGS = $(strip $(shell $(PKGCONFIG) --cflags libzip 2> /dev/null)) LIBSQLITE3 = $(shell $(PKGCONFIG) --libs sqlite3 2> /dev/null) SQLITE3FLAGS = $(strip $(shell $(PKGCONFIG) --cflags sqlite3)) +UNAME_A = $(shell uname -a) +ifneq (,$(filter $(UNAME_A), Debian)) + MARBLEFLAGS = -DINCOMPLETE_MARBLE +else + MARBLEFLAGS = -DQT_NO_KEYWORDS +endif + # Write the configure file all: configure configure $(CONFIGURE): Configure.mk @@ -181,6 +188,7 @@ configure $(CONFIGURE): Configure.mk ZIPFLAGS = $(ZIPFLAGS)\\\ LIBSQLITE3 = $(LIBSQLITE3)\\\ SQLITE3FLAGS = $(SQLITE3FLAGS)\\\ + MARBLEFLAGS = $(MARBLEFLAGS)\\\ " | tr '\\' '\n' > $(CONFIGFILE) else @@ -8,7 +8,7 @@ VERSION=3.1 CC=gcc CFLAGS=-Wall -Wno-pointer-sign -g $(CLCFLAGS) -DGSEAL_ENABLE CXX=g++ -CXXFLAGS=-Wall -g $(CLCXXFLAGS) -DQT_NO_KEYWORDS +CXXFLAGS=-Wall -g $(CLCXXFLAGS) $(MARBLEFLAGS) INSTALL=install # these locations seem to work for SuSE and Fedora @@ -20,7 +20,9 @@ Building the Qt version under Linux On Debian you need libqt4-dev, libmarble-dev, libzip-dev. Unfortunately the marble version in Debian stable (and possibly Ubuntu) appears broken and missing essential header files used in the -current git version of Subsurface. +current git version of Subsurface. We hack around this right now by +including this header file but this needs to be revisited before an +actual release. On Fedora you need qt-devel, marble-devel, libzip-devel. diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index ef8932773..5d3418662 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -8,8 +8,11 @@ #include <marble/GeoDataPlacemark.h> #include <marble/GeoDataDocument.h> #include <marble/MarbleModel.h> +#if INCOMPLETE_MARBLE +#include "marble/GeoDataTreeModel.h" +#else #include <marble/GeoDataTreeModel.h> - +#endif #include <QMouseEvent> #include <QMessageBox> diff --git a/qt-ui/marble/GeoDataTreeModel.h b/qt-ui/marble/GeoDataTreeModel.h new file mode 100644 index 000000000..3a9c5d67d --- /dev/null +++ b/qt-ui/marble/GeoDataTreeModel.h @@ -0,0 +1,114 @@ +// +// This file is part of the Marble Virtual Globe. +// +// This program is free software licensed under the GNU LGPL. You can +// find a copy of this license in LICENSE.txt in the top directory of +// the source code. +// +// Copyright 2010 Thibaut Gridel <tgridel@free.fr> +// + +#ifndef MARBLE_GEODATATREEMODEL_H +#define MARBLE_GEODATATREEMODEL_H + +// -> does not appear to be needed #include "marble_export.h" + +#include <QtCore/QAbstractItemModel> + +namespace Marble +{ +class GeoDataObject; +class GeoDataDocument; +class GeoDataFeature; +class GeoDataContainer; + + +/** + * @short The representation of GeoData in a model + * This class represents all available data given by kml-data files. + */ +class MARBLE_EXPORT GeoDataTreeModel : public QAbstractItemModel +{ + Q_OBJECT + + public: + + /** + * Creates a new GeoDataTreeModel. + * + * @param parent The parent object. + */ + explicit GeoDataTreeModel( QObject *parent = 0 ); + + /** + * Destroys the GeoDataModel. + */ + ~GeoDataTreeModel(); + + virtual bool hasChildren( const QModelIndex &parent ) const; + + /** + * Return the number of Items in the Model. + */ + int rowCount( const QModelIndex &parent = QModelIndex() ) const; + + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + + QVariant data( const QModelIndex &index, int role ) const; + + QModelIndex index( int row, int column, + const QModelIndex &parent = QModelIndex() ) const; + + QModelIndex index( GeoDataObject* object ); + + QModelIndex parent( const QModelIndex &index ) const; + + int columnCount( const QModelIndex &parent = QModelIndex() ) const; + + Qt::ItemFlags flags ( const QModelIndex & index ) const; + + bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); + + void reset() { QAbstractItemModel::reset(); } + +public Q_SLOTS: + + /** + * Sets the root document to use. This replaces previously loaded data, if any. + * @param document The new root document. Ownership retains with the caller, + * i.e. GeoDataTreeModel will not delete the passed document at its destruction. + */ + void setRootDocument( GeoDataDocument *document ); + GeoDataDocument* rootDocument(); + + int addFeature( GeoDataContainer *parent, GeoDataFeature *feature ); + + bool removeFeature( GeoDataContainer *parent, int index ); + + bool removeFeature( GeoDataFeature *feature ); + + void updateFeature( GeoDataFeature *feature ); + + int addDocument( GeoDataDocument *document ); + + void removeDocument( int index ); + + void removeDocument( GeoDataDocument* document ); + + void update(); + +Q_SIGNALS: + /// insert and remove row don't trigger any signal that proxies forward + /// this signal will refresh geometry layer and placemark layout + void removed( GeoDataObject *object ); + void added( GeoDataObject *object ); + private: + Q_DISABLE_COPY( GeoDataTreeModel ) + class Private; + Private* const d; +}; + +} + +#endif // MARBLE_GEODATATREEMODEL_H |