File indexing completed on 2024-05-19 05:57:21

0001 // SPDX-FileCopyrightText: 2022 Plata Hill <plata.hill@kdemail.net>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #pragma once
0005 
0006 #include <QObject>
0007 
0008 #include "channeldata.h"
0009 #include "programfactory.h"
0010 #include "types.h"
0011 
0012 #include <QVector>
0013 
0014 class Channel;
0015 
0016 class ChannelFactory : public QObject
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit ChannelFactory(bool onlyFavorites);
0022     ~ChannelFactory() = default;
0023 
0024     void setOnlyFavorites(bool onlyFavorites);
0025     size_t count() const;
0026     Channel *create(int index) const;
0027     void load() const;
0028     void update(const ChannelId &id);
0029 
0030 private:
0031     mutable QVector<ChannelData> m_channels;
0032     bool m_onlyFavorites;
0033     mutable ProgramFactory m_programFactory;
0034 };