/** Checks whether there are duplicated entries in the Transform's children list. */
 bool hasDuplicatedChildren() const
 {
   std::set<const ITransform*> tr_set;
   for(size_t i=0; i<childrenCount(); ++i)
     tr_set.insert(getChildren(i));
   return tr_set.size() != childrenCount();
 }
 /** Remove the child at the specified position */
 void removeChild( int pos )
 {
   Q_ASSERT( pos >= 0 && pos < childrenCount() );
   for ( int i = pos+1; i < childrenCount(); ++i ) {
     childAt( i )->mParentListPos--;
   }
   mChildren.removeAt( pos );
 }
Example #3
0
ViElement& ViElement::child(QString name)
{
	for(int i = 0; i < childrenCount(); ++i)
	{
		if(name == mChildren[i].name())
		{
			return mChildren[i];
		}
	}
	for(int i = 0; i < childrenCount(); ++i)
	{
		return mChildren[i].child(name);
	}
	return dummyElement();
}
Qt::ItemFlags AMActionHistoryModel3::flags(const QModelIndex &index) const
{
	if(!index.isValid())
		return Qt::NoItemFlags;
	if( index.column() != 0)
		return Qt::ItemIsEnabled;
	AMPointerTreeNode *indexNode = static_cast<AMPointerTreeNode*>(index.internalPointer());
	AMActionLogItem3 *item = 0;
	if(indexNode){
		//NEM
		item = static_cast<AMActionLogItem3*>(indexNode->item());
	}

	// In case the item didn't (or isn't yet) in some sort of finished state
	if(item && item->canCopy() && !(item->finalState() == 7 || item->finalState() == 8 || item->finalState() == 9) )
		return Qt::ItemIsEnabled;
	//In case a loop or list had no logged actions in it
	if(item && item->canCopy() && item->actionInheritedLoop() && (childrenCount(index) == 0) )
		return Qt::ItemIsEnabled;
	//In case a loop or list had no logged actions in it
	if(item && item->canCopy() && item->actionInheritedLoop() && (successfulChildrenCount(index) == 0) )
		return Qt::ItemIsEnabled;
	if (item && item->canCopy())
		return Qt::ItemIsEnabled | Qt::ItemIsSelectable;

	return Qt::ItemIsEnabled;
}
RubixCube::RubixCube() {
    rubix = (game::Mesh*)game::ResMgr::load("res/mesh/rubix/rubix-face.obj");
    flat = (game::Mesh*)game::ResMgr::load("res/mesh/rubix/flat-face.obj");
    // initialize faces
    game::Camera *cam = new game::Camera();
    cam->persp();
    game::cameraSet(cam);
    // faces
    for (GLfloat x = -1.f; x <= +1.f; x += 1.f)
        for (GLfloat y = -1.f; y <= +1.f; y += 1.f)
            for (GLfloat z = -1.f; z <= +1.f; z += 1.f)
                if (x != y || y != z || z != 0.f)
                    addChild(std::string("cube") + char(childrenCount() + '0'),
                             new SmallCube(glm::vec3(x, y, z), flat, rubix));
    scale(glm::vec3(.4f, .4f, .4f));
    game::fogSet(glm::vec4(0, 0, 0, 1), 0);
    //
    game::Light *l1 = new game::Light(glm::vec3(.5f), glm::vec3(.5f));
    game::lights.push_back(l1);
    l1->translate(glm::vec3(10, 0, 10));
    //
    game::Light *l2 = new game::Light(glm::vec3(.5f), glm::vec3(.4f));
    game::lights.push_back(l2);
    l2->translate(glm::vec3(5, 5, 10));
}
Example #6
0
void PipePart::prepareChildren() noexcept {
  size_t count = childrenCount();
  for (size_t i = 0; i < count; i++) {
    PipePart* childPart = _children[i];
    if (!(childPart->flags() & kFlagPrepareDone))
      childPart->preparePart();
  }
}
void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children)
{
    int count = childrenCount();
    for (int i = 0; i < count; i++) {
        AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
        children.append(AccessibilityUIElement(child));
    }
}
Example #8
0
ViElement& ViElement::child(int index)
{
	if(childrenCount() > index)
	{
		return mChildren[index];
	}
	return dummyElement();
}
Example #9
0
void ProjectNode::createBinFileHeaderNode()
{
    if(binFileHeaderNode)
        return;
    binFileHeaderNode = new BinaryFileHeaderNode();
    // Should be at second position
    int id = qMin(1,childrenCount());
    addChildAt(binFileHeaderNode,id);
}
Example #10
0
 BsonTreeItem* BsonTreeItem::childSafe(unsigned pos) const
 {
     if (childrenCount() > pos) {
         return _items[pos];
     }
     else {
         return NULL;
     }
 }
