Skip to content

Commit

Permalink
Merge pull request #3542 from xhaggi/epg-time-indicator
Browse files Browse the repository at this point in the history
[pvr] EPG content-progress indicator
  • Loading branch information
jmarshallnz committed Nov 6, 2013
2 parents cb381b3 + 55ecae7 commit d687d62
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 3 deletions.
1 change: 1 addition & 0 deletions addons/skin.confluence/720p/ViewsPVR.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@
<scrolltime>350</scrolltime> <scrolltime>350</scrolltime>
<timeblocks>40</timeblocks> <timeblocks>40</timeblocks>
<rulerunit>6</rulerunit> <rulerunit>6</rulerunit>
<progresstexture border="5">PVR-EpgProgressIndicator.png</progresstexture>
<onleft>31</onleft> <onleft>31</onleft>
<onright>31</onright> <onright>31</onright>
<onup>10</onup> <onup>10</onup>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions xbmc/XBDateTime.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ int CDateTimeSpan::GetSeconds() const
return (int)(((time.QuadPart/SECONDS_TO_FILETIME%SECONDS_PER_DAY)%SECONDS_PER_HOUR)%SECONDS_PER_MINUTE)%SECONDS_PER_MINUTE; return (int)(((time.QuadPart/SECONDS_TO_FILETIME%SECONDS_PER_DAY)%SECONDS_PER_HOUR)%SECONDS_PER_MINUTE)%SECONDS_PER_MINUTE;
} }


int CDateTimeSpan::GetSecondsTotal() const
{
ULARGE_INTEGER time;
ToULargeInt(time);

return (int)(time.QuadPart/SECONDS_TO_FILETIME);
}

void CDateTimeSpan::SetFromPeriod(const CStdString &period) void CDateTimeSpan::SetFromPeriod(const CStdString &period)
{ {
long days = atoi(period.c_str()); long days = atoi(period.c_str());
Expand Down
1 change: 1 addition & 0 deletions xbmc/XBDateTime.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CDateTimeSpan
int GetHours() const; int GetHours() const;
int GetMinutes() const; int GetMinutes() const;
int GetSeconds() const; int GetSeconds() const;
int GetSecondsTotal() const;


private: private:
void ToULargeInt(ULARGE_INTEGER& time) const; void ToULargeInt(ULARGE_INTEGER& time) const;
Expand Down
40 changes: 39 additions & 1 deletion xbmc/epg/GUIEPGGridContainer.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ using namespace std;


CGUIEPGGridContainer::CGUIEPGGridContainer(int parentID, int controlID, float posX, float posY, float width, CGUIEPGGridContainer::CGUIEPGGridContainer(int parentID, int controlID, float posX, float posY, float width,
float height, ORIENTATION orientation, int scrollTime, float height, ORIENTATION orientation, int scrollTime,
int preloadItems, int timeBlocks, int rulerUnit) int preloadItems, int timeBlocks, int rulerUnit, const CTextureInfo& progressIndicatorTexture)
: IGUIContainer(parentID, controlID, posX, posY, width, height) : IGUIContainer(parentID, controlID, posX, posY, width, height)
, m_guiProgressIndicatorTexture(posX, posY, width, height, progressIndicatorTexture)
{ {
ControlType = GUICONTAINER_EPGGRID; ControlType = GUICONTAINER_EPGGRID;
m_blocksPerPage = timeBlocks; m_blocksPerPage = timeBlocks;
Expand Down Expand Up @@ -108,6 +109,7 @@ void CGUIEPGGridContainer::Process(unsigned int currentTime, CDirtyRegionList &d
ProcessChannels(currentTime, dirtyregions); ProcessChannels(currentTime, dirtyregions);
ProcessRuler(currentTime, dirtyregions); ProcessRuler(currentTime, dirtyregions);
ProcessProgrammeGrid(currentTime, dirtyregions); ProcessProgrammeGrid(currentTime, dirtyregions);
ProcessProgressIndicator(currentTime, dirtyregions);


CGUIControl::Process(currentTime, dirtyregions); CGUIControl::Process(currentTime, dirtyregions);
} }
Expand All @@ -117,6 +119,7 @@ void CGUIEPGGridContainer::Render()
RenderChannels(); RenderChannels();
RenderRuler(); RenderRuler();
RenderProgrammeGrid(); RenderProgrammeGrid();
RenderProgressIndicator();


CGUIControl::Render(); CGUIControl::Render();
} }
Expand Down Expand Up @@ -540,6 +543,41 @@ void CGUIEPGGridContainer::RenderProgrammeGrid()
g_graphicsContext.RestoreClipRegion(); g_graphicsContext.RestoreClipRegion();
} }


