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 YTChannel : public QObject {
35 static YTChannel* forId(const QString &channelId);
36 static void subscribe(const QString &channelId);
37 static void unsubscribe(const QString &channelId);
38 static bool isSubscribed(const QString &channelId);
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 getChannelId() const { return channelId; }
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<YTChannel*> getCachedChannels() { return cache.values(); }
73 void thumbnailLoaded();
74 void error(QString message);
75 void notifyCountChanged();
78 void parseResponse(const QByteArray &bytes);
79 void requestError(QNetworkReply *reply);
80 void storeThumbnail(const QByteArray &bytes);
83 YTChannel(const QString &channelId, QObject *parent = 0);
84 void maybeLoadfromAPI();
87 static QHash<QString, YTChannel*> cache;
98 bool loadingThumbnail;
107 // This is required in order to use QPointer<YTUser> as a QVariant
108 typedef QPointer<YTChannel> YTChannelPointer;
109 Q_DECLARE_METATYPE(YTChannelPointer)
111 #endif // YTCHANNEL_H