Пример #1
0
void MythUIStateType::SetTextFromMap(const InfoMap &infoMap)
{
    if (m_ObjectsByName.isEmpty() && m_ObjectsByState.isEmpty())
        return;

    QMap<QString, MythUIType *>::Iterator i;

    for (i = m_ObjectsByName.begin(); i != m_ObjectsByName.end(); ++i)
    {
        MythUIType *type = i.value();

        MythUIText *textType = dynamic_cast<MythUIText *> (type);
        if (textType)
            textType->SetTextFromMap(infoMap);

        MythUIComposite *group = dynamic_cast<MythUIComposite *> (type);
        if (group)
            group->SetTextFromMap(infoMap);
    }

    QMap<int, MythUIType *>::Iterator j;

    for (j = m_ObjectsByState.begin(); j != m_ObjectsByState.end(); ++j)
    {
        MythUIType *type = j.value();

        MythUIText *textType = dynamic_cast<MythUIText *> (type);
        if (textType)
            textType->SetTextFromMap(infoMap);

        MythUIComposite *group = dynamic_cast<MythUIComposite *> (type);
        if (group)
            group->SetTextFromMap(infoMap);
    }
}
Пример #2
0
static void DoSetTextFromMap(MythUIType *UItype, QHash<QString, QString> &infoMap)
{
    QList<MythUIType *> *children = UItype->GetAllChildren();

    MythUIText *textType;

    QMutableListIterator<MythUIType *> i(*children);
    while (i.hasNext())
    {
        MythUIType *type = i.next();
        if (!type->IsVisible())
            continue;

        textType = dynamic_cast<MythUIText *> (type);
        if (textType && infoMap.contains(textType->objectName()))
            textType->SetTextFromMap(infoMap);


        MythUIGroup *group = dynamic_cast<MythUIGroup *> (type);
        if (group)
            DoSetTextFromMap(type, infoMap);
    }
}