forked from qt-creator/qt-creator
ProjectExplorer: Disentangle ProjectExplorer::updateRunActions
This enforces a linear pass through [static] ProjectExplorerPlugin::updateRunActions ProjectExplorerPluginPrivate::doUpdateRunAction [emit] ProjectExplorerPluginPrivate::runActionsUpdated instead of the previous direct emission of the signal from user code and connecting also the internal update to it. This is meant to simplify reasoning about execution order and maybe to help elimimating double executation. Change-Id: Id8cc41a46d9dec06afb5514855f2ae80560f3695 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -236,7 +236,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
|
|||||||
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
||||||
connect(BuildManager::instance(), &BuildManager::buildQueueFinished,
|
connect(BuildManager::instance(), &BuildManager::buildQueueFinished,
|
||||||
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
||||||
connect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged,
|
connect(TestTreeModel::instance(), &TestTreeModel::testTreeModelChanged,
|
||||||
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
this, &AutotestPlugin::updateMenuItemsEnabledState);
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
if (auto debugAspect = aspect<Debugger::DebuggerRunConfigurationAspect>()) {
|
if (auto debugAspect = aspect<Debugger::DebuggerRunConfigurationAspect>()) {
|
||||||
debugAspect->setUseQmlDebugger(enableQuick);
|
debugAspect->setUseQmlDebugger(enableQuick);
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->updateRunActions();
|
ProjectExplorer::ProjectExplorerPlugin::updateRunActions();
|
||||||
}
|
}
|
||||||
m_testConfig = config;
|
m_testConfig = config;
|
||||||
}
|
}
|
||||||
|
@@ -602,7 +602,7 @@ ClangTool::ClangTool()
|
|||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
this, &ClangTool::update);
|
this, &ClangTool::update);
|
||||||
connect(CppModelManager::instance(), &CppModelManager::projectPartsUpdated,
|
connect(CppModelManager::instance(), &CppModelManager::projectPartsUpdated,
|
||||||
this, &ClangTool::update);
|
this, &ClangTool::update);
|
||||||
|
@@ -176,7 +176,7 @@ bool CppcheckPlugin::initialize(const QStringList &arguments, QString *errorStri
|
|||||||
}
|
}
|
||||||
|
|
||||||
using ProjectExplorer::ProjectExplorerPlugin;
|
using ProjectExplorer::ProjectExplorerPlugin;
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
d.get(), &CppcheckPluginPrivate::updateManualRunAction);
|
d.get(), &CppcheckPluginPrivate::updateManualRunAction);
|
||||||
d->updateManualRunAction();
|
d->updateManualRunAction();
|
||||||
|
|
||||||
|
@@ -1186,7 +1186,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
|
|||||||
this, &DebuggerPluginPrivate::writeSettings);
|
this, &DebuggerPluginPrivate::writeSettings);
|
||||||
|
|
||||||
// ProjectExplorer
|
// ProjectExplorer
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
this, &DebuggerPluginPrivate::updatePresetState);
|
this, &DebuggerPluginPrivate::updatePresetState);
|
||||||
|
|
||||||
// EditorManager
|
// EditorManager
|
||||||
|
@@ -159,7 +159,7 @@ PerfProfilerTool::PerfProfilerTool()
|
|||||||
tracePointsAction->setEnabled(m_startAction->isEnabled());
|
tracePointsAction->setEnabled(m_startAction->isEnabled());
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
this, &PerfProfilerTool::updateRunActions);
|
this, &PerfProfilerTool::updateRunActions);
|
||||||
|
|
||||||
m_recordButton = new QToolButton;
|
m_recordButton = new QToolButton;
|
||||||
|
@@ -779,7 +779,7 @@ void AppOutputPane::slotRunControlFinished2(RunControl *sender)
|
|||||||
if (current && current == sender)
|
if (current && current == sender)
|
||||||
enableButtons(current);
|
enableButtons(current);
|
||||||
|
|
||||||
emit ProjectExplorerPlugin::instance()->updateRunActions();
|
ProjectExplorerPlugin::updateRunActions();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const bool isRunning = Utils::anyOf(m_runControlTabs, [](const RunControlTab &rt) {
|
const bool isRunning = Utils::anyOf(m_runControlTabs, [](const RunControlTab &rt) {
|
||||||
|
@@ -141,7 +141,7 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id)
|
|||||||
connect(this, &BuildConfiguration::enabledChanged, this, [this] {
|
connect(this, &BuildConfiguration::enabledChanged, this, [this] {
|
||||||
if (isActive() && project() == SessionManager::startupProject()) {
|
if (isActive() && project() == SessionManager::startupProject()) {
|
||||||
ProjectExplorerPlugin::updateActions();
|
ProjectExplorerPlugin::updateActions();
|
||||||
emit ProjectExplorerPlugin::instance()->updateRunActions();
|
ProjectExplorerPlugin::updateRunActions();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -453,7 +453,7 @@ public:
|
|||||||
void activeRunConfigurationChanged();
|
void activeRunConfigurationChanged();
|
||||||
void activeBuildConfigurationChanged();
|
void activeBuildConfigurationChanged();
|
||||||
|
|
||||||
void slotUpdateRunActions();
|
void doUpdateRunActions();
|
||||||
|
|
||||||
void currentModeChanged(Core::Id mode, Core::Id oldMode);
|
void currentModeChanged(Core::Id mode, Core::Id oldMode);
|
||||||
|
|
||||||
@@ -1705,8 +1705,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
connect(dd->m_projectTreeExpandAllAction, &QAction::triggered,
|
connect(dd->m_projectTreeExpandAllAction, &QAction::triggered,
|
||||||
ProjectTree::instance(), &ProjectTree::expandAll);
|
ProjectTree::instance(), &ProjectTree::expandAll);
|
||||||
|
|
||||||
connect(this, &ProjectExplorerPlugin::updateRunActions,
|
|
||||||
dd, &ProjectExplorerPluginPrivate::slotUpdateRunActions);
|
|
||||||
connect(this, &ProjectExplorerPlugin::settingsChanged,
|
connect(this, &ProjectExplorerPlugin::settingsChanged,
|
||||||
dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu);
|
dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu);
|
||||||
|
|
||||||
@@ -2469,7 +2467,7 @@ void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl)
|
|||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
++m_activeRunControlCount;
|
++m_activeRunControlCount;
|
||||||
runControl->initiateStart();
|
runControl->initiateStart();
|
||||||
emit m_instance->updateRunActions();
|
doUpdateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::showOutputPaneForRunControl(RunControl *runControl)
|
void ProjectExplorerPluginPrivate::showOutputPaneForRunControl(RunControl *runControl)
|
||||||
@@ -2526,7 +2524,7 @@ void ProjectExplorerPluginPrivate::buildQueueFinished(bool success)
|
|||||||
m_delayedRunConfiguration = nullptr;
|
m_delayedRunConfiguration = nullptr;
|
||||||
m_shouldHaveRunConfiguration = false;
|
m_shouldHaveRunConfiguration = false;
|
||||||
m_runMode = Constants::NO_RUN_MODE;
|
m_runMode = Constants::NO_RUN_MODE;
|
||||||
emit m_instance->updateRunActions();
|
doUpdateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QPair<QString, QString> > ProjectExplorerPluginPrivate::recentProjects() const
|
QList<QPair<QString, QString> > ProjectExplorerPluginPrivate::recentProjects() const
|
||||||
@@ -2889,7 +2887,8 @@ void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
|
|||||||
dd->executeRunConfiguration(rc, runMode);
|
dd->executeRunConfiguration(rc, runMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
emit m_instance->updateRunActions();
|
|
||||||
|
dd->doUpdateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QPair<Runnable, Utils::ProcessHandle>> ProjectExplorerPlugin::runningRunControlProcesses()
|
QList<QPair<Runnable, Utils::ProcessHandle>> ProjectExplorerPlugin::runningRunControlProcesses()
|
||||||
@@ -2987,7 +2986,7 @@ void ProjectExplorerPluginPrivate::activeRunConfigurationChanged()
|
|||||||
if (rc == previousRunConfiguration)
|
if (rc == previousRunConfiguration)
|
||||||
return;
|
return;
|
||||||
updateActions();
|
updateActions();
|
||||||
emit m_instance->updateRunActions();
|
doUpdateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::activeBuildConfigurationChanged()
|
void ProjectExplorerPluginPrivate::activeBuildConfigurationChanged()
|
||||||
@@ -3001,7 +3000,7 @@ void ProjectExplorerPluginPrivate::activeBuildConfigurationChanged()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
updateActions();
|
updateActions();
|
||||||
emit m_instance->updateRunActions();
|
doUpdateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::updateDeployActions()
|
void ProjectExplorerPluginPrivate::updateDeployActions()
|
||||||
@@ -3050,7 +3049,7 @@ void ProjectExplorerPluginPrivate::updateDeployActions()
|
|||||||
enableDeploySessionAction = false;
|
enableDeploySessionAction = false;
|
||||||
m_deploySessionAction->setEnabled(enableDeploySessionAction);
|
m_deploySessionAction->setEnabled(enableDeploySessionAction);
|
||||||
|
|
||||||
emit m_instance->updateRunActions();
|
doUpdateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectExplorerPlugin::canRunStartupProject(Core::Id runMode, QString *whyNot)
|
bool ProjectExplorerPlugin::canRunStartupProject(Core::Id runMode, QString *whyNot)
|
||||||
@@ -3125,13 +3124,15 @@ bool ProjectExplorerPlugin::canRunStartupProject(Core::Id runMode, QString *whyN
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::slotUpdateRunActions()
|
void ProjectExplorerPluginPrivate::doUpdateRunActions()
|
||||||
{
|
{
|
||||||
QString whyNot;
|
QString whyNot;
|
||||||
const bool state = ProjectExplorerPlugin::canRunStartupProject(Constants::NORMAL_RUN_MODE, &whyNot);
|
const bool state = ProjectExplorerPlugin::canRunStartupProject(Constants::NORMAL_RUN_MODE, &whyNot);
|
||||||
m_runAction->setEnabled(state);
|
m_runAction->setEnabled(state);
|
||||||
m_runAction->setToolTip(whyNot);
|
m_runAction->setToolTip(whyNot);
|
||||||
m_runWithoutDeployAction->setEnabled(state);
|
m_runWithoutDeployAction->setEnabled(state);
|
||||||
|
|
||||||
|
emit m_instance->runActionsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::addToRecentProjects(const QString &fileName, const QString &displayName)
|
void ProjectExplorerPluginPrivate::addToRecentProjects(const QString &fileName, const QString &displayName)
|
||||||
@@ -3988,6 +3989,11 @@ void ProjectExplorerPlugin::removeFromRecentProjects(const QString &fileName,
|
|||||||
dd->removeFromRecentProjects(fileName, displayName);
|
dd->removeFromRecentProjects(fileName, displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectExplorerPlugin::updateRunActions()
|
||||||
|
{
|
||||||
|
dd->doUpdateRunActions();
|
||||||
|
}
|
||||||
|
|
||||||
QList<QPair<QString, QString> > ProjectExplorerPlugin::recentProjects()
|
QList<QPair<QString, QString> > ProjectExplorerPlugin::recentProjects()
|
||||||
{
|
{
|
||||||
return dd->recentProjects();
|
return dd->recentProjects();
|
||||||
|
@@ -180,6 +180,8 @@ public:
|
|||||||
static void clearRecentProjects();
|
static void clearRecentProjects();
|
||||||
static void removeFromRecentProjects(const QString &fileName, const QString &displayName);
|
static void removeFromRecentProjects(const QString &fileName, const QString &displayName);
|
||||||
|
|
||||||
|
static void updateRunActions();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finishedInitialization();
|
void finishedInitialization();
|
||||||
|
|
||||||
@@ -191,7 +193,7 @@ signals:
|
|||||||
|
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
|
||||||
void updateRunActions();
|
void runActionsUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool coreAboutToClose();
|
static bool coreAboutToClose();
|
||||||
|
@@ -303,7 +303,7 @@ void RunConfiguration::update()
|
|||||||
const bool isActive = target()->isActive() && target()->activeRunConfiguration() == this;
|
const bool isActive = target()->isActive() && target()->activeRunConfiguration() == this;
|
||||||
|
|
||||||
if (isActive && project() == SessionManager::startupProject())
|
if (isActive && project() == SessionManager::startupProject())
|
||||||
emit ProjectExplorerPlugin::instance()->updateRunActions();
|
ProjectExplorerPlugin::updateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildTargetInfo RunConfiguration::buildTargetInfo() const
|
BuildTargetInfo RunConfiguration::buildTargetInfo() const
|
||||||
|
@@ -243,7 +243,7 @@ QmlProfilerTool::QmlProfilerTool()
|
|||||||
perspective->addToolBarWidget(d->m_displayFeaturesButton);
|
perspective->addToolBarWidget(d->m_displayFeaturesButton);
|
||||||
perspective->addToolBarWidget(d->m_timeLabel);
|
perspective->addToolBarWidget(d->m_timeLabel);
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
this, &QmlProfilerTool::updateRunActions);
|
this, &QmlProfilerTool::updateRunActions);
|
||||||
|
|
||||||
QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel();
|
QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel();
|
||||||
|
@@ -530,7 +530,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
|
|||||||
m_perspective.addWindow(m_visualization, Perspective::SplitVertical, nullptr,
|
m_perspective.addWindow(m_visualization, Perspective::SplitVertical, nullptr,
|
||||||
false, Qt::RightDockWidgetArea);
|
false, Qt::RightDockWidgetArea);
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
this, &CallgrindToolPrivate::updateRunActions);
|
this, &CallgrindToolPrivate::updateRunActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -571,7 +571,7 @@ MemcheckToolPrivate::MemcheckToolPrivate()
|
|||||||
|
|
||||||
m_perspective.addWindow(m_errorView, Perspective::SplitVertical, nullptr);
|
m_perspective.addWindow(m_errorView, Perspective::SplitVertical, nullptr);
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::runActionsUpdated,
|
||||||
this, &MemcheckToolPrivate::maybeActiveRunConfigurationChanged);
|
this, &MemcheckToolPrivate::maybeActiveRunConfigurationChanged);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user