diff --git a/plugins/gui/include/gui/gatelibrary_management/gatelibrary_content_widget.h b/plugins/gui/include/gui/gatelibrary_management/gatelibrary_content_widget.h index c89bb80d58f..d9b6308f634 100644 --- a/plugins/gui/include/gui/gatelibrary_management/gatelibrary_content_widget.h +++ b/plugins/gui/include/gui/gatelibrary_management/gatelibrary_content_widget.h @@ -153,5 +153,6 @@ namespace hal private: GateLibrary* mGateLibrary; std::filesystem::path mPath; + QString mTitle; }; } diff --git a/plugins/gui/include/gui/pin_model/pin_model.h b/plugins/gui/include/gui/pin_model/pin_model.h index 839521fb8d0..4cb83518b8f 100644 --- a/plugins/gui/include/gui/pin_model/pin_model.h +++ b/plugins/gui/include/gui/pin_model/pin_model.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/plugins/gui/src/gatelibrary_management/gatelibrary_content_widget.cpp b/plugins/gui/src/gatelibrary_management/gatelibrary_content_widget.cpp index 5579dc161cf..06cbbab43dd 100644 --- a/plugins/gui/src/gatelibrary_management/gatelibrary_content_widget.cpp +++ b/plugins/gui/src/gatelibrary_management/gatelibrary_content_widget.cpp @@ -64,6 +64,7 @@ namespace hal mToolbar->addAction(mDeleteAction); mToolbar->addAction(mSearchAction); + layout->addWidget(mToolbar); layout->addWidget(mTableView); layout->addWidget(mSearchbar); @@ -135,6 +136,7 @@ namespace hal HGLWriter* writer = new HGLWriter(); if(writer->write(mGateLibrary, mPath)) msg.exec(); + window()->setWindowTitle(mTitle); } void GatelibraryContentWidget::handleSaveAsAction() @@ -148,10 +150,15 @@ namespace hal gFileStatusManager->gatelibSaved(); HGLWriter* writer = new HGLWriter(); writer->write(mGateLibrary, std::filesystem::path(filename.toStdString())); + + window()->setWindowTitle(mTitle); } void GatelibraryContentWidget::handleUnsavedChanges() - {;} + { + mTitle = window()->windowTitle(); + window()->setWindowTitle(mTitle + " *"); + } void GatelibraryContentWidget::toggleSearchbar() { diff --git a/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp b/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp index 9e804166b3e..7463e6a6f53 100644 --- a/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp +++ b/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp @@ -266,13 +266,14 @@ namespace hal Q_EMIT close(); break; case QMessageBox::Discard: + gate_library_manager::remove(std::filesystem::path(mEditableGatelibrary->get_path())); + window()->setWindowTitle("HAL"); Q_EMIT close(); break; case QMessageBox::Cancel: msgBox->reject(); break; } - } } diff --git a/plugins/gui/src/pin_model/pin_model.cpp b/plugins/gui/src/pin_model/pin_model.cpp index 6a7d9ae335d..f99ccbba59f 100644 --- a/plugins/gui/src/pin_model/pin_model.cpp +++ b/plugins/gui/src/pin_model/pin_model.cpp @@ -11,6 +11,8 @@ namespace hal mAssignedGroupNames = QSet(); mAssignedPinNames = QSet(); mEditable = false; + + //connect(this, &PinModel::dataChanged, this, &PinModel::handleInvalidGroupUpdate); } PinModel::PinModel(QObject* parent, bool editable) : BaseTreeModel(parent) @@ -241,6 +243,7 @@ namespace hal break; } } + Q_EMIT dataChanged(index, index); } @@ -255,19 +258,6 @@ namespace hal switch(itemType){ case PinItem::TreeItemType::PinGroup: - /*{ - pinItem->setDirection(direction); - qInfo()<getChildren().length(); - for(auto child : pinItem->getChildren()) //set same direction for all pins of the pingroup - { - PinItem* pin = static_cast(child); - qInfo()<<"1"; - pin->setDirection(direction); - } - handleInvalidGroupUpdate(pinItem); - //qInfo()<<"handleEditDirection PinGroup"; - break; - }*/ case PinItem::TreeItemType::InvalidPinGroup:{ pinItem->setDirection(directionString); for(auto child : pinItem->getChildren()) //set same direction for all pins of the pingroup @@ -282,14 +272,6 @@ namespace hal break; } case PinItem::TreeItemType::Pin: - /*{ - pinItem->setDirection(direction); - //get the groupItem and update it - //auto groupItem = static_cast(pinItem->getParent()); - //handleGroupDirectionUpdate(groupItem); - handleInvalidPinUpdate(pinItem); - break; - }*/ case PinItem::TreeItemType::InvalidPin:{ QMessageBox warning; QPushButton* acceptBtn = warning.addButton(tr("Continue with changes"), QMessageBox::AcceptRole); @@ -312,7 +294,6 @@ namespace hal pinItem->setDirection(pinDirection); handleInvalidPinUpdate(pinItem); } - break; } } @@ -498,7 +479,6 @@ namespace hal //checks if the groups status is affected and if so it updates the group auto pinGroup = static_cast(pinItem->getParent()); handleInvalidGroupUpdate(pinGroup); - } void PinModel::handleInvalidGroupUpdate(PinItem* groupItem){