summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-04-11 14:15:24 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-04-11 14:15:24 +0200
commit56e80eb797b55458614599a82c2264c46e6e5eb0 (patch)
tree5740b8ed298559c45f045d5daad8481e4c3eb39b /src
parentba8da105e12f272bd95e2c10e7035edaaaecfa2a (diff)
parent400c7fa8e767c65aab4b8a1d5161b5259080cec9 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src')
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp9
-rw-r--r--src/imports/location/qdeclarativegeomapgesturearea.cpp2
-rw-r--r--src/location/doc/src/qtlocation.qdoc9
-rw-r--r--src/location/places/qplacesearchresult.cpp2
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp76
-rw-r--r--src/plugins/position/android/src/jnipositioning.cpp8
-rw-r--r--src/plugins/position/position.pro4
-rw-r--r--src/plugins/position/simulator/qlocationconnection_simulator.cpp5
-rw-r--r--src/positioning/doc/src/qtpositioning.qdoc9
9 files changed, 53 insertions, 71 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 59590309..5d40935f 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -187,7 +187,7 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent)
serviceProvider_(0),
mappingManager_(0),
zoomLevel_(8.0),
- center_(0,0),
+ center_(51.5073,-0.1277), //London city center
activeMapType_(0),
componentCompleted_(false),
mappingManagerInitialized_(false),
@@ -643,10 +643,10 @@ qreal QDeclarativeGeoMap::zoomLevel() const
}
/*!
-\qmlproperty coordinate QtLocation::Map::center
+ \qmlproperty coordinate QtLocation::Map::center
This property holds the coordinate which occupies the center of the
- mapping viewport.
+ mapping viewport. Invalid center coordinates are ignored.
The default value is an arbitrary valid coordinate.
*/
@@ -655,6 +655,9 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate &center)
if (!mappingManagerInitialized_ && center == center_)
return;
+ if (!center.isValid())
+ return;
+
center_ = center;
if (center_.isValid() && mappingManagerInitialized_) {
diff --git a/src/imports/location/qdeclarativegeomapgesturearea.cpp b/src/imports/location/qdeclarativegeomapgesturearea.cpp
index 336f922f..75b28cc3 100644
--- a/src/imports/location/qdeclarativegeomapgesturearea.cpp
+++ b/src/imports/location/qdeclarativegeomapgesturearea.cpp
@@ -274,7 +274,7 @@ QT_BEGIN_NAMESPACE
\qmlsignal QtLocation::MapGestureArea::pinchUpdated(PinchEvent event)
This signal is emitted as the user's fingers move across the map,
- after the the \l pinchStarted signal is emitted.
+ after the \l pinchStarted signal is emitted.
The corresponding handler is \c onPinchUpdated.
diff --git a/src/location/doc/src/qtlocation.qdoc b/src/location/doc/src/qtlocation.qdoc
index 032f5448..2be4173a 100644
--- a/src/location/doc/src/qtlocation.qdoc
+++ b/src/location/doc/src/qtlocation.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -62,13 +62,16 @@
/*!
\page qtlocation-index.html
\title Qt Location
-\brief The Qt Location API provides positioning, mapping, navigation, and place search
+\brief The Qt Location API provides mapping, navigation, and place search
via QML and C++ interfaces.
\ingroup technology-apis
-The Qt Location API provides positioning, mapping, navigation, and place search via QML
+The Qt Location API provides mapping, navigation, and place search via QML
and C++ interfaces.
+The API has not been released yet but due to its platform-independent nature is available
+on all Qt platforms.
+
\section1 Overview
The Qt Location API gives developers the ability to determine a position by
diff --git a/src/location/places/qplacesearchresult.cpp b/src/location/places/qplacesearchresult.cpp
index 4b6ab6de..a5d49501 100644
--- a/src/location/places/qplacesearchresult.cpp
+++ b/src/location/places/qplacesearchresult.cpp
@@ -86,7 +86,7 @@ bool QPlaceSearchResultPrivate::compare(const QPlaceSearchResultPrivate *other)
\snippet places/requesthandler.h Convert search result
- The implmentation is handled in such a way that object slicing is not an issue.
+ The implementation is handled in such a way that object slicing is not an issue.
It is not expected that client applications or backend plugins instantiate
a QPlaceSearchResult directly, but rather client applications simply convert
to search result subclasses and backend plugins only instantiate subclasses.
diff --git a/src/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp
index 563d8270..6aa97762 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp
@@ -69,78 +69,52 @@ QT_BEGIN_NAMESPACE
*/
QGeoTiledMapDataNokia::QGeoTiledMapDataNokia(QGeoTiledMappingManagerEngineNokia *engine, QObject *parent /*= 0*/) :
QGeoTiledMapData(engine, parent),
- logo(":/images/logo.png"), // HERE logo image
- copyrightsSlab(1, 1, QImage::Format_ARGB32) {}
+ logo(":/images/logo.png") // HERE logo image
+{}
QGeoTiledMapDataNokia::~QGeoTiledMapDataNokia() {}
void QGeoTiledMapDataNokia::evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTiles)
{
const int copyrightsMargin = 10;
- const int shadowWidth = 3;
+ const int spaceToLogo = 4;
+ const int blurRate = 1;
const int fontSize = 10;
QGeoTiledMappingManagerEngineNokia *engineNokia = static_cast<QGeoTiledMappingManagerEngineNokia *>(engine());
const QString copyrightsString = engineNokia->evaluateCopyrightsText(activeMapType(), mapController()->zoom(), visibleTiles);
- if (width() > 0 && height() > 0 && (lastCopyrightsString.isNull() || copyrightsString != lastCopyrightsString)) {
- copyrightsSlab = copyrightsSlab.copy(0, 0, width(), height());
-
- // Blank image with full alpha
- copyrightsSlab.fill(Qt::transparent);
-
- QPainter painter(&copyrightsSlab);
- painter.drawImage(QPoint(0, copyrightsSlab.height() - logo.height()), logo);
-
- QColor fontColor(Qt::black);
- fontColor.setAlpha(64);
+ if (width() > 0 && height() > 0 && ((copyrightsString.isNull() && copyrightsSlab.isNull()) || copyrightsString != lastCopyrightsString)) {
QFont font("Sans Serif");
font.setPixelSize(fontSize);
font.setStyleHint(QFont::SansSerif);
font.setWeight(QFont::Bold);
+ QRect textBounds = QFontMetrics(font).boundingRect(0, 0, width(), height(), Qt::AlignBottom | Qt::AlignLeft | Qt::TextWordWrap, copyrightsString);
+
+ copyrightsSlab = QImage(logo.width() + textBounds.width() + spaceToLogo + blurRate * 2,
+ qMax(logo.height(), textBounds.height() + blurRate * 2),
+ QImage::Format_ARGB32_Premultiplied);
+ copyrightsSlab.fill(Qt::transparent);
+
+ QPainter painter(&copyrightsSlab);
+ painter.drawImage(QPoint(0, copyrightsSlab.height() - logo.height()), logo);
painter.setFont(font);
- painter.setPen(fontColor);
- QRect textLimitsRect(logo.width(),
- 0,
- copyrightsSlab.width() - (logo.width() + copyrightsMargin * 2),
- copyrightsSlab.height());
-
- // Drawing the copyrights base shadow (watermark)
- QRect textBoundingRect;
- QRect wmRect(textLimitsRect);
- int x, y;
- for (x = 0; x < shadowWidth; x++) {
- wmRect.setLeft(textLimitsRect.left() + x);
- for (y = 0; y < shadowWidth; y++) {
- wmRect.setBottom(textLimitsRect.bottom() - y);
- painter.drawText(wmRect,
- Qt::AlignLeft | Qt::AlignBottom | Qt::TextWordWrap,
- copyrightsString,
- &textBoundingRect);
+ painter.setPen(QColor(0, 0, 0, 64));
+ painter.translate(spaceToLogo + logo.width(), -blurRate);
+ for (int x=-blurRate; x<=blurRate; ++x) {
+ for (int y=-blurRate; y<=blurRate; ++y) {
+ painter.drawText(x, y, textBounds.width(), copyrightsSlab.height(),
+ Qt::AlignBottom | Qt::AlignLeft | Qt::TextWordWrap,
+ copyrightsString);
}
}
-
- // Drawing the copyrights text top face
- font.setWeight(QFont::Bold);
- fontColor = Qt::white;
- painter.setFont(font);
- painter.setPen(fontColor);
- wmRect.setLeft(textLimitsRect.left() + 1);
- wmRect.setBottom(textLimitsRect.bottom() - 1);
- painter.drawText(wmRect,
- Qt::AlignLeft | Qt::AlignBottom | Qt::TextWordWrap,
- copyrightsString,
- &textBoundingRect);
-
+ painter.setPen(Qt::white);
+ painter.drawText(0, 0, textBounds.width(), copyrightsSlab.height(),
+ Qt::AlignBottom | Qt::AlignLeft | Qt::TextWordWrap,
+ copyrightsString);
painter.end();
- int newHeight = qMax(logo.height(), textBoundingRect.height());
-
- copyrightsSlab = copyrightsSlab.copy(0, copyrightsSlab.height() - newHeight,
- logo.width() + textBoundingRect.width() + shadowWidth + copyrightsMargin * 2,
- newHeight);
-
QPoint copyrightsPos(copyrightsMargin, height() - (copyrightsSlab.height() + copyrightsMargin));
lastCopyrightsPos = copyrightsPos;
emit copyrightsChanged(copyrightsSlab, copyrightsPos);
diff --git a/src/plugins/position/android/src/jnipositioning.cpp b/src/plugins/position/android/src/jnipositioning.cpp
index 6b49b9fe..afae1c8e 100644
--- a/src/plugins/position/android/src/jnipositioning.cpp
+++ b/src/plugins/position/android/src/jnipositioning.cpp
@@ -167,7 +167,9 @@ namespace AndroidPositioning {
__android_log_print(ANDROID_LOG_INFO, logTag, "Unknown positioningMethod");
}
}
+
env.jniEnv->ReleaseIntArrayElements(jProviders, providers, 0);
+ env.jniEnv->DeleteLocalRef(jProviders);
return ret;
}
@@ -261,6 +263,7 @@ namespace AndroidPositioning {
info.setAttribute(QGeoPositionInfo::Direction, bearing);
}
+ jniEnv->DeleteLocalRef(thisClass);
return info;
}
@@ -340,7 +343,10 @@ namespace AndroidPositioning {
if (location == 0)
return QGeoPositionInfo();
- return positionInfoFromJavaLocation(env.jniEnv, location);
+ const QGeoPositionInfo info = positionInfoFromJavaLocation(env.jniEnv, location);
+ env.jniEnv->DeleteLocalRef(location);
+
+ return info;
}
inline int positioningMethodToInt(QGeoPositionInfoSource::PositioningMethods m)
diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro
index 207b949b..0e2f9a5d 100644
--- a/src/plugins/position/position.pro
+++ b/src/plugins/position/position.pro
@@ -2,10 +2,10 @@ TEMPLATE = subdirs
config_geoclue:SUBDIRS += geoclue
config_gypsy:SUBDIRS += gypsy
-simulator:SUBDIRS += simulator
+qtHaveModule(simulator):SUBDIRS += simulator
blackberry:SUBDIRS += blackberry
ios:SUBDIRS += corelocation
-android:SUBDIRS += android
+android:!android-no-sdk:SUBDIRS += android
SUBDIRS += \
positionpoll
diff --git a/src/plugins/position/simulator/qlocationconnection_simulator.cpp b/src/plugins/position/simulator/qlocationconnection_simulator.cpp
index b78eb1cf..02ccad7a 100644
--- a/src/plugins/position/simulator/qlocationconnection_simulator.cpp
+++ b/src/plugins/position/simulator/qlocationconnection_simulator.cpp
@@ -73,11 +73,6 @@ namespace Simulator
// register for location notifications
mWorker->call("setRequestsLocationInfo");
-
- // wait until initial data is received
- QEventLoop loop;
- connect(this, SIGNAL(initialDataReceived()), &loop, SLOT(quit()));
- loop.exec();
}
LocationConnection::~LocationConnection()
diff --git a/src/positioning/doc/src/qtpositioning.qdoc b/src/positioning/doc/src/qtpositioning.qdoc
index 091b8c77..88235212 100644
--- a/src/positioning/doc/src/qtpositioning.qdoc
+++ b/src/positioning/doc/src/qtpositioning.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -25,9 +25,6 @@
**
****************************************************************************/
-
-
-
/*!
\module QtPositioning
\title Qt Positioning C++ Classes
@@ -64,6 +61,10 @@
The Qt Positioning API provides positioning information via QML and C++ interfaces.
+Currently the API is supported on \l{Qt for Android}{Android},
+\l{Qt for BlackBerry}{BlackBerry 10}, \l{Qt for iOS}{iOS} and
+\l{Qt for Linux/X11}{Linux} (using \l{http://www.freedesktop.org/wiki/Software/GeoClue}{GeoClue}).
+
\section1 Overview
The Qt Positioning API gives developers the ability to determine a position by