Skip to content

Commit

Permalink
fixed some bugs, added asterisk after gatelibrary name for unsaved ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
neoneela committed Sep 4, 2024
1 parent f24cd3d commit ee8c921
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ namespace hal
QUuid mUuid;
GateLibrary* mGateLibrary;
std::filesystem::path mPath;
QString mTitle;

bool mDirty;
};
Expand Down
1 change: 1 addition & 0 deletions plugins/gui/include/gui/pin_model/pin_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <QVariant>
#include <QMessageBox>
#include <QPushButton>
#include <QComboBox>
#include <array>
#include <set>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace hal
mToolbar->addAction(mSaveAsAction);
mDirty = false;


layout->addWidget(mToolbar);
layout->addWidget(mTableView);
layout->addWidget(mSearchbar);
Expand Down Expand Up @@ -157,6 +158,7 @@ namespace hal
mSaveAsAction->setEnabled(mDirty);
mSaveAsAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle,mSaveAsIconPath));

window()->setWindowTitle(mTitle);
}

void GatelibraryContentWidget::handleSaveAsAction()
Expand All @@ -177,6 +179,8 @@ namespace hal

mSaveAsAction->setEnabled(mDirty);
mSaveAsAction->setIcon(gui_utility::getStyledSvgIcon(mDisabledIconStyle,mSaveAsIconPath));

window()->setWindowTitle(mTitle);
}

void GatelibraryContentWidget::handleUnsavedChanges()
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
}

Expand Down
26 changes: 3 additions & 23 deletions plugins/gui/src/pin_model/pin_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace hal
mAssignedGroupNames = QSet<QString>();
mAssignedPinNames = QSet<QString>();
mEditable = false;

//connect(this, &PinModel::dataChanged, this, &PinModel::handleInvalidGroupUpdate);
}

PinModel::PinModel(QObject* parent, bool editable) : BaseTreeModel(parent)
Expand Down Expand Up @@ -241,6 +243,7 @@ namespace hal
break;
}
}

Q_EMIT dataChanged(index, index);
}

Expand All @@ -255,19 +258,6 @@ namespace hal

switch(itemType){
case PinItem::TreeItemType::PinGroup:
/*{
pinItem->setDirection(direction);
qInfo()<<pinItem->getChildren().length();
for(auto child : pinItem->getChildren()) //set same direction for all pins of the pingroup
{
PinItem* pin = static_cast<PinItem*>(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
Expand All @@ -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*>(pinItem->getParent());
//handleGroupDirectionUpdate(groupItem);
handleInvalidPinUpdate(pinItem);
break;
}*/
case PinItem::TreeItemType::InvalidPin:{
QMessageBox warning;
QPushButton* acceptBtn = warning.addButton(tr("Continue with changes"), QMessageBox::AcceptRole);
Expand All @@ -312,7 +294,6 @@ namespace hal
pinItem->setDirection(pinDirection);
handleInvalidPinUpdate(pinItem);
}

break;
}
}
Expand Down Expand Up @@ -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*>(pinItem->getParent());
handleInvalidGroupUpdate(pinGroup);

}

void PinModel::handleInvalidGroupUpdate(PinItem* groupItem){
Expand Down

0 comments on commit ee8c921

Please sign in to comment.