| 97 | } |
| 98 | |
| 99 | bool RcxDocument::load(const QString& path) { |
| 100 | QFile file(path); |
| 101 | if (!file.open(QIODevice::ReadOnly)) |
| 102 | return false; |
| 103 | undoStack.clear(); |
| 104 | QJsonDocument jdoc = QJsonDocument::fromJson(file.readAll()); |
| 105 | QJsonObject root = jdoc.object(); |
| 106 | tree = NodeTree::fromJson(root); |
| 107 | |
| 108 | // Load type aliases |
| 109 | typeAliases.clear(); |
| 110 | QJsonObject aliasObj = root["typeAliases"].toObject(); |
| 111 | for (auto it = aliasObj.begin(); it != aliasObj.end(); ++it) { |
| 112 | NodeKind k = kindFromString(it.key()); |
| 113 | QString v = it.value().toString(); |
| 114 | if (!v.isEmpty()) |
| 115 | typeAliases[k] = v; |
| 116 | } |
| 117 | |
| 118 | filePath = path; |
| 119 | modified = false; |
| 120 | emit documentChanged(); |
| 121 | return true; |
| 122 | } |
| 123 | |
| 124 | void RcxDocument::loadData(const QString& binaryPath) { |
| 125 | QFile file(binaryPath); |