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/>.
27 class YTUser : public QObject {
32 static YTUser* forId(QString userId);
33 static void subscribe(QString userId);
34 static void unsubscribe(QString userId);
35 static bool isSubscribed(QString userId);
37 int getId() { return id; }
38 void setId(int id) { this->id = id; }
40 uint getChecked() { return checked; }
43 uint getWatched() const { return watched; }
44 void setWatched(uint watched) { this->watched = watched; }
47 int getNotifyCount() const { return notifyCount; }
48 void setNotifyCount(int count) { notifyCount = count; }
49 void storeNotifyCount(int count);
50 bool updateNotifyCount();
52 QString getUserId() const { return userId; }
53 QString getUserName() const { return userName; }
54 QString getDisplayName() const { return displayName; }
55 QString getDescription() const { return description; }
56 QString getCountryCode() const { return countryCode; }
59 const QString & getThumbnailDir();
60 QString getThumbnailLocation();
61 const QPixmap & getThumbnail() { return thumbnail; }
63 static QList<YTUser*> getCachedUsers() { return cache.values(); }
67 void thumbnailLoaded();
68 void error(QString message);
71 void parseResponse(QByteArray bytes);
72 void requestError(QNetworkReply *reply);
73 void storeThumbnail(QByteArray bytes);
76 YTUser(QString userId, QObject *parent = 0);
77 void maybeLoadfromAPI();
80 static QHash<QString, YTUser*> cache;
91 bool loadingThumbnail;
100 // This is required in order to use QPointer<YTUser> as a QVariant
101 typedef QPointer<YTUser> YTUserPointer;
102 Q_DECLARE_METATYPE(YTUserPointer)