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, 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();
189 * @brief Slot function to get indication when dialog is finished
192 void updateLocationDialogFinished(int reason);
194 /******************************************************************************
196 ******************************************************************************/
199 * @brief Signal for finding user.
201 * @param coordinates user geo coordinates
203 void findUser(const QPointF &coordinates);
206 * @brief Signal that informs that user's message/location failed to update on Situare server
207 * This signal is originally sended from SituareService with name error
208 * Signal is renamed on MainWindow
210 void messageSendingFailed(const QString &error);
213 * @brief Signal that used to inform user that his message/location update tp Situare server
215 * This signal is originally sended from UserInfo
217 void notificateUpdateFailing(const QString &message);
220 * @brief Signal for refreshing user data.
223 void refreshUserData();
226 * @brief Signal for requesting reverseGeo from SituareEngine
229 void requestReverseGeo();
232 * @brief Signals, when address data is ready
234 * @param address Street address
236 void reverseGeoReady(const QString &address);
239 * @brief Signal for requestLocationUpdate from SituareEngine via MainWindow class
241 * @param status Status message
242 * @param publish Publish on Facebook
244 void statusUpdate(const QString &status, const bool &publish);
245 /******************************************************************************
247 ******************************************************************************/
249 bool m_backupFacebookPublishPolicity; ///< Backup of publish on Facebook checkbox value
250 bool m_expanded; ///< Item expanded state
251 bool m_messageUpdateVerified; ///< Place for message/location update check
252 QLabel *m_locationLabel; ///< Location label
253 QLabel *m_nameLabel; ///< Name label
254 QLabel *m_statusTextLabel; ///< Status text label
255 QLabel *m_updatedLabel; ///< Updated label
256 QPixmap m_backgroundBottomImage; ///< Bottom background image
257 QPixmap m_backgroundMiddleImage; ///< Middle background image
258 QPixmap m_backgroundTopImage; ///< Top background image
259 QPoint m_mousePosition; ///< Current mouse press position
260 QPointF m_coordinates; ///< User current coordinates
261 QString m_address; ///< Address from where the new message was sent
262 QString m_backupMessage; ///< Backup of users message
263 QString m_messageText; ///< User's message
264 QString m_time; ///< Time when the new message was sent
265 QString m_userName; ///< User's name
266 ImageButton *m_findButton; ///< User find button
267 UpdateLocationDialog *m_updateLocation; ///< Update location dialog