Added QPixmap for User class and implemented first version of profile image fetching...
[situare] / src / user / user.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Henri Lampela - henri.lampela@ixonos.com
6
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #ifndef USER_H
23 #define USER_H
24
25 #include <QPixmap>
26 #include <QPointF>
27 #include <QString>
28 #include <QUrl>
29
30 /**
31 * @brief Class to store user information (applies to friends also)
32 *
33 * @author Henri Lampela
34 * @class User user.h "user/user.h"
35 */
36 class User
37 {
38 public:
39
40     /**
41     * @brief Default constructor, initializes member data
42     *
43     */
44     User(const QString address, const QPointF coordinates, const QString name, const QString note,
45          const QUrl imageUrl, const QString timestamp, const bool type, const QString userId,
46          const QString units = 0, const double value = 0);
47
48     /*******************************************************************************
49      * MEMBER FUNCTIONS AND SLOTS
50      ******************************************************************************/
51
52     /**
53     * @brief Set address
54     *
55     * @param address street address
56     */
57     void setAddress(const QString &address);
58
59     /**
60     * @brief Set coordinates ( x = lon, y = lat )
61     *
62     * @param coordinates coordinates
63     */
64     void setCoordinates(const QPointF &coordinates);
65
66     /**
67     * @brief Set distance
68     *
69     * @param value distance
70     * @param units unit type
71     */
72     void setDistance(const double &value, const QString &units);
73
74     /**
75     * @brief Set note
76     *
77     * @param note note/status message
78     */
79     void setNote(const QString &note);
80
81     /**
82     * @brief Set profile image
83     *
84     * @param image Image
85     */
86     void setProfileImage(const QPixmap &image);
87
88     /**
89     * @brief Set download address for profile image
90     *
91     * @param imageUrl image url
92     */
93     void setProfileImageUrl(const QUrl &imageUrl);
94
95     /**
96     * @brief Set timestamp for last status update, timestamp is in literal mode
97     *
98     * @param timestamp timestamp
99     */
100     void setTimestamp(const QString &timestamp);
101
102     /**
103     * @brief Get address
104     *
105     * @return QString address
106     */
107     QString address() const;
108
109     /**
110     * @brief Get coordinates
111     *
112     * @return QPointF coordinates
113     */
114     QPointF coordinates() const;
115
116     /**
117     * @brief Get distance and units
118     *
119     * @param value distance
120     * @param units unit type
121     */
122     void distance(double &value, QString &units) const;
123
124     /**
125     * @brief Get name
126     *
127     * @return QString profile name
128     */
129     QString name() const;
130
131     /**
132     * @brief Get note/status message
133     *
134     * @return QString note
135     */
136     QString note() const;
137
138     /**
139     * @brief Get profile image
140     *
141     * @return QPixmap image
142     */
143     QPixmap profileImage() const;
144
145     /**
146     * @brief Get download address for profile image
147     *
148     * @return QString url
149     */
150     QUrl profileImageUrl() const;
151
152     /**
153     * @brief Get timestamp of last status update
154     *
155     * @return QString timestamp
156     */
157     QString timestamp() const;
158
159     /**
160     * @brief Get user type
161     *
162     * @return bool user type (true = user, false = friend)
163     */
164     bool type() const;
165
166     /**
167     * @brief Get userId
168     *
169     * @return QString userId
170     */
171     QString userId() const;
172
173     /*******************************************************************************
174      * DATA MEMBERS
175      ******************************************************************************/
176
177 private:
178     QString m_address; ///< placeholder for address information
179     QPointF m_coordinates; ///< placeholder for coordinates
180     QString m_name; ///< placeholder for name
181     QString m_note; ///< placeholder for note
182     QUrl m_profileImageUrl; ///< placeholder for image url
183     QString m_timestamp; ///< placeholer for timestamp
184     bool m_type; ///< placeholder for user type
185     QString m_units; ///< placeholder for distance unit type
186     QString m_userId; ///< placeholder for userId
187     double m_value; ///< placeholder for distance value
188
189     QPixmap m_profileImage; ///< placehokder for image
190 };
191
192
193 #endif // USER_H