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 YTChannel : public QObject {
32 static YTChannel* forId(const QString &channelId);
33 static bool subscribe(const QString &channelId);
34 static void unsubscribe(const QString &channelId);
35 static bool isSubscribed(const QString &channelId);
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 getChannelId() const { return channelId; }
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 QString latestVideoId();
64 static const QHash<QString, YTChannel*> &getCachedChannels() { return cache; }
72 void thumbnailLoaded();
73 void error(QString message);
74 void notifyCountChanged();
77 void parseResponse(const QByteArray &bytes);
78 void requestError(const QString &message);
79 void storeThumbnail(const QByteArray &bytes);
82 YTChannel(const QString &channelId, QObject *parent = 0);
83 void maybeLoadfromAPI();
86 static QHash<QString, YTChannel*> cache;
97 bool loadingThumbnail;
106 // This is required in order to use QPointer<YTUser> as a QVariant
107 typedef QPointer<YTChannel> YTChannelPointer;
108 Q_DECLARE_METATYPE(YTChannelPointer)
110 #endif // YTCHANNEL_H