#include <QPainter>
#include "../common.h"
-#include "listcommon.h"
#include "extendedlistitemstore.h"
+#include "listcommon.h"
#include "extendedlistitem.h"
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 EXTENDEDLISTITEM_H
#define EXTENDEDLISTITEM_H
/**
* @brief Base class for extended list items.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class ExtendedListItem : public ListItem
{
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 <QDebug>
#include <QRect>
text = itemStore->shortenedText();
}
- QRect iconRect = QRect(itemRect.left() + MARGIN*3,
+ QRect iconRect = QRect(itemRect.left() + MARGIN * 3,
previousSubItemTextRectBottom + ICON_MARGIN,
ICON_WIDTH, ICON_HEIGHT);
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 EXTENDEDLISTITEMDELEGATE_H
#define EXTENDEDLISTITEMDELEGATE_H
/**
* @brief Defines ExtendedListItem style.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class ExtendedListItemDelegate : public ListItemDelegate
{
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 "extendedlistitemstore.h"
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 EXTENDEDLISTITEMSTORE_H
#define EXTENDEDLISTITEMSTORE_H
/**
* @brief Stores ExtendedListItem data.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class ExtendedListItemStore
{
#include "friendlistitem.h"
-const int WALK_DISTANCE = 5; ///< Walk distance limit for distance icon
-const int CAR_DISTANCE = 500; ///< Car distance limit for distance icon
const int AEROPLANE_DISTANCE = 5000;///< Aeroplane distance limit for distance icon
+const int CAR_DISTANCE = 500; ///< Car distance limit for distance icon
+const int WALK_DISTANCE = 5; ///< Walk distance limit for distance icon
FriendListItem::FriendListItem()
- : m_user(0)
{
qDebug() << __PRETTY_FUNCTION__;
{
qDebug() << __PRETTY_FUNCTION__;
- return m_user->coordinates();
-}
-
-QString FriendListItem::id() const
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- return m_user->userId();
+ return m_coordinates;
}
void FriendListItem::setUserData(User *user)
qDebug() << __PRETTY_FUNCTION__;
if(user) {
- m_user = user;
QString unit;
double value;
- m_user->distance(value, unit);
+ user->distance(value, unit);
QString distanceText = QString::number(value) + " " + unit;
setData(DISTANCE_TEXT_DISPLAY_INDEX, distanceText);
setDistanceIcon(value, unit);
QRect distanceRect = distanceTextFontMetrics.boundingRect(distanceText);
setData(DISTANCE_SIZE_HINT_INDEX, distanceRect);
- setName(shortenText(m_user->name(), NAME_TEXT_MAX_WIDTH - distanceRect.width() + MARGIN,
+ setName(shortenText(user->name(), NAME_TEXT_MAX_WIDTH - distanceRect.width() + MARGIN,
ListItem::TEXT_SIZE_NORMAL));
+ setCoordinates(user->coordinates());
- if (!m_user->profileImage().isNull())
- setImage(m_user->profileImage());
+ if (!user->profileImage().isNull())
+ setImage(user->profileImage());
clearSubItems();
- addSubItem(m_user->note(), QPixmap(":/res/images/envelope.png"));
- addSubItem(m_user->address(), QPixmap(":/res/images/compass.png"));
- addSubItem(m_user->timestamp(), QPixmap(":/res/images/clock.png"));
+ addSubItem(user->note(), QPixmap(":/res/images/envelope.png"));
+ addSubItem(user->address(), QPixmap(":/res/images/compass.png"));
+ addSubItem(user->timestamp(), QPixmap(":/res/images/clock.png"));
}
}
setImage(image);
}
+void FriendListItem::setCoordinates(const GeoCoordinate &coordinates)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_coordinates = coordinates;
+}
+
void FriendListItem::setDistanceIcon(double value, const QString &unit)
{
qDebug() << __PRETTY_FUNCTION__;
#ifndef FRIENDLISTITEM_H
#define FRIENDLISTITEM_H
-#include "../user/user.h"
+#include "coordinates/geocoordinate.h"
#include "extendedlistitem.h"
+class User;
+
/**
* @brief List item stores information about friends.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class FriendListItem : public ExtendedListItem
{
*/
~FriendListItem();
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-public:
- /**
- * @brief Returns item's ID.
- *
- * @return item's ID
- */
- QString id() const;
-
/******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
GeoCoordinate coordinates();
/**
+ * @brief Sets item's coordinates.
+ *
+ * @param coordinates GeoCoordinate
+ */
+ void setCoordinates(const GeoCoordinate &coordinates);
+
+ /**
* @brief Set user data for this item.
*
* @param user User pointer
* DATA MEMBERS
******************************************************************************/
private:
- User *m_user; ///< User data
+ GeoCoordinate m_coordinates; ///< User coordinates
};
#endif // FRIENDLISTITEM_H
* @brief Displays FriendListItem.
*
* Class is used to display FriendListItem data.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class FriendListItemDelegate : public ExtendedListItemDelegate
{
USA.
*/
+#include "../user/user.h"
#include "coordinates/geocoordinate.h"
-#include "friendlistview.h"
#include "friendlistitem.h"
#include "friendlistitemdelegate.h"
+#include "friendlistview.h"
#include "panelcommon.h"
#include "friendlistpanel.h"
Kaj Wallin - kaj.wallin@ixonos.com
Henri Lampela - henri.lampela@ixonos.com
Pekka Nissinen - pekka.nissinen@ixonos.com
+ Jussi Laitinen - jussi.laitinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
* @author Kaj Wallin - kaj.wallin (at) ixonos.com
* @author Henri Lampela - henri.lampela (at) ixonos.com
* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
- *
- * @class FriendListPanel friendlistpanel.h "ui/friendlistpanel.h"
+ * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class FriendListPanel : public QWidget
{
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Henri Lampela - henri.lampela@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
+ 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 "friendlistitem.h"
#include "friendlistview.h"
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 FRIENDLISTVIEW_H
#define FRIENDLISTVIEW_H
/**
* @brief Shows FriendListItems in list view.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class FriendListView : public ListView
{
#include <QDebug>
#include <QPainter>
-#include "listitem.h"
-#include "listcommon.h"
#include "../common.h"
+#include "listcommon.h"
+
+#include "listitem.h"
ListItem::ListItem()
{
* @brief Base class for list items.
*
* Stores item's name and image and includes method to shorten texts.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class ListItem : public QListWidgetItem
{
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
/**
- * @brief Returns item's ID.
- *
- * @return item's ID
- */
- virtual QString id() const = 0;
-
- /**
* @brief Returns item's name.
*
* @return item's name
USA.
*/
-#include <QPainter>
#include <QDebug>
+#include <QPainter>
-#include "listitemdelegate.h"
-#include "listitem.h"
#include "../common.h"
-#include "listcommon.h"
#include "avatarimage.h"
+#include "listcommon.h"
+#include "listitem.h"
+
+#include "listitemdelegate.h"
-const int BACKGROUND_BOTTOM_HEIGHT = 15;
-const int BACKGROUND_TOP_HEIGHT = 20;
-const int NAME_TOP_MARGIN = 40;
+const int BACKGROUND_BOTTOM_HEIGHT = 15; ///< Background image bottom height
+const int BACKGROUND_TOP_HEIGHT = 20; ///< Background image top height
+const int NAME_TOP_MARGIN = 40; ///< Name text top margin
ListItemDelegate::ListItemDelegate(QWidget *parent) :
QStyledItemDelegate(parent)
//Image is set, draw image and text
if (!image.isNull()) {
- painter->drawPixmap(itemRect.left() + MARGIN*2, itemRect.top(), image);
- painter->drawText(itemRect.topLeft() + QPoint(MARGIN*2 + IMAGE_WIDTH + MARGIN,
+ painter->drawPixmap(itemRect.left() + MARGIN * 2, itemRect.top(), image);
+ painter->drawText(itemRect.topLeft() + QPoint(MARGIN * 2 + IMAGE_WIDTH + MARGIN,
NAME_TOP_MARGIN), name);
}
//Draw only text
else {
- painter->drawText(itemRect.topLeft() + QPoint(MARGIN*3, NAME_TOP_MARGIN), name);
+ painter->drawText(itemRect.topLeft() + QPoint(MARGIN * 3, NAME_TOP_MARGIN), name);
}
}
* @brief Displays ListItem.
*
* Class is used to display ListItem data.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class ListItemDelegate : public QStyledItemDelegate
{
qDebug() << __PRETTY_FUNCTION__;
foreach (ListItem *item, m_listItems) {
- if (itemIDs.contains(item->id()))
+ if (itemIDs.contains(m_listItems.key(item)))
setItemHidden(item, false);
else
setItemHidden(item, true);
*
* ListView is used to show ListItems in list view. Items can be added, removed or
* filtered.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class ListView : public QListWidget
{
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 LOCATIONLISTITEM_H
#define LOCATIONLISTITEM_H
/**
* @brief List item stores information about location results.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class LocationListItem : public ExtendedListItem
{
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@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 LOCATIONLISTVIEW_H
#define LOCATIONLISTVIEW_H
/**
* @brief Shows LocationListItems in list view.
+*
+* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
*/
class LocationListView : public ListView
{