示例#1
0
ZipArchive::DirectoryIterator ZipArchive::readDirectory(void)
	{
	/* Create a new directory iterator for the root directory: */
	DirectoryIterator dIt(directoryPos);
	
	/* Read the first proper directory entry: */
	return getNextEntry(dIt);
	}
示例#2
0
void KKeyChooser::readGlobalKeys()
{
	debug("KKeyChooser::readGlobalKeys()");
	
	globalDict->clear();
	
	// QDict<int> *tmpDict = new QDict<int> ( 37, false );
	
	// Insert all global keys into globalDict
	int *keyCode;
	KConfig *pConfig = kapp->getConfig();
	KEntryIterator *gIt = pConfig->entryIterator( "Global Keys" );
	gIt->toFirst();
	while ( gIt->current() ) {
		keyCode = new int;
		*keyCode = stringToKey( gIt->current()->aValue );
		globalDict->insert( gIt->currentKey(), keyCode);
		//debug( " %s, %d", gIt->currentKey(), *keyCode );
		++(*gIt);
	}
	
	
	
	// Only insert global keys which don't appear in the dictionary to be configured
	aIt->toFirst();
	while ( aIt->current() ) {
		if ( globalDict->find( aIt->currentKey() ) ) {
			
			// Tried removing but it didn't work. Hence set them to zero
			// instead
			keyCode = new int;
			*keyCode = 0;
			if ( globalDict->remove( aIt->currentKey() ) )
				debug("remove: %s", aIt->currentKey() );
			//debug("%s, %d", aIt->currentKey(), *globalDict->find(
			//aIt->currentKey() ));
			
		}
		++ ( *aIt );
	}
	
	globalDict->clear();
	
	debug("Global dict contents");
	
	QDictIterator<int> dIt( *globalDict );
	
	dIt.toFirst();
	while ( dIt.current() ) {
		debug("current %s:%d", dIt.currentKey(), *dIt.current());
		
		++dIt;
	}
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void CVstSelectCoincidentFacesCmd::GetSpecifiedMeshes(
	MSelectionList &meshList )
{
	meshList.clear();

	MSelectionList optSelectionList;
	m_undo.ArgDatabase().getObjects( optSelectionList );

	MDagPath mDagPath;
	MObject cObj;
	for ( MItSelectionList sIt( optSelectionList ); !sIt.isDone(); sIt.next() )
	{
		if ( sIt.itemType() == MItSelectionList::kDagSelectionItem && sIt.getDagPath( mDagPath, cObj ) )
		{
			if ( mDagPath.hasFn( MFn::kMesh ) )
			{
				if ( sIt.hasComponents() || !cObj.isNull() )
				{
					meshList.add( mDagPath, cObj );
				}
				else
				{
					mDagPath.extendToShapeDirectlyBelow( 0U );
					meshList.add( mDagPath, MObject::kNullObj, true );
				}
			}
		}
	}

	if ( meshList.isEmpty() )
	{
		for ( MItDag dIt( MItDag::kDepthFirst, MFn::kMesh ); !dIt.isDone(); dIt.next() )
		{
			if ( dIt.getPath( mDagPath ) )
			{
				meshList.add( mDagPath, MObject::kNullObj, true );
			}
		}
	}
}
示例#4
0
bool PictureContent::fromXml(QDomElement & contentElement, const QDir & baseDir)
{
    AbstractContent::fromXml(contentElement, baseDir);

    // build the afterload effects list
    m_afterLoadEffects.clear();
    QDomElement effectsE = contentElement.firstChildElement("effects");
    for (QDomElement effectE = effectsE.firstChildElement("effect"); effectE.isElement(); effectE = effectE.nextSiblingElement("effect")) {
        PictureEffect fx;
        fx.effect = (PictureEffect::Effect)effectE.attribute("type").toInt();
        fx.param = effectE.attribute("param").toDouble();
        if (fx.effect == PictureEffect::Crop) {
            QString rect = effectE.attribute("croppingRect");
            QStringList coordinates = rect.split(" ");
            if(coordinates.size() >= 3) {
                QRect croppingRect (coordinates.at(0).toInt(), coordinates.at(1).toInt(), coordinates.at(2).toInt(), coordinates.at(3).toInt());
                fx.rect = croppingRect;
            }
        }
        else if (fx.effect == PictureEffect::Opacity)
            setContentOpacity(fx.param);
        m_afterLoadEffects.append(fx);
    }

    // load picture properties
    QString path;

    // try relative file path
    const QString relPath = contentElement.firstChildElement("relativeFilePath").text();
    if (!relPath.isEmpty() && baseDir.exists(relPath))
        path = QDir::cleanPath(baseDir.filePath(relPath));

    // or use absolute path/url
    if (path.isEmpty())
        path = contentElement.firstChildElement("fileUrl").text();

    // RETROCOMP <= 0.8
    if (path.isEmpty())
        path = contentElement.firstChildElement("path").text();

    // load Network image
    if (path.startsWith("http", Qt::CaseInsensitive) || path.startsWith("ftp", Qt::CaseInsensitive))
        return loadFromNetwork(path, 0);

    // look for the file if can't find it anymore
    if (!QFile::exists(path)) {
        QString searchFileName = QFileInfo(path).fileName();
        if (!searchFileName.isEmpty()) {

            // find all replacements from the current basepath
            qWarning("PictureContent::fromXml: file '%s' not found, scanning for replacements", qPrintable(path));
            QDirIterator dIt(baseDir, QDirIterator::Subdirectories);
            QStringList replacements;
            while (dIt.hasNext()) {
                dIt.next();
                if (dIt.fileName() == searchFileName) {
                    QString replacement = dIt.fileInfo().absoluteFilePath();
                    replacements.append(replacement);
                    qWarning("PictureContent::fromXml:    found '%s'", qPrintable(replacement));
                }
            }

            // use the first replacement (### 1.0 display a selection dialog)
            if (!replacements.isEmpty()) {
                path = replacements.first();
                qWarning("PictureContent::fromXml:    using '%s'", qPrintable(path));
            } else
                qWarning("PictureContent::fromXml:    no replacements found");
        }
    }

    // load Local image
    return loadPhoto(path, false, false);
}