void ZButton::parse(const ZConfig &el){ if(!el.text().isEmpty()) setText(el.text()); else if(!el.attribute("text","").isEmpty()) setText(el.attribute("text")); if(el.hasAttribute("value")) setValue(el.attribute("value")); //! @icon - system name or path of the icon to display if(el.hasAttribute("icon")) zSetIcon(el.attribute("icon")); }
void ZDataModel::parse(const ZConfig &el){ if(el.hasAttribute("table")){ setTable(el.attribute("table")); for(int i = 0; i < columnCount(); i++){ _columns.insert(headerData(i,Qt::Horizontal).toString(), i); } foreach(const ZConfig &field, el.children("zee:field")){ if(_columns.contains(field.attribute("name"))){ // set header title if(field.hasAttribute("title")){ setHeaderData(_columns.value(field.attribute("name")), Qt::Horizontal, QVariant(field.attribute("title"))); } if(field.hasAttribute("belongsTo")){ QString relation = field.attribute("belongsTo"); QString rTable = relation.section(":",0,0); QString rKey = relation.section(":",1,1); QString rDisplay = relation.section(":",2,2); if(!(rTable.isEmpty() && rKey.isEmpty() && rDisplay.isEmpty())){ setRelation(_columns.value(field.attribute("name")), QSqlRelation(rTable,rKey,rDisplay)); } } } } }
void ZCountdown::parse(const ZConfig &el){ //! @target: the target time for the countdown _target = ZDateTime::strtotime(el.attribute("target")); if(_target.isValid()){ _targetMsec = (_target.toTime_t()*1000LL)+_target.time().msec(); qint64 now = ZDateTime::nowMsec_t(); if(!el.hasAttribute("interval")) _config.setAttribute("interval", ZCDWN_DEFAULT_INTV); if(_targetMsec > 0) _tracker = new ZTimer(_config.toElement(), this); z_log_debug("ZCountdown: Target epoch = "+STR(_targetMsec)); z_log_debug("ZCountdown: Current epoch = "+STR(now)); z_log_debug("ZCountdown: ---- DIFF ---- "+STR(_targetMsec-now)); }else{ z_log_error("ZCountdown: Invalid target date specified."); } }
void ZSound::parse(const ZConfig &el){ if(el.hasAttribute("src")){ _mediaObject->setCurrentSource(MediaSource(el.attribute("src"))); } }