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 9b8f1b8bd84..5620877d7c0 100644 --- a/plugins/gui/include/gui/gatelibrary_management/gatelibrary_content_widget.h +++ b/plugins/gui/include/gui/gatelibrary_management/gatelibrary_content_widget.h @@ -179,6 +179,7 @@ namespace hal QUuid mUuid; GateLibrary* mGateLibrary; std::filesystem::path mPath; + QString mTitle; bool mDirty; }; 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 eade1b0e0c5..805fbf424d7 100644 --- a/plugins/gui/src/gatelibrary_management/gatelibrary_content_widget.cpp +++ b/plugins/gui/src/gatelibrary_management/gatelibrary_content_widget.cpp @@ -73,6 +73,7 @@ namespace hal mToolbar->addAction(mSaveAsAction); mDirty = false; + layout->addWidget(mToolbar); layout->addWidget(mTableView); layout->addWidget(mSearchbar); @@ -157,6 +158,7 @@ namespace hal mSaveAsAction->setEnabled(mDirty); mSaveAsAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle,mSaveAsIconPath)); + window()->setWindowTitle(mTitle); } void GatelibraryContentWidget::handleSaveAsAction() @@ -177,6 +179,8 @@ namespace hal mSaveAsAction->setEnabled(mDirty); mSaveAsAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle,mSaveAsIconPath)); + + window()->setWindowTitle(mTitle); } void GatelibraryContentWidget::handleUnsavedChanges() @@ -187,6 +191,9 @@ namespace hal mSaveAsAction->setEnabled(mDirty); mSaveAsAction->setIcon(gui_utility::getStyledSvgIcon(mEnabledIconStyle,mSaveAsIconPath)); + + 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 00c771ad07f..0d59096674b 100644 --- a/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp +++ b/plugins/gui/src/gatelibrary_management/gatelibrary_manager.cpp @@ -262,13 +262,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){