Skip to content

Commit

Permalink
Disable action 'new' and 'open' when launching GateLibraryManager in …
Browse files Browse the repository at this point in the history
…readonly mode
  • Loading branch information
joern274 committed Oct 28, 2024
1 parent d0e3fdd commit 1d13f84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ namespace hal
void updateTabs(GateType* gateType);
bool callUnsavedChangesWindow();

bool isReadOnly() const;

public Q_SLOTS:
/**
* Opens the Wizard to edit or add a new gate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ namespace hal
mPinTab->update(gateType);
}

bool GateLibraryManager::isReadOnly() const
{
return mReadOnly;
}

bool GateLibraryManager::callUnsavedChangesWindow()
{
QMessageBox* msgBox = new QMessageBox(this);
Expand Down
5 changes: 4 additions & 1 deletion plugins/gui/src/main_window/file_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ namespace hal {
connect(mActionClose, &Action::triggered, mGatelibReference, &GateLibraryManager::handleCancelClicked);
connect(mActionSave, &Action::triggered, mGatelibReference, &GateLibraryManager::handleSaveAction);
connect(mActionSaveAs, &Action::triggered, mGatelibReference, &GateLibraryManager::handleSaveAsAction);
mActionCreate->setEnabled(true);
mActionCreate->setEnabled(!mGatelibReference->isReadOnly());
mActionOpen->setEnabled(!mGatelibReference->isReadOnly());
mActionSave->setEnabled(gFileStatusManager->isGatelibModified());
mActionSaveAs->setEnabled(gFileStatusManager->isGatelibModified());
}
Expand All @@ -103,6 +104,7 @@ namespace hal {
connect(mActionOpen, &Action::triggered, mGuiPluginReference, &GuiPluginManager::handleLoadExternalPlugin);
connect(mActionClose, &Action::triggered, mGuiPluginReference, &GuiPluginManager::handleButtonCancel);
mActionCreate->setDisabled(true);
mActionOpen->setEnabled(true);
mActionSave->setDisabled(true);
mActionSaveAs->setDisabled(true);
}
Expand All @@ -120,6 +122,7 @@ namespace hal {
connect(mActionSave, &Action::triggered, mMainWindowReference, &MainWindow::handleSaveTriggered);
connect(mActionSaveAs, &Action::triggered, mMainWindowReference, &MainWindow::handleSaveAsTriggered);
mActionCreate->setEnabled(true);
mActionOpen->setEnabled(true);
mActionSave->setEnabled(gFileStatusManager->modifiedFilesExisting());
mActionSaveAs->setEnabled(gFileStatusManager->modifiedFilesExisting());
}
Expand Down

0 comments on commit 1d13f84

Please sign in to comment.