Exemple #1
0
TupImportProjectPackage::TupImportProjectPackage(const QString &projectPath)
{
    QDomElement root = createElement("project_import");
    root.setAttribute("version", "0");
    appendChild(root);

    QFile file(projectPath);
    file.open(QIODevice::ReadOnly);
    QByteArray data = file.readAll().toBase64();

    QDomElement content = createElement("data");
    content.setAttribute("file", projectPath);
    content.appendChild(createCDATASection(data));
    root.appendChild(content);
}
void SResourcePackage::addResource(QDomElement &element, const QString &path)
{
	QFileInfo finfo(path);
	
	QString realPath = path;
	
	if ( finfo.isRelative() )
	{
		realPath = HOME+"/data/"+path;
	}
	
	QFile file(realPath);
	
	
	if( file.open( QIODevice::ReadOnly ))
	{
		QDomCDATASection cdata = createCDATASection( QString::fromLocal8Bit(file.readAll()));
		
		element.appendChild(cdata);
		
		file.close();
	}
}