3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Minitube 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.
16 You should have received a copy of the GNU General Public License
17 along with Minitube. If not, see <http://www.gnu.org/licenses/>.
25 #if QT_VERSION >= 0x050000
30 class YTUser : public QObject {
35 static YTUser* forId(QString userId);
36 static void subscribe(QString userId);
37 static void unsubscribe(QString userId);
38 static bool isSubscribed(QString userId);
40 int getId() { return id; }
41 void setId(int id) { this->id = id; }
43 uint getChecked() { return checked; }
46 uint getWatched() const { return watched; }
47 void setWatched(uint watched) { this->watched = watched; }
49 int getNotifyCount() const { return notifyCount; }
50 void setNotifyCount(int count) { notifyCount = count; }
51 void storeNotifyCount(int count);
52 bool updateNotifyCount();
54 QString getUserId() const { return userId; }
55 QString getUserName() const { return userName; }
56 QString getDisplayName() const { return displayName; }
57 QString getDescription() const { return description; }
58 QString getCountryCode() const { return countryCode; }
61 const QString & getThumbnailDir();
62 QString getThumbnailLocation();
63 const QPixmap & getThumbnail() { return thumbnail; }
65 static QList<YTUser*> getCachedUsers() { return cache.values(); }
73 void thumbnailLoaded();
74 void error(QString message);
75 void notifyCountChanged();
78 void parseResponse(QByteArray bytes);
79 void requestError(QNetworkReply *reply);
80 void storeThumbnail(QByteArray bytes);
83 YTUser(QString userId, QObject *parent = 0);
84 void maybeLoadfromAPI();
87 static QHash<QString, YTUser*> cache;
98 bool loadingThumbnail;
107 // This is required in order to use QPointer<YTUser> as a QVariant
108 typedef QPointer<YTUser> YTUserPointer;
109 Q_DECLARE_METATYPE(YTUserPointer)