#include "mapcommon.h"
#include "mapfetcher.h"
#include "mapscene.h"
+#include "mapscroller.h"
#include "maptile.h"
#include "network/networkaccessmanager.h"
#include "ownlocationitem.h"
connect(m_friendItemsHandler, SIGNAL(locationItemClicked(QList<QString>)),
this, SIGNAL(locationItemClicked(QList<QString>)));
+
+ m_scroller = &MapScroller::getInstance();
}
MapEngine::~MapEngine()
class GPSLocationItem;
class MapFetcher;
class MapScene;
+class MapScroller;
class MapTile;
class OwnLocationItem;
class User;
GPSLocationItem *m_gpsLocationItem; ///< Item pointing current location from GPS
MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
MapScene *m_mapScene; ///< Scene for map tiles
+ MapScroller *m_scroller;
OwnLocationItem *m_ownLocation; ///< Item to show own location
};
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Sami Rämö - sami.ramo@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+#include <QPointF>
+
+#include "mapscroller.h"
+
+MapScroller::MapScroller()
+{
+ setEasingCurve(QEasingCurve::OutCubic);
+}
+
+MapScroller& MapScroller::getInstance()
+{
+ static MapScroller instance;
+ return instance;
+}
+
+void MapScroller::updateCurrentValue(const QVariant &value)
+{
+ qWarning() << __PRETTY_FUNCTION__ << value.toPointF().x() << value.toPointF().y();
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Sami Rämö - sami.ramo@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+
+#ifndef MAPSCROLLER_H
+#define MAPSCROLLER_H
+
+#include <QVariantAnimation>
+
+class MapScroller : public QVariantAnimation
+{
+ Q_OBJECT
+
+private:
+ /// @todo remove default constructor after caller does set easing curve
+ MapScroller(); // {}
+ ~MapScroller() {}
+ MapScroller(const MapScroller &); // intentionally undefined
+ MapScroller & operator=(const MapScroller &); // intentionally undefined
+
+private:
+ void updateCurrentValue(const QVariant &value);
+
+public:
+ static MapScroller &getInstance();
+
+signals:
+
+public slots:
+
+};
+
+#endif // MAPSCROLLER_H
#include <QMouseEvent>
#include "mapcommon.h"
+#include "mapscroller.h"
#include "mapview.h"
MapView::MapView(QWidget *parent)
this, SIGNAL(viewZoomFinished()));
setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing);
+
+ m_scroller = &MapScroller::getInstance();
}
void MapView::centerToSceneCoordinates(QPoint sceneCoordinate)
void MapView::mouseReleaseEvent(QMouseEvent *event)
{
QGraphicsView::mouseReleaseEvent(event);
+
+ m_scroller->setStartValue(m_scenePosition);
+ m_scroller->setEndValue(m_scenePosition + m_scenePosition);
+ m_scroller->setDuration(1000);
+ m_scroller->start();
}
void MapView::resizeEvent(QResizeEvent *event)
class QPropertyAnimation;
+class MapScroller;
+
/**
* @brief Map view widget
*
QPointF m_mousePosition; ///< Previous mouse event position
QPointF m_scenePosition; ///< New center position
QPropertyAnimation *m_zoomAnimation; ///< Zoom animation
+
+ MapScroller *m_scroller;
};
#endif // MAPVIEW_H
ui/userinfopanel.cpp \
ui/zoombutton.cpp \
ui/zoombuttonpanel.cpp \
- user/user.cpp
+ user/user.cpp \
+ map/mapscroller.cpp
HEADERS += common.h \
engine/engine.h \
facebookservice/facebookauthentication.h \
ui/sidepanelbase.h \
ui/zoombutton.h \
ui/zoombuttonpanel.h \
- user/user.h
+ user/user.h \
+ map/mapscroller.h
QT += network \
webkit
DEFINES += QT_NO_DEBUG_OUTPUT