forked from qt-creator/qt-creator
ProjectExplorer: Use direct calls to signal update wishes
Change-Id: I73d4a417f23bcf7fd8c9e16640e920100a6cce5a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "projectmacroexpander.h"
|
||||
#include "projecttree.h"
|
||||
#include "target.h"
|
||||
#include "session.h"
|
||||
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
@@ -104,6 +105,13 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id)
|
||||
m_buildDirectoryAspect->setEnvironment(environment());
|
||||
this->target()->buildEnvironmentChanged(this);
|
||||
});
|
||||
|
||||
connect(this, &BuildConfiguration::enabledChanged, this, [this] {
|
||||
if (isActive() && project() == SessionManager::startupProject()) {
|
||||
ProjectExplorerPlugin::updateActions();
|
||||
emit ProjectExplorerPlugin::instance()->updateRunActions();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Utils::FilePath BuildConfiguration::buildDirectory() const
|
||||
|
||||
@@ -357,7 +357,6 @@ public:
|
||||
|
||||
void buildQueueFinished(bool success);
|
||||
|
||||
void buildStateChanged(ProjectExplorer::Project * pro);
|
||||
void loadAction();
|
||||
void handleUnloadProject();
|
||||
void unloadProjectContextMenu();
|
||||
@@ -1390,7 +1389,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
|
||||
auto buildManager = new BuildManager(this, dd->m_cancelBuildAction);
|
||||
connect(buildManager, &BuildManager::buildStateChanged,
|
||||
dd, &ProjectExplorerPluginPrivate::buildStateChanged);
|
||||
dd, &ProjectExplorerPluginPrivate::updateActions);
|
||||
connect(buildManager, &BuildManager::buildQueueFinished,
|
||||
dd, &ProjectExplorerPluginPrivate::buildQueueFinished, Qt::QueuedConnection);
|
||||
|
||||
@@ -2254,12 +2253,6 @@ void ProjectExplorerPluginPrivate::restoreSession()
|
||||
updateActions();
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::buildStateChanged(Project * pro)
|
||||
{
|
||||
Q_UNUSED(pro)
|
||||
updateActions();
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::executeRunConfiguration(RunConfiguration *runConfiguration, Core::Id runMode)
|
||||
{
|
||||
if (!runConfiguration->isConfigured()) {
|
||||
@@ -2895,21 +2888,8 @@ QList<QPair<Runnable, Utils::ProcessHandle>> ProjectExplorerPlugin::runningRunCo
|
||||
|
||||
void ProjectExplorerPluginPrivate::projectAdded(Project *pro)
|
||||
{
|
||||
Q_UNUSED(pro)
|
||||
m_projectsMode.setEnabled(true);
|
||||
|
||||
// more specific action en and disabling ?
|
||||
pro->subscribeSignal(&BuildConfiguration::enabledChanged, this, [this]() {
|
||||
auto bc = qobject_cast<BuildConfiguration *>(sender());
|
||||
if (bc && bc->isActive() && bc->project() == SessionManager::startupProject()) {
|
||||
updateActions();
|
||||
emit m_instance->updateRunActions();
|
||||
}
|
||||
});
|
||||
pro->subscribeSignal(&RunConfiguration::requestRunActionsUpdate, this, [this]() {
|
||||
auto rc = qobject_cast<RunConfiguration *>(sender());
|
||||
if (rc && rc->isActive() && rc->project() == SessionManager::startupProject())
|
||||
emit m_instance->updateRunActions();
|
||||
});
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::projectRemoved(Project *pro)
|
||||
@@ -3938,6 +3918,11 @@ QString ProjectExplorerPlugin::defaultBuildDirectoryTemplate()
|
||||
return QString(Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::updateActions()
|
||||
{
|
||||
dd->updateActions();
|
||||
}
|
||||
|
||||
QList<QPair<QString, QString> > ProjectExplorerPlugin::recentProjects()
|
||||
{
|
||||
return dd->recentProjects();
|
||||
|
||||
@@ -172,6 +172,8 @@ public:
|
||||
static QString buildDirectoryTemplate();
|
||||
static QString defaultBuildDirectoryTemplate();
|
||||
|
||||
static void updateActions();
|
||||
|
||||
signals:
|
||||
void finishedInitialization();
|
||||
|
||||
|
||||
@@ -25,17 +25,18 @@
|
||||
|
||||
#include "runconfiguration.h"
|
||||
|
||||
#include "project.h"
|
||||
#include "runcontrol.h"
|
||||
#include "target.h"
|
||||
#include "toolchain.h"
|
||||
#include "abi.h"
|
||||
#include "buildconfiguration.h"
|
||||
#include "environmentaspect.h"
|
||||
#include "kitinformation.h"
|
||||
#include "runconfigurationaspects.h"
|
||||
#include "session.h"
|
||||
#include "kitinformation.h"
|
||||
#include "project.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "runconfigurationaspects.h"
|
||||
#include "runcontrol.h"
|
||||
#include "session.h"
|
||||
#include "target.h"
|
||||
#include "toolchain.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
@@ -172,8 +173,10 @@ RunConfiguration::RunConfiguration(Target *target, Core::Id id)
|
||||
updateEnabledState();
|
||||
});
|
||||
|
||||
connect(this, &RunConfiguration::enabledChanged,
|
||||
this, &RunConfiguration::requestRunActionsUpdate);
|
||||
connect(this, &RunConfiguration::enabledChanged, this, [this] {
|
||||
if (isActive() && project() == SessionManager::startupProject())
|
||||
emit ProjectExplorerPlugin::instance()->updateRunActions();
|
||||
});
|
||||
|
||||
Utils::MacroExpander *expander = macroExpander();
|
||||
expander->setDisplayName(tr("Run Settings"));
|
||||
|
||||
@@ -185,7 +185,6 @@ public:
|
||||
}
|
||||
|
||||
signals:
|
||||
void requestRunActionsUpdate();
|
||||
void configurationFinished();
|
||||
void enabledChanged();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user