Commit 917b586a authored by Corey Wetterer-Nelson's avatar Corey Wetterer-Nelson
Browse files

add logic to disable/enable menu items

parent 585024ec
......@@ -125,13 +125,50 @@ bool pqACE3PMenu::startup()
#endif
// // Connect to project loader
// auto projectLoader = pqACE3PLoader::instance();
// QObject::connect(projectLoader, &pqACE3PLoader::projectOpened, this,
// &pqACE3PMenu::onProjectOpened);
QObject::connect(
closeProjectReaction, &pqACE3PCloseReaction::projectClosed,
this, &pqACE3PMenu::onProjectClosed
);
// For now, presume that there is no project loaded at startup
this->onProjectClosed();
auto projectLoader = pqACE3PLoader::instance();
QObject::connect(
projectLoader, &pqACE3PLoader::projectOpened,
this, &pqACE3PMenu::onProjectOpened
);
return true;
}
void pqACE3PMenu::shutdown()
{
}
//-----------------------------------------------------------------------------
void pqACE3PMenu::onProjectOpened(smtk::project::ProjectPtr project)
{
m_newProjectAction->setEnabled(false);
m_openProjectAction->setEnabled(false);
m_recentProjectsAction->setEnabled(false);
m_saveProjectAction->setEnabled(true);
// m_saveAsProjectAction->setEnabled(true);
m_closeProjectAction->setEnabled(true);
m_exportProjectAction->setEnabled(true);
// auto secondModel = project->findResource<smtk::model::Resource>("second");
// m_importModelAction->setEnabled(secondModel == nullptr);
}
//-----------------------------------------------------------------------------
void pqACE3PMenu::onProjectClosed()
{
m_newProjectAction->setEnabled(true);
m_openProjectAction->setEnabled(true);
m_recentProjectsAction->setEnabled(true);
m_saveProjectAction->setEnabled(false);
// m_saveAsProjectAction->setEnabled(false);
m_closeProjectAction->setEnabled(false);
m_exportProjectAction->setEnabled(false);
// m_importModelAction->setEnabled(false);
}
......@@ -26,6 +26,8 @@ class pqACE3PMenu : public QActionGroup
using Superclass = QActionGroup;
public slots:
void onProjectOpened(smtk::project::ProjectPtr project);
void onProjectClosed();
public:
pqACE3PMenu(QObject* parent = nullptr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment