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; }
46 int getNotifyCount() const { return notifyCount; }
47 void setNotifyCount(int count) { notifyCount = count; }
48 void storeNotifyCount(int count);
49 bool updateNotifyCount();
51 QString getUserId() const { return userId; }
52 QString getUserName() const { return userName; }
53 QString getDisplayName() const { return displayName; }
54 QString getDescription() const { return description; }
55 QString getCountryCode() const { return countryCode; }
58 const QString & getThumbnailDir();
59 QString getThumbnailLocation();
60 const QPixmap & getThumbnail() { return thumbnail; }
62 static QList<YTUser*> getCachedUsers() { return cache.values(); }
70 void thumbnailLoaded();
71 void error(QString message);
72 void notifyCountChanged();
75 void parseResponse(QByteArray bytes);
76 void requestError(QNetworkReply *reply);
77 void storeThumbnail(QByteArray bytes);
80 YTUser(QString userId, QObject *parent = 0);
81 void maybeLoadfromAPI();
84 static QHash<QString, YTUser*> cache;
95 bool loadingThumbnail;
104 // This is required in order to use QPointer<YTUser> as a QVariant
105 typedef QPointer<YTUser> YTUserPointer;
106 Q_DECLARE_METATYPE(YTUserPointer)