<qresource prefix="/">
<file>res/images/arrow_left.png</file>
<file>res/images/arrow_right.png</file>
- <file>res/images/clock_small.png</file>
- <file>res/images/compas_small.png</file>
- <file>res/images/facebook_user_64.png</file>
- <file>res/images/list_small.png</file>
- <file>res/images/reload_icon.png</file>
- <file>res/images/sendPosition_icon.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_bottom.png</file>
- <file>res/images/list_item_middle.png</file>
- <file>res/images/list_item_top.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>
</qresource>
</RCC>
<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/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>
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@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 <QPixmap>
+
+#include "mapbutton.h"
+#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)
+{
+ QPixmap pixmap(fileName);
+
+ // Temporary (lazy fix) solution to get the buttons larger
+ addPixmap(pixmap.scaled(m_buttonWidth, m_buttonHeight, Qt::KeepAspectRatio, Qt::FastTransformation));
+}
+
+void MapButton::draw(QPainter *painter, int x, int y)
+{
+ paint(painter, x, y, m_buttonWidth, m_buttonHeight, NULL, m_buttonMode);
+}
+
+void MapButton::setMode(QIcon::Mode mode)
+{
+ m_buttonMode = mode;
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@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 MAPBUTTON_H
+#define MAPBUTTON_H
+
+#include <QIcon>
+#include <QString>
+#include <QPainter>
+
+class MapButton : public QIcon
+{
+public:
+ MapButton(QString fileName);
+ void draw(QPainter *painter, int x, int y);
+ void setMode(QIcon::Mode mode);
+
+private:
+ QIcon::Mode m_buttonMode;
+ int m_buttonWidth;
+ int m_buttonHeight;
+};
+
+#endif // MAPBUTTON_H
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_LEVEL = MIN_MAP_SCENE_NORMAL_LEVEL
+ + MAX_MAP_ZOOM_LEVEL + 2; ///< Zepth of zoom panel (Z-axis)
+static const int MAP_ZOOM_PANEL_BUTTON_SIZE = 74; ///< Size of a zoom panel button
+
const qreal MAX_LATITUDE = 85.05112877980659237802; ///< Maximum latitude value
const qreal MIN_LATITUDE = -MAX_LATITUDE; ///< Minimum latitude value
const qreal MIN_LONGITUDE = -180.0; ///< Minimum longitude value
Sami Rämö - sami.ramo@ixonos.com
Jussi Laitinen - jussi.laitinen@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
connect(this, SIGNAL(fetchImage(QUrl)), m_mapFetcher, SLOT(fetchMapImage(QUrl)));
connect(m_mapFetcher, SIGNAL(mapImageReceived(QUrl,QPixmap)), this,
SLOT(mapImageReceived(QUrl, QPixmap)));
+
+ m_mapZoomPanel = new MapZoomPanel(NULL, MAP_ZOOM_PANEL_POSITION_X, MAP_ZOOM_PANEL_POSITION_Y);
+ m_mapScene->addItem(m_mapZoomPanel);
+ connect(m_mapZoomPanel, SIGNAL(zoomInPressed()), this, SLOT(zoomIn()));
+ connect(m_mapZoomPanel, SIGNAL(zoomOutPressed()), this, SLOT(zoomOut()));
}
void MapEngine::init()
parseURL(url, zoom, x, y);
QString hashKey = tilePath(zoom, x, y);
- if (!m_mapTilesInScene.contains(hashKey)) {
+ if (!m_mapScene->isTileInScene(hashKey)) {
MapTile *mapTile = new MapTile();
mapTile->setZoomLevel(zoom);
mapTile->setTileNumber(QPoint(x, y));
mapTile->setPixmap(pixmap);
- m_mapTilesInScene.insert(hashKey, mapTile);
- m_mapScene->addMapTile(mapTile);
+ m_mapScene->addTile(mapTile, hashKey);
- removeStackedTiles(mapTile);
+ m_mapScene->removeStackedTiles(mapTile, viewRect());
}
}
return QRect(topLeftX, topLeftY, gridWidth, gridHeight);
}
+void MapEngine::alignImmovableItems(QPoint viewTopLeft)
+{
+ m_mapZoomPanel->setPos(viewTopLeft);
+
+// qDebug() << __PRETTY_FUNCTION__ << "viewTopLeft:" << viewTopLeft;
+}
+
void MapEngine::setLocation(QPoint sceneCoordinate)
{
- //qDebug() << __PRETTY_FUNCTION__;
+// qDebug() << __PRETTY_FUNCTION__;
m_sceneCoordinate = sceneCoordinate;
emit locationChanged(m_sceneCoordinate);
if (isCenterTileChanged(sceneCoordinate)) {
getTiles(sceneCoordinate);
- removeTilesOutOfView();
+ m_mapScene->removeOutOfViewTiles(viewRect());
}
}
QUrl url = buildURL(m_zoomLevel, QPoint(tileX, tileY));
- if (!m_mapTilesInScene.contains(tilePath(m_zoomLevel, tileX, tileY)))
+ if (!m_mapScene->isTileInScene(tilePath(m_zoomLevel, tileX, tileY)))
emit fetchImage(url);
}
}
}
-void MapEngine::removeTile(MapTile *tile)
+QRect MapEngine::viewRect()
{
- //qDebug() << __PRETTY_FUNCTION__;
-
- if (tile) {
- m_mapTilesInScene.remove(tilePath(tile->zoomLevel(), tile->tileNumber().x(),
- tile->tileNumber().y()));
- m_mapScene->removeItem(tile);
- delete tile;
- }
-}
-
-void MapEngine::removeTilesOutOfView()
-{
- //qDebug() << __PRETTY_FUNCTION__;
-
QPoint topLeft = convertTileNumberToSceneCoordinate(m_zoomLevel, m_viewGrid.topLeft());
QPoint bottomRight = convertTileNumberToSceneCoordinate(m_zoomLevel, m_viewGrid.bottomRight()
+ QPoint(1, 1));
- qreal width = bottomRight.x() - topLeft.x();
- qreal height = bottomRight.y() - topLeft.y();
-
- QList<QGraphicsItem *> viewTiles = m_mapScene->items(topLeft.x(), topLeft.y(), width, height,
- Qt::ContainsItemBoundingRect);
- QList<QGraphicsItem *> allTiles = m_mapScene->items();
-
- //Remove tiles which are in view from allTiles
- foreach (QGraphicsItem *tile, viewTiles)
- allTiles.removeOne(tile);
-
- //Remove tiles out of view
- foreach (QGraphicsItem *tile, allTiles) {
- MapTile *tileToRemove = dynamic_cast<MapTile *>(tile);
- removeTile(tileToRemove);
- }
-}
-
-void MapEngine::removeStackedTiles(MapTile *newTile)
-{
- //qDebug() << __PRETTY_FUNCTION__;
-
- QRectF newTileSceneRect = newTile->sceneBoundingRect();
- QList<QGraphicsItem *> collidingTiles = newTile->collidingItems(Qt::IntersectsItemBoundingRect);
-
- //Loop all items under new tile
- foreach (QGraphicsItem *collidingTile, collidingTiles) {
-
- QRectF collidingTileSceneRect = collidingTile->sceneBoundingRect();
-
- //If new tile covers the tile under, remove the tile
- if (newTileSceneRect.contains(collidingTileSceneRect)) {
- MapTile *tile = dynamic_cast<MapTile *>(collidingTile);
- removeTile(tile);
- }
-
- else {
- //Get tiles below removal candidate
- QList<QGraphicsItem *> stackedTiles = m_mapScene->items(collidingTileSceneRect,
- Qt::ContainsItemBoundingRect);
- QRectF combined = combineTiles(collidingTile, stackedTiles);
-
- //If combined tiles below removal candidate covers removal candidate, remove it
- if (combined.contains(collidingTileSceneRect)) {
- MapTile *tile = dynamic_cast<MapTile *>(collidingTile);
- removeTile(tile);
- }
- }
- }
-}
-
-QRectF MapEngine::combineTiles(QGraphicsItem *parentTile,
- const QList<QGraphicsItem*> &stackedTiles)
-{
- QRectF combined;
- int count = 0;
-
- foreach (QGraphicsItem *stackedTile, stackedTiles) {
- if (stackedTile != parentTile) {
- count++;
- QRectF stackedTileSceneRect = stackedTile->sceneBoundingRect();
- combined = combined.united(stackedTileSceneRect);
- }
- }
-
- if (count < 4)
- combined = QRectF();
-
- return combined;
+ return QRect(topLeft, bottomRight);
}
void MapEngine::viewResized(const QSize &size)
{
m_viewSize = size;
getTiles(m_sceneCoordinate);
- removeTilesOutOfView();
+ m_mapScene->removeOutOfViewTiles(viewRect());
}
-void MapEngine::zoomIn()
+void MapEngine::viewZoomInFinished()
{
qDebug() << __PRETTY_FUNCTION__;
+ m_mapScene->removeOutOfViewTiles(viewRect());
+}
+
+void MapEngine::zoomIn()
+{
+// qDebug() << __PRETTY_FUNCTION__;
if (m_zoomLevel < MAX_MAP_ZOOM_LEVEL) {
m_zoomLevel++;
emit zoomLevelChanged(m_zoomLevel);
- setTilesDrawingLevels();
+ m_mapScene->setTilesDrawingLevels(m_zoomLevel);
getTiles(m_sceneCoordinate);
-
- // remove unused tiles after zooming is done
- QTimer::singleShot(ZOOM_TIME*2, this, SLOT(removeTilesOutOfView()));
}
}
void MapEngine::zoomOut()
{
- qDebug() << __PRETTY_FUNCTION__;
+// qDebug() << __PRETTY_FUNCTION__;
if (m_zoomLevel > MIN_MAP_ZOOM_LEVEL) {
m_zoomLevel--;
emit zoomLevelChanged(m_zoomLevel);
- setTilesDrawingLevels();
+ m_mapScene->setTilesDrawingLevels(m_zoomLevel);
getTiles(m_sceneCoordinate);
}
}
-void MapEngine::setTilesDrawingLevels()
-{
- //qDebug() << __PRETTY_FUNCTION__ << "m_zoomLevel:" << m_zoomLevel;
-
- QList<QGraphicsItem *> items = m_mapScene->items();
-
- for (int i = 0; i < items.size(); ++i) {
- MapTile *item = dynamic_cast<MapTile *>(items.at(i));
- if (item)
- item->setSceneLevel(m_zoomLevel);
- }
-
-}
-
QString MapEngine::tilePath(int zoomLevel, int x, int y)
{
QString tilePathString(QString::number(zoomLevel) + "/");
return tilePathString;
}
-void MapEngine::scalingFactorChanged(qreal scaleFactor)
-{
- qDebug() << __PRETTY_FUNCTION__;
- Q_UNUSED(scaleFactor);
-}
-
QPoint MapEngine::convertSceneCoordinateToTileNumber(int zoomLevel, QPoint sceneCoordinate)
{
int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
Sami Rämö - sami.ramo@ixonos.com
Jussi Laitinen - jussi.laitinen@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include "mapfetcher.h"
#include "mapscene.h"
#include "maptile.h"
+#include "mapzoompanel.h"
/**
* @brief Map engine
* converting coordinates.
* @author Sami Rämö - sami.ramo (at) ixonos.com
* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
+* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class MapEngine : public QObject
{
MapEngine(QObject *parent = 0);
/*******************************************************************************
- * CLASS SPECIFIC MEMBER FUNCTIONS AND SLOTS
+ * MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
+public:
/**
* @brief Convert latitude and longitude to scene coordinates.
*
*/
QGraphicsScene* scene();
+ /**
+ * @brief Return tile path created from tile values.
+ *
+ * @param zoomLevel tile's zoom level
+ * @param x tile's x value
+ * @param y tile's y value
+ * @return QString tile path
+ */
+ static QString tilePath(int zoomLevel, int x, int y);
+
public slots:
/**
+ * @brief Slot for immovable scene items position correction
+ *
+ * @param viewTopLeft Scene coordinate of the viewport top left corner
+ */
+ void alignImmovableItems(QPoint viewTopLeft);
+
+ /**
* @brief Slot for setting current view location
*
* Emits locationChanged signal.
/**
* @brief Get new tiles.
*
- * Calculates which tiles has to be fetched.
+ * Calculates which tiles has to be fetched. Does emit fetchImage for tiles which
+ * aren't already in the scene.
* @param sceneCoordinate scene's center coordinate
*/
void getTiles(QPoint sceneCoordinate);
bool isCenterTileChanged(QPoint sceneCoordinate);
/**
- * @brief Combine tiles' rectangles to one rectangle.
- *
- * @param parentTile parent tile not to combine
- * @param stackedTiles tiles to combine
- * @return QRectF resulting rectangle
- */
- QRectF combineTiles(QGraphicsItem *parentTile, const QList<QGraphicsItem*> &stackedTiles);
-
- /**
* @brief Parse given URL to zoom, x and y values. Parsed values are
* placed in variables given as parameters.
*
void parseURL(const QUrl &url, int &zoom, int &x, int &y);
/**
- * @brief Remove tiles which are stacked.
- *
- * Iterate through tiles which are under this map tile and remove obscured
- * tiles.
- *
- * @param newTile new tile covering old tiles
- */
- void removeStackedTiles(MapTile *newTile);
-
- /**
- * @brief Remove tile.
- *
- * Removes tile from scene and list of current tiles in scene.
- * @param tile MapTile to remove
- */
- void removeTile(MapTile *tile);
-
- /**
- * @brief Set drawing order of all tiles in the scene
- *
- * Check MapTile::setSceneLevel for more information.
- */
- void setTilesDrawingLevels();
-
- /**
* @brief Calculate maximum value for tile in this zoom level.
*
* @param zoomLevel zoom level
int tileMaxValue(int zoomLevel);
/**
- * @brief Return tile path created from tile values.
+ * @brief Returns the current view rect including margins
*
- * @param zoomLevel tile's zoom level
- * @param x tile's x value
- * @param y tile's y value
- * @return QString tile path
+ * @return Current view rect
*/
- QString tilePath(int zoomLevel, int x, int y);
+ QRect viewRect();
private slots:
/**
void mapImageReceived(const QUrl &url, const QPixmap &pixmap);
/**
- * @brief Remove tiles which are out of view bounds.
- */
- void removeTilesOutOfView();
-
- /**
- * @brief Slot for view scaling factor change events
+ * @brief Slot for actions after view zoom is finished
*
- * Can be used to trigger scaling of zoom buttons, friend indicators and other
- * MapScene elements which should retain their visual size
- * @param scaleFactor view's scale factor
+ * Does run removeOutOfViewTiles
*/
- void scalingFactorChanged(qreal scaleFactor);
+ void viewZoomInFinished();
/**
* @brief Slot for zooming in
* DATA MEMBERS
******************************************************************************/
private:
- QPoint m_centerTile; ///< Current center tile
MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
MapScene *m_mapScene; ///< Scene for map tiles
- QHash<QString, MapTile *> m_mapTilesInScene; ///< List of map tiles in map scene
- QPoint m_sceneCoordinate; ///< Current center coordinate
- QRect m_viewGrid; ///< Current grid of tiles in view
- QSize m_viewSize; ///< Current view size
+ MapZoomPanel *m_mapZoomPanel; ///< Toolbar for zoom buttons
+ QPoint m_centerTile; ///< Current center tile
+ QPoint m_sceneCoordinate; ///< Current center coordinate
+ QRect m_viewGrid; ///< Current grid of tiles in view (includes margin)
+ QSize m_viewSize; ///< Current view size
int m_zoomLevel; ///< Current zoom level
};
setSceneRect(0, 0, maxPixelsX, maxPixelsY);
}
-void MapScene::addMapTile(MapTile *mapTile)
+void MapScene::addTile(MapTile *mapTile, QString hashKey)
{
+ m_mapTilesInScene.insert(hashKey, mapTile);
addItem(mapTile);
}
+
+bool MapScene::isTileInScene(QString hashKey)
+{
+ return m_mapTilesInScene.contains(hashKey);
+}
+
+void MapScene::removeOutOfViewTiles(QRect viewRect)
+{
+// qDebug() << __PRETTY_FUNCTION__;
+
+ QList<QGraphicsItem *> viewTiles = items(viewRect, Qt::ContainsItemBoundingRect);
+ QList<QGraphicsItem *> allTiles = items();
+
+// qDebug() << __PRETTY_FUNCTION__ << "All tiles:" << allTiles.count();
+// qDebug() << __PRETTY_FUNCTION__ << "Tiles in view area:" << viewTiles.count();
+
+ //Remove tiles which are in view from allTiles
+ foreach (QGraphicsItem *tile, viewTiles)
+ allTiles.removeOne(tile);
+
+
+ //Remove tiles out of view
+ foreach (QGraphicsItem *tile, allTiles) {
+ MapTile *tileToRemove = dynamic_cast<MapTile *>(tile);
+ if (tileToRemove)
+ removeTile(tileToRemove);
+ }
+}
+
+void MapScene::removeStackedTiles(MapTile *newTile, QRect viewRect)
+{
+// qDebug() << __PRETTY_FUNCTION__;
+
+ QRectF newTileSceneRect = newTile->sceneBoundingRect();
+
+ //Loop all items under new tile
+ QList<QGraphicsItem *> collidingTiles = newTile->collidingItems(Qt::IntersectsItemBoundingRect);
+// qDebug() << __PRETTY_FUNCTION__ << "Colliding tiles before:" << collidingTiles.count();
+ foreach (QGraphicsItem *collidingTile, collidingTiles) {
+
+
+ QRectF collidingTileSceneRect = collidingTile->sceneBoundingRect();
+
+ // remove tile if it is obscured by new tile
+ if (newTileSceneRect.contains(collidingTileSceneRect)) {
+ MapTile *tile = dynamic_cast<MapTile *>(collidingTile);
+ if (tile)
+ removeTile(tile);
+ }
+ else {
+ // remove tile if it is obscured in the view area
+ QRect collidingTileViewableArea =
+ collidingTileSceneRect.intersected(viewRect).toRect();
+ if (collidingTile->isObscured(collidingTileViewableArea)) {
+ qDebug() << __PRETTY_FUNCTION__ << "Deleting obscured item";
+ MapTile *tile = dynamic_cast<MapTile *>(collidingTile);
+ if (tile)
+ removeTile(tile);
+ }
+ }
+ }
+// qDebug() << __PRETTY_FUNCTION__ << "All tiles after:"
+// << newTile->collidingItems(Qt::IntersectsItemBoundingRect).count();
+}
+
+
+void MapScene::removeTile(MapTile *tile)
+{
+// qDebug() << __PRETTY_FUNCTION__;
+
+ if (tile) {
+ m_mapTilesInScene.remove(MapEngine::tilePath(tile->zoomLevel(),
+ tile->tileNumber().x(),
+ tile->tileNumber().y()));
+ removeItem(tile);
+ delete tile;
+ }
+}
+
+void MapScene::setTilesDrawingLevels(int zoomLevel)
+{
+// qDebug() << __PRETTY_FUNCTION__ << "m_zoomLevel:" << m_zoomLevel;
+
+ QList<QGraphicsItem *> allItems = items();
+
+ for (int i = 0; i < allItems.size(); ++i) {
+ MapTile *item = dynamic_cast<MapTile *>(allItems.at(i));
+ if (item)
+ item->setSceneLevel(zoomLevel);
+ }
+}
MapScene(QObject *parent = 0);
/*******************************************************************************
- * CLASS SPECIFIC MEMBER FUNCTIONS AND SLOTS
+ * MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
+public:
/**
* @brief Add MapTile item to scene
*
* @param mapTile Map tile item to be added
+ * @param hashKey Hash key for the tile
*/
- void addMapTile(MapTile *mapTile);
+ void addTile(MapTile *mapTile, QString hashKey);
+
+ /**
+ * @brief Returns if tile mathcing hash key is already in the scene
+ *
+ * @param hashKey
+ * @return True if tile was in the scene, otherwise false
+ */
+ bool isTileInScene(QString hashKey);
+
+ /**
+ * @brief Remove tiles which are out of view bounds.
+ *
+ * @param viewRect Current view rect
+ */
+ void removeOutOfViewTiles(QRect viewRect);
+
+ /**
+ * @brief Remove tiles which are stacked.
+ *
+ * Iterate through tiles which are under this map tile and remove obscured
+ * tiles.
+ *
+ * @param newTile new tile covering old tiles
+ * @param viewRect Current view rect
+ */
+ void removeStackedTiles(MapTile *newTile, QRect viewRect);
+
+ /**
+ * @brief Remove tile.
+ *
+ * Removes tile from scene and list of current tiles in scene.
+ * @param tile MapTile to remove
+ */
+ void removeTile(MapTile *tile);
+
+ /**
+ * @brief Set drawing order of all tiles in the scene
+ *
+ * Check MapTile::setSceneLevel for more information.
+ * @param zoomLevel Current zoom level
+ */
+ void setTilesDrawingLevels(int zoomLevel);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ QHash<QString, MapTile *> m_mapTilesInScene; ///< List of map tiles in map scene
};
#endif // MAPSCENE_H
void MapView::timerEvent(QTimerEvent *event)
{
if (event->timerId() == m_timerID) {
+ bool finished = false;
qreal scaleFactor = currentScale();
// qDebug() << __PRETTY_FUNCTION__
if (fabs(m_zoomTargetScale - scaleFactor) <= fabs(m_zoomScaleDelta)) {
scaleFactor = m_zoomTargetScale;
killTimer(event->timerId());
+ finished = true;
}
else {
scaleFactor += m_zoomScaleDelta;
QTransform transform;
transform.scale(scaleFactor, scaleFactor);
- emit scalingFactorChanged(scaleFactor);
setTransform(transform);
+ emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
+
+ if (finished && m_zoomScaleDelta > 0)
+ emit viewZoomInFinished();
}
}
m_scenePosition += m_mousePosition - mapToScene(event->pos()).toPoint();
emit viewScrolled(m_scenePosition);
- //qDebug() << __PRETTY_FUNCTION__ << "m_scenePosition" << m_scenePosition;
+// qDebug() << __PRETTY_FUNCTION__ << "m_scenePosition:" << m_scenePosition;
m_mousePosition = mapToScene(event->pos()).toPoint();
+ emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
}
void MapView::mousePressEvent(QMouseEvent *event)
{
+ QGraphicsView::mousePressEvent(event);
+
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;
void MapView::resizeEvent(QResizeEvent *event)
{
- //qDebug() << "Resize event: " << event->size();
+// qDebug() << "Resize event: " << event->size();
emit viewResized(event->size());
+ emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
}
class MapView : public QGraphicsView
{
Q_OBJECT
+
public:
/**
* @brief Constructor
******************************************************************************/
signals:
/**
- * @brief Signal for view scale factor change events
- *
- * Can be used to trigger scaling of zoom buttons, friend indicators and other
- * MapScene elements which should retain their visual size
- * @param scaleFactor view's scale factor
- */
- void scalingFactorChanged(qreal scaleFactor);
-
- /**
* @brief Signal for view resize events.
*
* Signal is emitted when view has been resized.
*/
void viewScrolled(QPoint sceneCoordinate);
+ /**
+ * @brief Signal for informing that zooming in is finished
+ *
+ */
+ void viewZoomInFinished();
+
+ /**
+ * @brief Signal for updating view content
+ *
+ * Signal is emitted when view content needs an update.
+ * @param viewTopLeft Scene coordinate of the viewport top left corner
+ */
+ void viewContentChanged(QPoint viewTopLeft);
+
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@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 "mapcommon.h"
+#include "mapzoompanel.h"
+
+MapZoomPanel::MapZoomPanel(QGraphicsItem *parent, int x, int y) : QGraphicsItem(parent)
+{
+ m_x = x;
+ m_y = y;
+ m_width = MAP_ZOOM_PANEL_BUTTON_SIZE;
+ m_height = MAP_ZOOM_PANEL_BUTTON_SIZE * 2;
+
+ m_zoomInBtn = new MapButton(":/res/images/zoom_in.png");
+ m_zoomOutBtn = new MapButton(":/res/images/zoom_out.png");
+
+ setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ setZValue(static_cast<qreal>(MAP_ZOOM_PANEL_LEVEL));
+}
+
+QRectF MapZoomPanel::boundingRect() const
+{
+ return QRectF(m_x, m_y, m_width, m_height);
+}
+
+void MapZoomPanel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ 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);
+}
+
+void MapZoomPanel::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ if ( event->pos().y() < (m_y + 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)
+{
+ Q_UNUSED(event);
+
+ m_zoomInBtn->setMode(QIcon::Normal);
+ m_zoomOutBtn->setMode(QIcon::Normal);
+
+ if ( event->pos().y() < (m_y + MAP_ZOOM_PANEL_BUTTON_SIZE) )
+ emit zoomInPressed();
+ else
+ emit zoomOutPressed();
+
+ update();
+
+// qDebug() << __PRETTY_FUNCTION__;
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@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 MAPZOOMPANEL_H
+#define MAPZOOMPANEL_H
+
+#include <QRectF>
+#include <QWidget>
+#include <QPainter>
+#include <QGraphicsItem>
+#include <QStyleOptionGraphicsItem>
+#include <QGraphicsSceneMouseEvent>
+
+#include "mapbutton.h"
+
+class MapZoomPanel : public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+
+public:
+ MapZoomPanel(QGraphicsItem *parent = 0, int x = 0, int y = 0);
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+signals:
+ void zoomInPressed();
+ void zoomOutPressed();
+
+private:
+ MapButton *m_zoomInBtn;
+ MapButton *m_zoomOutBtn;
+
+ qreal m_x;
+ qreal m_y;
+ qreal m_width;
+ qreal m_height;
+};
+
+#endif // MAPZOOMPANEL_H
map/mapscene.cpp \
map/maptile.cpp \
map/mapfetcher.cpp \
+ map/mapzoompanel.cpp \
+ map/mapbutton.cpp \
ui/pixmap.cpp \
ui/infotab.cpp \
ui/updatelocation/updatelocationdialog.cpp \
ui/friendlistitemdelegate.cpp \
ui/friendlistitem.cpp \
engine/engine.cpp \
- user/user.cpp
+ user/user.cpp \
+ ui/buttonitem.cpp \
+ ui/situareuser.cpp
HEADERS += ui/mainwindow.h \
ui/mapviewscreen.h \
ui/listviewscreen.h \
map/maptile.h \
map/mapfetcher.h \
map/mapcommon.h \
+ map/mapzoompanel.h \
+ map/mapbutton.h \
ui/pixmap.h \
ui/infotab.h \
ui/updatelocation/updatelocationdialog.h \
ui/friendlistitemdelegate.h \
ui/friendlistitem.h \
engine/engine.h \
- user/user.h
-
+ user/user.h \
+ ui/buttonitem.h \
+ ui/situareuser.h
QT += network \
webkit
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@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 <QPainter>
+#include "buttonitem.h"
+
+const int ROUNDNESS = 4;
+
+ButtonItem::ButtonItem(QWidget *parent)
+ : QPushButton(parent)
+{
+
+}
+
+void ButtonItem::paintEvent(QPaintEvent *aPaintEvent)
+{
+ //Look and feel settings
+
+ QRect widgetRect = this->rect();
+ QPainter painter(this);
+ painter.save();
+
+ painter.setRenderHint(QPainter::Antialiasing);
+ QPainterPath roundedRect;
+ roundedRect.addRoundedRect(1,1,widgetRect.width()-2, widgetRect.height()-2,ROUNDNESS,ROUNDNESS);
+
+ painter.setClipPath(roundedRect);
+ QRegion maskRegion = painter.clipRegion();
+
+ setMask(maskRegion);
+ QIcon tmpIcon = this->icon();
+ QSize visibleArea = this->iconSize();
+ QPixmap pixmap = tmpIcon.pixmap(visibleArea);
+ painter.drawPixmap(QPointF(0,0),pixmap);
+ painter.restore();
+
+}
+
+QSize ButtonItem::sizeHint() const
+{
+ return this->iconSize();
+}
+
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@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 BUTTONITEM_H
+#define BUTTONITEM_H
+
+#include <QPushButton>
+
+/**
+* @brief ButtonItem class.
+* Custom button item for Situare buttons
+* @author Jukka Saastamoinen
+*/
+
+class ButtonItem : public QPushButton
+{
+ Q_OBJECT
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
+ ButtonItem(QWidget *parent = 0);
+
+/*******************************************************************************
+* BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+*******************************************************************************/
+protected:
+ /**
+ * @brief This function is called when the widget is drawn
+ *
+ * @param aPaintEvent Pointer to paint event
+ */
+ void paintEvent(QPaintEvent *aPaintEvent);
+ /**
+ * @brief This function returns the preferred size of the button
+ * for the layout using it.
+ *
+ * @return QSize Size of the button
+ */
+ QSize sizeHint() const;
+
+};
+
+#endif // BUTTONITEM_H
*/
#include "infotab.h"
+#include "buttonitem.h"
+#include <QDebug>
+
+const int RGB_R = 152;
+const int RGB_G = 152;
+const int RGB_B = 152;
+const int GRADIENT_START_R = 49;
+const int GRADIENT_START_G = 52;
+const int GRADIENT_START_B = 57;
+const int GRADIENT_STOP_R = 82;
+const int GRADIENT_STOP_G = 73;
+const int GRADIENT_STOP_B = 74;
+const int ROUNDNESS = 9;
+const int SIZE_X = 280;
+const int SIZE_Y = 280;
+const int BIG_FONT = 18;
+const int SMALL_FONT = 13;
+const int RECT_WIDTH_OFFSET = 2;
+const int RECT_HEIGHT_OFFSET = 2;
InfoTab::InfoTab(QWidget *parent)
: QWidget(parent, Qt::FramelessWindowHint)
{
- m_layout = new QGridLayout(this);
- m_userPicture = new QLabel;
- m_userNameLabel = new QLabel;
- m_messageLabel = new QLabel;
- m_addressLabel = new QLabel;
- m_timeLabel = new QLabel;
- QLabel *m_clockLabel = new QLabel;
- QLabel *m_envelopeLabel = new QLabel;
- QLabel *m_compassLabel = new QLabel;
- QToolButton *updateFriendsButton = new QToolButton;
- QToolButton *updateStatusMessageButton = new QToolButton;
-
- updateFriendsButton->setIcon(QIcon(QPixmap(":/res/images/reload_icon.png")));
- updateStatusMessageButton->setIcon(QIcon(QPixmap(":/res/images/sendPosition_icon.png")));
-
- m_clockLabel->setPixmap(QPixmap(":/res/images/clock_small.png"));
- m_envelopeLabel->setPixmap(QPixmap(":/res/images/list_small.png"));
- m_compassLabel->setPixmap(QPixmap(":/res/images/compas_small.png"));
- m_layout->addWidget(m_userPicture,0,0,4,1);
- m_layout->addWidget(m_userNameLabel,0,2,1,2);
- m_layout->addWidget(m_clockLabel,1,1,1,1);
- m_layout->addWidget(m_envelopeLabel,2,1,1,1);
- m_layout->addWidget(m_compassLabel,3,1,1,1);
- m_layout->addWidget(m_timeLabel,1,2,1,1);
- m_layout->addWidget(m_messageLabel,2,2,1,1);
- m_layout->addWidget(m_addressLabel,3,2,1,1);
- m_layout->addWidget(updateFriendsButton,0,3,2,1);
- m_layout->addWidget(updateStatusMessageButton,1,3,2,1);
+ widget = new QWidget(this);
+ verticalLayout = new QVBoxLayout(widget);
+ horizontalLayout = new QHBoxLayout(widget);
+ m_layout = new QGridLayout(widget);
+ situUser = new SituareUser(widget);
+ situUser->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+ situUser->setMargin(1);
+
+ //Tex color settings
+ QPalette textPalette;
+ QColor textColor(RGB_R,RGB_G,RGB_B);
+ textPalette.setColor(QPalette::WindowText,textColor);
+ m_userNameLabel = new QLabel(widget);
+ m_userNameLabel->setFont(QFont( "Nokia Sans", BIG_FONT, QFont::Normal));
+
+ m_messageLabel = new QLabel(widget);
+ m_messageLabel->setFont(QFont( "Nokia Sans", SMALL_FONT, QFont::Normal));
+ m_messageLabel->setPalette(textPalette);
+
+ m_addressLabel = new QLabel(widget);
+ m_addressLabel->setFont(QFont( "Nokia Sans", SMALL_FONT, QFont::Normal));
+ m_addressLabel->setPalette(textPalette);
+
+ m_timeLabel = new QLabel(widget);
+ m_timeLabel->setFont(QFont( "Nokia Sans", 13, QFont::Normal));
+ m_timeLabel->setPalette(textPalette);
+
+ m_clockLabel = new QLabel(widget);
+ m_clockLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
+ m_envelopeLabel = new QLabel(widget);
+ m_envelopeLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
+ m_compassLabel = new QLabel(widget);
+ m_compassLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
+ ButtonItem *updateFriendsButton = new ButtonItem(widget);
+ ButtonItem *updateStatusMessageButton = new ButtonItem(widget);
+
+ updateFriendsButton->setIcon(QIcon(QPixmap(":/res/images/refresh.png")));
+ updateStatusMessageButton->setIcon(QIcon(QPixmap(":/res/images/send_position.png")));
+
+ m_clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
+ m_envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
+ m_compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
+ m_layout->addWidget(situUser,0,0,1,2,Qt::AlignHCenter);
+ m_layout->addWidget(m_userNameLabel,1,1,1,2);
+ m_layout->addWidget(m_clockLabel,3,0,1,1);
+ m_layout->addWidget(m_envelopeLabel,2,0,1,1);
+ m_layout->addWidget(m_compassLabel,4,0,1,1);
+ m_layout->addWidget(m_timeLabel,3,1,1,1);
+ m_layout->addWidget(m_messageLabel,2,1,1,1);
+ m_layout->addWidget(m_addressLabel,4,1,1,1);
+
+ verticalLayout->addLayout(m_layout);
+ horizontalLayout->setSpacing(0);
+ horizontalLayout->addWidget(updateFriendsButton);
+ horizontalLayout->addWidget(updateStatusMessageButton);
+
+ verticalLayout->addLayout(horizontalLayout);
connect(updateStatusMessageButton,SIGNAL(clicked()),this,SLOT(messageUpdate()));
connect(updateFriendsButton,SIGNAL(clicked()),this,SLOT(updateFriendsStatus()));
}
-InfoTab::~InfoTab()
-{
- if (m_userPicture)
- delete m_userPicture;
- if (m_userNameLabel)
- delete m_userNameLabel;
- if (m_messageLabel)
- delete m_messageLabel;
- if (m_addressLabel)
- delete m_addressLabel;
- if (m_timeLabel)
- delete m_timeLabel;
- if (m_layout)
- delete m_layout;
- m_userPicture=NULL;
- m_userNameLabel=NULL;
- m_messageLabel=NULL;
- m_addressLabel=NULL;
- m_timeLabel=NULL;
- m_layout=NULL;
-}
-
void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
{
+
+ QRect widgetRect = this->rect();
+
+ //Gradient
+ QLinearGradient linearGrad(QPointF(widgetRect.height(), widgetRect.width()/2),
+ QPointF(widgetRect.width()/2,0));
+ linearGrad.setColorAt(0, QColor::fromRgb(GRADIENT_START_R,GRADIENT_START_G,GRADIENT_START_B));
+ linearGrad.setColorAt(1, QColor::fromRgb(GRADIENT_STOP_R,GRADIENT_STOP_G,GRADIENT_STOP_B));
+
//Look and feel settings
QPalette qpalette;
- QColor myColor(Qt::black);
- myColor.setAlpha(50);
- qpalette.setColor(QPalette::Background,myColor);
+ QBrush brush(linearGrad);
+ qpalette.setBrush(QPalette::Window,brush);
setPalette(qpalette);
- int roundness(6);
- QRect widgetRect = this->rect();
QPainter painter(this);
+
painter.save();
painter.setRenderHint(QPainter::Antialiasing);
QPainterPath roundedRect;
- roundedRect.addRoundedRect(1,1,widgetRect.width() - 2, widgetRect.height()-2,roundness,roundness);
+ roundedRect.addRoundedRect(1,1,widgetRect.width()-RECT_WIDTH_OFFSET,
+ widgetRect.height()-RECT_HEIGHT_OFFSET,ROUNDNESS,ROUNDNESS);
painter.setClipPath(roundedRect);
QRegion maskRegion = painter.clipRegion();
setMask(maskRegion);
- painter.fillPath(roundedRect,QBrush(myColor));
+ painter.fillPath(roundedRect,QBrush(brush));
painter.restore();
}
+QSize InfoTab::sizeHint() const
+{
+ QSize size(SIZE_X,SIZE_Y);
+ return size;
+}
+
void InfoTab::setAvatar(const QPixmap &avat)
{
m_avatar = avat;
- m_userPicture->setPixmap(m_avatar);
+ situUser->setPixmap(m_avatar);
}
void InfoTab::setUserName(const QString &usernam)
#include <QtGui>
#include <QWidget>
+#include "situareuser.h"
/**
* @brief InfoTab class.
class InfoTab : public QWidget
{
Q_OBJECT
-protected:
- /**
- * @brief This function is called when the widget is drawn
- *
- * @param aPaintEvent Pointer to paint event
- */
- void paintEvent(QPaintEvent *aPaintEvent);
public:
/**
* @brief Constructor
* @param parent Parent
*/
InfoTab(QWidget *parent=0);
+
+/*******************************************************************************
+* BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+*******************************************************************************/
+protected:
/**
+ * @brief This function is called when the widget is drawn
*
- * @brief Destructor
+ * @param aPaintEvent Pointer to paint event
*/
- ~InfoTab();
+ void paintEvent(QPaintEvent *aPaintEvent);
+ QSize sizeHint() const;
public slots:
/**
* @brief Sets the users current address
*/
void launchUpdateFriendsStatus();
private:
- QLabel *m_userPicture; ///< Shows the user's avatar
- QLabel *m_userNameLabel; ///< Shows the user's name
- QLabel *m_messageLabel; ///< Shows the Situare message icon
QLabel *m_addressLabel; ///< Shows the Situare address icon
+ QLabel *m_messageLabel; ///< Shows the Situare message icon
QLabel *m_timeLabel; ///< Shows the Situare time icon
- QGridLayout *m_layout; ///< Layout for shown items
- QString m_messageText; ///< User's message
- QString m_userName; ///< User's name
+ QLabel *m_userPicture; ///< Shows the user's avatar
+ QLabel *m_userNameLabel; ///< Shows the user's name
QString m_address; ///< Address from where the new message was sent.
+ QString m_messageText; ///< User's message
QString m_time; ///< Time when the new message was sent
+ QString m_userName; ///< User's name
QPixmap m_avatar; ///< User's avatar
+ QWidget *widget; ///< Parent of all widgets.
+ SituareUser *situUser; ///< Situare user's framed picture
+ QVBoxLayout *verticalLayout;
+ QHBoxLayout *horizontalLayout;
+ QGridLayout *m_layout;
+ QLabel *m_clockLabel;
+ QLabel *m_envelopeLabel;
+ QLabel *m_compassLabel;
+
};
#endif // INFOTAB_H
#include <QtGui/QVBoxLayout>
#include <QGraphicsProxyWidget>
#include <QStateMachine>
-#include <QListView>
+#include <QtGui/QGraphicsTransform>
+#include <QtGui/QGraphicsRotation>
#include <QDebug>
#include <QScrollArea>
#include "friendlistitem.h"
#include "friendlistmodel.h"
#include "user/user.h"
+#include "situareuser.h"
+
+const int INFOTAB_Y_LOC_STATE1 = 71;
+const int INFOTAB_X_LOC_STATE2 = 59;
+const int INFOTAB_Y_LOC_STATE2 = 71;
+const int LEFTBAR_X_LOC = 0;
+const int LEFTBAR_Y_LOC = 0;
+const int SLIDING_BAR_X_LOC_STATE1 = 0;
+const int SLIDING_BAR_Y_LOC_STATE1 = 0;
+const int BACKGROUND_X_LOC_STATE1 = 400;
+const int BACKGROUND_Y_LOC_STATE1 = 0;
+const int RIGHTARROW_X_LOC_STATE1 = 9;
+const int RIGHTARROW_Y_LOC_STATE1 = 205;
+const int LEFTARROW_X_LOC_STATE1 = 9;
+const int LEFTARROW_Y_LOC_STATE1 = 205;
+const int PROXYWIDGET_X_LOC_STATE1 = 59;
+const int PROXYWIDGET_Y_LOC_STATE1 = 71;
+const int SLIDING_BAR_X_LOC_STATE2 = 376;
+const int SLIDING_BAR_Y_LOC_STATE2 = 0;
+const int BACKGROUND_X_LOC_STATE2 = 0;
+const int BACKGROUND_Y_LOC_STATE2 = 0;
+const int RIGHTARROW_X_LOC_STATE2 = 385;
+const int RIGHTARROW_Y_LOC_STATE2 = 205;
+const int LEFTARROW_X_LOC_STATE2 = 385;
+const int LEFTARROW_Y_LOC_STATE2 = 205;
+const int PROXYWIDGET_X_LOC_STATE2 = 59;
+const int PROXYWIDGET_Y_LOC_STATE2 = 71;
ListViewScreen::ListViewScreen(QWidget *parent)
: QWidget(parent)
friendListView->addWidget(item4);
friendListView->addWidget(item5);
friendListView->addWidget(item6);
-// friendListView->addWidget(new QPushButton("Hep", this));
QScrollArea *friendListScroll = new QScrollArea();
friendListScroll->setWidget(friendListView);
//DEBUG
- m_arrowbutton = new Pixmap(QPixmap(":/res/images/arrow_right.png"));
-
+ m_leftSideBar = new Pixmap(QPixmap(":/res/images/side_bar_left.png"));
+ m_slidingLeftSideBar = new Pixmap(QPixmap(":/res/images/sliding_bar_left.png"));
+ m_personalInfoBackGround = new Pixmap(QPixmap(":/res/images/personal_info_bckgrnd.png"));
+ m_arrowLeft = new Pixmap(QPixmap(":/res/images/arrow_left.png"));
+ m_arrowRight = new Pixmap(QPixmap(":/res/images/arrow_right.png"));
m_personalInfo = new InfoTab;
- m_personalInfo->setAvatar(QPixmap(":/res/images/facebook_user_64.png"));
+ m_personalInfo->setAvatar(QPixmap(":/res/images/situare_user.jpg"));
m_personalInfo->setUserName("Fred Facebook");
m_personalInfo->setMessageText("Hello Maemo Situare !");
m_personalInfo->setTime("1 hour ago");
m_personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
+ qDebug() << "InfoTab width: " << m_personalInfo->width();
+ qDebug() << "InfoTab heigth: " << m_personalInfo->height();
+ m_locationDialog = new UpdateLocationDialog(this);
m_widgetProxy = new QGraphicsProxyWidget();
m_widgetProxy->setWidget(m_personalInfo);
QGraphicsScene *scene= new QGraphicsScene(this);
- scene->setBackgroundBrush(Qt::white);
+// scene->setBackgroundBrush(Qt::white);
+ scene->addItem(m_personalInfoBackGround);
scene->addItem(m_widgetProxy);
- scene->addItem(m_arrowbutton);
- qDebug() << "Scene width: " << scene->width();
- qDebug() << "Scene heigth: " << scene->height();
+ scene->addItem(m_leftSideBar);
+ scene->addItem(m_slidingLeftSideBar);
+ scene->addItem(m_arrowRight);
+ scene->addItem(m_arrowLeft);
+ //DEBUG
+ QGraphicsProxyWidget *scrollProxy = new QGraphicsProxyWidget();
+ scrollProxy->setWidget(friendListScroll);
+ scrollProxy->setZValue(m_personalInfoBackGround->zValue() - 3);
+ scrollProxy->setMinimumSize(790, 480);
+ scene->addItem(scrollProxy);
+ scrollProxy->setPos(300, 0);
+ //DEBUG
+ m_leftSideBar->setPos(0,0);
QGraphicsView *view = new QGraphicsView(scene);
view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view->setBackgroundBrush(Qt::white);
+// view->setBackgroundBrush(Qt::white);
QStateMachine *machine = new QStateMachine(this);
machine->setInitialState(state1);
// State 1
- state1->assignProperty(m_widgetProxy,"pos",QPointF(-(m_personalInfo->width()),0));
- state1->assignProperty(m_arrowbutton,"pos",QPointF(0,(m_personalInfo->height()/4)));
+ state1->assignProperty(m_widgetProxy,"pos",QPointF(-m_personalInfo->width(),
+ INFOTAB_Y_LOC_STATE1));
+ state1->assignProperty(m_slidingLeftSideBar,"pos",
+ QPointF(SLIDING_BAR_X_LOC_STATE1,SLIDING_BAR_Y_LOC_STATE1));
+ state1->assignProperty(m_personalInfoBackGround,"pos",
+ QPointF(-BACKGROUND_X_LOC_STATE1,BACKGROUND_Y_LOC_STATE1));
+ state1->assignProperty(m_arrowRight,"pos", QPointF(RIGHTARROW_X_LOC_STATE1,
+ RIGHTARROW_Y_LOC_STATE1));
+ state1->assignProperty(m_arrowLeft,"pos", QPointF(LEFTARROW_X_LOC_STATE2,
+ LEFTARROW_Y_LOC_STATE2));
+ state1->assignProperty(m_arrowRight,"visible", true);
+ state1->assignProperty(m_arrowLeft,"visible", false);
// State 2
- state2->assignProperty(m_widgetProxy,"pos",QPointF(0,0));
- state2->assignProperty(m_arrowbutton,"pos",QPointF((m_personalInfo->width()),(m_personalInfo->height()/4)));
+ state2->assignProperty(m_widgetProxy,"pos",QPointF(INFOTAB_X_LOC_STATE2,INFOTAB_Y_LOC_STATE2));
+ state2->assignProperty(m_slidingLeftSideBar,"pos",QPointF(SLIDING_BAR_X_LOC_STATE2,
+ SLIDING_BAR_Y_LOC_STATE2));
+ state2->assignProperty(m_personalInfoBackGround,"pos",QPointF(BACKGROUND_X_LOC_STATE2,
+ BACKGROUND_Y_LOC_STATE2));
+ state2->assignProperty(m_arrowRight,"pos", QPointF(RIGHTARROW_X_LOC_STATE2,
+ RIGHTARROW_Y_LOC_STATE2));
+ state2->assignProperty(m_arrowLeft,"pos", QPointF(LEFTARROW_X_LOC_STATE2,
+ LEFTARROW_Y_LOC_STATE2));
+ state2->assignProperty(m_arrowRight,"visible", false);
+ state2->assignProperty(m_arrowLeft,"visible", true);
- m_trans1 = state1->addTransition(m_arrowbutton,SIGNAL(clicked()),state2);
+ m_trans1 = state1->addTransition(m_slidingLeftSideBar,SIGNAL(clicked()),state2);
m_anim1 = new QPropertyAnimation(m_widgetProxy,"pos");
- m_anim2 = new QPropertyAnimation(m_arrowbutton,"pos");
+ m_anim2 = new QPropertyAnimation(m_slidingLeftSideBar,"pos");
+ m_anim3 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
+ m_anim4 = new QPropertyAnimation(m_arrowRight,"pos");
+ m_anim5 = new QPropertyAnimation(m_arrowLeft,"pos");
+ m_anim6 = new QPropertyAnimation(m_arrowRight,"visible");
+ m_anim7 = new QPropertyAnimation(m_arrowLeft,"visible");
m_trans1->addAnimation(m_anim1);
m_trans1->addAnimation(m_anim2);
+ m_trans1->addAnimation(m_anim3);
+ m_trans1->addAnimation(m_anim4);
+ m_trans1->addAnimation(m_anim5);
+ m_trans1->addAnimation(m_anim6);
+ m_trans1->addAnimation(m_anim7);
- m_trans2 = state2->addTransition(m_arrowbutton,SIGNAL(clicked()),state1);
- m_anim3= new QPropertyAnimation(m_widgetProxy,"pos");
- m_anim4= new QPropertyAnimation(m_arrowbutton,"pos");
- m_trans2->addAnimation(m_anim3);
- m_trans2->addAnimation(m_anim4);
-
+ m_trans2 = state2->addTransition(m_slidingLeftSideBar,SIGNAL(clicked()),state1);
+ m_anim8 = new QPropertyAnimation(m_widgetProxy,"pos");
+ m_anim9 = new QPropertyAnimation(m_slidingLeftSideBar,"pos");
+ m_anim10 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
+ m_anim11 = new QPropertyAnimation(m_arrowRight,"pos");
+ m_anim12 = new QPropertyAnimation(m_arrowLeft,"pos");
+ m_anim13 = new QPropertyAnimation(m_arrowRight,"visible");
+ m_anim14 = new QPropertyAnimation(m_arrowLeft,"visible");
+ m_trans2->addAnimation(m_anim8);
+ m_trans2->addAnimation(m_anim9);
+ m_trans2->addAnimation(m_anim10);
+ m_trans2->addAnimation(m_anim11);
+ m_trans2->addAnimation(m_anim12);
+ m_trans2->addAnimation(m_anim13);
+ m_trans2->addAnimation(m_anim14);
machine->start();
m_vbox = new QVBoxLayout(this);
-// m_vbox->addWidget(view);
- //DEBUG
- //m_vbox->addWidget(friendListView);
- m_vbox->addWidget(friendListScroll);
- //DEBUG
+ m_vbox->addWidget(view);
+ //m_vbox->addWidget(friendListScroll);
m_vbox->setMargin(0);
- //connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
+ connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
}
ListViewScreen::~ListViewScreen()
{
- if (m_personalInfo)
- delete m_personalInfo;
- if (m_arrowbutton)
- delete m_arrowbutton;
- if (m_trans1)
- delete m_trans1;
- if (m_trans2)
- delete m_trans2;
- if (m_anim1)
- delete m_anim1;
- if (m_anim2)
- delete m_anim2;
- if (m_anim3)
- delete m_anim3;
- if (m_anim4)
- delete m_anim4;
- if (m_vbox)
- delete m_vbox;
+ delete m_personalInfo;
+ delete m_leftSideBar;
+ delete m_slidingLeftSideBar;
+ delete m_personalInfoBackGround;
+ delete m_arrowLeft;
+ delete m_arrowRight;
+ delete m_trans1;
+ delete m_trans2;
+ delete m_anim1;
+ delete m_anim2;
+ delete m_anim3;
+ delete m_anim4;
+ delete m_anim5;
+ delete m_anim6;
+ delete m_anim7;
+ delete m_anim8;
+ delete m_anim9;
+ delete m_anim10;
+ delete m_anim11;
+ delete m_anim12;
+ delete m_anim13;
+ delete m_anim14;
+ delete m_vbox;
}
void ListViewScreen::updateMessage()
{
qDebug() << __PRETTY_FUNCTION__;
-// m_locationDialog->exec();
+ m_locationDialog->exec();
}
#include <QtGui>
#include "infotab.h"
#include "pixmap.h"
-#include "user/user.h"
-
+#include "updatelocation/updatelocationdialog.h"
/**
* @brief List View class. Used for displaying List of friends
private:
QVBoxLayout *m_vbox; ///< Holds the graphics view
Pixmap *m_arrowbutton; ///< Button which reveals/hides the info tab when pressed
+ Pixmap *m_leftSideBar;
+ Pixmap *m_slidingLeftSideBar;
+ Pixmap *m_personalInfoBackGround;
+ Pixmap *m_arrowLeft;
+ Pixmap *m_arrowRight;
QGraphicsProxyWidget *m_widgetProxy; ///< Embeds InfoTab to graphics view
QAbstractTransition *m_trans1; ///< Animation transition from hidden state to visible
QAbstractTransition *m_trans2; ///< Animation transition from visible to hidden
QPropertyAnimation *m_anim2; ///< Animation for arrowbutton from hidden to visible
QPropertyAnimation *m_anim3; ///< Animation for infotab from visible to hidden
QPropertyAnimation *m_anim4; ///< Animation for arrowbutton from visible to hidden
+ QPropertyAnimation *m_anim5; ///< Animation
+ QPropertyAnimation *m_anim6; ///< Animation for arrowbutton from visible to hidden
+ QPropertyAnimation *m_anim7;
+ QPropertyAnimation *m_anim8;
+ QPropertyAnimation *m_anim9;
+ QPropertyAnimation *m_anim10;
+ QPropertyAnimation *m_anim11;
+ QPropertyAnimation *m_anim12;
+ QPropertyAnimation *m_anim13;
+ QPropertyAnimation *m_anim14;
+ UpdateLocationDialog *m_locationDialog; ///< Message dialog
};
#endif // LISTVIEWTAB_H
mapView, SLOT(centerToSceneCoordinates(QPoint)));
connect(mapEngine, SIGNAL(zoomLevelChanged(int)), mapView, SLOT(setZoomLevel(int)));
connect(mapView, SIGNAL(viewResized(QSize)), mapEngine, SLOT(viewResized(QSize)));
- connect(mapView, SIGNAL(scalingFactorChanged(qreal)),
- mapEngine, SLOT(scalingFactorChanged(qreal)));
+ connect(mapView, SIGNAL(viewContentChanged(QPoint)),
+ mapEngine, SLOT(alignImmovableItems(QPoint)));
+ connect(mapView, SIGNAL(viewZoomInFinished()), mapEngine, SLOT(viewZoomInFinished()));
QHBoxLayout *mapViewLayout = new QHBoxLayout;
//DEBUG
- QVBoxLayout *mapControlLayout = new QVBoxLayout;
- QWidget *mapControl = new QWidget(this);
- mapControl->setLayout(mapControlLayout);
- search = new QPushButton("Search", this);
- zoomOut = new QPushButton("-", this);
- zoomIn = new QPushButton("+", this);
- mapControlLayout->addWidget(&latLine);
- mapControlLayout->addWidget(&lonLine);
- mapControlLayout->addWidget(search);
- mapControlLayout->addWidget(zoomIn);
- mapControlLayout->addWidget(zoomOut);
- mapViewLayout->addWidget(mapControl);
- connect(search, SIGNAL(clicked()), this, SLOT(searchMap()));
- connect(zoomIn, SIGNAL(clicked()), mapEngine, SLOT(zoomIn()));
- connect(zoomOut, SIGNAL(clicked()), mapEngine, SLOT(zoomOut()));
+// QVBoxLayout *mapControlLayout = new QVBoxLayout;
+// QWidget *mapControl = new QWidget(this);
+// mapControl->setLayout(mapControlLayout);
+// search = new QPushButton("Search", this);
+// zoomOut = new QPushButton("-", this);
+// zoomIn = new QPushButton("+", this);
+// mapControlLayout->addWidget(&latLine);
+// mapControlLayout->addWidget(&lonLine);
+// mapControlLayout->addWidget(search);
+// mapControlLayout->addWidget(zoomIn);
+// mapControlLayout->addWidget(zoomOut);
+// mapViewLayout->addWidget(mapControl);
+// connect(search, SIGNAL(clicked()), this, SLOT(searchMap()));
+// connect(zoomIn, SIGNAL(clicked()), mapEngine, SLOT(zoomIn()));
+// connect(zoomOut, SIGNAL(clicked()), mapEngine, SLOT(zoomOut()));
//DEBUG
mapViewLayout->addWidget(mapView);
setLayout(mapViewLayout);
Q_OBJECT
public:
/**
+ * @brief Constructor
+ *
+ * @param picture Reference to the picture displayed
+ * @param parent Parent
+ */
+ Pixmap(const QPixmap &picture, QGraphicsObject *parent = 0);
+/*******************************************************************************
+* BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+*******************************************************************************/
+public:
+ /**
* @brief Bounding box of the drawed pixmap
*
* @return Rectangle shaped bounding box of the pixmap
* @param * Pointer to the widget
*/
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
-public:
- /**
- * @brief Constructor
- *
- * @param picture Reference to the picture displayed
- * @param parent Parent
- */
- Pixmap(const QPixmap &picture, QGraphicsObject *parent = 0);
+/*******************************************************************************
+* SIGNALS
+******************************************************************************/
signals:
/**
* @brief Signal which is emitted when the pixmap
* bounding box area is clicked.
*/
void clicked();
+/*******************************************************************************
+* DATA MEMBERS
+******************************************************************************/
private:
QPixmap m_p; ///<Holds the buttons pixmap
};
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@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 "situareuser.h"
+#include <QPainter>
+#include <QDebug>
+
+const int BORDER_X_OFFSET = 6;
+const int BORDER_Y_OFFSET = 6;
+const int RECT_WIDTH_OFFSET = 2;
+const int RECT_HEIGHT_OFFSET = 2;
+const int ROUNDNESS = 9;
+const int PIC_SIZE_X = 50;
+const int PIC_SIZE_Y = 50;
+
+SituareUser::SituareUser(QWidget *parent)
+ : QLabel(parent)
+{
+}
+
+
+void SituareUser::paintEvent(QPaintEvent *aPaintEvent)
+{
+ QRect widgetRect = QRect(0,0,this->pixmap()->width(),this->pixmap()->height());
+
+ QPainter painter(this);
+ painter.save();
+
+ painter.setRenderHint(QPainter::Antialiasing);
+ QPainterPath roundedRect;
+ roundedRect.addRoundedRect(0,0,widgetRect.width()+RECT_WIDTH_OFFSET,
+ widgetRect.height()+RECT_HEIGHT_OFFSET,ROUNDNESS,ROUNDNESS);
+ painter.setClipPath(roundedRect);
+ QRegion maskRegion = painter.clipRegion();
+
+ setMask(maskRegion);
+
+ painter.drawPixmap(QPointF(0,0),(*(this->pixmap())));
+ clearMask();
+ painter.drawPixmap(QPointF(-BORDER_X_OFFSET,-BORDER_Y_OFFSET),
+ (QPixmap(":/res/images/profile_pic_border.png")));
+ painter.restore();
+}
+
+QSize SituareUser::sizeHint() const
+{
+ return QSize(PIC_SIZE_X,PIC_SIZE_Y);
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@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 SITUAREUSER_H
+#define SITUAREUSER_H
+
+#include <QLabel>
+#include <QPixmap>
+
+class SituareUser : public QLabel
+{
+ Q_OBJECT
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
+ SituareUser(QWidget *parent=0);
+/*******************************************************************************
+* BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+*******************************************************************************/
+protected:
+ /**
+ * @brief This function is called when the widget is drawn
+ *
+ * @param aPaintEvent Pointer to paint event
+ */
+ void paintEvent(QPaintEvent *aPaintEvent);
+ /**
+ * @brief This function suggests layouter correct size.
+ *
+ * @return QSize Size of the label
+ */
+ QSize sizeHint() const;
+};
+
+#endif // SITUAREUSER_H
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@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 <QtTest>
+#include <QtGui>
+#include "ui/buttonitem.h"
+#include <QDebug>
+
+class TestButtonItem: public QObject
+{
+ Q_OBJECT
+private slots:
+ void constructorTest();
+ void buttonSizeHintTest();
+};
+
+/**
+* @brief Tests that the button constructor works.
+*/
+void TestButtonItem::constructorTest()
+{
+ ButtonItem *myButton = new ButtonItem();
+ QVERIFY(myButton);
+ delete myButton;
+ myButton = NULL;
+ QVERIFY(!myButton);
+}
+
+/**
+* @brief Tests that the button size is correct.
+*/
+void TestButtonItem::buttonSizeHintTest()
+{
+ ButtonItem *myButton = new ButtonItem();
+ myButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
+}
+
+
+QTEST_MAIN(TestButtonItem)
+#include "testbuttonitem.moc"
+
+
--- /dev/null
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET = buttonitem
+DEPENDPATH += .
+INCLUDEPATH += . \
+ ../../../src/
+
+SOURCES += testbuttonitem.cpp \
+ ../../../src/ui/buttonitem.cpp
+HEADERS += ../../../src/ui/buttonitem.h