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,
26 #include <QTreeWidgetItem>
27 #include <QListWidgetItem>
28 #include "updatelocation/updatelocationdialog.h"
30 #include "../user/user.h"
34 class UserInfo : public QWidget
41 * @param parent Parent
43 UserInfo(QWidget *parent=0);
45 /*******************************************************************************
46 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
47 *******************************************************************************/
50 * @brief This function is called when the widget is drawn
52 * @param aPaintEvent Pointer to paint event
54 void paintEvent(QPaintEvent *aPaintEvent);
56 * @brief Set current mouse position to mouse event position.
58 * @param event QMouseEvent mouse press event
60 void mousePressEvent(QMouseEvent *event);
62 // * @brief Call toggleHeight if mouse position is unchanged.
64 // * Check if current mouse position is same as mouse release position.
65 // * @param event QMouseEvent mouse release event
67 // void mouseReleaseEvent(QMouseEvent *event);
69 /******************************************************************************
70 * MEMBER FUNCTIONS AND SLOTS
71 ******************************************************************************/
76 * @brief Sets the users current address
78 * @param addr Reference to users current address
80 void setAddress(const QString &addr);
82 * @brief Sets the user picture
84 * @param avat Reference to user picture
86 void setAvatar(const QPixmap &image);
88 * @brief Sets the message text
90 * @param text Reference to user message
92 void setMessageText(const QString &text);
94 * @brief Sets the time of updated message
96 * @param tim Reference to time when message was sent.
98 void setTime(const QString &tim);
100 * @brief Sets the user name
102 * @param usernam Reference to user name
104 void setUserName(const QString &name);
107 * @brief Slot function to forward messageUpdate launch signal
110 void messageUpdate();
112 // * @brief Set shortened or full-length text to labels.
114 // * @param expanded true if full-length text is set, false otherwise
116 // void setText(bool expanded);
118 // * @brief Set shortened texts from User data.
120 // * Text length is defined by MAXIMUM_CHARS.
122 // void shortenTexts();
124 * @brief Slot function to forward friends status update signal
127 void updateFriendsStatus();
131 * @brief Signal to launch manual message update dialog
134 void launchMessageUpdate();
136 * @brief Signal to refresh friends statuses
137 * @todo: Connect to friends lists when ready
139 void launchUpdateFriendsStatus();
141 /******************************************************************************
143 ******************************************************************************/
145 QPixmap m_backgroundTopImage; ///< Top background image
146 QPixmap m_backgroundMiddleImage; ///< Middle background image
147 QPixmap m_backgroundBottomImage; ///< Bottom background image
148 bool m_expanded; ///< Item expanded state
149 QLabel *m_distanceLabel; ///< Distance to friend label
150 QLabel *m_imageLabel; ///< Image label
151 QLabel *m_locationLabel; ///< Location label
152 QPoint m_mousePosition; ///< Current mouse press position
153 QLabel *m_nameLabel; ///< Name label
156 QString m_messageText;
158 QString m_shortenedLocation; ///< Shortened location text
159 QString m_shortenedName; ///< Shortened name text
160 QString m_shortenedStatusText; ///< Shortened status text
161 QString m_shortenedUpdated; ///< Shortened updated text
163 QLabel *m_statusTextLabel; ///< Status text label
164 QLabel *m_updatedLabel; ///< Updated label
165 UpdateLocationDialog *m_locationDialog; ///< Message dialog
169 const int BACKGROUND_TOP_HEIGHT = 20;
170 const int BACKGROUND_BOTTOM_HEIGHT = 15;
171 const QColor COLOR_GRAY = QColor(152, 152, 152); ///< Gray color
172 const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
173 const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal); ///< Small font
174 const int ICON_HEIGHT = 24; ///< Icon height
175 const int ICON_WIDTH = 24; ///< Icon width
176 const int IMAGE_HEIGHT = 60; ///< Friend image height
177 const int IMAGE_WIDTH = 60; ///< Friend image width
178 const int ITEM_MAX_HEIGHT = 1240; ///< Maximum height for item
179 const int ITEM_MAX_WIDTH = 250; ///< Maximum width for item
180 const int ITEM_MIN_HEIGHT = 141; ///< Minimum height for item
181 const int ITEM_MIN_WIDTH = 250; ///< Minimum width for item
182 const int MARGIN = 5; ///< Icon margin
183 const int MOUSE_PRESS_AREA_WIDTH = 20; ///< Area width for item height toggling
184 const int MOUSE_PRESS_AREA_HEIGHT = 20; ///< Area height for item height toggling
186 * @var NAME_LABEL_MAX_WIDTH
188 * @brief Name label's maximum width
190 const int NAME_LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - IMAGE_WIDTH;
192 * @var LABEL_MAX_WIDTH
194 * @brief All label's maximum width
196 const int LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - IMAGE_WIDTH - MARGIN - ICON_WIDTH;