forked from qt-creator/qt-creator
ProjectExplorer: Add an option for automatic generation of runconfigs
Default to 'on'. Task-number: QTCREATORBUG-18578 Change-Id: Ib430542b00d93138827fe8930db6a4e5a03c014c Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -49,6 +49,7 @@ public:
|
|||||||
bool useJom = true;
|
bool useJom = true;
|
||||||
bool autorestoreLastSession = false; // This option is set in the Session Manager!
|
bool autorestoreLastSession = false; // This option is set in the Session Manager!
|
||||||
bool prompToStopRunControl = false;
|
bool prompToStopRunControl = false;
|
||||||
|
bool automaticallyCreateRunConfigurations = true;
|
||||||
bool addLibraryPathsToRunEnv = true;
|
bool addLibraryPathsToRunEnv = true;
|
||||||
int maxAppOutputLines = Core::Constants::DEFAULT_MAX_LINE_COUNT;
|
int maxAppOutputLines = Core::Constants::DEFAULT_MAX_LINE_COUNT;
|
||||||
int maxBuildOutputLines = Core::Constants::DEFAULT_MAX_LINE_COUNT;
|
int maxBuildOutputLines = Core::Constants::DEFAULT_MAX_LINE_COUNT;
|
||||||
@@ -74,6 +75,7 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS
|
|||||||
&& p1.useJom == p2.useJom
|
&& p1.useJom == p2.useJom
|
||||||
&& p1.autorestoreLastSession == p2.autorestoreLastSession
|
&& p1.autorestoreLastSession == p2.autorestoreLastSession
|
||||||
&& p1.prompToStopRunControl == p2.prompToStopRunControl
|
&& p1.prompToStopRunControl == p2.prompToStopRunControl
|
||||||
|
&& p1.automaticallyCreateRunConfigurations == p2.automaticallyCreateRunConfigurations
|
||||||
&& p1.addLibraryPathsToRunEnv == p2.addLibraryPathsToRunEnv
|
&& p1.addLibraryPathsToRunEnv == p2.addLibraryPathsToRunEnv
|
||||||
&& p1.maxAppOutputLines == p2.maxAppOutputLines
|
&& p1.maxAppOutputLines == p2.maxAppOutputLines
|
||||||
&& p1.maxBuildOutputLines == p2.maxBuildOutputLines
|
&& p1.maxBuildOutputLines == p2.maxBuildOutputLines
|
||||||
|
@@ -108,7 +108,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const
|
|||||||
m_settings.wrapAppOutput = m_ui.wrapAppOutputCheckBox->isChecked();
|
m_settings.wrapAppOutput = m_ui.wrapAppOutputCheckBox->isChecked();
|
||||||
m_settings.useJom = m_ui.jomCheckbox->isChecked();
|
m_settings.useJom = m_ui.jomCheckbox->isChecked();
|
||||||
m_settings.addLibraryPathsToRunEnv = m_ui.addLibraryPathsToRunEnvCheckBox->isChecked();
|
m_settings.addLibraryPathsToRunEnv = m_ui.addLibraryPathsToRunEnvCheckBox->isChecked();
|
||||||
m_settings.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked();
|
m_settings.automaticallyCreateRunConfigurations = m_ui.automaticallyCreateRunConfiguration->isChecked();
|
||||||
m_settings.maxAppOutputLines = m_ui.maxAppOutputBox->value();
|
m_settings.maxAppOutputLines = m_ui.maxAppOutputBox->value();
|
||||||
m_settings.maxBuildOutputLines = m_ui.maxBuildOutputBox->value();
|
m_settings.maxBuildOutputLines = m_ui.maxBuildOutputBox->value();
|
||||||
m_settings.stopBeforeBuild = static_cast<ProjectExplorerSettings::StopBeforeBuild>(m_ui.stopBeforeBuildComboBox->currentIndex());
|
m_settings.stopBeforeBuild = static_cast<ProjectExplorerSettings::StopBeforeBuild>(m_ui.stopBeforeBuildComboBox->currentIndex());
|
||||||
@@ -130,6 +130,7 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &
|
|||||||
m_ui.jomCheckbox->setChecked(m_settings.useJom);
|
m_ui.jomCheckbox->setChecked(m_settings.useJom);
|
||||||
m_ui.addLibraryPathsToRunEnvCheckBox->setChecked(m_settings.addLibraryPathsToRunEnv);
|
m_ui.addLibraryPathsToRunEnvCheckBox->setChecked(m_settings.addLibraryPathsToRunEnv);
|
||||||
m_ui.promptToStopRunControlCheckBox->setChecked(m_settings.prompToStopRunControl);
|
m_ui.promptToStopRunControlCheckBox->setChecked(m_settings.prompToStopRunControl);
|
||||||
|
m_ui.automaticallyCreateRunConfiguration->setChecked(m_settings.automaticallyCreateRunConfigurations);
|
||||||
m_ui.maxAppOutputBox->setValue(m_settings.maxAppOutputLines);
|
m_ui.maxAppOutputBox->setValue(m_settings.maxAppOutputLines);
|
||||||
m_ui.maxBuildOutputBox->setValue(m_settings.maxBuildOutputLines);
|
m_ui.maxBuildOutputBox->setValue(m_settings.maxBuildOutputLines);
|
||||||
m_ui.stopBeforeBuildComboBox->setCurrentIndex(static_cast<int>(m_settings.stopBeforeBuild));
|
m_ui.stopBeforeBuildComboBox->setCurrentIndex(static_cast<int>(m_settings.stopBeforeBuild));
|
||||||
|
@@ -231,7 +231,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="7" column="0">
|
||||||
|
<widget class="QCheckBox" name="automaticallyCreateRunConfiguration">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Creates suitable run configurations automatically when setting up a new kit.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create suitable run configurations automatically</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelStopBeforeBuild">
|
<widget class="QLabel" name="labelStopBeforeBuild">
|
||||||
@@ -279,7 +289,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" colspan="2">
|
<item row="9" column="0" colspan="2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -312,7 +322,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0" colspan="2">
|
<item row="10" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>12</number>
|
<number>12</number>
|
||||||
|
@@ -25,25 +25,27 @@
|
|||||||
|
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
|
#include "buildconfiguration.h"
|
||||||
#include "buildinfo.h"
|
#include "buildinfo.h"
|
||||||
|
#include "buildmanager.h"
|
||||||
#include "buildtargetinfo.h"
|
#include "buildtargetinfo.h"
|
||||||
|
#include "deployconfiguration.h"
|
||||||
#include "deploymentdata.h"
|
#include "deploymentdata.h"
|
||||||
|
#include "devicesupport/devicemanager.h"
|
||||||
#include "kit.h"
|
#include "kit.h"
|
||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
#include "kitmanager.h"
|
#include "kitmanager.h"
|
||||||
#include "buildconfiguration.h"
|
|
||||||
#include "deployconfiguration.h"
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
#include "projectexplorer.h"
|
||||||
|
#include "projectexplorericons.h"
|
||||||
|
#include "projectexplorersettings.h"
|
||||||
#include "runconfiguration.h"
|
#include "runconfiguration.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <projectexplorer/buildmanager.h>
|
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
|
||||||
#include <projectexplorer/projectexplorericons.h>
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
@@ -52,6 +54,8 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const char ACTIVE_BC_KEY[] = "ProjectExplorer.Target.ActiveBuildConfiguration";
|
const char ACTIVE_BC_KEY[] = "ProjectExplorer.Target.ActiveBuildConfiguration";
|
||||||
const char BC_KEY_PREFIX[] = "ProjectExplorer.Target.BuildConfiguration.";
|
const char BC_KEY_PREFIX[] = "ProjectExplorer.Target.BuildConfiguration.";
|
||||||
@@ -574,41 +578,43 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
}
|
}
|
||||||
configuredCount -= toRemove.count();
|
configuredCount -= toRemove.count();
|
||||||
|
|
||||||
// Create new "automatic" RCs and put them into newConfigured/newUnconfigured
|
|
||||||
foreach (const RunConfigurationCreationInfo &item, creators) {
|
|
||||||
if (item.creationMode == RunConfigurationCreationInfo::ManualCreationOnly)
|
|
||||||
continue;
|
|
||||||
bool exists = false;
|
|
||||||
for (const RunConfigurationCreationInfo &ex : existing) {
|
|
||||||
if (ex.id == item.id && ex.buildKey == item.buildKey)
|
|
||||||
exists = true;
|
|
||||||
}
|
|
||||||
if (exists)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
RunConfiguration *rc = item.create(this);
|
|
||||||
if (!rc)
|
|
||||||
continue;
|
|
||||||
QTC_CHECK(rc->id() == item.id);
|
|
||||||
if (!rc->isConfigured())
|
|
||||||
newUnconfigured << rc;
|
|
||||||
else
|
|
||||||
newConfigured << rc;
|
|
||||||
}
|
|
||||||
configuredCount += newConfigured.count();
|
|
||||||
|
|
||||||
// Decide what to do with the different categories:
|
|
||||||
bool removeExistingUnconfigured = false;
|
bool removeExistingUnconfigured = false;
|
||||||
if (configuredCount > 0) {
|
if (ProjectExplorerPlugin::projectExplorerSettings().automaticallyCreateRunConfigurations) {
|
||||||
// new non-Custom Executable RCs were added
|
// Create new "automatic" RCs and put them into newConfigured/newUnconfigured
|
||||||
removeExistingUnconfigured = true;
|
foreach (const RunConfigurationCreationInfo &item, creators) {
|
||||||
qDeleteAll(newUnconfigured);
|
if (item.creationMode == RunConfigurationCreationInfo::ManualCreationOnly)
|
||||||
newUnconfigured.clear();
|
continue;
|
||||||
} else {
|
bool exists = false;
|
||||||
// no new RCs, use old or new CERCs?
|
for (const RunConfigurationCreationInfo &ex : existing) {
|
||||||
if (!existingUnconfigured.isEmpty()) {
|
if (ex.id == item.id && ex.buildKey == item.buildKey)
|
||||||
|
exists = true;
|
||||||
|
}
|
||||||
|
if (exists)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
RunConfiguration *rc = item.create(this);
|
||||||
|
if (!rc)
|
||||||
|
continue;
|
||||||
|
QTC_CHECK(rc->id() == item.id);
|
||||||
|
if (!rc->isConfigured())
|
||||||
|
newUnconfigured << rc;
|
||||||
|
else
|
||||||
|
newConfigured << rc;
|
||||||
|
}
|
||||||
|
configuredCount += newConfigured.count();
|
||||||
|
|
||||||
|
// Decide what to do with the different categories:
|
||||||
|
if (configuredCount > 0) {
|
||||||
|
// new non-Custom Executable RCs were added
|
||||||
|
removeExistingUnconfigured = true;
|
||||||
qDeleteAll(newUnconfigured);
|
qDeleteAll(newUnconfigured);
|
||||||
newUnconfigured.clear();
|
newUnconfigured.clear();
|
||||||
|
} else {
|
||||||
|
// no new RCs, use old or new CERCs?
|
||||||
|
if (!existingUnconfigured.isEmpty()) {
|
||||||
|
qDeleteAll(newUnconfigured);
|
||||||
|
newUnconfigured.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user