Updated translations + bugfixes
This commit is contained in:
parent
1759adf25a
commit
f66fc1db26
|
@ -34,7 +34,7 @@ add_executable(SchemeEditor
|
|||
comdel/parser/tokens_type.cpp
|
||||
comdel/parser/ast_nodes.cpp
|
||||
comdel/parser/parser_util.cpp
|
||||
comdel/parser/comdellexer.cpp
|
||||
comdel/parser/comdel_lexer.cpp
|
||||
main.cpp
|
||||
mainwindow.ui
|
||||
comdel/domain/comdel_validator.cpp comdel/domain/comdel_validator.h comdel/display/attribute_dialog.cpp comdel/display/attribute_dialog.h comdel/display/name_dialog.cpp comdel/display/name_dialog.h comdel/domain/comdel_generator.cpp comdel/domain/comdel_generator.h comdel/display/library_list.cpp comdel/display/library_list.h application.cpp application.h comdel/display/single_automatic_dialog.cpp comdel/display/single_automatic_dialog.h)
|
||||
|
|
|
@ -9,77 +9,80 @@ CONFIG += c++17
|
|||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
comdel/display/attribute_dialog.cpp \
|
||||
comdel/display/component_display.cpp \
|
||||
comdel/display/library_display.cpp \
|
||||
comdel/display/library_list.cpp \
|
||||
comdel/display/name_dialog.cpp \
|
||||
comdel/display/schema_display.cpp \
|
||||
comdel/domain/addressspace.cpp \
|
||||
comdel/display/single_automatic_dialog.cpp \
|
||||
comdel/domain/address_space.cpp \
|
||||
comdel/domain/attribute.cpp \
|
||||
comdel/domain/bus.cpp \
|
||||
comdel/domain/schemacreator.cpp \
|
||||
comdel/domain/comdel_generator.cpp \
|
||||
comdel/domain/comdel_validator.cpp \
|
||||
comdel/domain/component.cpp \
|
||||
comdel/domain/connection.cpp \
|
||||
comdel/domain/comdelvalidator.cpp \
|
||||
comdel/domain/connectioninstance.cpp \
|
||||
comdel/domain/connection_instance.cpp \
|
||||
comdel/domain/display.cpp \
|
||||
comdel/domain/functionsignature.cpp \
|
||||
comdel/domain/function_signature.cpp \
|
||||
comdel/domain/instance.cpp \
|
||||
comdel/domain/instanceattribute.cpp \
|
||||
comdel/domain/instance_attribute.cpp \
|
||||
comdel/domain/library.cpp \
|
||||
comdel/domain/pin.cpp \
|
||||
comdel/domain/rule.cpp \
|
||||
comdel/domain/schema.cpp \
|
||||
comdel/domain/schema_creator.cpp \
|
||||
comdel/domain/value.cpp \
|
||||
comdel/domain/wireinstance.cpp \
|
||||
comdel/parser/astnode.cpp \
|
||||
comdel/parser/comdellexer.cpp \
|
||||
comdel/parser/comdelparser.cpp \
|
||||
comdel/parser/parsecontext.cpp \
|
||||
comdel/parser/parserutil.cpp \
|
||||
comdel/parser/sourceerror.cpp \
|
||||
comdel/parser/ast_nodes.cpp \
|
||||
comdel/parser/comdel_lexer.cpp \
|
||||
comdel/parser/comdel_parser.cpp \
|
||||
comdel/parser/parse_context.cpp \
|
||||
comdel/parser/parser_util.cpp \
|
||||
comdel/parser/source_error.cpp \
|
||||
comdel/parser/token.cpp \
|
||||
comdel/parser/tokenstype.cpp \
|
||||
comdel/display/dialogmanager.cpp \
|
||||
comdel/display/attribute_dialog.cpp \
|
||||
comdel/display/name_dialog.cpp \
|
||||
comdel/parser/tokens_type.cpp \
|
||||
application.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
comdel/display/attribute_dialog.h \
|
||||
comdel/display/component_display.h \
|
||||
comdel/display/library_display.h \
|
||||
comdel/display/library_list.h \
|
||||
comdel/display/name_dialog.h \
|
||||
comdel/display/schema_display.h \
|
||||
comdel/domain/addressspace.h \
|
||||
comdel/display/single_automatic_dialog.h \
|
||||
comdel/domain/address_space.h \
|
||||
comdel/domain/attribute.h \
|
||||
comdel/domain/bus.h \
|
||||
comdel/domain/schemacreator.h \
|
||||
comdel/domain/comdel_generator.h \
|
||||
comdel/domain/comdel_validator.h \
|
||||
comdel/domain/component.h \
|
||||
comdel/domain/connection.h \
|
||||
comdel/domain/comdelvalidator.h \
|
||||
comdel/domain/connectioninstance.h \
|
||||
comdel/domain/connection_instance.h \
|
||||
comdel/domain/display.h \
|
||||
comdel/domain/functionsignature.h \
|
||||
comdel/domain/function_signature.h \
|
||||
comdel/domain/instance.h \
|
||||
comdel/domain/instanceattribute.h \
|
||||
comdel/domain/instance_attribute.h \
|
||||
comdel/domain/library.h \
|
||||
comdel/domain/pin.h \
|
||||
comdel/domain/rule.h \
|
||||
comdel/domain/schema.h \
|
||||
comdel/domain/schema_creator.h \
|
||||
comdel/domain/value.h \
|
||||
comdel/domain/wireinstance.h \
|
||||
comdel/parser/astnode.h \
|
||||
comdel/parser/comdellexer.h \
|
||||
comdel/parser/comdelparser.h \
|
||||
comdel/parser/ast_nodes.h \
|
||||
comdel/parser/comdel_lexer.h \
|
||||
comdel/parser/comdel_parser.h \
|
||||
comdel/parser/expected.h \
|
||||
comdel/parser/parsecontext.h \
|
||||
comdel/parser/parserutil.h \
|
||||
comdel/parser/parse_context.h \
|
||||
comdel/parser/parser_util.h \
|
||||
comdel/parser/poly.h \
|
||||
comdel/parser/presult.h \
|
||||
comdel/parser/sourceerror.h \
|
||||
comdel/parser/source_error.h \
|
||||
comdel/parser/token.h \
|
||||
comdel/parser/tokenstype.h \
|
||||
comdel/display/dialogmanager.h \
|
||||
comdel/display/attribute_dialog.h \
|
||||
comdel/display/name_dialog.h \
|
||||
comdel/parser/tokens_type.h \
|
||||
mainwindow.h
|
||||
|
||||
FORMS += \
|
||||
|
|
|
@ -59,14 +59,16 @@ namespace display {
|
|||
|
||||
}
|
||||
|
||||
AttributeDialog::AttributeDialog(domain::InstanceAttribute *attribute) {
|
||||
AttributeDialog::AttributeDialog(domain::InstanceAttribute *attribute, bool updating) {
|
||||
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
attributeValue = attribute;
|
||||
|
||||
this->setWindowTitle(QString::fromStdString("Izmjeni " + attribute->attribute.getName()));
|
||||
auto actionType = updating ? "Izmjeni " : "Postavi ";
|
||||
|
||||
this->setWindowTitle(QString::fromStdString(actionType + attribute->attribute.getName()));
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
this->setLayout(layout);
|
||||
|
@ -120,11 +122,11 @@ namespace display {
|
|||
auto *radioLayout = new QHBoxLayout(group);
|
||||
group->setLayout(radioLayout);
|
||||
|
||||
auto isTrue = new QRadioButton("true", group);
|
||||
auto isTrue = new QRadioButton("da", group);
|
||||
connect(isTrue, &QRadioButton::clicked, [this]() {
|
||||
this->value = domain::Value::fromBool(true);
|
||||
});
|
||||
auto isFalse = new QRadioButton("false", group);
|
||||
auto isFalse = new QRadioButton("ne", group);
|
||||
connect(isFalse, &QRadioButton::clicked, [this]() {
|
||||
this->value = domain::Value::fromBool(false);
|
||||
});
|
||||
|
@ -140,7 +142,7 @@ namespace display {
|
|||
layout->addWidget(group);
|
||||
}
|
||||
|
||||
auto button = new QPushButton("Ažuriraj");
|
||||
auto button = new QPushButton(updating ? "Ažuriraj" : "Postavi");
|
||||
connect(button, &QPushButton::clicked, this, &AttributeDialog::onUpdate);
|
||||
|
||||
layout->addWidget(button);
|
||||
|
@ -170,14 +172,16 @@ namespace display {
|
|||
}
|
||||
|
||||
MemoryDialog::MemoryDialog(domain::InstanceAttribute *attribute,
|
||||
std::vector<std::shared_ptr<domain::ComponentInstance>> instances) {
|
||||
std::vector<std::shared_ptr<domain::ComponentInstance>> instances, bool updating) {
|
||||
memoryInstances = std::vector<std::string>();
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
attributeValue = attribute;
|
||||
|
||||
this->setWindowTitle(QString::fromStdString("Izmjeni " + attribute->attribute.getName()));
|
||||
auto actionType = updating ? "Izmjeni memoriju" : "Postavi memoriju";
|
||||
|
||||
this->setWindowTitle(QString::fromStdString(actionType));
|
||||
|
||||
for (auto &instance: instances) {
|
||||
if (instance->component.getType() == domain::Component::MEMORY) {
|
||||
|
@ -212,7 +216,7 @@ namespace display {
|
|||
}
|
||||
}
|
||||
|
||||
auto button = new QPushButton("Ažuriraj");
|
||||
auto button = new QPushButton(updating ? "Ažuriraj" : "Postavi");
|
||||
connect(button, &QPushButton::clicked, this, &MemoryDialog::onUpdate);
|
||||
|
||||
layout->addWidget(button);
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace display {
|
|||
domain::InstanceAttribute *attributeValue;
|
||||
|
||||
public:
|
||||
AttributeDialog(domain::InstanceAttribute *attribute);
|
||||
AttributeDialog(domain::InstanceAttribute *attribute, bool updating = true);
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -63,7 +63,7 @@ namespace display {
|
|||
|
||||
public:
|
||||
MemoryDialog(domain::InstanceAttribute *attribute,
|
||||
std::vector<std::shared_ptr<domain::ComponentInstance>> instances);
|
||||
std::vector<std::shared_ptr<domain::ComponentInstance>> instances, bool updating = true);
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
|
@ -7,11 +7,15 @@
|
|||
|
||||
#include <QMenu>
|
||||
#include <QLine>
|
||||
#include <QPen>
|
||||
#include <QGraphicsSceneContextMenuEvent>
|
||||
#include <set>
|
||||
|
||||
|
||||
namespace display {
|
||||
|
||||
QPen connectionPen(QColor::fromRgb(150, 150, 250));
|
||||
|
||||
void Component::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
|
||||
QMenu menu;
|
||||
menu.addAction("Izmjeni ime", [this]() {
|
||||
|
@ -32,19 +36,21 @@ namespace display {
|
|||
auto *attr = &this->instance->attributes[i];
|
||||
bool enabled = attr->attribute.getPopup().has_value();
|
||||
|
||||
auto action = menu.addAction(QString::fromStdString("Izmjeni " + attr->name),
|
||||
[attr]() {
|
||||
if (attr->value.getType() == domain::Value::MEMORY_REFERENCE) {
|
||||
if(attr->value.getType() == domain::Value::MEMORY_REFERENCE) {
|
||||
menu.addAction("Izmjeni memoriju", [attr]() {
|
||||
auto dialog = new MemoryDialog(attr,
|
||||
Application::instance()->getSchema()->componentInstances);
|
||||
dialog->exec();
|
||||
});
|
||||
} else {
|
||||
auto action = menu.addAction(QString::fromStdString("Izmjeni '" + attr->name + "'"),
|
||||
[attr]() {
|
||||
auto dialog = new AttributeDialog(attr);
|
||||
dialog->exec();
|
||||
}
|
||||
});
|
||||
action->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
menu.addSeparator();
|
||||
menu.addAction(QString::fromStdString("Ukloni " + this->instance->name), [this]() {
|
||||
Application::instance()->removeComponent(this->instance->name);
|
||||
|
@ -62,7 +68,7 @@ namespace display {
|
|||
|
||||
void Pin::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
|
||||
QMenu menu;
|
||||
menu.addAction("Connect pin", [&]() {});
|
||||
menu.addAction("Poveži pin", [&]() {});
|
||||
menu.exec(event->screenPos());
|
||||
}
|
||||
|
||||
|
@ -75,6 +81,8 @@ namespace display {
|
|||
QPointF(pin.getDisplayPin().getConnectionX(),
|
||||
pin.getDisplayPin().getConnectionY());
|
||||
view->context.line = new QGraphicsLineItem(QLineF(view->context.startingPoint, event->scenePos()));
|
||||
view->context.line->setPen(QPen(QColor::fromRgb(100, 100, 250), 1, Qt::PenStyle::DashLine));
|
||||
view->context.line->setZValue(1000);
|
||||
this->scene()->addItem(view->context.line);
|
||||
|
||||
view->showConnectable(this);
|
||||
|
@ -225,9 +233,8 @@ namespace display {
|
|||
BusConnection::BusConnection(domain::BusConnectionInstance *connection, ComponentGroup *component, BusGroup *bus): connection(
|
||||
connection), component(component), bus(bus) {
|
||||
updateConnection();
|
||||
|
||||
setCursor(Qt::CrossCursor);
|
||||
|
||||
setPen(connectionPen);
|
||||
setZValue(-1);
|
||||
setHandlesChildEvents(false);
|
||||
}
|
||||
|
||||
|
@ -280,7 +287,8 @@ namespace display {
|
|||
DirectConnection::DirectConnection(domain::DirectConnectionInstance *connection, ComponentGroup *first,
|
||||
ComponentGroup *second): connection(connection), first(first), second(second) {
|
||||
updateConnection();
|
||||
setCursor(Qt::CrossCursor);
|
||||
setPen(connectionPen);
|
||||
setZValue(-1);
|
||||
setHandlesChildEvents(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ namespace display {
|
|||
componentList = new LibraryList(this);
|
||||
busList = new LibraryList(this);
|
||||
|
||||
layout->setMargin(4);
|
||||
layout->addWidget(new QLabel("Components:"));
|
||||
layout->setContentsMargins(4, 4, 4, 4);
|
||||
layout->addWidget(new QLabel("Komponente:"));
|
||||
layout->addWidget(componentList, 1);
|
||||
layout->addSpacing(8);
|
||||
layout->addWidget(new QLabel("Buses:"));
|
||||
layout->addWidget(new QLabel("Sabirnice:"));
|
||||
layout->addWidget(busList, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
namespace display {
|
||||
|
||||
Schema::Schema() {
|
||||
this->selectedBrush.setColor(QColor::fromRgb(20, 20, 125));
|
||||
this->selectedPen.setColor(QColor::fromRgb(20, 20, 125));
|
||||
schema = nullptr;
|
||||
library = std::nullopt;
|
||||
this->setScene(&scene);
|
||||
|
@ -27,7 +25,9 @@ namespace display {
|
|||
components.clear();
|
||||
buses.clear();
|
||||
scene.clear();
|
||||
pins.clear();
|
||||
busConnections.clear();
|
||||
directConnections.clear();
|
||||
|
||||
if (schema != nullptr) {
|
||||
for (auto &instance: schema->componentInstances) {
|
||||
|
@ -150,6 +150,7 @@ namespace display {
|
|||
if (con.has_value()) {
|
||||
auto attributes = populateAttributes(con->getAttributes());
|
||||
if(attributes.size() != con->getAttributes().size()) {
|
||||
clearSelectable();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -190,6 +191,7 @@ namespace display {
|
|||
attributes = populateAttributes(con->getAttributes());
|
||||
}
|
||||
if(attributes.size() != con->getAttributes().size()) {
|
||||
clearSelectable();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -211,14 +213,7 @@ namespace display {
|
|||
}
|
||||
}
|
||||
|
||||
updateConnections();
|
||||
|
||||
|
||||
for (auto &item: this->context.selectable) {
|
||||
this->scene.removeItem(item);
|
||||
delete item;
|
||||
}
|
||||
this->context.selectable.clear();
|
||||
clearSelectable();
|
||||
}
|
||||
|
||||
void Schema::showConnectable(Pin *domainPin) {
|
||||
|
@ -236,7 +231,7 @@ namespace display {
|
|||
continue;
|
||||
}
|
||||
auto rect = new QGraphicsRectItem(group->boundingRect());
|
||||
rect->setPen(selectedPen);
|
||||
rect->setBrush(selectedBrush);
|
||||
rect->setPos(group->scenePos());
|
||||
|
||||
auto _rect = rect->rect();
|
||||
|
@ -255,6 +250,7 @@ namespace display {
|
|||
auto pinInstance = domain::ConnectionComponent{connection.componentInstance.value()->name, connection.pin.value().getName()};
|
||||
auto &instance = pins[pinInstance];
|
||||
auto rect = new QGraphicsRectItem(instance->boundingRect());
|
||||
rect->setBrush(selectedBrush);
|
||||
rect->setPen(selectedPen);
|
||||
rect->setPos(instance->scenePos());
|
||||
|
||||
|
@ -276,13 +272,13 @@ namespace display {
|
|||
domain::InstanceAttribute attribute(attr.getName(), attr.getDefault(), attr);
|
||||
if(attr.getPopup().has_value() && attr.getPopup()->getType() == domain::Popup::AUTOMATIC) {
|
||||
if(attr.getDefault().isType(domain::Value::MEMORY_REFERENCE)) {
|
||||
auto dialog = new MemoryDialog(&attribute, schema->componentInstances);
|
||||
auto dialog = new MemoryDialog(&attribute, schema->componentInstances, false);
|
||||
if(dialog->exec() == QDialog::Rejected) {
|
||||
// if any dialog isn't set, whole creation is rejected
|
||||
return {};
|
||||
}
|
||||
} else {
|
||||
auto dialog = new AttributeDialog(&attribute);
|
||||
auto dialog = new AttributeDialog(&attribute, false);
|
||||
if(dialog->exec() == QDialog::Rejected) {
|
||||
// if any dialog isn't set, whole creation is rejected
|
||||
return {};
|
||||
|
@ -301,7 +297,7 @@ namespace display {
|
|||
instanceAttributes.emplace_back(attr.getName(), attr.getDefault(), attr);
|
||||
}
|
||||
|
||||
auto dialog = new display::SingleAutomaticDialog(instanceAttributes);
|
||||
auto dialog = new display::SingleAutomaticDialog(instanceAttributes, false);
|
||||
if(dialog->exec() == QDialog::Rejected) {
|
||||
// if dialog is rejected, whole creation is rejected
|
||||
return {};
|
||||
|
@ -311,4 +307,14 @@ namespace display {
|
|||
|
||||
}
|
||||
|
||||
void Schema::clearSelectable() {
|
||||
updateConnections();
|
||||
|
||||
for (auto &item: this->context.selectable) {
|
||||
this->scene.removeItem(item);
|
||||
delete item;
|
||||
}
|
||||
this->context.selectable.clear();
|
||||
}
|
||||
|
||||
} // namespace display
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <QGraphicsView>
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
#include <QGraphicsLineItem>
|
||||
|
||||
#include <comdel/domain/schema.h>
|
||||
|
@ -19,8 +20,9 @@ namespace display {
|
|||
|
||||
public:
|
||||
|
||||
QBrush selectedBrush;
|
||||
QPen selectedPen;
|
||||
QBrush selectedBrush = QBrush(QColor::fromRgb(50, 50, 150, 100), Qt::BrushStyle::SolidPattern);
|
||||
QPen selectedPen = QPen(QColor::fromRgb(50, 50, 150), 1, Qt::PenStyle::SolidLine);
|
||||
QPen activeLinePen = QPen(QColor::fromRgb(250, 100, 100));
|
||||
|
||||
enum State {
|
||||
DEFAULT,
|
||||
|
@ -68,15 +70,11 @@ namespace display {
|
|||
domain::Schema *schema{};
|
||||
std::optional<domain::Library> library;
|
||||
|
||||
std::vector<domain::BusInstance *>
|
||||
getAvailableConnectionBusses(domain::ComponentInstance *instance, domain::Pin &pin);
|
||||
|
||||
std::vector<domain::ConnectionComponent>
|
||||
getAvailableConnectionPins(domain::ComponentInstance *instance, domain::Pin &pin);
|
||||
|
||||
std::vector<domain::InstanceAttribute> populateAttributes(std::vector<domain::Attribute>& attributes);
|
||||
|
||||
std::vector<domain::InstanceAttribute> populateSingleAutomaticConnection(domain::Connection connection);
|
||||
|
||||
void clearSelectable();
|
||||
};
|
||||
|
||||
} // namespace display
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include <QPushButton>
|
||||
|
||||
namespace display {
|
||||
SingleAutomaticDialog::SingleAutomaticDialog(std::vector<domain::InstanceAttribute> &values): attributes(values) {
|
||||
SingleAutomaticDialog::SingleAutomaticDialog(std::vector<domain::InstanceAttribute> &values, bool updating): attributes(values) {
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setWindowTitle(QString::fromStdString("Postavi poveznicu"));
|
||||
setWindowTitle(QString::fromStdString(updating ? "Ažuriraj poveznicu" : "Postavi poveznicu"));
|
||||
|
||||
firstValue = values[0].value;
|
||||
secondValue = values[1].value;
|
||||
|
@ -29,7 +29,7 @@ namespace display {
|
|||
setupValues(firstLayout, values[0], &SingleAutomaticDialog::onFirstEnumerationChanged);
|
||||
setupValues(secondLayout, values[1], &SingleAutomaticDialog::onSecondEnumerationChanged);
|
||||
|
||||
auto button = new QPushButton("Ažuriraj");
|
||||
auto button = new QPushButton(updating ? "Ažuriraj" : "Postavi");
|
||||
connect(button, &QPushButton::clicked, this, &SingleAutomaticDialog::onUpdate);
|
||||
parentLayout->addWidget(button);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace display {
|
|||
std::vector<domain::InstanceAttribute> &attributes;
|
||||
|
||||
public:
|
||||
explicit SingleAutomaticDialog(std::vector<domain::InstanceAttribute>& values);
|
||||
explicit SingleAutomaticDialog(std::vector<domain::InstanceAttribute>& values, bool updating = true);
|
||||
|
||||
void setupValues(QVBoxLayout *layout, domain::InstanceAttribute &attribute, void (display::SingleAutomaticDialog::* handler)(int));
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace domain {
|
|||
if(memoryReference != nullopt) {
|
||||
if(memoryInstances.count(*memoryReference) == 0) {
|
||||
context.attributes["memoryReference"] = domain::Value::fromString(memoryReference.value());
|
||||
auto message = populateMessage("There isn't a memory instance '{memoryReference}'", context);
|
||||
auto message = populateMessage("Ne postoji memorijska komponenta '{memoryReference}'", context);
|
||||
errors.emplace_back(component.get(), nullptr, Action::ERROR, message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
#include "display.h"
|
||||
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
|
||||
namespace domain {
|
||||
|
||||
QBrush busBrush(QColor::fromRgb(200, 200, 200));
|
||||
QPen busPen(QColor::fromRgb(200, 200, 200));
|
||||
|
||||
Display::Display(std::vector<ui::Item> items) : items(items) {}
|
||||
|
||||
void Display::render(QGraphicsItemGroup *group) {
|
||||
|
@ -39,11 +45,16 @@ namespace domain {
|
|||
}
|
||||
|
||||
void ui::Bus::render(QGraphicsItemGroup *group, int size) {
|
||||
int _w = w, _h = h;
|
||||
if (orientation == HORIZONTAL) {
|
||||
group->addToGroup(new QGraphicsRectItem(x, y, size, h));
|
||||
_w = size;
|
||||
} else {
|
||||
group->addToGroup(new QGraphicsRectItem(x, y, w, size));
|
||||
_h = size;
|
||||
}
|
||||
auto rect = new QGraphicsRectItem(x, y, _w, _h);
|
||||
rect->setBrush(busBrush);
|
||||
rect->setPen(busPen);
|
||||
group->addToGroup(rect);
|
||||
}
|
||||
|
||||
int ui::Bus::getDefaultSize() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "comdellexer.h"
|
||||
#include "comdel_lexer.h"
|
||||
#include "token.h"
|
||||
#include "tokens_type.h"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "comdellexer.h"
|
||||
#include "comdel_lexer.h"
|
||||
#include "comdel_parser.h"
|
||||
#include "parser_util.h"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Version 0.0.1
|
||||
#include "libraries\frisc\vjezba1\FRISC.cdl"
|
||||
#include "libraries\frisc\vjezba1\dma.cdl"
|
||||
#include "libraries\frisc\vjezba1\memory.cdl"
|
||||
|
||||
|
||||
|
@ -24,43 +23,31 @@ component System
|
|||
wire --BACK;
|
||||
|
||||
|
||||
//PIOSabirnica
|
||||
wire<8> PIO_DATA;
|
||||
wire READY;
|
||||
wire STROBE;
|
||||
|
||||
|
||||
//directRam
|
||||
wire INT;
|
||||
|
||||
|
||||
// components --------------------------------------------
|
||||
subcomponent Memorija memorija<false, 1, 1024, 8, 0>(ADR, DATA, READ, WRITE, SIZE, WAIT, INT, *, *, *);
|
||||
subcomponent Memorija memorija<false, 1, 65536, 8, 0>(ADR, DATA, READ, WRITE, SIZE, WAIT, *, *, *, INT);
|
||||
subcomponent FRISC procesor(ADR, DATA, READ, WRITE, SIZE, WAIT, INT0, INT1, INT2, INT3, --IACK, 1, *, INT, *, *, *);
|
||||
subcomponent DMA dma<1024>(ADR, DATA, READ, WRITE, SIZE, WAIT, INT0, --BREQ, --BACK, 0, 0, *, *);
|
||||
|
||||
display {
|
||||
component { x: -104; y: -102; ref: "procesor"; }
|
||||
component { x: 39; y: 199; ref: "memorija"; }
|
||||
component { x: -352; y: 13; ref: "dma"; }
|
||||
component { x: -377; y: -302; ref: "procesor"; }
|
||||
component { x: -56; y: -80; ref: "memorija"; }
|
||||
|
||||
// glavnaSabirnica bus
|
||||
|
||||
rectangle {
|
||||
x: -106; y: 80;
|
||||
x: -377; y: -106;
|
||||
w: 100; h: 20;
|
||||
}
|
||||
|
||||
|
||||
// PIOSabirnica bus
|
||||
|
||||
|
||||
// directRam bus
|
||||
|
||||
|
||||
line {x1:-54; y1:14; x2:-55; y2:90;}
|
||||
line {x1:89; y1:183; x2:-55; y2:90;}
|
||||
line {x1:-244; y1:79; x2:-55; y2:90;}
|
||||
line {x1:23; y1:227; x2:12; y2:-52;}
|
||||
line {x1:-6; y1:-96; x2:-326; y2:-95;}
|
||||
line {x1:-327; y1:-186; x2:-326; y2:-95;}
|
||||
line {x1:-72; y1:-52; x2:-261; y2:-252;}
|
||||
}
|
||||
}
|
|
@ -2,35 +2,15 @@
|
|||
|
||||
@schema {
|
||||
@instance procesor FRISC {
|
||||
@position (-162, -117)
|
||||
@position (-543, -304)
|
||||
@attribute _memory null
|
||||
}
|
||||
|
||||
@instance dma DMA {
|
||||
@position (-393, -26)
|
||||
@attribute pocetnaAdresa 0
|
||||
}
|
||||
|
||||
@instance glavnaSabirnica glavnaSabirnica {
|
||||
@position (-155, 49)
|
||||
@position (-544, -91)
|
||||
@size 100
|
||||
}
|
||||
|
||||
@instance PIOSabirnica PIOSabirnica {
|
||||
@position (0, 0)
|
||||
@size 0
|
||||
}
|
||||
|
||||
@instance PIOSabirnica PIOSabirnica {
|
||||
@position (0, 0)
|
||||
@size 0
|
||||
}
|
||||
|
||||
@connection (dma.glavniPin, PIOSabirnica, procesor.glavniPin) {
|
||||
}
|
||||
@connection (dma.glavniPin, glavnaSabirnica) {
|
||||
@attribute interupt 1
|
||||
}
|
||||
@connection (dma.glavniPin, PIOSabirnica, procesor.glavniPin) {
|
||||
@connection (procesor.glavniPin, glavnaSabirnica) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,13 @@ void MainWindow::setupUi()
|
|||
ui->centralwidget->setLayout(layout);
|
||||
|
||||
// setup toolbar
|
||||
ui->toolBar->addAction("Load library", this, &MainWindow::onLoadLibrary);
|
||||
ui->toolBar->addAction("Load schema", this, &MainWindow::onLoadSchema);
|
||||
ui->toolBar->addAction("Save schema", this, &MainWindow::onStoreScheme);
|
||||
ui->toolBar->addAction("Generate system", this, &MainWindow::onGenerateComdel);
|
||||
ui->toolBar->addAction("Učitaj bibiloteku", this, &MainWindow::onLoadLibrary);
|
||||
ui->toolBar->addAction("Učitaj shemu", this, &MainWindow::onLoadSchema);
|
||||
ui->toolBar->addAction("Spremi shemu", this, &MainWindow::onStoreScheme);
|
||||
ui->toolBar->addAction("Generiraj comdel", this, &MainWindow::onGenerateComdel);
|
||||
|
||||
connect(ui->actionSave_schema, &QAction::triggered, this, &MainWindow::onStoreScheme);
|
||||
connect(ui->actionExport_schema, &QAction::triggered, this, &MainWindow::onGenerateComdel);
|
||||
connect(ui->actionValidate, &QAction::triggered, this, &MainWindow::onValidateSchema);
|
||||
|
||||
// setup central content
|
||||
|
@ -47,10 +49,10 @@ void MainWindow::setupUi()
|
|||
schemaParent->setLayout(schemaLayout);
|
||||
|
||||
schemaDisplay = new display::Schema();
|
||||
schemaLayout->setMargin(0);
|
||||
schemaLayout->setContentsMargins(0, 0, 0, 0);
|
||||
schemaLayout->addWidget(schemaDisplay, 1);
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(libraryDisplay);
|
||||
layout->addWidget(schemaParent, 1);
|
||||
|
||||
|
@ -62,7 +64,7 @@ void MainWindow::setupUi()
|
|||
|
||||
void MainWindow::onLoadLibrary() {
|
||||
auto filename = QFileDialog::getOpenFileName(this,
|
||||
tr("Open library"), "/home", tr("Comdel library (*.csl)"));
|
||||
tr("Otvori biblioteku"), "", tr("Comdel biblioteka (*.csl)"));
|
||||
if(!filename.isEmpty()) {
|
||||
std::ostringstream output;
|
||||
log->clear();
|
||||
|
@ -81,7 +83,7 @@ void MainWindow::onLoadLibrary() {
|
|||
|
||||
void MainWindow::onLoadSchema() {
|
||||
auto filename = QFileDialog::getOpenFileName(this,
|
||||
tr("Open schema"), "/home", tr("Comdel schema (*.csl)"));
|
||||
tr("Otvori shemu"), "", tr("Comdel shema (*.csl)"));
|
||||
if(!filename.isEmpty()) {
|
||||
std::ostringstream output;
|
||||
log->clear();
|
||||
|
@ -102,7 +104,7 @@ void MainWindow::onLoadSchema() {
|
|||
|
||||
void MainWindow::onStoreScheme() {
|
||||
auto filename = QFileDialog::getSaveFileName(this,
|
||||
tr("Save schema"), "/home", tr("Comdel schema (*.csl)"));
|
||||
tr("Spremi shemu"), "", tr("Comdel shema (*.csl)"));
|
||||
if(!filename.isEmpty()) {
|
||||
log->clear();
|
||||
|
||||
|
@ -113,9 +115,9 @@ void MainWindow::onStoreScheme() {
|
|||
out<<output.str();
|
||||
out.close();
|
||||
|
||||
log->appendPlainText("Successfully stored schema\n");
|
||||
log->appendPlainText("Uspješno spremljena shema\n");
|
||||
} else {
|
||||
log->appendPlainText("Failed storing schema\n");
|
||||
log->appendPlainText("Greška tijekom spremanja sheme\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +125,7 @@ void MainWindow::onStoreScheme() {
|
|||
|
||||
void MainWindow::onGenerateComdel() {
|
||||
auto filename = QFileDialog::getSaveFileName(this,
|
||||
tr("Save schema"), "/home", tr("Comdel system (*.system)"));
|
||||
tr("Spremi shemu"), "", tr("Comdel sustav (*.system)"));
|
||||
if(!filename.isEmpty()) {
|
||||
log->clear();
|
||||
|
||||
|
@ -140,9 +142,9 @@ void MainWindow::onGenerateComdel() {
|
|||
out<<output.str();
|
||||
out.close();
|
||||
|
||||
log->appendPlainText("Successfully generated comdel\n");
|
||||
log->appendPlainText("Uspješno generiranje comdel modela\n");
|
||||
} else {
|
||||
log->appendPlainText("Failed generating comdel\n");
|
||||
log->appendPlainText("Neuspješno generiranje comdel modela\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,17 +53,17 @@
|
|||
</widget>
|
||||
<action name="actionSave_schema">
|
||||
<property name="text">
|
||||
<string>Save schema</string>
|
||||
<string>Spremi shemu</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport_schema">
|
||||
<property name="text">
|
||||
<string>Export schema</string>
|
||||
<string>Generiraj comdel</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionValidate">
|
||||
<property name="text">
|
||||
<string>Validate</string>
|
||||
<string>Validairaj</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue