예제 #1
0
bool CollectForOutput::collectItems()
{
    uint counter = 0;
    int c=0;
    QList<PageItem*> allItems;
    PageItem* ite = NULL;
    for (uint lc = 0; lc < 2; ++lc)
    {
        switch (lc)
        {
        case 0:
            counter = m_Doc->MasterItems.count();
            break;
        case 1:
            counter = m_Doc->DocItems.count();
            break;
        }
        for (uint b = 0; b < counter; ++b)
        {
            switch (lc)
            {
            case 0:
                ite = m_Doc->MasterItems.at(b);
                break;
            case 1:
                ite = m_Doc->DocItems.at(b);
                break;
            }
            if (ite->isGroup())
                allItems = ite->getItemList();
            else
                allItems.append(ite);
            for (int ii = 0; ii < allItems.count(); ii++)
            {
                ite = allItems.at(ii);
                processItem(ite);
            }
            allItems.clear();
            if (uiCollect)
                emit itemsCollected(c++);
        }
    }
    for (QHash<int, PageItem*>::iterator itf = m_Doc->FrameItems.begin(); itf != m_Doc->FrameItems.end(); ++itf)
    {
        PageItem *it = itf.value();
        if (it->isGroup())
            allItems = it->asGroupFrame()->getItemList();
        else
            allItems.append(it);
        for (int ii = 0; ii < allItems.count(); ii++)
        {
            it = allItems.at(ii);
            processItem(it);
        }
        allItems.clear();
        if (uiCollect)
            emit itemsCollected(c++);
    }
    for (int c = 0; c < patterns.count(); ++c)
    {
        ScPattern pa = m_Doc->docPatterns[patterns[c]];
        for (int o = 0; o < pa.items.count(); o++)
        {
            ite = pa.items.at(o);
            if (ite->isGroup())
                allItems = ite->getItemList();
            else
                allItems.append(ite);
            for (int ii = 0; ii < allItems.count(); ii++)
            {
                ite = allItems.at(ii);
                processItem(ite);
            }
            allItems.clear();
        }
        if (uiCollect)
            emit patternsCollected(c);
    }
    return true;
}
예제 #2
0
 void
 advance ()
   {
     ++source_;
     processItem();
   }
예제 #3
0
 TransformingCore (IT const& orig, FUN processor)
   : trafo_(processor) // induces a signature check
   , source_(orig)
   {
     processItem();
   }
예제 #4
0
 TransformingCore (IT&& orig, FUN processor)
   : trafo_(processor) // induces a signature check
   , source_(forward<IT> (orig))
   {
     processItem();
   }
예제 #5
0
void AbstractBall::act()
{
    processItem(getProcessItem());
    moveNext();
    handleAnimation();
}
예제 #6
0
/**
 * @brief RsCollectionDialog::addRecursive: Add Selected item to RSCollection
 *   -Add File seperatly if parent folder not selected
 *   -Add File in folder if selected
 *   -Get root folder the selected one
 * @param recursive: If true, add all selected directory childrens
 */
void RsCollectionDialog::addRecursive(bool recursive)
{
	QStringList fileToHash;
	QMap<QString, QString > dirToAdd;
    int count=0;//to not scan all items on list .count()

	QModelIndexList milSelectionList =	ui._systemFileTW->selectionModel()->selectedIndexes();
	foreach (QModelIndex index, milSelectionList)
	{

		if (index.column()==0){//Get only FileName
			QString filePath = _dirModel->filePath(_tree_proxyModel->mapToSource(index));
			QFileInfo fileInfo = filePath;
			if (fileInfo.isDir()) {
				dirToAdd.insert(fileInfo.absoluteFilePath(),fileInfo.absolutePath());
				++count;
				if (recursive) {
					if (!addAllChild(fileInfo, dirToAdd, fileToHash, count)) return;
				} else {
					continue;
				}
			}//if (fileInfo.isDir())
			if (fileInfo.isFile()){
				fileToHash.append(fileInfo.absoluteFilePath());
				++count;
				if (dirToAdd.contains(fileInfo.absolutePath()))
					_listOfFilesAddedInDir.insert(fileInfo.absoluteFilePath(),fileInfo.absolutePath());
				else
					_listOfFilesAddedInDir.insert(fileInfo.absoluteFilePath(),"");
			}//if (fileInfo.isFile())
		}//if (index.column()==0)
	}//foreach (QModelIndex index, milSelectionList)

	// Process Dirs
	QTreeWidgetItem *item = NULL;
	if (!ui._fileEntriesTW->selectedItems().empty())
		item= ui._fileEntriesTW->selectedItems().at(0);
	if (item) {
		while (item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_DIR) {
			item = item->parent();//Only Dir as Parent
		}//while
	}//if (item)

	int index = 0;
	while (index < dirToAdd.count())
	{
		ColFileInfo root;
		if (item && (item != getRootItem())) {
			root.name = "";
			root.path = item->text(COLUMN_FILE);
		} else {
			root.name = "";
			root.path = "";
		}
		//QMap is ordered, so we get parent before child
		//Iterator is moved inside this function
		processItem(dirToAdd, index, root);
	}//while (index < dirToAdd.count())

	//Update liste before attach files to be sure when file is hashed, parent directory exists.
	updateList();

	for (QHash<QString,QString>::Iterator it = _listOfFilesAddedInDir.begin(); it != _listOfFilesAddedInDir.end() ; ++it)
	{
		QString path = it.value();
		it.value() = "";
		if (dirToAdd.contains(path)){
			it.value() = dirToAdd.value(path);
		} else if(item) {
			if (item->data(COLUMN_HASH, ROLE_NAME) != "") {
				it.value() = item->text(COLUMN_FILE);
			}//if (item->data(COLUMN_HASH, ROLE_NAME) != "")
		}//if (dirToAdd.contains(path))
	}//for (QHash<QString,QString>::Iterator it

	// Process Files once all done
	ui._hashBox->addAttachments(fileToHash,RS_FILE_REQ_ANONYMOUS_ROUTING /*, 0*/);
}