forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.0'
Conflicts: src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp Change-Id: I6ae2d37290643d69390f679a54f7596782f3d97f
This commit is contained in:
@@ -172,8 +172,8 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
if (!tool || !tool->isValid()) {
|
||||
emit addTask(Task(Task::Error,
|
||||
QCoreApplication::translate("CMakeProjectManager::CMakeBuildStep",
|
||||
"Qt Creator needs a cmake tool set up to build. "
|
||||
"Configure a cmake tool in the kit options."),
|
||||
"Qt Creator needs a CMake Tool set up to build. "
|
||||
"Configure a CMake Tool in the kit options."),
|
||||
Utils::FileName(), -1,
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
canInit = false;
|
||||
|
||||
@@ -344,13 +344,20 @@ void CMakeConfigurationKitConfigWidget::editConfigurationChanges()
|
||||
"separated from the variable value by \"=\".<br>"
|
||||
"You may provide a type hint by adding \":TYPE\" before the \"=\"."));
|
||||
|
||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply|QDialogButtonBox::Cancel);
|
||||
auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply
|
||||
|QDialogButtonBox::Reset|QDialogButtonBox::Cancel);
|
||||
|
||||
layout->addWidget(m_editor);
|
||||
layout->addWidget(buttons);
|
||||
|
||||
connect(buttons, &QDialogButtonBox::accepted, m_dialog, &QDialog::accept);
|
||||
connect(buttons, &QDialogButtonBox::rejected, m_dialog, &QDialog::reject);
|
||||
connect(buttons, &QDialogButtonBox::clicked, m_dialog, [buttons, this](QAbstractButton *button) {
|
||||
if (button != buttons->button(QDialogButtonBox::Reset))
|
||||
return;
|
||||
CMakeConfigurationKitInformation::setConfiguration(kit(),
|
||||
CMakeConfigurationKitInformation::defaultConfiguration(kit()));
|
||||
});
|
||||
connect(m_dialog, &QDialog::accepted, this, &CMakeConfigurationKitConfigWidget::acceptChangesDialog);
|
||||
connect(m_dialog, &QDialog::rejected, this, &CMakeConfigurationKitConfigWidget::closeChangesDialog);
|
||||
connect(buttons->button(QDialogButtonBox::Apply), &QAbstractButton::clicked,
|
||||
|
||||
@@ -323,15 +323,22 @@ void CMakeConfigurationKitInformation::fromStringList(Kit *k, const QStringList
|
||||
setConfiguration(k, result);
|
||||
}
|
||||
|
||||
CMakeConfig CMakeConfigurationKitInformation::defaultConfiguration(const Kit *k)
|
||||
{
|
||||
Q_UNUSED(k);
|
||||
CMakeConfig config;
|
||||
config << CMakeConfigItem(CMAKE_QMAKE_KEY, "%{Qt:qmakeExecutable}");
|
||||
config << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, "%{Compiler:Executable}");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
QVariant CMakeConfigurationKitInformation::defaultValue(const Kit *k) const
|
||||
{
|
||||
Q_UNUSED(k);
|
||||
|
||||
// FIXME: Convert preload scripts
|
||||
CMakeConfig config;
|
||||
config << CMakeConfigItem(CMAKE_QMAKE_KEY, "%{Qt:qmakeExecutable}");
|
||||
config << CMakeConfigItem(CMAKE_TOOLCHAIN_KEY, "%{Compiler:Executable}");
|
||||
|
||||
CMakeConfig config = defaultConfiguration(k);
|
||||
const QStringList tmp
|
||||
= Utils::transform(config, [](const CMakeConfigItem &i) { return i.toString(); });
|
||||
return tmp;
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
static QStringList toStringList(const ProjectExplorer::Kit *k);
|
||||
static void fromStringList(ProjectExplorer::Kit *k, const QStringList &in);
|
||||
|
||||
static CMakeConfig defaultConfiguration(const ProjectExplorer::Kit *k);
|
||||
|
||||
// KitInformation interface
|
||||
QVariant defaultValue(const ProjectExplorer::Kit *k) const override;
|
||||
QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *k) const override;
|
||||
|
||||
@@ -204,8 +204,11 @@ void CMakeProject::parseCMakeOutput()
|
||||
{
|
||||
auto cmakeBc = qobject_cast<CMakeBuildConfiguration *>(sender());
|
||||
QTC_ASSERT(cmakeBc, return);
|
||||
if (!activeTarget() || activeTarget()->activeBuildConfiguration() != cmakeBc)
|
||||
|
||||
Target *t = activeTarget();
|
||||
if (!t || t->activeBuildConfiguration() != cmakeBc)
|
||||
return;
|
||||
Kit *k = t->kit();
|
||||
|
||||
BuildDirManager *bdm = cmakeBc->buildDirManager();
|
||||
QTC_ASSERT(bdm, return);
|
||||
@@ -216,10 +219,11 @@ void CMakeProject::parseCMakeOutput()
|
||||
bdm->clearFiles(); // Some of the FileNodes in files() were deleted!
|
||||
|
||||
updateApplicationAndDeploymentTargets();
|
||||
updateTargetRunConfigurations(t);
|
||||
|
||||
createGeneratedCodeModelSupport();
|
||||
|
||||
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(cmakeBc->target()->kit());
|
||||
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||
if (!tc) {
|
||||
emit fileListChanged();
|
||||
return;
|
||||
@@ -230,7 +234,7 @@ void CMakeProject::parseCMakeOutput()
|
||||
CppTools::ProjectPartBuilder ppBuilder(pinfo);
|
||||
|
||||
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
|
||||
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(cmakeBc->target()->kit())) {
|
||||
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k)) {
|
||||
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
|
||||
activeQtVersion = CppTools::ProjectPart::Qt4;
|
||||
else
|
||||
@@ -264,8 +268,6 @@ void CMakeProject::parseCMakeOutput()
|
||||
emit fileListChanged();
|
||||
|
||||
emit cmakeBc->emitBuildTypeChanged();
|
||||
|
||||
updateRunConfigurations();
|
||||
}
|
||||
|
||||
bool CMakeProject::needsConfiguration() const
|
||||
@@ -278,6 +280,11 @@ bool CMakeProject::requiresTargetPanel() const
|
||||
return !targets().isEmpty();
|
||||
}
|
||||
|
||||
bool CMakeProject::knowsAllBuildExecutables() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMakeProject::supportsKit(Kit *k, QString *errorMessage) const
|
||||
{
|
||||
if (!CMakeKitInformation::cmakeTool(k)) {
|
||||
@@ -546,46 +553,33 @@ QStringList CMakeProject::filesGeneratedFrom(const QString &sourceFile) const
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeProject::updateRunConfigurations()
|
||||
{
|
||||
foreach (Target *t, targets())
|
||||
updateTargetRunConfigurations(t);
|
||||
}
|
||||
|
||||
// TODO Compare with updateDefaultRunConfigurations();
|
||||
void CMakeProject::updateTargetRunConfigurations(Target *t)
|
||||
{
|
||||
// create new and remove obsolete RCs using the factories
|
||||
t->updateDefaultRunConfigurations();
|
||||
// *Update* existing runconfigurations (no need to update new ones!):
|
||||
QHash<QString, const CMakeBuildTarget *> buildTargetHash;
|
||||
const QList<CMakeBuildTarget> buildTargetList = buildTargets();
|
||||
foreach (const CMakeBuildTarget &bt, buildTargetList) {
|
||||
if (bt.targetType != ExecutableType || bt.executable.isEmpty())
|
||||
continue;
|
||||
|
||||
// *Update* runconfigurations:
|
||||
QMultiMap<QString, CMakeRunConfiguration*> existingRunConfigurations;
|
||||
foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) {
|
||||
if (CMakeRunConfiguration* cmakeRC = qobject_cast<CMakeRunConfiguration *>(rc))
|
||||
existingRunConfigurations.insert(cmakeRC->title(), cmakeRC);
|
||||
buildTargetHash.insert(bt.title, &bt);
|
||||
}
|
||||
|
||||
foreach (const CMakeBuildTarget &ct, buildTargets()) {
|
||||
if (ct.targetType != ExecutableType)
|
||||
foreach (RunConfiguration *rc, t->runConfigurations()) {
|
||||
auto cmakeRc = qobject_cast<CMakeRunConfiguration *>(rc);
|
||||
if (!cmakeRc)
|
||||
continue;
|
||||
if (ct.executable.isEmpty())
|
||||
continue;
|
||||
QList<CMakeRunConfiguration *> list = existingRunConfigurations.values(ct.title);
|
||||
if (!list.isEmpty()) {
|
||||
// Already exists, so override the settings...
|
||||
foreach (CMakeRunConfiguration *rc, list) {
|
||||
rc->setExecutable(ct.executable);
|
||||
rc->setBaseWorkingDirectory(ct.workingDirectory);
|
||||
rc->setEnabled(true);
|
||||
}
|
||||
|
||||
auto btIt = buildTargetHash.constFind(cmakeRc->title());
|
||||
cmakeRc->setEnabled(btIt != buildTargetHash.constEnd());
|
||||
if (btIt != buildTargetHash.constEnd()) {
|
||||
cmakeRc->setExecutable(btIt.value()->executable);
|
||||
cmakeRc->setBaseWorkingDirectory(btIt.value()->workingDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
if (t->runConfigurations().isEmpty()) {
|
||||
// Oh no, no run configuration,
|
||||
// create a custom executable run configuration
|
||||
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
|
||||
}
|
||||
// create new and remove obsolete RCs using the factories
|
||||
t->updateDefaultRunConfigurations();
|
||||
}
|
||||
|
||||
void CMakeProject::updateApplicationAndDeploymentTargets()
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
|
||||
bool needsConfiguration() const override;
|
||||
bool requiresTargetPanel() const override;
|
||||
bool knowsAllBuildExecutables() const override;
|
||||
|
||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage = 0) const override;
|
||||
|
||||
@@ -124,8 +125,6 @@ private:
|
||||
void handleParsingStarted();
|
||||
void parseCMakeOutput();
|
||||
|
||||
void updateRunConfigurations();
|
||||
|
||||
void buildTree(Internal::CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
||||
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list) const;
|
||||
ProjectExplorer::FolderNode *findOrCreateFolder(Internal::CMakeProjectNode *rootNode, QString directory);
|
||||
|
||||
Reference in New Issue
Block a user