rendered paste bodyDvdWidget * DvdWidgetFactory::MakeWidget(const QDomElement & definition,
DvdWidget * parent)
{
DvdWidget * retval = NULL;
/* First perform basic sanity checks on the definition file and get the
wigdet type */
if(definition.tagName() != "DvdWidget") {
// TODO: emit warning here
return NULL;
}
QString widgetType = definition.attribute("type", "");
retval = CreateDefaultWidget(widgetType, parent);
if(retval == NULL) {
// TODO: emit warning here
return NULL;
}
/* Second part of a three phase init, create the UI form */
retval->InitUIControl();
/* Third part of the three phase init, create and init the property
list */
QDomElement properties = definition.firstChildElement("properties");
if(properties.isNull()) {
// TODO: emit warning here
return NULL;
}
PropertyDirector * propDir = PropertyDirector::GetInstance();
PropertyList * propList = propDir->RegisterWidget(retval,properties);
retval->InitPropertyList(propList);
QDomElement childrenElement = definition.firstChildElement("children");
if(childrenElement.isNull()) {
return retval;
} else {
QDomNodeList children = childrenElement.childNodes();
int i = 0;
int childrenCount = children.length();
for(i = 0; i < childrenCount; ++i) {
if(children.at(i).toElement().isNull())
return retval;
this->MakeWidget(children.at(i).toElement(), retval);
}
}
return retval;
}