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