Updated schema
This commit is contained in:
parent
bf029929a7
commit
9f1714d844
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 7.0.0, 2022-04-12T22:39:08. -->
|
||||
<!-- Written by QtCreator 6.0.2, 2022-04-18T11:25:49. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{1f5ef7b0-cf08-4d4a-b37d-18ed0b7a2084}</value>
|
||||
<value type="QByteArray">{391729b0-9fcc-4b56-ba51-7d7ee685fc97}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
|
@ -83,22 +83,25 @@
|
|||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="CppEditor.QuickFix">
|
||||
<value type="bool" key="UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.2 clang 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.2 clang 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.clang_64_kit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{8ccd2350-ba56-4630-b9a6-4b0b4b193aaf}</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/s2ismac/Desktop/comdel/build-SchemeEditor-Desktop_Qt_5_15_2_clang_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/s2ismac/Desktop/comdel/build-SchemeEditor-Desktop_Qt_5_15_2_clang_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/bbr/build-SchemeEditor-Desktop-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/bbr/build-SchemeEditor-Desktop-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
@ -136,8 +139,8 @@
|
|||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/s2ismac/Desktop/comdel/build-SchemeEditor-Desktop_Qt_5_15_2_clang_64bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/s2ismac/Desktop/comdel/build-SchemeEditor-Desktop_Qt_5_15_2_clang_64bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/bbr/build-SchemeEditor-Desktop-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/bbr/build-SchemeEditor-Desktop-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
@ -177,8 +180,8 @@
|
|||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/s2ismac/Desktop/comdel/build-SchemeEditor-Desktop_Qt_5_15_2_clang_64bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/s2ismac/Desktop/comdel/build-SchemeEditor-Desktop_Qt_5_15_2_clang_64bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/bbr/build-SchemeEditor-Desktop-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/bbr/build-SchemeEditor-Desktop-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
@ -238,14 +241,14 @@
|
|||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/Users/s2ismac/Desktop/comdel/schema_editor/SchemeEditor.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/s2ismac/Desktop/comdel/schema_editor/SchemeEditor.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/bbr/SchemeEditor/SchemeEditor.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/bbr/SchemeEditor/SchemeEditor.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/Users/s2ismac/Desktop/comdel/build-SchemeEditor-Desktop_Qt_5_15_2_clang_64bit-Debug/SchemeEditor.app/Contents/MacOS</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/bbr/build-SchemeEditor-Desktop-Debug</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
|
|
|
@ -9,11 +9,11 @@ Schema::Schema()
|
|||
}
|
||||
|
||||
|
||||
void Schema::setSchema(std::optional<domain::Schema> schema)
|
||||
void Schema::setSchema(domain::Schema* schema)
|
||||
{
|
||||
scene.clear();
|
||||
this->schema = schema;
|
||||
if(schema.has_value()) {
|
||||
if(schema != nullptr) {
|
||||
for(auto &instance: schema->instances) {
|
||||
ComponentWrapper *group = nullptr;
|
||||
auto component = dynamic_cast<domain::ComponentInstance*>(instance);
|
||||
|
|
|
@ -14,12 +14,12 @@ class Schema: public QGraphicsView
|
|||
public:
|
||||
Schema();
|
||||
|
||||
void setSchema(std::optional<domain::Schema> schema);
|
||||
void setSchema(domain::Schema* schema);
|
||||
|
||||
private:
|
||||
QGraphicsScene scene;
|
||||
|
||||
std::optional<domain::Schema> schema;
|
||||
domain::Schema* schema;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -728,28 +728,28 @@ std::optional<Condition> SchemaCreator::loadCondition(ConditionNode node)
|
|||
}
|
||||
|
||||
|
||||
std::optional<Schema> SchemaCreator::loadSchema(SchemaNode node, Library &library)
|
||||
Schema* SchemaCreator::loadSchema(SchemaNode node, Library &library)
|
||||
{
|
||||
Schema schema;
|
||||
Schema *schema = new Schema();
|
||||
|
||||
for(auto &instance: node.instances) {
|
||||
if(library.hasComponent(instance.component.value)) {
|
||||
schema.instances.push_back(loadComponentInstance(instance, library));
|
||||
schema->instances.push_back(loadComponentInstance(instance, library));
|
||||
}
|
||||
if(library.hasBus(instance.component.value)) {
|
||||
schema.instances.push_back(loadBusInstance(instance, library));
|
||||
schema->instances.push_back(loadBusInstance(instance, library));
|
||||
}
|
||||
}
|
||||
|
||||
for(auto &wire: node.wires) {
|
||||
auto w = loadWireInstance(wire);
|
||||
if(w) {
|
||||
schema.wires.push_back(*w);
|
||||
schema->wires.push_back(*w);
|
||||
}
|
||||
}
|
||||
|
||||
for(auto &conn: node.connections) {
|
||||
auto firstComponent = dynamic_cast<ComponentInstance*>(schema.getInstance(conn.first.instance.value));
|
||||
auto firstComponent = dynamic_cast<ComponentInstance*>(schema->getInstance(conn.first.instance.value));
|
||||
if(firstComponent == NULL) {
|
||||
errors.push_back(SourceError{conn.first.instance.span, "unknown component"});
|
||||
continue;
|
||||
|
@ -762,7 +762,7 @@ std::optional<Schema> SchemaCreator::loadSchema(SchemaNode node, Library &librar
|
|||
|
||||
ComponentInstance *secondComponent = NULL;
|
||||
if(conn.second.has_value()) {
|
||||
secondComponent = dynamic_cast<ComponentInstance*>(schema.getInstance(conn.second->instance.value));
|
||||
secondComponent = dynamic_cast<ComponentInstance*>(schema->getInstance(conn.second->instance.value));
|
||||
if(secondComponent == NULL) {
|
||||
errors.push_back(SourceError{conn.second->instance.span, "unknown component"});
|
||||
continue;
|
||||
|
@ -773,7 +773,7 @@ std::optional<Schema> SchemaCreator::loadSchema(SchemaNode node, Library &librar
|
|||
}
|
||||
}
|
||||
|
||||
auto bus = dynamic_cast<BusInstance*>(schema.getInstance(conn.bus.value));
|
||||
auto bus = dynamic_cast<BusInstance*>(schema->getInstance(conn.bus.value));
|
||||
if(bus == NULL) {
|
||||
errors.push_back(SourceError{conn.bus.span, "unknown bus"});
|
||||
continue;
|
||||
|
@ -808,12 +808,12 @@ std::optional<Schema> SchemaCreator::loadSchema(SchemaNode node, Library &librar
|
|||
errors.push_back(SourceError{conn.span, "missing @wire"});
|
||||
continue;
|
||||
}
|
||||
if(!schema.hasWire(conn.wire->value)) {
|
||||
if(!schema->hasWire(conn.wire->value)) {
|
||||
errors.push_back(SourceError{conn.wire->span, "unknown wire"});
|
||||
continue;
|
||||
}
|
||||
|
||||
auto wire = schema.getWire(conn.wire->value);
|
||||
auto wire = schema->getWire(conn.wire->value);
|
||||
|
||||
std::vector<InstanceAttribute*> attributes;
|
||||
for(auto& attr: conn.attributes) {
|
||||
|
@ -837,9 +837,9 @@ std::optional<Schema> SchemaCreator::loadSchema(SchemaNode node, Library &librar
|
|||
}
|
||||
|
||||
if(secondComponent == NULL) {
|
||||
schema.connections.push_back(new BusConnectionInstance(firstComponent, attributes, bus, wire, *connection));
|
||||
schema->connections.push_back(new BusConnectionInstance(firstComponent, attributes, bus, wire, *connection));
|
||||
} else {
|
||||
schema.connections.push_back(new DirectConnectionInstance(firstComponent, secondComponent, attributes, bus, wire, *connection));
|
||||
schema->connections.push_back(new DirectConnectionInstance(firstComponent, secondComponent, attributes, bus, wire, *connection));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
|
||||
std::optional<Library> loadLibrary(LibraryNode node);
|
||||
|
||||
std::optional<Schema> loadSchema(SchemaNode node, Library &library);
|
||||
Schema* loadSchema(SchemaNode node, Library &library);
|
||||
};
|
||||
|
||||
} // namespace domain
|
||||
|
|
|
@ -84,7 +84,7 @@ void MainWindow::onLoadLibrary() {
|
|||
libraryDisplay->setLibrary(library);
|
||||
|
||||
// on library load we create a new schema
|
||||
schema = domain::Schema();
|
||||
schema = new domain::Schema();
|
||||
schemaDisplay->setSchema(schema);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ void MainWindow::onLoadSchema() {
|
|||
}
|
||||
|
||||
void MainWindow::onValidateSchema(bool /*toggled*/) {
|
||||
if(!schema.has_value()) {
|
||||
if(schema == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ void MainWindow::onValidateSchema(bool /*toggled*/) {
|
|||
|
||||
void MainWindow::clear() {
|
||||
validationErrors.clear();
|
||||
schema = std::nullopt;
|
||||
schema = nullptr;
|
||||
library = std::nullopt;
|
||||
|
||||
libraryDisplay->setLibrary(library);
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
display::Schema *schemaDisplay;
|
||||
|
||||
std::optional<domain::Library> library = std::nullopt;
|
||||
std::optional<domain::Schema> schema = std::nullopt;
|
||||
domain::Schema* schema = nullptr;
|
||||
|
||||
std::vector<domain::FunctionSignature> signatures;
|
||||
|
||||
|
|
Loading…
Reference in New Issue