forked from opdenkamp/xbmc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added: GUIDialogExtendedProgressBar. a progress bar with a label (use…
…d by pvr and epg)
- Loading branch information
Showing
6 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
<window id="614"> | |||
<defaultcontrol></defaultcontrol> | |||
<animation effect="slide" start="0,-70" end="0,0" time="100">WindowOpen</animation> | |||
<animation effect="slide" start="0,0" end="0,-70" delay="400" time="100">WindowClose</animation> | |||
<controls> | |||
<control type="group"> | |||
<posx>720</posx> | |||
<posy>0</posy> | |||
<animation effect="slide" end="-400,0" time="200" condition="Window.IsVisible(133)">conditional</animation> | |||
<animation effect="slide" end="0,-80" time="200" condition="Window.IsVisible(FullscreenVideo) | Window.IsVisible(Visualisation)">conditional</animation> | |||
<control type="image"> | |||
<posx>0</posx> | |||
<posy>-10</posy> | |||
<width>400</width> | |||
<height>70</height> | |||
<texture flipy="true" border="20,20,20,2">InfoMessagePanel.png</texture> | |||
</control> | |||
<control type="label" id="30"> | |||
<description>Header Label</description> | |||
<posx>15</posx> | |||
<posy>4</posy> | |||
<width>370</width> | |||
<height>18</height> | |||
<font>font10_title</font> | |||
<textcolor>selected</textcolor> | |||
<align>left</align> | |||
<aligny>center</aligny> | |||
</control> | |||
<control type="label" id="31"> | |||
<description>Title Label</description> | |||
<posx>15</posx> | |||
<posy>20</posy> | |||
<width>370</width> | |||
<height>20</height> | |||
<font>font10</font> | |||
<align>left</align> | |||
<aligny>center</aligny> | |||
</control> | |||
<control type="progress" id="32"> | |||
<description>progress control</description> | |||
<posx>15</posx> | |||
<posy>42</posy> | |||
<width>370</width> | |||
<height>8</height> | |||
</control> | |||
</control> | |||
</controls> | |||
</window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,103 @@ | |||
/* | |||
* Copyright (C) 2005-2010 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 "GUIDialogExtendedProgressBar.h" | |||
#include "guilib/GUIProgressControl.h" | |||
#include "guilib/GUISliderControl.h" | |||
#include "threads/SingleLock.h" | |||
|
|||
#define CONTROL_LABELHEADER 30 | |||
#define CONTROL_LABELTITLE 31 | |||
#define CONTROL_PROGRESS 32 | |||
|
|||
CGUIDialogExtendedProgressBar::CGUIDialogExtendedProgressBar(void) | |||
: CGUIDialog(WINDOW_DIALOG_EXT_PROGRESS, "DialogExtendedProgressBar.xml") | |||
{ | |||
m_loadOnDemand = false; | |||
} | |||
|
|||
bool CGUIDialogExtendedProgressBar::OnMessage(CGUIMessage& message) | |||
{ | |||
switch (message.GetMessage()) | |||
{ | |||
case GUI_MSG_WINDOW_INIT: | |||
{ | |||
CGUIDialog::OnMessage(message); | |||
|
|||
m_strTitle.Empty(); | |||
m_strHeader.Empty(); | |||
m_fPercentDone = -1.0f; | |||
|
|||
UpdateState(); | |||
return true; | |||
} | |||
break; | |||
} | |||
|
|||
return CGUIDialog::OnMessage(message); | |||
} | |||
|
|||
void CGUIDialogExtendedProgressBar::Render() | |||
{ | |||
if (m_bRunning) | |||
UpdateState(); | |||
|
|||
CGUIDialog::Render(); | |||
} | |||
|
|||
void CGUIDialogExtendedProgressBar::SetHeader(const CStdString& strHeader) | |||
{ | |||
CSingleLock lock (m_critical); | |||
|
|||
m_strHeader = strHeader; | |||
} | |||
|
|||
void CGUIDialogExtendedProgressBar::SetTitle(const CStdString& strTitle) | |||
{ | |||
CSingleLock lock (m_critical); | |||
|
|||
m_strTitle = strTitle; | |||
} | |||
|
|||
void CGUIDialogExtendedProgressBar::SetProgress(int currentItem, int itemCount) | |||
{ | |||
CSingleLock lock (m_critical); | |||
|
|||
m_fPercentDone = (float)((currentItem*100)/itemCount); | |||
if (m_fPercentDone > 100.0F) | |||
m_fPercentDone = 100.0F; | |||
} | |||
|
|||
void CGUIDialogExtendedProgressBar::UpdateState() | |||
{ | |||
CSingleLock lock (m_critical); | |||
|
|||
SET_CONTROL_LABEL(CONTROL_LABELHEADER, m_strHeader); | |||
SET_CONTROL_LABEL(CONTROL_LABELTITLE, m_strTitle); | |||
|
|||
if (m_fPercentDone > -1.0f) | |||
{ | |||
SET_CONTROL_VISIBLE(CONTROL_PROGRESS); | |||
CGUIProgressControl* pProgressCtrl=(CGUIProgressControl*)GetControl(CONTROL_PROGRESS); | |||
if (pProgressCtrl) pProgressCtrl->SetPercentage(m_fPercentDone); | |||
} | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,44 @@ | |||
#pragma once | |||
/* | |||
* Copyright (C) 2005-2010 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 "guilib/GUIDialog.h" | |||
|
|||
class CGUIDialogExtendedProgressBar : public CGUIDialog | |||
{ | |||
public: | |||
CGUIDialogExtendedProgressBar(void); | |||
virtual ~CGUIDialogExtendedProgressBar(void) {} | |||
virtual bool OnMessage(CGUIMessage& message); | |||
virtual void Render(); | |||
void SetProgress(int currentItem, int itemCount); | |||
void SetHeader(const CStdString& strHeader); | |||
void SetTitle(const CStdString& strTitle); | |||
void UpdateState(); | |||
|
|||
protected: | |||
CStdString m_strTitle; | |||
CStdString m_strHeader; | |||
CCriticalSection m_critical; | |||
float m_fPercentDone; | |||
int m_currentItem; | |||
int m_itemCount; | |||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters