Skip to content

Commit

Permalink
Fix the keypress handling in MythUIButtonTree when using a grid layou…
Browse files Browse the repository at this point in the history
…t in the

buttonlist.

This change allow you to use a <buttontree> widget to navigate a tree like the
gallery view in MythVideo. The main advantage is you can use the same code for
both a tree view and gallery view the only difference is in the theme.
  • Loading branch information
Paul Harrison committed Dec 30, 2010
1 parent fcd5054 commit b2b6633
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions mythtv/libs/libmythui/mythuibuttontree.cpp
Expand Up @@ -533,17 +533,32 @@ bool MythUIButtonTree::keyPressEvent(QKeyEvent *event)
{
QString action = actions[i];
handled = true;

if (action == "RIGHT")
if (m_activeList && m_activeList->m_layout == MythUIButtonList::LayoutGrid)
{
SwitchList(true);
if (action == "SELECT" && m_currentNode->childCount() > 0)
{
SwitchList(true);
}
else if (action == "ESCAPE" && m_currentDepth > 1)
{
SwitchList(false);
}
else
handled = false;
}
else if (action == "LEFT")
else
{
SwitchList(false);
if (action == "RIGHT")
{
SwitchList(true);
}
else if (action == "LEFT")
{
SwitchList(false);
}
else
handled = false;
}
else
handled = false;
}

if (!handled && m_activeList)
Expand Down

0 comments on commit b2b6633

Please sign in to comment.