MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / load

Method load

src/controller.cpp:99–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99bool 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
124void RcxDocument::loadData(const QString& binaryPath) {
125 QFile file(binaryPath);

Calls 2

kindFromStringFunction · 0.85
clearMethod · 0.80