Skip to content

Commit

Permalink
Add support for statetypes in MythUIButtonTree
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Jan 30, 2012
1 parent 70ca0bf commit 4620a82
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.25.20120128-1"
#define MYTH_BINARY_VERSION "0.25.20120130-1"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
19 changes: 19 additions & 0 deletions mythtv/libs/libmythui/mythgenerictree.cpp
Expand Up @@ -734,6 +734,7 @@ MythUIButtonListItem *MythGenericTree::CreateListButton(MythUIButtonList *list)
item->SetData(qVariantFromValue(this));
item->SetTextFromMap(m_strings);
item->SetImageFromMap(m_imageFilenames);
item->SetStatesFromMap(m_states);

if (visibleChildCount() > 0)
item->setDrawArrow(true);
Expand Down Expand Up @@ -796,3 +797,21 @@ QString MythGenericTree::GetImage(const QString &name) const

return QString();
}

void MythGenericTree::DisplayState(const QString &state, const QString &name)
{
if (!name.isEmpty())
m_states.insert(name, state);
}

QString MythGenericTree::GetState(const QString &name) const
{
if (name.isEmpty())
return QString();

QMap<QString, QString>::const_iterator it = m_states.find(name);
if (it != m_states.end())
return *it;

return QString();
}
3 changes: 3 additions & 0 deletions mythtv/libs/libmythui/mythgenerictree.h
Expand Up @@ -78,6 +78,9 @@ class MUI_PUBLIC MythGenericTree
void SetImage(const QString &filename, const QString &name="");
QString GetImage(const QString &name="") const;

void DisplayState(const QString &state, const QString &name="");
QString GetState(const QString &name="") const;

void SetData(QVariant data) { m_data = data; }
const QVariant GetData(void) const { return m_data; }

Expand Down
6 changes: 6 additions & 0 deletions mythtv/libs/libmythui/mythuibuttonlist.cpp
Expand Up @@ -3189,6 +3189,12 @@ void MythUIButtonListItem::DisplayState(const QString &state,
m_parent->Update();
}

void MythUIButtonListItem::SetStatesFromMap(const QMap<QString, QString> &stateMap)
{
m_states.clear();
m_states = stateMap;
}

bool MythUIButtonListItem::checkable() const
{
return m_checkable;
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/mythuibuttonlist.h
Expand Up @@ -68,6 +68,7 @@ class MUI_PUBLIC MythUIButtonListItem
QString GetImage(const QString &name="") const;

void DisplayState(const QString &state, const QString &name);
void SetStatesFromMap(const QMap<QString, QString> &stateMap);

bool checkable() const;
void setCheckable(bool flag);
Expand Down

0 comments on commit 4620a82

Please sign in to comment.