void MythUIStateType::CopyFrom(MythUIType *base) { MythUIStateType *st = dynamic_cast<MythUIStateType *>(base); if (!st) return; m_ShowEmpty = st->m_ShowEmpty; MythUIType::CopyFrom(base); QMap<QString, MythUIType *>::iterator i; for (i = st->m_ObjectsByName.begin(); i != st->m_ObjectsByName.end(); ++i) { MythUIType *other = i.value(); QString key = i.key(); MythUIType *newtype = GetChild(other->objectName()); AddObject(key, newtype); newtype->SetVisible(false); } QMap<int, MythUIType *>::iterator j; for (j = st->m_ObjectsByState.begin(); j != st->m_ObjectsByState.end(); ++j) { MythUIType *other = j.value(); int key = j.key(); MythUIType *newtype = GetChild(other->objectName()); AddObject((StateType)key, newtype); newtype->SetVisible(false); } }
void ZMEvents::setGridLayout(int layout) { if (layout < 1 || layout > 3) layout = 1; if (layout == m_layout) return; if (m_eventGrid) m_eventGrid->Reset(); m_layout = layout; // iterate though the children showing/hiding them as appropriate QString name; QString layoutName = QString("layout%1").arg(layout); QList<MythUIType *> *children = GetAllChildren(); for (int x = 0; x < children->size(); x++) { MythUIType *type = children->at(x); name = type->objectName(); if (name.startsWith("layout")) { if (name.startsWith(layoutName)) type->SetVisible(true); else type->SetVisible(false); } } // get the correct grid m_eventGrid = dynamic_cast<MythUIButtonList *> (GetChild(layoutName + "_eventlist")); if (m_eventGrid) { connect(m_eventGrid, SIGNAL(itemSelected( MythUIButtonListItem*)), this, SLOT(eventChanged(MythUIButtonListItem*))); connect(m_eventGrid, SIGNAL(itemClicked( MythUIButtonListItem*)), this, SLOT(playPressed())); connect(m_eventGrid, SIGNAL(itemVisible(MythUIButtonListItem*)), this, SLOT(eventVisible(MythUIButtonListItem*))); updateUIList(); BuildFocusList(); SetFocusWidget(m_eventGrid); } else {
/** * \brief Delete a named child of this UIType * * \param Name of child */ void MythUIType::DeleteChild(const QString &name) { QMutableListIterator<MythUIType *> it(m_ChildrenList); while (it.hasNext()) { it.next(); MythUIType *type = it.value(); if (type->objectName() == name) { delete type; it.remove(); return; } } }