2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #ifndef FRIENDLISTITEM_H
23 #define FRIENDLISTITEM_H
26 #include <QTreeWidgetItem>
27 #include <QListWidgetItem>
29 #include "../user/user.h"
33 * @brief FriendListItem shows friend data in expandable item.
35 * @class FriendListItem friendlistitem.h "ui/friendlistitem.h"
37 class FriendListItem : public ListItem
42 * @brief Construct FriendListItem.
44 * Initializes layouts and member variables. Sets stylesheet
46 * @param parent parent widget
50 /******************************************************************************
51 * MEMBER FUNCTIONS AND SLOTS
52 ******************************************************************************/
55 * @brief Set user data for this item.
57 * @param user User pointer
59 void setUserData(User *user);
61 bool toggleSelection();
62 void setSelected(bool expanded);
64 void setId(const QString &id);
66 QPointF coordinates();
70 * @brief Set distance icon.
72 * Icon is selected by distance.
74 * @param value distance value
75 * @param unit distance unit
77 void setDistanceIcon(double value, const QString &unit);
80 * @brief Set shortened or full-length text to labels.
82 * @param expanded true if full-length text is set, false otherwise
84 void setText(bool expanded);
87 * @brief Set shortened texts from User data.
89 * Text length is defined by MAXIMUM_CHARS.
93 void calculateTextRects();
95 /******************************************************************************
97 ******************************************************************************/
99 bool m_selected; ///< Item selected state
100 QPoint m_mousePosition; ///< Current mouse press position
101 QRect m_locationRect;
102 QRect m_statusTextRect;
104 int m_expandedHeight;
105 QString m_shortenedLocation; ///< Shortened location text
106 QString m_shortenedName; ///< Shortened name text
107 QString m_shortenedStatusText; ///< Shortened status text
108 QString m_shortenedUpdated; ///< Shortened updated text
109 QString m_distanceText; ///< Distance text
110 User *m_user; ///< User data
113 #endif // FRIENDLISTITEM_H