Example #11
0
void SatellitesConfigNodeItem::clear()
{
    for( int i = childrenCount(); i > 0; --i ) {
        SatellitesConfigAbstractItem *item = m_children.at( i - 1 );
        item->clear();
        m_children.remove( i - 1 );
        delete item;
    }
}
Example #12
0
bool ViElement::hasChild(QString name)
{
    for(int i = 0; i < childrenCount(); ++i)
    {
        if(name == mChildren[i].name())
        {
            return true;
        }
    }
    return false;
}
 void eraseChild(ShaderNode* node)
 {
   VL_CHECK(node->parent() == this);
   for(unsigned i=0; i<childrenCount(); ++i)
     if (child(i) == node)     
     {
       mNodes.erase(mNodes.begin()+i);
       node->mParent = NULL;
       return;
     }
 }
void AccessibilityUIElement::getChildren(Vector<RefPtr<AccessibilityUIElement> >& children)
{
    if (!ATK_IS_OBJECT(m_element.get()))
        return;

    int count = childrenCount();
    for (int i = 0; i < count; i++) {
        GRefPtr<AtkObject> child = adoptGRef(atk_object_ref_accessible_child(ATK_OBJECT(m_element.get()), i));
        children.append(AccessibilityUIElement::create(child.get()));
    }
}
Example #15
0
QDomNode ViElement::toDom()
{
	QDomDocument document;
	QDomElement node = document.createElement(name());
	for(int i = 0; i < attributeCount(); ++i)
	{
		node.setAttribute(mAttributes[i].name(), mAttributes[i].toString());
	}
	if(childrenCount() > 0)
	{
		for(int i = 0; i < childrenCount(); ++i)
		{
			node.appendChild(mChildren[i].toDom());
		}
	}
	else
	{
		node.appendChild(document.createTextNode(toString()));
	}
	return node;
}
Example #16
0
static int childrenCount(const PsiContactListModel* model, const QModelIndex& root)
{
	int result = 0;
	for (int i = 0; i < model->rowCount(root); ++i) {
		QModelIndex index = model->index(i, 0, root);
		if (model->data(index, ContactListModel::ExpandedRole).toBool()) {
			result += childrenCount(model, index);
		} else {
			result++;
		}
	}
	return result;
}
Example #17
0
QList<OperationsList*> OperationsList::findClusters(const QString& label) const
{
    QList<OperationsList*> result;
    for( int i = 0 ; i < childrenCount() ; ++i )
    {
        OperationsList* list = child( i );
        if( list->label() == label )
        {
            result.append( list );
        }
    }
    return result;
}
void CNcdNodeFolderProxy::InternalizeNodeDataL( RReadStream& aStream )
    {
    DLTRACEIN((""));
    
    // First internalize parent data
    CNcdNodeProxy::InternalizeNodeDataL( aStream );

    // Get the children data here.

    DLTRACE(("Handle children"));

    // Clear the buffer because new childs will be appended
    iChildren.ResetAndDestroy();
    
    TInt childrenCount( aStream.ReadInt32L() );
    DLTRACE(("Children: %d", childrenCount ));

    TInt classObjectType( NcdNodeClassIds::ENcdNullObjectClassId );

    for ( TInt i = 0; i < childrenCount; ++i )
        {
        // This is safe casting because enum is same as TInt
        classObjectType = 
            static_cast<NcdNodeClassIds::TNcdNodeClassId>(aStream.ReadInt32L());
        if ( NcdNodeClassIds::ENcdChildEntityClassId == classObjectType )
            {
            CNcdChildEntity* childEntity = CNcdChildEntity::NewLC( aStream );
            iChildren.AppendL( childEntity );
            CleanupStack::Pop( childEntity );            
            DLINFO((_L("Added child, id: %S, array index: %d, real index: %d"),
            &childEntity->Identifier().NodeId(), i, childEntity->Index() ));
            }
        else
            {
            // For debug purposes
            DLERROR(("Wrong class id"));
            DASSERT( EFalse );

            // Wrong kind of class object info
            User::Leave( KErrCorrupt );
            }
        }
        
    // Show node info here, after the internalization has been done.        
    DLTRACEOUT(( _L("Node: %S, %S, %d"), 
                 &Namespace(), &Id(), NodeIdentifier().ClientUid().iUid ));
    }
void BookmarksItem::addChild(BookmarksItem * child)
{
    insertChild(childrenCount(), child);
}
          mNodes.erase(mNodes.begin()+i);
          node->mParent = NULL;
          return;
        }
    }

    void eraseChild(unsigned index)
    {
      VL_CHECK(index<childrenCount())
      mNodes[index]->mParent = NULL;
      mNodes.erase(mNodes.begin()+index);
    }

    void eraseChildren(unsigned start, unsigned count)
    {
      VL_CHECK(start < childrenCount())
      VL_CHECK(start+count-1 < childrenCount())
      for(unsigned i=start; i<start+count; ++i)
        mNodes[i]->mParent = NULL;
      mNodes.erase(mNodes.begin()+start, mNodes.begin()+start+count);
    }

    int findChild(const ShaderNode* node) const
    {
      for(unsigned i=0; i<childrenCount(); ++i)
        if(child(i) == node)
          return i;
      return -1;
    }

    size_t childrenCount() const { return mNodes.size(); }
