2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
6 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Katri Kaikkonen - katri.kaikkonen@ixonos.com
8 Henri Lampela - henri.lampela@ixonos.com
10 Situare is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 version 2 as published by the Free Software Foundation.
14 Situare is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Situare; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
29 #include "updatelocation/updatelocationdialog.h"
34 * @brief UserInfo shows user's data in expandable item.
36 * @class UserInfo userinfo.h "ui/userinfo.h"
38 class UserInfo : public QWidget
45 * @param parent Parent
47 UserInfo(QWidget *parent=0);
49 /*******************************************************************************
50 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
51 *******************************************************************************/
54 * @brief Set current mouse position to mouse event position.
56 * @param event QMouseEvent mouse press event
58 void mousePressEvent(QMouseEvent *event);
61 * @brief Call toggleHeight if mouse position is unchanged.
63 * Check if current mouse position is same as mouse release position.
64 * @param event QMouseEvent mouse release event
66 void mouseReleaseEvent(QMouseEvent *event);
69 * @brief This function is called when the widget is drawn
71 * @param aPaintEvent Pointer to paint event
73 void paintEvent(QPaintEvent *aPaintEvent);
75 /******************************************************************************
76 * MEMBER FUNCTIONS AND SLOTS
77 ******************************************************************************/
80 * @brief Sets the users current address
82 * @param address Reference to users current address
84 void setAddress(const QString &address);
87 * @brief Sets the users current coordinates
89 * @param coordinates Reference to users current coordinates
91 void setCoordinates(const QPointF &coordinates);
94 * @brief Sets the message text
96 * @param text Reference to user message
98 void setMessageText(const QString &text);
101 * @brief Sets the user picture
103 * @param image Reference to user picture
105 void setProfileImage(const QPixmap &image);
108 * @brief Sets the time of updated message
110 * @param time Reference to time when message was sent.
112 void setTime(const QString &time);
115 * @brief Sets the user name
117 * @param name Reference to user name
119 void setUserName(const QString &name);
123 * @brief Set shortened or full-length text to labels.
125 * @param expanded true if full-length text is set, false otherwise
127 void setText(bool expanded);
130 * @brief Set shortened texts from User data.
132 * Text length is defined by MAXIMUM_CHARS.
134 QString shortenText(const QLabel *label, const QString &text, int textMaxWidth);
138 * @brief Slot for find button click
140 void findButtonClicked();
143 * @brief Slot function to forward messageUpdate launch signal
146 void messageUpdate();
148 /******************************************************************************
150 ******************************************************************************/
153 * @brief Signal for finding user.
155 * @param coordinates user geo coordinates
157 void findUser(const QPointF &coordinates);
160 * @brief Signal for refreshing user data.
163 void refreshUserData();
166 * @brief Signal for requesting reverseGeo from SituareEngine
169 void requestReverseGeo();
172 * @brief Signals, when address data is ready
174 * @param address Street address
176 void reverseGeoReady(const QString &address);
179 * @brief Signal for requestLocationUpdate from SituareEngine via MainWindow class
181 * @param status Status message
182 * @param publish Publish on Facebook
184 void statusUpdate(const QString &status, const bool &publish);
185 void messageUpdatedToSituare();
186 void messageSendingFailed(const QString &error);
188 /******************************************************************************
190 ******************************************************************************/
192 bool m_expanded; ///< Item expanded state
193 QLabel *m_locationLabel; ///< Location label
194 QLabel *m_nameLabel; ///< Name label
195 QLabel *m_statusTextLabel; ///< Status text label
196 QLabel *m_updatedLabel; ///< Updated label
197 QPixmap m_backgroundBottomImage; ///< Bottom background image
198 QPixmap m_backgroundMiddleImage; ///< Middle background image
199 QPixmap m_backgroundTopImage; ///< Top background image
200 QPoint m_mousePosition; ///< Current mouse press position
201 QPointF m_coordinates; ///< User current coordinates
202 QString m_address; ///< Address from where the new message was sent.
203 QString m_messageText; ///< User's message
204 QString m_time; ///< Time when the new message was sent
205 QString m_userName; ///< User's name
206 ImageButton *m_findButton; ///< User find button