void CGUIEPGGridContainer::ProcessProgressIndicator(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
CPoint originRuler = CPoint(m_rulerPosX, m_rulerPosY) + m_renderOffset;
float width = ((CDateTime::GetUTCDateTime() - m_gridStart).GetSecondsTotal() * m_blockSize) / (MINSPERBLOCK * 60) - m_programmeScrollOffset;

if (m_orientation == VERTICAL)
{
m_guiProgressIndicatorTexture.SetWidth(width);
m_guiProgressIndicatorTexture.SetPosition(originRuler.x, originRuler.y);
}
else
{
m_guiProgressIndicatorTexture.SetHeight(width);
m_guiProgressIndicatorTexture.SetPosition(originRuler.x, originRuler.y);
}

m_guiProgressIndicatorTexture.Process(currentTime);
}

void CGUIEPGGridContainer::RenderProgressIndicator()
{
bool render = false;

if (m_orientation == VERTICAL)
render = g_graphicsContext.SetClipRegion(m_rulerPosX, m_rulerPosY, m_gridWidth, m_height);
else
render = g_graphicsContext.SetClipRegion(m_rulerPosX, m_rulerPosY, m_width, m_gridHeight);

if(render)
{
m_guiProgressIndicatorTexture.Render();
g_graphicsContext.RestoreClipRegion();
}
}

void CGUIEPGGridContainer::ProcessItem(float posX, float posY, CGUIListItem* item, CGUIListItem *&lastitem, void CGUIEPGGridContainer::ProcessItem(float posX, float posY, CGUIListItem* item, CGUIListItem *&lastitem,
bool focused, CGUIListItemLayout* normallayout, CGUIListItemLayout* focusedlayout, bool focused, CGUIListItemLayout* normallayout, CGUIListItemLayout* focusedlayout,
unsigned int currentTime, CDirtyRegionList &dirtyregions, float resize /* = -1.0f */) unsigned int currentTime, CDirtyRegionList &dirtyregions, float resize /* = -1.0f */)
Expand Down
6 changes: 5 additions & 1 deletion xbmc/epg/GUIEPGGridContainer.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace EPG
public: public:
CGUIEPGGridContainer(int parentID, int controlID, float posX, float posY, float width, float height, CGUIEPGGridContainer(int parentID, int controlID, float posX, float posY, float width, float height,
ORIENTATION orientation, int scrollTime, int preloadItems, int minutesPerPage, ORIENTATION orientation, int scrollTime, int preloadItems, int minutesPerPage,
int rulerUnit); int rulerUnit, const CTextureInfo& progressIndicatorTexture);
virtual ~CGUIEPGGridContainer(void); virtual ~CGUIEPGGridContainer(void);
virtual CGUIEPGGridContainer *Clone() const { return new CGUIEPGGridContainer(*this); }; virtual CGUIEPGGridContainer *Clone() const { return new CGUIEPGGridContainer(*this); };


