<file>res/images/arrow_right.png</file>
<file>res/images/clock.png</file>
<file>res/images/compass.png</file>
- <file>res/images/dummy_Avatar.png</file>
<file>res/images/envelope.png</file>
<file>res/images/list_item.png</file>
- <file>res/images/dummy_image.png</file>
<file>res/images/zoom_in.png</file>
<file>res/images/zoom_out.png</file>
- <file>res/images/compass.png</file>
- <file>res/images/envelope.png</file>
<file>res/images/personal_info_bckgrnd.png</file>
<file>res/images/profile_pic_border.png</file>
<file>res/images/refresh.png</file>
<file>res/images/send_position.png</file>
<file>res/images/side_bar_left.png</file>
<file>res/images/side_bar_right.png</file>
- <file>res/images/situare_user.jpg</file>
<file>res/images/sliding_bar_left.png</file>
<file>res/images/sliding_bar_right.png</file>
- <file>res/images/clock.png</file>
<file>res/images/led_red_g.png</file>
<file>res/images/led_red_h.png</file>
<file>res/images/led_red_s.png</file>
<RCC>
<qresource prefix="/">
-<<<<<<< HEAD:src/images.qrc
<file>resources/arrow_left.png</file>
<file>resources/arrow_right.png</file>
<file>resources/bkg_grid.png</file>
- <file>resources/clock.png</file>
- <file>resources/clock_small.png</file>
- <file>resources/compass.png</file>
- <file>resources/compas_small.png</file>
- <file>resources/dummy_Avatar.png</file>
- <file>resources/envelope.png</file>
- <file>resources/facebook_user_64.png</file>
- <file>resources/fb.jpg</file>
<file>resources/led_red_g.png</file>
<file>resources/led_red_h.png</file>
<file>resources/led_red_s.png</file>
<file>resources/list_item.png</file>
- <file>resources/list_item_selected.png</file>
- <file>resources/list_small.png</file>
- <file>resources/personal_infotab_background.png</file>
- <file>resources/reload_icon.png</file>
- <file>resources/sendPosition_icon.png</file>
- <file>resources/separe_line.png</file>
<file>resources/side_bar_left.png</file>
<file>resources/side_bar_right.png</file>
<file>resources/sliding_bar_left.png</file>
<file>resources/sliding_bar_right.png</file>
- <file>resources/top_separtor.png</file>
- <file>resources/zoom_in.png</file>
- <file>resources/zoom_out.png</file>
- <file>resources/list_item_bottom.png</file>
- <file>resources/list_item_middle.png</file>
- <file>resources/list_item_top.png</file>
-=======
<file>resources/zoom_in.png</file>
<file>resources/zoom_out.png</file>
<file>resources/clock.png</file>
<file>resources/compass.png</file>
<file>resources/envelope.png</file>
<file>resources/profile_pic_border.png</file>
- <file>resources/situare_user.jpg</file>
<file>resources/send_position.png</file>
- <file>resources/side_bar_left.png</file>
- <file>resources/sliding_bar_left.png</file>
<file>resources/personal_info_bckgrnd.png</file>
<file>resources/refresh.png</file>
- <file>resources/arrow_left.png</file>
- <file>resources/arrow_right.png</file>
->>>>>>> personalinfo:src/images.qrc
</qresource>
</RCC>
#include "mapcommon.h"
MapButton::MapButton(QString fileName)
- : m_buttonMode(QIcon::Normal),
- m_buttonWidth(MAP_ZOOM_PANEL_BUTTON_SIZE),
- m_buttonHeight(MAP_ZOOM_PANEL_BUTTON_SIZE)
+ : m_buttonMode(QIcon::Normal)
+ , m_buttonWidth(MAP_ZOOM_PANEL_BUTTON_SIZE)
+ , m_buttonHeight(MAP_ZOOM_PANEL_BUTTON_SIZE)
{
- // Add an image to the icon
+ qDebug() << __PRETTY_FUNCTION__;
+
addFile(fileName);
}
void MapButton::draw(QPainter *painter, int x, int y)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
paint(painter, x, y, m_buttonWidth, m_buttonHeight, NULL, m_buttonMode);
}
void MapButton::setMode(QIcon::Mode mode)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
m_buttonMode = mode;
}
#include <QString>
#include <QPainter>
+/**
+* @brief A simple class for icon button
+*
+* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+*/
class MapButton : public QIcon
{
public:
+ /**
+ * @brief Constructor
+ *
+ * @param fileName Icon image file name
+ */
MapButton(QString fileName);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+ /**
+ * @brief Draws the button
+ *
+ * @param painter Painter
+ * @param x Button x coordinate
+ * @param y Button y coordinate
+ */
void draw(QPainter *painter, int x, int y);
+
+ /**
+ * @brief Sets the button icon mode
+ *
+ * @param mode Button icon mode
+ */
void setMode(QIcon::Mode mode);
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
private:
- QIcon::Mode m_buttonMode;
- int m_buttonWidth;
- int m_buttonHeight;
+ QIcon::Mode m_buttonMode; ///< Button mode (Normal, Selected etc...)
+ int m_buttonWidth; ///< Button width
+ int m_buttonHeight; ///< Button height
};
#endif // MAPBUTTON_H
* @brief layer of own location icon
*/
const int OWN_LOCATION_ICON_Z_LEVEL = FRIEND_LOCATION_ICON_Z_LEVEL + 1;
-
-const int MAP_ZOOM_PANEL_LEVEL = OWN_LOCATION_ICON_Z_LEVEL + 1; ///< Zepth of zoom panel (Z-axis)
+const int MAP_OWN_LOCATION_ICON_SIZE = 24; ///< Size of own location item icon
const int ZOOM_FPS = 30; ///< FPS for the zoom effect
const qreal ZOOM_TIME = 250; ///< Length of the zoom effect (ms)
-static const int MAP_ZOOM_PANEL_POSITION_X = 10; ///< Horizontal position of zoom panel
-static const int MAP_ZOOM_PANEL_POSITION_Y = 10; ///< Vertical position of zoom panel
-
-static const int MAP_ZOOM_PANEL_BUTTON_SIZE = 74; ///< Size of a zoom panel button
-
-static const int MAP_OWN_LOCATION_ICON_SIZE = 24; ///< Size of own location item icon
+const int MAP_ZOOM_PANEL_POSITION_X = 10; ///< Horizontal position of zoom panel
+const int MAP_ZOOM_PANEL_POSITION_Y = 10; ///< Vertical position of zoom panel
+const int MAP_ZOOM_PANEL_LEVEL = OWN_LOCATION_ICON_Z_LEVEL + 1; ///< Zepth of zoom panel (Z-axis)
+const int MAP_ZOOM_PANEL_BUTTON_SIZE = 74; ///< Size of a zoom panel button
+const int MAP_ZOOM_PANEL_BUTTON_SPACING = 4; ///< Size of a zoom button spacing
const qreal MAX_LATITUDE = 85.05112877980659237802; ///< Maximum latitude value
const qreal MIN_LATITUDE = -MAX_LATITUDE; ///< Minimum latitude value
void MapEngine::alignImmovableItems(QPoint viewTopLeft)
{
- m_mapZoomPanel->setPos(viewTopLeft);
-
qDebug() << __PRETTY_FUNCTION__ << "viewTopLeft:" << viewTopLeft;
+
+ m_mapZoomPanel->setPos(viewTopLeft);
}
void MapEngine::setLocation(QPoint sceneCoordinate)
class MapEngine : public QObject
{
Q_OBJECT
+
public:
/**
* @brief Constructor
*/
void zoomOut();
-
-
/*******************************************************************************
* SIGNALS
******************************************************************************/
*/
void zoomLevelChanged(int newZoomLevel);
-
-
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
*/
void addTile(MapTile *mapTile, QString hashKey);
- void debugItemsCount();
-
/**
* @brief Enqueue stacked tiles removal request
*
{
qDebug() << __PRETTY_FUNCTION__;
- QGraphicsView::mousePressEvent(event);
+ QGraphicsView::mousePressEvent(event); // Temporary solution
m_mousePosition = mapToScene(event->pos()).toPoint();
m_scenePosition = mapToScene(width() / 2 - 1, height() / 2 - 1).toPoint();
void MapView::centerToSceneCoordinates(QPoint sceneCoordinate)
{
qDebug() << __PRETTY_FUNCTION__ << "sceneCoordinate" << sceneCoordinate;
+
centerOn(sceneCoordinate);
}
void MapView::resizeEvent(QResizeEvent *event)
{
- qDebug() << __PRETTY_FUNCTION__ << event->size();
+ qDebug() << __PRETTY_FUNCTION__ << "Resize:" << event->size();
+
emit viewResized(event->size());
emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
}
+
+void MapView::showEvent(QShowEvent *event)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QGraphicsView::showEvent(event);
+ emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
+}
*/
void resizeEvent(QResizeEvent *event);
+ /**
+ * @brief Called when view is displayed.
+ *
+ * @param event show event
+ */
+ void showEvent(QShowEvent *event);
+
private:
/**
* @brief Event handler for mouse move events
MapZoomPanel::MapZoomPanel(QGraphicsItem *parent, int x, int y) : QGraphicsItem(parent)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
m_x = x;
m_y = y;
m_width = MAP_ZOOM_PANEL_BUTTON_SIZE;
- m_height = MAP_ZOOM_PANEL_BUTTON_SIZE * 2;
+ m_height = MAP_ZOOM_PANEL_BUTTON_SIZE + MAP_ZOOM_PANEL_BUTTON_SPACING
+ + MAP_ZOOM_PANEL_BUTTON_SIZE;
m_zoomInBtn = new MapButton(":/res/images/zoom_in.png");
m_zoomOutBtn = new MapButton(":/res/images/zoom_out.png");
setZValue(static_cast<qreal>(MAP_ZOOM_PANEL_LEVEL));
}
+MapZoomPanel::~MapZoomPanel()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ delete m_zoomInBtn;
+ delete m_zoomOutBtn;
+ m_zoomInBtn = 0;
+ m_zoomOutBtn = 0;
+}
+
QRectF MapZoomPanel::boundingRect() const
{
+ qDebug() << __PRETTY_FUNCTION__;
+
return QRectF(m_x, m_y, m_width, m_height);
}
void MapZoomPanel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
Q_UNUSED(option);
Q_UNUSED(widget);
m_zoomInBtn->draw(painter, m_x, m_y);
- m_zoomOutBtn->draw(painter, m_x, m_y + MAP_ZOOM_PANEL_BUTTON_SIZE);
+ m_zoomOutBtn->draw(painter, m_x, m_y + MAP_ZOOM_PANEL_BUTTON_SPACING
+ + MAP_ZOOM_PANEL_BUTTON_SIZE);
}
void MapZoomPanel::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- if ( event->pos().y() < (m_y + MAP_ZOOM_PANEL_BUTTON_SIZE) )
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if ( event->pos().y() < (m_y + MAP_ZOOM_PANEL_BUTTON_SPACING + MAP_ZOOM_PANEL_BUTTON_SIZE) )
m_zoomInBtn->setMode(QIcon::Selected);
else
m_zoomOutBtn->setMode(QIcon::Selected);
update();
-
-// qDebug() << __PRETTY_FUNCTION__;
}
void MapZoomPanel::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
Q_UNUSED(event);
m_zoomInBtn->setMode(QIcon::Normal);
m_zoomOutBtn->setMode(QIcon::Normal);
- if ( event->pos().y() < (m_y + MAP_ZOOM_PANEL_BUTTON_SIZE) )
+ if ( event->pos().y() < (m_y + MAP_ZOOM_PANEL_BUTTON_SPACING + MAP_ZOOM_PANEL_BUTTON_SIZE) )
emit zoomInPressed();
else
emit zoomOutPressed();
update();
-
-// qDebug() << __PRETTY_FUNCTION__;
}
#include "mapbutton.h"
+/**
+* @brief Panel for zoom buttons
+*
+* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+*/
class MapZoomPanel : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ * @param x Panel x coordinate
+ * @param y Panel y coordinate
+ */
MapZoomPanel(QGraphicsItem *parent = 0, int x = 0, int y = 0);
+
+ /**
+ * @brief Destructor
+ */
+ ~MapZoomPanel();
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+public:
+ /**
+ * @brief Returns the outer bounds of the panel
+ */
QRectF boundingRect() const;
+
+ /**
+ * @brief Paints the panel and its content
+ *
+ * @param painter Painter
+ * @param option Style options
+ * @param widget Widget
+ */
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
protected:
+ /**
+ * @brief Event handler for mouse press events
+ *
+ * @param event Mouse event
+ */
void mousePressEvent(QGraphicsSceneMouseEvent *event);
+
+ /**
+ * @brief Event handler for mouse release events
+ *
+ * @param event Mouse event
+ */
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
signals:
+ /**
+ * @brief Signal for zoom in button click
+ */
void zoomInPressed();
+
+ /**
+ * @brief Signal for zoom out button click
+ */
void zoomOutPressed();
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
private:
- MapButton *m_zoomInBtn;
- MapButton *m_zoomOutBtn;
-
- qreal m_x;
- qreal m_y;
- qreal m_width;
- qreal m_height;
+ MapButton *m_zoomInBtn; ///< Button for zoom in
+ MapButton *m_zoomOutBtn; ///< Button for zoom out
+ qreal m_x; ///< Panel x coordinate
+ qreal m_y; ///< Panel y coordinate
+ qreal m_width; ///< Panel width
+ qreal m_height; ///< Panel height
};
#endif // MAPZOOMPANEL_H
#include "mapengine.h"
#include "mapcommon.h"
-
OwnLocationItem::OwnLocationItem(const QPointF & ownPosition)
{
qDebug() << __PRETTY_FUNCTION__;
setOffset(-ownLocationIcon.width()/2, -ownLocationIcon.height()/2);
setFlag(QGraphicsItem::ItemIgnoresTransformations);
}
-
-
#include "mapcommon.h"
#include "baselocationitem.h"
-
-
/**
* @brief Class that shows own location icon on the map
*
class OwnLocationItem : public BaseLocationItem
{
public:
-
/**
* @brief Constructor of OwnLocationItem.
* Sets position to specified location.
message(Make sure you have QJson development headers installed)
message(install headers with: sudo apt-get install libqjson-dev)
}
-maemo5 {
+maemo5 {
message(QJson built in)
message(Make sure you have QJson development headers installed)
message(add: deb http://repository.maemo.org/extras-devel fremantle free non-free)
target.path = $$BINDIR
INSTALLS += target
}
-RESOURCES +=
qDebug() << __PRETTY_FUNCTION__;
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5ShowProgressIndicator, value);
+#else
+ Q_UNUSED(value);
#endif // Q_WS_MAEMO_5
}
void switchView(int);
private slots:
-
/**
* @brief Private slot, which starts UpdateLocationDialog
*
/*******************************************************************************
* SIGNALS
******************************************************************************/
- signals:
+signals:
/**
* @brief Signal for requesting reverseGeo from SituareEngine
*
INCLUDEPATH += . \
../../../src/
-# DEFINES += QT_NO_DEBUG_OUTPUT
# Input
SOURCES += testmapengine.cpp \
../../../src/map/mapengine.cpp \
../../../src/map/mapbutton.h \
../../../src/map/ownlocationitem.h \
../../../src/map/maptilerequest.h
-RESOURCES +=
DEFINES += QT_NO_DEBUG_OUTPUT
MapTile mapTile;
mapTile.setZoomLevel(13, 14);
QVERIFY(mapTile.zoomLevel() == 13);
-
}
/**
pixmap = ownLocationItem.pixmap();
QCOMPARE (pixmap.isNull(), false);
-
// Test Position
QCOMPARE(ownLocationItem.position(),
MapEngine::convertLatLonToSceneCoordinate(defaultLocationPoint));
// Test Z-value
QCOMPARE(static_cast<int>(ownLocationItem.zValue()), OWN_LOCATION_ICON_Z_LEVEL);
-
// Test Offset
QCOMPARE(ownLocationItem.offset(),
QPointF(-ownLocationItem.pixmap().width()/2, -ownLocationItem.pixmap().height()/2));
-
// Test ItemIgnoresTransformations Flags
QGraphicsItem::GraphicsItemFlags ownLocationItemFlags = ownLocationItem.flags();
QCOMPARE(ownLocationItemFlags, itemIgnoresTransformationsFlagValue);
-
}
void TestOwnLocationItem::testSetAndGetPosition()
QCOMPARE(ownLocation.position(),
MapEngine::convertLatLonToSceneCoordinate(testLocationPoint));
-
}
void TestOwnLocationItem::testHideAndShowPosition()
#include "../../../src/situareservice/situareservice.h"
#include "../../../src/situareservice/situarecommon.h"
-
class testFetchLocations : public QObject
{
Q_OBJECT
delete situare;
}
-
//void testFetchLocations::testIncorrectUrl()
//{
// QNetworkAccessManager *manager = new QNetworkAccessManager();
QCOMPARE(receivedErrorSpy.count(), 0);
}
-
QTEST_MAIN(testFetchLocations)
#include "testfetchlocations.moc"
../../../src/ui/settingsdialog.h
QT += webkit \
network
-!maemo5:QT += opengl