function timing macros added to geomap.cpp and logger.h added to project
authorJanne Kiiski <janne.kiiski@ixonos.com>
Wed, 24 Nov 2010 13:10:25 +0000 (15:10 +0200)
committerJanne Kiiski <janne.kiiski@ixonos.com>
Wed, 24 Nov 2010 13:10:25 +0000 (15:10 +0200)
src/qmlui/geomap.cpp
src/src.pro

index c20c276..649121f 100644 (file)
@@ -1,12 +1,11 @@
 #include "geomap.h"
-#include <QDebug>
 #include <QGeoMapPixmapObject>
 #include <QGeoMapPolylineObject>
 #include "../user/friendmodel.h"
 #include "../coordinates/geocoordinate.h"
 #include "../routing/routemodel.h"
-#include <QGraphicsSceneMouseEvent>
 #include "../ui/avatarimage.h"
+#include "../logger.h"
 
 using namespace QtMobility;
 
@@ -27,6 +26,8 @@ public:
       */
     void filterCoordinatePoints(QList<QGeoCoordinate>* geometryPoints)
     {
+        DEBUG_FUNCTION_TIME;
+
         // Rough guess for maximum point count for smooth use
         // Produces max 500+n items to result array (rounding error in division)...
         static const int MAX_POINT_COUNT = 500;
@@ -60,7 +61,7 @@ GeoMap::GeoMap(QGraphicsItem* parent)
       prevGpsLocation(0,0),
       initialized(false)
 {
-    qDebug() << __PRETTY_FUNCTION__;
+    DEBUG_FUNCTION_TIME;
     connect(this, SIGNAL(panned(QPoint)), this, SLOT(panned()));
 
     setCenter(prevGpsLocation);
@@ -72,11 +73,12 @@ GeoMap::GeoMap(QGraphicsItem* parent)
 
 GeoMap::~GeoMap()
 {
-    qDebug() << __PRETTY_FUNCTION__;
+    DEBUG_FUNCTION_TIME;
 }
 
 qreal GeoMap::angleToGpsLocation() const
 {
+    DEBUG_FUNCTION_TIME;
     const qreal result = prevGpsLocation.isValid() ? center().azimuthTo(prevGpsLocation) : 0.0;
     qDebug() << "QmlMap::angleToGpsLocation: " << result;
     return result;
@@ -84,6 +86,7 @@ qreal GeoMap::angleToGpsLocation() const
 
 qreal GeoMap::distanceToGpsLocation() const
 {
+    DEBUG_FUNCTION_TIME;
     const qreal result = prevGpsLocation.isValid() ? center().distanceTo(prevGpsLocation) : 0.0;
     qDebug() << "QmlMap::distanceToGpsLocation: " << result << " meters";
     return result;
@@ -91,6 +94,7 @@ qreal GeoMap::distanceToGpsLocation() const
 
 QString GeoMap::distanceToGpsLocationText() const
 {
+    DEBUG_FUNCTION_TIME;
     const qreal distance = distanceToGpsLocation();
     // copy/paste from: IndicatorButtonPanel::updateValues
     const int MAX_TO_METERS = 999.5;
@@ -118,11 +122,14 @@ QString GeoMap::distanceToGpsLocationText() const
     return distanceText;
 }
 
-double GeoMap::centerLatitude() const {
+double GeoMap::centerLatitude() const
+{
     return center().latitude();
 }
 
-void GeoMap::setCenterLatitude(const double latitude) {
+void GeoMap::setCenterLatitude(const double latitude)
+{
+    DEBUG_FUNCTION_TIME;
     QGeoCoordinate newCenter = center();
     newCenter.setLatitude(latitude);
     setCenter(newCenter);
@@ -134,7 +141,9 @@ double GeoMap::centerLongitude() const
     return center().longitude();
 }
 
-void GeoMap::setCenterLongitude(const double longitude) {
+void GeoMap::setCenterLongitude(const double longitude)
+{
+    DEBUG_FUNCTION_TIME;
     QGeoCoordinate newCenter = center();
     newCenter.setLongitude(longitude);
     setCenter(newCenter);
@@ -154,6 +163,7 @@ double GeoMap::gpsLocationLongitude() const
 
 void GeoMap::setFriendModels(FriendModel* friendModel, FilteredFriendModel* friendFilterModel)
 {
+    DEBUG_FUNCTION_TIME;
     Q_D(GeoMap);
     Q_ASSERT(friendModel && friendFilterModel);
     if (friendModel && friendFilterModel) {
@@ -165,6 +175,7 @@ void GeoMap::setFriendModels(FriendModel* friendModel, FilteredFriendModel* frie
 
 void GeoMap::setRouteModel(RouteModel* routeModel)
 {
+    DEBUG_FUNCTION_TIME;
     Q_D(GeoMap);
     Q_ASSERT(routeModel);
     d->routeModel = routeModel;
@@ -173,14 +184,15 @@ void GeoMap::setRouteModel(RouteModel* routeModel)
 
 void GeoMap::panned()
 {
+    DEBUG_FUNCTION_TIME;
     emit positionChanged();
 }
 
 void GeoMap::onFriendModelReset()
 {
+    DEBUG_FUNCTION_TIME;
     Q_D(GeoMap);
     Q_ASSERT(d->friendModel);
-
     foreach(QGeoMapPixmapObject* mapObject, d->friendMapObjects) {
         removeMapObject(mapObject);
         delete mapObject;
@@ -214,7 +226,7 @@ void GeoMap::onFriendModelReset()
 
 void GeoMap::onRouteModelReset()
 {
-    qDebug() << __PRETTY_FUNCTION__;
+    DEBUG_FUNCTION_TIME;
     Q_D(GeoMap);
     Q_ASSERT(d->routeModel);
 
@@ -231,10 +243,7 @@ void GeoMap::onRouteModelReset()
         removeMapObject(d->routeMapObject);
     }
     if (!path.isEmpty()) {
-        qDebug() << "PATH BEFORE: " << path.count();
         d->filterCoordinatePoints(&path);
-        qDebug() << "PATH AFTER: " << path.count();
-
         d->routeMapObject->setPath(path);
         QPen pen(Qt::red);
         pen.setWidth(5);
@@ -245,6 +254,7 @@ void GeoMap::onRouteModelReset()
 
 void GeoMap::goToGpsLocation()
 {
+    DEBUG_FUNCTION_TIME;
     qDebug() << "QmlMap::goToGpsLocation";
     if (!source)
         source = QGeoPositionInfoSource::createDefaultSource(this);
@@ -259,6 +269,7 @@ void GeoMap::goToGpsLocation()
 
 void GeoMap::onClicked(qreal mouseX, qreal mouseY)
 {
+    DEBUG_FUNCTION_TIME;
     Q_D(GeoMap);
     QList<QGeoMapObject*> mapObjects = mapObjectsAtScreenPosition(QPointF(mouseX, mouseY));
     QList<User*> filter;
@@ -274,11 +285,13 @@ void GeoMap::onClicked(qreal mouseX, qreal mouseY)
 
 void GeoMap::zoomIn()
 {
+    DEBUG_FUNCTION_TIME;
     setZoomLevel(zoomLevel() + 1.0);
 }
 
 void GeoMap::zoomOut()
 {
+    DEBUG_FUNCTION_TIME;
     if (zoomLevel() > 2.0)
         setZoomLevel(zoomLevel() - 1.0);
 }
@@ -286,6 +299,7 @@ void GeoMap::zoomOut()
 
 void GeoMap::positionUpdated(const QGeoPositionInfo& positionInfo)
 {
+    DEBUG_FUNCTION_TIME;
     qDebug() << "QmlMap::positionUpdated: " << positionInfo.coordinate();
     prevGpsLocation = positionInfo.coordinate();
     Q_D(GeoMap);
index 619e7ba..8bc5cfd 100644 (file)
@@ -190,7 +190,8 @@ HEADERS += application.h \
     user/profile.h \
     qmlui/userimageprovider.h \
     routing/searchhistorymodel.h \
-    routing/searchresultsmodel.h
+    routing/searchresultsmodel.h \
+    logger.h
 
 OTHER_FILES += qmlui/Main.qml \
     qmlui/Dialog.qml \