Expand Down Expand Up @@ -136,9 +136,11 @@ namespace EPG
void ProcessChannels(unsigned int currentTime, CDirtyRegionList &dirtyregions); void ProcessChannels(unsigned int currentTime, CDirtyRegionList &dirtyregions);
void ProcessRuler(unsigned int currentTime, CDirtyRegionList &dirtyregions); void ProcessRuler(unsigned int currentTime, CDirtyRegionList &dirtyregions);
void ProcessProgrammeGrid(unsigned int currentTime, CDirtyRegionList &dirtyregions); void ProcessProgrammeGrid(unsigned int currentTime, CDirtyRegionList &dirtyregions);
void ProcessProgressIndicator(unsigned int currentTime, CDirtyRegionList &dirtyregions);
void RenderChannels(); void RenderChannels();
void RenderRuler(); void RenderRuler();
void RenderProgrammeGrid(); void RenderProgrammeGrid();
void RenderProgressIndicator();


CPoint m_renderOffset; ///< \brief render offset of the first item in the list \sa SetRenderOffset CPoint m_renderOffset; ///< \brief render offset of the first item in the list \sa SetRenderOffset


Expand Down Expand Up @@ -212,6 +214,8 @@ namespace EPG
CDateTime m_gridStart; CDateTime m_gridStart;
CDateTime m_gridEnd; CDateTime m_gridEnd;


CGUITexture m_guiProgressIndicatorTexture;

struct GridItemsPtr **m_gridIndex; struct GridItemsPtr **m_gridIndex;
GridItemsPtr *m_item; GridItemsPtr *m_item;
CGUIListItem *m_lastItem; CGUIListItem *m_lastItem;
Expand Down
4 changes: 3 additions & 1 deletion xbmc/guilib/GUIControlFactory.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
CTextureInfo textureRadioOnFocus, textureRadioOnNoFocus; CTextureInfo textureRadioOnFocus, textureRadioOnNoFocus;
CTextureInfo textureRadioOffFocus, textureRadioOffNoFocus; CTextureInfo textureRadioOffFocus, textureRadioOffNoFocus;
CTextureInfo imageNoFocus, imageFocus; CTextureInfo imageNoFocus, imageFocus;
CTextureInfo textureProgressIndicator;
CGUIInfoLabel texturePath; CGUIInfoLabel texturePath;
CRect borderSize; CRect borderSize;


Expand Down Expand Up @@ -989,6 +990,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
XMLUtils::GetBoolean(pControlNode,"pulseonselect", bPulse); XMLUtils::GetBoolean(pControlNode,"pulseonselect", bPulse);
XMLUtils::GetInt(pControlNode, "timeblocks", timeBlocks); XMLUtils::GetInt(pControlNode, "timeblocks", timeBlocks);
XMLUtils::GetInt(pControlNode, "rulerunit", rulerUnit); XMLUtils::GetInt(pControlNode, "rulerunit", rulerUnit);
GetTexture(pControlNode, "progresstexture", textureProgressIndicator);


GetInfoTexture(pControlNode, "imagepath", texture, texturePath, parentID); GetInfoTexture(pControlNode, "imagepath", texture, texturePath, parentID);


Expand Down Expand Up @@ -1333,7 +1335,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
} }
else if (type == CGUIControl::GUICONTAINER_EPGGRID) else if (type == CGUIControl::GUICONTAINER_EPGGRID)
{ {
control = new CGUIEPGGridContainer(parentID, id, posX, posY, width, height, orientation, scrollTime, preloadItems, timeBlocks, rulerUnit); control = new CGUIEPGGridContainer(parentID, id, posX, posY, width, height, orientation, scrollTime, preloadItems, timeBlocks, rulerUnit, textureProgressIndicator);
((CGUIEPGGridContainer *)control)->LoadLayout(pControlNode); ((CGUIEPGGridContainer *)control)->LoadLayout(pControlNode);
((CGUIEPGGridContainer *)control)->SetRenderOffset(offset); ((CGUIEPGGridContainer *)control)->SetRenderOffset(offset);
((CGUIEPGGridContainer *)control)->SetType(viewType, viewLabel); ((CGUIEPGGridContainer *)control)->SetType(viewType, viewLabel);
Expand Down

0 comments on commit d687d62

Please sign in to comment.