00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Jukka Saastamoinen - jukka.saastamoinen@ixonos.com 00006 Jussi Laitinen - jussi.laitinen@ixonos.com 00007 Katri Kaikkonen - katri.kaikkonen@ixonos.com 00008 Henri Lampela - henri.lampela@ixonos.com 00009 Ville Tiensuu - ville.tiensuu@ixonos.com 00010 00011 Situare is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU General Public License 00013 version 2 as published by the Free Software Foundation. 00014 00015 Situare is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with Situare; if not, write to the Free Software 00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00023 USA. 00024 */ 00025 00026 #ifndef USERINFO_H 00027 #define USERINFO_H 00028 00029 #include <QWidget> 00030 #include "updatelocation/updatelocationdialog.h" 00031 00032 class ImageButton; 00033 00039 class UserInfo : public QWidget 00040 { 00041 Q_OBJECT 00042 public: 00048 UserInfo(QWidget *parent=0); 00049 00055 ~UserInfo(); 00056 00057 /******************************************************************************* 00058 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS 00059 *******************************************************************************/ 00060 protected: 00066 void mousePressEvent(QMouseEvent *event); 00067 00074 void mouseReleaseEvent(QMouseEvent *event); 00075 00081 void paintEvent(QPaintEvent *aPaintEvent); 00082 00083 /****************************************************************************** 00084 * MEMBER FUNCTIONS AND SLOTS 00085 ******************************************************************************/ 00086 public: 00092 void setAddress(const QString &address); 00093 00099 void setCoordinates(const QPointF &coordinates); 00100 00106 void setProfileImage(const QPixmap &image); 00107 00113 void setTime(const QString &time); 00114 00120 void setUserName(const QString &name); 00121 00122 public slots: 00123 00127 void clearUpdateLocationDialogData(); 00128 00136 void backupUpdateLocationDialogData(const QString &status, bool publish); 00137 00143 void setMessageText(const QString &text); 00144 00145 00152 void verifyMessageUpdateFailure(const QString &errorMessage); 00153 00154 private: 00155 00160 void restoreUnsendMessage(); 00161 00167 void setText(bool expanded); 00168 00174 QString shortenText(const QLabel *label, const QString &text, int textMaxWidth); 00175 00176 private slots: 00180 void findButtonClicked(); 00181 00186 void messageUpdate(); 00187 00192 void updateLocationDialogFinished(int reason); 00193 00194 /****************************************************************************** 00195 * SIGNALS 00196 ******************************************************************************/ 00197 signals: 00203 void findUser(const QPointF &coordinates); 00204 00210 void messageSendingFailed(const QString &error); 00211 00217 void notificateUpdateFailing(const QString &message); 00218 00223 void refreshUserData(); 00224 00229 void requestReverseGeo(); 00230 00236 void reverseGeoReady(const QString &address); 00237 00244 void statusUpdate(const QString &status, const bool &publish); 00245 /****************************************************************************** 00246 * DATA MEMBERS 00247 ******************************************************************************/ 00248 private: 00249 bool m_backupFacebookPublishPolicity; 00250 bool m_expanded; 00251 bool m_messageUpdateVerified; 00252 QLabel *m_locationLabel; 00253 QLabel *m_nameLabel; 00254 QLabel *m_statusTextLabel; 00255 QLabel *m_updatedLabel; 00256 QPixmap m_backgroundBottomImage; 00257 QPixmap m_backgroundMiddleImage; 00258 QPixmap m_backgroundTopImage; 00259 QPoint m_mousePosition; 00260 QPointF m_coordinates; 00261 QString m_address; 00262 QString m_backupMessage; 00263 QString m_messageText; 00264 QString m_time; 00265 QString m_userName; 00266 ImageButton *m_findButton; 00267 UpdateLocationDialog *m_updateLocation; 00268 }; 00269 00270 #endif // USERINFO_H