diff options
author | Alex Wilson <alex.wilson@nokia.com> | 2012-05-14 18:37:19 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-15 07:39:12 +0200 |
commit | 285a52a7a02cdf18b95df56cd579c7910ec84949 (patch) | |
tree | 6cbf8eaf497f033a959b290e4378d10a6d7de591 /src/imports | |
parent | 42ca2853c8c91a29899d5cb24c2e854f6c366a55 (diff) | |
download | qtlocation-285a52a7a02cdf18b95df56cd579c7910ec84949.tar.gz |
Coding style fixes: whitespace crusades
* Single spaces after keywords and before a bracket/brace
* Binary operator spacing
* Curlies at open of class/function body
* Spacing around some type specifiers/declarations
Change-Id: Ie516283e7a39c7ce83071ea8125774c76db611f5
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/imports')
38 files changed, 183 insertions, 202 deletions
diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp index 3eaaa6e8..a969e622 100644 --- a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp @@ -176,7 +176,7 @@ void QDeclarativeCategory::setCategory(const QPlaceCategory &category) if (m_icon && m_icon->parent() == this) { m_icon->setPlugin(m_plugin); m_icon->setIcon(m_category.icon()); - } else if (!m_icon || m_icon->parent() != this){ + } else if (!m_icon || m_icon->parent() != this) { m_icon = new QDeclarativePlaceIcon(m_category.icon(), m_plugin, this); emit iconChanged(); } diff --git a/src/imports/location/declarativeplaces/qdeclarativecontactdetail.cpp b/src/imports/location/declarativeplaces/qdeclarativecontactdetail.cpp index 196e6d83..b68b22f7 100644 --- a/src/imports/location/declarativeplaces/qdeclarativecontactdetail.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativecontactdetail.cpp @@ -177,7 +177,7 @@ QString QDeclarativeContactDetail::label() const void QDeclarativeContactDetail::setLabel(const QString &label) { - if (m_contactDetail.label()!= label) { + if (m_contactDetail.label() != label) { m_contactDetail.setLabel(label); emit labelChanged(); } @@ -196,7 +196,7 @@ QString QDeclarativeContactDetail::value() const void QDeclarativeContactDetail::setValue(const QString &value) { - if (m_contactDetail.value()!= value) { + if (m_contactDetail.value() != value) { m_contactDetail.setValue(value); emit valueChanged(); } diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp index 391ce9c1..5a69c47f 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp @@ -918,7 +918,7 @@ QQmlListProperty<QDeclarativeCategory> QDeclarativePlace::categories() void QDeclarativePlace::category_append(QQmlListProperty<QDeclarativeCategory> *prop, QDeclarativeCategory *value) { - QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object); + QDeclarativePlace *object = static_cast<QDeclarativePlace*>(prop->object); if (object->m_categoriesToBeDeleted.contains(value)) object->m_categoriesToBeDeleted.removeAll(value); @@ -947,7 +947,7 @@ int QDeclarativePlace::category_count(QQmlListProperty<QDeclarativeCategory> *pr QDeclarativeCategory* QDeclarativePlace::category_at(QQmlListProperty<QDeclarativeCategory> *prop, int index) { - QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object); + QDeclarativePlace *object = static_cast<QDeclarativePlace*>(prop->object); QDeclarativeCategory *res = NULL; if (object->m_categories.count() > index && index > -1) { res = object->m_categories[index]; @@ -960,7 +960,7 @@ QDeclarativeCategory* QDeclarativePlace::category_at(QQmlListProperty<QDeclarati */ void QDeclarativePlace::category_clear(QQmlListProperty<QDeclarativeCategory> *prop) { - QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object); + QDeclarativePlace *object = static_cast<QDeclarativePlace*>(prop->object); if (object->m_categories.isEmpty()) return; @@ -983,7 +983,7 @@ void QDeclarativePlace::synchronizeCategories() qDeleteAll(m_categories); m_categories.clear(); foreach (const QPlaceCategory &value, m_src.categories()) { - QDeclarativeCategory* declarativeValue = new QDeclarativeCategory(value, m_plugin, this); + QDeclarativeCategory *declarativeValue = new QDeclarativeCategory(value, m_plugin, this); m_categories.append(declarativeValue); } } diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp b/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp index f0031b02..bfa392d4 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp @@ -169,7 +169,7 @@ QPlaceAttribute QDeclarativePlaceAttribute::attribute() const */ void QDeclarativePlaceAttribute::setLabel(const QString &label) { - if (m_attribute.label()!= label) { + if (m_attribute.label() != label) { m_attribute.setLabel(label); emit labelChanged(); } diff --git a/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp index 2a446049..0a3b5f65 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp @@ -401,7 +401,7 @@ void QDeclarativePlaceContentModel::fetchFinished() if (startIndex == -1) startIndex = currentIndex; - if (!changedIndexesIter.hasNext() || (changedIndexesIter.hasNext() && changedIndexesIter.peekNext() > (currentIndex +1))) { + if (!changedIndexesIter.hasNext() || (changedIndexesIter.hasNext() && changedIndexesIter.peekNext() > (currentIndex + 1))) { for (int i = startIndex; i <= currentIndex; ++i) { const QPlaceContent &content = contents.value(i); m_content.insert(i, content); diff --git a/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp b/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp index 9d46df45..31069289 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeresultmodelbase.cpp @@ -207,7 +207,7 @@ void QDeclarativeResultModelBase::queryFinished() m_reply = favoritesManager->matchingPlaces(request); connect(m_reply, SIGNAL(finished()), this, SLOT(queryFinished())); } - } else if (reply->type() == QPlaceReply::MatchReply){ + } else if (reply->type() == QPlaceReply::MatchReply) { QPlaceMatchReply *matchReply = qobject_cast<QPlaceMatchReply *>(reply); Q_ASSERT(matchReply); updateLayout(matchReply->places()); @@ -233,7 +233,7 @@ void QDeclarativeResultModelBase::updateLayout(const QList<QPlace> &favoritePlac m_results = m_resultsBuffer; m_resultsBuffer.clear(); - for (int i=0 ;i < m_results.count(); ++i) { + for (int i = 0; i < m_results.count(); ++i) { QDeclarativePlace *place = new QDeclarativePlace(m_results.at(i).place(),plugin(), this); m_places.append(place); diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp index f19579b9..6e38a7fc 100644 --- a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel.cpp @@ -375,7 +375,7 @@ QQmlListProperty<QDeclarativeCategory> QDeclarativeSearchResultModel::categories void QDeclarativeSearchResultModel::categories_append(QQmlListProperty<QDeclarativeCategory> *list, QDeclarativeCategory *declCategory) { - QDeclarativeSearchResultModel* searchModel = qobject_cast<QDeclarativeSearchResultModel*>(list->object); + QDeclarativeSearchResultModel *searchModel = qobject_cast<QDeclarativeSearchResultModel*>(list->object); if (searchModel && declCategory) { searchModel->m_categories.append(declCategory); QList<QPlaceCategory> categories = searchModel->m_request.categories(); diff --git a/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp index dee28028..ba86f3e2 100644 --- a/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp @@ -646,7 +646,7 @@ QModelIndex QDeclarativeSupportedCategoriesModel::index(const QString &categoryI int QDeclarativeSupportedCategoriesModel::rowToAddChild(PlaceCategoryNode *node, const QPlaceCategory &category) { Q_ASSERT(node); - for (int i=0 ; i < node->childIds.count(); ++i) { + for (int i = 0; i < node->childIds.count(); ++i) { if (category.name() < m_categoriesTree.value(node->childIds.at(i))->declCategory->name()) return i; } diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index 015ec3dc..53fc3924 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -99,7 +99,8 @@ class QLocationDeclarativeModule: public QQmlExtensionPlugin FILE "plugin.json") public: - virtual void registerTypes(const char* uri) { + virtual void registerTypes(const char* uri) + { if (QLatin1String(uri) == QLatin1String("QtMobility.location")) { qWarning("QtMobility.location is not supported. Use QtLocation instead."); } else if (QLatin1String(uri) == QLatin1String("Qt.location")) { diff --git a/src/imports/location/mapnode_p.h b/src/imports/location/mapnode_p.h index bf89d79c..e0b5de94 100644 --- a/src/imports/location/mapnode_p.h +++ b/src/imports/location/mapnode_p.h @@ -71,9 +71,7 @@ public: ~MapNode(); void setSize(const QSize &size); - QSize size() const { - return m_size; - } + QSize size() const { return m_size; } void update(); void preprocess(); diff --git a/src/imports/location/qdeclarativecoordinate.cpp b/src/imports/location/qdeclarativecoordinate.cpp index deec3693..5ab6f80f 100644 --- a/src/imports/location/qdeclarativecoordinate.cpp +++ b/src/imports/location/qdeclarativecoordinate.cpp @@ -261,7 +261,7 @@ bool QDeclarativeCoordinate::isValid() const qreal QDeclarativeCoordinate::distanceTo(QObject* coordinate) { - QDeclarativeCoordinate* coord = static_cast<QDeclarativeCoordinate*>(coordinate); + QDeclarativeCoordinate *coord = static_cast<QDeclarativeCoordinate*>(coordinate); return m_coordinate.distanceTo(coord->coordinate()); } diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp index 5e908ca5..389de66b 100644 --- a/src/imports/location/qdeclarativegeocodemodel.cpp +++ b/src/imports/location/qdeclarativegeocodemodel.cpp @@ -267,7 +267,7 @@ QVariant QDeclarativeGeocodeModel::data(const QModelIndex &index, int role) cons if (index.row() >= declarativeLocations_.count()) return QVariant(); if (role == QDeclarativeGeocodeModel::LocationRole) { - QObject* locationObject = declarativeLocations_.at(index.row()); + QObject *locationObject = declarativeLocations_.at(index.row()); Q_ASSERT(locationObject); return QVariant::fromValue(locationObject); } @@ -489,7 +489,7 @@ void QDeclarativeGeocodeModel::setLocations(const QList<QGeoLocation> &locations qDeleteAll(declarativeLocations_); declarativeLocations_.clear(); for (int i = 0; i < locations.count(); ++i) { - QDeclarativeGeoLocation* location = new QDeclarativeGeoLocation(locations.at(i), this); + QDeclarativeGeoLocation *location = new QDeclarativeGeoLocation(locations.at(i), this); declarativeLocations_.append(location); } endResetModel(); @@ -640,7 +640,7 @@ void QDeclarativeGeocodeModel::setQuery(const QVariant& query) { if (query == queryVariant_) return; - QObject* object = qvariant_cast<QObject*>(query); + QObject *object = qvariant_cast<QObject*>(query); if (qobject_cast<QDeclarativeCoordinate*>(object)) { if (coordinate_) coordinate_->disconnect(this); diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h index acbde061..838e236d 100644 --- a/src/imports/location/qdeclarativegeocodemodel_p.h +++ b/src/imports/location/qdeclarativegeocodemodel_p.h @@ -172,9 +172,9 @@ private: void setLocations(const QList<QGeoLocation> &locations); QGeoBoundingArea boundingArea(); void abortRequest(); - QGeocodeReply* reply_; + QGeocodeReply *reply_; - QDeclarativeGeoServiceProvider* plugin_; + QDeclarativeGeoServiceProvider *plugin_; QPointer<QObject> boundingArea_; QGeoBoundingBox boundingBox_; QGeoBoundingCircle boundingCircle_; @@ -185,8 +185,8 @@ private: QString errorString_; GeocodeError error_; QVariant queryVariant_; - QDeclarativeCoordinate* coordinate_; - QDeclarativeGeoAddress* address_; + QDeclarativeCoordinate *coordinate_; + QDeclarativeGeoAddress *address_; QString searchString_; int limit_; diff --git a/src/imports/location/qdeclarativegeolocation.cpp b/src/imports/location/qdeclarativegeolocation.cpp index c2f0db5e..96c4ef63 100644 --- a/src/imports/location/qdeclarativegeolocation.cpp +++ b/src/imports/location/qdeclarativegeolocation.cpp @@ -121,14 +121,14 @@ void QDeclarativeGeoLocation::setLocation(const QGeoLocation &src) if (m_coordinate && m_coordinate->parent() == this) { m_coordinate->setCoordinate(src.coordinate()); - } else if (!m_coordinate || m_coordinate->parent() != this){ + } else if (!m_coordinate || m_coordinate->parent() != this) { m_coordinate = new QDeclarativeCoordinate(src.coordinate(), this); emit coordinateChanged(); } if (m_boundingBox && m_boundingBox->parent() == this) { m_boundingBox->setBox(src.boundingBox()); - } else if (!m_boundingBox || m_boundingBox->parent() != this){ + } else if (!m_boundingBox || m_boundingBox->parent() != this) { m_boundingBox = new QDeclarativeGeoBoundingBox(src.boundingBox(), this); emit boundingBoxChanged(); } diff --git a/src/imports/location/qdeclarativegeomaneuver_p.h b/src/imports/location/qdeclarativegeomaneuver_p.h index fe952d2a..fee2773c 100644 --- a/src/imports/location/qdeclarativegeomaneuver_p.h +++ b/src/imports/location/qdeclarativegeomaneuver_p.h @@ -96,8 +96,8 @@ public: private: QGeoManeuver maneuver_; - QDeclarativeCoordinate* position_; - QDeclarativeCoordinate* waypoint_; + QDeclarativeCoordinate *position_; + QDeclarativeCoordinate *waypoint_; }; QT_END_NAMESPACE diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index 0c5679ad..47d45345 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -243,7 +243,7 @@ void QDeclarativeGeoMap::onMapChildrenChanged() if (copyrights) { foundCopyrights = true; } else { - QDeclarativeGeoMapItemBase* mapItem = qobject_cast<QDeclarativeGeoMapItemBase*>(kids.at(i)); + QDeclarativeGeoMapItemBase *mapItem = qobject_cast<QDeclarativeGeoMapItemBase*>(kids.at(i)); if (mapItem) { if (mapItem->z() > maxChildZ) maxChildZ = mapItem->z(); @@ -278,10 +278,10 @@ void QDeclarativeGeoMap::onMapChildrenChanged() */ void QDeclarativeGeoMap::pluginReady() { - serviceProvider_ = plugin_->sharedGeoServiceProvider(); + serviceProvider_ = plugin_->sharedGeoServiceProvider(); mappingManager_ = serviceProvider_->mappingManager(); - if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { + if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { qmlInfo(this) << tr("Warning: Plugin does not support mapping. Error message: %1") .arg(serviceProvider_->errorString()); return; @@ -413,13 +413,13 @@ void QDeclarativeGeoMap::populateMap() QObjectList kids = children(); for (int i = 0; i < kids.size(); ++i) { // dispatch items appropriately - QDeclarativeGeoMapItemView* mapView = qobject_cast<QDeclarativeGeoMapItemView*>(kids.at(i)); + QDeclarativeGeoMapItemView *mapView = qobject_cast<QDeclarativeGeoMapItemView*>(kids.at(i)); if (mapView) { mapViews_.append(mapView); setupMapView(mapView); continue; } - QDeclarativeGeoMapItemBase* mapItem = qobject_cast<QDeclarativeGeoMapItemBase*>(kids.at(i)); + QDeclarativeGeoMapItemBase *mapItem = qobject_cast<QDeclarativeGeoMapItemBase*>(kids.at(i)); if (mapItem) { addMapItem(mapItem); } @@ -837,7 +837,7 @@ void QDeclarativeGeoMap::mapBearingChanged(qreal bearing) void QDeclarativeGeoMap::mapCenterChanged(AnimatableCoordinate center) { if (center.coordinate() != this->center()->coordinate()) { - QDeclarativeCoordinate* currentCenter = this->center(); + QDeclarativeCoordinate *currentCenter = this->center(); currentCenter->setLatitude(center.coordinate().latitude()); currentCenter->setLongitude(center.coordinate().longitude()); currentCenter->setAltitude(center.coordinate().altitude()); @@ -1148,9 +1148,9 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine) if (mapItems_.size() == 0) return; - qreal minX = 0; + qreal minX = 0; qreal maxX = 0; - qreal minY = 0; + qreal minY = 0; qreal maxY = 0; qreal topLeftX = 0; qreal topLeftY = 0; @@ -1216,9 +1216,9 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine) double mapWidthRatio = width() / (width() + height()); double zoomRatio; if (bboxWidthRatio > mapWidthRatio) - zoomRatio = bboxWidth / width(); + zoomRatio = bboxWidth / width(); else - zoomRatio = bboxHeight / height(); + zoomRatio = bboxHeight / height(); qreal newZoom = log10(zoomRatio) / log10(0.5); newZoom = floor(qMax(minimumZoomLevel(), (map_->mapController()->zoom() + newZoom))); diff --git a/src/imports/location/qdeclarativegeomap_p.h b/src/imports/location/qdeclarativegeomap_p.h index d7254302..416f341c 100644 --- a/src/imports/location/qdeclarativegeomap_p.h +++ b/src/imports/location/qdeclarativegeomap_p.h @@ -215,30 +215,30 @@ private: void populateMap(); void fitViewportToMapItemsRefine(bool refine); - QDeclarativeGeoServiceProvider* plugin_; - QGeoServiceProvider* serviceProvider_; - QGeoMappingManager* mappingManager_; + QDeclarativeGeoServiceProvider *plugin_; + QGeoServiceProvider *serviceProvider_; + QGeoMappingManager *mappingManager_; qreal zoomLevel_; qreal bearing_; qreal tilt_; QPointer<QDeclarativeCoordinate> center_; - QDeclarativeGeoMapType* activeMapType_; + QDeclarativeGeoMapType *activeMapType_; QList<QDeclarativeGeoMapType*> supportedMapTypes_; bool componentCompleted_; bool mappingManagerInitialized_; QList<QDeclarativeGeoMapItemView*> mapViews_; - QDeclarativeGeoMapGestureArea* gestureArea_; - QDeclarativeGeoMapFlickable* flickable_; - QDeclarativeGeoMapPinchArea* pinchArea_; + QDeclarativeGeoMapGestureArea *gestureArea_; + QDeclarativeGeoMapFlickable *flickable_; + QDeclarativeGeoMapPinchArea *pinchArea_; void paintGL(QGLPainter *painter); void earlyDraw(QGLPainter *painter); void restoreDefaults(QGLPainter *painter); - QQuickCanvas* canvas_; + QQuickCanvas *canvas_; int touchTimer_; QGeoTileCache *tileCache_; diff --git a/src/imports/location/qdeclarativegeomapgesturearea.cpp b/src/imports/location/qdeclarativegeomapgesturearea.cpp index c2e467c9..de9ffd74 100644 --- a/src/imports/location/qdeclarativegeomapgesturearea.cpp +++ b/src/imports/location/qdeclarativegeomapgesturearea.cpp @@ -831,8 +831,8 @@ void QDeclarativeGeoMapGestureArea::updateVelocityList(const QPointF &pos) int dxFromLastPos = pos.x() - lastPos_.x(); lastPos_ = pos; lastPosTime_.restart(); - qreal velX = qreal(dxFromLastPos)/elapsed; - qreal velY = qreal(dyFromLastPos)/elapsed; + qreal velX = qreal(dxFromLastPos) / elapsed; + qreal velY = qreal(dyFromLastPos) / elapsed; velocityX_ = qBound<qreal>(-pan_.maxVelocity_, velX, pan_.maxVelocity_); velocityY_ = qBound<qreal>(-pan_.maxVelocity_, velY, pan_.maxVelocity_); } @@ -865,58 +865,47 @@ void QDeclarativeGeoMapGestureArea::update() void QDeclarativeGeoMapGestureArea::touchPointStateMachine() { // Transitions: - switch (touchPointState_) - { - case touchPoints0:{ - if (touchPoints_.count()==1){ + switch (touchPointState_) { + case touchPoints0: + if (touchPoints_.count() == 1) { clearTouchData(); startOneTouchPoint(); touchPointState_ = touchPoints1; - } - else if (touchPoints_.count()==2){ + } else if (touchPoints_.count() == 2) { clearTouchData(); startTwoTouchPoints(); touchPointState_ = touchPoints2; } break; - } - case touchPoints1:{ - if (touchPoints_.count()==0){ + case touchPoints1: + if (touchPoints_.count() == 0) { touchPointState_ = touchPoints0; - } - else if (touchPoints_.count()==2){ + } else if (touchPoints_.count() == 2) { startTwoTouchPoints(); touchPointState_ = touchPoints2; } break; - } - case touchPoints2:{ - if (touchPoints_.count()==0){ + case touchPoints2: + if (touchPoints_.count() == 0) { touchPointState_ = touchPoints0; - } - else if (touchPoints_.count()==1){ + } else if (touchPoints_.count() == 1) { startOneTouchPoint(); touchPointState_ = touchPoints1; } break; - } }; // Update - switch (touchPointState_) - { - case touchPoints0:{ + switch (touchPointState_) { + case touchPoints0: break; // do nothing if no touch points down - } - case touchPoints1:{ + case touchPoints1: updateOneTouchPoint(); break; - } - case touchPoints2:{ + case touchPoints2: updateTwoTouchPoints(); break; } - } } /*! @@ -961,7 +950,7 @@ void QDeclarativeGeoMapGestureArea::startTwoTouchPoints() QPointF startPos = (sceneStartPoint1_ + sceneStartPoint2_) * 0.5; lastPos_ = startPos; lastPosTime_.start(); - QGeoCoordinate startCoord = map_->screenPositionToCoordinate(startPos, false); + QGeoCoordinate startCoord = map_->screenPositionToCoordinate(startPos, false); startCoord_.setLongitude(startCoord_.longitude() + startCoord.longitude() - touchCenterCoord_.longitude()); startCoord_.setLatitude(startCoord_.latitude() + startCoord.latitude() - @@ -977,8 +966,8 @@ void QDeclarativeGeoMapGestureArea::updateTwoTouchPoints() QPointF p2 = touchPoints_.at(1).scenePos(); qreal dx = p1.x() - p2.x(); qreal dy = p1.y() - p2.y(); - distanceBetweenTouchPoints_ = sqrt(dx*dx + dy*dy); - sceneCenter_ = (p1 + p2)/2; + distanceBetweenTouchPoints_ = sqrt(dx * dx + dy * dy); + sceneCenter_ = (p1 + p2) / 2; touchCenterCoord_ = map_->screenPositionToCoordinate(sceneCenter_, false); updateVelocityList(sceneCenter_); @@ -993,7 +982,7 @@ void QDeclarativeGeoMapGestureArea::updateTwoTouchPoints() */ void QDeclarativeGeoMapGestureArea::setPinchActive(bool active) { - if ((active && pinchState_==pinchActive) || (!active && pinchState_!=pinchActive)) + if ((active && pinchState_ == pinchActive) || (!active && pinchState_ != pinchActive)) return; pinchState_ = active ? pinchActive : pinchInactive; emit pinchDep_->activeChanged(); @@ -1008,38 +997,32 @@ void QDeclarativeGeoMapGestureArea::pinchStateMachine() { PinchState lastState = pinchState_; // Transitions: - switch (pinchState_) - { - case pinchInactive:{ - if (canStartPinch()){ + switch (pinchState_) { + case pinchInactive: + if (canStartPinch()) { startPinch(); setPinchActive(true); } break; - } - case pinchActive:{ - if (touchPoints_.count() <= 1){ + case pinchActive: + if (touchPoints_.count() <= 1) { endPinch(); setPinchActive(false); } break; } - } // This line implements an exclusive state machine, where the transitions and updates don't // happen on the same frame if (pinchState_ != lastState) return; // Update - switch (pinchState_) - { - case pinchInactive:{ + switch (pinchState_) { + case pinchInactive: break; // do nothing - } - case pinchActive:{ + case pinchActive: updatePinch(); break; } - } } /*! @@ -1049,13 +1032,13 @@ bool QDeclarativeGeoMapGestureArea::canStartPinch() { const int startDragDistance = qApp->styleHints()->startDragDistance(); - if (touchPoints_.count() >= 2){ + if (touchPoints_.count() >= 2) { QPointF p1 = touchPoints_.at(0).scenePos(); QPointF p2 = touchPoints_.at(1).scenePos(); - if (qAbs(p1.x()-sceneStartPoint1_.x()) > startDragDistance - || qAbs(p1.y()-sceneStartPoint1_.y()) > startDragDistance - || qAbs(p2.x()-sceneStartPoint2_.x()) > startDragDistance - || qAbs(p2.y()-sceneStartPoint2_.y()) > startDragDistance) { + if (qAbs(p1.x() - sceneStartPoint1_.x()) > startDragDistance + || qAbs(p1.y() - sceneStartPoint1_.y()) > startDragDistance + || qAbs(p2.x() - sceneStartPoint2_.x()) > startDragDistance + || qAbs(p2.y() - sceneStartPoint2_.y()) > startDragDistance) { pinchEvent_.setCenter(declarativeMap_->mapFromScene(sceneCenter_)); pinchEvent_.setAngle(twoTouchAngle_); pinchEvent_.setPoint1(p1); @@ -1099,7 +1082,7 @@ void QDeclarativeGeoMapGestureArea::updatePinch() if (distanceBetweenTouchPoints_) { newZoomLevel = // How much further/closer the current touchpoints are (in pixels) compared to pinch start - ((distanceBetweenTouchPoints_ - pinchStartDist_) * + ((distanceBetweenTouchPoints_ - pinchStartDist_) * // How much one pixel corresponds in units of zoomlevel (and multiply by above delta) (maximumZoomLevelChange_ / ((declarativeMap_->width() + declarativeMap_->height()) / 2))) + // Add to starting zoom level. Sign of (dist-pinchstartdist) takes care of zoom in / out @@ -1138,7 +1121,7 @@ void QDeclarativeGeoMapGestureArea::updatePinch() if (distanceBetweenTouchPoints_) { newTilt = // How much further/closer the current touchpoints are (in pixels) compared to pinch start - ((distanceBetweenTouchPoints_ - pinchStartDist_) * + ((distanceBetweenTouchPoints_ - pinchStartDist_) * // How much one pixel corresponds in units of tilt degrees (and multiply by above delta) (maximumTiltChange_ / ((declarativeMap_->width() + declarativeMap_->height()) / 2))) + // Add to starting tilt. @@ -1152,7 +1135,7 @@ void QDeclarativeGeoMapGestureArea::updatePinch() } if (activeGestures_ & RotationGesture) { bool unlimitedRotation = (minimumRotation_ == 0.0 && maximumRotation_ == 0.0); - if ((pinchStartRotation_ >= minimumRotation_ && pinchStartRotation_ <= maximumRotation_) || unlimitedRotation) { + if ((pinchStartRotation_ >= minimumRotation_ && pinchStartRotation_ <= maximumRotation_) || unlimitedRotation) { qreal r = pinchRotation_ * rotationFactor_ + pinchStartRotation_; if (!unlimitedRotation) r = qMin(qMax(minimumRotation_,r), maximumRotation_); @@ -1190,55 +1173,47 @@ void QDeclarativeGeoMapGestureArea::panStateMachine() PanState lastState = panState_; // Transitions - switch (panState_) - { - case panInactive:{ + switch (panState_) { + case panInactive: if (canStartPan()) panState_ = panActive; break; - } - case panActive:{ - if (touchPoints_.count()==0){ + case panActive: + if (touchPoints_.count() == 0) { panState_ = panFlick; if (!tryStartFlick()) panState_ = panInactive; } break; - } - case panFlick:{ - if (touchPoints_.count()>0){ // re touched before movement ended + case panFlick: + if (touchPoints_.count() > 0) { // re touched before movement ended endFlick(); panState_ = panActive; } break; } - } // Update - switch (panState_) - { - case panInactive:{ // do nothing + switch (panState_) { + case panInactive: // do nothing break; - } - case panActive:{ + case panActive: updatePan(); // this ensures 'panStarted' occurs after the pan has actually started - if (lastState != panActive){ + if (lastState != panActive) { emit panStarted(); emit flickableDep_->movementStarted(); } break; - } - case panFlick:{ + case panFlick: break; } - } } /*! \internal */ bool QDeclarativeGeoMapGestureArea::canStartPan() { - if (touchPoints_.count() == 0 || (activeGestures_ & PanGesture)==0) + if (touchPoints_.count() == 0 || (activeGestures_ & PanGesture) == 0) return false; // Check if thresholds for normal panning are met. @@ -1270,7 +1245,7 @@ void QDeclarativeGeoMapGestureArea::updatePan() */ bool QDeclarativeGeoMapGestureArea::tryStartFlick() { - if ((activeGestures_ & FlickGesture)==0) + if ((activeGestures_ & FlickGesture) == 0) return false; // if we drag then pause before release we should not cause a flick. qreal velocityX = 0.0; @@ -1300,7 +1275,7 @@ bool QDeclarativeGeoMapGestureArea::tryStartFlick() flickPixelsX = (flickTimeX * velocityX) / (1000.0 * 2); } int flickTime = qMax(flickTimeY, flickTimeX); - if (flickTime > 0){ + if (flickTime > 0) { startFlick(flickPixelsX, flickPixelsY, flickTime); return true; } @@ -1337,9 +1312,9 @@ void QDeclarativeGeoMapGestureArea::stopPan() { velocityX_ = 0; velocityY_ = 0; - if (panState_ == panFlick) + if (panState_ == panFlick) { endFlick(); - else if (panState_ == panActive){ + } else if (panState_ == panActive) { emit panFinished(); flickableDep_->movementEnded(); } diff --git a/src/imports/location/qdeclarativegeomapgesturearea_p.h b/src/imports/location/qdeclarativegeomapgesturearea_p.h index 2d1b6c4d..2aeb8fdd 100644 --- a/src/imports/location/qdeclarativegeomapgesturearea_p.h +++ b/src/imports/location/qdeclarativegeomapgesturearea_p.h @@ -204,10 +204,15 @@ public: void setMap(QGeoMap* map); // will be removed - void registerFlickDeprecated(QDeclarativeGeoMapFlickable *flickable){ - flickableDep_ = flickable; } - void registerPinchDeprecated(QDeclarativeGeoMapPinchArea *pinchArea){ - pinchDep_ = pinchArea; } + void registerFlickDeprecated(QDeclarativeGeoMapFlickable *flickable) + { + flickableDep_ = flickable; + } + + void registerPinchDeprecated(QDeclarativeGeoMapPinchArea *pinchArea) + { + pinchDep_ = pinchArea; + } Q_SIGNALS: void pinchActiveChanged(); diff --git a/src/imports/location/qdeclarativegeomapitembase.cpp b/src/imports/location/qdeclarativegeomapitembase.cpp index 5111acf2..df042cee 100644 --- a/src/imports/location/qdeclarativegeomapitembase.cpp +++ b/src/imports/location/qdeclarativegeomapitembase.cpp @@ -144,7 +144,8 @@ void QDeclarativeGeoMapItemBase::dragEnded() /*! \internal */ -void QDeclarativeGeoMapItemBase::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) { +void QDeclarativeGeoMapItemBase::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) +{ if (quickMap == quickMap_) return; if (quickMap && quickMap_) diff --git a/src/imports/location/qdeclarativegeomapitembase_p.h b/src/imports/location/qdeclarativegeomapitembase_p.h index 4a71669c..c65dfcef 100644 --- a/src/imports/location/qdeclarativegeomapitembase_p.h +++ b/src/imports/location/qdeclarativegeomapitembase_p.h @@ -81,7 +81,7 @@ public: virtual void dragEnded(); QDeclarativeGeoMap* quickMap() {return quickMap_;} - QGeoMap* map() {return map_;} + QGeoMap* map() { return map_; } QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); virtual QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *); @@ -98,8 +98,8 @@ private Q_SLOTS: void baseCameraDataChanged(const QGeoCameraData &camera); private: - QGeoMap* map_; - QDeclarativeGeoMap* quickMap_; + QGeoMap *map_; + QDeclarativeGeoMap *quickMap_; QSizeF lastSize_; QGeoCameraData lastCameraData_; diff --git a/src/imports/location/qdeclarativegeomapitemview.cpp b/src/imports/location/qdeclarativegeomapitemview.cpp index 607f03c1..54088f46 100644 --- a/src/imports/location/qdeclarativegeomapitemview.cpp +++ b/src/imports/location/qdeclarativegeomapitemview.cpp @@ -112,8 +112,8 @@ void QDeclarativeGeoMapItemView::setModel(const QVariant &model) if (!model.isValid() || model == modelVariant_) return; QObject *object = qvariant_cast<QObject*>(model); - QAbstractItemModel* itemModel; - QListModelInterface* listModel; + QAbstractItemModel *itemModel; + QListModelInterface *listModel; if (object) { itemModel = qobject_cast<QAbstractItemModel*>(object); listModel = qobject_cast<QListModelInterface*>(object); @@ -165,7 +165,7 @@ void QDeclarativeGeoMapItemView::itemModelRowsInserted(QModelIndex, int start, i if (!componentCompleted_ || !map_ || !delegate_ || !itemModel_) return; - QDeclarativeGeoMapItemBase* mapItem; + QDeclarativeGeoMapItemBase *mapItem; for (int i = start; i <= end; ++i) { mapItem = createItem(i); if (!mapItem) { @@ -199,7 +199,7 @@ void QDeclarativeGeoMapItemView::listModelItemsChanged(int index, int count, con if (!componentCompleted_ || !map_ || !delegate_ || !listModel_) return; - for (int i = index; i < index+count; ++i) { + for (int i = index; i < index + count; ++i) { QDeclarativeGeoMapItemBase *mapItem = mapItemList_.takeAt(i); Q_ASSERT(mapItem); if (!mapItem) // bad @@ -220,8 +220,8 @@ void QDeclarativeGeoMapItemView::listModelItemsInserted(int index, int count) if (!componentCompleted_ || !map_ || !delegate_ || !listModel_) return; - QDeclarativeGeoMapItemBase* mapItem; - for (int i = index; i < index+count; ++i) { + QDeclarativeGeoMapItemBase *mapItem; + for (int i = index; i < index + count; ++i) { mapItem = createItem(i); if (!mapItem) continue; @@ -320,7 +320,7 @@ void QDeclarativeGeoMapItemView::repopulate() // Iterate model data and instantiate delegates. if (itemModel_) { - QDeclarativeGeoMapItemBase* mapItem; + QDeclarativeGeoMapItemBase *mapItem; for (int i = 0; i < itemModel_->rowCount(); ++i) { mapItem = createItem(i); Q_ASSERT(mapItem); @@ -373,14 +373,14 @@ QDeclarativeGeoMapItemBase *QDeclarativeGeoMapItemView::createItemFromListModel( } itemContext->setContextProperty(QLatin1String("model"), model); - QObject* obj = delegate_->create(itemContext); + QObject *obj = delegate_->create(itemContext); if (!obj) { qWarning() << "QDeclarativeGeoMapItemView map item creation failed."; delete itemContext; return 0; } - QDeclarativeGeoMapItemBase *declMapObj = qobject_cast<QDeclarativeGeoMapItemBase*>(obj); + QDeclarativeGeoMapItemBase *declMapObj = qobject_cast<QDeclarativeGeoMapItemBase*>(obj); if (!declMapObj) { qWarning() << "QDeclarativeGeoMapItemView map item delegate is of unsupported type."; delete itemContext; @@ -423,14 +423,14 @@ QDeclarativeGeoMapItemBase* QDeclarativeGeoMapItemView::createItemFromItemModel( } itemContext->setContextProperty(QLatin1String("model"), model); - QObject* obj = delegate_->create(itemContext); + QObject *obj = delegate_->create(itemContext); if (!obj) { qWarning() << "QDeclarativeGeoMapItemView map item creation failed."; delete itemContext; return 0; } - QDeclarativeGeoMapItemBase *declMapObj = qobject_cast<QDeclarativeGeoMapItemBase*>(obj); + QDeclarativeGeoMapItemBase *declMapObj = qobject_cast<QDeclarativeGeoMapItemBase*>(obj); if (!declMapObj) { qWarning() << "QDeclarativeGeoMapItemView map item delegate is of unsupported type."; delete itemContext; diff --git a/src/imports/location/qdeclarativegeomapitemview_p.h b/src/imports/location/qdeclarativegeomapitemview_p.h index deed4f60..45117c3b 100644 --- a/src/imports/location/qdeclarativegeomapitemview_p.h +++ b/src/imports/location/qdeclarativegeomapitemview_p.h @@ -116,8 +116,8 @@ private: bool componentCompleted_; QQmlComponent *delegate_; QVariant modelVariant_; - QAbstractItemModel* itemModel_; - QListModelInterface* listModel_; + QAbstractItemModel *itemModel_; + QListModelInterface *listModel_; QDeclarativeGeoMap *map_; QList<QDeclarativeGeoMapItemBase*> mapItemList_; }; diff --git a/src/imports/location/qdeclarativegeomapmousearea.cpp b/src/imports/location/qdeclarativegeomapmousearea.cpp index 261d69c2..d38f8dc3 100644 --- a/src/imports/location/qdeclarativegeomapmousearea.cpp +++ b/src/imports/location/qdeclarativegeomapmousearea.cpp @@ -139,10 +139,10 @@ QDeclarativeGeoMapMouseArea::~QDeclarativeGeoMapMouseArea() Converts the \a event's coordinates to geo coordinates. */ -QDeclarativeCoordinate* QDeclarativeGeoMapMouseArea::mouseToCoordinate(QQuickMouseEvent* event) +QDeclarativeCoordinate *QDeclarativeGeoMapMouseArea::mouseToCoordinate(QQuickMouseEvent* event) { // figure out the map association for this mouse area and use it to resolve geocoordinate - QDeclarativeGeoMap* quickmap = map(); + QDeclarativeGeoMap *quickmap = map(); if (quickmap) return quickmap->toCoordinate(quickmap->mapFromItem(this, QPointF(event->x(), event->y()))); return new QDeclarativeCoordinate; // return invalid coordinate @@ -152,14 +152,14 @@ QDeclarativeCoordinate* QDeclarativeGeoMapMouseArea::mouseToCoordinate(QQuickMou \internal */ // TODO: cache the map association and hook up to parent change -signals -QDeclarativeGeoMap* QDeclarativeGeoMapMouseArea::map() +QDeclarativeGeoMap *QDeclarativeGeoMapMouseArea::map() { - QQuickItem* pmi = parentMapItem(); - QDeclarativeGeoMap* map = 0; + QQuickItem *pmi = parentMapItem(); + QDeclarativeGeoMap *map = 0; if (pmi) { map = qobject_cast<QDeclarativeGeoMap*>(pmi); if (!map) { - QDeclarativeGeoMapItemBase* item = qobject_cast<QDeclarativeGeoMapItemBase*>(pmi); + QDeclarativeGeoMapItemBase *item = qobject_cast<QDeclarativeGeoMapItemBase*>(pmi); if (item) map = item->quickMap(); } @@ -192,7 +192,7 @@ void QDeclarativeGeoMapMouseArea::componentComplete() void QDeclarativeGeoMapMouseArea::mousePressEvent(QMouseEvent *event) { // map element's flickable may use the event - QQuickItem* pmi = parentMapItem(); + QQuickItem *pmi = parentMapItem(); if (pmi && qobject_cast<QDeclarativeGeoMap*>(pmi)) qobject_cast<QDeclarativeGeoMap*>(pmi)->mouseEvent(event); @@ -213,7 +213,7 @@ void QDeclarativeGeoMapMouseArea::mousePressEvent(QMouseEvent *event) void QDeclarativeGeoMapMouseArea::mouseReleaseEvent(QMouseEvent *event) { // map element's flickable may use the event - QQuickItem* pmi = parentMapItem(); + QQuickItem *pmi = parentMapItem(); if (pmi && qobject_cast<QDeclarativeGeoMap*>(pmi)) { qobject_cast<QDeclarativeGeoMap*>(pmi)->mouseEvent(event); @@ -241,7 +241,7 @@ void QDeclarativeGeoMapMouseArea::mouseDoubleClickEvent(QMouseEvent *event) void QDeclarativeGeoMapMouseArea::mouseMoveEvent(QMouseEvent *event) { // map element's flickable may use the event - QQuickItem* pmi = parentMapItem(); + QQuickItem *pmi = parentMapItem(); if (pmi && qobject_cast<QDeclarativeGeoMap*>(pmi)) qobject_cast<QDeclarativeGeoMap*>(pmi)->mouseEvent(event); @@ -253,7 +253,7 @@ void QDeclarativeGeoMapMouseArea::mouseMoveEvent(QMouseEvent *event) */ void QDeclarativeGeoMapMouseArea::hoverEnterEvent(QHoverEvent *event) { - QQuickItem* pmi = parentMapItem(); + QQuickItem *pmi = parentMapItem(); bool contains = true; if (pmi && qobject_cast<QDeclarativeGeoMapItemBase*>(pmi)) contains = qobject_cast<QDeclarativeGeoMapItemBase*>(pmi)->contains(event->pos()); @@ -270,7 +270,7 @@ void QDeclarativeGeoMapMouseArea::hoverEnterEvent(QHoverEvent *event) */ void QDeclarativeGeoMapMouseArea::hoverMoveEvent(QHoverEvent *event) { - QQuickItem* pmi = parentMapItem(); + QQuickItem *pmi = parentMapItem(); bool contains = true; if (pmi && qobject_cast<QDeclarativeGeoMapItemBase*>(pmi)) contains = qobject_cast<QDeclarativeGeoMapItemBase*>(pmi)->contains(event->pos()); @@ -293,7 +293,7 @@ void QDeclarativeGeoMapMouseArea::hoverMoveEvent(QHoverEvent *event) */ void QDeclarativeGeoMapMouseArea::hoverLeaveEvent(QHoverEvent *event) { - QQuickItem* pmi = parentMapItem(); + QQuickItem *pmi = parentMapItem(); bool contains = true; if (pmi && qobject_cast<QDeclarativeGeoMapItemBase*>(pmi)) contains = qobject_cast<QDeclarativeGeoMapItemBase*>(pmi)->contains(event->pos()); @@ -312,7 +312,7 @@ void QDeclarativeGeoMapMouseArea::hoverLeaveEvent(QHoverEvent *event) */ QQuickItem* QDeclarativeGeoMapMouseArea::parentMapItem() { - QQuickItem* item = this; + QQuickItem *item = this; while (item->parentItem()) { item = item->parentItem(); if (qobject_cast<QDeclarativeGeoMap*>(item) || diff --git a/src/imports/location/qdeclarativegeomapquickitem_p.h b/src/imports/location/qdeclarativegeomapquickitem_p.h index e38dcb90..875ad414 100644 --- a/src/imports/location/qdeclarativegeomapquickitem_p.h +++ b/src/imports/location/qdeclarativegeomapquickitem_p.h @@ -92,7 +92,7 @@ protected Q_SLOTS: private: qreal scaleFactor(); - QDeclarativeCoordinate* coordinate_; + QDeclarativeCoordinate *coordinate_; QDeclarativeCoordinate internalCoordinate_; QWeakPointer<QQuickItem> sourceItem_; QQuickItem *opacityContainer_; diff --git a/src/imports/location/qdeclarativegeomaptype_p.h b/src/imports/location/qdeclarativegeomaptype_p.h index c60e6c5f..744ee873 100644 --- a/src/imports/location/qdeclarativegeomaptype_p.h +++ b/src/imports/location/qdeclarativegeomaptype_p.h @@ -79,7 +79,7 @@ public: QString description() const; bool mobile() const; - const QGeoMapType mapType(){return mapType_;} + const QGeoMapType mapType() { return mapType_; } private: QGeoMapType mapType_; diff --git a/src/imports/location/qdeclarativegeoroute_p.h b/src/imports/location/qdeclarativegeoroute_p.h index d056e776..89be9505 100644 --- a/src/imports/location/qdeclarativegeoroute_p.h +++ b/src/imports/location/qdeclarativegeoroute_p.h @@ -94,7 +94,7 @@ private: QList<QGeoCoordinate> routePath(); QGeoRoute route_; - QDeclarativeGeoBoundingBox* bounds_; + QDeclarativeGeoBoundingBox *bounds_; QList<QDeclarativeCoordinate*> path_; QList<QDeclarativeGeoRouteSegment*> segments_; friend class QDeclarativeRouteMapItem; diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp index ccb1b32e..f157f387 100644 --- a/src/imports/location/qdeclarativegeoroutemodel.cpp +++ b/src/imports/location/qdeclarativegeoroutemodel.cpp @@ -260,7 +260,7 @@ QVariant QDeclarativeGeoRouteModel::data(const QModelIndex &index, int role) con } if (role == RouteRole) { - QObject* route = routes_.at(index.row()); + QObject *route = routes_.at(index.row()); return QVariant::fromValue(route); } return QVariant(); @@ -732,7 +732,7 @@ QQmlListProperty<QDeclarativeCoordinate> QDeclarativeGeoRouteQuery::waypoints() void QDeclarativeGeoRouteQuery::waypoints_append(QQmlListProperty<QDeclarativeCoordinate> *prop, QDeclarativeCoordinate *waypoint) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); model->addWaypoint(waypoint); } @@ -741,7 +741,7 @@ void QDeclarativeGeoRouteQuery::waypoints_append(QQmlListProperty<QDeclarativeCo */ int QDeclarativeGeoRouteQuery::waypoints_count(QQmlListProperty<QDeclarativeCoordinate> *prop) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); return model->waypoints_.count(); } @@ -750,7 +750,7 @@ int QDeclarativeGeoRouteQuery::waypoints_count(QQmlListProperty<QDeclarativeCoor */ QDeclarativeCoordinate* QDeclarativeGeoRouteQuery::waypoints_at(QQmlListProperty<QDeclarativeCoordinate> *prop, int index) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); Q_ASSERT(index < model->waypoints_.count()); return model->waypoints_.at(index); } @@ -760,7 +760,7 @@ QDeclarativeCoordinate* QDeclarativeGeoRouteQuery::waypoints_at(QQmlListProperty */ void QDeclarativeGeoRouteQuery::waypoints_clear(QQmlListProperty<QDeclarativeCoordinate> *prop) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); model->clearWaypoints(); } @@ -787,7 +787,7 @@ QQmlListProperty<QDeclarativeGeoBoundingBox> QDeclarativeGeoRouteQuery::excluded */ void QDeclarativeGeoRouteQuery::exclusions_append(QQmlListProperty<QDeclarativeGeoBoundingBox> *prop, QDeclarativeGeoBoundingBox *area) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); model->addExcludedArea(area); } @@ -796,7 +796,7 @@ void QDeclarativeGeoRouteQuery::exclusions_append(QQmlListProperty<QDeclarativeG */ int QDeclarativeGeoRouteQuery::exclusions_count(QQmlListProperty<QDeclarativeGeoBoundingBox> *prop) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); return model->exclusions_.count(); } @@ -805,7 +805,7 @@ int QDeclarativeGeoRouteQuery::exclusions_count(QQmlListProperty<QDeclarativeGeo */ QDeclarativeGeoBoundingBox* QDeclarativeGeoRouteQuery::exclusions_at(QQmlListProperty<QDeclarativeGeoBoundingBox> *prop, int index) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); Q_ASSERT(index < model->exclusions_.count()); return model->exclusions_.at(index); } @@ -815,7 +815,7 @@ QDeclarativeGeoBoundingBox* QDeclarativeGeoRouteQuery::exclusions_at(QQmlListPro */ void QDeclarativeGeoRouteQuery::exclusions_clear(QQmlListProperty<QDeclarativeGeoBoundingBox> *prop) { - QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + QDeclarativeGeoRouteQuery *model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); model->clearExcludedAreas(); } diff --git a/src/imports/location/qdeclarativegeoroutemodel_p.h b/src/imports/location/qdeclarativegeoroutemodel_p.h index ec8c19e9..0e62ef87 100644 --- a/src/imports/location/qdeclarativegeoroutemodel_p.h +++ b/src/imports/location/qdeclarativegeoroutemodel_p.h @@ -157,9 +157,9 @@ private: bool complete_; - QDeclarativeGeoServiceProvider* plugin_; - QDeclarativeGeoRouteQuery* routeQuery_; - QGeoRouteReply* reply_; + QDeclarativeGeoServiceProvider *plugin_; + QDeclarativeGeoRouteQuery *routeQuery_; + QGeoRouteReply *reply_; QList<QDeclarativeGeoRoute*> routes_; bool autoUpdate_; diff --git a/src/imports/location/qdeclarativegeoroutesegment_p.h b/src/imports/location/qdeclarativegeoroutesegment_p.h index 5dce70f7..43e26fb2 100644 --- a/src/imports/location/qdeclarativegeoroutesegment_p.h +++ b/src/imports/location/qdeclarativegeoroutesegment_p.h @@ -75,7 +75,7 @@ private: static void path_clear(QQmlListProperty<QDeclarativeCoordinate> *prop); QGeoRouteSegment segment_; - QDeclarativeGeoManeuver* maneuver_; + QDeclarativeGeoManeuver *maneuver_; QList<QDeclarativeCoordinate*> path_; }; diff --git a/src/imports/location/qdeclarativegeoserviceprovider.cpp b/src/imports/location/qdeclarativegeoserviceprovider.cpp index 3f76a90c..c53cc93d 100644 --- a/src/imports/location/qdeclarativegeoserviceprovider.cpp +++ b/src/imports/location/qdeclarativegeoserviceprovider.cpp @@ -498,7 +498,7 @@ QMap<QString, QVariant> QDeclarativeGeoServiceProvider::parameterMap() const { QMap<QString, QVariant> map; - for(int i = 0; i < parameters_.size(); ++i) { + for (int i = 0; i < parameters_.size(); ++i) { QDeclarativeGeoServiceProviderParameter *parameter = parameters_.at(i); map.insert(parameter->name(), parameter->value()); } diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index 6e535fa6..6b00076c 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -213,7 +213,7 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map) screenIndices_ << ix[i]; } for (int i = 0; i < (ts.vertices.size()/2*2); i += 2) - screenVertices_ << Point(vx[i], vx[i+1]); + screenVertices_ << Point(vx[i], vx[i + 1]); screenBounds_ = ppi.boundingRect(); } @@ -308,7 +308,7 @@ QQmlListProperty<QDeclarativeCoordinate> QDeclarativePolygonMapItem::declarative void QDeclarativePolygonMapItem::path_append( QQmlListProperty<QDeclarativeCoordinate> *property, QDeclarativeCoordinate *coordinate) { - QDeclarativePolygonMapItem* item = qobject_cast<QDeclarativePolygonMapItem*>(property->object); + QDeclarativePolygonMapItem *item = qobject_cast<QDeclarativePolygonMapItem*>(property->object); item->coordPath_.append(coordinate); item->path_.append(coordinate->coordinate()); @@ -345,7 +345,7 @@ QDeclarativeCoordinate* QDeclarativePolygonMapItem::path_at( void QDeclarativePolygonMapItem::path_clear( QQmlListProperty<QDeclarativeCoordinate> *property) { - QDeclarativePolygonMapItem* item = qobject_cast<QDeclarativePolygonMapItem*>( + QDeclarativePolygonMapItem *item = qobject_cast<QDeclarativePolygonMapItem*>( property->object); qDeleteAll(item->coordPath_); item->coordPath_.clear(); @@ -542,7 +542,7 @@ void QDeclarativePolygonMapItem::dragEnded() if (newCoordinate.isValid()) { qreal firstLongitude = path_.at(0).longitude(); qreal firstLatitude = path_.at(0).latitude(); - for (int i = 0; i<path_.count(); ++i) { + for (int i = 0; i < path_.count(); ++i) { QGeoCoordinate coord = path_.at(i); coord.setLongitude(coord.longitude() + newCoordinate.longitude() - firstLongitude); coord.setLatitude(coord.latitude() + newCoordinate.latitude() - firstLatitude); diff --git a/src/imports/location/qdeclarativepolygonmapitem_p.h b/src/imports/location/qdeclarativepolygonmapitem_p.h index 0f06287f..6cb53aa7 100644 --- a/src/imports/location/qdeclarativepolygonmapitem_p.h +++ b/src/imports/location/qdeclarativepolygonmapitem_p.h @@ -144,7 +144,7 @@ public: private: QSGFlatColorMaterial fill_material_; - MapPolylineNode* border_; + MapPolylineNode *border_; QSGGeometry geometry_; bool blocked_; }; diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index fcade1fb..d2cce34d 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -185,7 +185,7 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map, // clear the old data and reserve enough memory srcPoints_.clear(); - srcPoints_.reserve(path.size()*2); + srcPoints_.reserve(path.size() * 2); srcPointTypes_.clear(); srcPointTypes_.reserve(path.size()); @@ -314,8 +314,8 @@ static void clipSegmentToRect(qreal x0, qreal y0, qreal x1, qreal y1, if (accept) { if (outPoints.size() >= 2) { qreal lastX, lastY; - lastY = outPoints.at(outPoints.size()-1); - lastX = outPoints.at(outPoints.size()-2); + lastY = outPoints.at(outPoints.size() - 1); + lastX = outPoints.at(outPoints.size() - 2); if (!qFuzzyCompare(lastY, y0) || !qFuzzyCompare(lastX, x0)) { outTypes << QPainterPath::MoveToElement; @@ -345,12 +345,12 @@ static void clipPathToRect(const QVector<qreal> &points, qreal lastX, lastY; for (int i = 0; i < types.size(); ++i) { if (i > 0 && types[i] != QPainterPath::MoveToElement) { - qreal x = points[i*2], y = points[i*2+1]; + qreal x = points[i * 2], y = points[i * 2 + 1]; clipSegmentToRect(lastX, lastY, x, y, clipRect, outPoints, outTypes); } - lastX = points[i*2]; - lastY = points[i*2+1]; + lastX = points[i * 2]; + lastY = points[i * 2 + 1]; } } @@ -399,13 +399,13 @@ void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map, QPolygonF tri; const float *vs = ts.vertices(); - for (int i = 0; i < ts.vertexCount()/2*2; i+=2) { - screenVertices_ << Point(vs[i], vs[i+1]); + for (int i = 0; i < (ts.vertexCount()/2*2); i += 2) { + screenVertices_ << Point(vs[i], vs[i + 1]); - if (!qIsFinite(vs[i]) || !qIsFinite(vs[i+1])) + if (!qIsFinite(vs[i]) || !qIsFinite(vs[i + 1])) break; - tri << QPointF(vs[i], vs[i+1]); + tri << QPointF(vs[i], vs[i + 1]); if (tri.size() == 4) { tri.remove(0); screenOutline_.addPolygon(tri); @@ -463,7 +463,7 @@ void QDeclarativePolylineMapItem::updateAfterCoordinateChanged() void QDeclarativePolylineMapItem::setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map) { QDeclarativeGeoMapItemBase::setMap(quickMap,map); - if (map){ + if (map) { geometry_.markSourceDirty(); updateMapItem(); } @@ -488,7 +488,7 @@ QQmlListProperty<QDeclarativeCoordinate> QDeclarativePolylineMapItem::declarativ void QDeclarativePolylineMapItem::path_append(QQmlListProperty<QDeclarativeCoordinate> *property, QDeclarativeCoordinate *coordinate) { - QDeclarativePolylineMapItem* item = qobject_cast<QDeclarativePolylineMapItem*>( + QDeclarativePolylineMapItem *item = qobject_cast<QDeclarativePolylineMapItem*>( property->object); QObject::connect(coordinate, SIGNAL(coordinateChanged(QGeoCoordinate)), @@ -525,7 +525,7 @@ QDeclarativeCoordinate* QDeclarativePolylineMapItem::path_at( void QDeclarativePolylineMapItem::path_clear( QQmlListProperty<QDeclarativeCoordinate> *property) { - QDeclarativePolylineMapItem* item = qobject_cast<QDeclarativePolylineMapItem*>( + QDeclarativePolylineMapItem *item = qobject_cast<QDeclarativePolylineMapItem*>( property->object); qDeleteAll(item->coordPath_); item->coordPath_.clear(); @@ -687,7 +687,7 @@ void QDeclarativePolylineMapItem::dragEnded() if (newCoordinate.isValid()) { qreal firstLongitude = path_.at(0).longitude(); qreal firstLatitude = path_.at(0).latitude(); - for (int i = 0; i<path_.count(); ++i) { + for (int i = 0; i < path_.count(); ++i) { QGeoCoordinate coord = path_.at(i); coord.setLongitude(coord.longitude() + newCoordinate.longitude() - firstLongitude); coord.setLatitude(coord.latitude() + newCoordinate.latitude() - firstLatitude); diff --git a/src/imports/location/qdeclarativepositionsource_p.h b/src/imports/location/qdeclarativepositionsource_p.h index 89edff0f..26b7ecda 100644 --- a/src/imports/location/qdeclarativepositionsource_p.h +++ b/src/imports/location/qdeclarativepositionsource_p.h @@ -127,10 +127,10 @@ private Q_SLOTS: void positionUpdateReceived(const QGeoPositionInfo& update); void sourceErrorReceived(const QGeoPositionInfoSource::Error error); private: - QGeoPositionInfoSource* m_positionSource; + QGeoPositionInfoSource *m_positionSource; PositioningMethods m_positioningMethod; QDeclarativePosition m_position; - QFile* m_nmeaFile; + QFile *m_nmeaFile; QString m_nmeaFileName; QUrl m_nmeaSource; bool m_active; diff --git a/src/imports/location/qdeclarativerectanglemapitem_p.h b/src/imports/location/qdeclarativerectanglemapitem_p.h index a5b74fb6..1005e7b9 100644 --- a/src/imports/location/qdeclarativerectanglemapitem_p.h +++ b/src/imports/location/qdeclarativerectanglemapitem_p.h @@ -106,8 +106,8 @@ protected Q_SLOTS: void afterViewportChanged(const QGeoMapViewportChangeEvent &event); private: - QDeclarativeCoordinate* topLeft_; - QDeclarativeCoordinate* bottomRight_; + QDeclarativeCoordinate *topLeft_; + QDeclarativeCoordinate *bottomRight_; QDeclarativeCoordinate internalTopLeft_; QDeclarativeCoordinate internalBottomRight_; QDeclarativeMapLineProperties border_; diff --git a/src/imports/location/qdeclarativeroutemapitem_p.h b/src/imports/location/qdeclarativeroutemapitem_p.h index e5d587f6..535687d7 100644 --- a/src/imports/location/qdeclarativeroutemapitem_p.h +++ b/src/imports/location/qdeclarativeroutemapitem_p.h @@ -85,7 +85,7 @@ protected Q_SLOTS: private: QDeclarativeMapLineProperties line_; - QDeclarativeGeoRoute* route_; + QDeclarativeGeoRoute *route_; QList<QGeoCoordinate> path_; bool dirtyMaterial_; bool dragActive_; diff --git a/src/imports/location/qgeomapitemgeometry_p.h b/src/imports/location/qgeomapitemgeometry_p.h index 9e25982b..202f1090 100644 --- a/src/imports/location/qgeomapitemgeometry_p.h +++ b/src/imports/location/qgeomapitemgeometry_p.h @@ -61,7 +61,8 @@ class QGeoMapItemGeometry : public QObject public: - struct Point { + struct Point + { inline Point(qreal x, qreal y) : x(x), y(y) {} inline Point() : x(0), y(0) {} inline Point(const QPointF &pt) : x(pt.x()), y(pt.y()) {} @@ -101,9 +102,9 @@ public: inline quint32 size() const { if (isIndexed()) - return screenIndices_.size()/3; + return screenIndices_.size() / 3; else - return screenVertices_.size()/3; + return screenVertices_.size() / 3; } inline void clear() { firstPointOffset_ = QPointF(0,0); |