| 1 |
/* |
| 2 |
* Copyright (C) 2012-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "pvr/channels/PVRChannelGroupFromUser.h" |
| 12 |
|
| 13 |
#include <memory> |
| 14 |
#include <vector> |
| 15 |
|
| 16 |
namespace PVR |
| 17 |
{ |
| 18 |
class CPVRChannel; |
| 19 |
class CPVRChannelNumber; |
| 20 |
|
| 21 |
class CPVRChannelGroupAllChannels : public CPVRChannelGroupFromUser |
| 22 |
{ |
| 23 |
public: |
| 24 |
CPVRChannelGroupAllChannels() = delete; |
| 25 |
|
| 26 |
/*! |
| 27 |
* @brief Create a new all channels channel group. |
| 28 |
* @param bRadio True if this group holds radio channels. |
| 29 |
*/ |
| 30 |
explicit CPVRChannelGroupAllChannels(bool bRadio); |
| 31 |
|
| 32 |
/*! |
| 33 |
* @brief Create a new all channels channel group. |
| 34 |
* @param path The path for the new group. |
| 35 |
*/ |
| 36 |
explicit CPVRChannelGroupAllChannels(const CPVRChannelsPath& path); |
| 37 |
|
| 38 |
~CPVRChannelGroupAllChannels() override; |
| 39 |
|
| 40 |
/*! |
| 41 |
* @see CPVRChannelGroup::IsGroupMember |
| 42 |
*/ |
| 43 |
bool IsGroupMember( |
| 44 |
const std::shared_ptr<const CPVRChannelGroupMember>& groupMember) const override; |
| 45 |
|
| 46 |
/*! |
| 47 |
* @see CPVRChannelGroup::AppendToGroup |
| 48 |
*/ |
| 49 |
bool AppendToGroup(const std::shared_ptr<const CPVRChannelGroupMember>& groupMember) override; |
| 50 |
|
| 51 |
/*! |
| 52 |
* @see CPVRChannelGroup::RemoveFromGroup |
| 53 |
*/ |
| 54 |
bool RemoveFromGroup(const std::shared_ptr<const CPVRChannelGroupMember>& groupMember) override; |
| 55 |
|
| 56 |
/*! |
| 57 |
* @brief Check whether the group name is still correct after the language setting changed. |
| 58 |
*/ |
| 59 |
void CheckGroupName(); |
| 60 |
|
| 61 |
/*! |
| 62 |
* @brief Check whether this group could be deleted by the user. |
| 63 |
* @return True if the group could be deleted, false otherwise. |
| 64 |
*/ |
| 65 |
bool SupportsDelete() const override { return false; } |
| 66 |
|
| 67 |
/*! |
| 68 |
* @brief Check whether this group is owner of the channel instances it contains. |
| 69 |
* @return True if owner, false otherwise. |
| 70 |
*/ |
| 71 |
bool IsChannelsOwner() const override { return true; } |
| 72 |
|
| 73 |
protected: |
| 74 |
/*! |
| 75 |
* @brief Remove deleted group members from this group. Delete stale channels. |
| 76 |
* @param groupMembers The group members to use to update this list. |
| 77 |
* @return The removed members . |
| 78 |
*/ |
| 79 |
std::vector<std::shared_ptr<CPVRChannelGroupMember>> RemoveDeletedGroupMembers( |
| 80 |
const std::vector<std::shared_ptr<CPVRChannelGroupMember>>& groupMembers) override; |
| 81 |
|
| 82 |
/*! |
| 83 |
* @brief Update data with 'all channels' group members from the given clients, sync with local data. |
| 84 |
* @param clients The clients to fetch data from. Leave empty to fetch data from all created clients. |
| 85 |
* @return True on success, false otherwise. |
| 86 |
*/ |
| 87 |
bool UpdateFromClients(const std::vector<std::shared_ptr<CPVRClient>>& clients) override; |
| 88 |
|
| 89 |
private: |
| 90 |
/*! |
| 91 |
* @brief Return the type of this group. |
| 92 |
*/ |
| 93 |
int GroupType() const override { return PVR_GROUP_TYPE_ALL_CHANNELS; } |
| 94 |
}; |
| 95 |
} // namespace PVR |