Skip to content

Commit

Permalink
added: GUIDialogExtendedProgressBar. a progress bar with a label (use…
Browse files Browse the repository at this point in the history
…d by pvr and epg)
  • Loading branch information
opdenkamp committed Feb 12, 2011
1 parent 655aa1b commit 83dd4d9
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 0 deletions.
48 changes: 48 additions & 0 deletions addons/skin.confluence/720p/DialogExtendedProgressBar.xml
@@ -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>
2 changes: 2 additions & 0 deletions xbmc/Application.cpp
Expand Up @@ -191,6 +191,7 @@
#include "settings/GUIDialogContentSettings.h" #include "settings/GUIDialogContentSettings.h"
#include "video/dialogs/GUIDialogVideoScan.h" #include "video/dialogs/GUIDialogVideoScan.h"
#include "dialogs/GUIDialogBusy.h" #include "dialogs/GUIDialogBusy.h"
#include "dialogs/GUIDialogExtendedProgressBar.h"
#include "dialogs/GUIDialogKeyboard.h" #include "dialogs/GUIDialogKeyboard.h"
#include "dialogs/GUIDialogYesNo.h" #include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogOK.h"
Expand Down Expand Up @@ -1068,6 +1069,7 @@ bool CApplication::Initialize()
#ifdef HAS_LINUX_NETWORK #ifdef HAS_LINUX_NETWORK
g_windowManager.Add(new CGUIDialogAccessPoints); // window id = 141 g_windowManager.Add(new CGUIDialogAccessPoints); // window id = 141
#endif #endif
g_windowManager.Add(new CGUIDialogExtendedProgressBar); // window id = 148


g_windowManager.Add(new CGUIDialogLockSettings); // window id = 131 g_windowManager.Add(new CGUIDialogLockSettings); // window id = 131


Expand Down
103 changes: 103 additions & 0 deletions xbmc/dialogs/GUIDialogExtendedProgressBar.cpp
@@ -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);
}
}

44 changes: 44 additions & 0 deletions xbmc/dialogs/GUIDialogExtendedProgressBar.h
@@ -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;
};
1 change: 1 addition & 0 deletions xbmc/dialogs/Makefile
Expand Up @@ -3,6 +3,7 @@ SRCS=GUIDialogBoxBase.cpp \
GUIDialogButtonMenu.cpp \ GUIDialogButtonMenu.cpp \
GUIDialogCache.cpp \ GUIDialogCache.cpp \
GUIDialogContextMenu.cpp \ GUIDialogContextMenu.cpp \
GUIDialogExtendedProgressBar.cpp \
GUIDialogFavourites.cpp \ GUIDialogFavourites.cpp \
GUIDialogFileBrowser.cpp \ GUIDialogFileBrowser.cpp \
GUIDialogGamepad.cpp \ GUIDialogGamepad.cpp \
Expand Down
1 change: 1 addition & 0 deletions xbmc/guilib/Key.h
Expand Up @@ -364,6 +364,7 @@
#define WINDOW_DIALOG_SLIDER 10145 #define WINDOW_DIALOG_SLIDER 10145
#define WINDOW_DIALOG_ADDON_INFO 10146 #define WINDOW_DIALOG_ADDON_INFO 10146
#define WINDOW_DIALOG_TEXT_VIEWER 10147 #define WINDOW_DIALOG_TEXT_VIEWER 10147
#define WINDOW_DIALOG_EXT_PROGRESS 10148


#define WINDOW_MUSIC_PLAYLIST 10500 #define WINDOW_MUSIC_PLAYLIST 10500
#define WINDOW_MUSIC_FILES 10501 #define WINDOW_MUSIC_FILES 10501
Expand Down

0 comments on commit 83dd4d9

Please sign in to comment.