Permalink
Browse files

Allow widget dependencies to work with progress bar.

Only images and textareas could be used previously.
Ideally, dependencies should work with any ui objects based on their visibility status. But trying to keep changes to a minimum.
  • Loading branch information...
jyavenard committed Jul 9, 2013
1 parent 8e614f1 commit 3a7abbf272866a24522a8735a963d0e8153b993f
@@ -16,14 +16,15 @@ MythUIProgressBar::MythUIProgressBar(MythUIType *parent, const QString &name)
: MythUIType(parent, name),
m_layout(LayoutHorizontal), m_effect(EffectReveal),
m_total(0), m_start(0),
m_current(0)
m_current(0), m_firstdepend(true)
{
}
void MythUIProgressBar::Reset()
{
m_total = m_start = m_current = 0;
CalculatePosition();
emit DependChanged(false);
MythUIType::Reset();
}
@@ -188,3 +189,13 @@ void MythUIProgressBar::CreateCopy(MythUIType *parent)
MythUIProgressBar *progressbar = new MythUIProgressBar(parent, objectName());
progressbar->CopyFrom(this);
}
void MythUIProgressBar::SetVisible(bool visible)
{
if (m_firstdepend || visible != m_Visible)
{
emit DependChanged(!visible);
m_firstdepend = false;
}
MythUIType::SetVisible(visible);
}
@@ -26,6 +26,7 @@ class MUI_PUBLIC MythUIProgressBar : public MythUIType
void SetUsed(int);
void SetTotal(int);
int GetUsed(void) { return m_current; }
virtual void SetVisible(bool visible);
protected:
virtual bool ParseElement(
@@ -40,6 +41,7 @@ class MUI_PUBLIC MythUIProgressBar : public MythUIType
int m_total;
int m_start;
int m_current;
int m_firstdepend;
void CalculatePosition(void);
};
@@ -135,7 +135,7 @@ class MUI_PUBLIC MythUIType : public QObject, public XMLParseBase
virtual QRegion GetDirtyArea(void) const;
bool IsVisible(bool recurse = false) const;
void SetVisible(bool visible);
virtual void SetVisible(bool visible);
void MoveTo(QPoint destXY, QPoint speedXY);
//FIXME: make mode enum

0 comments on commit 3a7abbf

Please sign in to comment.