11 #include "XBDateTime.h" 16 #include <unordered_map> 27 GridItem(
const std::shared_ptr<CFileItem>& _item,
float _width,
int _startBlock,
int _endBlock)
28 : item(_item), originWidth(_width), width(_width), startBlock(_startBlock), endBlock(_endBlock)
32 bool operator==(
const GridItem& other)
const 34 return (startBlock == other.startBlock && endBlock == other.endBlock);
37 std::shared_ptr<CFileItem> item;
38 float originWidth = 0.0f;
49 static constexpr
int MINSPERBLOCK = 5;
54 void Initialize(
const std::unique_ptr<CFileItemList>& items,
65 static const int INVALID_INDEX = -1;
66 void FindChannelAndBlockIndex(
int channelUid,
67 unsigned int broadcastUid,
70 int& newBlockIndex)
const;
72 void FreeChannelMemory(
int keepStart,
int keepEnd);
73 bool FreeProgrammeMemory(
int firstChannel,
int lastChannel,
int firstBlock,
int lastBlock);
74 void FreeRulerMemory(
int keepStart,
int keepEnd);
76 std::shared_ptr<CFileItem> GetChannelItem(
int iIndex)
const {
return m_channelItems[iIndex]; }
77 bool HasChannelItems()
const {
return !m_channelItems.empty(); }
78 int ChannelItemsSize()
const {
return static_cast<int>(m_channelItems.size()); }
79 int GetLastChannel()
const 81 return m_channelItems.empty() ? -1 :
static_cast<int>(m_channelItems.size()) - 1;
84 std::shared_ptr<CFileItem> GetRulerItem(
int iIndex)
const {
return m_rulerItems[iIndex]; }
85 int RulerItemsSize()
const {
return static_cast<int>(m_rulerItems.size()); }
87 int GridItemsSize()
const {
return m_blocks; }
88 bool IsSameGridItem(
int iChannel,
int iBlock1,
int iBlock2)
const;
89 std::shared_ptr<CFileItem> GetGridItem(
int iChannel,
int iBlock)
const;
90 int GetGridItemStartBlock(
int iChannel,
int iBlock)
const;
91 int GetGridItemEndBlock(
int iChannel,
int iBlock)
const;
92 CDateTime GetGridItemEndTime(
int iChannel,
int iBlock)
const;
93 float GetGridItemWidth(
int iChannel,
int iBlock)
const;
94 float GetGridItemOriginWidth(
int iChannel,
int iBlock)
const;
95 void DecreaseGridItemWidth(
int iChannel,
int iBlock,
float fSize);
97 bool IsZeroGridDuration()
const {
return (m_gridEnd - m_gridStart) ==
CDateTimeSpan(0, 0, 0, 0); }
98 const CDateTime& GetGridStart()
const {
return m_gridStart; }
99 const CDateTime& GetGridEnd()
const {
return m_gridEnd; }
100 unsigned int GetGridStartPadding()
const;
102 unsigned int GetPageNowOffset()
const;
103 int GetNowBlock()
const;
104 int GetLastBlock()
const {
return m_blocks - 1; }
106 CDateTime GetStartTimeForBlock(
int block)
const;
107 int GetBlock(
const CDateTime& datetime)
const;
108 int GetFirstEventBlock(
const std::shared_ptr<const CPVREpgInfoTag>& event)
const;
109 int GetLastEventBlock(
const std::shared_ptr<const CPVREpgInfoTag>& event)
const;
110 bool IsEventMemberOfBlock(
const std::shared_ptr<const CPVREpgInfoTag>& event,
int iBlock)
const;
112 std::unique_ptr<CFileItemList> GetCurrentTimeLineItems(
int firstChannel,
int numChannels)
const;
115 GridItem* GetGridItemPtr(
int iChannel,
int iBlock)
const;
116 std::shared_ptr<CFileItem> CreateGapItem(
int iChannel)
const;
117 std::shared_ptr<CFileItem> GetItem(
int iChannel,
int iBlock)
const;
119 std::vector<std::shared_ptr<CPVREpgInfoTag>> GetEPGTimeline(
int iChannel,
125 std::vector<std::shared_ptr<CFileItem>> tags;
130 using EpgTagsMap = std::unordered_map<int, EpgTags>;
132 std::shared_ptr<CFileItem> CreateEpgTags(
int iChannel,
int iBlock)
const;
133 std::shared_ptr<CFileItem> GetEpgTags(EpgTagsMap::iterator& itEpg,
136 std::shared_ptr<CFileItem> GetEpgTagsBefore(EpgTags& epgTags,
int iChannel,
int iBlock)
const;
137 std::shared_ptr<CFileItem> GetEpgTagsAfter(EpgTags& epgTags,
int iChannel,
int iBlock)
const;
139 mutable EpgTagsMap m_epgItems;
144 std::vector<std::shared_ptr<CFileItem>> m_channelItems;
145 std::vector<std::shared_ptr<CFileItem>> m_rulerItems;
147 struct GridCoordinates
149 GridCoordinates(
int _channel,
int _block) : channel(_channel), block(_block) {}
151 bool operator==(
const GridCoordinates& other)
const 153 return (channel == other.channel && block == other.block);
160 struct GridCoordinatesHash
162 std::size_t operator()(
const GridCoordinates& coordinates)
const 164 return std::hash<int>()(coordinates.channel) ^ std::hash<int>()(coordinates.block);
168 mutable std::unordered_map<GridCoordinates, GridItem, GridCoordinatesHash> m_gridIndex;
171 float m_fBlockSize = 0.0f;
173 int m_firstActiveChannel = 0;
174 int m_lastActiveChannel = 0;
175 int m_firstActiveBlock = 0;
176 int m_lastActiveBlock = 0;
Definition: ContextMenuManager.h:24
Represents a list of files.
Definition: FileItem.h:702
Definition: GUIEPGGridContainerModel.h:46
Definition: EpgInfoTag.h:28
Definition: GUIEPGGridContainerModel.h:25
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
Definition: XBDateTime.h:21
Represents a file on a share.
Definition: FileItem.h:102