File indexing completed on 2025-02-23 04:35:15

0001 // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 #include "abstractlistmodel.h"
0005 
0006 #include "plasmatube.h"
0007 
0008 #include <KLocalizedString>
0009 
0010 #include <QFutureWatcher>
0011 #include <QtConcurrent>
0012 
0013 AbstractListModel::AbstractListModel(QObject *parent)
0014     : QAbstractListModel(parent)
0015 {
0016 }
0017 
0018 QHash<int, QByteArray> AbstractListModel::roleNames() const
0019 {
0020     return {{IdRole, "id"},
0021             {TypeRole, "type"},
0022             {TitleRole, "title"},
0023             {ThumbnailRole, "thumbnail"},
0024             {LengthRole, "length"},
0025             {ViewCountRole, "viewCount"},
0026             {AuthorRole, "author"},
0027             {AuthorIdRole, "authorId"},
0028             {AuthorUrlRole, "authorUrl"},
0029             {PublishedRole, "published"},
0030             {PublishedTextRole, "publishedText"},
0031             {DescriptionRole, "description"},
0032             {DescriptionHtmlRole, "descriptionHtml"},
0033             {LiveNowRole, "liveNow"},
0034             {PaidRole, "paid"},
0035             {PremiumRole, "premium"},
0036             {WatchedRole, "watched"},
0037             {VideoCountRole, "videoCount"},
0038             {ChannelNameRole, "channelName"},
0039             {ChannelAvatarRole, "channelAvatar"}};
0040 }
0041 
0042 bool AbstractListModel::isLoading() const
0043 {
0044     return m_loading;
0045 }
0046 
0047 void AbstractListModel::setLoading(const bool loading)
0048 {
0049     if (loading != m_loading) {
0050         m_loading = loading;
0051         Q_EMIT isLoadingChanged();
0052     }
0053 }
0054 
0055 #include "moc_abstractlistmodel.cpp"