diff --git a/.gitignore b/.gitignore index 984fb90..de79239 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /build/ /sir/ /builds/ +/_build diff --git a/include/sirEdit/data/serialize.hpp b/include/sirEdit/data/serialize.hpp index e83a476..f5a5ae5 100644 --- a/include/sirEdit/data/serialize.hpp +++ b/include/sirEdit/data/serialize.hpp @@ -111,9 +111,11 @@ namespace sirEdit::data { return this->serializer; } - void addTool(Tool tool) { - this->serializer.addTool(new Tool(std::move(tool))); + const Tool* addTool(Tool tool) { + Tool* tmp = new Tool(std::move(tool)); + this->serializer.addTool(tmp); updateCall(this->change_callback); + return tmp; } void setFieldStatus(const Tool& tool, const Type& type, const Field& field, FIELD_STATE state, const std::function& callback_field, const std::function& callback_type) { // Set state diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index bf65a34..e7c0369 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -270,8 +270,8 @@ class MainWindow { // Dialog finished toolFinish->signal_clicked().connect([this, newToolDialog, toolName, toolDescription, toolCommand]() -> void { newToolDialog->hide(); - this->__transitions.addTool({toolName->get_text(), toolDescription->get_buffer()->get_text(), toolCommand->get_buffer()->get_text()}); - // TODO: Open new tool view + const Tool* tool = this->__transitions.addTool({toolName->get_text(), toolDescription->get_buffer()->get_text(), toolCommand->get_buffer()->get_text()}); + this->__create_tab(*const_cast(tool)); }); }