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
9 Ville Tiensuu - ville.tiensuu@ixonos.com
11 Situare is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License
13 version 2 as published by the Free Software Foundation.
15 Situare is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with Situare; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
30 #include "updatelocation/updatelocationdialog.h"
35 * @brief UserInfo shows user's data in expandable item.
37 * @class UserInfo userinfo.h "ui/userinfo.h"
39 class UserInfo : public QWidget
46 * @param parent Parent
48 UserInfo(QWidget *parent=0);
52 * saves unsend user message to settings
57 /*******************************************************************************
58 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
59 *******************************************************************************/
62 * @brief Set current mouse position to mouse event position.
64 * @param event QMouseEvent mouse press event
66 void mousePressEvent(QMouseEvent *event);
69 * @brief Call toggleHeight if mouse position is unchanged.
71 * Check if current mouse position is same as mouse release position.
72 * @param event QMouseEvent mouse release event
74 void mouseReleaseEvent(QMouseEvent *event);
77 * @brief This function is called when the widget is drawn
79 * @param aPaintEvent Pointer to paint event
81 void paintEvent(QPaintEvent *aPaintEvent);
83 /******************************************************************************
84 * MEMBER FUNCTIONS AND SLOTS
85 ******************************************************************************/
88 * @brief Sets the users current address
90 * @param address Reference to users current address
92 void setAddress(const QString &address);
95 * @brief Sets the users current coordinates
97 * @param coordinates Reference to users current coordinates
99 void setCoordinates(const QPointF &coordinates);
102 * @brief Sets the user picture
104 * @param image Reference to user picture
106 void setProfileImage(const QPixmap &image);
109 * @brief Sets the time of updated message
111 * @param time Reference to time when message was sent.
113 void setTime(const QString &time);
116 * @brief Sets the user name
118 * @param name Reference to user name
120 void setUserName(const QString &name);
125 * @brief Clears backups of message and publish on Facebook setting
127 void clearUpdateLocationDialogData();
130 * @brief Saves status message and Facebook publish setting
132 * @param status message that user sends. Message is stored to m_backupMessage data member
133 * @param publish setting that determines whether the user status message is published on
134 * Facebook. This value is stored to m_backupFacebookPublishPolicity data member.
136 void backupUpdateLocationDialogData(const QString &status, const bool &publish);
139 * @brief Sets the message text
141 * @param text Reference to user message
143 void setMessageText(const QString &text);
147 * @brief Emits signal to inform user about failed message/location update.
148 * Contains logic to send signal only after failed message/location update.
150 * @param errorMessage from Situare server. Message is not used in this function
152 void verifyMessageUpdateFailure(const QString &errorMessage);
157 * @brief reads Unsend message from settings at startup
160 void restoreUnsendMessage();
163 * @brief Set shortened or full-length text to labels.
165 * @param expanded true if full-length text is set, false otherwise
167 void setText(bool expanded);
170 * @brief Set shortened texts from User data.
172 * Text length is defined by MAXIMUM_CHARS.
174 QString shortenText(const QLabel *label, const QString &text, int textMaxWidth);
178 * @brief Slot for find button click
180 void findButtonClicked();
183 * @brief Slot function to forward messageUpdate launch signal
186 void messageUpdate();
188 /******************************************************************************
190 ******************************************************************************/
193 * @brief Signal for finding user.
195 * @param coordinates user geo coordinates
197 void findUser(const QPointF &coordinates);
200 * @brief Signal that informs that user's message/location failed to update on Situare server
201 * This signal is originally sended from SituareService with name error
202 * Signal is renamed on MainWindow
204 void messageSendingFailed(const QString &error);
207 * @brief Signal that used to inform user that his message/location update tp Situare server
209 * This signal is originally sended from UserInfo
211 void notificateUpdateFailing(const QString &message);
214 * @brief Signal for refreshing user data.
217 void refreshUserData();
220 * @brief Signal for requesting reverseGeo from SituareEngine
223 void requestReverseGeo();
226 * @brief Signals, when address data is ready
228 * @param address Street address
230 void reverseGeoReady(const QString &address);
233 * @brief Signal for requestLocationUpdate from SituareEngine via MainWindow class
235 * @param status Status message
236 * @param publish Publish on Facebook
238 void statusUpdate(const QString &status, const bool &publish);
239 /******************************************************************************
241 ******************************************************************************/
243 bool m_backupFacebookPublishPolicity; ///< Backup of publish on Facebook checkbox value
244 bool m_expanded; ///< Item expanded state
245 bool m_messageUpdateVerified; ///< Place for message/location update check
246 QLabel *m_locationLabel; ///< Location label
247 QLabel *m_nameLabel; ///< Name label
248 QLabel *m_statusTextLabel; ///< Status text label
249 QLabel *m_updatedLabel; ///< Updated label
250 QPixmap m_backgroundBottomImage; ///< Bottom background image
251 QPixmap m_backgroundMiddleImage; ///< Middle background image
252 QPixmap m_backgroundTopImage; ///< Top background image
253 QPoint m_mousePosition; ///< Current mouse press position
254 QPointF m_coordinates; ///< User current coordinates
255 QString m_address; ///< Address from where the new message was sent
256 QString m_backupMessage; ///< Backup of users message
257 QString m_messageText; ///< User's message
258 QString m_time; ///< Time when the new message was sent
259 QString m_userName; ///< User's name
260 ImageButton *m_findButton; ///< User find button
261 UpdateLocationDialog *m_messageDialog; ///< Dialog for sending message and location