| 83 | |
| 84 | |
| 85 | QJsonObject |
| 86 | Connection:: |
| 87 | save() const |
| 88 | { |
| 89 | QJsonObject connectionJson; |
| 90 | |
| 91 | if (_inNode && _outNode) |
| 92 | { |
| 93 | connectionJson["in_id"] = _inNode->id().toString(); |
| 94 | connectionJson["in_index"] = _inPortIndex; |
| 95 | |
| 96 | connectionJson["out_id"] = _outNode->id().toString(); |
| 97 | connectionJson["out_index"] = _outPortIndex; |
| 98 | |
| 99 | if (_converter) |
| 100 | { |
| 101 | auto getTypeJson = [this](PortType type) |
| 102 | { |
| 103 | QJsonObject typeJson; |
| 104 | NodeDataType nodeType = this->dataType(type); |
| 105 | typeJson["id"] = nodeType.id; |
| 106 | typeJson["name"] = nodeType.name; |
| 107 | |
| 108 | return typeJson; |
| 109 | }; |
| 110 | |
| 111 | QJsonObject converterTypeJson; |
| 112 | |
| 113 | converterTypeJson["in"] = getTypeJson(PortType::In); |
| 114 | converterTypeJson["out"] = getTypeJson(PortType::Out); |
| 115 | |
| 116 | connectionJson["converter"] = converterTypeJson; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | return connectionJson; |
| 121 | } |
| 122 | |
| 123 | |
| 124 | QUuid |