Пример #1
0
// BUTTONS
void ColorDialog::on_push_save_clicked(){
  //Now set the output values
  colorname = ui->line_name->text();
  colorpath = QDir::homePath()+"/.lumina/colors/"+colorname+".qss.colors";
  //Check if that color already exists
  if(QFile::exists(colorpath)){
    if( QMessageBox::Yes != QMessageBox::question(this, tr("Color Exists"), tr("This color scheme already exists.\n Overwrite it?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) ){
      colorname.clear();
      colorpath.clear();
      return; //cancelled
    }
  }
  //save the colors and close
  saveColors();
  this->close();
}
Пример #2
0
FileFactory::FileError File_v2::save(QDataStream *stream)
{

    *stream << (qint32)FileFactory::Version_1_2;
    stream->setVersion(QDataStream::Qt_4_7);

    if(!mInternalStitchSet) {

        mInternalStitchSet = new StitchSet();
        mInternalStitchSet->isTemporary = true;
        mInternalStitchSet->stitchSetFileName = StitchLibrary::inst()->nextSetSaveFile();
        StitchLibrary::inst()->addStitchSet(mInternalStitchSet);

    } else {
        mInternalStitchSet->clearStitches();
    }

    //start xml save...
    QString *data = new QString();
    QXmlStreamWriter xmlStream(data);
    xmlStream.setAutoFormatting(true);
    xmlStream.writeStartDocument();

    xmlStream.writeStartElement("pattern"); //start pattern
    //TODO: dont need to set the version when saving into a binary file.
    xmlStream.writeAttribute("version", QString::number(FileFactory::Version_1_2));

    //create the StitchSet then save the icons.
    saveCustomStitches(&xmlStream);
    mInternalStitchSet->saveIcons(stream);

    saveColors(&xmlStream);

    saveCharts(&xmlStream);
    xmlStream.writeEndElement();

    xmlStream.writeEndDocument();

    //put xml into binary file.
    *stream << data->toUtf8();

    delete data;
    data = 0;
	
	return FileFactory::No_Error;
}
Пример #3
0
bool SpriteMeshLoader::saveSpriteMesh( string filename, SkeletalDrawing* myDrawing){

    //generate arrays from location

	MeshData* myMesh=renderer->vboList[myDrawing->vboMeshID];

	vertexCount=myMesh->vData.size();

	vertices=new Vector4f[vertexCount];

	//TODO: change to 8 bit unsigned Integer!
	colors=new Vector4f[vertexCount];
	secondaryColors=new Vector3f[vertexCount];
	normals=new Vector3f[vertexCount];

	texCoords=new Vector3f[vertexCount];

	//TODO: change to 8 bit unsigned Integer!
	boneReference=new Vector4f[vertexCount];

	vertexWeights=new Vector4f[vertexCount];


    for (int i=0;i<(int)vertexCount;i++){
		vertices[i]=myMesh->vData[i].location;
        normals[i]=myMesh->vData[i].normal;

        texCoords[i]=Vector3f(myMesh->vData[i].texCoord);
        colors[i]=myMesh->vData[i].color;
        secondaryColors[i]=myMesh->vData[i].secondaryColor;

        vertexWeights[i]=myMesh->vData[i].vertexWeights;
        boneReference[i]=myMesh->vData[i].boneReferences;
    }

    //setup XML
    TiXmlDocument doc;
    TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
    doc.LinkEndChild( decl );
    TiXmlElement * root = new TiXmlElement( "MSBPointSpriteMesh" );
    doc.LinkEndChild( root );

    saveVertices(root);
	delete(vertices);

    saveNormals(root);
	delete(normals);

    saveTexCoords(root);
	delete(texCoords);

    saveColors(root);
	delete(colors);

    saveSecondaryColors(root);
	delete(secondaryColors);

    saveBoneReferences(root);
	delete(boneReference);

    saveVertexWeights(root);
	delete(vertexWeights);

    saveBones(root, myDrawing);

    ///Bones


    doc.SaveFile( filename );
    doc.Clear();


	//createVBOs(myDrawing->vboMeshID);
	loadSpriteMesh(filename, myDrawing->vboMeshID);
    return true;
}