/*! * \brief Update the widget following a change */ void MythUIButtonTree::SetTreeState(bool refreshAll) { if (!m_initialized) Init(); if (!m_rootNode) return; if (!m_currentNode) DoSetCurrentNode(m_rootNode->getSelectedChild()); QList<MythGenericTree *> route = m_currentNode->getRoute(); // Sanity Checks if (m_depthOffset >= route.size()) m_depthOffset = 0; if (((int)m_currentDepth + m_depthOffset) >= route.size()) m_currentDepth = 0; MythGenericTree *node = route.at(m_currentDepth + m_depthOffset); if (m_currentDepth != m_oldDepth) refreshAll = true; m_oldDepth = m_currentDepth; m_visibleLists = 0; uint listid = 0; while (listid < m_buttonlists.count()) { MythUIButtonList *list = m_buttonlists.at(listid); list->SetVisible(false); list->SetActive(false); MythGenericTree *selectedNode = NULL; if (node) selectedNode = node->getSelectedChild(true); if (refreshAll || m_activeListID < listid) { if (!UpdateList(list, node)) { listid++; continue; } } if (m_active && (listid == m_activeListID)) { m_activeList = list; list->SetActive(true); DoSetCurrentNode(selectedNode); emit itemSelected(list->GetItemCurrent()); } listid++; list->SetVisible(true); m_visibleLists++; node = selectedNode; } }