Example #1
0
/*!
    \internal
*/
void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path)
{
    /*
        if (iteratorFlags & QFileSystemIterator::FollowSymlinks) {
            if (fileInfo.filePath() != path)
                fileInfo.setFile(path);
            if (fileInfo.isSymLink()) {
                visitedLinks << fileInfo.canonicalFilePath();
            } else {
                visitedLinks << fileInfo.absoluteFilePath();
            }
        }
    */

#ifdef Q_OS_WIN
    wchar_t szSearchPath[MAX_PATH];
    QString::fromAscii(path).toWCharArray(szSearchPath);
    wcscat(szSearchPath, L"\\*");
    HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult);
    m_bFirstSearchResult = true;
#else
    DIR *dir = ::opendir(path.constData());
    //m_entry = ::readdir(dir);
    //while (m_entry && isDotOrDotDot(m_entry->d_name))
    //    m_entry = ::readdir(m_dirStructs.top());
#endif
    m_dirStructs.append(dir);
    m_dirPaths.append(path);
    m_entry = 0;
    if (filters & QDir::Dirs)
        m_nextDirShown = ShowDir;
    else
        m_nextDirShown = DontShowDir;
    m_currentDirShown = DontShowDir;
}
Example #2
0
void minigis::getParentPos(MapObject const *object, MapCamera const *camera, QPointF &mid, qreal &angle)
{
    QStack<MapObject const *> stack;
    MapObject const *obj = object;

    if (object->parentObject())
        obj = object->parentObject();
    else {
        mid = QPointF(0, 0);
        angle = 0;
        return;
    }

    while (obj->parentObject()) {
        stack.append(obj);
        obj = obj->parentObject();
    }
    if (!obj->drawer()) {
        // TODO: временное неправильное решение
        mid = QPointF(-100000, -100000);
        return;
    }

    mid = camera->toScreen(obj->drawer()->pos(obj));
    angle = obj->drawer()->angle(obj, camera);
    while (!stack.isEmpty()) {
        MapObject const *tmp = stack.pop();
        mid += QTransform().rotate(angle).map(tmp->drawer()->pos(tmp));
        angle += tmp->drawer()->angle(tmp, camera);
    }
}
Example #3
0
QStack<int> parseIntStack(const Xml_string& str)
{
	QStringList strlist = str.split(' ', QString::SkipEmptyParts);
	QStack<int> result;
	for (QStringList::iterator it=strlist.begin(); it != strlist.end(); ++it)
		result.append(parseInt(*it));
	return result;
}
QStack<ToDoListWidget::serviceData_t>
ToDoListExport::getData()
{
   QList<QTreeWidgetItem*> items = ui->exportList->selectedItems();

   QStack<ToDoListWidget::serviceData_t> itemsList;

   foreach(QTreeWidgetItem* item, items)
   {
       ToDoListWidget::serviceData_t newService;
       newService.serviceName = item->text(0);
       newService.serviceType = item->text(1);
       itemsList.append(newService);
   }
Example #5
0
void testQStack()
{
    QVector<int> bigv;
    for (int i = 0; i < 10; ++i)
        bigv.append(i);
    QStack<int> big;
    for (int i = 0; i < 10; ++i)
        big.append(i);
    QStack<Foo *> plist;
    plist.append(new Foo(1));
    plist.append(0);
    plist.append(new Foo(2));
    QStack<Foo> flist;
    flist.append(1);
    flist.append(2);
    flist.append(3);
    flist.append(4);
    //flist.takeFirst();
    //flist.takeFirst();
    QStack<bool> vec;
    vec.append(true);
    vec.append(false);
}
QStack<KisFillInterval> KisFillIntervalMap::fetchAllIntervals(int rowCorrection) const
{
    QStack<KisFillInterval> intervals;

    Private::GlobalMap::const_iterator rowMapIt = m_d->map.constBegin();
    Private::GlobalMap::const_iterator rowMapEndIt = m_d->map.constEnd();

    while (rowMapIt != rowMapEndIt) {
        Private::LineIntervalMap::const_iterator it = rowMapIt->constBegin();
        Private::LineIntervalMap::const_iterator end = rowMapIt->constEnd();

        while(it != end) {
            KisFillInterval interval = *it;
            interval.row += rowCorrection;
            intervals.append(interval);
            ++it;
        }

        ++rowMapIt;
    }

    return intervals;
}
Example #7
0
void Seeker::powerSeek( QString path ) {
    this->flag = false ;
    this->result.clear() ;
    Node* node = this->seek( path ) ;
    if ( node ) {
        if ( node->record.count() ) {
            //qDebug() << "get" << path ;
            this->result.append( node ) ;
            this->flag = true ;
        }
        else {
            //qDebug() << "power seek" ;
            QStack<Node*> current;
            QStack<Node*> deeper;
            current.push( this->current ) ;
            while( current.count() > 0 && this->result.count() < 1 ) {
                while( current.count() > 0 ) {
                    node = current.pop() ;
                    //qDebug() << QString( node->code ) ;
                    if ( node->record.count() )
                        this->result.append( node ) ;
                    else {
                        if ( this->result.count() < 1 ) {
                            for ( int i = 0; i < node->child.count(); i++ ) {
                                deeper.append( node->child[i] ) ;
                            }
                        }
                    }
                }
                current = deeper ;
                deeper.clear() ;
            }
        }
    }
    //return this->result ;
}
void operator <<(QStack<PropertyNode*>& _stack, const QList<PropertyNode*>& _list)
{
    foreach (PropertyNode* node, _list)
        _stack.append(node);
}
Example #9
0
void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd)
{
    const bool checkRanges = (rangeStart != -1) && (rangeEnd != -1);
    if (m_modelManager->state() == QmlProfilerModelManager::ClearingData) {
        beginResetModel();
        clear();
        endResetModel();
        return;
    } else if (m_modelManager->state() != QmlProfilerModelManager::ProcessingData &&
               m_modelManager->state() != QmlProfilerModelManager::Done) {
        return;
    }

    beginResetModel();
    clear();

    const QVector<QmlProfilerDataModel::QmlEventData> &eventList
            = m_modelManager->qmlModel()->getEvents();
    const QVector<QmlProfilerDataModel::QmlEventTypeData> &typesList
            = m_modelManager->qmlModel()->getEventTypes();

    // used by binding loop detection
    QStack<const QmlProfilerDataModel::QmlEventData *> callStack;
    callStack.append(0);
    FlameGraphData *stackTop = &m_stackBottom;

    for (int i = 0; i < eventList.size(); ++i) {
        const QmlProfilerDataModel::QmlEventData *event = &eventList[i];
        int typeIndex = event->typeIndex();
        const QmlProfilerDataModel::QmlEventTypeData *type = &typesList[typeIndex];

        if (!m_acceptedTypes.contains(type->rangeType))
            continue;

        if (checkRanges) {
            if ((event->startTime() + event->duration() < rangeStart)
                    || (event->startTime() > rangeEnd))
                continue;
        }

        const QmlProfilerDataModel::QmlEventData *potentialParent = callStack.top();
        while (potentialParent &&
               potentialParent->startTime() + potentialParent->duration() <= event->startTime()) {
            callStack.pop();
            stackTop = stackTop->parent;
            potentialParent = callStack.top();
        }

        callStack.push(event);
        stackTop = pushChild(stackTop, event);

        m_modelManager->modelProxyCountUpdated(m_modelId, i, eventList.count());
    }

    foreach (FlameGraphData *child, m_stackBottom.children)
        m_stackBottom.duration += child->duration;

    loadNotes(-1, false);

    m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
    endResetModel();
}
Example #10
0
Selection Serializer::importCollection()
{
	Collection* coll = lookup<Collection>("<collection>");
	Selection result( &m_Doc, false);
//	qDebug() << QString("deserialize: collection %1 doc %2").arg((ulong)coll).arg((ulong)&m_Doc);
	if (coll == NULL)
		qDebug() << "deserialize: no objects collected";
	else
	{
		QMap<QString,QString> newNames;

		//TODO: fonts

		do {
			newNames.clear();
			for (int i = 0; i < coll->cstyles.count(); ++i)
			{
				QString oldName = coll->cstyles[i].name();
				int oldIndex = m_Doc.charStyles().find(oldName);
				if (oldIndex >= 0 && m_Doc.charStyle(oldName) == coll->cstyles[i])
					continue;
				QString newName = oldName;
				if (oldIndex >= 0 && !newNames.contains(oldName))
				{
					int counter = 0;
					while (m_Doc.charStyles().find(newName) >= 0)
						newName = (QObject::tr("Copy of %1 (%2)")).arg(oldName).arg(++counter);
					newNames[oldName] = newName;
				}
			}
			
			coll->cstyles.rename(newNames);
		}
		while (newNames.count() > 0);
		m_Doc.redefineCharStyles(coll->cstyles, false);		

		do {
			newNames.clear();
			for (int i = 0; i < coll->pstyles.count(); ++i)  // FIXME:  QValueList<QString> StyleSet::names()
			{
				QString oldName = coll->pstyles[i].name();
				int oldIndex = m_Doc.paragraphStyles().find(oldName);
//				qDebug() << QString("comparing %1 (old %2 new %3): parent '%4'='%5' cstyle %6 equiv %7").arg(oldName).arg(oldIndex).arg(i)
//					   .arg(oldIndex>=0? m_Doc.paragraphStyle(oldName).parent() : "?").arg(coll->pstyles[i].parent())
//					   .arg(oldIndex>=0? m_Doc.paragraphStyle(oldName).charStyle() == coll->pstyles[i].charStyle() : false)
//					   .arg(oldIndex>=0? m_Doc.paragraphStyle(oldName).equiv(coll->pstyles[i]) : false);
			
				if (oldIndex >= 0 && coll->pstyles[i] == m_Doc.paragraphStyle(oldName) )
					continue;
				QString newName = oldName;
				if (oldIndex >= 0 && !newNames.contains(oldName))
				{
					int counter = 0;
					while (m_Doc.paragraphStyles().find(newName) >= 0)
						newName = (QObject::tr("Copy of %1 (%2)")).arg(oldName).arg(++counter);
					newNames[oldName] = newName;
				}
			}
			coll->pstyles.rename(newNames);
		}
		while(newNames.count() > 0);
		
		m_Doc.redefineStyles(coll->pstyles, false);		

		//TODO: linestyles : this is temporary code until MultiLine is replaced by LineStyle
		QMap<QString,multiLine>::Iterator mlit;
		for (mlit = coll->lstyles.begin(); mlit != coll->lstyles.end(); ++mlit)
		{
			multiLine& ml = mlit.value();
			QString    oldName = mlit.key();
			QString    newName = mlit.key();
			QMap<QString,multiLine>::ConstIterator mlitd = m_Doc.MLineStyles.find(oldName);
			if (mlitd != m_Doc.MLineStyles.end() && ml != mlitd.value())
			{
				int counter = 0;
				while (m_Doc.MLineStyles.contains(newName))
					newName = (QObject::tr("Copy of %1 (%2)")).arg(oldName).arg(++counter);
			}
			m_Doc.MLineStyles.insert(newName, ml);
		}

		//TODO: patterns
		
		QList<PageItem*>* objects = &(coll->items);
		m_Doc.PageColors = backUpColors;
		m_Doc.PageColors.addColors(coll->colors, false);
		int maxG = m_Doc.GroupCounter;
		for (int i=0; i < objects->count(); ++i)
		{
			PageItem* currItem = objects->at(i);
			currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
			currItem->setFillQColor();
			currItem->setLineQColor();
			result.addItem(currItem);
			if (currItem->Groups.count() != 0)
			{
				QStack<int> groups;
				for (int i=0; i < currItem->groups().count(); ++i)
				{
					int newGroup = m_Doc.GroupCounter + currItem->groups()[i] - 1;
					groups.append(newGroup);
				}
				currItem->setGroups(groups);
				maxG = qMax(maxG, currItem->Groups.top()+1);
			}
		}
		m_Doc.GroupCounter = maxG;
		updateGradientColors(coll->colors);
		delete coll;
	}
	return result;
}