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
43 * @brief Construct FriendListItem.
45 * Initializes layouts and member variables. Sets stylesheet
47 * @param parent parent widget
52 /******************************************************************************
53 * MEMBER FUNCTIONS AND SLOTS
54 ******************************************************************************/
57 * @brief Set user data for this item.
59 * @param user User pointer
61 void setUserData(User *user);
64 void setExpanded(bool expanded);
66 void setId(const QString &id);
68 QPointF coordinates();
72 * @brief Set distance icon.
74 * Icon is selected by distance.
76 * @param value distance value
77 * @param unit distance unit
79 void setDistanceIcon(double value, const QString &unit);
82 * @brief Set shortened or full-length text to labels.
84 * @param expanded true if full-length text is set, false otherwise
86 void setText(bool expanded);
89 * @brief Set shortened texts from User data.
91 * Text length is defined by MAXIMUM_CHARS.
95 QString elideText(int width, const QString &text);
97 void calculateTextRects();
100 // * @brief Slot for find button click
102 // void findButtonClicked();
104 /******************************************************************************
106 ******************************************************************************/
109 // * @brief Signal for finding friend.
111 // * @param coordinates friend's geo coordinates
113 // void findFriend(const QPointF &coordinates);
115 /******************************************************************************
117 ******************************************************************************/
119 bool m_expanded; ///< Item expanded state
120 QPoint m_mousePosition; ///< Current mouse press position
121 QRect m_locationRect;
122 QRect m_statusTextRect;
124 int m_expandedHeight;
125 QString m_shortenedLocation; ///< Shortened location text
126 QString m_shortenedName; ///< Shortened name text
127 QString m_shortenedStatusText; ///< Shortened status text
128 QString m_shortenedUpdated; ///< Shortened updated text
129 QString m_distanceText; ///< Distance text
130 User *m_user; ///< User data
133 #endif // FRIENDLISTITEM_H