QVariant AMActionHistoryModel3::data(const QModelIndex &index, int role) const
{
	AMPointerTreeNode *indexNode = static_cast<AMPointerTreeNode*>(index.internalPointer());
	if(!indexNode){
		//NEM
		return QVariant();
	}
	AMActionLogItem3 *item = static_cast<AMActionLogItem3*>(indexNode->item());
	if(!item){
		AMErrorMon::alert(this, AMACTIONHISTORYMODEL_MODELDATA_BAD_ITEM, QString("The action history attempted to access data with a bad item (row: %1 column: %2). Please report this problem to the Acquaman developers ").arg(index.row()).arg(index.column()));
		return QVariant();
	}

	if(role == Qt::DisplayRole) {
		switch(index.column()) {
		case 0: return item->shortDescription();
		case 1: return QVariant();
		case 2: return item->failureMessage();
		case 3: return AMDateTimeUtils::prettyDateTime(item->endDateTime());
		case 4: return AMDateTimeUtils::prettyDuration(item->startDateTime(), item->endDateTime());
		}
	}
	else if(role == Qt::DecorationRole) {
		// column 0: return the action icon.
		if(index.column() == 0) {
			QString iconFileName = item->iconFileName();
			if(iconFileName.isEmpty())
				iconFileName = ":/64x64/generic-action.png";
			QPixmap p;
			if(QPixmapCache::find("AMActionLogItemIcon" % iconFileName, &p))
				return p;
			else {
				p.load(iconFileName);
				p = p.scaledToHeight(22, Qt::SmoothTransformation);
				QPixmapCache::insert("AMActionLogItemIcon" % iconFileName, p);
				return p;
			}
		}
		// column 1: return the status icon
		else if(index.column() == 1) {
			switch(item->finalState()) {
			case AMAction3::Succeeded: return succeededIcon_;
			case AMAction3::Cancelled: return cancelledIcon_;
			case AMAction3::Failed: return failedIcon_;
			default: return unknownIcon_;
			}
		}
		else
			return QVariant();
	}
	else if(role == Qt::SizeHintRole) {
		return QSize(-1, 32);
	}
	else if(role == Qt::ToolTipRole) {
		if(index.column() == 0) {

			// In case the item didn't (or isn't yet) in some sort of finished state
			if(item && item->canCopy() && !(item->finalState() == 7 || item->finalState() == 8 || item->finalState() == 9) )
				return "Cannot select this item, it has not yet completed";
			//In case a loop or list had no logged actions in it
			if(item && item->canCopy() && item->actionInheritedLoop() && (childrenCount(index) == 0) )
				return "Cannot select this item, it has no children.";
			//In case a loop or list had no logged actions in it
			if(item && item->canCopy() && item->actionInheritedLoop() && (successfulChildrenCount(index) == 0) )
				return "Cannot select this item, none of its children succeeded.";

			return item->longDescription();
		}
		else if(index.column() == 1) {
			switch(item->finalState()) {
			case AMAction3::Succeeded: return "Succeeded";
			case AMAction3::Cancelled: return "Cancelled";
			case AMAction3::Failed:
				if(item->failureMessage().isEmpty())
					return "Failed";
				else
					return QString("Failed with message: %1").arg(item->failureMessage());
			default: return "[?]";
			}
		}
		else if(index.column() == 2)
			return QString(item->failureMessage());
	}
	else if(role == Qt::BackgroundRole) {
		switch(item->finalState()) {
		case AMAction3::Succeeded:
			return QColor(126, 255, 106);// light green
		case AMAction3::Cancelled:
			return QColor(255, 176, 106);// light orange
		case AMAction3::Failed:
			return QColor(255, 104, 106);// light red
		default:
			return QVariant();
		}
	}
	else if(role == AMActionHistoryModel3::ParentSelectRole) {
		ParentSelectMap selectMap;
		ParentSelectMap::const_iterator i = item->allParentSelected().constBegin();
		while (i != item->allParentSelected().constEnd()) {
			selectMap.insert(i.key(), i.value());
			++i;
		}
		return QVariant::fromValue(selectMap);
	}

	return QVariant();
}
 /** Add a new child to this TodoTreeNode */
 void addChild( TodoTreeNode *node )
 {
   node->mParentListPos = childrenCount();
   mChildren.append( node );
 }
 void eraseChild(unsigned index)
 {
   VL_CHECK(index<childrenCount())
   mNodes[index]->mParent = NULL;
   mNodes.erase(mNodes.begin()+index);
 }
bool SearchResultTreeItem::isLeaf() const
{
    return childrenCount() == 0 && parent() != 0;
}
Example #25
0
int PsiContactListModel::visibleItemsCount() const
{
	return childrenCount(this, QModelIndex());
}