00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Jussi Laitinen - jussi.laitinen@ixonos.com 00006 00007 Situare is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 version 2 as published by the Free Software Foundation. 00010 00011 Situare is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Situare; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00019 USA. 00020 */ 00021 00022 #ifndef FRIENDLISTITEM_H 00023 #define FRIENDLISTITEM_H 00024 00025 #include <QWidget> 00026 #include <QTreeWidgetItem> 00027 #include <QListWidgetItem> 00028 00029 #include "../user/user.h" 00030 00031 class QLabel; 00032 class ImageButton; 00033 00039 class FriendListItem : public QWidget 00040 { 00041 Q_OBJECT 00042 00043 public: 00051 FriendListItem(QWidget *parent = 0); 00052 00053 /******************************************************************************* 00054 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS 00055 ******************************************************************************/ 00056 protected: 00062 void mousePressEvent(QMouseEvent *event); 00063 00070 void mouseReleaseEvent(QMouseEvent *event); 00071 00077 void paintEvent(QPaintEvent *event); 00078 00079 /****************************************************************************** 00080 * MEMBER FUNCTIONS AND SLOTS 00081 ******************************************************************************/ 00082 public: 00088 void setData(User *user); 00089 00090 private: 00099 void setDistanceIcon(double value, const QString &unit); 00100 00106 void setText(bool expanded); 00107 00113 void shortenTexts(); 00114 00115 private slots: 00119 void findButtonClicked(); 00120 00121 /****************************************************************************** 00122 * SIGNALS 00123 ******************************************************************************/ 00124 signals: 00130 void findFriend(const QPointF &coordinates); 00131 00132 /****************************************************************************** 00133 * DATA MEMBERS 00134 ******************************************************************************/ 00135 private: 00136 QPixmap m_backgroundTopImage; 00137 QPixmap m_backgroundMiddleImage; 00138 QPixmap m_backgroundBottomImage; 00139 bool m_expanded; 00140 QLabel *m_distanceImageLabel; 00141 QLabel *m_distanceTextLabel; 00142 ImageButton *m_findButton; 00143 QLabel *m_locationLabel; 00144 QPoint m_mousePosition; 00145 QLabel *m_nameLabel; 00146 QString m_shortenedLocation; 00147 QString m_shortenedName; 00148 QString m_shortenedStatusText; 00149 QString m_shortenedUpdated; 00150 QLabel *m_statusTextLabel; 00151 QLabel *m_updatedLabel; 00152 User *m_user; 00153 }; 00154 00155 #endif // FRIENDLISTITEM_H