Skip to content

Use JSON for state saving #595

@aalex

Description

@aalex

Replace QDomDocument-based XML serialization with QJsonDocument/QJsonObject/QJsonArray (built into Qt, no new dependencies).

We should also rename paints to sources and mappings to layers in the new JSON format.

Target file format

{
  "version": "0.6.3",
  "sources": [
    {
      "className": "Color",
      "id": 1,
      "name": "My Color",
      "locked": false,
      "opacity": 1.0,
      "color": "#ff0000"
    },
    {
      "className": "Video",
      "id": 2,
      "name": "My Video",
      "locked": false,
      "opacity": 1.0,
      "uri": "video.mp4",
      "volume": 0.8,
      "rate": 1.0,
      "x": 0.0,
      "y": 0.0
    }
  ],
  "layers": [
    {
      "className": "TextureMapping",
      "id": 0,
      "name": "Quad 0",
      "locked": false,
      "opacity": 1.0,
      "solo": false,
      "visible": true,
      "depth": 0,
      "paintId": 2,
      "destination": {
        "className": "Quad",
        "vertices": [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]
      },
      "source": {
        "className": "Quad",
        "vertices": [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions