1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
#pragma once
/*
* Copyright (C) 2012 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "PVRChannelGroup.h"
namespace PVR
{
class CPVRChannelGroups;
class CPVRDatabase;
/** XBMC's internal group, the group containing all channels */
class CPVRChannelGroupInternal : public CPVRChannelGroup
{
friend class CPVRChannelGroups;
friend class CPVRDatabase;
public:
/*!
* @brief Create a new internal channel group.
* @param bRadio True if this group holds radio channels.
*/
CPVRChannelGroupInternal(bool bRadio);
CPVRChannelGroupInternal(const CPVRChannelGroup &group);
virtual ~CPVRChannelGroupInternal(void);
/**
* @brief The amount of channels in this container.
* @return The amount of channels in this container.
*/
int GetNumHiddenChannels() const { return m_iHiddenChannels; }
/*!
* @brief Add or update a channel in this table.
* @param channel The channel to update.
* @return True if the channel was updated and persisted.
*/
bool UpdateChannel(const CPVRChannel &channel);
/*!
* @brief Add a channel to this internal group.
* @param iChannelNumber The channel number to use for this channel or 0 to add it to the back.
* @param bSortAndRenumber Set to false to not to sort the group after adding a channel
*/
bool InsertInGroup(CPVRChannel &channel, int iChannelNumber = 0, bool bSortAndRenumber = true);
/*!
* @brief Callback for add-ons to update a channel.
* @param channel The updated channel.
* @return True if the channel has been updated succesfully, false otherwise.
*/
void UpdateFromClient(const CPVRChannel &channel, unsigned int iChannelNumber = 0);
/*!
* @see CPVRChannelGroup::IsGroupMember
*/
bool IsGroupMember(const CPVRChannel &channel) const;
/*!
* @see CPVRChannelGroup::AddToGroup
*/
bool AddToGroup(CPVRChannel &channel, int iChannelNumber = 0, bool bSortAndRenumber = true);
/*!
* @see CPVRChannelGroup::RemoveFromGroup
*/
bool RemoveFromGroup(const CPVRChannel &channel);
/*!
* @see CPVRChannelGroup::MoveChannel
*/
bool MoveChannel(unsigned int iOldChannelNumber, unsigned int iNewChannelNumber, bool bSaveInDb = true);
/*!
* @see CPVRChannelGroup::GetMembers
*/
int GetMembers(CFileItemList &results, bool bGroupMembers = true) const;
/*!
* @brief Check whether the group name is still correct after the language setting changed.
*/
void CheckGroupName(void);
/*!
* @brief Create an EPG table for each channel.
* @brief bForce Create the tables, even if they already have been created before.
* @return True if all tables were created successfully, false otherwise.
*/
bool CreateChannelEpgs(bool bForce = false);
bool AddNewChannel(const CPVRChannel &channel, unsigned int iChannelNumber = 0) { UpdateFromClient(channel, iChannelNumber); return true; }
protected:
/*!
* @brief Load all channels from the database.
* @param bCompress Compress the database after changing anything.
* @return The amount of channels that were loaded.
*/
int LoadFromDb(bool bCompress = false);
/*!
* @brief Load all channels from the clients.
* @return The amount of channels that were loaded.
*/
int LoadFromClients(void);
/*!
* @brief Check if this group is the internal group containing all channels.
* @return True if it's the internal group, false otherwise.
*/
bool IsInternalGroup(void) const { return true; }
/*!
* @brief Update the current channel list with the given list.
*
* Update the current channel list with the given list.
* Only the new channels will be present in the passed list after this call.
*
* @param channels The channels to use to update this list.
* @return True if everything went well, false otherwise.
*/
bool UpdateGroupEntries(const CPVRChannelGroup &channels);
bool AddAndUpdateChannels(const CPVRChannelGroup &channels, bool bUseBackendChannelNumbers);
/*!
* @brief Refresh the channel list from the clients.
*/
bool Update(void);
/*!
* @brief Remove invalid channels and updates the channel numbers.
*/
bool Renumber(void);
/*!
* @brief Load the channels from the database.
*
* Load the channels from the database.
* If no channels are stored in the database, then the channels will be loaded from the clients.
*
* @return The amount of channels that were added.
*/
int Load(void);
/*!
* @brief Update the vfs paths of all channels.
*/
void UpdateChannelPaths(void);
void CreateChannelEpg(CPVRChannelPtr channel, bool bForce = false);
int m_iHiddenChannels; /*!< the amount of hidden channels in this container */
};
}
|