mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Adds preliminary support for Marble Widget
Adds preliminary support for marble widget, alongside with the dive list. my idea is to let the view stay there at the left of the dive list since we got a lot of unused space and a globe is something nice to have - so you can look around where did you dived, the dives near the one that's currectly selected, and so on. I'm not using OpenStreetMaps right now, but a good thing about marble is that it is skinnable - so for instance, a dive school could present a dive lesson using subsurface with a globe from the 1600, to make it feel like 'history'. This version will only compile to Qt4. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
2f35c94026
commit
4098922b55
5 changed files with 95 additions and 35 deletions
26
Configure.mk
26
Configure.mk
|
@ -83,20 +83,28 @@ endif
|
|||
# Use qmake to find out which Qt version we are building for.
|
||||
QT_VERSION_MAJOR = $(shell $(QMAKE) -query QT_VERSION | cut -d. -f1)
|
||||
ifeq ($(QT_VERSION_MAJOR), 5)
|
||||
QT_MODULES = Qt5Widgets Qt5Svg
|
||||
QT_CORE = Qt5Core
|
||||
QTBINDIR = $(shell $(QMAKE) -query QT_HOST_BINS)
|
||||
# Tool paths are not stored in .pc files in Qt 5.0
|
||||
MOC = $(QTBINDIR)/moc
|
||||
UIC = $(QTBINDIR)/uic
|
||||
RCC = $(QTBINDIR)/rcc
|
||||
else
|
||||
# QT_MODULES = Qt5Widgets Qt5Svg
|
||||
# QT_CORE = Qt5Core
|
||||
# QTBINDIR = $(shell $(QMAKE) -query QT_HOST_BINS)
|
||||
# # Tool paths are not stored in .pc files in Qt 5.0
|
||||
# MOC = $(QTBINDIR)/moc
|
||||
# UIC = $(QTBINDIR)/uic
|
||||
# RCC = $(QTBINDIR)/rcc
|
||||
# if qmake is qt5, try to get the qt4 one.
|
||||
QMAKE = { qmake-qt4 -v >/dev/null 2>&1 && echo qmake-qt4; }
|
||||
#else
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(QMAKE)),)
|
||||
$(error Could not find qmake or qmake-qt4 in $$PATH for the Qt4 version they failed)
|
||||
endif
|
||||
|
||||
QT_MODULES = QtGui QtSvg
|
||||
QT_CORE = QtCore
|
||||
MOC = $(shell $(PKGCONFIG) --variable=moc_location QtCore)
|
||||
UIC = $(shell $(PKGCONFIG) --variable=uic_location QtGui)
|
||||
RCC = $(shell $(PKGCONFIG) --variable=rcc_location QtGui)
|
||||
endif
|
||||
#endif
|
||||
|
||||
# we need GLIB2CFLAGS for gettext
|
||||
QTCXXFLAGS = $(shell $(PKGCONFIG) --cflags $(QT_MODULES)) $(GLIB2CFLAGS)
|
||||
|
|
4
Makefile
4
Makefile
|
@ -40,6 +40,7 @@ HEADERS = \
|
|||
qt-ui/starwidget.h \
|
||||
qt-ui/modeldelegates.h \
|
||||
qt-ui/profilegraphics.h \
|
||||
qt-ui/globe.h
|
||||
|
||||
|
||||
SOURCES = \
|
||||
|
@ -70,6 +71,7 @@ SOURCES = \
|
|||
qt-ui/starwidget.cpp \
|
||||
qt-ui/modeldelegates.cpp \
|
||||
qt-ui/profilegraphics.cpp \
|
||||
qt-ui/globe.cpp \
|
||||
$(RESFILE)
|
||||
|
||||
|
||||
|
@ -112,7 +114,7 @@ else
|
|||
endif
|
||||
|
||||
LIBS = $(LIBQT) $(LIBXML2) $(LIBXSLT) $(LIBSQLITE3) $(LIBGCONF2) $(LIBDIVECOMPUTER) \
|
||||
$(EXTRALIBS) $(LIBZIP) -lpthread -lm $(LIBOSMGPSMAP) $(LIBSOUP) $(LIBWINSOCK)
|
||||
$(EXTRALIBS) $(LIBZIP) -lpthread -lm $(LIBOSMGPSMAP) $(LIBSOUP) $(LIBWINSOCK) -lmarblewidget
|
||||
|
||||
MSGLANGS=$(notdir $(wildcard po/*.po))
|
||||
|
||||
|
|
25
qt-ui/globe.cpp
Normal file
25
qt-ui/globe.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "globe.h"
|
||||
#include <marble/AbstractFloatItem.h>
|
||||
|
||||
using namespace Marble;
|
||||
|
||||
GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent)
|
||||
{
|
||||
setMapThemeId("earth/bluemarble/bluemarble.dgml");
|
||||
setProjection( Marble::Spherical );
|
||||
|
||||
// Enable the cloud cover and enable the country borders
|
||||
setShowClouds( true );
|
||||
setShowBorders( true );
|
||||
|
||||
// Hide the FloatItems: Compass and StatusBar
|
||||
setShowOverviewMap(false);
|
||||
setShowScaleBar(false);
|
||||
|
||||
Q_FOREACH( AbstractFloatItem * floatItem, floatItems() ){
|
||||
if ( floatItem && floatItem->nameId() == "compass" ) {
|
||||
floatItem->setPosition( QPoint( 10, 10 ) );
|
||||
floatItem->setContentSize( QSize( 50, 50 ) );
|
||||
}
|
||||
}
|
||||
}
|
13
qt-ui/globe.h
Normal file
13
qt-ui/globe.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef GLOBE_H
|
||||
#define GLOBE_H
|
||||
|
||||
#include <marble/MarbleWidget.h>
|
||||
|
||||
class GlobeGPS : public Marble::MarbleWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GlobeGPS(QWidget *parent);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -14,8 +14,8 @@
|
|||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="mainSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -27,6 +27,10 @@
|
|||
<widget class="MainTab" name="InfoWidget" native="true"/>
|
||||
<widget class="ProfileGraphicsView" name="ProfileWidget"/>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="globeListSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="DiveListView" name="ListWidget">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> QTreeView {
|
||||
|
@ -78,6 +82,8 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="GlobeGPS" name="widget" native="true"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -88,7 +94,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>763</width>
|
||||
<height>20</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -365,6 +371,12 @@
|
|||
<extends>QGraphicsView</extends>
|
||||
<header>profilegraphics.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GlobeGPS</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>globe.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in a new issue