Skip to content

Commit

Permalink
changed "finish" button to "save changes", as well as the functionali…
Browse files Browse the repository at this point in the history
…ty to disabled if no changes were made
  • Loading branch information
neoneela committed Sep 19, 2024
1 parent b1b1e99 commit 7778418
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace hal {
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent = QModelIndex()) const override;
};

class GateLibraryWizard;
class GeneralInfoWizardPage:public QWizardPage{
Q_OBJECT

Expand Down Expand Up @@ -100,7 +101,7 @@ namespace hal {
void handleNameChanged(const QString& txt);

private:
QWizard* mWizard;
GateLibraryWizard* mWizard;
QGridLayout* mLayout;
QLabel* mLabelName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ namespace hal
int nextId() const override;
Q_SIGNALS:
void triggerUnsavedChanges();
private Q_SLOTS:
void handleWasEdited();
private:
GateLibrary* mGateLibrary;
GateType* mGateType;
Expand All @@ -92,5 +94,6 @@ namespace hal

PinModel* mPinModel;
GateType* mNewGateType;
bool mWasEdited;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ namespace hal
return false;
}
}
if(!mWizard->mWasEdited) return false;
return true;
}

Expand Down
18 changes: 18 additions & 0 deletions plugins/gui/src/gatelibrary_management/gatelibrary_wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace hal
mGateLibrary = gateLibrary;
mGateType = gateType;
mPinModel = new PinModel(this, true);
mWasEdited = false;

if(mGateType == nullptr)
{
Expand All @@ -65,6 +66,18 @@ namespace hal
boolPage->setData(mGateType);
}

setButtonText(WizardButton::FinishButton, "Save changes");

connect(generalInfoPage, &GeneralInfoWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(pinsPage, &PinsWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(ffPage, &FlipFlopWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(boolPage, &BoolWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(latchPage, &LatchWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(lutPage, &LUTWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(initPage, &InitWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(ramPage, &RAMWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(ramportPage, &RAMPortWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
connect(statePage, &StateWizardPage::completeChanged, this, &GateLibraryWizard::handleWasEdited);
}

void GateLibraryWizard::accept()
Expand Down Expand Up @@ -126,6 +139,11 @@ namespace hal
gFileStatusManager->gatelibChanged();
}

void GateLibraryWizard::handleWasEdited()
{
mWasEdited = true;
}

GateType* GateLibraryWizard::getRecentCreatedGate(){
return mNewGateType;
}
Expand Down

0 comments on commit 7778418

Please sign in to comment.