Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
progressbar: moved UpdateState() calls from Render() to Process()
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Aug 17, 2012
1 parent e66ce8f commit 97733f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions xbmc/dialogs/GUIDialogExtendedProgressBar.cpp
Expand Up @@ -85,7 +85,7 @@ bool CGUIDialogExtendedProgressBar::OnMessage(CGUIMessage& message)
m_iLastSwitchTime = XbmcThreads::SystemClockMillis();
CGUIDialog::OnMessage(message);

UpdateState();
UpdateState(0);
return true;
}
break;
Expand All @@ -94,15 +94,15 @@ bool CGUIDialogExtendedProgressBar::OnMessage(CGUIMessage& message)
return CGUIDialog::OnMessage(message);
}

void CGUIDialogExtendedProgressBar::Render()
void CGUIDialogExtendedProgressBar::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
if (m_active)
UpdateState();
UpdateState(currentTime);

CGUIDialog::Render();
CGUIDialog::Process(currentTime, dirtyregions);
}

void CGUIDialogExtendedProgressBar::UpdateState()
void CGUIDialogExtendedProgressBar::UpdateState(unsigned int currentTime)
{
bool bNoItemsLeft(false);
string strHeader;
Expand All @@ -127,10 +127,10 @@ void CGUIDialogExtendedProgressBar::UpdateState()
}

// update the current item ptr
unsigned int iNow = XbmcThreads::SystemClockMillis();
if (iNow - m_iLastSwitchTime >= ITEM_SWITCH_TIME_MS)
if (currentTime > m_iLastSwitchTime &&
currentTime - m_iLastSwitchTime >= ITEM_SWITCH_TIME_MS)
{
m_iLastSwitchTime = iNow;
m_iLastSwitchTime = currentTime;

// select next item
if (++m_iCurrentItem > m_handles.size() - 1)
Expand All @@ -149,7 +149,7 @@ void CGUIDialogExtendedProgressBar::UpdateState()
}
else
{
bNoItemsLeft = true;
bNoItemsLeft = true;
}
}

Expand Down
4 changes: 2 additions & 2 deletions xbmc/dialogs/GUIDialogExtendedProgressBar.h
Expand Up @@ -57,12 +57,12 @@ class CGUIDialogExtendedProgressBar : public CGUIDialog
CGUIDialogExtendedProgressBar(void);
virtual ~CGUIDialogExtendedProgressBar(void) {};
virtual bool OnMessage(CGUIMessage& message);
virtual void Render();
virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);

CGUIDialogProgressBarHandle *GetHandle(const std::string &strTitle);

protected:
void UpdateState();
void UpdateState(unsigned int currentTime);

CCriticalSection m_critSection;
unsigned int m_iCurrentItem;
Expand Down

0 comments on commit 97733f7

Please sign in to comment.