forked from qt-creator/qt-creator
Merge branch 'master' of scm.dev.nokia.troll.no:creator/mainline
Conflicts: src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
This commit is contained in:
165
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
Normal file
165
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeproject.h"
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace Internal;
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro)
|
||||
: BuildConfiguration(pro), m_toolChain(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(BuildConfiguration *source)
|
||||
: BuildConfiguration(source), m_toolChain(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
||||
{
|
||||
delete m_toolChain;
|
||||
}
|
||||
|
||||
CMakeProject *CMakeBuildConfiguration::cmakeProject() const
|
||||
{
|
||||
return static_cast<CMakeProject *>(project());
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeBuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
ProjectExplorer::Environment env = useSystemEnvironment() ?
|
||||
ProjectExplorer::Environment(QProcess::systemEnvironment()) :
|
||||
ProjectExplorer::Environment();
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeBuildConfiguration::environment() const
|
||||
{
|
||||
ProjectExplorer::Environment env = baseEnvironment();
|
||||
env.modify(userEnvironmentChanges());
|
||||
return env;
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setUseSystemEnvironment(bool b)
|
||||
{
|
||||
if (b == useSystemEnvironment())
|
||||
return;
|
||||
setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
bool CMakeBuildConfiguration::useSystemEnvironment() const
|
||||
{
|
||||
bool b = !(value("clearSystemEnvironment").isValid() &&
|
||||
value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> CMakeBuildConfiguration::userEnvironmentChanges() const
|
||||
{
|
||||
return ProjectExplorer::EnvironmentItem::fromStringList(value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = ProjectExplorer::EnvironmentItem::toStringList(diff);
|
||||
if (list == value("userEnvironmentChanges"))
|
||||
return;
|
||||
setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString buildDirectory = value("buildDirectory").toString();
|
||||
if (buildDirectory.isEmpty())
|
||||
buildDirectory = cmakeProject()->sourceDirectory() + "/qtcreator-build";
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::buildParser() const
|
||||
{
|
||||
// TODO this is actually slightly wrong, but do i care?
|
||||
// this should call toolchain(configuration)
|
||||
if (!m_toolChain)
|
||||
return QString::null;
|
||||
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
||||
//|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_GCC;
|
||||
} else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_MSVC;
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeBuildConfiguration::toolChainType() const
|
||||
{
|
||||
if (m_toolChain)
|
||||
return m_toolChain->type();
|
||||
return ProjectExplorer::ToolChain::UNKNOWN;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *CMakeBuildConfiguration::toolChain() const
|
||||
{
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::updateToolChain(const QString &compiler)
|
||||
{
|
||||
//qDebug()<<"CodeBlocks Compilername"<<compiler
|
||||
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||
if (compiler == "gcc") {
|
||||
#ifdef Q_OS_WIN
|
||||
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
||||
#else
|
||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||
#endif
|
||||
} else if (compiler == "msvc8") {
|
||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(value("msvcVersion").toString(), false);
|
||||
} else {
|
||||
}
|
||||
|
||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||
delete newToolChain;
|
||||
newToolChain = 0;
|
||||
} else {
|
||||
delete m_toolChain;
|
||||
m_toolChain = newToolChain;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
73
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
Normal file
73
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef CMAKEBUILDCONFIGURATION_H
|
||||
#define CMAKEBUILDCONFIGURATION_H
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeProject;
|
||||
|
||||
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeBuildConfiguration(CMakeProject *pro);
|
||||
CMakeBuildConfiguration(BuildConfiguration *source);
|
||||
~CMakeBuildConfiguration();
|
||||
|
||||
CMakeProject *cmakeProject() const;
|
||||
|
||||
ProjectExplorer::Environment environment() const;
|
||||
ProjectExplorer::Environment baseEnvironment() const;
|
||||
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const;
|
||||
bool useSystemEnvironment() const;
|
||||
void setUseSystemEnvironment(bool b);
|
||||
|
||||
virtual QString buildDirectory() const;
|
||||
QString buildParser() const;
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
|
||||
void updateToolChain(const QString &compiler);
|
||||
private:
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
#endif // CMAKEBUILDCONFIGURATION_H
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "cmakebuildenvironmentwidget.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include <projectexplorer/environmenteditmodel.h>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QCheckBox>
|
||||
@@ -41,7 +42,7 @@ using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project)
|
||||
: BuildConfigWidget(), m_pro(project)
|
||||
: BuildConfigWidget(), m_pro(project), m_buildConfiguration(0)
|
||||
{
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
@@ -63,29 +64,26 @@ QString CMakeBuildEnvironmentWidget::displayName() const
|
||||
return tr("Build Environment");
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::init(const QString &buildConfigurationName)
|
||||
void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << "Qt4BuildConfigWidget::init()";
|
||||
|
||||
m_buildConfiguration = buildConfigurationName;
|
||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfigurationName);
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(bc));
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
||||
m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(bc));
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
|
||||
m_buildEnvironmentWidget->updateButtons();
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
||||
{
|
||||
m_pro->setUserEnvironmentChanges(
|
||||
m_pro->buildConfiguration(m_buildConfiguration), m_buildEnvironmentWidget->userChanges());
|
||||
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
m_pro->setUseSystemEnvironment(bc, !checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
||||
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ class EnvironmentWidget;
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
class CMakeProject;
|
||||
class CMakeBuildConfiguration;
|
||||
|
||||
class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
||||
{
|
||||
@@ -51,7 +52,7 @@ public:
|
||||
CMakeBuildEnvironmentWidget(CMakeProject *project);
|
||||
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void environmentModelUserChangesUpdated();
|
||||
@@ -61,7 +62,7 @@ private:
|
||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
||||
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
||||
CMakeProject *m_pro;
|
||||
QString m_buildConfiguration;
|
||||
CMakeBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "makestep.h"
|
||||
#include "cmakeopenprojectwizard.h"
|
||||
#include "cmakebuildenvironmentwidget.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
@@ -89,7 +90,7 @@ QString CMakeBuildConfigurationFactory::displayNameForType(const QString & /* ty
|
||||
return tr("Create");
|
||||
}
|
||||
|
||||
bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
{
|
||||
QTC_ASSERT(type == "Create", return false);
|
||||
|
||||
@@ -103,19 +104,20 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
&ok);
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return false;
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
BuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
|
||||
MakeStep *makeStep = new MakeStep(m_project, bc);
|
||||
MakeStep *makeStep = new MakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(m_project, bc);
|
||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||
m_project->sourceDirectory(),
|
||||
m_project->buildDirectory(bc),
|
||||
m_project->environment(bc));
|
||||
bc->buildDirectory(),
|
||||
bc->environment());
|
||||
if (copw.exec() != QDialog::Accepted) {
|
||||
delete bc;
|
||||
return false;
|
||||
@@ -129,7 +131,20 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
// Default to all
|
||||
if (m_project->targets().contains("all"))
|
||||
makeStep->setBuildTarget("all", true);
|
||||
return true;
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::BuildConfiguration *source) const
|
||||
{
|
||||
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(old);
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *CMakeBuildConfigurationFactory::restore() const
|
||||
{
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
||||
return bc;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -140,7 +155,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
m_fileName(fileName),
|
||||
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
|
||||
m_rootNode(new CMakeProjectNode(m_fileName)),
|
||||
m_toolChain(0),
|
||||
m_insideFileChanged(false)
|
||||
{
|
||||
m_file = new CMakeFile(this, fileName);
|
||||
@@ -149,7 +163,11 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
CMakeProject::~CMakeProject()
|
||||
{
|
||||
delete m_rootNode;
|
||||
delete m_toolChain;
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *CMakeProject::activeCMakeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<CMakeBuildConfiguration *>(activeBuildConfiguration());
|
||||
}
|
||||
|
||||
IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const
|
||||
@@ -163,7 +181,7 @@ void CMakeProject::slotActiveBuildConfiguration()
|
||||
// Pop up a dialog asking the user to rerun cmake
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||
if (!cbpFileFi.exists()) {
|
||||
@@ -180,9 +198,9 @@ void CMakeProject::slotActiveBuildConfiguration()
|
||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||
CMakeOpenProjectWizard copw(m_manager,
|
||||
sourceFileInfo.absolutePath(),
|
||||
buildDirectory(activeBC),
|
||||
activeBC->buildDirectory(),
|
||||
mode,
|
||||
environment(activeBC));
|
||||
activeBC->environment());
|
||||
copw.exec();
|
||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||
}
|
||||
@@ -200,39 +218,6 @@ void CMakeProject::fileChanged(const QString &fileName)
|
||||
m_insideFileChanged = false;
|
||||
}
|
||||
|
||||
void CMakeProject::updateToolChain(const QString &compiler)
|
||||
{
|
||||
//qDebug()<<"CodeBlocks Compilername"<<compiler
|
||||
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||
if (compiler == "gcc") {
|
||||
#ifdef Q_OS_WIN
|
||||
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
||||
#else
|
||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||
#endif
|
||||
} else if (compiler == "msvc8") {
|
||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(activeBuildConfiguration()->value("msvcVersion").toString(), false);
|
||||
} else {
|
||||
// TODO other toolchains
|
||||
qDebug()<<"Not implemented yet!!! Qt Creator doesn't know which toolchain to use for"<<compiler;
|
||||
}
|
||||
|
||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||
delete newToolChain;
|
||||
newToolChain = 0;
|
||||
} else {
|
||||
delete m_toolChain;
|
||||
m_toolChain = newToolChain;
|
||||
}
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *CMakeProject::toolChain(BuildConfiguration *configuration) const
|
||||
{
|
||||
if (configuration != activeBuildConfiguration())
|
||||
qWarning()<<"CMakeProject asked for toolchain of a not active buildconfiguration";
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
void CMakeProject::changeBuildDirectory(BuildConfiguration *configuration, const QString &newBuildDirectory)
|
||||
{
|
||||
configuration->setValue("buildDirectory", newBuildDirectory);
|
||||
@@ -247,7 +232,8 @@ QString CMakeProject::sourceDirectory() const
|
||||
bool CMakeProject::parseCMakeLists()
|
||||
{
|
||||
// Find cbp file
|
||||
QString cbpFile = CMakeManager::findCbpFile(buildDirectory(activeBuildConfiguration()));
|
||||
CMakeBuildConfiguration *activeBC = activeCMakeBuildConfiguration();
|
||||
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
|
||||
|
||||
// setFolderName
|
||||
m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName());
|
||||
@@ -256,7 +242,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
//qDebug()<<"Parsing file "<<cbpFile;
|
||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||
// ToolChain
|
||||
updateToolChain(cbpparser.compilerName());
|
||||
activeBC->updateToolChain(cbpparser.compilerName());
|
||||
|
||||
m_projectName = cbpparser.projectName();
|
||||
m_rootNode->setFolderName(cbpparser.projectName());
|
||||
@@ -309,7 +295,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
QStringList allIncludePaths;
|
||||
QStringList allFrameworkPaths;
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths();
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
|
||||
foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
@@ -325,12 +311,12 @@ bool CMakeProject::parseCMakeLists()
|
||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||
if (pinfo.includePaths != allIncludePaths
|
||||
|| pinfo.sourceFiles != m_files
|
||||
|| pinfo.defines != m_toolChain->predefinedMacros()
|
||||
|| pinfo.defines != activeBC->toolChain()->predefinedMacros()
|
||||
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
||||
pinfo.includePaths = allIncludePaths;
|
||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||
pinfo.sourceFiles = m_files;
|
||||
pinfo.defines = m_toolChain->predefinedMacros(); // TODO this is to simplistic
|
||||
pinfo.defines = activeBC->toolChain()->predefinedMacros(); // TODO this is to simplistic
|
||||
pinfo.frameworkPaths = allFrameworkPaths;
|
||||
modelmanager->updateProjectInfo(pinfo);
|
||||
modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
||||
@@ -388,31 +374,12 @@ bool CMakeProject::parseCMakeLists()
|
||||
} else {
|
||||
// TODO report error
|
||||
qDebug()<<"Parsing failed";
|
||||
delete m_toolChain;
|
||||
m_toolChain = 0;
|
||||
activeBC->updateToolChain(QString::null);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CMakeProject::buildParser(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
// TODO this is actually slightly wrong, but do i care?
|
||||
// this should call toolchain(configuration)
|
||||
if (!m_toolChain)
|
||||
return QString::null;
|
||||
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
||||
//|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_GCC;
|
||||
} else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_MSVC;
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
QStringList CMakeProject::targets() const
|
||||
{
|
||||
QStringList results;
|
||||
@@ -535,8 +502,6 @@ QString CMakeProject::name() const
|
||||
return m_projectName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Core::IFile *CMakeProject::file() const
|
||||
{
|
||||
return m_file;
|
||||
@@ -557,56 +522,6 @@ bool CMakeProject::isApplication() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeProject::baseEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = useSystemEnvironment(configuration) ? Environment(QProcess::systemEnvironment()) : Environment();
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeProject::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = baseEnvironment(configuration);
|
||||
env.modify(userEnvironmentChanges(configuration));
|
||||
return env;
|
||||
}
|
||||
|
||||
void CMakeProject::setUseSystemEnvironment(BuildConfiguration *configuration, bool b)
|
||||
{
|
||||
if (b == useSystemEnvironment(configuration))
|
||||
return;
|
||||
configuration->setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged(configuration->name());
|
||||
}
|
||||
|
||||
bool CMakeProject::useSystemEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
bool b = !(configuration->value("clearSystemEnvironment").isValid() &&
|
||||
configuration->value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> CMakeProject::userEnvironmentChanges(BuildConfiguration *configuration) const
|
||||
{
|
||||
return EnvironmentItem::fromStringList(configuration->value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void CMakeProject::setUserEnvironmentChanges(BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = EnvironmentItem::toStringList(diff);
|
||||
if (list == configuration->value("userEnvironmentChanges"))
|
||||
return;
|
||||
configuration->setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged(configuration->name());
|
||||
}
|
||||
|
||||
QString CMakeProject::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
QString buildDirectory = configuration->value("buildDirectory").toString();
|
||||
if (buildDirectory.isEmpty())
|
||||
buildDirectory = sourceDirectory() + "/qtcreator-build";
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
|
||||
{
|
||||
return new CMakeBuildSettingsWidget(this);
|
||||
@@ -649,18 +564,19 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration("all");
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(this);
|
||||
bc->setDisplayName("all");
|
||||
addBuildConfiguration(bc);
|
||||
bc->setValue("msvcVersion", copw.msvcVersion());
|
||||
if (!copw.buildDirectory().isEmpty())
|
||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
||||
|
||||
// Now create a standard build configuration
|
||||
makeStep = new MakeStep(this, bc);
|
||||
makeStep = new MakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
//TODO save arguments somewhere copw.arguments()
|
||||
MakeStep *cleanMakeStep = new MakeStep(this, bc);
|
||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
setActiveBuildConfiguration(bc);
|
||||
@@ -668,10 +584,8 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
// We have a user file, but we could still be missing the cbp file
|
||||
// or simply run createXml with the saved settings
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
QStringList needToCreate;
|
||||
QStringList needToUpdate;
|
||||
BuildConfiguration *activeBC = activeBuildConfiguration();
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
|
||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||
@@ -683,9 +597,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||
CMakeOpenProjectWizard copw(m_manager,
|
||||
sourceFileInfo.absolutePath(),
|
||||
buildDirectory(activeBC),
|
||||
activeBC->buildDirectory(),
|
||||
mode,
|
||||
environment(activeBC));
|
||||
activeBC->environment());
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||
@@ -714,13 +628,6 @@ CMakeTarget CMakeProject::targetForTitle(const QString &title)
|
||||
return CMakeTarget();
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeProject::toolChainType() const
|
||||
{
|
||||
if (m_toolChain)
|
||||
return m_toolChain->type();
|
||||
return ProjectExplorer::ToolChain::UNKNOWN;
|
||||
}
|
||||
|
||||
// CMakeFile
|
||||
|
||||
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
||||
@@ -779,7 +686,7 @@ void CMakeFile::modified(ReloadBehavior *behavior)
|
||||
}
|
||||
|
||||
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
|
||||
: m_project(project)
|
||||
: m_project(project), m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setContentsMargins(20, -1, 0, -1);
|
||||
@@ -808,12 +715,11 @@ QString CMakeBuildSettingsWidget::displayName() const
|
||||
return "CMake";
|
||||
}
|
||||
|
||||
void CMakeBuildSettingsWidget::init(const QString &buildConfigurationName)
|
||||
void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = buildConfigurationName;
|
||||
BuildConfiguration *bc = m_project->buildConfiguration(buildConfigurationName);
|
||||
m_pathLineEdit->setText(m_project->buildDirectory(bc));
|
||||
if (m_project->buildDirectory(bc) == m_project->sourceDirectory())
|
||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||
if (m_buildConfiguration->buildDirectory() == m_project->sourceDirectory())
|
||||
m_changeButton->setEnabled(false);
|
||||
else
|
||||
m_changeButton->setEnabled(true);
|
||||
@@ -821,14 +727,13 @@ void CMakeBuildSettingsWidget::init(const QString &buildConfigurationName)
|
||||
|
||||
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
||||
{
|
||||
BuildConfiguration *bc = m_project->buildConfiguration(m_buildConfiguration);
|
||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||
m_project->sourceDirectory(),
|
||||
m_project->buildDirectory(bc),
|
||||
m_project->environment(bc));
|
||||
m_buildConfiguration->buildDirectory(),
|
||||
m_buildConfiguration->environment());
|
||||
if (copw.exec() == QDialog::Accepted) {
|
||||
m_project->changeBuildDirectory(bc, copw.buildDirectory());
|
||||
m_pathLineEdit->setText(m_project->buildDirectory(bc));
|
||||
m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
|
||||
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "makestep.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -73,7 +74,9 @@ public:
|
||||
QStringList availableCreationTypes() const;
|
||||
QString displayNameForType(const QString &type) const;
|
||||
|
||||
bool create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||
ProjectExplorer::BuildConfiguration *restore() const;
|
||||
|
||||
private:
|
||||
CMakeProject *m_project;
|
||||
@@ -88,6 +91,8 @@ public:
|
||||
CMakeProject(CMakeManager *manager, const QString &filename);
|
||||
~CMakeProject();
|
||||
|
||||
CMakeBuildConfiguration *activeCMakeBuildConfiguration() const;
|
||||
|
||||
virtual QString name() const;
|
||||
virtual Core::IFile *file() const;
|
||||
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
@@ -97,16 +102,6 @@ public:
|
||||
|
||||
virtual bool isApplication() const;
|
||||
|
||||
//building environment
|
||||
ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
ProjectExplorer::Environment baseEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUserEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
bool useSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUseSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration, bool b);
|
||||
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -114,12 +109,10 @@ public:
|
||||
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
QStringList targets() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
CMakeTarget targetForTitle(const QString &title);
|
||||
|
||||
QString sourceDirectory() const;
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
protected:
|
||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||
@@ -134,7 +127,6 @@ private slots:
|
||||
|
||||
private:
|
||||
bool parseCMakeLists();
|
||||
void updateToolChain(const QString &compiler);
|
||||
|
||||
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
||||
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
|
||||
@@ -150,7 +142,6 @@ private:
|
||||
CMakeProjectNode *m_rootNode;
|
||||
QStringList m_files;
|
||||
QList<CMakeTarget> m_targets;
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
ProjectExplorer::FileWatcher *m_watcher;
|
||||
bool m_insideFileChanged;
|
||||
QSet<QString> m_watchedFiles;
|
||||
@@ -230,14 +221,14 @@ public:
|
||||
|
||||
// This is called to set up the config widget before showing it
|
||||
// buildConfiguration is QString::null for the non buildConfiguration specific page
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
private slots:
|
||||
void openChangeBuildDirectoryDialog();
|
||||
private:
|
||||
CMakeProject *m_project;
|
||||
QLineEdit *m_pathLineEdit;
|
||||
QPushButton *m_changeButton;
|
||||
QString m_buildConfiguration;
|
||||
CMakeBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -10,7 +10,8 @@ HEADERS = cmakeproject.h \
|
||||
makestep.h \
|
||||
cmakerunconfiguration.h \
|
||||
cmakeopenprojectwizard.h \
|
||||
cmakebuildenvironmentwidget.h
|
||||
cmakebuildenvironmentwidget.h \
|
||||
cmakebuildconfiguration.h
|
||||
SOURCES = cmakeproject.cpp \
|
||||
cmakeprojectplugin.cpp \
|
||||
cmakeprojectmanager.cpp \
|
||||
@@ -18,7 +19,8 @@ SOURCES = cmakeproject.cpp \
|
||||
makestep.cpp \
|
||||
cmakerunconfiguration.cpp \
|
||||
cmakeopenprojectwizard.cpp \
|
||||
cmakebuildenvironmentwidget.cpp
|
||||
cmakebuildenvironmentwidget.cpp \
|
||||
cmakebuildconfiguration.cpp
|
||||
RESOURCES += cmakeproject.qrc
|
||||
FORMS +=
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "cmakerunconfiguration.h"
|
||||
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/environment.h>
|
||||
@@ -58,12 +59,19 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
connect(pro, SIGNAL(environmentChanged(QString)),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
// TODO
|
||||
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||
// this, SIGNAL(baseEnvironmentChanged()));
|
||||
}
|
||||
|
||||
CMakeRunConfiguration::~CMakeRunConfiguration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeProject *CMakeRunConfiguration::cmakeProject() const
|
||||
{
|
||||
return static_cast<CMakeProject *>(project());
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::type() const
|
||||
@@ -186,7 +194,7 @@ ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
|
||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) {
|
||||
env = ProjectExplorer::Environment::systemEnvironment();
|
||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) {
|
||||
env = project()->environment(project()->activeBuildConfiguration());
|
||||
env = project()->activeBuildConfiguration()->environment();
|
||||
}
|
||||
return env;
|
||||
}
|
||||
@@ -226,8 +234,8 @@ void CMakeRunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplore
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeRunConfiguration::toolChainType() const
|
||||
{
|
||||
CMakeProject *pro = static_cast<CMakeProject *>(project());
|
||||
return pro->toolChainType();
|
||||
CMakeBuildConfiguration *bc = cmakeProject()->activeCMakeBuildConfiguration();
|
||||
return bc->toolChainType();
|
||||
}
|
||||
|
||||
// Configuration widget
|
||||
|
||||
@@ -53,6 +53,8 @@ class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfigu
|
||||
public:
|
||||
CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory, const QString &title);
|
||||
virtual ~CMakeRunConfiguration();
|
||||
CMakeProject *cmakeProject() const;
|
||||
|
||||
virtual QString type() const;
|
||||
virtual QString executable() const;
|
||||
virtual RunMode runMode() const;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "makestep.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
@@ -42,15 +43,14 @@ using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
MakeStep::MakeStep(CMakeProject *pro, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(pro, bc), m_pro(pro), m_clean(false), m_futureInterface(0)
|
||||
MakeStep::MakeStep(BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc), m_clean(false), m_futureInterface(0)
|
||||
{
|
||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||
}
|
||||
|
||||
MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_pro(bs->m_pro),
|
||||
m_clean(bs->m_clean),
|
||||
m_futureInterface(0),
|
||||
m_buildTargets(bs->m_buildTargets),
|
||||
@@ -64,6 +64,11 @@ MakeStep::~MakeStep()
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *MakeStep::cmakeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<CMakeBuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
void MakeStep::setClean(bool clean)
|
||||
{
|
||||
m_clean = clean;
|
||||
@@ -96,18 +101,18 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
|
||||
bool MakeStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
setBuildParser(m_pro->buildParser(bc));
|
||||
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
||||
setBuildParser(bc->buildParser());
|
||||
|
||||
setEnabled(true);
|
||||
setWorkingDirectory(m_pro->buildDirectory(bc));
|
||||
setWorkingDirectory(bc->buildDirectory());
|
||||
|
||||
setCommand(m_pro->toolChain(bc)->makeCommand());
|
||||
setCommand(bc->toolChain()->makeCommand());
|
||||
|
||||
QStringList arguments = m_buildTargets;
|
||||
arguments << additionalArguments();
|
||||
setArguments(arguments);
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
setEnvironment(bc->environment());
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
return AbstractMakeStep::init();
|
||||
@@ -154,11 +159,6 @@ void MakeStep::stdOut(const QString &line)
|
||||
AbstractMakeStep::stdOut(line);
|
||||
}
|
||||
|
||||
CMakeProject *MakeStep::project() const
|
||||
{
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool MakeStep::buildsTarget(const QString &target) const
|
||||
{
|
||||
return m_buildTargets.contains(target);
|
||||
@@ -206,7 +206,8 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
fl->addRow(tr("Targets:"), m_targetsList);
|
||||
|
||||
// TODO update this list also on rescans of the CMakeLists.txt
|
||||
CMakeProject *pro = m_makeStep->project();
|
||||
// TODO shouldn't be accessing project
|
||||
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeProject();
|
||||
foreach(const QString& target, pro->targets()) {
|
||||
QListWidgetItem *item = new QListWidgetItem(target, m_targetsList);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
@@ -255,11 +256,13 @@ void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
QStringList arguments = m_makeStep->m_buildTargets;
|
||||
arguments << m_makeStep->additionalArguments();
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2")
|
||||
.arg(m_makeStep->project()->toolChain(
|
||||
m_makeStep->buildConfiguration())
|
||||
->makeCommand(),
|
||||
arguments.join(" "));
|
||||
|
||||
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
|
||||
ProjectExplorer::ToolChain *tc = bc->toolChain();
|
||||
if (tc)
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments.join(" "));
|
||||
else
|
||||
m_summaryText = tr("<b>Unknown Toolchain</b>");
|
||||
emit updateSummary();
|
||||
}
|
||||
|
||||
@@ -277,12 +280,10 @@ bool MakeStepFactory::canCreate(const QString &name) const
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
BuildStep *MakeStepFactory::create(Project *project, BuildConfiguration *bc, const QString &name) const
|
||||
BuildStep *MakeStepFactory::create(BuildConfiguration *bc, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new MakeStep(pro, bc);
|
||||
return new MakeStep(bc);
|
||||
}
|
||||
|
||||
BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
@@ -290,7 +291,7 @@ BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList MakeStepFactory::canCreateForProject(Project * /* pro */) const
|
||||
QStringList MakeStepFactory::canCreateForBuildConfiguration(BuildConfiguration * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeProject;
|
||||
class CMakeBuildConfiguration;
|
||||
|
||||
class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
@@ -49,9 +49,12 @@ class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
friend class MakeStepConfigWidget; // TODO remove
|
||||
// This is for modifying internal data
|
||||
public:
|
||||
MakeStep(CMakeProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~MakeStep();
|
||||
|
||||
CMakeBuildConfiguration *cmakeBuildConfiguration() const;
|
||||
|
||||
virtual bool init();
|
||||
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
@@ -60,7 +63,6 @@ public:
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
CMakeProject *project() const;
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList additionalArguments() const;
|
||||
@@ -77,7 +79,6 @@ protected:
|
||||
// For parsing [ 76%]
|
||||
virtual void stdOut(const QString &line);
|
||||
private:
|
||||
CMakeProject *m_pro;
|
||||
bool m_clean;
|
||||
QRegExp m_percentProgress;
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
@@ -107,9 +108,9 @@ private:
|
||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -168,6 +168,7 @@ RESOURCES += core.qrc \
|
||||
|
||||
win32 {
|
||||
SOURCES += progressmanager/progressmanager_win.cpp
|
||||
LIBS += -lole32
|
||||
}
|
||||
else:macx {
|
||||
OBJECTIVE_SOURCES += progressmanager/progressmanager_mac.mm
|
||||
|
||||
@@ -50,10 +50,7 @@ ProgressManagerPrivate::ProgressManagerPrivate(QObject *parent)
|
||||
|
||||
ProgressManagerPrivate::~ProgressManagerPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
void ProgressManagerPrivate::init()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void ProgressManagerPrivate::cancelTasks(const QString &type)
|
||||
|
||||
@@ -29,6 +29,14 @@
|
||||
|
||||
#include "progressmanager_p.h"
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#import <AppKit/NSDockTile.h>
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
ProgressManagerPrivate(QObject *parent = 0);
|
||||
~ProgressManagerPrivate();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
FutureProgress *addTask(const QFuture<void> &future, const QString &title, const QString &type,
|
||||
ProgressFlags flags);
|
||||
|
||||
@@ -27,8 +27,93 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include "progressmanager_p.h"
|
||||
|
||||
// for windows progress bar
|
||||
#ifndef __GNUC__
|
||||
# include <shobjidl.h>
|
||||
#endif
|
||||
|
||||
// Windows 7 SDK required
|
||||
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
|
||||
|
||||
namespace {
|
||||
int total = 0;
|
||||
ITaskbarList3* pITask = 0;
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
HRESULT hRes = CoCreateInstance(CLSID_TaskbarList,
|
||||
NULL,CLSCTX_INPROC_SERVER,
|
||||
IID_ITaskbarList3,(LPVOID*) &pITask);
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
pITask = 0;
|
||||
CoUninitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
pITask->HrInit();
|
||||
return;
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
if (pITask) {
|
||||
pITask->Release();
|
||||
pITask = NULL;
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text)
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationProgressRange(int min, int max)
|
||||
{
|
||||
total = max-min;
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationProgressValue(int value)
|
||||
{
|
||||
if (pITask) {
|
||||
WId winId = Core::ICore::instance()->mainWindow()->winId();
|
||||
pITask->SetProgressValue(winId, value, total);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool visible)
|
||||
{
|
||||
if (!pITask)
|
||||
return;
|
||||
|
||||
WId winId = Core::ICore::instance()->mainWindow()->winId();
|
||||
if (visible)
|
||||
pITask->SetProgressState(winId, TBPF_NORMAL);
|
||||
else
|
||||
pITask->SetProgressState(winId, TBPF_NOPROGRESS);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text)
|
||||
@@ -49,3 +134,6 @@ void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool
|
||||
{
|
||||
Q_UNUSED(visible)
|
||||
}
|
||||
|
||||
|
||||
#endif // __ITaskbarList2_INTERFACE_DEFINED__
|
||||
|
||||
@@ -29,6 +29,14 @@
|
||||
|
||||
#include "progressmanager_p.h"
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text)
|
||||
|
||||
@@ -186,19 +186,20 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class FindUses: protected ASTVisitor
|
||||
class FindLocalUses: protected ASTVisitor
|
||||
{
|
||||
Scope *_functionScope;
|
||||
|
||||
FindScope findScope;
|
||||
|
||||
public:
|
||||
FindUses(TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit)
|
||||
FindLocalUses(TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit), hasD(false), hasQ(false)
|
||||
{ }
|
||||
|
||||
// local and external uses.
|
||||
SemanticInfo::LocalUseMap localUses;
|
||||
bool hasD;
|
||||
bool hasQ;
|
||||
|
||||
void operator()(FunctionDefinitionAST *ast)
|
||||
{
|
||||
@@ -218,7 +219,7 @@ protected:
|
||||
if (! (ast && ast->name))
|
||||
return false;
|
||||
|
||||
Identifier *id = ast->name->identifier();
|
||||
const Identifier *id = ast->name->identifier();
|
||||
|
||||
if (scope) {
|
||||
for (Symbol *member = scope->lookat(id); member; member = member->next()) {
|
||||
@@ -357,6 +358,16 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool visit(QtMemberDeclarationAST *ast)
|
||||
{
|
||||
if (tokenKind(ast->q_token) == T_Q_D)
|
||||
hasD = true;
|
||||
else
|
||||
hasQ = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool visit(ExpressionOrDeclarationStatementAST *ast)
|
||||
{
|
||||
accept(ast->declaration);
|
||||
@@ -466,7 +477,7 @@ protected:
|
||||
|
||||
class FindFunctionDefinitions: protected SymbolVisitor
|
||||
{
|
||||
Name *_declarationName;
|
||||
const Name *_declarationName;
|
||||
QList<Function *> *_functions;
|
||||
|
||||
public:
|
||||
@@ -475,7 +486,7 @@ public:
|
||||
_functions(0)
|
||||
{ }
|
||||
|
||||
void operator()(Name *declarationName, Scope *globals,
|
||||
void operator()(const Name *declarationName, Scope *globals,
|
||||
QList<Function *> *functions)
|
||||
{
|
||||
_declarationName = declarationName;
|
||||
@@ -491,8 +502,8 @@ protected:
|
||||
|
||||
virtual bool visit(Function *function)
|
||||
{
|
||||
Name *name = function->name();
|
||||
if (QualifiedNameId *q = name->asQualifiedNameId())
|
||||
const Name *name = function->name();
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||
name = q->unqualifiedNameId();
|
||||
|
||||
if (_declarationName->isEqualTo(name))
|
||||
@@ -504,19 +515,19 @@ protected:
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
static QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
|
||||
static const QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
|
||||
{
|
||||
Name *symbolName = s->name();
|
||||
const Name *symbolName = s->name();
|
||||
if (! symbolName)
|
||||
return 0; // nothing to do.
|
||||
|
||||
QVector<Name *> names;
|
||||
QVector<const Name *> names;
|
||||
|
||||
for (Scope *scope = s->scope(); scope; scope = scope->enclosingScope()) {
|
||||
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
||||
if (scope->owner() && scope->owner()->name()) {
|
||||
Name *ownerName = scope->owner()->name();
|
||||
if (QualifiedNameId *q = ownerName->asQualifiedNameId()) {
|
||||
const Name *ownerName = scope->owner()->name();
|
||||
if (const QualifiedNameId *q = ownerName->asQualifiedNameId()) {
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
names.prepend(q->nameAt(i));
|
||||
}
|
||||
@@ -527,7 +538,7 @@ static QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext
|
||||
}
|
||||
}
|
||||
|
||||
if (QualifiedNameId *q = symbolName->asQualifiedNameId()) {
|
||||
if (const QualifiedNameId *q = symbolName->asQualifiedNameId()) {
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
names.append(q->nameAt(i));
|
||||
}
|
||||
@@ -929,6 +940,7 @@ void CPPEditor::updateMethodBoxIndex()
|
||||
}
|
||||
|
||||
void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||
const SemanticInfo &semanticInfo,
|
||||
QList<QTextEdit::ExtraSelection> *selections)
|
||||
{
|
||||
bool isUnused = false;
|
||||
@@ -951,6 +963,14 @@ void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||
sel.cursor.setPosition(anchor);
|
||||
sel.cursor.setPosition(position, QTextCursor::KeepAnchor);
|
||||
|
||||
if (isUnused) {
|
||||
if (semanticInfo.hasQ && sel.cursor.selectedText() == QLatin1String("q"))
|
||||
continue; // skip q
|
||||
|
||||
else if (semanticInfo.hasD && sel.cursor.selectedText() == QLatin1String("d"))
|
||||
continue; // skip d
|
||||
}
|
||||
|
||||
selections->append(sel);
|
||||
}
|
||||
}
|
||||
@@ -1001,27 +1021,28 @@ void CPPEditor::updateUsesNow()
|
||||
semanticRehighlight();
|
||||
}
|
||||
|
||||
static bool isCompatible(Name *name, Name *otherName)
|
||||
static bool isCompatible(const Name *name, const Name *otherName)
|
||||
{
|
||||
if (NameId *nameId = name->asNameId()) {
|
||||
if (TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
||||
if (const NameId *nameId = name->asNameId()) {
|
||||
if (const TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
||||
return nameId->identifier()->isEqualTo(otherTemplId->identifier());
|
||||
} else if (TemplateNameId *templId = name->asTemplateNameId()) {
|
||||
if (NameId *otherNameId = otherName->asNameId())
|
||||
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
|
||||
if (const NameId *otherNameId = otherName->asNameId())
|
||||
return templId->identifier()->isEqualTo(otherNameId->identifier());
|
||||
}
|
||||
|
||||
return name->isEqualTo(otherName);
|
||||
}
|
||||
|
||||
static bool isCompatible(Function *definition, Symbol *declaration, QualifiedNameId *declarationName)
|
||||
static bool isCompatible(Function *definition, Symbol *declaration,
|
||||
const QualifiedNameId *declarationName)
|
||||
{
|
||||
Function *declTy = declaration->type()->asFunctionType();
|
||||
if (! declTy)
|
||||
return false;
|
||||
|
||||
Name *definitionName = definition->name();
|
||||
if (QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
const Name *definitionName = definition->name();
|
||||
if (const QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
||||
return false;
|
||||
else if (q->nameCount() > declarationName->nameCount())
|
||||
@@ -1041,8 +1062,8 @@ static bool isCompatible(Function *definition, Symbol *declaration, QualifiedNam
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i != q->nameCount(); ++i) {
|
||||
Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
const Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
const Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
if (! isCompatible(n, m))
|
||||
return false;
|
||||
}
|
||||
@@ -1085,7 +1106,7 @@ void CPPEditor::switchDeclarationDefinition()
|
||||
QList<LookupItem> resolvedSymbols = typeOfExpression(QString(), doc, lastSymbol);
|
||||
const LookupContext &context = typeOfExpression.lookupContext();
|
||||
|
||||
QualifiedNameId *q = qualifiedNameIdForSymbol(f, context);
|
||||
const QualifiedNameId *q = qualifiedNameIdForSymbol(f, context);
|
||||
QList<Symbol *> symbols = context.resolve(q);
|
||||
|
||||
Symbol *declaration = 0;
|
||||
@@ -1258,11 +1279,11 @@ Symbol *CPPEditor::findDefinition(Symbol *symbol)
|
||||
if (! funTy)
|
||||
return 0; // symbol does not have function type.
|
||||
|
||||
Name *name = symbol->name();
|
||||
const Name *name = symbol->name();
|
||||
if (! name)
|
||||
return 0; // skip anonymous functions!
|
||||
|
||||
if (QualifiedNameId *q = name->asQualifiedNameId())
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||
name = q->unqualifiedNameId();
|
||||
|
||||
// map from file names to function definitions.
|
||||
@@ -1681,9 +1702,9 @@ void CPPEditor::performQuickFix(int index)
|
||||
{
|
||||
CPPQuickFixCollector *quickFixCollector = CppPlugin::instance()->quickFixCollector();
|
||||
QuickFixOperationPtr op = m_quickFixes.at(index);
|
||||
//quickFixCollector->perform(op);
|
||||
op->createChangeSet();
|
||||
setChangeSet(op->changeSet());
|
||||
quickFixCollector->perform(op);
|
||||
//op->createChangeSet();
|
||||
//setChangeSet(op->changeSet());
|
||||
}
|
||||
|
||||
void CPPEditor::contextMenuEvent(QContextMenuEvent *e)
|
||||
@@ -1869,6 +1890,10 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
|
||||
m_occurrencesFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES));
|
||||
m_occurrencesUnusedFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_UNUSED));
|
||||
m_occurrencesUnusedFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
|
||||
m_occurrencesUnusedFormat.setUnderlineColor(m_occurrencesUnusedFormat.foreground().color());
|
||||
m_occurrencesUnusedFormat.clearForeground();
|
||||
m_occurrencesUnusedFormat.setToolTip(tr("Unused variable"));
|
||||
m_occurrenceRenameFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_RENAME));
|
||||
|
||||
// only set the background, we do not want to modify foreground properties set by the syntax highlighter or the link
|
||||
@@ -1934,7 +1959,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
|
||||
int line = 0, column = 0;
|
||||
convertPosition(position(), &line, &column);
|
||||
|
||||
QList<QTextEdit::ExtraSelection> allSelections;
|
||||
QList<QTextEdit::ExtraSelection> unusedSelections;
|
||||
|
||||
m_renameSelections.clear();
|
||||
|
||||
@@ -1953,18 +1978,16 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
|
||||
}
|
||||
}
|
||||
|
||||
if (uses.size() == 1) {
|
||||
if (uses.size() == 1)
|
||||
// it's an unused declaration
|
||||
// highlightUses(uses, &allSelections);
|
||||
} else if (good) {
|
||||
QList<QTextEdit::ExtraSelection> selections;
|
||||
highlightUses(uses, &selections);
|
||||
m_renameSelections += selections;
|
||||
allSelections += selections;
|
||||
}
|
||||
highlightUses(uses, semanticInfo, &unusedSelections);
|
||||
|
||||
else if (good && m_renameSelections.isEmpty())
|
||||
highlightUses(uses, semanticInfo, &m_renameSelections);
|
||||
}
|
||||
|
||||
setExtraSelections(CodeSemanticsSelection, allSelections);
|
||||
setExtraSelections(UnusedSymbolSelection, unusedSelections);
|
||||
setExtraSelections(CodeSemanticsSelection, m_renameSelections);
|
||||
}
|
||||
|
||||
SemanticHighlighter::Source CPPEditor::currentSource(bool force)
|
||||
@@ -2078,7 +2101,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
||||
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(translationUnit);
|
||||
FunctionDefinitionAST *currentFunctionDefinition = functionDefinitionUnderCursor(ast, source.line, source.column);
|
||||
|
||||
FindUses useTable(translationUnit);
|
||||
FindLocalUses useTable(translationUnit);
|
||||
useTable(currentFunctionDefinition);
|
||||
|
||||
SemanticInfo semanticInfo;
|
||||
@@ -2086,6 +2109,8 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
||||
semanticInfo.snapshot = snapshot;
|
||||
semanticInfo.doc = doc;
|
||||
semanticInfo.localUses = useTable.localUses;
|
||||
semanticInfo.hasQ = useTable.hasQ;
|
||||
semanticInfo.hasD = useTable.hasD;
|
||||
|
||||
return semanticInfo;
|
||||
}
|
||||
|
||||
@@ -79,10 +79,12 @@ public:
|
||||
typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator;
|
||||
|
||||
SemanticInfo()
|
||||
: revision(-1)
|
||||
: revision(-1), hasQ(false), hasD(false)
|
||||
{ }
|
||||
|
||||
int revision;
|
||||
bool hasQ: 1;
|
||||
bool hasD: 1;
|
||||
CPlusPlus::Snapshot snapshot;
|
||||
CPlusPlus::Document::Ptr doc;
|
||||
LocalUseMap localUses;
|
||||
@@ -253,6 +255,7 @@ private:
|
||||
SemanticHighlighter::Source currentSource(bool force = false);
|
||||
|
||||
void highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||
const SemanticInfo &semanticInfo,
|
||||
QList<QTextEdit::ExtraSelection> *selections);
|
||||
|
||||
void createToolBar(CPPEditorEditable *editable);
|
||||
|
||||
@@ -138,7 +138,7 @@ void CppHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
|
||||
}
|
||||
}
|
||||
|
||||
static QString buildHelpId(Symbol *symbol, Name *name)
|
||||
static QString buildHelpId(Symbol *symbol, const Name *name)
|
||||
{
|
||||
Scope *scope = 0;
|
||||
|
||||
@@ -161,13 +161,13 @@ static QString buildHelpId(Symbol *symbol, Name *name)
|
||||
Symbol *owner = scope->owner();
|
||||
|
||||
if (owner && owner->name() && ! scope->isEnumScope()) {
|
||||
Name *name = owner->name();
|
||||
Identifier *id = 0;
|
||||
const Name *name = owner->name();
|
||||
const Identifier *id = 0;
|
||||
|
||||
if (NameId *nameId = name->asNameId())
|
||||
if (const NameId *nameId = name->asNameId())
|
||||
id = nameId->identifier();
|
||||
|
||||
else if (TemplateNameId *nameId = name->asTemplateNameId())
|
||||
else if (const TemplateNameId *nameId = name->asTemplateNameId())
|
||||
id = nameId->identifier();
|
||||
|
||||
if (id)
|
||||
@@ -182,7 +182,7 @@ static QString buildHelpId(Symbol *symbol, Name *name)
|
||||
static FullySpecifiedType resolve(const FullySpecifiedType &ty,
|
||||
const LookupContext &context,
|
||||
Symbol **resolvedSymbol,
|
||||
Name **resolvedName)
|
||||
const Name **resolvedName)
|
||||
{
|
||||
Control *control = context.control();
|
||||
|
||||
@@ -272,8 +272,10 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
if (!doc)
|
||||
return; // nothing to do
|
||||
|
||||
QString formatTooltip = edit->extraSelectionTooltip(pos);
|
||||
QTextCursor tc(edit->document());
|
||||
tc.setPosition(pos);
|
||||
|
||||
const unsigned lineNumber = tc.block().blockNumber() + 1;
|
||||
|
||||
// Find the last symbol up to the cursor position
|
||||
@@ -332,14 +334,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
Symbol *lookupSymbol = result.lastVisibleSymbol(); // lookup symbol
|
||||
|
||||
Symbol *resolvedSymbol = lookupSymbol;
|
||||
Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
|
||||
const Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
|
||||
firstType = resolve(firstType, typeOfExpression.lookupContext(),
|
||||
&resolvedSymbol, &resolvedName);
|
||||
|
||||
if (resolvedSymbol && resolvedSymbol->scope()
|
||||
&& resolvedSymbol->scope()->isClassScope()) {
|
||||
Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass();
|
||||
if (Identifier *id = enclosingClass->identifier()) {
|
||||
if (const Identifier *id = enclosingClass->identifier()) {
|
||||
if (id->isEqualTo(resolvedSymbol->identifier()))
|
||||
resolvedSymbol = enclosingClass;
|
||||
}
|
||||
@@ -392,6 +394,11 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
m_helpEngineNeedsSetup = false;
|
||||
}
|
||||
|
||||
|
||||
if (!formatTooltip.isEmpty()) {
|
||||
m_toolTip = formatTooltip;
|
||||
}
|
||||
|
||||
if (!m_toolTip.isEmpty())
|
||||
m_toolTip = Qt::escape(m_toolTip);
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ protected:
|
||||
return previousItem;
|
||||
}
|
||||
|
||||
TextEditor::CompletionItem newCompletionItem(Name *name)
|
||||
TextEditor::CompletionItem newCompletionItem(const Name *name)
|
||||
{
|
||||
TextEditor::CompletionItem item(_collector);
|
||||
item.text = overview.prettyName(name);
|
||||
@@ -200,25 +200,25 @@ protected:
|
||||
return item;
|
||||
}
|
||||
|
||||
virtual void visit(NameId *name)
|
||||
virtual void visit(const NameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(TemplateNameId *name)
|
||||
virtual void visit(const TemplateNameId *name)
|
||||
{
|
||||
_item = newCompletionItem(name);
|
||||
_item.text = QLatin1String(name->identifier()->chars());
|
||||
}
|
||||
|
||||
virtual void visit(DestructorNameId *name)
|
||||
virtual void visit(const DestructorNameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(OperatorNameId *name)
|
||||
virtual void visit(const OperatorNameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(ConversionNameId *name)
|
||||
virtual void visit(const ConversionNameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(QualifiedNameId *name)
|
||||
virtual void visit(const QualifiedNameId *name)
|
||||
{ _item = newCompletionItem(name->unqualifiedNameId()); }
|
||||
};
|
||||
|
||||
@@ -890,13 +890,13 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
||||
FullySpecifiedType exprTy = result.type().simplified();
|
||||
|
||||
if (Class *klass = exprTy->asClassType()) {
|
||||
Name *className = klass->name();
|
||||
const Name *className = klass->name();
|
||||
if (! className)
|
||||
continue; // nothing to do for anonymoous classes.
|
||||
|
||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
||||
Symbol *member = klass->memberAt(i);
|
||||
Name *memberName = member->name();
|
||||
const Name *memberName = member->name();
|
||||
|
||||
if (! memberName)
|
||||
continue; // skip anonymous member.
|
||||
@@ -945,7 +945,7 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
||||
if (functions.isEmpty()) {
|
||||
ResolveExpression resolveExpression(context);
|
||||
ResolveClass resolveClass;
|
||||
Name *functionCallOp = context.control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||
const Name *functionCallOp = context.control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||
|
||||
foreach (const LookupItem &result, results) {
|
||||
FullySpecifiedType ty = result.type().simplified();
|
||||
@@ -1092,7 +1092,7 @@ bool CppCodeCompletion::completeMember(const QList<LookupItem> &baseResults,
|
||||
classObjectCandidates.append(klass);
|
||||
|
||||
else if (NamedType *namedTy = ty->asNamedType()) {
|
||||
Name *className = namedTy->name();
|
||||
const Name *className = namedTy->name();
|
||||
const QList<Symbol *> classes = resolveClass(className, r, context);
|
||||
|
||||
foreach (Symbol *c, classes) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
@@ -79,8 +79,8 @@ QList<int> CppFindReferences::references(Symbol *symbol,
|
||||
Document::Ptr doc,
|
||||
const Snapshot& snapshot) const
|
||||
{
|
||||
Identifier *id = 0;
|
||||
if (Identifier *symbolId = symbol->identifier())
|
||||
const Identifier *id = 0;
|
||||
if (const Identifier *symbolId = symbol->identifier())
|
||||
id = doc->control()->findIdentifier(symbolId->chars(), symbolId->size());
|
||||
|
||||
QList<int> references;
|
||||
@@ -106,7 +106,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
QTime tm;
|
||||
tm.start();
|
||||
|
||||
Identifier *symbolId = symbol->identifier();
|
||||
const Identifier *symbolId = symbol->identifier();
|
||||
Q_ASSERT(symbolId != 0);
|
||||
|
||||
const QString sourceFile = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
||||
@@ -142,7 +142,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
|
||||
if (Document::Ptr previousDoc = snapshot.value(fileName)) {
|
||||
Control *control = previousDoc->control();
|
||||
Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
|
||||
const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
|
||||
if (! id)
|
||||
continue; // skip this document, it's not using symbolId.
|
||||
}
|
||||
@@ -164,7 +164,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
doc->tokenize();
|
||||
|
||||
Control *control = doc->control();
|
||||
if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
|
||||
if (const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
|
||||
QTime tm;
|
||||
tm.start();
|
||||
doc->parse();
|
||||
@@ -202,7 +202,7 @@ void CppFindReferences::findUsages(Symbol *symbol)
|
||||
|
||||
void CppFindReferences::renameUsages(Symbol *symbol)
|
||||
{
|
||||
if (Identifier *id = symbol->identifier()) {
|
||||
if (const Identifier *id = symbol->identifier()) {
|
||||
const QString textToReplace = QString::fromUtf8(id->chars(), id->size());
|
||||
|
||||
Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchAndReplace);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ bool SearchSymbols::visit(Function *symbol)
|
||||
return false;
|
||||
|
||||
QString extraScope;
|
||||
if (Name *name = symbol->name()) {
|
||||
if (QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
||||
if (const Name *name = symbol->name()) {
|
||||
if (const QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
||||
if (nameId->nameCount() > 1) {
|
||||
extraScope = overview.prettyName(nameId->nameAt(nameId->nameCount() - 2));
|
||||
}
|
||||
|
||||
@@ -1588,6 +1588,8 @@ QList<Symbol> CdbDebugEngine::moduleSymbols(const QString &moduleName)
|
||||
|
||||
void CdbDebugEngine::reloadRegisters()
|
||||
{
|
||||
if (state() != InferiorStopped)
|
||||
return;
|
||||
const int intBase = 10;
|
||||
if (debugCDB)
|
||||
qDebug() << Q_FUNC_INFO << intBase;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <projectexplorer/environment.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -131,7 +132,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
||||
}
|
||||
if (const ProjectExplorer::Project *project = runConfiguration->project()) {
|
||||
m_startParameters->buildDir =
|
||||
project->buildDirectory(project->activeBuildConfiguration());
|
||||
project->activeBuildConfiguration()->buildDirectory();
|
||||
}
|
||||
m_startParameters->useTerminal =
|
||||
runConfiguration->runMode() == LocalApplicationRunConfiguration::Console;
|
||||
|
||||
@@ -155,9 +155,8 @@ static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents)
|
||||
out = out.left(out.lastIndexOf('"'));
|
||||
// optimization: dumper output never needs real C unquoting
|
||||
out.replace('\\', "");
|
||||
out = "dummy={" + out + "}";
|
||||
|
||||
contents->fromString(out);
|
||||
contents->fromStringMultiple(out);
|
||||
//qDebug() << "CONTENTS" << contents->toString(true);
|
||||
return contents->isValid();
|
||||
}
|
||||
@@ -2569,6 +2568,8 @@ void GdbEngine::handleStackListThreads(const GdbResponse &response)
|
||||
|
||||
void GdbEngine::reloadRegisters()
|
||||
{
|
||||
if (state() != InferiorStopped)
|
||||
return;
|
||||
if (!m_registerNamesListed) {
|
||||
postCommand(_("-data-list-register-names"), CB(handleRegisterListNames));
|
||||
m_registerNamesListed = true;
|
||||
@@ -3584,8 +3585,8 @@ void GdbEngine::handleStackFrame(const GdbResponse &response)
|
||||
<< out.left(pos);
|
||||
out = out.mid(pos);
|
||||
}
|
||||
GdbMi all("[" + out + "]");
|
||||
//GdbMi all(out);
|
||||
GdbMi all;
|
||||
all.fromStringMultiple(out);
|
||||
|
||||
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
|
||||
GdbMi locals = all.findChild("locals");
|
||||
|
||||
@@ -348,6 +348,13 @@ void GdbMi::fromString(const QByteArray &ba)
|
||||
parseResultOrValue(from, to);
|
||||
}
|
||||
|
||||
void GdbMi::fromStringMultiple(const QByteArray &ba)
|
||||
{
|
||||
const char *from = ba.constBegin();
|
||||
const char *to = ba.constEnd();
|
||||
parseTuple_helper(from, to);
|
||||
}
|
||||
|
||||
GdbMi GdbMi::findChild(const char *name) const
|
||||
{
|
||||
for (int i = 0; i < m_children.size(); ++i)
|
||||
|
||||
@@ -91,7 +91,6 @@ class GdbMi
|
||||
{
|
||||
public:
|
||||
GdbMi() : m_type(Invalid) {}
|
||||
explicit GdbMi(const QByteArray &str) { fromString(str); }
|
||||
|
||||
QByteArray m_name;
|
||||
QByteArray m_data;
|
||||
@@ -126,6 +125,7 @@ public:
|
||||
|
||||
QByteArray toString(bool multiline = false, int indent = 0) const;
|
||||
void fromString(const QByteArray &str);
|
||||
void fromStringMultiple(const QByteArray &str);
|
||||
void setStreamOutput(const QByteArray &name, const QByteArray &content);
|
||||
|
||||
private:
|
||||
|
||||
@@ -975,11 +975,8 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents, Debugger debugger)
|
||||
// parse a query
|
||||
bool QtDumperHelper::parseQuery(const char *data, Debugger debugger)
|
||||
{
|
||||
QByteArray fullData = data;
|
||||
fullData.insert(0, '{');
|
||||
fullData.append(data);
|
||||
fullData.append('}');
|
||||
GdbMi root(fullData);
|
||||
GdbMi root;
|
||||
root.fromStringMultiple(QByteArray(data));
|
||||
if (!root.isValid())
|
||||
return false;
|
||||
return parseQuery(root, debugger);
|
||||
@@ -1475,11 +1472,8 @@ bool QtDumperHelper::parseValue(const char *data,
|
||||
QList<WatchData> *l)
|
||||
{
|
||||
l->clear();
|
||||
QByteArray fullData = data;
|
||||
fullData.insert(0, '{');
|
||||
fullData.append(data);
|
||||
fullData.append('}');
|
||||
GdbMi root(fullData);
|
||||
GdbMi root;
|
||||
root.fromStringMultiple(QByteArray(data));
|
||||
if (!root.isValid())
|
||||
return false;
|
||||
gbdMiToWatchData(root, GdbMiRecursionContext(), l);
|
||||
|
||||
@@ -251,8 +251,8 @@ static bool isCompatible(const Function *definition, const Symbol *declaration,
|
||||
if (! declTy)
|
||||
return false;
|
||||
|
||||
Name *definitionName = definition->name();
|
||||
if (QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
const Name *definitionName = definition->name();
|
||||
if (const QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
||||
return false;
|
||||
else if (q->nameCount() > declarationName->nameCount())
|
||||
@@ -272,8 +272,8 @@ static bool isCompatible(const Function *definition, const Symbol *declaration,
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i != q->nameCount(); ++i) {
|
||||
Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
const Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
const Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
if (! isCompatible(n, m))
|
||||
return false;
|
||||
}
|
||||
@@ -291,13 +291,13 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
||||
if (!cppModelManager)
|
||||
return Document::Ptr();
|
||||
|
||||
QVector<Name *> qualifiedName;
|
||||
QVector<const Name *> qualifiedName;
|
||||
Scope *scope = functionDeclaration->scope();
|
||||
for (; scope; scope = scope->enclosingScope()) {
|
||||
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
||||
if (scope->owner() && scope->owner()->name()) {
|
||||
Name *scopeOwnerName = scope->owner()->name();
|
||||
if (QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
|
||||
const Name *scopeOwnerName = scope->owner()->name();
|
||||
if (const QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
qualifiedName.prepend(q->nameAt(i));
|
||||
|
||||
@@ -312,7 +312,7 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
||||
qualifiedName.append(functionDeclaration->name());
|
||||
|
||||
Control control;
|
||||
QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
||||
const QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
||||
LookupContext context(&control);
|
||||
const Snapshot documents = cppModelManager->snapshot();
|
||||
foreach (Document::Ptr doc, documents) {
|
||||
@@ -321,13 +321,13 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
||||
visibleScopes = context.expand(visibleScopes);
|
||||
foreach (Scope *visibleScope, visibleScopes) {
|
||||
Symbol *symbol = 0;
|
||||
if (NameId *nameId = q->unqualifiedNameId()->asNameId())
|
||||
if (const NameId *nameId = q->unqualifiedNameId()->asNameId())
|
||||
symbol = visibleScope->lookat(nameId->identifier());
|
||||
else if (DestructorNameId *dtorId = q->unqualifiedNameId()->asDestructorNameId())
|
||||
else if (const DestructorNameId *dtorId = q->unqualifiedNameId()->asDestructorNameId())
|
||||
symbol = visibleScope->lookat(dtorId->identifier());
|
||||
else if (TemplateNameId *templNameId = q->unqualifiedNameId()->asTemplateNameId())
|
||||
else if (const TemplateNameId *templNameId = q->unqualifiedNameId()->asTemplateNameId())
|
||||
symbol = visibleScope->lookat(templNameId->identifier());
|
||||
else if (OperatorNameId *opId = q->unqualifiedNameId()->asOperatorNameId())
|
||||
else if (const OperatorNameId *opId = q->unqualifiedNameId()->asOperatorNameId())
|
||||
symbol = visibleScope->lookat(opId->kind());
|
||||
// ### cast operators
|
||||
for (; symbol; symbol = symbol->next()) {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "genericbuildconfiguration.h"
|
||||
#include "genericproject.h"
|
||||
|
||||
using namespace GenericProjectManager;
|
||||
using namespace GenericProjectManager::Internal;
|
||||
using ProjectExplorer::BuildConfiguration;
|
||||
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericProject *pro)
|
||||
: BuildConfiguration(pro)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericBuildConfiguration *source)
|
||||
: BuildConfiguration(source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment GenericBuildConfiguration::environment() const
|
||||
{
|
||||
return ProjectExplorer::Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
QString GenericBuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString buildDirectory = value("buildDirectory").toString();
|
||||
|
||||
if (buildDirectory.isEmpty()) {
|
||||
QFileInfo fileInfo(project()->file()->fileName());
|
||||
|
||||
buildDirectory = fileInfo.absolutePath();
|
||||
}
|
||||
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
GenericProject *GenericBuildConfiguration::genericProject() const
|
||||
{
|
||||
return static_cast<GenericProject *>(project());
|
||||
}
|
||||
|
||||
@@ -27,59 +27,30 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef EMBEDDEDPROPERTIESPAGE_H
|
||||
#define EMBEDDEDPROPERTIESPAGE_H
|
||||
#ifndef GENERICBUILDCONFIGURATION_H
|
||||
#define GENERICBUILDCONFIGURATION_H
|
||||
|
||||
#include "ui_embeddedpropertiespage.h"
|
||||
|
||||
#include <projectexplorer/iprojectproperties.h>
|
||||
|
||||
#include <QtCore/QModelIndex>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class EmbeddedPropertiesWidget;
|
||||
class GenericProject;
|
||||
|
||||
class EmbeddedPropertiesPanelFactory : public ProjectExplorer::IPanelFactory
|
||||
{
|
||||
public:
|
||||
virtual bool supports(ProjectExplorer::Project *project);
|
||||
ProjectExplorer::IPropertiesPanel *createPanel(ProjectExplorer::Project *project);
|
||||
};
|
||||
|
||||
class EmbeddedPropertiesPanel : public ProjectExplorer::IPropertiesPanel
|
||||
{
|
||||
public:
|
||||
EmbeddedPropertiesPanel(ProjectExplorer::Project *project);
|
||||
~EmbeddedPropertiesPanel();
|
||||
|
||||
QString name() const;
|
||||
QWidget *widget() const;
|
||||
QIcon icon() const;
|
||||
|
||||
private:
|
||||
EmbeddedPropertiesWidget *m_widget;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
class EmbeddedPropertiesWidget : public QWidget
|
||||
class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EmbeddedPropertiesWidget(ProjectExplorer::Project *project);
|
||||
virtual ~EmbeddedPropertiesWidget();
|
||||
private:
|
||||
Ui_EmbeddedPropertiesPage m_ui;
|
||||
ProjectExplorer::Project *m_pro;
|
||||
GenericBuildConfiguration(GenericProject *pro);
|
||||
GenericBuildConfiguration(GenericBuildConfiguration *source);
|
||||
|
||||
GenericProject *genericProject() const;
|
||||
|
||||
virtual ProjectExplorer::Environment environment() const;
|
||||
virtual QString buildDirectory() const;
|
||||
};
|
||||
|
||||
} // namespace GenericProjectManager
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // EMBEDDEDPROPERTIESPAGE_H
|
||||
#endif // GENERICBUILDCONFIGURATION_H
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "genericprojectconstants.h"
|
||||
#include "genericproject.h"
|
||||
#include "ui_genericmakestep.h"
|
||||
#include "genericbuildconfiguration.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
@@ -47,13 +48,13 @@
|
||||
using namespace GenericProjectManager;
|
||||
using namespace GenericProjectManager::Internal;
|
||||
|
||||
GenericMakeStep::GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(pro, bc), m_pro(pro)
|
||||
GenericMakeStep::GenericMakeStep(ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc)
|
||||
{
|
||||
}
|
||||
|
||||
GenericMakeStep::GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc), m_pro(bs->project())
|
||||
: AbstractMakeStep(bs, bc)
|
||||
{
|
||||
m_buildTargets = bs->m_buildTargets;
|
||||
m_makeArguments = bs->m_makeArguments;
|
||||
@@ -64,23 +65,28 @@ GenericMakeStep::~GenericMakeStep()
|
||||
{
|
||||
}
|
||||
|
||||
GenericBuildConfiguration *GenericMakeStep::genericBuildConfiguration() const
|
||||
{
|
||||
return static_cast<GenericBuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
bool GenericMakeStep::init()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
const QString buildParser = m_pro->buildParser(bc);
|
||||
GenericBuildConfiguration *bc = genericBuildConfiguration();
|
||||
//TODO
|
||||
const QString buildParser = genericBuildConfiguration()->genericProject()->buildParser(bc);
|
||||
setBuildParser(buildParser);
|
||||
qDebug() << "*** build parser:" << buildParser;
|
||||
|
||||
setEnabled(true);
|
||||
Core::VariableManager *vm = Core::VariableManager::instance();
|
||||
const QString rawBuildDir = m_pro->buildDirectory(bc);
|
||||
const QString rawBuildDir = bc->buildDirectory();
|
||||
const QString buildDir = vm->resolve(rawBuildDir);
|
||||
setWorkingDirectory(buildDir);
|
||||
|
||||
setCommand(makeCommand());
|
||||
setArguments(replacedArguments());
|
||||
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
setEnvironment(bc->environment());
|
||||
return AbstractMakeStep::init();
|
||||
}
|
||||
|
||||
@@ -119,7 +125,8 @@ QString GenericMakeStep::makeCommand() const
|
||||
{
|
||||
QString command = m_makeCommand;
|
||||
if (command.isEmpty()) {
|
||||
if (ProjectExplorer::ToolChain *toolChain = m_pro->toolChain())
|
||||
GenericProject *pro = genericBuildConfiguration()->genericProject();
|
||||
if (ProjectExplorer::ToolChain *toolChain = pro->toolChain())
|
||||
command = toolChain->makeCommand();
|
||||
else
|
||||
command = QLatin1String("make");
|
||||
@@ -152,11 +159,6 @@ bool GenericMakeStep::immutable() const
|
||||
return true;
|
||||
}
|
||||
|
||||
GenericProject *GenericMakeStep::project() const
|
||||
{
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool GenericMakeStep::buildsTarget(const QString &target) const
|
||||
{
|
||||
return m_buildTargets.contains(target);
|
||||
@@ -184,7 +186,7 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt
|
||||
m_ui->setupUi(this);
|
||||
|
||||
// TODO update this list also on rescans of the GenericLists.txt
|
||||
GenericProject *pro = m_makeStep->project();
|
||||
GenericProject *pro = m_makeStep->genericBuildConfiguration()->genericProject();
|
||||
foreach (const QString &target, pro->targets()) {
|
||||
QListWidgetItem *item = new QListWidgetItem(target, m_ui->targetsList);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
@@ -280,14 +282,11 @@ bool GenericMakeStepFactory::canCreate(const QString &name) const
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::Project *project,
|
||||
ProjectExplorer::BuildConfiguration *bc,
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::BuildConfiguration *bc,
|
||||
const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
GenericProject *pro = qobject_cast<GenericProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new GenericMakeStep(pro, bc);
|
||||
return new GenericMakeStep(bc);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::BuildStep *bs,
|
||||
@@ -296,7 +295,7 @@ ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::Build
|
||||
return new GenericMakeStep(static_cast<GenericMakeStep*>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList GenericMakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
QStringList GenericMakeStepFactory::canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ QT_END_NAMESPACE
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class GenericProject;
|
||||
class GenericBuildConfiguration;
|
||||
class GenericMakeStepConfigWidget;
|
||||
|
||||
struct GenericMakeStepSettings
|
||||
@@ -56,9 +56,11 @@ class GenericMakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
Q_OBJECT
|
||||
friend class GenericMakeStepConfigWidget; // TODO remove again?
|
||||
public:
|
||||
GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
||||
GenericMakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||
GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~GenericMakeStep();
|
||||
GenericBuildConfiguration *genericBuildConfiguration() const;
|
||||
|
||||
virtual bool init();
|
||||
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
@@ -67,7 +69,6 @@ public:
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
GenericProject *project() const;
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList replacedArguments() const;
|
||||
@@ -76,7 +77,6 @@ public:
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
private:
|
||||
GenericProject *m_pro;
|
||||
QStringList m_buildTargets;
|
||||
QStringList m_makeArguments;
|
||||
QString m_makeCommand;
|
||||
@@ -105,12 +105,11 @@ private:
|
||||
class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro,
|
||||
ProjectExplorer::BuildConfiguration *bc,
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc,
|
||||
const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs,
|
||||
ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "genericproject.h"
|
||||
#include "genericprojectconstants.h"
|
||||
#include "genericmakestep.h"
|
||||
#include "genericbuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -131,7 +132,7 @@ QString GenericBuildConfigurationFactory::displayNameForType(const QString & /*
|
||||
return tr("Create");
|
||||
}
|
||||
|
||||
bool GenericBuildConfigurationFactory::create(const QString &type) const
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::create(const QString &type) const
|
||||
{
|
||||
QTC_ASSERT(type == "Create", return false);
|
||||
//TODO asking for name is duplicated everywhere, but maybe more
|
||||
@@ -145,13 +146,26 @@ bool GenericBuildConfigurationFactory::create(const QString &type) const
|
||||
&ok);
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return false;
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(m_project);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
m_project->addBuildConfiguration(bc); // also makes the name unique...
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(m_project, bc);
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
return true;
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::clone(BuildConfiguration *source) const
|
||||
{
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(static_cast<GenericBuildConfiguration *>(source));
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::restore() const
|
||||
{
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(m_project);
|
||||
return bc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -465,25 +479,6 @@ bool GenericProject::isApplication() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment GenericProject::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return ProjectExplorer::Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
QString GenericProject::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
QString buildDirectory = configuration->value("buildDirectory").toString();
|
||||
|
||||
if (buildDirectory.isEmpty()) {
|
||||
QFileInfo fileInfo(m_fileName);
|
||||
|
||||
buildDirectory = fileInfo.absolutePath();
|
||||
}
|
||||
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *GenericProject::createConfigWidget()
|
||||
{
|
||||
return new GenericBuildSettingsWidget(this);
|
||||
@@ -518,10 +513,11 @@ bool GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead
|
||||
Project::restoreSettingsImpl(reader);
|
||||
|
||||
if (buildConfigurations().isEmpty()) {
|
||||
ProjectExplorer::BuildConfiguration *bc = new BuildConfiguration("all");
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(this);
|
||||
bc->setDisplayName("all");
|
||||
addBuildConfiguration(bc);
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(this, bc);
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
@@ -574,7 +570,7 @@ void GenericProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
|
||||
: m_project(project)
|
||||
: m_project(project), m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setContentsMargins(0, -1, 0, -1);
|
||||
@@ -610,15 +606,15 @@ GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
|
||||
QString GenericBuildSettingsWidget::displayName() const
|
||||
{ return tr("Generic Manager"); }
|
||||
|
||||
void GenericBuildSettingsWidget::init(const QString &buildConfigurationName)
|
||||
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = buildConfigurationName;
|
||||
m_pathChooser->setPath(m_project->buildDirectory(m_project->buildConfiguration(buildConfigurationName)));
|
||||
m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
|
||||
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_project->buildConfiguration(m_buildConfiguration)->setValue("buildDirectory", m_pathChooser->path());
|
||||
m_buildConfiguration->setValue("buildDirectory", m_pathChooser->path());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::toolChainSelected(int index)
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Internal {
|
||||
class GenericProject;
|
||||
class GenericMakeStep;
|
||||
class GenericProjectFile;
|
||||
class GenericBuildConfiguration;
|
||||
|
||||
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||
{
|
||||
@@ -66,7 +67,9 @@ public:
|
||||
QStringList availableCreationTypes() const;
|
||||
QString displayNameForType(const QString &type) const;
|
||||
|
||||
bool create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||
ProjectExplorer::BuildConfiguration *restore() const;
|
||||
|
||||
private:
|
||||
GenericProject *m_project;
|
||||
@@ -93,9 +96,6 @@ public:
|
||||
|
||||
virtual bool isApplication() const;
|
||||
|
||||
virtual ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
|
||||
virtual QString displayName() const;
|
||||
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private Q_SLOTS:
|
||||
void buildDirectoryChanged();
|
||||
@@ -202,7 +202,7 @@ private Q_SLOTS:
|
||||
private:
|
||||
GenericProject *m_project;
|
||||
Utils::PathChooser *m_pathChooser;
|
||||
QString m_buildConfiguration;
|
||||
GenericBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -10,7 +10,8 @@ HEADERS = genericproject.h \
|
||||
genericprojectwizard.h \
|
||||
genericprojectfileseditor.h \
|
||||
pkgconfigtool.h \
|
||||
genericmakestep.h
|
||||
genericmakestep.h \
|
||||
genericbuildconfiguration.h
|
||||
SOURCES = genericproject.cpp \
|
||||
genericprojectplugin.cpp \
|
||||
genericprojectmanager.cpp \
|
||||
@@ -18,8 +19,8 @@ SOURCES = genericproject.cpp \
|
||||
genericprojectwizard.cpp \
|
||||
genericprojectfileseditor.cpp \
|
||||
pkgconfigtool.cpp \
|
||||
genericmakestep.cpp
|
||||
genericmakestep.cpp \
|
||||
genericbuildconfiguration.cpp
|
||||
RESOURCES += genericproject.qrc
|
||||
FORMS += genericmakestep.ui
|
||||
|
||||
OTHER_FILES += GenericProjectManager.pluginspec
|
||||
|
||||
@@ -427,7 +427,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
|
||||
|
||||
a = new QAction(tr("Reset Font Size"), this);
|
||||
cmd = am->registerAction(a, QLatin1String("Help.ResetFontSize"),
|
||||
cmd = am->registerAction(a, TextEditor::Constants::RESET_FONT_SIZE,
|
||||
modecontext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
||||
connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -46,8 +47,8 @@ namespace {
|
||||
bool debug = false;
|
||||
}
|
||||
|
||||
AbstractMakeStep::AbstractMakeStep(Project *project, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(project, bc),
|
||||
AbstractMakeStep::AbstractMakeStep(BuildConfiguration *bc)
|
||||
: AbstractProcessStep(bc),
|
||||
m_buildParser(0)
|
||||
{
|
||||
}
|
||||
@@ -144,7 +145,7 @@ void AbstractMakeStep::slotAddToTaskWindow(const TaskWindow::Task &task)
|
||||
if (debug)
|
||||
qDebug() << "No success. Trying all files in project ...";
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
foreach (const QString &file, project()->files(ProjectExplorer::Project::AllFiles)) {
|
||||
foreach (const QString &file, buildConfiguration()->project()->files(ProjectExplorer::Project::AllFiles)) {
|
||||
QFileInfo candidate(file);
|
||||
if (candidate.fileName() == fileName) {
|
||||
if (debug)
|
||||
|
||||
@@ -46,7 +46,7 @@ class PROJECTEXPLORER_EXPORT AbstractMakeStep : public ProjectExplorer::Abstract
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbstractMakeStep(Project * project, BuildConfiguration *bc);
|
||||
AbstractMakeStep(BuildConfiguration *bc);
|
||||
AbstractMakeStep(AbstractMakeStep *bs, BuildConfiguration *bc);
|
||||
~AbstractMakeStep();
|
||||
virtual bool init();
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AbstractProcessStep::AbstractProcessStep(Project *pro, BuildConfiguration *bc)
|
||||
: BuildStep(pro, bc), m_timer(0), m_futureInterface(0), m_process(0), m_eventLoop(0)
|
||||
AbstractProcessStep::AbstractProcessStep(BuildConfiguration *bc)
|
||||
: BuildStep(bc), m_timer(0), m_futureInterface(0), m_process(0), m_eventLoop(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class PROJECTEXPLORER_EXPORT AbstractProcessStep : public BuildStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbstractProcessStep(Project *pro, BuildConfiguration *bc);
|
||||
AbstractProcessStep(BuildConfiguration *bc);
|
||||
AbstractProcessStep(AbstractProcessStep *bs, BuildConfiguration *bc);
|
||||
/// reimplemented from BuildStep::init()
|
||||
/// You need to call this from YourBuildStep::init()
|
||||
|
||||
@@ -44,14 +44,14 @@ IBuildStepFactory *findFactory(const QString &name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildConfiguration(const QString &name)
|
||||
: m_name(name)
|
||||
BuildConfiguration::BuildConfiguration(Project *pro)
|
||||
: m_project(pro)
|
||||
{
|
||||
setDisplayName(name);
|
||||
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildConfiguration(const QString &name, BuildConfiguration *source)
|
||||
: m_values(source->m_values), m_name(name)
|
||||
BuildConfiguration::BuildConfiguration(BuildConfiguration *source)
|
||||
: m_values(source->m_values), m_project(source->m_project)
|
||||
{
|
||||
foreach(BuildStep *originalbs, source->buildSteps()) {
|
||||
IBuildStepFactory *factory = findFactory(originalbs->name());
|
||||
@@ -71,16 +71,6 @@ BuildConfiguration::~BuildConfiguration()
|
||||
qDeleteAll(m_cleanSteps);
|
||||
}
|
||||
|
||||
void BuildConfiguration::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
QString BuildConfiguration::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString BuildConfiguration::displayName() const
|
||||
{
|
||||
QVariant v = value("ProjectExplorer.BuildConfiguration.DisplayName");
|
||||
@@ -90,7 +80,10 @@ QString BuildConfiguration::displayName() const
|
||||
|
||||
void BuildConfiguration::setDisplayName(const QString &name)
|
||||
{
|
||||
if (value("ProjectExplorer.BuildConfiguration.DisplayName").toString() == name)
|
||||
return;
|
||||
setValue("ProjectExplorer.BuildConfiguration.DisplayName", name);
|
||||
emit displayNameChanged();
|
||||
}
|
||||
|
||||
QVariant BuildConfiguration::value(const QString & key) const
|
||||
@@ -172,6 +165,12 @@ void BuildConfiguration::moveCleanStepUp(int position)
|
||||
m_cleanSteps.swap(position - 1, position);
|
||||
}
|
||||
|
||||
Project *BuildConfiguration::project() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
// IBuildConfigurationFactory
|
||||
///
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define BUILDCONFIGURATION_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
#include "environment.h"
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QString>
|
||||
@@ -50,13 +51,13 @@ class PROJECTEXPLORER_EXPORT BuildConfiguration : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BuildConfiguration(const QString &name);
|
||||
BuildConfiguration(const QString &name, BuildConfiguration *source);
|
||||
~BuildConfiguration();
|
||||
QString name() const;
|
||||
// ctors are protected
|
||||
virtual ~BuildConfiguration();
|
||||
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
// TODO remove those
|
||||
QVariant value(const QString &key) const;
|
||||
void setValue(const QString &key, QVariant value);
|
||||
|
||||
@@ -73,15 +74,26 @@ public:
|
||||
void removeCleanStep(int position);
|
||||
void moveCleanStepUp(int position);
|
||||
|
||||
private:
|
||||
void setName(const QString &name);
|
||||
Project *project() const;
|
||||
|
||||
virtual Environment environment() const = 0;
|
||||
virtual QString buildDirectory() const = 0;
|
||||
|
||||
signals:
|
||||
void environmentChanged();
|
||||
void buildDirectoryChanged();
|
||||
void displayNameChanged();
|
||||
|
||||
protected:
|
||||
BuildConfiguration(Project * project);
|
||||
BuildConfiguration(BuildConfiguration *source);
|
||||
|
||||
private:
|
||||
QList<BuildStep *> m_buildSteps;
|
||||
QList<BuildStep *> m_cleanSteps;
|
||||
|
||||
QHash<QString, QVariant> m_values;
|
||||
QString m_name;
|
||||
friend class Project; // for setName
|
||||
Project *m_project;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject
|
||||
@@ -98,12 +110,15 @@ public:
|
||||
virtual QString displayNameForType(const QString &type) const = 0;
|
||||
|
||||
// creates build configuration(s) for given type and adds them to project
|
||||
// returns true if build configuration(s) actually have been added
|
||||
virtual bool create(const QString &type) const = 0;
|
||||
// if successfull returns the BuildConfiguration that should be shown in the
|
||||
// project mode for editing
|
||||
virtual BuildConfiguration *create(const QString &type) const = 0;
|
||||
|
||||
// to come:
|
||||
// restore
|
||||
// clone
|
||||
// clones a given BuildConfiguration, should not add it to the project
|
||||
virtual BuildConfiguration *clone(BuildConfiguration *source) const = 0;
|
||||
|
||||
// restores a BuildConfiguration with the name and adds it to the project
|
||||
virtual BuildConfiguration *restore() const = 0;
|
||||
|
||||
signals:
|
||||
void availableCreationTypesChanged();
|
||||
@@ -111,4 +126,6 @@ signals:
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
Q_DECLARE_METATYPE(ProjectExplorer::BuildConfiguration *);
|
||||
|
||||
#endif // BUILDCONFIGURATION_H
|
||||
|
||||
@@ -136,7 +136,7 @@ void BuildManager::cancel()
|
||||
this, SLOT(addToTaskWindow(ProjectExplorer::TaskWindow::Task)));
|
||||
disconnect(m_currentBuildStep, SIGNAL(addToOutputWindow(QString)),
|
||||
this, SLOT(addToOutputWindow(QString)));
|
||||
decrementActiveBuildSteps(m_currentBuildStep->project());
|
||||
decrementActiveBuildSteps(m_currentBuildStep->buildConfiguration()->project());
|
||||
|
||||
m_progressFutureInterface->setProgressValueAndText(m_progress*100, "Build canceled"); //TODO NBS fix in qtconcurrent
|
||||
clearBuildQueue();
|
||||
@@ -169,7 +169,7 @@ void BuildManager::emitCancelMessage()
|
||||
void BuildManager::clearBuildQueue()
|
||||
{
|
||||
foreach (BuildStep * bs, m_buildQueue)
|
||||
decrementActiveBuildSteps(bs->project());
|
||||
decrementActiveBuildSteps(bs->buildConfiguration()->project());
|
||||
|
||||
m_buildQueue.clear();
|
||||
m_running = false;
|
||||
@@ -280,13 +280,14 @@ void BuildManager::nextBuildQueue()
|
||||
bool result = m_watcher.result();
|
||||
if (!result) {
|
||||
// Build Failure
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(m_currentBuildStep->project()->name()));
|
||||
const QString projectName = m_currentBuildStep->buildConfiguration()->project()->name();
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(projectName));
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">When executing build step '%1'</font>").arg(m_currentBuildStep->displayName()));
|
||||
// NBS TODO fix in qtconcurrent
|
||||
m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Error while building project %1").arg(m_currentBuildStep->project()->name()));
|
||||
m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Error while building project %1").arg(projectName));
|
||||
}
|
||||
|
||||
decrementActiveBuildSteps(m_currentBuildStep->project());
|
||||
decrementActiveBuildSteps(m_currentBuildStep->buildConfiguration()->project());
|
||||
if (result)
|
||||
nextStep();
|
||||
else
|
||||
@@ -317,17 +318,18 @@ void BuildManager::nextStep()
|
||||
|
||||
bool init = m_currentBuildStep->init();
|
||||
if (!init) {
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(m_currentBuildStep->project()->name()));
|
||||
const QString projectName = m_currentBuildStep->buildConfiguration()->project()->name();
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(projectName));
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">When executing build step '%1'</font>").arg(m_currentBuildStep->displayName()));
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_currentBuildStep->project() != m_previousBuildStepProject) {
|
||||
const QString projectName = m_currentBuildStep->project()->name();
|
||||
if (m_currentBuildStep->buildConfiguration()->project() != m_previousBuildStepProject) {
|
||||
const QString projectName = m_currentBuildStep->buildConfiguration()->project()->name();
|
||||
addToOutputWindow(tr("<b>Running build steps for project %2...</b>")
|
||||
.arg(projectName));
|
||||
m_previousBuildStepProject = m_currentBuildStep->project();
|
||||
m_previousBuildStepProject = m_currentBuildStep->buildConfiguration()->project();
|
||||
}
|
||||
m_watcher.setFuture(QtConcurrent::run(&BuildStep::run, m_currentBuildStep));
|
||||
} else {
|
||||
@@ -346,23 +348,15 @@ void BuildManager::buildQueueAppend(BuildStep * bs)
|
||||
{
|
||||
m_buildQueue.append(bs);
|
||||
++m_maxProgress;
|
||||
incrementActiveBuildSteps(bs->project());
|
||||
incrementActiveBuildSteps(bs->buildConfiguration()->project());
|
||||
}
|
||||
|
||||
void BuildManager::buildProjects(const QList<Project *> &projects, const QList<QString> &configurations)
|
||||
void BuildManager::buildProjects(const QList<BuildConfiguration *> &configurations)
|
||||
{
|
||||
Q_ASSERT(projects.count() == configurations.count());
|
||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
||||
QList<Project *>::const_iterator it, end;
|
||||
end = projects.constEnd();
|
||||
|
||||
for (it = projects.constBegin(); it != end; ++it, ++cit) {
|
||||
if (*cit != QString::null) {
|
||||
BuildConfiguration *bc = (*it)->buildConfiguration(*cit);
|
||||
QList<BuildStep *> buildSteps = bc->buildSteps();
|
||||
foreach (BuildStep *bs, buildSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
foreach(BuildConfiguration *bc, configurations) {
|
||||
QList<BuildStep *> buildSteps = bc->buildSteps();
|
||||
foreach (BuildStep *bs, buildSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
}
|
||||
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
||||
@@ -370,20 +364,12 @@ void BuildManager::buildProjects(const QList<Project *> &projects, const QList<Q
|
||||
startBuildQueue();
|
||||
}
|
||||
|
||||
void BuildManager::cleanProjects(const QList<Project *> &projects, const QList<QString> &configurations)
|
||||
void BuildManager::cleanProjects(const QList<BuildConfiguration *> &configurations)
|
||||
{
|
||||
Q_ASSERT(projects.count() == configurations.count());
|
||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
||||
QList<Project *>::const_iterator it, end;
|
||||
end = projects.constEnd();
|
||||
|
||||
for (it = projects.constBegin(); it != end; ++it, ++cit) {
|
||||
if (*cit != QString::null) {
|
||||
BuildConfiguration *bc = (*it)->buildConfiguration(*cit);
|
||||
QList<BuildStep *> cleanSteps = bc->cleanSteps();
|
||||
foreach (BuildStep *bs, cleanSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
foreach(BuildConfiguration *bc, configurations) {
|
||||
QList<BuildStep *> cleanSteps = bc->cleanSteps();
|
||||
foreach (BuildStep *bs, cleanSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
}
|
||||
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
||||
@@ -391,14 +377,14 @@ void BuildManager::cleanProjects(const QList<Project *> &projects, const QList<Q
|
||||
startBuildQueue();
|
||||
}
|
||||
|
||||
void BuildManager::buildProject(Project *p, const QString &configuration)
|
||||
void BuildManager::buildProject(BuildConfiguration *configuration)
|
||||
{
|
||||
buildProjects(QList<Project *>() << p, QList<QString>() << configuration);
|
||||
buildProjects(QList<BuildConfiguration *>() << configuration);
|
||||
}
|
||||
|
||||
void BuildManager::cleanProject(Project *p, const QString &configuration)
|
||||
void BuildManager::cleanProject(BuildConfiguration *configuration)
|
||||
{
|
||||
cleanProjects(QList<Project *>() << p, QList<QString>() << configuration);
|
||||
cleanProjects(QList<BuildConfiguration *>() << configuration);
|
||||
}
|
||||
|
||||
void BuildManager::appendStep(BuildStep *step)
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace Internal {
|
||||
class BuildStep;
|
||||
class Project;
|
||||
class ProjectExplorerPlugin;
|
||||
class BuildConfiguration;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BuildManager
|
||||
: public QObject
|
||||
@@ -70,10 +71,10 @@ public:
|
||||
void gotoTaskWindow();
|
||||
|
||||
//TODO these should take buildconfiguration object
|
||||
void buildProject(Project *p, const QString &configuration);
|
||||
void buildProjects(const QList<Project *> &projects, const QList<QString> &configurations);
|
||||
void cleanProject(Project *p, const QString &configuration);
|
||||
void cleanProjects(const QList<Project *> &projects, const QList<QString> &configurations);
|
||||
void buildProject(BuildConfiguration *bc);
|
||||
void buildProjects(const QList<BuildConfiguration *> &configurations);
|
||||
void cleanProject(BuildConfiguration *configuration);
|
||||
void cleanProjects(const QList<BuildConfiguration *> &configurations);
|
||||
bool isBuilding(Project *p);
|
||||
|
||||
// Append any build step to the list of build steps (currently only used to add the QMakeStep)
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "gccparser.h"
|
||||
#include "msvcparser.h"
|
||||
#include "qmakeparser.h"
|
||||
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
@@ -65,18 +64,3 @@ ProjectExplorer::IBuildParser * MsvcParserFactory::create(const QString & name)
|
||||
Q_UNUSED(name)
|
||||
return new MsvcParser();
|
||||
}
|
||||
|
||||
QMakeParserFactory::~QMakeParserFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool QMakeParserFactory::canCreate(const QString & name) const
|
||||
{
|
||||
return (name == Constants::BUILD_PARSER_QMAKE);
|
||||
}
|
||||
|
||||
ProjectExplorer::IBuildParser * QMakeParserFactory::create(const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new QMakeParser();
|
||||
}
|
||||
|
||||
@@ -55,16 +55,6 @@ public:
|
||||
virtual ProjectExplorer::IBuildParser * create(const QString & name) const;
|
||||
};
|
||||
|
||||
class QMakeParserFactory : public ProjectExplorer::IBuildParserFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QMakeParserFactory() {}
|
||||
virtual ~QMakeParserFactory();
|
||||
virtual bool canCreate(const QString & name) const;
|
||||
virtual ProjectExplorer::IBuildParser * create(const QString & name) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
|
||||
@@ -37,18 +37,21 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QMargins>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
///
|
||||
/// BuildSettingsPanelFactory
|
||||
// BuildSettingsPanelFactory
|
||||
///
|
||||
|
||||
bool BuildSettingsPanelFactory::supports(Project *project)
|
||||
@@ -62,7 +65,7 @@ IPropertiesPanel *BuildSettingsPanelFactory::createPanel(Project *project)
|
||||
}
|
||||
|
||||
///
|
||||
/// BuildSettingsPanel
|
||||
// BuildSettingsPanel
|
||||
///
|
||||
|
||||
BuildSettingsPanel::BuildSettingsPanel(Project *project) :
|
||||
@@ -92,74 +95,36 @@ QIcon BuildSettingsPanel::icon() const
|
||||
}
|
||||
|
||||
///
|
||||
// BuildSettingsSubWidgets
|
||||
///
|
||||
|
||||
BuildSettingsSubWidgets::~BuildSettingsSubWidgets()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void BuildSettingsSubWidgets::addWidget(const QString &name, QWidget *widget)
|
||||
{
|
||||
QSpacerItem *item = new QSpacerItem(1, 10, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(name);
|
||||
QFont f = label->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() *1.2);
|
||||
label->setFont(f);
|
||||
|
||||
layout()->addItem(item);
|
||||
layout()->addWidget(label);
|
||||
layout()->addWidget(widget);
|
||||
|
||||
m_spacerItems.append(item);
|
||||
m_labels.append(label);
|
||||
m_widgets.append(widget);
|
||||
}
|
||||
|
||||
void BuildSettingsSubWidgets::clear()
|
||||
{
|
||||
foreach(QSpacerItem *item, m_spacerItems)
|
||||
layout()->removeItem(item);
|
||||
qDeleteAll(m_spacerItems);
|
||||
qDeleteAll(m_widgets);
|
||||
qDeleteAll(m_labels);
|
||||
m_widgets.clear();
|
||||
m_labels.clear();
|
||||
m_spacerItems.clear();
|
||||
}
|
||||
|
||||
QList<QWidget *> BuildSettingsSubWidgets::widgets() const
|
||||
{
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
BuildSettingsSubWidgets::BuildSettingsSubWidgets(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
new QVBoxLayout(this);
|
||||
layout()->setMargin(0);
|
||||
}
|
||||
|
||||
///
|
||||
/// BuildSettingsWidget
|
||||
// BuildSettingsWidget
|
||||
///
|
||||
|
||||
BuildSettingsWidget::~BuildSettingsWidget()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
: m_project(project)
|
||||
BuildSettingsWidget::BuildSettingsWidget(Project *project) :
|
||||
m_project(project),
|
||||
m_buildConfiguration(0),
|
||||
m_leftMargin(0)
|
||||
{
|
||||
// Provide some time for our contentsmargins to get updated:
|
||||
QTimer::singleShot(0, this, SLOT(init()));
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::init()
|
||||
{
|
||||
QMargins margins(contentsMargins());
|
||||
m_leftMargin = margins.left();
|
||||
margins.setLeft(0);
|
||||
setContentsMargins(margins);
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setContentsMargins(0, -1, 0, -1);
|
||||
vbox->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
{ // Edit Build Configuration row
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
hbox->setContentsMargins(m_leftMargin, 0, 0, 0);
|
||||
hbox->addWidget(new QLabel(tr("Edit Build Configuration:"), this));
|
||||
m_buildConfigurationComboBox = new QComboBox(this);
|
||||
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
@@ -169,6 +134,8 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
m_addButton->setText(tr("Add"));
|
||||
m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
hbox->addWidget(m_addButton);
|
||||
m_addButtonMenu = new QMenu(this);
|
||||
m_addButton->setMenu(m_addButtonMenu);
|
||||
|
||||
m_removeButton = new QPushButton(this);
|
||||
m_removeButton->setText(tr("Remove"));
|
||||
@@ -182,14 +149,7 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
m_makeActiveLabel->setVisible(false);
|
||||
vbox->addWidget(m_makeActiveLabel);
|
||||
|
||||
m_subWidgets = new BuildSettingsSubWidgets(this);
|
||||
vbox->addWidget(m_subWidgets);
|
||||
|
||||
m_addButtonMenu = new QMenu(this);
|
||||
m_addButton->setMenu(m_addButtonMenu);
|
||||
updateAddButtonMenu();
|
||||
|
||||
m_buildConfiguration = m_project->activeBuildConfiguration()->name();
|
||||
m_buildConfiguration = m_project->activeBuildConfiguration();
|
||||
|
||||
connect(m_makeActiveLabel, SIGNAL(linkActivated(QString)),
|
||||
this, SLOT(makeActive()));
|
||||
@@ -200,8 +160,9 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
connect(m_removeButton, SIGNAL(clicked()),
|
||||
this, SLOT(deleteConfiguration()));
|
||||
|
||||
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
||||
this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
||||
// TODO update on displayNameChange
|
||||
// connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
||||
// this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
||||
|
||||
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SLOT(checkMakeActiveLabel()));
|
||||
@@ -209,19 +170,54 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
if (m_project->buildConfigurationFactory())
|
||||
connect(m_project->buildConfigurationFactory(), SIGNAL(availableCreationTypesChanged()), SLOT(updateAddButtonMenu()));
|
||||
|
||||
updateAddButtonMenu();
|
||||
updateBuildSettings();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::addSubWidget(const QString &name, QWidget *widget)
|
||||
{
|
||||
widget->setContentsMargins(m_leftMargin, 10, 0, 0);
|
||||
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(name);
|
||||
QFont f = label->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.2);
|
||||
label->setFont(f);
|
||||
|
||||
label->setContentsMargins(m_leftMargin, 10, 0, 0);
|
||||
|
||||
layout()->addWidget(label);
|
||||
layout()->addWidget(widget);
|
||||
|
||||
m_labels.append(label);
|
||||
m_subWidgets.append(widget);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::clear()
|
||||
{
|
||||
qDeleteAll(m_subWidgets);
|
||||
m_subWidgets.clear();
|
||||
qDeleteAll(m_labels);
|
||||
m_labels.clear();
|
||||
|
||||
}
|
||||
|
||||
QList<QWidget *> BuildSettingsWidget::subWidgets() const
|
||||
{
|
||||
return m_subWidgets;
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::makeActive()
|
||||
{
|
||||
m_project->setActiveBuildConfiguration(m_project->buildConfiguration(m_buildConfiguration));
|
||||
m_project->setActiveBuildConfiguration(m_buildConfiguration);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::updateAddButtonMenu()
|
||||
{
|
||||
m_addButtonMenu->clear();
|
||||
m_addButtonMenu->addAction(tr("&Clone Selected"),
|
||||
this, SLOT(cloneConfiguration()));
|
||||
this, SLOT(cloneConfiguration()));
|
||||
IBuildConfigurationFactory *factory = m_project->buildConfigurationFactory();
|
||||
if (factory) {
|
||||
foreach (const QString &type, factory->availableCreationTypes()) {
|
||||
@@ -231,17 +227,6 @@ void BuildSettingsWidget::updateAddButtonMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &buildConfiguration)
|
||||
{
|
||||
for (int i=0; i<m_buildConfigurationComboBox->count(); ++i) {
|
||||
if (m_buildConfigurationComboBox->itemData(i).toString() == buildConfiguration) {
|
||||
m_buildConfigurationComboBox->setItemText(i, m_project->buildConfiguration(buildConfiguration)->displayName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BuildSettingsWidget::updateBuildSettings()
|
||||
{
|
||||
// TODO save position, entry from combbox
|
||||
@@ -249,26 +234,26 @@ void BuildSettingsWidget::updateBuildSettings()
|
||||
// Delete old tree items
|
||||
bool blocked = m_buildConfigurationComboBox->blockSignals(true);
|
||||
m_buildConfigurationComboBox->clear();
|
||||
m_subWidgets->clear();
|
||||
clear();
|
||||
|
||||
// update buttons
|
||||
m_removeButton->setEnabled(m_project->buildConfigurations().size() > 1);
|
||||
|
||||
// Add pages
|
||||
BuildConfigWidget *generalConfigWidget = m_project->createConfigWidget();
|
||||
m_subWidgets->addWidget(generalConfigWidget->displayName(), generalConfigWidget);
|
||||
addSubWidget(generalConfigWidget->displayName(), generalConfigWidget);
|
||||
|
||||
m_subWidgets->addWidget(tr("Build Steps"), new BuildStepsPage(m_project));
|
||||
m_subWidgets->addWidget(tr("Clean Steps"), new BuildStepsPage(m_project, true));
|
||||
addSubWidget(tr("Build Steps"), new BuildStepsPage(m_project, false));
|
||||
addSubWidget(tr("Clean Steps"), new BuildStepsPage(m_project, true));
|
||||
|
||||
QList<BuildConfigWidget *> subConfigWidgets = m_project->subConfigWidgets();
|
||||
foreach (BuildConfigWidget *subConfigWidget, subConfigWidgets)
|
||||
m_subWidgets->addWidget(subConfigWidget->displayName(), subConfigWidget);
|
||||
addSubWidget(subConfigWidget->displayName(), subConfigWidget);
|
||||
|
||||
// Add tree items
|
||||
foreach (const BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
m_buildConfigurationComboBox->addItem(bc->displayName(), bc->name());
|
||||
if (bc->name() == m_buildConfiguration)
|
||||
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
m_buildConfigurationComboBox->addItem(bc->displayName(), QVariant::fromValue<BuildConfiguration *>(bc));
|
||||
if (bc == m_buildConfiguration)
|
||||
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
|
||||
}
|
||||
|
||||
@@ -276,24 +261,25 @@ void BuildSettingsWidget::updateBuildSettings()
|
||||
|
||||
// TODO Restore position, entry from combbox
|
||||
// TODO? select entry from combobox ?
|
||||
|
||||
activeBuildConfigurationChanged();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::currentIndexChanged(int index)
|
||||
{
|
||||
m_buildConfiguration = m_buildConfigurationComboBox->itemData(index).toString();
|
||||
m_buildConfiguration = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||
activeBuildConfigurationChanged();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::activeBuildConfigurationChanged()
|
||||
{
|
||||
for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
|
||||
if (m_buildConfigurationComboBox->itemData(i).toString() == m_buildConfiguration) {
|
||||
if (m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>() == m_buildConfiguration) {
|
||||
m_buildConfigurationComboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (QWidget *widget, m_subWidgets->widgets()) {
|
||||
foreach (QWidget *widget, subWidgets()) {
|
||||
if (BuildConfigWidget *buildStepWidget = qobject_cast<BuildConfigWidget*>(widget)) {
|
||||
buildStepWidget->init(m_buildConfiguration);
|
||||
}
|
||||
@@ -304,10 +290,8 @@ void BuildSettingsWidget::activeBuildConfigurationChanged()
|
||||
void BuildSettingsWidget::checkMakeActiveLabel()
|
||||
{
|
||||
m_makeActiveLabel->setVisible(false);
|
||||
if (!m_project->activeBuildConfiguration() || m_project->activeBuildConfiguration()->name() != m_buildConfiguration) {
|
||||
BuildConfiguration *bc = m_project->buildConfiguration(m_buildConfiguration);
|
||||
QTC_ASSERT(bc, return);
|
||||
m_makeActiveLabel->setText(tr("<a href=\"#\">Make %1 active.</a>").arg(bc->displayName()));
|
||||
if (!m_project->activeBuildConfiguration() || m_project->activeBuildConfiguration() != m_buildConfiguration) {
|
||||
m_makeActiveLabel->setText(tr("<a href=\"#\">Make %1 active.</a>").arg(m_buildConfiguration->displayName()));
|
||||
m_makeActiveLabel->setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -316,61 +300,56 @@ void BuildSettingsWidget::createConfiguration()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
const QString &type = action->data().toString();
|
||||
if (m_project->buildConfigurationFactory()->create(type)) {
|
||||
// TODO switching to last buildconfiguration in list might not be what we want
|
||||
m_buildConfiguration = m_project->buildConfigurations().last()->name();
|
||||
BuildConfiguration *bc = m_project->buildConfigurationFactory()->create(type);
|
||||
if (bc) {
|
||||
m_buildConfiguration = bc;
|
||||
updateBuildSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::cloneConfiguration()
|
||||
{
|
||||
const QString configuration = m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toString();
|
||||
cloneConfiguration(configuration);
|
||||
const int index = m_buildConfigurationComboBox->currentIndex();
|
||||
BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||
cloneConfiguration(bc);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::deleteConfiguration()
|
||||
{
|
||||
const QString configuration = m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toString();
|
||||
deleteConfiguration(configuration);
|
||||
const int index = m_buildConfigurationComboBox->currentIndex();
|
||||
BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||
deleteConfiguration(bc);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration)
|
||||
void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfiguration)
|
||||
{
|
||||
if (sourceConfiguration.isEmpty())
|
||||
if (!sourceConfiguration)
|
||||
return;
|
||||
|
||||
QString newBuildConfiguration = QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:"));
|
||||
if (newBuildConfiguration.isEmpty())
|
||||
QString newDisplayName(QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:")));
|
||||
if (newDisplayName.isEmpty())
|
||||
return;
|
||||
|
||||
QString newDisplayName = newBuildConfiguration;
|
||||
QStringList buildConfigurationDisplayNames;
|
||||
foreach(BuildConfiguration *bc, m_project->buildConfigurations())
|
||||
buildConfigurationDisplayNames << bc->displayName();
|
||||
newDisplayName = Project::makeUnique(newDisplayName, buildConfigurationDisplayNames);
|
||||
|
||||
QStringList buildConfigurationNames;
|
||||
foreach(BuildConfiguration *bc, m_project->buildConfigurations())
|
||||
buildConfigurationNames << bc->name();
|
||||
m_buildConfiguration = m_project->buildConfigurationFactory()->clone(sourceConfiguration);
|
||||
m_buildConfiguration->setDisplayName(newDisplayName);
|
||||
m_project->addBuildConfiguration(m_buildConfiguration);
|
||||
|
||||
newBuildConfiguration = Project::makeUnique(newBuildConfiguration, buildConfigurationNames);
|
||||
|
||||
m_project->copyBuildConfiguration(sourceConfiguration, newBuildConfiguration);
|
||||
m_project->setDisplayNameFor(m_project->buildConfiguration(newBuildConfiguration), newDisplayName);
|
||||
|
||||
m_buildConfiguration = newBuildConfiguration;
|
||||
updateBuildSettings();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration)
|
||||
void BuildSettingsWidget::deleteConfiguration(BuildConfiguration *deleteConfiguration)
|
||||
{
|
||||
if (deleteConfiguration.isEmpty() || m_project->buildConfigurations().size() <= 1)
|
||||
if (!deleteConfiguration || m_project->buildConfigurations().size() <= 1)
|
||||
return;
|
||||
|
||||
if (m_project->activeBuildConfiguration()->name() == deleteConfiguration) {
|
||||
if (m_project->activeBuildConfiguration() == deleteConfiguration) {
|
||||
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
if (bc->name() != deleteConfiguration) {
|
||||
if (bc != deleteConfiguration) {
|
||||
m_project->setActiveBuildConfiguration(bc);
|
||||
break;
|
||||
}
|
||||
@@ -378,15 +357,15 @@ void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration
|
||||
}
|
||||
|
||||
if (m_buildConfiguration == deleteConfiguration) {
|
||||
foreach (const BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
if (bc->name() != deleteConfiguration) {
|
||||
m_buildConfiguration = bc->name();
|
||||
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
if (bc != deleteConfiguration) {
|
||||
m_buildConfiguration = bc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_project->removeBuildConfiguration(m_project->buildConfiguration(deleteConfiguration));
|
||||
m_project->removeBuildConfiguration(deleteConfiguration);
|
||||
|
||||
updateBuildSettings();
|
||||
}
|
||||
|
||||
@@ -32,34 +32,22 @@
|
||||
|
||||
#include "iprojectproperties.h"
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QGroupBox>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QMenu;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class BuildConfiguration;
|
||||
class IBuildStepFactory;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class BuildSettingsSubWidgets : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BuildSettingsSubWidgets(QWidget *parent);
|
||||
~BuildSettingsSubWidgets();
|
||||
void clear();
|
||||
void addWidget(const QString &name, QWidget *widget);
|
||||
QList<QWidget *> widgets() const;
|
||||
private:
|
||||
QList<QWidget *> m_widgets;
|
||||
QList<QLabel *> m_labels;
|
||||
QList<QSpacerItem *> m_spacerItems;
|
||||
};
|
||||
|
||||
class BuildSettingsPanelFactory : public IPanelFactory
|
||||
{
|
||||
public:
|
||||
@@ -92,8 +80,11 @@ public:
|
||||
BuildSettingsWidget(Project *project);
|
||||
~BuildSettingsWidget();
|
||||
|
||||
void clear();
|
||||
void addSubWidget(const QString &name, QWidget *widget);
|
||||
QList<QWidget *> subWidgets() const;
|
||||
|
||||
private slots:
|
||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
||||
void updateBuildSettings();
|
||||
void currentIndexChanged(int index);
|
||||
void activeBuildConfigurationChanged();
|
||||
@@ -105,18 +96,25 @@ private slots:
|
||||
void checkMakeActiveLabel();
|
||||
void makeActive();
|
||||
|
||||
void init();
|
||||
|
||||
private:
|
||||
void cloneConfiguration(const QString &toClone);
|
||||
void deleteConfiguration(const QString &toDelete);
|
||||
void cloneConfiguration(BuildConfiguration *toClone);
|
||||
void deleteConfiguration(BuildConfiguration *toDelete);
|
||||
|
||||
Project *m_project;
|
||||
BuildConfiguration *m_buildConfiguration;
|
||||
|
||||
QPushButton *m_addButton;
|
||||
QPushButton *m_removeButton;
|
||||
QComboBox *m_buildConfigurationComboBox;
|
||||
BuildSettingsSubWidgets *m_subWidgets;
|
||||
QString m_buildConfiguration;
|
||||
QMenu *m_addButtonMenu;
|
||||
QLabel *m_makeActiveLabel;
|
||||
|
||||
QList<QWidget *> m_subWidgets;
|
||||
QList<QLabel *> m_labels;
|
||||
|
||||
int m_leftMargin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -36,15 +36,15 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
BuildStep::BuildStep(Project * pro, BuildConfiguration *bc)
|
||||
: m_project(pro), m_buildConfiguration(bc)
|
||||
BuildStep::BuildStep(BuildConfiguration *bc)
|
||||
: m_buildConfiguration(bc)
|
||||
{
|
||||
}
|
||||
|
||||
BuildStep::BuildStep(BuildStep *bs, BuildConfiguration *bc)
|
||||
: m_project(bs->m_project), m_buildConfiguration(bc)
|
||||
: m_buildConfiguration(bc)
|
||||
{
|
||||
|
||||
Q_UNUSED(bs);
|
||||
}
|
||||
|
||||
BuildStep::~BuildStep()
|
||||
@@ -68,11 +68,6 @@ void BuildStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
Q_UNUSED(map)
|
||||
}
|
||||
|
||||
Project *BuildStep::project() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
|
||||
BuildConfiguration *BuildStep::buildConfiguration() const
|
||||
{
|
||||
return m_buildConfiguration;
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#include <QtCore/QFutureInterface>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Project;
|
||||
class BuildConfiguration;
|
||||
|
||||
/*
|
||||
@@ -71,9 +69,8 @@ class BuildStepConfigWidget;
|
||||
class PROJECTEXPLORER_EXPORT BuildStep : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class Project; //for managing BuildConfigurations
|
||||
protected:
|
||||
BuildStep(Project *p, BuildConfiguration *bc);
|
||||
BuildStep(BuildConfiguration *bc);
|
||||
BuildStep(BuildStep *bs, BuildConfiguration *bc);
|
||||
|
||||
public:
|
||||
@@ -110,7 +107,6 @@ public:
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
Project *project() const;
|
||||
BuildConfiguration *buildConfiguration() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -120,7 +116,6 @@ Q_SIGNALS:
|
||||
void addToOutputWindow(const QString &string);
|
||||
|
||||
private:
|
||||
Project *m_project;
|
||||
BuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
@@ -135,10 +130,10 @@ public:
|
||||
/// Called to check wheter this factory can restore the named BuildStep
|
||||
virtual bool canCreate(const QString &name) const = 0;
|
||||
/// Called to restore a buildstep
|
||||
virtual BuildStep *create(Project *pro, BuildConfiguration *bc, const QString &name) const = 0;
|
||||
virtual BuildStep *create(BuildConfiguration *bc, const QString &name) const = 0;
|
||||
/// Called by the add BuildStep action to check which BuildSteps could be added
|
||||
/// to the project by this factory, should return a list of names
|
||||
virtual QStringList canCreateForProject(Project *pro) const = 0;
|
||||
virtual QStringList canCreateForBuildConfiguration(BuildConfiguration *bc) const = 0;
|
||||
/// Called to convert an internal name to a displayName
|
||||
|
||||
/// Called to clone a BuildStep
|
||||
@@ -158,7 +153,7 @@ public:
|
||||
virtual QString displayName() const = 0;
|
||||
|
||||
// This is called to set up the config widget before showing it
|
||||
virtual void init(const QString &buildConfiguration) = 0;
|
||||
virtual void init(BuildConfiguration *bc) = 0;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget
|
||||
|
||||
@@ -28,13 +28,14 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "buildstepspage.h"
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QSignalMapper>
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QMenu>
|
||||
@@ -47,40 +48,11 @@ using namespace ProjectExplorer::Internal;
|
||||
|
||||
BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
|
||||
BuildConfigWidget(),
|
||||
m_pro(project),
|
||||
m_clean(clean)
|
||||
m_clean(clean),
|
||||
m_addButton(0),
|
||||
m_leftMargin(-1)
|
||||
{
|
||||
m_vbox = new QVBoxLayout(this);
|
||||
m_vbox->setContentsMargins(0, 0, 0, 0);
|
||||
m_vbox->setSpacing(0);
|
||||
|
||||
m_noStepsLabel = new QLabel(tr("No Build Steps"), this);
|
||||
m_vbox->addWidget(m_noStepsLabel);
|
||||
|
||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||
m_addButton = new QPushButton(this);
|
||||
m_addButton->setText(clean ? tr("Add clean step") : tr("Add build step"));
|
||||
m_addButton->setMenu(new QMenu(this));
|
||||
hboxLayout->addWidget(m_addButton);
|
||||
|
||||
m_removeButton = new QPushButton(this);
|
||||
m_removeButton->setText(clean ? tr("Remove clean step") : tr("Remove build step"));
|
||||
m_removeButton->setMenu(new QMenu(this));
|
||||
hboxLayout->addWidget(m_removeButton);
|
||||
hboxLayout->addStretch(10);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
m_addButton->setAttribute(Qt::WA_MacSmallSize);
|
||||
m_removeButton->setAttribute(Qt::WA_MacSmallSize);
|
||||
#endif
|
||||
|
||||
m_vbox->addLayout(hboxLayout);
|
||||
|
||||
connect(m_addButton->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateAddBuildStepMenu()));
|
||||
|
||||
connect(m_removeButton->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateRemoveBuildStepMenu()));
|
||||
Q_UNUSED(project);
|
||||
}
|
||||
|
||||
BuildStepsPage::~BuildStepsPage()
|
||||
@@ -110,18 +82,21 @@ QString BuildStepsPage::displayName() const
|
||||
return m_clean ? tr("Clean Steps") : tr("Build Steps");
|
||||
}
|
||||
|
||||
void BuildStepsPage::init(const QString &buildConfiguration)
|
||||
void BuildStepsPage::init(BuildConfiguration *bc)
|
||||
{
|
||||
QTC_ASSERT(bc, return);
|
||||
|
||||
setupUi();
|
||||
|
||||
foreach(BuildStepsWidgetStruct s, m_buildSteps) {
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
}
|
||||
m_buildSteps.clear();
|
||||
|
||||
m_configuration = buildConfiguration;
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
m_configuration = bc;
|
||||
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
const QList<BuildStep *> &steps = m_clean ? m_configuration->cleanSteps() : m_configuration->buildSteps();
|
||||
int i = 0;
|
||||
foreach (BuildStep *bs, steps) {
|
||||
addBuildStepWidget(i, bs);
|
||||
@@ -143,8 +118,8 @@ void BuildStepsPage::updateAddBuildStepMenu()
|
||||
QMap<QString, QPair<QString, IBuildStepFactory *> > map;
|
||||
//Build up a list of possible steps and save map the display names to the (internal) name and factories.
|
||||
QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
foreach (IBuildStepFactory * factory, factories) {
|
||||
QStringList names = factory->canCreateForProject(m_pro);
|
||||
foreach (IBuildStepFactory *factory, factories) {
|
||||
QStringList names = factory->canCreateForBuildConfiguration(m_configuration);
|
||||
foreach (const QString &name, names) {
|
||||
map.insert(factory->displayNameForName(name), QPair<QString, IBuildStepFactory *>(name, factory));
|
||||
}
|
||||
@@ -188,138 +163,144 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step)
|
||||
s.upButton->setIconSize(QSize(10, 10));
|
||||
s.downButton->setIconSize(QSize(10, 10));
|
||||
#endif
|
||||
s.removeButton = new QPushButton(this);
|
||||
s.removeButton->setText(QChar('X'));
|
||||
s.removeButton->setMaximumHeight(22);
|
||||
s.removeButton->setMaximumWidth(22);
|
||||
|
||||
// layout
|
||||
QWidget *toolWidget = new QWidget(s.detailsWidget);
|
||||
toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
s.hbox = new QHBoxLayout(toolWidget);
|
||||
s.hbox->setMargin(0);
|
||||
s.hbox->setSpacing(0);
|
||||
s.hbox->addWidget(s.upButton);
|
||||
s.hbox->addWidget(s.downButton);
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
toolWidget->setLayout(hbox);
|
||||
hbox->setMargin(0);
|
||||
hbox->setSpacing(0);
|
||||
hbox->addWidget(s.upButton);
|
||||
hbox->addWidget(s.downButton);
|
||||
hbox->addWidget(s.removeButton);
|
||||
|
||||
s.detailsWidget->setToolWidget(toolWidget);
|
||||
|
||||
const int leftMargin(qMax(m_leftMargin - toolWidget->width(), 0));
|
||||
s.detailsWidget->setContentsMargins(leftMargin, 0, 0, 1);
|
||||
|
||||
m_buildSteps.insert(pos, s);
|
||||
|
||||
m_vbox->insertWidget(pos, s.detailsWidget);
|
||||
|
||||
connect(s.widget, SIGNAL(updateSummary()),
|
||||
this, SLOT(updateSummary()));
|
||||
|
||||
connect(s.upButton, SIGNAL(clicked()),
|
||||
this, SLOT(upBuildStep()));
|
||||
m_upMapper, SLOT(map()));
|
||||
connect(s.downButton, SIGNAL(clicked()),
|
||||
this, SLOT(downBuildStep()));
|
||||
m_downMapper, SLOT(map()));
|
||||
connect(s.removeButton, SIGNAL(clicked()),
|
||||
m_removeMapper, SLOT(map()));
|
||||
}
|
||||
|
||||
void BuildStepsPage::addBuildStep()
|
||||
{
|
||||
if (QAction *action = qobject_cast<QAction *>(sender())) {
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
QPair<QString, IBuildStepFactory *> pair = m_addBuildStepHash.value(action);
|
||||
BuildStep *newStep = pair.second->create(m_pro, bc, pair.first);
|
||||
int pos = m_clean ? bc->cleanSteps().count() : bc->buildSteps().count();
|
||||
m_clean ? bc->insertCleanStep(pos, newStep) : bc->insertBuildStep(pos, newStep);
|
||||
BuildStep *newStep = pair.second->create(m_configuration, pair.first);
|
||||
int pos = m_clean ? m_configuration->cleanSteps().count() : m_configuration->buildSteps().count();
|
||||
m_clean ? m_configuration->insertCleanStep(pos, newStep) : m_configuration->insertBuildStep(pos, newStep);
|
||||
|
||||
addBuildStepWidget(pos, newStep);
|
||||
const BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||
s.widget->init();
|
||||
s.detailsWidget->setSummaryText(s.widget->summaryText());
|
||||
s.detailsWidget->setExpanded(true);
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::updateRemoveBuildStepMenu()
|
||||
{
|
||||
QMenu *menu = m_removeButton->menu();
|
||||
menu->clear();
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
foreach(BuildStep *step, steps) {
|
||||
QAction *action = menu->addAction(step->displayName());
|
||||
if (step->immutable())
|
||||
action->setEnabled(false);
|
||||
connect(action, SIGNAL(triggered()),
|
||||
this, SLOT(removeBuildStep()));
|
||||
}
|
||||
}
|
||||
|
||||
void BuildStepsPage::removeBuildStep()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (action) {
|
||||
int pos = m_removeButton->menu()->actions().indexOf(action);
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
if (steps.at(pos)->immutable())
|
||||
return;
|
||||
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
m_buildSteps.removeAt(pos);
|
||||
m_clean ? bc->removeCleanStep(pos) : bc->removeBuildStep(pos);
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::upBuildStep()
|
||||
{
|
||||
int pos = -1;
|
||||
QToolButton *tb = qobject_cast<QToolButton *>(sender());
|
||||
if (!tb)
|
||||
return;
|
||||
|
||||
for (int i=0; i<m_buildSteps.count(); ++i) {
|
||||
if (m_buildSteps.at(i).upButton == tb) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos == -1)
|
||||
return;
|
||||
|
||||
stepMoveUp(pos);
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::downBuildStep()
|
||||
{
|
||||
int pos = -1;
|
||||
QToolButton *tb = qobject_cast<QToolButton *>(sender());
|
||||
if (!tb)
|
||||
return;
|
||||
|
||||
for (int i=0; i<m_buildSteps.count(); ++i) {
|
||||
if (m_buildSteps.at(i).downButton == tb) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos == -1)
|
||||
return;
|
||||
|
||||
stepMoveUp(pos + 1);
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::stepMoveUp(int pos)
|
||||
{
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
m_clean ? bc->moveCleanStepUp(pos) : bc->moveBuildStepUp(pos);
|
||||
m_clean ? m_configuration->moveCleanStepUp(pos) : m_configuration->moveBuildStepUp(pos);
|
||||
|
||||
m_vbox->insertWidget(pos - 1, m_buildSteps.at(pos).detailsWidget);
|
||||
|
||||
BuildStepsWidgetStruct tmp = m_buildSteps.at(pos -1);
|
||||
m_buildSteps[pos -1] = m_buildSteps.at(pos);
|
||||
m_buildSteps[pos] = tmp;
|
||||
m_buildSteps.swap(pos - 1, pos);
|
||||
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::stepMoveDown(int pos)
|
||||
{
|
||||
stepMoveUp(pos + 1);
|
||||
}
|
||||
|
||||
void BuildStepsPage::stepRemove(int pos)
|
||||
{
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
m_buildSteps.removeAt(pos);
|
||||
m_clean ? m_configuration->removeCleanStep(pos) : m_configuration->removeBuildStep(pos);
|
||||
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::setupUi()
|
||||
{
|
||||
if (0 != m_addButton)
|
||||
return;
|
||||
|
||||
QMargins margins(contentsMargins());
|
||||
m_leftMargin = margins.left();
|
||||
margins.setLeft(0);
|
||||
setContentsMargins(margins);
|
||||
|
||||
m_upMapper = new QSignalMapper(this);
|
||||
connect(m_upMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(stepMoveUp(int)));
|
||||
m_downMapper = new QSignalMapper(this);
|
||||
connect(m_downMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(stepMoveDown(int)));
|
||||
m_removeMapper = new QSignalMapper(this);
|
||||
connect(m_removeMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(stepRemove(int)));
|
||||
|
||||
m_vbox = new QVBoxLayout(this);
|
||||
m_vbox->setContentsMargins(0, 0, 0, 0);
|
||||
m_vbox->setSpacing(0);
|
||||
|
||||
m_noStepsLabel = new QLabel(tr("No Build Steps"), this);
|
||||
m_noStepsLabel->setContentsMargins(m_leftMargin, 0, 0, 0);
|
||||
m_vbox->addWidget(m_noStepsLabel);
|
||||
|
||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||
hboxLayout->setContentsMargins(m_leftMargin, 4, 0, 0);
|
||||
m_addButton = new QPushButton(this);
|
||||
m_addButton->setText(m_clean ? tr("Add clean step") : tr("Add build step"));
|
||||
m_addButton->setMenu(new QMenu(this));
|
||||
hboxLayout->addWidget(m_addButton);
|
||||
|
||||
hboxLayout->addStretch(10);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
m_addButton->setAttribute(Qt::WA_MacSmallSize);
|
||||
#endif
|
||||
|
||||
m_vbox->addLayout(hboxLayout);
|
||||
|
||||
connect(m_addButton->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateAddBuildStepMenu()));
|
||||
}
|
||||
|
||||
void BuildStepsPage::updateBuildStepButtonsState()
|
||||
{
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
for(int i=0; i<m_buildSteps.count(); ++i) {
|
||||
const QList<BuildStep *> &steps = m_clean ? m_configuration->cleanSteps() : m_configuration->buildSteps();
|
||||
for(int i = 0; i < m_buildSteps.count(); ++i) {
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(i);
|
||||
s.upButton->setEnabled((i>0) && !(steps.at(i)->immutable() && steps.at(i - 1)));
|
||||
s.downButton->setEnabled((i + 1< steps.count()) && !(steps.at(i)->immutable() && steps.at(i + 1)->immutable()));
|
||||
s.removeButton->setEnabled(!steps.at(i)->immutable());
|
||||
m_removeMapper->setMapping(s.removeButton, i);
|
||||
s.upButton->setEnabled((i > 0) && !(steps.at(i)->immutable() && steps.at(i - 1)));
|
||||
m_upMapper->setMapping(s.upButton, i);
|
||||
s.downButton->setEnabled((i + 1 < steps.count()) && !(steps.at(i)->immutable() && steps.at(i + 1)->immutable()));
|
||||
m_downMapper->setMapping(s.downButton, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,18 +34,17 @@
|
||||
#include <utils/detailswidget.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTreeWidgetItem;
|
||||
class QHBoxLayout;
|
||||
class QPushButton;
|
||||
class QAbstractButton;
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
class QVBoxLayout;
|
||||
class QSignalMapper;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Project;
|
||||
class BuildConfiguration;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -59,7 +58,7 @@ struct BuildStepsWidgetStruct
|
||||
Utils::DetailsWidget *detailsWidget;
|
||||
QToolButton *upButton;
|
||||
QToolButton *downButton;
|
||||
QHBoxLayout *hbox;
|
||||
QPushButton *removeButton;
|
||||
};
|
||||
|
||||
class BuildStepsPage : public BuildConfigWidget
|
||||
@@ -71,35 +70,37 @@ public:
|
||||
virtual ~BuildStepsPage();
|
||||
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init(BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void updateAddBuildStepMenu();
|
||||
void addBuildStep();
|
||||
void updateRemoveBuildStepMenu();
|
||||
void removeBuildStep();
|
||||
void upBuildStep();
|
||||
void downBuildStep();
|
||||
void updateSummary();
|
||||
void stepMoveUp(int pos);
|
||||
void stepMoveDown(int pos);
|
||||
void stepRemove(int pos);
|
||||
|
||||
private:
|
||||
void stepMoveUp(int pos);
|
||||
void setupUi();
|
||||
void updateBuildStepButtonsState();
|
||||
void addBuildStepWidget(int pos, BuildStep *step);
|
||||
|
||||
Project *m_pro;
|
||||
QString m_configuration;
|
||||
BuildConfiguration * m_configuration;
|
||||
QHash<QAction *, QPair<QString, ProjectExplorer::IBuildStepFactory *> > m_addBuildStepHash;
|
||||
bool m_clean;
|
||||
|
||||
QList<QHBoxLayout *> m_titleLayouts;
|
||||
QList<BuildStepsWidgetStruct> m_buildSteps;
|
||||
|
||||
QVBoxLayout *m_vbox;
|
||||
|
||||
QLabel *m_noStepsLabel;
|
||||
QPushButton *m_addButton;
|
||||
QPushButton *m_removeButton;
|
||||
|
||||
QSignalMapper *m_upMapper;
|
||||
QSignalMapper *m_downMapper;
|
||||
QSignalMapper *m_removeMapper;
|
||||
|
||||
int m_leftMargin;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/debugginghelper.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
@@ -251,8 +252,9 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
connect(pro, SIGNAL(environmentChanged(QString)),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
// TODO
|
||||
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||
// this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
}
|
||||
|
||||
@@ -279,7 +281,7 @@ QString CustomExecutableRunConfiguration::executable() const
|
||||
{
|
||||
QString exec;
|
||||
if (QDir::isRelativePath(m_executable)) {
|
||||
Environment env = project()->environment(project()->activeBuildConfiguration());
|
||||
Environment env = project()->activeBuildConfiguration()->environment();
|
||||
exec = env.searchInPath(m_executable);
|
||||
} else {
|
||||
exec = m_executable;
|
||||
@@ -328,7 +330,7 @@ QString CustomExecutableRunConfiguration::baseWorkingDirectory() const
|
||||
QString CustomExecutableRunConfiguration::workingDirectory() const
|
||||
{
|
||||
QString wd = m_workingDirectory;
|
||||
QString bd = project()->buildDirectory(project()->activeBuildConfiguration());
|
||||
QString bd = project()->activeBuildConfiguration()->buildDirectory();
|
||||
return wd.replace("$BUILDDIR", QDir::cleanPath(bd));
|
||||
}
|
||||
|
||||
@@ -345,7 +347,7 @@ ProjectExplorer::Environment CustomExecutableRunConfiguration::baseEnvironment()
|
||||
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) {
|
||||
env = ProjectExplorer::Environment::systemEnvironment();
|
||||
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) {
|
||||
env = project()->environment(project()->activeBuildConfiguration());
|
||||
env = project()->activeBuildConfiguration()->environment();
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "processstep.h"
|
||||
#include "buildstep.h"
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -45,8 +46,8 @@ static const char * const PROCESS_WORKINGDIRECTORY = "abstractProcess.workingDir
|
||||
static const char * const PROCESS_ARGUMENTS = "abstractProcess.arguments";
|
||||
static const char * const PROCESS_ENABLED = "abstractProcess.enabled";
|
||||
|
||||
ProcessStep::ProcessStep(Project *pro, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(pro, bc)
|
||||
ProcessStep::ProcessStep(BuildConfiguration *bc)
|
||||
: AbstractProcessStep(bc)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -64,12 +65,12 @@ ProcessStep::ProcessStep(ProcessStep *bs, BuildConfiguration *bc)
|
||||
|
||||
bool ProcessStep::init()
|
||||
{
|
||||
setEnvironment(project()->environment(buildConfiguration()));
|
||||
setEnvironment(buildConfiguration()->environment());
|
||||
QString wd = workingDirectory();
|
||||
if (wd.isEmpty())
|
||||
wd = "$BUILDDIR";
|
||||
|
||||
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", project()->buildDirectory(buildConfiguration())));
|
||||
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", buildConfiguration()->buildDirectory()));
|
||||
AbstractProcessStep::setCommand(m_command);
|
||||
AbstractProcessStep::setEnabled(m_enabled);
|
||||
AbstractProcessStep::setArguments(m_arguments);
|
||||
@@ -200,10 +201,10 @@ bool ProcessStepFactory::canCreate(const QString &name) const
|
||||
return name == "projectexplorer.processstep";
|
||||
}
|
||||
|
||||
BuildStep *ProcessStepFactory::create(Project *pro, BuildConfiguration *bc, const QString &name) const
|
||||
BuildStep *ProcessStepFactory::create(BuildConfiguration *bc, const QString &name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new ProcessStep(pro, bc);
|
||||
return new ProcessStep(bc);
|
||||
}
|
||||
|
||||
BuildStep *ProcessStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
@@ -211,9 +212,9 @@ BuildStep *ProcessStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) cons
|
||||
return new ProcessStep(static_cast<ProcessStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList ProcessStepFactory::canCreateForProject(Project *pro) const
|
||||
QStringList ProcessStepFactory::canCreateForBuildConfiguration(BuildConfiguration *bc) const
|
||||
{
|
||||
Q_UNUSED(pro)
|
||||
Q_UNUSED(bc)
|
||||
return QStringList()<<"projectexplorer.processstep";
|
||||
}
|
||||
QString ProcessStepFactory::displayNameForName(const QString &name) const
|
||||
|
||||
@@ -45,9 +45,9 @@ class ProcessStepFactory : public IBuildStepFactory
|
||||
public:
|
||||
ProcessStepFactory();
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual BuildStep *create(Project *pro, BuildConfiguration *bc, const QString &name) const;
|
||||
virtual BuildStep *create(BuildConfiguration *bc, const QString &name) const;
|
||||
virtual BuildStep *clone(BuildStep *bs, BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(Project *pro) const;
|
||||
virtual QStringList canCreateForBuildConfiguration(BuildConfiguration *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ class ProcessStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProcessStep(Project *pro, BuildConfiguration *bc);
|
||||
ProcessStep(BuildConfiguration *bc);
|
||||
ProcessStep(ProcessStep *bs, BuildConfiguration *bc);
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
|
||||
@@ -74,15 +74,6 @@ QString Project::makeUnique(const QString &preferedName, const QStringList &used
|
||||
|
||||
void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
QStringList buildConfigurationNames;
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations())
|
||||
buildConfigurationNames << bc->name();
|
||||
|
||||
// Check that the internal name is not taken and use a different one otherwise
|
||||
QString configurationName = configuration->name();
|
||||
configurationName = makeUnique(configurationName, buildConfigurationNames);
|
||||
configuration->setName(configurationName);
|
||||
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QString configurationDisplayName = configuration->displayName();
|
||||
QStringList displayNames;
|
||||
@@ -94,7 +85,7 @@ void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
// add it
|
||||
m_buildConfigurationValues.push_back(configuration);
|
||||
|
||||
emit addedBuildConfiguration(this, configuration->name());
|
||||
emit addedBuildConfiguration(this, configuration);
|
||||
}
|
||||
|
||||
void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||
@@ -105,21 +96,10 @@ void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||
|
||||
m_buildConfigurationValues.removeOne(configuration);
|
||||
|
||||
emit removedBuildConfiguration(this, configuration->name());
|
||||
emit removedBuildConfiguration(this, configuration);
|
||||
delete configuration;
|
||||
}
|
||||
|
||||
void Project::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
BuildConfiguration *sourceConfiguration = buildConfiguration(source);
|
||||
if (!sourceConfiguration)
|
||||
return;
|
||||
|
||||
m_buildConfigurationValues.push_back(new BuildConfiguration(dest, sourceConfiguration));
|
||||
|
||||
emit addedBuildConfiguration(this, dest);
|
||||
}
|
||||
|
||||
QList<BuildConfiguration *> Project::buildConfigurations() const
|
||||
{
|
||||
return m_buildConfigurationValues;
|
||||
@@ -144,7 +124,7 @@ bool Project::restoreSettings()
|
||||
if (!restoreSettingsImpl(reader))
|
||||
return false;
|
||||
|
||||
if (m_activeBuildConfiguration.isEmpty() && !m_buildConfigurationValues.isEmpty())
|
||||
if (m_activeBuildConfiguration && !m_buildConfigurationValues.isEmpty())
|
||||
setActiveBuildConfiguration(m_buildConfigurationValues.at(0));
|
||||
|
||||
if (!m_activeRunConfiguration && !m_runConfigurations.isEmpty())
|
||||
@@ -159,47 +139,48 @@ QList<BuildConfigWidget*> Project::subConfigWidgets()
|
||||
|
||||
void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||
{
|
||||
writer.saveValue("activebuildconfiguration", m_activeBuildConfiguration);
|
||||
//save m_values
|
||||
writer.saveValue("project", m_values);
|
||||
const QList<BuildConfiguration *> bcs = buildConfigurations();
|
||||
|
||||
// For compability with older versions the "name" is saved as a string instead of a number
|
||||
writer.saveValue("activebuildconfiguration", QString::number(bcs.indexOf(m_activeBuildConfiguration)));
|
||||
|
||||
//save buildsettings
|
||||
QStringList buildConfigurationNames;
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
QMap<QString, QVariant> temp = bc->toMap();
|
||||
writer.saveValue("buildConfiguration-" + bc->name(), temp);
|
||||
buildConfigurationNames << bc->name();
|
||||
for(int i=0; i < bcs.size(); ++i) {
|
||||
QMap<QString, QVariant> temp = bcs.at(i)->toMap();
|
||||
writer.saveValue("buildConfiguration-" + QString::number(i), temp);
|
||||
buildConfigurationNames << QString::number(i);
|
||||
}
|
||||
writer.saveValue("buildconfigurations", buildConfigurationNames);
|
||||
|
||||
// save each buildstep/buildConfiguration combination
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
for(int i=0; i < bcs.size(); ++i) {
|
||||
QStringList buildStepNames;
|
||||
foreach (BuildStep *buildStep, bc->buildSteps())
|
||||
foreach (BuildStep *buildStep, bcs.at(i)->buildSteps())
|
||||
buildStepNames << buildStep->name();
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-buildsteps", buildStepNames);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-buildsteps", buildStepNames);
|
||||
|
||||
int buildstepnr = 0;
|
||||
foreach (BuildStep *buildStep, bc->buildSteps()) {
|
||||
foreach (BuildStep *buildStep, bcs.at(i)->buildSteps()) {
|
||||
QMap<QString, QVariant> temp;
|
||||
buildStep->storeIntoLocalMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr), temp);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-buildstep" + QString().setNum(buildstepnr), temp);
|
||||
++buildstepnr;
|
||||
}
|
||||
}
|
||||
|
||||
// save each cleanstep/buildConfiguration combination
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
for(int i=0; i < bcs.size(); ++i) {
|
||||
QStringList cleanStepNames;
|
||||
foreach (BuildStep *cleanStep, bc->cleanSteps())
|
||||
foreach (BuildStep *cleanStep, bcs.at(i)->cleanSteps())
|
||||
cleanStepNames << cleanStep->name();
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-cleansteps", cleanStepNames);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-cleansteps", cleanStepNames);
|
||||
|
||||
int cleanstepnr = 0;
|
||||
foreach (BuildStep *cleanStep, bc->cleanSteps()) {
|
||||
foreach (BuildStep *cleanStep, bcs.at(i)->cleanSteps()) {
|
||||
QMap<QString, QVariant> temp;
|
||||
cleanStep->storeIntoLocalMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr), temp);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-cleanstep" + QString().setNum(cleanstepnr), temp);
|
||||
++cleanstepnr;
|
||||
}
|
||||
}
|
||||
@@ -223,24 +204,21 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||
|
||||
bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
{
|
||||
m_activeBuildConfiguration = reader.restoreValue("activebuildconfiguration").toString();
|
||||
|
||||
m_values = reader.restoreValue("project").toMap();
|
||||
|
||||
const QList<IBuildStepFactory *> buildStepFactories =
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
|
||||
// restoring BuldConfigurations from settings
|
||||
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
||||
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
addBuildConfiguration(bc);
|
||||
BuildConfiguration *bc = buildConfigurationFactory()->restore();
|
||||
|
||||
QMap<QString, QVariant> temp =
|
||||
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
||||
bc->setValuesFromMap(temp);
|
||||
|
||||
// Restore build steps
|
||||
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-buildsteps");
|
||||
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildsteps");
|
||||
if(buildStepsValueVariant.isValid()) {
|
||||
int pos = 0;
|
||||
QStringList buildStepNames = buildStepsValueVariant.toStringList();
|
||||
@@ -249,7 +227,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
BuildStep *buildStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(buildStepName)) {
|
||||
buildStep = factory->create(this, bc, buildStepName);
|
||||
buildStep = factory->create(bc, buildStepName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -259,7 +237,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromLocalMap(buildStepValues);
|
||||
bc->insertBuildStep(pos, buildStep);
|
||||
++pos;
|
||||
@@ -267,7 +245,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
}
|
||||
}
|
||||
// Restore clean steps
|
||||
QVariant cleanStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-cleansteps");
|
||||
QVariant cleanStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleansteps");
|
||||
if(cleanStepsValueVariant.isValid()) {
|
||||
int pos = 0;
|
||||
QStringList cleanStepNames = cleanStepsValueVariant.toStringList();
|
||||
@@ -276,7 +254,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
BuildStep *cleanStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(cleanStepName)) {
|
||||
cleanStep = factory->create(this, bc, cleanStepName);
|
||||
cleanStep = factory->create(bc, cleanStepName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -286,13 +264,26 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||
bc->insertCleanStep(pos, cleanStep);
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
addBuildConfiguration(bc);
|
||||
}
|
||||
|
||||
// Set Active Configuration
|
||||
{ // Try restoring the active configuration
|
||||
QString activeConfigurationName = reader.restoreValue("activebuildconfiguration").toString();
|
||||
int index = buildConfigurationNames.indexOf(activeConfigurationName);
|
||||
if (index != -1)
|
||||
m_activeBuildConfiguration = buildConfigurations().at(index);
|
||||
else if (!buildConfigurations().isEmpty())
|
||||
m_activeBuildConfiguration = buildConfigurations().at(0);
|
||||
else
|
||||
m_activeBuildConfiguration = 0;
|
||||
}
|
||||
|
||||
//Build Settings
|
||||
@@ -313,13 +304,14 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
}
|
||||
}
|
||||
if (factory) {
|
||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
||||
buildStep = factory->create(this, bc, buildStepName);
|
||||
bc->insertBuildStep(pos, buildStep);
|
||||
const QList<BuildConfiguration *> &bcs = buildConfigurations();
|
||||
for(int i = 0; i < bcs.size(); ++i) {
|
||||
buildStep = factory->create(bcs.at(i), buildStepName);
|
||||
bcs.at(i)->insertBuildStep(pos, buildStep);
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + QString::number(i) + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromLocalMap(buildStepValues);
|
||||
}
|
||||
++pos;
|
||||
@@ -345,13 +337,14 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
}
|
||||
|
||||
if (factory) {
|
||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
||||
cleanStep = factory->create(this, bc, cleanStepName);
|
||||
bc->insertCleanStep(pos, cleanStep);
|
||||
const QList<BuildConfiguration *> &bcs = buildConfigurations();
|
||||
for (int i = 0; i < bcs.size(); ++i) {
|
||||
cleanStep = factory->create(bcs.at(i), cleanStepName);
|
||||
bcs.at(i)->insertCleanStep(pos, cleanStep);
|
||||
QMap<QString, QVariant> cleanStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromGlobalMap(cleanStepValues);
|
||||
QMap<QString, QVariant> buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + QString::number(i) + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||
}
|
||||
++pos;
|
||||
@@ -392,38 +385,15 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Project::setValue(const QString &name, const QVariant & value)
|
||||
{
|
||||
m_values.insert(name, value);
|
||||
}
|
||||
|
||||
QVariant Project::value(const QString &name) const
|
||||
{
|
||||
QMap<QString, QVariant>::const_iterator it =
|
||||
m_values.find(name);
|
||||
if (it != m_values.constEnd())
|
||||
return it.value();
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
BuildConfiguration *Project::buildConfiguration(const QString &name) const
|
||||
{
|
||||
for (int i = 0; i != m_buildConfigurationValues.size(); ++i)
|
||||
if (m_buildConfigurationValues.at(i)->name() == name)
|
||||
return m_buildConfigurationValues.at(i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BuildConfiguration *Project::activeBuildConfiguration() const
|
||||
{
|
||||
return buildConfiguration(m_activeBuildConfiguration); //TODO
|
||||
return m_activeBuildConfiguration;
|
||||
}
|
||||
|
||||
void Project::setActiveBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
if (m_activeBuildConfiguration != configuration->name() && m_buildConfigurationValues.contains(configuration)) {
|
||||
m_activeBuildConfiguration = configuration->name();
|
||||
if (m_activeBuildConfiguration != configuration && m_buildConfigurationValues.contains(configuration)) {
|
||||
m_activeBuildConfiguration = configuration;
|
||||
emit activeBuildConfigurationChanged();
|
||||
}
|
||||
}
|
||||
@@ -483,23 +453,6 @@ EditorConfiguration *Project::editorConfiguration() const
|
||||
return m_editorConfiguration;
|
||||
}
|
||||
|
||||
void Project::setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName)
|
||||
{
|
||||
if (configuration->displayName() == displayName)
|
||||
return;
|
||||
QString dn = displayName;
|
||||
QStringList displayNames;
|
||||
foreach (BuildConfiguration *bc, m_buildConfigurationValues) {
|
||||
if (bc != configuration)
|
||||
displayNames << bc->displayName();
|
||||
}
|
||||
dn = makeUnique(displayName, displayNames);
|
||||
|
||||
configuration->setDisplayName(displayName);
|
||||
|
||||
emit buildConfigurationDisplayNameChanged(configuration->name());
|
||||
}
|
||||
|
||||
QByteArray Project::predefinedMacros(const QString &) const
|
||||
{
|
||||
return QByteArray();
|
||||
|
||||
@@ -86,19 +86,13 @@ public:
|
||||
// Build configuration
|
||||
void addBuildConfiguration(BuildConfiguration *configuration);
|
||||
void removeBuildConfiguration(BuildConfiguration *configuration);
|
||||
void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
BuildConfiguration *buildConfiguration(const QString & name) const;
|
||||
|
||||
QList<BuildConfiguration *> buildConfigurations() const;
|
||||
// remove and add "QString uniqueConfigurationDisplayName(const QString &proposedName) const" instead
|
||||
void setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName);
|
||||
BuildConfiguration *activeBuildConfiguration() const;
|
||||
void setActiveBuildConfiguration(BuildConfiguration *configuration);
|
||||
|
||||
virtual IBuildConfigurationFactory *buildConfigurationFactory() const = 0;
|
||||
|
||||
void setValue(const QString &name, const QVariant &value);
|
||||
QVariant value(const QString &name) const;
|
||||
|
||||
// Running
|
||||
QList<RunConfiguration *> runConfigurations() const;
|
||||
void addRunConfiguration(RunConfiguration* runConfiguration);
|
||||
@@ -109,9 +103,6 @@ public:
|
||||
|
||||
EditorConfiguration *editorConfiguration() const;
|
||||
|
||||
virtual Environment environment(BuildConfiguration *configuration) const = 0;
|
||||
virtual QString buildDirectory(BuildConfiguration *configuration) const = 0;
|
||||
|
||||
void saveSettings();
|
||||
bool restoreSettings();
|
||||
|
||||
@@ -132,7 +123,6 @@ public:
|
||||
static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
|
||||
signals:
|
||||
void fileListChanged();
|
||||
void buildDirectoryChanged();
|
||||
|
||||
// TODO clean up signal names
|
||||
// might be better to also have
|
||||
@@ -146,12 +136,8 @@ signals:
|
||||
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
|
||||
// This signal is jut there for updating the tree list in the buildsettings wizard
|
||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
||||
void environmentChanged(const QString &buildConfiguration);
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
protected:
|
||||
/* This method is called when the project .user file is saved. Simply call
|
||||
@@ -173,9 +159,8 @@ protected:
|
||||
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
|
||||
|
||||
private:
|
||||
QMap<QString, QVariant> m_values;
|
||||
QList<BuildConfiguration *> m_buildConfigurationValues;
|
||||
QString m_activeBuildConfiguration;
|
||||
BuildConfiguration *m_activeBuildConfiguration;
|
||||
QList<RunConfiguration *> m_runConfigurations;
|
||||
RunConfiguration* m_activeRunConfiguration;
|
||||
EditorConfiguration *m_editorConfiguration;
|
||||
|
||||
@@ -307,7 +307,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
// Build parsers
|
||||
addAutoReleasedObject(new GccParserFactory);
|
||||
addAutoReleasedObject(new MsvcParserFactory);
|
||||
addAutoReleasedObject(new QMakeParserFactory);
|
||||
|
||||
// Settings page
|
||||
addAutoReleasedObject(new ProjectExplorerSettingsPage);
|
||||
@@ -1424,20 +1423,7 @@ void ProjectExplorerPlugin::buildProjectOnly()
|
||||
qDebug() << "ProjectExplorerPlugin::buildProjectOnly";
|
||||
|
||||
if (saveModifiedFiles())
|
||||
buildManager()->buildProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
}
|
||||
|
||||
static QStringList configurations(const QList<Project *> &projects)
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const Project * pro, projects) {
|
||||
if (BuildConfiguration *bc = pro->activeBuildConfiguration()) {
|
||||
result << bc->name();
|
||||
} else {
|
||||
result << QString::null;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
buildManager()->buildProject(d->m_currentProject->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::buildProject()
|
||||
@@ -1446,8 +1432,11 @@ void ProjectExplorerPlugin::buildProject()
|
||||
qDebug() << "ProjectExplorerPlugin::buildProject";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, d->m_session->projectOrder(d->m_currentProject))
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,8 +1446,10 @@ void ProjectExplorerPlugin::buildSession()
|
||||
qDebug() << "ProjectExplorerPlugin::buildSession";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, d->m_session->projectOrder())
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1468,8 +1459,8 @@ void ProjectExplorerPlugin::rebuildProjectOnly()
|
||||
qDebug() << "ProjectExplorerPlugin::rebuildProjectOnly";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
d->m_buildManager->cleanProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
d->m_buildManager->buildProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
d->m_buildManager->cleanProject(d->m_currentProject->activeBuildConfiguration());
|
||||
d->m_buildManager->buildProject(d->m_currentProject->activeBuildConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1479,11 +1470,13 @@ void ProjectExplorerPlugin::rebuildProject()
|
||||
qDebug() << "ProjectExplorerPlugin::rebuildProject";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
const QStringList configs = configurations(projects);
|
||||
const QList<Project *> &projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
|
||||
d->m_buildManager->cleanProjects(projects, configs);
|
||||
d->m_buildManager->buildProjects(projects, configs);
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1494,10 +1487,12 @@ void ProjectExplorerPlugin::rebuildSession()
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
||||
const QStringList configs = configurations(projects);
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
|
||||
d->m_buildManager->cleanProjects(projects, configs);
|
||||
d->m_buildManager->buildProjects(projects, configs);
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1507,7 +1502,7 @@ void ProjectExplorerPlugin::cleanProjectOnly()
|
||||
qDebug() << "ProjectExplorerPlugin::cleanProjectOnly";
|
||||
|
||||
if (saveModifiedFiles())
|
||||
d->m_buildManager->cleanProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
d->m_buildManager->cleanProject(d->m_currentProject->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::cleanProject()
|
||||
@@ -1517,7 +1512,10 @@ void ProjectExplorerPlugin::cleanProject()
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
d->m_buildManager->cleanProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1528,21 +1526,24 @@ void ProjectExplorerPlugin::cleanSession()
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
||||
d->m_buildManager->cleanProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::runProject()
|
||||
{
|
||||
runProjectImpl(startupProject());
|
||||
runProjectImpl(startupProject(), ProjectExplorer::Constants::RUNMODE);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::runProjectContextMenu()
|
||||
{
|
||||
runProjectImpl(d->m_currentProject);
|
||||
runProjectImpl(d->m_currentProject, ProjectExplorer::Constants::RUNMODE);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::runProjectImpl(Project *pro)
|
||||
void ProjectExplorerPlugin::runProjectImpl(Project *pro, QString mode)
|
||||
{
|
||||
if (!pro)
|
||||
return;
|
||||
@@ -1553,16 +1554,21 @@ void ProjectExplorerPlugin::runProjectImpl(Project *pro)
|
||||
return;
|
||||
}
|
||||
if (saveModifiedFiles()) {
|
||||
d->m_runMode = ProjectExplorer::Constants::RUNMODE;
|
||||
d->m_runMode = mode;
|
||||
d->m_delayedRunConfiguration = pro->activeRunConfiguration();
|
||||
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(pro);
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach(Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
|
||||
updateRunAction();
|
||||
}
|
||||
} else {
|
||||
// TODO this ignores RunConfiguration::isEnabled()
|
||||
if (saveModifiedFiles())
|
||||
executeRunConfiguration(pro->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
|
||||
executeRunConfiguration(pro->activeRunConfiguration(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1572,25 +1578,7 @@ void ProjectExplorerPlugin::debugProject()
|
||||
if (!pro || d->m_debuggingRunControl )
|
||||
return;
|
||||
|
||||
if (d->m_projectExplorerSettings.buildBeforeRun && pro->hasBuildSettings()) {
|
||||
if (!pro->activeRunConfiguration()->isEnabled()) {
|
||||
if (!showBuildConfigDialog())
|
||||
return;
|
||||
}
|
||||
if (saveModifiedFiles()) {
|
||||
d->m_runMode = ProjectExplorer::Constants::DEBUGMODE;
|
||||
d->m_delayedRunConfiguration = pro->activeRunConfiguration();
|
||||
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(pro);
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
|
||||
updateRunAction();
|
||||
}
|
||||
} else {
|
||||
// TODO this ignores RunConfiguration::isEnabled()
|
||||
if (saveModifiedFiles())
|
||||
executeRunConfiguration(pro->activeRunConfiguration(), ProjectExplorer::Constants::DEBUGMODE);
|
||||
}
|
||||
runProjectImpl(pro, ProjectExplorer::Constants::DEBUGMODE);
|
||||
}
|
||||
|
||||
bool ProjectExplorerPlugin::showBuildConfigDialog()
|
||||
@@ -1965,14 +1953,14 @@ void ProjectExplorerPlugin::populateBuildConfigurationMenu()
|
||||
d->m_buildConfigurationMenu->clear();
|
||||
if (Project *pro = d->m_currentProject) {
|
||||
const BuildConfiguration *activeBC = pro->activeBuildConfiguration();
|
||||
foreach (const BuildConfiguration *bc, pro->buildConfigurations()) {
|
||||
foreach (BuildConfiguration *bc, pro->buildConfigurations()) {
|
||||
QString displayName = bc->displayName();
|
||||
QAction *act = new QAction(displayName, d->m_buildConfigurationActionGroup);
|
||||
if (debug)
|
||||
qDebug() << "BuildConfiguration " << bc->name() << "active: " << activeBC->name();
|
||||
qDebug() << "BuildConfiguration " << bc->displayName() << "active: " << activeBC->displayName();
|
||||
act->setCheckable(true);
|
||||
act->setChecked(bc == activeBC);
|
||||
act->setData(bc->name());
|
||||
act->setData(QVariant::fromValue(bc));
|
||||
d->m_buildConfigurationMenu->addAction(act);
|
||||
}
|
||||
d->m_buildConfigurationMenu->setEnabled(true);
|
||||
@@ -1986,8 +1974,7 @@ void ProjectExplorerPlugin::buildConfigurationMenuTriggered(QAction *action)
|
||||
if (debug)
|
||||
qDebug() << "ProjectExplorerPlugin::buildConfigurationMenuTriggered";
|
||||
|
||||
d->m_currentProject->setActiveBuildConfiguration(d->m_currentProject->buildConfiguration(
|
||||
action->data().toString()));
|
||||
d->m_currentProject->setActiveBuildConfiguration(action->data().value<BuildConfiguration *>());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::populateRunConfigurationMenu()
|
||||
@@ -2136,9 +2123,6 @@ Internal::ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings
|
||||
return d->m_projectExplorerSettings;
|
||||
}
|
||||
|
||||
// ---------- BuildConfigDialog -----------
|
||||
Q_DECLARE_METATYPE(BuildConfiguration*);
|
||||
|
||||
BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_project(project)
|
||||
@@ -2173,7 +2157,7 @@ BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
||||
RunConfiguration *activeRun = m_project->activeRunConfiguration();
|
||||
foreach (BuildConfiguration *config, m_project->buildConfigurations()) {
|
||||
if (activeRun->isEnabled(config)) {
|
||||
m_configCombo->addItem(config->name(), qVariantFromValue(config));
|
||||
m_configCombo->addItem(config->displayName(), QVariant::fromValue(config));
|
||||
}
|
||||
}
|
||||
if (m_configCombo->count() == 0) {
|
||||
|
||||
@@ -215,7 +215,7 @@ private slots:
|
||||
void currentModeChanged(Core::IMode *mode);
|
||||
|
||||
private:
|
||||
void runProjectImpl(Project *pro);
|
||||
void runProjectImpl(Project *pro, QString mode);
|
||||
void executeRunConfiguration(RunConfiguration *, const QString &mode);
|
||||
bool showBuildConfigDialog();
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ HEADERS += projectexplorer.h \
|
||||
projectexplorersettingspage.h \
|
||||
projectwelcomepage.h \
|
||||
projectwelcomepagewidget.h \
|
||||
qmakeparser.h \
|
||||
baseprojectwizarddialog.h
|
||||
SOURCES += projectexplorer.cpp \
|
||||
projectwindow.cpp \
|
||||
@@ -121,7 +120,6 @@ SOURCES += projectexplorer.cpp \
|
||||
projectwelcomepage.cpp \
|
||||
projectwelcomepagewidget.cpp \
|
||||
corelistenercheckingforrunningbuild.cpp \
|
||||
qmakeparser.cpp \
|
||||
baseprojectwizarddialog.cpp
|
||||
FORMS += processstep.ui \
|
||||
editorsettingspropertiespage.ui \
|
||||
|
||||
@@ -179,7 +179,6 @@ const char * const FORM_MIMETYPE = "application/x-designer";
|
||||
const char * const RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource";
|
||||
|
||||
// build parsers
|
||||
const char * const BUILD_PARSER_QMAKE = "BuildParser.QMake";
|
||||
const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC";
|
||||
const char * const BUILD_PARSER_GCC = "BuildParser.Gcc";
|
||||
const char * const BUILD_PARSER_RVCT = "BuildParser.Rvct";
|
||||
|
||||
@@ -44,28 +44,28 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QBoxLayout>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QTabWidget>
|
||||
#include <QtGui/QTreeWidget>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPaintEvent>
|
||||
#include <QtGui/QMenu>
|
||||
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
namespace {
|
||||
const int ICON_SIZE(64);
|
||||
|
||||
const int ABOVE_HEADING_MARGIN(10);
|
||||
const int ABOVE_CONTENTS_MARGIN(4);
|
||||
const int BELOW_CONTENTS_MARGIN(16);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -84,8 +84,9 @@ public:
|
||||
}
|
||||
void paintEvent(QPaintEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
QPainter p(this);
|
||||
p.fillRect(e->rect(), QBrush(Utils::StyleHelper::borderColor()));
|
||||
p.fillRect(contentsRect(), QBrush(Utils::StyleHelper::borderColor()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -94,7 +95,7 @@ public:
|
||||
///
|
||||
|
||||
PanelsWidget::Panel::Panel(QWidget * w) :
|
||||
iconLabel(0), lineWidget(0), nameLabel(0), panelWidget(w), spacer(0)
|
||||
iconLabel(0), lineWidget(0), nameLabel(0), panelWidget(w)
|
||||
{ }
|
||||
|
||||
PanelsWidget::Panel::~Panel()
|
||||
@@ -103,7 +104,6 @@ PanelsWidget::Panel::~Panel()
|
||||
delete lineWidget;
|
||||
delete nameLabel;
|
||||
// do not delete panelWidget, we do not own it!
|
||||
delete spacer;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -118,16 +118,10 @@ PanelsWidget::PanelsWidget(QWidget *parent) :
|
||||
// side of the screen.
|
||||
m_root->setMaximumWidth(800);
|
||||
// The layout holding the individual panels:
|
||||
m_layout = new QGridLayout;
|
||||
m_layout->setColumnMinimumWidth(0, ICON_SIZE);
|
||||
|
||||
// A helper layout to glue some stretch to the button of
|
||||
// the panel layout:
|
||||
QVBoxLayout * vbox = new QVBoxLayout;
|
||||
vbox->addLayout(m_layout);
|
||||
vbox->addStretch(10);
|
||||
|
||||
m_root->setLayout(vbox);
|
||||
m_layout = new QGridLayout(m_root);
|
||||
m_layout->setColumnMinimumWidth(0, ICON_SIZE + 4);
|
||||
m_layout->setSpacing(0);
|
||||
m_layout->setRowStretch(0, 10);
|
||||
|
||||
// Add horizontal space to the left of our widget:
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
@@ -155,15 +149,17 @@ PanelsWidget::~PanelsWidget()
|
||||
* Add a widget into the grid layout of the PanelsWidget.
|
||||
*
|
||||
* ...
|
||||
* +--------+-------------------------------------------+
|
||||
* | | widget |
|
||||
* +--------+-------------------------------------------+
|
||||
* +--------+-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
||||
* | widget (with contentsmargins adjusted!) |
|
||||
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||
*/
|
||||
void PanelsWidget::addWidget(QWidget *widget)
|
||||
{
|
||||
Panel *p = new Panel(widget);
|
||||
m_layout->addWidget(widget, m_layout->rowCount(), 1);
|
||||
m_panels.append(p);
|
||||
QTC_ASSERT(widget, return);
|
||||
|
||||
const int row(m_layout->rowCount() - 1);
|
||||
m_layout->setRowStretch(row, 0);
|
||||
addPanelWidget(new Panel(widget), row);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -171,52 +167,49 @@ void PanelsWidget::addWidget(QWidget *widget)
|
||||
* layout of the PanelsWidget.
|
||||
*
|
||||
* ...
|
||||
* +--------+-------------------------------------------+
|
||||
* | | spacer |
|
||||
* +--------+-------------------------------------------+
|
||||
* +--------+-------------------------------------------+ ABOVE_HEADING_MARGIN
|
||||
* | icon | name |
|
||||
* + +-------------------------------------------+
|
||||
* | | Line |
|
||||
* + +-------------------------------------------+
|
||||
* | | widget |
|
||||
* +--------+-------------------------------------------+
|
||||
* | | line |
|
||||
* +--------+-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
||||
* | widget (with contentsmargins adjusted!) |
|
||||
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||
*/
|
||||
void PanelsWidget::addWidget(const QString &name, QWidget *widget, const QIcon & icon)
|
||||
{
|
||||
QTC_ASSERT(widget, return);
|
||||
|
||||
Panel *p = new Panel(widget);
|
||||
|
||||
// spacer:
|
||||
const int spacerRow(m_layout->rowCount());
|
||||
p->spacer = new QSpacerItem(1, 10, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_layout->addItem(p->spacer, spacerRow, 1);
|
||||
|
||||
// icon:
|
||||
const int headerRow(spacerRow + 1);
|
||||
const int headerRow(m_layout->rowCount() - 1);
|
||||
m_layout->setRowStretch(headerRow, 0);
|
||||
|
||||
if (!icon.isNull()) {
|
||||
p->iconLabel = new QLabel(m_root);
|
||||
p->iconLabel->setPixmap(icon.pixmap(ICON_SIZE, ICON_SIZE));
|
||||
m_layout->addWidget(p->iconLabel, headerRow, 0, 3, 1, Qt::AlignTop | Qt::AlignHCenter);
|
||||
p->iconLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
|
||||
m_layout->addWidget(p->iconLabel, headerRow, 0, 2, 1, Qt::AlignTop | Qt::AlignHCenter);
|
||||
}
|
||||
|
||||
// name:
|
||||
p->nameLabel = new QLabel(m_root);
|
||||
p->nameLabel->setText(name);
|
||||
p->nameLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
|
||||
QFont f = p->nameLabel->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.4);
|
||||
p->nameLabel->setFont(f);
|
||||
m_layout->addWidget(p->nameLabel, headerRow, 1);
|
||||
m_layout->addWidget(p->nameLabel, headerRow, 1, 1, 1, Qt::AlignBottom | Qt::AlignLeft);
|
||||
|
||||
// line:
|
||||
const int lineRow(headerRow + 1);
|
||||
p->lineWidget = new OnePixelBlackLine(m_root);
|
||||
m_layout->addWidget(p->lineWidget, lineRow, 1);
|
||||
|
||||
// widget:
|
||||
// add the widget:
|
||||
const int widgetRow(lineRow + 1);
|
||||
m_layout->addWidget(p->panelWidget, widgetRow, 1);
|
||||
|
||||
m_panels.append(p);
|
||||
addPanelWidget(p, widgetRow);
|
||||
}
|
||||
|
||||
QWidget *PanelsWidget::rootWidget() const
|
||||
@@ -235,13 +228,24 @@ void PanelsWidget::clear()
|
||||
m_layout->removeWidget(p->nameLabel);
|
||||
if (p->panelWidget)
|
||||
m_layout->removeWidget(p->panelWidget);
|
||||
if (p->spacer)
|
||||
m_layout->removeItem(p->spacer);
|
||||
delete p;
|
||||
}
|
||||
m_panels.clear();
|
||||
}
|
||||
|
||||
void PanelsWidget::addPanelWidget(Panel *panel, int row)
|
||||
{
|
||||
panel->panelWidget->setContentsMargins(m_layout->columnMinimumWidth(0),
|
||||
ABOVE_CONTENTS_MARGIN, 0,
|
||||
BELOW_CONTENTS_MARGIN);
|
||||
m_layout->addWidget(panel->panelWidget, row, 0, 1, 2);
|
||||
|
||||
const int stretchRow(row + 1);
|
||||
m_layout->setRowStretch(stretchRow, 10);
|
||||
|
||||
m_panels.append(panel);
|
||||
}
|
||||
|
||||
////
|
||||
// ActiveConfigurationWidget
|
||||
////
|
||||
@@ -512,7 +516,7 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
|
||||
|
||||
//m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
foreach(const BuildConfiguration *buildConfiguration, p->buildConfigurations())
|
||||
m_comboBox->addItem(buildConfiguration->displayName(), buildConfiguration->name());
|
||||
m_comboBox->addItem(buildConfiguration->displayName(), buildConfiguration);
|
||||
if (p->buildConfigurations().count() == 1) {
|
||||
m_label->setText(m_comboBox->itemText(0));
|
||||
setCurrentWidget(m_label);
|
||||
@@ -522,14 +526,15 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
|
||||
if (index != -1)
|
||||
m_comboBox->setCurrentIndex(index);
|
||||
|
||||
connect(p, SIGNAL(buildConfigurationDisplayNameChanged(QString)),
|
||||
this, SLOT(nameChanged(QString)));
|
||||
// TODO
|
||||
// connect(p, SIGNAL(buildConfigurationDisplayNameChanged(QString)),
|
||||
// this, SLOT(nameChanged(ProjectExplorer::BuildConfiguration *)));
|
||||
connect(p, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SLOT(activeConfigurationChanged()));
|
||||
connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
||||
this, SLOT(addedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
||||
connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
||||
this, SLOT(removedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
||||
connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)),
|
||||
this, SLOT(addedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)));
|
||||
connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)),
|
||||
this, SLOT(removedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)));
|
||||
connect(m_comboBox, SIGNAL(activated(int)),
|
||||
this, SLOT(changedIndex(int)));
|
||||
}
|
||||
@@ -539,28 +544,28 @@ BuildConfigurationComboBox::~BuildConfigurationComboBox()
|
||||
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::nameChanged(const QString &buildConfiguration)
|
||||
void BuildConfigurationComboBox::nameChanged(BuildConfiguration *bc)
|
||||
{
|
||||
int index = nameToIndex(buildConfiguration);
|
||||
const int index(buildConfigurationToIndex(bc));
|
||||
if (index == -1)
|
||||
return;
|
||||
const QString &displayName = m_project->buildConfiguration(buildConfiguration)->displayName();
|
||||
const QString &displayName = bc->displayName();
|
||||
m_comboBox->setItemText(index, displayName);
|
||||
if (m_comboBox->count() == 1)
|
||||
m_label->setText(displayName);
|
||||
}
|
||||
|
||||
int BuildConfigurationComboBox::nameToIndex(const QString &buildConfiguration)
|
||||
int BuildConfigurationComboBox::buildConfigurationToIndex(BuildConfiguration *bc)
|
||||
{
|
||||
for (int i=0; i < m_comboBox->count(); ++i)
|
||||
if (m_comboBox->itemData(i) == buildConfiguration)
|
||||
if (m_comboBox->itemData(i).value<BuildConfiguration *>() == bc)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::activeConfigurationChanged()
|
||||
{
|
||||
int index = nameToIndex(m_project->activeBuildConfiguration()->name());
|
||||
const int index(buildConfigurationToIndex(m_project->activeBuildConfiguration()));
|
||||
if (index == -1)
|
||||
return;
|
||||
ignoreIndexChange = true;
|
||||
@@ -568,20 +573,26 @@ void BuildConfigurationComboBox::activeConfigurationChanged()
|
||||
ignoreIndexChange = false;
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *,const QString &buildConfiguration)
|
||||
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration *bc)
|
||||
{
|
||||
Q_UNUSED(project);
|
||||
ignoreIndexChange = true;
|
||||
m_comboBox->addItem(m_project->buildConfiguration(buildConfiguration)->displayName(), buildConfiguration);
|
||||
m_comboBox->addItem(bc->displayName(), QVariant::fromValue(bc));
|
||||
|
||||
if (m_comboBox->count() == 2)
|
||||
setCurrentWidget(m_comboBox);
|
||||
ignoreIndexChange = false;
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration)
|
||||
void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration * bc)
|
||||
{
|
||||
Q_UNUSED(project);
|
||||
ignoreIndexChange = true;
|
||||
int index = nameToIndex(buildConfiguration);
|
||||
const int index(buildConfigurationToIndex(bc));
|
||||
if (index == -1)
|
||||
return;
|
||||
m_comboBox->removeItem(index);
|
||||
if (m_comboBox->count() == 1) {
|
||||
m_label->setText(m_comboBox->itemText(0));
|
||||
@@ -594,8 +605,7 @@ void BuildConfigurationComboBox::changedIndex(int newIndex)
|
||||
{
|
||||
if (newIndex == -1)
|
||||
return;
|
||||
m_project->setActiveBuildConfiguration(
|
||||
m_project->buildConfiguration(m_comboBox->itemData(newIndex).toString()));
|
||||
m_project->setActiveBuildConfiguration(m_comboBox->itemData(newIndex).value<BuildConfiguration *>());
|
||||
}
|
||||
|
||||
///
|
||||
@@ -719,19 +729,13 @@ ProjectWindow::ProjectWindow(QWidget *parent)
|
||||
m_panelsWidget = new PanelsWidget(this);
|
||||
viewLayout->addWidget(m_panelsWidget);
|
||||
|
||||
// Run and build configuration selection area:
|
||||
// Run and build configuration selection panel:
|
||||
m_activeConfigurationWidget = new ActiveConfigurationWidget(m_panelsWidget->rootWidget());
|
||||
|
||||
// Spacer and line:
|
||||
m_spacerBetween = new QWidget(m_panelsWidget->rootWidget());
|
||||
QVBoxLayout *spacerVbox = new QVBoxLayout(m_spacerBetween);
|
||||
spacerVbox->setMargin(0);
|
||||
m_spacerBetween->setLayout(spacerVbox);
|
||||
spacerVbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
spacerVbox->addWidget(new OnePixelBlackLine(m_spacerBetween));
|
||||
spacerVbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
// Spacer and line panel:
|
||||
m_spacerBetween = new OnePixelBlackLine(m_panelsWidget->rootWidget());
|
||||
|
||||
// Project chooser:
|
||||
// Project chooser panel:
|
||||
m_projectChooser = new QWidget(m_panelsWidget->rootWidget());
|
||||
QHBoxLayout *hbox = new QHBoxLayout(m_projectChooser);
|
||||
hbox->setMargin(0);
|
||||
|
||||
@@ -30,32 +30,26 @@
|
||||
#ifndef PROJECTWINDOW_H
|
||||
#define PROJECTWINDOW_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtCore/QPair>
|
||||
#include <QtGui/QStackedWidget>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QStackedWidget>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QGridLayout;
|
||||
class QModelIndex;
|
||||
class QTabWidget;
|
||||
class QHBoxLayout;
|
||||
class QComboBox;
|
||||
class QMenu;
|
||||
class QSpacerItem;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class IPropertiesPanel;
|
||||
class Project;
|
||||
class ProjectExplorerPlugin;
|
||||
class SessionManager;
|
||||
class BuildConfiguration;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -78,17 +72,18 @@ private:
|
||||
struct Panel
|
||||
{
|
||||
// This does not take ownership of widget!
|
||||
explicit Panel(QWidget * widget);
|
||||
explicit Panel(QWidget *widget);
|
||||
~Panel();
|
||||
|
||||
QLabel *iconLabel;
|
||||
QWidget *lineWidget;
|
||||
QLabel *nameLabel;
|
||||
QWidget *panelWidget;
|
||||
QSpacerItem *spacer;
|
||||
};
|
||||
QList<Panel *> m_panels;
|
||||
|
||||
void addPanelWidget(Panel *panel, int row);
|
||||
|
||||
QGridLayout *m_layout;
|
||||
QWidget *m_root;
|
||||
};
|
||||
@@ -100,13 +95,15 @@ public:
|
||||
BuildConfigurationComboBox(ProjectExplorer::Project *p, QWidget *parent = 0);
|
||||
~BuildConfigurationComboBox();
|
||||
private slots:
|
||||
void nameChanged(const QString &buildConfiguration);
|
||||
void nameChanged(BuildConfiguration *bc);
|
||||
void activeConfigurationChanged();
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration *bc);
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration *bc);
|
||||
void changedIndex(int newIndex);
|
||||
private:
|
||||
int nameToIndex(const QString &buildConfiguration);
|
||||
int buildConfigurationToIndex(BuildConfiguration *bc);
|
||||
bool ignoreIndexChange;
|
||||
ProjectExplorer::Project *m_project;
|
||||
QComboBox *m_comboBox;
|
||||
|
||||
@@ -853,7 +853,6 @@ Project *SessionManager::projectForFile(const QString &fileName) const
|
||||
foreach (Project *p, projectList)
|
||||
if (p != currentProject && projectContainsFile(p, fileName))
|
||||
return p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -666,7 +666,7 @@ static int blockStartState(const QTextBlock &block)
|
||||
return state & 0xff;
|
||||
}
|
||||
|
||||
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedChar)
|
||||
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar /*typedChar*/)
|
||||
{
|
||||
TextEditor::TabSettings ts = tabSettings();
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace QmlEditor {
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool visit(Block *ast)
|
||||
virtual bool visit(Block * /*ast*/)
|
||||
{
|
||||
// TODO
|
||||
// if (_pos > ast->lbraceToken.end() && _pos < ast->rbraceToken.offset) {
|
||||
|
||||
@@ -162,12 +162,6 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
|
||||
QStringList QmlProject::files() const
|
||||
{ return m_files; }
|
||||
|
||||
QString QmlProject::buildParser(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QmlProject::name() const
|
||||
{
|
||||
return m_projectName;
|
||||
@@ -198,18 +192,6 @@ bool QmlProject::hasBuildSettings() const
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment QmlProject::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return ProjectExplorer::Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
QString QmlProject::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return QString();
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *QmlProject::createConfigWidget()
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -71,9 +71,6 @@ public:
|
||||
virtual bool isApplication() const;
|
||||
virtual bool hasBuildSettings() const;
|
||||
|
||||
virtual ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -81,7 +78,6 @@ public:
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
|
||||
QStringList targets() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
enum RefreshOptions {
|
||||
Files = 0x01,
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "embeddedpropertiespage.h"
|
||||
#include "qt4project.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
///
|
||||
/// EmbeddedPropertiesPanelFactory
|
||||
///
|
||||
|
||||
bool EmbeddedPropertiesPanelFactory::supports(Project *project)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
Qt4Project *pro = qobject_cast<Qt4Project *>(project);
|
||||
if (pro) {
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(project)
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectExplorer::IPropertiesPanel *EmbeddedPropertiesPanelFactory::createPanel(
|
||||
ProjectExplorer::Project *project)
|
||||
{
|
||||
return new EmbeddedPropertiesPanel(project);
|
||||
}
|
||||
|
||||
///
|
||||
/// EmbeddedPropertiesPanel
|
||||
///
|
||||
|
||||
EmbeddedPropertiesPanel::EmbeddedPropertiesPanel(ProjectExplorer::Project *project) :
|
||||
m_widget(new EmbeddedPropertiesWidget(project)),
|
||||
m_icon(":/projectexplorer/images/rebuild.png")
|
||||
{
|
||||
}
|
||||
|
||||
EmbeddedPropertiesPanel::~EmbeddedPropertiesPanel()
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
QString EmbeddedPropertiesPanel::name() const
|
||||
{
|
||||
return QApplication::tr("Embedded Linux");
|
||||
}
|
||||
|
||||
QWidget *EmbeddedPropertiesPanel::widget() const
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
QIcon EmbeddedPropertiesPanel::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
///
|
||||
/// EmbeddedPropertiesWidget
|
||||
///
|
||||
|
||||
EmbeddedPropertiesWidget::EmbeddedPropertiesWidget(ProjectExplorer::Project *project)
|
||||
: QWidget()
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
m_ui.virtualBoxCheckbox->setChecked(project->value("useVBOX").toBool());
|
||||
|
||||
// Find all skins
|
||||
QString skin = QFileInfo(project->value("VNCSkin").toString()).fileName();
|
||||
QStringList skins;
|
||||
|
||||
QDir skinDir = QApplication::applicationDirPath();
|
||||
skinDir.cdUp();
|
||||
if (skinDir.cd("qtembeddedtools") && skinDir.cd("qsimplevnc")) {
|
||||
skins = skinDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot );
|
||||
}
|
||||
m_ui.skinComboBox->clear();
|
||||
m_ui.skinComboBox->addItems(skins);
|
||||
if (!skin.isEmpty()) {
|
||||
int index = m_ui.skinComboBox->findText(skin);
|
||||
if (index != -1)
|
||||
m_ui.skinComboBox->setCurrentIndex(index);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(project)
|
||||
#endif
|
||||
//TODO readd finish code
|
||||
/*
|
||||
project->setValue("useVBOX", m_ui.virtualBoxCheckbox->isChecked());
|
||||
|
||||
//Skin
|
||||
QDir skinDir = QApplication::applicationDirPath();
|
||||
skinDir.cdUp();
|
||||
skinDir.cd("qtembeddedtools");
|
||||
skinDir.cd("qsimplevnc");
|
||||
project->setValue("VNCSkin", skinDir.absolutePath() + "/" + m_ui.skinComboBox->currentText() + "/" + m_ui.skinComboBox->currentText());
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
EmbeddedPropertiesWidget::~EmbeddedPropertiesWidget()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<class>EmbeddedPropertiesPage</class>
|
||||
<widget class="QWidget" name="EmbeddedPropertiesPage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>649</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<property name="fieldGrowthPolicy" >
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QCheckBox" name="virtualBoxCheckbox" >
|
||||
<property name="text" >
|
||||
<string>Use Virtual Box
|
||||
Note: This adds the toolchain to the build environment and runs the program inside a virtual machine.
|
||||
It also automatically sets the correct Qt version.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="skinLabel" >
|
||||
<property name="text" >
|
||||
<string>Skin:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="skinComboBox" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "qt4project.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qtversionmanager.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -99,7 +100,8 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
|
||||
const Qt4Project *project = qt4ProjectFor(fileName);
|
||||
// Get the binary either from the current Qt version of the project or Path
|
||||
if (project) {
|
||||
const QtVersion *qtVersion= project->qtVersion(project->activeBuildConfiguration());
|
||||
Qt4BuildConfiguration *qt4bc = project->activeQt4BuildConfiguration();
|
||||
const QtVersion *qtVersion= qt4bc->qtVersion();
|
||||
data->binary = (qtVersion->*commandAccessor)();
|
||||
data->workingDirectory = QFileInfo(project->file()->fileName()).absolutePath();
|
||||
} else {
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "makestep.h"
|
||||
|
||||
#include "qt4project.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -44,8 +45,8 @@ using ExtensionSystem::PluginManager;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
MakeStep::MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(project, bc), m_clean(false)
|
||||
MakeStep::MakeStep(ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc), m_clean(false)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -53,7 +54,7 @@ MakeStep::MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc
|
||||
MakeStep::MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_clean(bs->m_clean),
|
||||
m_makeargs(bs->m_makeargs),
|
||||
m_userArgs(bs->m_userArgs),
|
||||
m_makeCmd(bs->m_makeCmd)
|
||||
{
|
||||
|
||||
@@ -64,6 +65,11 @@ MakeStep::~MakeStep()
|
||||
|
||||
}
|
||||
|
||||
Qt4BuildConfiguration *MakeStep::qt4BuildConfiguration() const
|
||||
{
|
||||
return static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
void MakeStep::setClean(bool clean)
|
||||
{
|
||||
m_clean = clean;
|
||||
@@ -78,7 +84,7 @@ void MakeStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
|
||||
|
||||
void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
m_makeargs = map.value("makeargs").toStringList();
|
||||
m_userArgs = map.value("makeargs").toStringList();
|
||||
m_makeCmd = map.value("makeCmd").toString();
|
||||
if (map.value("clean").isValid() && map.value("clean").toBool())
|
||||
m_clean = true;
|
||||
@@ -87,7 +93,7 @@ void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
|
||||
void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["makeargs"] = m_makeargs;
|
||||
map["makeargs"] = m_userArgs;
|
||||
map["makeCmd"] = m_makeCmd;
|
||||
if (m_clean)
|
||||
map["clean"] = true;
|
||||
@@ -96,15 +102,14 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
|
||||
bool MakeStep::init()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
Environment environment = project()->environment(bc);
|
||||
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
|
||||
Environment environment = bc->environment();
|
||||
setEnvironment(environment);
|
||||
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
|
||||
QString workingDirectory = qt4project->buildDirectory(bc);
|
||||
QString workingDirectory = bc->buildDirectory();
|
||||
setWorkingDirectory(workingDirectory);
|
||||
|
||||
QString makeCmd = qt4project->makeCommand(bc);
|
||||
QString makeCmd = bc->makeCommand();
|
||||
if (!m_makeCmd.isEmpty())
|
||||
makeCmd = m_makeCmd;
|
||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||
@@ -123,17 +128,17 @@ bool MakeStep::init()
|
||||
// we should stop the clean queue
|
||||
// That is mostly so that rebuild works on a alrady clean project
|
||||
setIgnoreReturnValue(m_clean);
|
||||
QStringList args = m_makeargs;
|
||||
QStringList args = m_userArgs;
|
||||
if (!m_clean) {
|
||||
if (!qt4project->defaultMakeTarget(bc).isEmpty())
|
||||
args << qt4project->defaultMakeTarget(bc);
|
||||
if (!bc->defaultMakeTarget().isEmpty())
|
||||
args << bc->defaultMakeTarget();
|
||||
}
|
||||
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
|
||||
// absolute file path
|
||||
// FIXME doing this without the user having a way to override this is rather bad
|
||||
// so we only do it for unix and if the user didn't override the make command
|
||||
// but for now this is the least invasive change
|
||||
ProjectExplorer::ToolChain *toolchain = qt4project->toolChain(bc);
|
||||
ProjectExplorer::ToolChain *toolchain = bc->toolChain();
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType type = ProjectExplorer::ToolChain::UNKNOWN;
|
||||
if (toolchain)
|
||||
@@ -163,7 +168,7 @@ bool MakeStep::init()
|
||||
|
||||
void MakeStep::run(QFutureInterface<bool> & fi)
|
||||
{
|
||||
if (qobject_cast<Qt4Project *>(project())->rootProjectNode()->projectType() == ScriptTemplate) {
|
||||
if (qt4BuildConfiguration()->qt4Project()->rootProjectNode()->projectType() == ScriptTemplate) {
|
||||
fi.reportResult(true);
|
||||
return;
|
||||
}
|
||||
@@ -191,19 +196,19 @@ ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
return new MakeStepConfigWidget(this);
|
||||
}
|
||||
|
||||
QStringList MakeStep::makeArguments()
|
||||
QStringList MakeStep::userArguments()
|
||||
{
|
||||
return m_makeargs;
|
||||
return m_userArgs;
|
||||
}
|
||||
|
||||
void MakeStep::setMakeArguments(const QStringList &arguments)
|
||||
void MakeStep::setUserArguments(const QStringList &arguments)
|
||||
{
|
||||
m_makeargs = arguments;
|
||||
emit changed();
|
||||
m_userArgs = arguments;
|
||||
emit userArgumentsChanged();
|
||||
}
|
||||
|
||||
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
: BuildStepConfigWidget(), m_makeStep(makeStep)
|
||||
: BuildStepConfigWidget(), m_makeStep(makeStep), m_ignoreChange(false)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)),
|
||||
@@ -211,9 +216,9 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
|
||||
this, SLOT(makeArgumentsLineEditTextEdited()));
|
||||
|
||||
connect(makeStep, SIGNAL(changed()),
|
||||
this, SLOT(update()));
|
||||
connect(makeStep->project(), SIGNAL(buildDirectoryChanged()),
|
||||
connect(makeStep, SIGNAL(userArgumentsChanged()),
|
||||
this, SLOT(userArgumentsChanged()));
|
||||
connect(makeStep->buildConfiguration(), SIGNAL(buildDirectoryChanged()),
|
||||
this, SLOT(updateDetails()));
|
||||
|
||||
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
||||
@@ -224,22 +229,20 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
|
||||
void MakeStepConfigWidget::updateMakeOverrideLabel()
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_makeStep->project());
|
||||
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4project->
|
||||
makeCommand(m_makeStep->buildConfiguration())));
|
||||
Qt4BuildConfiguration *qt4bc = m_makeStep->qt4BuildConfiguration();
|
||||
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
Qt4Project *pro = static_cast<Qt4Project *>(m_makeStep->project());
|
||||
ProjectExplorer::BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||
QString workingDirectory = pro->buildDirectory(bc);
|
||||
Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration();
|
||||
QString workingDirectory = bc->buildDirectory();
|
||||
|
||||
QString makeCmd = pro->makeCommand(bc);
|
||||
QString makeCmd = bc->makeCommand();
|
||||
if (!m_makeStep->m_makeCmd.isEmpty())
|
||||
makeCmd = m_makeStep->m_makeCmd;
|
||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||
Environment environment = pro->environment(bc);
|
||||
Environment environment = bc->environment();
|
||||
// Try to detect command in environment
|
||||
QString tmp = environment.searchInPath(makeCmd);
|
||||
if (tmp == QString::null) {
|
||||
@@ -254,9 +257,9 @@ void MakeStepConfigWidget::updateDetails()
|
||||
// FIXME doing this without the user having a way to override this is rather bad
|
||||
// so we only do it for unix and if the user didn't override the make command
|
||||
// but for now this is the least invasive change
|
||||
QStringList args = m_makeStep->makeArguments();
|
||||
QStringList args = m_makeStep->userArguments();
|
||||
ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN;
|
||||
ProjectExplorer::ToolChain *toolChain = pro->toolChain(bc);
|
||||
ProjectExplorer::ToolChain *toolChain = bc->toolChain();
|
||||
if (toolChain)
|
||||
t = toolChain->type();
|
||||
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {
|
||||
@@ -278,9 +281,11 @@ QString MakeStepConfigWidget::displayName() const
|
||||
return m_makeStep->displayName();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::update()
|
||||
void MakeStepConfigWidget::userArgumentsChanged()
|
||||
{
|
||||
init();
|
||||
const QStringList &makeArguments = m_makeStep->userArguments();
|
||||
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::init()
|
||||
@@ -290,7 +295,7 @@ void MakeStepConfigWidget::init()
|
||||
const QString &makeCmd = m_makeStep->m_makeCmd;
|
||||
m_ui.makeLineEdit->setText(makeCmd);
|
||||
|
||||
const QStringList &makeArguments = m_makeStep->makeArguments();
|
||||
const QStringList &makeArguments = m_makeStep->userArguments();
|
||||
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
|
||||
updateDetails();
|
||||
}
|
||||
@@ -303,8 +308,10 @@ void MakeStepConfigWidget::makeLineEditTextEdited()
|
||||
|
||||
void MakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
||||
{
|
||||
m_makeStep->setMakeArguments(
|
||||
m_ignoreChange = true;
|
||||
m_makeStep->setUserArguments(
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
|
||||
m_ignoreChange = false;
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -325,10 +332,10 @@ bool MakeStepFactory::canCreate(const QString & name) const
|
||||
return (name == Constants::MAKESTEP);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::create(ProjectExplorer::Project *pro, ProjectExplorer::BuildConfiguration *bc, const QString & name) const
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::create(ProjectExplorer::BuildConfiguration *bc, const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new MakeStep(static_cast<Qt4Project *>(pro), bc);
|
||||
return new MakeStep(bc);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const
|
||||
@@ -336,9 +343,9 @@ ProjectExplorer::BuildStep *MakeStepFactory::clone(ProjectExplorer::BuildStep *b
|
||||
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
QStringList MakeStepFactory::canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *pro) const
|
||||
{
|
||||
if (qobject_cast<Qt4Project *>(pro))
|
||||
if (qobject_cast<Qt4BuildConfiguration *>(pro))
|
||||
return QStringList() << Constants::MAKESTEP;
|
||||
else
|
||||
return QStringList();
|
||||
|
||||
@@ -43,8 +43,9 @@ class Project;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
|
||||
namespace Internal {
|
||||
class Qt4BuildConfiguration;
|
||||
|
||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -52,12 +53,12 @@ public:
|
||||
MakeStepFactory();
|
||||
virtual ~MakeStepFactory();
|
||||
bool canCreate(const QString & name) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::Project * pro, ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
}
|
||||
} //namespace Internal
|
||||
|
||||
class Qt4Project;
|
||||
|
||||
@@ -67,17 +68,20 @@ class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
friend class MakeStepConfigWidget; // TODO remove this
|
||||
// used to access internal stuff
|
||||
public:
|
||||
MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~MakeStep();
|
||||
|
||||
Internal::Qt4BuildConfiguration *qt4BuildConfiguration() const;
|
||||
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
virtual QString name();
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
QStringList makeArguments();
|
||||
void setMakeArguments(const QStringList &arguments);
|
||||
QStringList userArguments();
|
||||
void setUserArguments(const QStringList &arguments);
|
||||
|
||||
virtual void restoreFromGlobalMap(const QMap<QString, QVariant> &map);
|
||||
|
||||
@@ -87,10 +91,10 @@ public:
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
void userArgumentsChanged();
|
||||
private:
|
||||
bool m_clean;
|
||||
QStringList m_makeargs;
|
||||
QStringList m_userArgs;
|
||||
QString m_makeCmd;
|
||||
};
|
||||
|
||||
@@ -105,13 +109,14 @@ public:
|
||||
private slots:
|
||||
void makeLineEditTextEdited();
|
||||
void makeArgumentsLineEditTextEdited();
|
||||
void update();
|
||||
void updateMakeOverrideLabel();
|
||||
void updateDetails();
|
||||
void userArgumentsChanged();
|
||||
private:
|
||||
Ui::MakeStep m_ui;
|
||||
MakeStep *m_makeStep;
|
||||
QString m_summaryText;
|
||||
bool m_ignoreChange;
|
||||
};
|
||||
|
||||
} // Qt4ProjectManager
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "qt4projectmanager.h"
|
||||
#include "qmakestep.h"
|
||||
#include "makestep.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
@@ -66,9 +67,9 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QtVersionManager::scanMakeFile(directory, m_importVersion->defaultBuildConfig());
|
||||
m_importBuildConfig = result.first;
|
||||
m_additionalArguments = Qt4Project::removeSpecFromArgumentList(result.second);
|
||||
m_additionalArguments = Qt4BuildConfiguration::removeSpecFromArgumentList(result.second);
|
||||
|
||||
QString parsedSpec = Qt4Project::extractSpecFromArgumentList(result.second, directory, m_importVersion);
|
||||
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArgumentList(result.second, directory, m_importVersion);
|
||||
QString versionSpec = m_importVersion->mkspec();
|
||||
|
||||
// Compare mkspecs and add to additional arguments
|
||||
|
||||
@@ -28,10 +28,28 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmakeparser.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "taskwindow.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include <projectexplorer/taskwindow.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
using ProjectExplorer::TaskWindow;
|
||||
|
||||
QMakeParserFactory::~QMakeParserFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool QMakeParserFactory::canCreate(const QString & name) const
|
||||
{
|
||||
return (name == Constants::BUILD_PARSER_QMAKE);
|
||||
}
|
||||
|
||||
ProjectExplorer::IBuildParser * QMakeParserFactory::create(const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new QMakeParser();
|
||||
}
|
||||
|
||||
QMakeParser::QMakeParser()
|
||||
{
|
||||
@@ -39,7 +57,7 @@ QMakeParser::QMakeParser()
|
||||
|
||||
QString QMakeParser::name() const
|
||||
{
|
||||
return QLatin1String(ProjectExplorer::Constants::BUILD_PARSER_QMAKE);
|
||||
return QLatin1String(Qt4ProjectManager::Constants::BUILD_PARSER_QMAKE);
|
||||
}
|
||||
|
||||
void QMakeParser::stdOutput(const QString & line)
|
||||
@@ -57,7 +75,7 @@ void QMakeParser::stdError(const QString & line)
|
||||
lne /* description */,
|
||||
QString() /* filename */,
|
||||
-1 /* linenumber */,
|
||||
Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -30,11 +30,23 @@
|
||||
#ifndef QMAKEPARSER_H
|
||||
#define QMAKEPARSER_H
|
||||
|
||||
#include "ibuildparser.h"
|
||||
#include <projectexplorer/ibuildparser.h>
|
||||
|
||||
#include <QtCore/QRegExp>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QMakeParserFactory : public ProjectExplorer::IBuildParserFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QMakeParserFactory() {}
|
||||
virtual ~QMakeParserFactory();
|
||||
virtual bool canCreate(const QString & name) const;
|
||||
virtual ProjectExplorer::IBuildParser * create(const QString & name) const;
|
||||
};
|
||||
|
||||
|
||||
class QMakeParser : public ProjectExplorer::IBuildParser
|
||||
{
|
||||
@@ -48,6 +60,7 @@ public:
|
||||
private:
|
||||
};
|
||||
|
||||
} // namesapce Interanal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // QMAKEPARSER_H
|
||||
@@ -34,12 +34,11 @@
|
||||
#include "qt4projectmanager.h"
|
||||
#include "makestep.h"
|
||||
#include "qtversionmanager.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@@ -49,16 +48,15 @@ using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
QMakeStep::QMakeStep(Qt4Project *project, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(project, bc), m_pro(project), m_forced(false)
|
||||
QMakeStep::QMakeStep(ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc), m_forced(false)
|
||||
{
|
||||
}
|
||||
|
||||
QMakeStep::QMakeStep(QMakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_pro(bs->m_pro),
|
||||
m_forced(false),
|
||||
m_qmakeArgs(bs->m_qmakeArgs)
|
||||
m_userArgs(bs->m_userArgs)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -67,26 +65,31 @@ QMakeStep::~QMakeStep()
|
||||
{
|
||||
}
|
||||
|
||||
QStringList QMakeStep::arguments()
|
||||
Qt4BuildConfiguration *QMakeStep::qt4BuildConfiguration() const
|
||||
{
|
||||
QStringList additonalArguments = m_qmakeArgs;
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
return static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
QStringList QMakeStep::allArguments()
|
||||
{
|
||||
QStringList additonalArguments = m_userArgs;
|
||||
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
|
||||
QStringList arguments;
|
||||
arguments << project()->file()->fileName();
|
||||
arguments << buildConfiguration()->project()->file()->fileName();
|
||||
arguments << "-r";
|
||||
|
||||
if (!additonalArguments.contains("-spec"))
|
||||
arguments << "-spec" << m_pro->qtVersion(bc)->mkspec();
|
||||
arguments << "-spec" << bc->qtVersion()->mkspec();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
ToolChain::ToolChainType type = m_pro->toolChainType(bc);
|
||||
ToolChain::ToolChainType type = bc->toolChainType();
|
||||
if (type == ToolChain::GCC_MAEMO)
|
||||
arguments << QLatin1String("-unix");
|
||||
#endif
|
||||
|
||||
if (bc->value("buildConfiguration").isValid()) {
|
||||
QStringList configarguments;
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = m_pro->qtVersion(bc)->defaultBuildConfig();
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = bc->qtVersion()->defaultBuildConfig();
|
||||
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt());
|
||||
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
|
||||
configarguments << "CONFIG-=debug_and_release";
|
||||
@@ -110,8 +113,8 @@ QStringList QMakeStep::arguments()
|
||||
|
||||
bool QMakeStep::init()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
const QtVersion *qtVersion = m_pro->qtVersion(bc);
|
||||
Qt4BuildConfiguration *qt4bc = qt4BuildConfiguration();
|
||||
const QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
|
||||
if (!qtVersion->isValid()) {
|
||||
#if defined(Q_WS_MAC)
|
||||
@@ -122,8 +125,8 @@ bool QMakeStep::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList args = arguments();
|
||||
QString workingDirectory = m_pro->buildDirectory(bc);
|
||||
QStringList args = allArguments();
|
||||
QString workingDirectory = qt4bc->buildDirectory();
|
||||
|
||||
QString program = qtVersion->qmakeCommand();
|
||||
|
||||
@@ -132,7 +135,7 @@ bool QMakeStep::init()
|
||||
if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
|
||||
if (qtVersion->qmakeCommand() == qmakePath) {
|
||||
m_needToRunQMake = !m_pro->compareBuildConfigurationToImportFrom(bc, workingDirectory);
|
||||
m_needToRunQMake = !qt4bc->compareToImportFrom(workingDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,15 +148,16 @@ bool QMakeStep::init()
|
||||
setWorkingDirectory(workingDirectory);
|
||||
setCommand(program);
|
||||
setArguments(args);
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
setEnvironment(qt4bc->environment());
|
||||
|
||||
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_QMAKE);
|
||||
setBuildParser(Qt4ProjectManager::Constants::BUILD_PARSER_QMAKE);
|
||||
return AbstractMakeStep::init();
|
||||
}
|
||||
|
||||
void QMakeStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
if (qobject_cast<Qt4Project *>(project())->rootProjectNode()->projectType() == ScriptTemplate) {
|
||||
Qt4Project *pro = qt4BuildConfiguration()->qt4Project();
|
||||
if (pro->rootProjectNode()->projectType() == ScriptTemplate) {
|
||||
fi.reportResult(true);
|
||||
return;
|
||||
}
|
||||
@@ -210,40 +214,40 @@ bool QMakeStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||
return result;
|
||||
}
|
||||
|
||||
void QMakeStep::setQMakeArguments(const QStringList &arguments)
|
||||
void QMakeStep::setUserArguments(const QStringList &arguments)
|
||||
{
|
||||
m_qmakeArgs = arguments;
|
||||
emit changed();
|
||||
m_userArgs = arguments;
|
||||
emit userArgumentsChanged();
|
||||
}
|
||||
|
||||
QStringList QMakeStep::qmakeArguments()
|
||||
QStringList QMakeStep::userArguments()
|
||||
{
|
||||
return m_qmakeArgs;
|
||||
return m_userArgs;
|
||||
}
|
||||
|
||||
void QMakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
m_qmakeArgs = map.value("qmakeArgs").toStringList();
|
||||
m_userArgs = map.value("qmakeArgs").toStringList();
|
||||
AbstractProcessStep::restoreFromLocalMap(map);
|
||||
}
|
||||
|
||||
void QMakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["qmakeArgs"] = m_qmakeArgs;
|
||||
map["qmakeArgs"] = m_userArgs;
|
||||
AbstractProcessStep::storeIntoLocalMap(map);
|
||||
}
|
||||
|
||||
QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
|
||||
: BuildStepConfigWidget(), m_step(step)
|
||||
: BuildStepConfigWidget(), m_step(step), m_ignoreChange(false)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
connect(m_ui.qmakeAdditonalArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
|
||||
this, SLOT(qmakeArgumentsLineEditTextEdited()));
|
||||
connect(m_ui.buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(buildConfigurationChanged()));
|
||||
connect(step, SIGNAL(changed()),
|
||||
this, SLOT(update()));
|
||||
connect(step->project(), SIGNAL(qtVersionChanged(ProjectExplorer::BuildConfiguration *)),
|
||||
this, SLOT(qtVersionChanged(ProjectExplorer::BuildConfiguration *)));
|
||||
connect(step, SIGNAL(userArgumentsChanged()),
|
||||
this, SLOT(userArgumentsChanged()));
|
||||
connect(step->buildConfiguration(), SIGNAL(qtVersionChanged()),
|
||||
this, SLOT(qtVersionChanged()));
|
||||
}
|
||||
|
||||
QString QMakeStepConfigWidget::summaryText() const
|
||||
@@ -251,29 +255,28 @@ QString QMakeStepConfigWidget::summaryText() const
|
||||
return m_summaryText;
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::qtVersionChanged(ProjectExplorer::BuildConfiguration *bc)
|
||||
void QMakeStepConfigWidget::qtVersionChanged()
|
||||
{
|
||||
if (bc == m_step->buildConfiguration()) {
|
||||
updateTitleLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
}
|
||||
updateTitleLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::updateTitleLabel()
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_step->project());
|
||||
const QtVersion *qtVersion = qt4project->qtVersion(m_step->buildConfiguration());
|
||||
Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
|
||||
const QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
if (!qtVersion) {
|
||||
m_summaryText = tr("<b>QMake:</b> No Qt version set. QMake can not be run.");
|
||||
emit updateSummary();
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList args = m_step->arguments();
|
||||
QStringList args = m_step->allArguments();
|
||||
// We don't want the full path to the .pro file
|
||||
int index = args.indexOf(m_step->project()->file()->fileName());
|
||||
const QString projectFileName = m_step->buildConfiguration()->project()->file()->fileName();
|
||||
int index = args.indexOf(projectFileName);
|
||||
if (index != -1)
|
||||
args[index] = QFileInfo(m_step->project()->file()->fileName()).fileName();
|
||||
args[index] = QFileInfo(projectFileName).fileName();
|
||||
|
||||
// And we only use the .pro filename not the full path
|
||||
QString program = QFileInfo(qtVersion->qmakeCommand()).fileName();
|
||||
@@ -284,10 +287,12 @@ void QMakeStepConfigWidget::updateTitleLabel()
|
||||
|
||||
void QMakeStepConfigWidget::qmakeArgumentsLineEditTextEdited()
|
||||
{
|
||||
m_step->setQMakeArguments(
|
||||
m_ignoreChange = true;
|
||||
m_step->setUserArguments(
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui.qmakeAdditonalArgumentsLineEdit->text()));
|
||||
m_ignoreChange = false;
|
||||
|
||||
static_cast<Qt4Project *>(m_step->project())->invalidateCachedTargetInformation();
|
||||
m_step->qt4BuildConfiguration()->qt4Project()->invalidateCachedTargetInformation();
|
||||
updateTitleLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
}
|
||||
@@ -303,12 +308,12 @@ void QMakeStepConfigWidget::buildConfigurationChanged()
|
||||
buildConfiguration = buildConfiguration & ~QtVersion::DebugBuild;
|
||||
}
|
||||
bc->setValue("buildConfiguration", int(buildConfiguration));
|
||||
static_cast<Qt4Project *>(m_step->project())->invalidateCachedTargetInformation();
|
||||
m_step->qt4BuildConfiguration()->qt4Project()->invalidateCachedTargetInformation();
|
||||
updateTitleLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
// TODO if exact parsing is the default, we need to update the code model
|
||||
// and all the Qt4ProFileNodes
|
||||
//static_cast<Qt4Project *>(m_step->project())->update();
|
||||
// m_step->qt4Project()->update();
|
||||
}
|
||||
|
||||
QString QMakeStepConfigWidget::displayName() const
|
||||
@@ -316,14 +321,19 @@ QString QMakeStepConfigWidget::displayName() const
|
||||
return m_step->displayName();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::update()
|
||||
void QMakeStepConfigWidget::userArgumentsChanged()
|
||||
{
|
||||
init();
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->userArguments());
|
||||
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
|
||||
updateTitleLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::init()
|
||||
{
|
||||
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->qmakeArguments());
|
||||
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->userArguments());
|
||||
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
|
||||
ProjectExplorer::BuildConfiguration *bc = m_step->buildConfiguration();
|
||||
bool debug = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt()) & QtVersion::DebugBuild;
|
||||
@@ -334,11 +344,11 @@ void QMakeStepConfigWidget::init()
|
||||
|
||||
void QMakeStepConfigWidget::updateEffectiveQMakeCall()
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_step->project());
|
||||
const QtVersion *qtVersion = qt4project->qtVersion(m_step->buildConfiguration());
|
||||
Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
|
||||
const QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
if (qtVersion) {
|
||||
QString program = QFileInfo(qtVersion->qmakeCommand()).fileName();
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + ProjectExplorer::Environment::joinArgumentList(m_step->arguments()));
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + ProjectExplorer::Environment::joinArgumentList(m_step->allArguments()));
|
||||
} else {
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(tr("No valid Qt version set."));
|
||||
}
|
||||
@@ -361,10 +371,10 @@ bool QMakeStepFactory::canCreate(const QString & name) const
|
||||
return (name == Constants::QMAKESTEP);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *QMakeStepFactory::create(ProjectExplorer::Project * pro, BuildConfiguration *bc, const QString & name) const
|
||||
ProjectExplorer::BuildStep *QMakeStepFactory::create(BuildConfiguration *bc, const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new QMakeStep(static_cast<Qt4Project *>(pro), bc);
|
||||
return new QMakeStep(bc);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *QMakeStepFactory::clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const
|
||||
@@ -372,9 +382,12 @@ ProjectExplorer::BuildStep *QMakeStepFactory::clone(ProjectExplorer::BuildStep *
|
||||
return new QMakeStep(static_cast<QMakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList QMakeStepFactory::canCreateForProject(ProjectExplorer::Project *) const
|
||||
QStringList QMakeStepFactory::canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
return QStringList() << Constants::QMAKESTEP;
|
||||
if (Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(bc))
|
||||
if (!qt4bc->qmakeStep())
|
||||
return QStringList() << Constants::QMAKESTEP;
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString QMakeStepFactory::displayNameForName(const QString &name) const
|
||||
|
||||
@@ -43,8 +43,11 @@ class Project;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
class Qt4Project;
|
||||
|
||||
namespace Internal {
|
||||
class Qt4BuildConfiguration;
|
||||
|
||||
class QMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -52,55 +55,52 @@ public:
|
||||
QMakeStepFactory();
|
||||
virtual ~QMakeStepFactory();
|
||||
bool canCreate(const QString & name) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::Project * pro, ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
}
|
||||
|
||||
class Qt4Project;
|
||||
} // namespace Internal
|
||||
|
||||
|
||||
class QMakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class Qt4Project; // TODO remove
|
||||
// Currently used to access qmakeArgs
|
||||
public:
|
||||
QMakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc);
|
||||
QMakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||
QMakeStep(QMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~QMakeStep();
|
||||
Internal::Qt4BuildConfiguration *qt4BuildConfiguration() const;
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
virtual QString name();
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
QStringList arguments();
|
||||
void setForced(bool b);
|
||||
bool forced();
|
||||
|
||||
QStringList qmakeArguments();
|
||||
void setQMakeArguments(const QStringList &arguments);
|
||||
QStringList allArguments();
|
||||
QStringList userArguments();
|
||||
void setUserArguments(const QStringList &arguments);
|
||||
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
void userArgumentsChanged();
|
||||
|
||||
protected:
|
||||
virtual void processStartupFailed();
|
||||
virtual bool processFinished(int exitCode, QProcess::ExitStatus status);
|
||||
|
||||
private:
|
||||
Qt4Project *m_pro;
|
||||
// last values
|
||||
QStringList m_lastEnv;
|
||||
bool m_forced;
|
||||
bool m_needToRunQMake; // set in init(), read in run()
|
||||
QStringList m_qmakeArgs;
|
||||
QStringList m_userArgs;
|
||||
};
|
||||
|
||||
|
||||
@@ -115,14 +115,15 @@ public:
|
||||
private slots:
|
||||
void qmakeArgumentsLineEditTextEdited();
|
||||
void buildConfigurationChanged();
|
||||
void update();
|
||||
void qtVersionChanged(ProjectExplorer::BuildConfiguration *bc);
|
||||
void userArgumentsChanged();
|
||||
void qtVersionChanged();
|
||||
private:
|
||||
void updateTitleLabel();
|
||||
void updateEffectiveQMakeCall();
|
||||
Ui::QMakeStep m_ui;
|
||||
QMakeStep *m_step;
|
||||
QString m_summaryText;
|
||||
bool m_ignoreChange;
|
||||
};
|
||||
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "maemotoolchain.h"
|
||||
#include "profilereader.h"
|
||||
#include "qt4project.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
@@ -260,11 +261,6 @@ MaemoRunConfiguration::MaemoRunConfiguration(Project *project,
|
||||
connect(project, SIGNAL(activeBuildConfigurationChanged()), this,
|
||||
SLOT(invalidateCachedTargetInformation()));
|
||||
|
||||
connect(project, SIGNAL(targetInformationChanged()), this,
|
||||
SLOT(invalidateCachedSimulatorInformation()));
|
||||
connect(project, SIGNAL(activeBuildConfigurationChanged()), this,
|
||||
SLOT(invalidateCachedSimulatorInformation()));
|
||||
|
||||
qemu = new QProcess(this);
|
||||
connect(qemu, SIGNAL(error(QProcess::ProcessError)), &dumper,
|
||||
SLOT(printToStream(QProcess::ProcessError)));
|
||||
@@ -296,10 +292,9 @@ Qt4Project *MaemoRunConfiguration::project() const
|
||||
|
||||
bool MaemoRunConfiguration::isEnabled() const
|
||||
{
|
||||
Qt4Project *qt4Project = qobject_cast<Qt4Project*>(project());
|
||||
QTC_ASSERT(qt4Project, return false);
|
||||
ToolChain::ToolChainType type =
|
||||
qt4Project->toolChainType(qt4Project->activeBuildConfiguration());
|
||||
Qt4BuildConfiguration *qt4bc = project()->activeQt4BuildConfiguration();
|
||||
QTC_ASSERT(qt4bc, return false);
|
||||
ToolChain::ToolChainType type = qt4bc->toolChainType();
|
||||
return type == ToolChain::GCC_MAEMO;
|
||||
}
|
||||
|
||||
@@ -355,8 +350,8 @@ void MaemoRunConfiguration::wasDeployed()
|
||||
|
||||
bool MaemoRunConfiguration::hasDebuggingHelpers() const
|
||||
{
|
||||
return project()->qtVersion(project()->activeBuildConfiguration())
|
||||
->hasDebuggingHelper();
|
||||
Qt4BuildConfiguration *qt4bc = project()->activeQt4BuildConfiguration();
|
||||
return qt4bc->qtVersion()->hasDebuggingHelper();
|
||||
}
|
||||
|
||||
bool MaemoRunConfiguration::debuggingHelpersNeedDeployment() const
|
||||
@@ -411,10 +406,10 @@ const QString MaemoRunConfiguration::cmd(const QString &cmdName) const
|
||||
|
||||
const MaemoToolChain *MaemoRunConfiguration::toolchain() const
|
||||
{
|
||||
Qt4Project *qt4Project = qobject_cast<Qt4Project *>(project());
|
||||
QTC_ASSERT(qt4Project != 0, return 0);
|
||||
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
|
||||
QTC_ASSERT(qt4bc, return 0);
|
||||
MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>(
|
||||
qt4Project->toolChain(qt4Project->activeBuildConfiguration()) );
|
||||
qt4bc->toolChain() );
|
||||
QTC_ASSERT(tc != 0, return 0);
|
||||
return tc;
|
||||
}
|
||||
@@ -429,7 +424,7 @@ const QString MaemoRunConfiguration::gdbCmd() const
|
||||
QString MaemoRunConfiguration::maddeRoot() const
|
||||
{
|
||||
if (const MaemoToolChain *tc = toolchain())
|
||||
tc->maddeRoot();
|
||||
return tc->maddeRoot();
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -447,8 +442,8 @@ const QStringList MaemoRunConfiguration::arguments() const
|
||||
|
||||
const QString MaemoRunConfiguration::dumperLib() const
|
||||
{
|
||||
return project()->qtVersion(project()->activeBuildConfiguration())->
|
||||
debuggingHelperLibrary();
|
||||
Qt4BuildConfiguration *qt4bc = project()->activeQt4BuildConfiguration();
|
||||
return qt4bc->qtVersion()->debuggingHelperLibrary();
|
||||
}
|
||||
|
||||
QString MaemoRunConfiguration::executable() const
|
||||
@@ -543,7 +538,8 @@ void MaemoRunConfiguration::updateTarget()
|
||||
m_executable = QString::null;
|
||||
m_cachedTargetInformationValid = true;
|
||||
|
||||
if (Qt4Project *qt4Project = static_cast<Qt4Project *>(project())) {
|
||||
if (Qt4Project *qt4Project = project()) {
|
||||
Qt4BuildConfiguration *qt4bc = qt4Project->activeQt4BuildConfiguration();
|
||||
Qt4PriFileNode * priFileNode = qt4Project->rootProjectNode()
|
||||
->findProFileFor(m_proFilePath);
|
||||
if (!priFileNode) {
|
||||
@@ -551,8 +547,7 @@ void MaemoRunConfiguration::updateTarget()
|
||||
return;
|
||||
}
|
||||
|
||||
QtVersion *qtVersion =
|
||||
qt4Project->qtVersion(qt4Project->activeBuildConfiguration());
|
||||
QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
ProFileReader *reader = priFileNode->createProFileReader();
|
||||
reader->setCumulative(false);
|
||||
reader->setQtVersion(qtVersion);
|
||||
@@ -600,8 +595,7 @@ void MaemoRunConfiguration::updateTarget()
|
||||
QFileInfo(project()->file()->fileName()).absoluteDir();
|
||||
QString relSubDir =
|
||||
baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path());
|
||||
QDir baseBuildDirectory =
|
||||
project()->buildDirectory(project()->activeBuildConfiguration());
|
||||
QDir baseBuildDirectory = qt4bc->buildDirectory();
|
||||
QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
|
||||
|
||||
if (!reader->contains("DESTDIR")) {
|
||||
@@ -1137,11 +1131,10 @@ const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
|
||||
bool AbstractMaemoRunControl::setProcessEnvironment(QProcess &process)
|
||||
{
|
||||
QTC_ASSERT(runConfig, return false);
|
||||
Qt4Project *qt4Project = qobject_cast<Qt4Project *>(runConfig->project());
|
||||
QTC_ASSERT(qt4Project, return false);
|
||||
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(runConfig->project()->activeBuildConfiguration());
|
||||
QTC_ASSERT(qt4bc, return false);
|
||||
Environment env = Environment::systemEnvironment();
|
||||
qt4Project->toolChain(qt4Project->activeBuildConfiguration())
|
||||
->addToEnvironment(env);
|
||||
qt4bc->toolChain()->addToEnvironment(env);
|
||||
process.setEnvironment(env.toStringList());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -37,9 +37,11 @@
|
||||
#include "s60runconfigbluetoothstarter.h"
|
||||
#include "bluetoothlistener_gui.h"
|
||||
#include "serialdevicelister.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -54,10 +56,18 @@
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
static const int PROGRESS_PACKAGECREATED = 100;
|
||||
static const int PROGRESS_PACKAGESIGNED = 200;
|
||||
static const int PROGRESS_DEPLOYBASE = 200;
|
||||
static const int PROGRESS_PACKAGEDEPLOYED = 300;
|
||||
static const int PROGRESS_PACKAGEINSTALLED = 400;
|
||||
static const int PROGRESS_MAX = 400;
|
||||
|
||||
// Format information about a file
|
||||
static QString lsFile(const QString &f)
|
||||
{
|
||||
@@ -98,6 +108,11 @@ S60DeviceRunConfiguration::~S60DeviceRunConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
Qt4Project *S60DeviceRunConfiguration::qt4Project() const
|
||||
{
|
||||
return static_cast<Qt4Project *>(project());
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::type() const
|
||||
{
|
||||
return QLatin1String("Qt4ProjectManager.DeviceRunConfiguration");
|
||||
@@ -106,21 +121,22 @@ QString S60DeviceRunConfiguration::type() const
|
||||
ProjectExplorer::ToolChain::ToolChainType S60DeviceRunConfiguration::toolChainType(
|
||||
ProjectExplorer::BuildConfiguration *configuration) const
|
||||
{
|
||||
if (const Qt4Project *pro = qobject_cast<const Qt4Project*>(project()))
|
||||
return pro->toolChainType(configuration);
|
||||
if (Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(configuration))
|
||||
return bc->toolChainType();
|
||||
return ProjectExplorer::ToolChain::INVALID;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType S60DeviceRunConfiguration::toolChainType() const
|
||||
{
|
||||
if (const Qt4Project *pro = qobject_cast<const Qt4Project*>(project()))
|
||||
return pro->toolChainType(pro->activeBuildConfiguration());
|
||||
if (Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration()))
|
||||
return bc->toolChainType();
|
||||
return ProjectExplorer::ToolChain::INVALID;
|
||||
}
|
||||
|
||||
bool S60DeviceRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const
|
||||
{
|
||||
const ToolChain::ToolChainType type = toolChainType(configuration);
|
||||
Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(configuration);
|
||||
const ToolChain::ToolChainType type = qt4bc->toolChainType();
|
||||
return type == ToolChain::GCCE || type == ToolChain::RVCT_ARMV5 || type == ToolChain::RVCT_ARMV6;
|
||||
}
|
||||
|
||||
@@ -243,9 +259,8 @@ QString S60DeviceRunConfiguration::packageFileName() const
|
||||
|
||||
QString S60DeviceRunConfiguration::localExecutableFileName() const
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
|
||||
S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(
|
||||
qt4project->qtVersion(qt4project->activeBuildConfiguration()));
|
||||
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
|
||||
S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(qt4bc->qtVersion());
|
||||
|
||||
QString localExecutable = device.epocRoot;
|
||||
localExecutable += QString::fromLatin1("/epoc32/release/%1/%2/%3.exe")
|
||||
@@ -258,15 +273,15 @@ void S60DeviceRunConfiguration::updateTarget()
|
||||
{
|
||||
if (m_cachedTargetInformationValid)
|
||||
return;
|
||||
Qt4Project *pro = static_cast<Qt4Project *>(project());
|
||||
Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
|
||||
Qt4PriFileNode * priFileNode = qt4Project()->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||
if (!priFileNode) {
|
||||
m_baseFileName = QString::null;
|
||||
m_cachedTargetInformationValid = true;
|
||||
emit targetInformationChanged();
|
||||
return;
|
||||
}
|
||||
QtVersion *qtVersion = pro->qtVersion(pro->activeBuildConfiguration());
|
||||
QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
ProFileReader *reader = priFileNode->createProFileReader();
|
||||
reader->setCumulative(false);
|
||||
reader->setQtVersion(qtVersion);
|
||||
@@ -274,7 +289,7 @@ void S60DeviceRunConfiguration::updateTarget()
|
||||
// Find out what flags we pass on to qmake, this code is duplicated in the qmake step
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion->defaultBuildConfig();
|
||||
QtVersion::QmakeBuildConfigs projectBuildConfiguration =
|
||||
QtVersion::QmakeBuildConfigs(pro->activeBuildConfiguration()->value("buildConfiguration").toInt());
|
||||
QtVersion::QmakeBuildConfigs(qt4bc->value("buildConfiguration").toInt());
|
||||
QStringList addedUserConfigArguments;
|
||||
QStringList removedUserConfigArguments;
|
||||
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
|
||||
@@ -297,7 +312,7 @@ void S60DeviceRunConfiguration::updateTarget()
|
||||
// Extract data
|
||||
const QDir baseProjectDirectory = QFileInfo(project()->file()->fileName()).absoluteDir();
|
||||
const QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path());
|
||||
const QDir baseBuildDirectory = project()->buildDirectory(project()->activeBuildConfiguration());
|
||||
const QDir baseBuildDirectory = qt4bc->buildDirectory();
|
||||
const QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
|
||||
|
||||
// Directory
|
||||
@@ -319,7 +334,7 @@ void S60DeviceRunConfiguration::updateTarget()
|
||||
m_packageTemplateFileName = QDir::cleanPath(
|
||||
m_workingDir + QLatin1Char('/') + m_targetName + QLatin1String("_template.pkg"));
|
||||
|
||||
switch (pro->toolChainType(pro->activeBuildConfiguration())) {
|
||||
switch (qt4bc->toolChainType()) {
|
||||
case ToolChain::GCCE:
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
m_platform = QLatin1String("gcce");
|
||||
@@ -407,7 +422,10 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
|
||||
m_makesis(new QProcess(this)),
|
||||
m_signsis(0),
|
||||
m_launcher(0)
|
||||
{
|
||||
{
|
||||
// connect for automatically reporting the "finished deploy" state to the progress manager
|
||||
connect(this, SIGNAL(finished()), this, SLOT(reportDeployFinished()));
|
||||
|
||||
connect(m_makesis, SIGNAL(readyReadStandardError()),
|
||||
this, SLOT(readStandardError()));
|
||||
connect(m_makesis, SIGNAL(readyReadStandardOutput()),
|
||||
@@ -417,10 +435,10 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
|
||||
connect(m_makesis, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(makesisProcessFinished()));
|
||||
|
||||
Qt4Project *project = qobject_cast<Qt4Project *>(runConfiguration->project());
|
||||
QTC_ASSERT(project, return);
|
||||
|
||||
S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
|
||||
|
||||
Qt4BuildConfiguration *activeBuildConf = s60runConfig->qt4Project()->activeQt4BuildConfiguration();
|
||||
|
||||
QTC_ASSERT(s60runConfig, return);
|
||||
m_toolChain = s60runConfig->toolChainType();
|
||||
m_serialPortName = s60runConfig->serialPortName();
|
||||
@@ -432,18 +450,17 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
|
||||
m_symbianTarget = s60runConfig->symbianTarget();
|
||||
m_packageTemplateFile = s60runConfig->packageTemplateFileName();
|
||||
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
|
||||
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->versionInfo().value("QT_INSTALL_DATA");
|
||||
m_qtDir = activeBuildConf->qtVersion()->versionInfo().value("QT_INSTALL_DATA");
|
||||
m_useCustomSignature = (s60runConfig->signingMode() == S60DeviceRunConfiguration::SignCustom);
|
||||
m_customSignaturePath = s60runConfig->customSignaturePath();
|
||||
m_customKeyPath = s60runConfig->customKeyPath();
|
||||
|
||||
ProjectExplorer::BuildConfiguration *const activeBuildConf = project->activeBuildConfiguration();
|
||||
const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(project->qtVersion(activeBuildConf));
|
||||
const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(activeBuildConf->qtVersion());
|
||||
switch (m_toolChain) {
|
||||
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
|
||||
case ProjectExplorer::ToolChain::RVCT_ARMV6_GNUPOC: {
|
||||
// 'sis' is a make target here. Set up with correct environment
|
||||
ProjectExplorer::ToolChain *toolchain = project->toolChain(activeBuildConf);
|
||||
ProjectExplorer::ToolChain *toolchain = activeBuildConf->toolChain();
|
||||
m_makesisTool = toolchain->makeCommand();
|
||||
m_toolsDirectory = device.epocRoot + QLatin1String("/epoc32/tools");
|
||||
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
|
||||
@@ -484,6 +501,13 @@ S60DeviceRunControlBase::~S60DeviceRunControlBase()
|
||||
|
||||
void S60DeviceRunControlBase::start()
|
||||
{
|
||||
m_deployProgress = new QFutureInterface<void>;
|
||||
Core::ICore::instance()->progressManager()->addTask(m_deployProgress->future(),
|
||||
tr("Deploying"),
|
||||
QLatin1String("Symbian.Deploy"));
|
||||
m_deployProgress->setProgressRange(0, PROGRESS_MAX);
|
||||
m_deployProgress->setProgressValue(0);
|
||||
m_deployProgress->reportStarted();
|
||||
emit started();
|
||||
if (m_serialPortName.isEmpty()) {
|
||||
error(this, tr("There is no device plugged in."));
|
||||
@@ -603,6 +627,7 @@ void S60DeviceRunControlBase::makesisProcessFinished()
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
m_deployProgress->setProgressValue(PROGRESS_PACKAGECREATED);
|
||||
switch (m_toolChain) {
|
||||
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
|
||||
case ProjectExplorer::ToolChain::RVCT_ARMV6_GNUPOC:
|
||||
@@ -644,6 +669,7 @@ void S60DeviceRunControlBase::signsisProcessFinished()
|
||||
stop();
|
||||
emit finished();
|
||||
} else {
|
||||
m_deployProgress->setProgressValue(PROGRESS_PACKAGESIGNED);
|
||||
startDeployment();
|
||||
}
|
||||
}
|
||||
@@ -659,6 +685,7 @@ void S60DeviceRunControlBase::startDeployment()
|
||||
connect(m_launcher, SIGNAL(canNotCloseFile(QString,QString)), this, SLOT(printCloseFileFailed(QString,QString)));
|
||||
connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice()));
|
||||
connect(m_launcher, SIGNAL(canNotInstall(QString,QString)), this, SLOT(printInstallFailed(QString,QString)));
|
||||
connect(m_launcher, SIGNAL(installingFinished()), this, SLOT(printInstallingFinished()));
|
||||
connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int)));
|
||||
connect(m_launcher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
|
||||
|
||||
@@ -727,14 +754,23 @@ void S60DeviceRunControlBase::printCopyingNotice()
|
||||
|
||||
void S60DeviceRunControlBase::printCopyProgress(int progress)
|
||||
{
|
||||
emit addToOutputWindow(this, tr("%1% copied.").arg(progress));
|
||||
m_deployProgress->setProgressValue(PROGRESS_DEPLOYBASE + progress);
|
||||
}
|
||||
|
||||
void S60DeviceRunControlBase::printInstallingNotice()
|
||||
{
|
||||
m_deployProgress->setProgressValue(PROGRESS_PACKAGEDEPLOYED);
|
||||
emit addToOutputWindow(this, tr("Installing application..."));
|
||||
}
|
||||
|
||||
void S60DeviceRunControlBase::printInstallingFinished()
|
||||
{
|
||||
m_deployProgress->setProgressValue(PROGRESS_PACKAGEINSTALLED);
|
||||
m_deployProgress->reportFinished();
|
||||
delete m_deployProgress;
|
||||
m_deployProgress = 0;
|
||||
}
|
||||
|
||||
void S60DeviceRunControlBase::printInstallFailed(const QString &filename, const QString &errorMessage)
|
||||
{
|
||||
emit addToOutputWindow(this, tr("Could not install from package %1 on device: %2").arg(filename, errorMessage));
|
||||
@@ -747,6 +783,15 @@ void S60DeviceRunControlBase::launcherFinished()
|
||||
handleLauncherFinished();
|
||||
}
|
||||
|
||||
void S60DeviceRunControlBase::reportDeployFinished()
|
||||
{
|
||||
if (m_deployProgress) {
|
||||
m_deployProgress->reportFinished();
|
||||
delete m_deployProgress;
|
||||
m_deployProgress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QMessageBox *S60DeviceRunControlBase::createTrkWaitingMessageBox(const QString &port, QWidget *parent)
|
||||
{
|
||||
const QString title = QCoreApplication::translate("Qt4ProjectManager::Internal::S60DeviceRunControlBase",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QFutureInterface>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QMessageBox;
|
||||
@@ -47,6 +48,8 @@ namespace Debugger {
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
class Qt4Project;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
@@ -61,6 +64,8 @@ public:
|
||||
explicit S60DeviceRunConfiguration(ProjectExplorer::Project *project, const QString &proFilePath);
|
||||
~S60DeviceRunConfiguration();
|
||||
|
||||
Qt4Project *qt4Project() const;
|
||||
|
||||
QString type() const;
|
||||
bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
QWidget *configurationWidget();
|
||||
@@ -172,9 +177,11 @@ private slots:
|
||||
void printCopyProgress(int progress);
|
||||
void printInstallingNotice();
|
||||
void printInstallFailed(const QString &filename, const QString &errorMessage);
|
||||
void printInstallingFinished();
|
||||
void launcherFinished();
|
||||
void slotLauncherStateChanged(int);
|
||||
void slotWaitingForTrkClosed();
|
||||
void reportDeployFinished();
|
||||
|
||||
private:
|
||||
bool createPackageFileFromTemplate(QString *errorMessage);
|
||||
@@ -203,6 +210,7 @@ private:
|
||||
QString m_makesisTool;
|
||||
QString m_packageFile;
|
||||
|
||||
QFutureInterface<void> *m_deployProgress;
|
||||
trk::Launcher *m_launcher;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "profilereader.h"
|
||||
#include "s60manager.h"
|
||||
#include "s60devices.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
@@ -47,6 +48,7 @@
|
||||
#include <QtGui/QLineEdit>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
// ======== S60EmulatorRunConfiguration
|
||||
@@ -71,6 +73,11 @@ S60EmulatorRunConfiguration::~S60EmulatorRunConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
Qt4Project *S60EmulatorRunConfiguration::qt4Project() const
|
||||
{
|
||||
return static_cast<Qt4Project *>(project());
|
||||
}
|
||||
|
||||
QString S60EmulatorRunConfiguration::type() const
|
||||
{
|
||||
return "Qt4ProjectManager.EmulatorRunConfiguration";
|
||||
@@ -78,9 +85,9 @@ QString S60EmulatorRunConfiguration::type() const
|
||||
|
||||
bool S60EmulatorRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const
|
||||
{
|
||||
Qt4Project *pro = qobject_cast<Qt4Project*>(project());
|
||||
QTC_ASSERT(pro, return false);
|
||||
ToolChain::ToolChainType type = pro->toolChainType(configuration);
|
||||
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(configuration);
|
||||
QTC_ASSERT(qt4bc, return false);
|
||||
ToolChain::ToolChainType type = qt4bc->toolChainType();
|
||||
return type == ToolChain::WINSCW;
|
||||
}
|
||||
|
||||
@@ -113,23 +120,22 @@ void S60EmulatorRunConfiguration::updateTarget()
|
||||
{
|
||||
if (m_cachedTargetInformationValid)
|
||||
return;
|
||||
Qt4Project *pro = static_cast<Qt4Project *>(project());
|
||||
Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
|
||||
Qt4PriFileNode * priFileNode = qt4Project()->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||
if (!priFileNode) {
|
||||
m_executable = QString::null;
|
||||
m_cachedTargetInformationValid = true;
|
||||
emit targetInformationChanged();
|
||||
return;
|
||||
}
|
||||
QtVersion *qtVersion = pro->qtVersion(pro->activeBuildConfiguration());
|
||||
QtVersion *qtVersion = qt4bc->qtVersion();
|
||||
ProFileReader *reader = priFileNode->createProFileReader();
|
||||
reader->setCumulative(false);
|
||||
reader->setQtVersion(qtVersion);
|
||||
|
||||
// Find out what flags we pass on to qmake, this code is duplicated in the qmake step
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion->defaultBuildConfig();
|
||||
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(pro->activeBuildConfiguration()
|
||||
->value("buildConfiguration").toInt());
|
||||
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(qt4bc->value("buildConfiguration").toInt());
|
||||
QStringList addedUserConfigArguments;
|
||||
QStringList removedUserConfigArguments;
|
||||
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
|
||||
@@ -282,8 +288,7 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
|
||||
{
|
||||
// stuff like the EPOCROOT and EPOCDEVICE env variable
|
||||
Environment env = Environment::systemEnvironment();
|
||||
Project *project = runConfiguration->project();
|
||||
static_cast<Qt4Project *>(project)->toolChain(project->activeBuildConfiguration())->addToEnvironment(env);
|
||||
runConfiguration->qt4Project()->activeQt4BuildConfiguration()->toolChain()->addToEnvironment(env);
|
||||
m_applicationLauncher.setEnvironment(env.toStringList());
|
||||
|
||||
m_executable = runConfiguration->executable();
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace Utils {
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
class Qt4Project;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class S60EmulatorRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
@@ -54,6 +56,8 @@ public:
|
||||
S60EmulatorRunConfiguration(ProjectExplorer::Project *project, const QString &proFilePath);
|
||||
~S60EmulatorRunConfiguration();
|
||||
|
||||
Qt4Project *qt4Project() const;
|
||||
|
||||
QString type() const;
|
||||
bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
QWidget *configurationWidget();
|
||||
|
||||
404
src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
Normal file
404
src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
Normal file
@@ -0,0 +1,404 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "qt4project.h"
|
||||
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace {
|
||||
bool debug = false;
|
||||
}
|
||||
|
||||
namespace {
|
||||
const char * const KEY_QT_VERSION_ID = "QtVersionId";
|
||||
}
|
||||
|
||||
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Project *pro)
|
||||
: BuildConfiguration(pro)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BuildConfiguration *source)
|
||||
: BuildConfiguration(source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Qt4BuildConfiguration::~Qt4BuildConfiguration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Qt4Project *Qt4BuildConfiguration::qt4Project() const
|
||||
{
|
||||
return static_cast<Qt4Project *>(project());
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment Qt4BuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
Environment env = useSystemEnvironment() ? Environment::systemEnvironment() : Environment();
|
||||
qtVersion()->addToEnvironment(env);
|
||||
ToolChain *tc = toolChain();
|
||||
if (tc)
|
||||
tc->addToEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment Qt4BuildConfiguration::environment() const
|
||||
{
|
||||
Environment env = baseEnvironment();
|
||||
env.modify(userEnvironmentChanges());
|
||||
return env;
|
||||
}
|
||||
|
||||
void Qt4BuildConfiguration::setUseSystemEnvironment(bool b)
|
||||
{
|
||||
if (useSystemEnvironment() == b)
|
||||
return;
|
||||
setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
bool Qt4BuildConfiguration::useSystemEnvironment() const
|
||||
{
|
||||
bool b = !(value("clearSystemEnvironment").isValid()
|
||||
&& value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> Qt4BuildConfiguration::userEnvironmentChanges() const
|
||||
{
|
||||
return EnvironmentItem::fromStringList(value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void Qt4BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = EnvironmentItem::toStringList(diff);
|
||||
if (list == value("userEnvironmentChanges").toStringList())
|
||||
return;
|
||||
setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
QString Qt4BuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString workingDirectory;
|
||||
if (value("useShadowBuild").toBool())
|
||||
workingDirectory = value("buildDirectory").toString();
|
||||
if (workingDirectory.isEmpty())
|
||||
workingDirectory = QFileInfo(project()->file()->fileName()).absolutePath();
|
||||
return workingDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *Qt4BuildConfiguration::toolChain() const
|
||||
{
|
||||
ToolChain::ToolChainType tct = toolChainType();
|
||||
return qtVersion()->toolChain(tct);
|
||||
}
|
||||
|
||||
QString Qt4BuildConfiguration::makeCommand() const
|
||||
{
|
||||
ToolChain *tc = toolChain();
|
||||
return tc ? tc->makeCommand() : "make";
|
||||
}
|
||||
|
||||
#ifdef QTCREATOR_WITH_S60
|
||||
static inline QString symbianMakeTarget(QtVersion::QmakeBuildConfig buildConfig,
|
||||
const QString &type)
|
||||
{
|
||||
QString rc = (buildConfig & QtVersion::DebugBuild) ?
|
||||
QLatin1String("debug-") : QLatin1String("release-");
|
||||
rc += type;
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString Qt4BuildConfiguration::defaultMakeTarget() const
|
||||
{
|
||||
#ifdef QTCREATOR_WITH_S60
|
||||
ToolChain *tc = toolChain();
|
||||
if (!tc)
|
||||
return QString::null;
|
||||
const QtVersion::QmakeBuildConfig buildConfig
|
||||
= QtVersion::QmakeBuildConfig(value("buildConfiguration").toInt());
|
||||
|
||||
switch (tc->type()) {
|
||||
case ToolChain::GCCE:
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
return symbianMakeTarget(buildConfig, QLatin1String("gcce"));
|
||||
case ToolChain::RVCT_ARMV5:
|
||||
return symbianMakeTarget(buildConfig, QLatin1String("armv5"));
|
||||
case ToolChain::RVCT_ARMV6:
|
||||
case ToolChain::RVCT_ARMV6_GNUPOC:
|
||||
return symbianMakeTarget(buildConfig, QLatin1String("armv6"));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
QString Qt4BuildConfiguration::qtDir() const
|
||||
{
|
||||
QtVersion *version = qtVersion();
|
||||
if (version)
|
||||
return version->versionInfo().value("QT_INSTALL_DATA");
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
QtVersion *Qt4BuildConfiguration::qtVersion() const
|
||||
{
|
||||
return QtVersionManager::instance()->version(qtVersionId());
|
||||
}
|
||||
|
||||
int Qt4BuildConfiguration::qtVersionId() const
|
||||
{
|
||||
QtVersionManager *vm = QtVersionManager::instance();
|
||||
if (debug)
|
||||
qDebug()<<"Looking for qtVersion ID of "<<displayName();
|
||||
int id = 0;
|
||||
QVariant vid = value(KEY_QT_VERSION_ID);
|
||||
if (vid.isValid()) {
|
||||
id = vid.toInt();
|
||||
if (vm->version(id)->isValid()) {
|
||||
return id;
|
||||
} else {
|
||||
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, 0);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// Backward compatibilty, we might have just the name:
|
||||
QString vname = value("QtVersion").toString();
|
||||
if (debug)
|
||||
qDebug()<<" Backward compatibility reading QtVersion"<<vname;
|
||||
if (!vname.isEmpty()) {
|
||||
const QList<QtVersion *> &versions = vm->versions();
|
||||
foreach (const QtVersion * const version, versions) {
|
||||
if (version->name() == vname) {
|
||||
if (debug)
|
||||
qDebug()<<"found name in versions";
|
||||
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, version->uniqueId());
|
||||
return version->uniqueId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug)
|
||||
qDebug()<<" using qtversion with id ="<<id;
|
||||
// Nothing found, reset to default
|
||||
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
void Qt4BuildConfiguration::setQtVersion(int id)
|
||||
{
|
||||
setValue(KEY_QT_VERSION_ID, id);
|
||||
emit qtVersionChanged();
|
||||
qt4Project()->updateActiveRunConfiguration();
|
||||
}
|
||||
|
||||
void Qt4BuildConfiguration::setToolChainType(ProjectExplorer::ToolChain::ToolChainType type)
|
||||
{
|
||||
setValue("ToolChain", (int)type);
|
||||
qt4Project()->updateActiveRunConfiguration();
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType Qt4BuildConfiguration::toolChainType() const
|
||||
{
|
||||
ToolChain::ToolChainType originalType = ToolChain::ToolChainType(value("ToolChain").toInt());
|
||||
ToolChain::ToolChainType type = originalType;
|
||||
const QtVersion *version = qtVersion();
|
||||
if (!version->possibleToolChainTypes().contains(type)) {
|
||||
// Oh no the saved type is not valid for this qt version
|
||||
// use default tool chain
|
||||
type = version->defaultToolchainType();
|
||||
const_cast<Qt4BuildConfiguration *>(this)->setToolChainType(type);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
QMakeStep *Qt4BuildConfiguration::qmakeStep() const
|
||||
{
|
||||
QMakeStep *qs = 0;
|
||||
foreach(BuildStep *bs, buildSteps())
|
||||
if ((qs = qobject_cast<QMakeStep *>(bs)) != 0)
|
||||
return qs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
MakeStep *Qt4BuildConfiguration::makeStep() const
|
||||
{
|
||||
MakeStep *qs = 0;
|
||||
foreach(BuildStep *bs, buildSteps())
|
||||
if ((qs = qobject_cast<MakeStep *>(bs)) != 0)
|
||||
return qs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// returns true if both are equal
|
||||
bool Qt4BuildConfiguration::compareToImportFrom(const QString &workingDirectory)
|
||||
{
|
||||
QMakeStep *qs = qmakeStep();
|
||||
if (QDir(workingDirectory).exists(QLatin1String("Makefile")) && qs) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
|
||||
QtVersion *version = qtVersion();
|
||||
if (version->qmakeCommand() == qmakePath) {
|
||||
// same qtversion
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QtVersionManager::scanMakeFile(workingDirectory, version->defaultBuildConfig());
|
||||
if (QtVersion::QmakeBuildConfig(value("buildConfiguration").toInt()) == result.first) {
|
||||
// The QMake Build Configuration are the same,
|
||||
// now compare arguments lists
|
||||
// we have to compare without the spec/platform cmd argument
|
||||
// and compare that on its own
|
||||
QString actualSpec = extractSpecFromArgumentList(qs->userArguments(), workingDirectory, version);
|
||||
if (actualSpec.isEmpty()) {
|
||||
// Easy one the user has choosen not to override the settings
|
||||
actualSpec = version->mkspec();
|
||||
}
|
||||
|
||||
|
||||
QString parsedSpec = extractSpecFromArgumentList(result.second, workingDirectory, version);
|
||||
QStringList actualArgs = removeSpecFromArgumentList(qs->userArguments());
|
||||
QStringList parsedArgs = removeSpecFromArgumentList(result.second);
|
||||
|
||||
if (debug) {
|
||||
qDebug()<<"Actual args:"<<actualArgs;
|
||||
qDebug()<<"Parsed args:"<<parsedArgs;
|
||||
qDebug()<<"Actual spec:"<<actualSpec;
|
||||
qDebug()<<"Parsed spec:"<<parsedSpec;
|
||||
}
|
||||
|
||||
if (actualArgs == parsedArgs) {
|
||||
// Specs match exactly
|
||||
if (actualSpec == parsedSpec)
|
||||
return true;
|
||||
// Actual spec is the default one
|
||||
// qDebug()<<"AS vs VS"<<actualSpec<<version->mkspec();
|
||||
if ((actualSpec == version->mkspec() || actualSpec == "default")
|
||||
&& (parsedSpec == version->mkspec() || parsedSpec == "default" || parsedSpec.isEmpty()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// We match -spec and -platfrom separetly
|
||||
// We ignore -cache, because qmake contained a bug that it didn't
|
||||
// mention the -cache in the Makefile
|
||||
// That means changing the -cache option in the additional arguments
|
||||
// does not automatically rerun qmake. Alas, we could try more
|
||||
// intelligent matching for -cache, but i guess people rarely
|
||||
// do use that.
|
||||
|
||||
QStringList Qt4BuildConfiguration::removeSpecFromArgumentList(const QStringList &old)
|
||||
{
|
||||
if (!old.contains("-spec") && !old.contains("-platform") && !old.contains("-cache"))
|
||||
return old;
|
||||
QStringList newList;
|
||||
bool ignoreNext = false;
|
||||
foreach(const QString &item, old) {
|
||||
if (ignoreNext) {
|
||||
ignoreNext = false;
|
||||
} else if (item == "-spec" || item == "-platform" || item == "-cache") {
|
||||
ignoreNext = true;
|
||||
} else {
|
||||
newList << item;
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
QString Qt4BuildConfiguration::extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version)
|
||||
{
|
||||
int index = list.indexOf("-spec");
|
||||
if (index == -1)
|
||||
index = list.indexOf("-platform");
|
||||
if (index == -1)
|
||||
return QString();
|
||||
|
||||
++index;
|
||||
|
||||
if (index >= list.length())
|
||||
return QString();
|
||||
|
||||
QString baseMkspecDir = version->versionInfo().value("QMAKE_MKSPECS");
|
||||
if (baseMkspecDir.isEmpty())
|
||||
baseMkspecDir = version->versionInfo().value("QT_INSTALL_DATA") + "/mkspecs";
|
||||
|
||||
QString parsedSpec = QDir::cleanPath(list.at(index));
|
||||
#ifdef Q_OS_WIN
|
||||
baseMkspecDir = baseMkspecDir.toLower();
|
||||
parsedSpec = parsedSpec.toLower();
|
||||
#endif
|
||||
// if the path is relative it can be
|
||||
// relative to the working directory (as found in the Makefiles)
|
||||
// or relatively to the mkspec directory
|
||||
// if it is the former we need to get the canonical form
|
||||
// for the other one we don't need to do anything
|
||||
if (QFileInfo(parsedSpec).isRelative()) {
|
||||
if(QFileInfo(directory + "/" + parsedSpec).exists()) {
|
||||
parsedSpec = QDir::cleanPath(directory + "/" + parsedSpec);
|
||||
#ifdef Q_OS_WIN
|
||||
parsedSpec = parsedSpec.toLower();
|
||||
#endif
|
||||
} else {
|
||||
parsedSpec = baseMkspecDir + "/" + parsedSpec;
|
||||
}
|
||||
}
|
||||
|
||||
QFileInfo f2(parsedSpec);
|
||||
while (f2.isSymLink()) {
|
||||
parsedSpec = f2.symLinkTarget();
|
||||
f2.setFile(parsedSpec);
|
||||
}
|
||||
|
||||
if (parsedSpec.startsWith(baseMkspecDir)) {
|
||||
parsedSpec = parsedSpec.mid(baseMkspecDir.length() + 1);
|
||||
} else {
|
||||
QString sourceMkSpecPath = version->sourcePath() + "/mkspecs";
|
||||
if (parsedSpec.startsWith(sourceMkSpecPath)) {
|
||||
parsedSpec = parsedSpec.mid(sourceMkSpecPath.length() + 1);
|
||||
}
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
parsedSpec = parsedSpec.toLower();
|
||||
#endif
|
||||
return parsedSpec;
|
||||
|
||||
}
|
||||
108
src/plugins/qt4projectmanager/qt4buildconfiguration.h
Normal file
108
src/plugins/qt4projectmanager/qt4buildconfiguration.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QT4BUILDCONFIGURATION_H
|
||||
#define QT4BUILDCONFIGURATION_H
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
|
||||
class Qt4Project;
|
||||
class QtVersion;
|
||||
class QMakeStep;
|
||||
class MakeStep;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class Qt4BuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Qt4BuildConfiguration(Qt4Project *pro);
|
||||
// copy ctor
|
||||
Qt4BuildConfiguration(Qt4BuildConfiguration *source);
|
||||
~Qt4BuildConfiguration();
|
||||
|
||||
Qt4Project *qt4Project() const;
|
||||
|
||||
ProjectExplorer::Environment environment() const;
|
||||
ProjectExplorer::Environment baseEnvironment() const;
|
||||
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const;
|
||||
bool useSystemEnvironment() const;
|
||||
void setUseSystemEnvironment(bool b);
|
||||
|
||||
virtual QString buildDirectory() const;
|
||||
|
||||
// returns the qtdir (depends on the current QtVersion)
|
||||
QString qtDir() const;
|
||||
//returns the qtVersion, if the project is set to use the default qt version, then
|
||||
// that is returned
|
||||
// to check wheter the project uses the default qt version use qtVersionId
|
||||
QtVersion *qtVersion() const;
|
||||
|
||||
// returns the id of the qt version, if the project is using the default qt version
|
||||
// this function returns 0
|
||||
int qtVersionId() const;
|
||||
//returns the name of the qt version, might be QString::Null, which means default qt version
|
||||
// qtVersion is in general the better method to use
|
||||
QString qtVersionName() const;
|
||||
|
||||
void setQtVersion(int id);
|
||||
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
void setToolChainType(ProjectExplorer::ToolChain::ToolChainType type);
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
|
||||
|
||||
// Those functions are used in a few places.
|
||||
// The drawback is that we shouldn't actually depend on them beeing always there
|
||||
// That is generally the stuff that is asked should normally be transfered to
|
||||
// Qt4Project *
|
||||
// So that we can later enable people to build qt4projects the way they would like
|
||||
QMakeStep *qmakeStep() const;
|
||||
MakeStep *makeStep() const;
|
||||
|
||||
QString makeCommand() const;
|
||||
QString defaultMakeTarget() const;
|
||||
|
||||
bool compareToImportFrom(const QString &workingDirectory);
|
||||
static QStringList removeSpecFromArgumentList(const QStringList &old);
|
||||
static QString extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version);
|
||||
|
||||
signals:
|
||||
void qtVersionChanged();
|
||||
};
|
||||
|
||||
} // namespace Qt4ProjectManager
|
||||
} // namespace Internal
|
||||
|
||||
#endif // QT4BUILDCONFIGURATION_H
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "qt4buildenvironmentwidget.h"
|
||||
#include "qt4project.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/environmenteditmodel.h>
|
||||
|
||||
@@ -42,7 +43,7 @@ using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project)
|
||||
: BuildConfigWidget(), m_pro(project)
|
||||
: BuildConfigWidget(), m_pro(project), m_buildConfiguration(0)
|
||||
{
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
@@ -65,28 +66,25 @@ QString Qt4BuildEnvironmentWidget::displayName() const
|
||||
return tr("Build Environment");
|
||||
}
|
||||
|
||||
void Qt4BuildEnvironmentWidget::init(const QString &buildConfiguration)
|
||||
void Qt4BuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << "Qt4BuildConfigWidget::init()";
|
||||
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfiguration);
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(bc));
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
||||
m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(bc));
|
||||
m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
|
||||
m_buildEnvironmentWidget->updateButtons();
|
||||
}
|
||||
|
||||
void Qt4BuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
||||
{
|
||||
m_pro->setUserEnvironmentChanges(m_pro->buildConfiguration(m_buildConfiguration),
|
||||
m_buildEnvironmentWidget->userChanges());
|
||||
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
||||
}
|
||||
|
||||
void Qt4BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
m_pro->setUseSystemEnvironment(bc, !checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
||||
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace Qt4ProjectManager {
|
||||
class Qt4Project;
|
||||
|
||||
namespace Internal {
|
||||
class Qt4BuildConfiguration;
|
||||
|
||||
class Qt4BuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -53,7 +55,7 @@ public:
|
||||
Qt4BuildEnvironmentWidget(Qt4Project *project);
|
||||
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void environmentModelUserChangesUpdated();
|
||||
@@ -63,7 +65,7 @@ private:
|
||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
||||
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
||||
Qt4Project *m_pro;
|
||||
QString m_buildConfiguration;
|
||||
Qt4BuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "qt4project.h"
|
||||
#include "qt4projectmanager.h"
|
||||
#include "qtuicodemodelsupport.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/nodesvisitor.h>
|
||||
#include <projectexplorer/filewatcher.h>
|
||||
@@ -1101,7 +1102,9 @@ ProFileReader *Qt4PriFileNode::createProFileReader() const
|
||||
connect(reader, SIGNAL(errorFound(QString)),
|
||||
m_project, SLOT(proFileParseError(QString)));
|
||||
|
||||
QtVersion *version = m_project->qtVersion(m_project->activeBuildConfiguration());
|
||||
Qt4BuildConfiguration *qt4bc = m_project->activeQt4BuildConfiguration();
|
||||
|
||||
QtVersion *version = qt4bc->qtVersion();
|
||||
if (version->isValid())
|
||||
reader->setQtVersion(version);
|
||||
|
||||
@@ -1202,7 +1205,7 @@ QString Qt4PriFileNode::buildDir() const
|
||||
{
|
||||
const QDir srcDirRoot = QFileInfo(m_project->rootProjectNode()->path()).absoluteDir();
|
||||
const QString relativeDir = srcDirRoot.relativeFilePath(m_projectDir);
|
||||
return QDir(m_project->buildDirectory(m_project->activeBuildConfiguration())).absoluteFilePath(relativeDir);
|
||||
return QDir(m_project->activeBuildConfiguration()->buildDirectory()).absoluteFilePath(relativeDir);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "projectloadwizard.h"
|
||||
#include "qtversionmanager.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#ifdef QTCREATOR_WITH_S60
|
||||
#include "qt-s60/gccetoolchain.h"
|
||||
@@ -67,10 +69,6 @@ using namespace ProjectExplorer;
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
namespace {
|
||||
const char * const KEY_QT_VERSION_ID = "QtVersionId";
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -269,7 +267,7 @@ QString Qt4BuildConfigurationFactory::displayNameForType(const QString &type) co
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool Qt4BuildConfigurationFactory::create(const QString &type) const
|
||||
BuildConfiguration *Qt4BuildConfigurationFactory::create(const QString &type) const
|
||||
{
|
||||
QTC_ASSERT(m_versions.contains(type), return false);
|
||||
const VersionInfo &info = m_versions.value(type);
|
||||
@@ -289,10 +287,24 @@ bool Qt4BuildConfigurationFactory::create(const QString &type) const
|
||||
m_project->addQt4BuildConfiguration(tr("%1 Debug").arg(buildConfigurationName),
|
||||
version,
|
||||
(version->defaultBuildConfig() | QtVersion::DebugBuild));
|
||||
BuildConfiguration *bc =
|
||||
m_project->addQt4BuildConfiguration(tr("%1 Release").arg(buildConfigurationName),
|
||||
version,
|
||||
(version->defaultBuildConfig() & ~QtVersion::DebugBuild));
|
||||
return true;
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *Qt4BuildConfigurationFactory::clone(BuildConfiguration *source) const
|
||||
{
|
||||
Qt4BuildConfiguration *oldbc = static_cast<Qt4BuildConfiguration *>(source);
|
||||
Qt4BuildConfiguration *newbc = new Qt4BuildConfiguration(oldbc);
|
||||
return newbc;
|
||||
}
|
||||
|
||||
BuildConfiguration *Qt4BuildConfigurationFactory::restore() const
|
||||
{
|
||||
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(m_project);
|
||||
return bc;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -323,9 +335,14 @@ Qt4Project::~Qt4Project()
|
||||
delete m_projectFiles;
|
||||
}
|
||||
|
||||
Qt4BuildConfiguration *Qt4Project::activeQt4BuildConfiguration() const
|
||||
{
|
||||
return static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration());
|
||||
}
|
||||
|
||||
void Qt4Project::defaultQtVersionChanged()
|
||||
{
|
||||
if (qtVersionId(activeBuildConfiguration()) == 0)
|
||||
if (activeQt4BuildConfiguration()->qtVersionId() == 0)
|
||||
m_rootProjectNode->update();
|
||||
}
|
||||
|
||||
@@ -333,9 +350,10 @@ void Qt4Project::qtVersionsChanged()
|
||||
{
|
||||
QtVersionManager *vm = QtVersionManager::instance();
|
||||
foreach (BuildConfiguration *bc, buildConfigurations()) {
|
||||
if (!vm->version(qtVersionId(bc))->isValid()) {
|
||||
setQtVersion(bc, 0);
|
||||
if (bc == activeBuildConfiguration())
|
||||
Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(bc);
|
||||
if (!vm->version(qt4bc->qtVersionId())->isValid()) {
|
||||
qt4bc->setQtVersion(0);
|
||||
if (qt4bc == activeBuildConfiguration())
|
||||
m_rootProjectNode->update();
|
||||
}
|
||||
}
|
||||
@@ -365,8 +383,9 @@ bool Qt4Project::restoreSettingsImpl(PersistentSettingsReader &settingsReader)
|
||||
// or if not, is reset to the default
|
||||
|
||||
foreach (BuildConfiguration *bc, buildConfigurations()) {
|
||||
qtVersionId(bc);
|
||||
toolChainType(bc);
|
||||
Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(bc);
|
||||
qt4bc->qtVersionId();
|
||||
qt4bc->toolChainType();
|
||||
}
|
||||
|
||||
m_rootProjectNode = new Qt4ProFileNode(this, m_fileInfo->fileName(), this);
|
||||
@@ -436,40 +455,42 @@ ProjectExplorer::IBuildConfigurationFactory *Qt4Project::buildConfigurationFacto
|
||||
return m_buildConfigurationFactory;
|
||||
}
|
||||
|
||||
void Qt4Project::addQt4BuildConfiguration(QString buildConfigurationName, QtVersion *qtversion,
|
||||
Qt4BuildConfiguration *Qt4Project::addQt4BuildConfiguration(QString displayName, QtVersion *qtversion,
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
||||
QStringList additionalArguments)
|
||||
{
|
||||
bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild;
|
||||
|
||||
// Add the buildconfiguration
|
||||
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration(buildConfigurationName);
|
||||
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(this);
|
||||
bc->setDisplayName(displayName);
|
||||
addBuildConfiguration(bc);
|
||||
|
||||
QMakeStep *qmakeStep = new QMakeStep(this, bc);
|
||||
QMakeStep *qmakeStep = new QMakeStep(bc);
|
||||
bc->insertBuildStep(0, qmakeStep);
|
||||
|
||||
MakeStep *makeStep = new MakeStep(this, bc);
|
||||
MakeStep *makeStep = new MakeStep(bc);
|
||||
bc->insertBuildStep(1, makeStep);
|
||||
|
||||
MakeStep* cleanStep = new MakeStep(this, bc);
|
||||
MakeStep* cleanStep = new MakeStep(bc);
|
||||
cleanStep->setClean(true);
|
||||
bc->insertCleanStep(0, cleanStep);
|
||||
if (!additionalArguments.isEmpty())
|
||||
qmakeStep->m_qmakeArgs = additionalArguments;
|
||||
qmakeStep->setUserArguments(additionalArguments);
|
||||
|
||||
// set some options for qmake and make
|
||||
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
|
||||
makeStep->setMakeArguments(QStringList() << (debug ? "debug" : "release"));
|
||||
makeStep->setUserArguments(QStringList() << (debug ? "debug" : "release"));
|
||||
|
||||
bc->setValue("buildConfiguration", int(qmakeBuildConfiguration));
|
||||
|
||||
// Finally set the qt version
|
||||
bool defaultQtVersion = (qtversion == 0);
|
||||
if (defaultQtVersion)
|
||||
setQtVersion(bc, 0);
|
||||
bc->setQtVersion(0);
|
||||
else
|
||||
setQtVersion(bc, qtversion->uniqueId());
|
||||
bc->setQtVersion(qtversion->uniqueId());
|
||||
return bc;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -499,61 +520,13 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile
|
||||
m_proFilesForCodeModelUpdate.append(pro);
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *Qt4Project::toolChain(BuildConfiguration *configuration) const
|
||||
{
|
||||
ToolChain::ToolChainType tct = toolChainType(configuration);
|
||||
return qtVersion(configuration)->toolChain(tct);
|
||||
}
|
||||
|
||||
QString Qt4Project::makeCommand(BuildConfiguration *configuration) const
|
||||
{
|
||||
ToolChain *tc = toolChain(configuration);
|
||||
return tc ? tc->makeCommand() : "make";
|
||||
}
|
||||
|
||||
#ifdef QTCREATOR_WITH_S60
|
||||
static inline QString symbianMakeTarget(QtVersion::QmakeBuildConfig buildConfig,
|
||||
const QString &type)
|
||||
{
|
||||
QString rc = (buildConfig & QtVersion::DebugBuild) ?
|
||||
QLatin1String("debug-") : QLatin1String("release-");
|
||||
rc += type;
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString Qt4Project::defaultMakeTarget(BuildConfiguration *configuration) const
|
||||
{
|
||||
#ifdef QTCREATOR_WITH_S60
|
||||
ToolChain *tc = toolChain(configuration);
|
||||
if (!tc)
|
||||
return QString::null;
|
||||
const QtVersion::QmakeBuildConfig buildConfig
|
||||
= QtVersion::QmakeBuildConfig(activeBuildConfiguration()->value("buildConfiguration").toInt());
|
||||
|
||||
switch (tc->type()) {
|
||||
case ToolChain::GCCE:
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
return symbianMakeTarget(buildConfig, QLatin1String("gcce"));
|
||||
case ToolChain::RVCT_ARMV5:
|
||||
return symbianMakeTarget(buildConfig, QLatin1String("armv5"));
|
||||
case ToolChain::RVCT_ARMV6:
|
||||
case ToolChain::RVCT_ARMV6_GNUPOC:
|
||||
return symbianMakeTarget(buildConfig, QLatin1String("armv6"));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(configuration);
|
||||
#endif
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
void Qt4Project::updateCodeModel()
|
||||
{
|
||||
if (debug)
|
||||
qDebug()<<"Qt4Project::updateCodeModel()";
|
||||
|
||||
Qt4BuildConfiguration *activeBC = activeQt4BuildConfiguration();
|
||||
|
||||
CppTools::CppModelManagerInterface *modelmanager =
|
||||
ExtensionSystem::PluginManager::instance()
|
||||
->getObject<CppTools::CppModelManagerInterface>();
|
||||
@@ -565,7 +538,7 @@ void Qt4Project::updateCodeModel()
|
||||
QStringList predefinedFrameworkPaths;
|
||||
QByteArray predefinedMacros;
|
||||
|
||||
ToolChain *tc = toolChain(activeBuildConfiguration());
|
||||
ToolChain *tc = activeBC->toolChain();
|
||||
QList<HeaderPath> allHeaderPaths;
|
||||
if (tc) {
|
||||
predefinedMacros = tc->predefinedMacros();
|
||||
@@ -584,7 +557,7 @@ void Qt4Project::updateCodeModel()
|
||||
predefinedIncludePaths.append(headerPath.path());
|
||||
}
|
||||
|
||||
const QHash<QString, QString> versionInfo = qtVersion(activeBuildConfiguration())->versionInfo();
|
||||
const QHash<QString, QString> versionInfo = activeBC->qtVersion()->versionInfo();
|
||||
const QString newQtIncludePath = versionInfo.value(QLatin1String("QT_INSTALL_HEADERS"));
|
||||
|
||||
predefinedIncludePaths.append(newQtIncludePath);
|
||||
@@ -669,7 +642,7 @@ void Qt4Project::updateCodeModel()
|
||||
}
|
||||
|
||||
// Add mkspec directory
|
||||
info.includes.append(qtVersion(activeBuildConfiguration())->mkspecPath());
|
||||
info.includes.append(activeBC->qtVersion()->mkspecPath());
|
||||
|
||||
info.frameworkPaths = allFrameworkPaths;
|
||||
|
||||
@@ -683,7 +656,7 @@ void Qt4Project::updateCodeModel()
|
||||
}
|
||||
|
||||
// Add mkspec directory
|
||||
allIncludePaths.append(qtVersion(activeBuildConfiguration())->mkspecPath());
|
||||
allIncludePaths.append(activeBC->qtVersion()->mkspecPath());
|
||||
|
||||
// Dump things out
|
||||
// This is debugging output...
|
||||
@@ -766,7 +739,6 @@ QStringList Qt4Project::frameworkPaths(const QString &fileName) const
|
||||
// */
|
||||
void Qt4Project::update()
|
||||
{
|
||||
// TODO Maybe remove this method completely?
|
||||
m_rootProjectNode->update();
|
||||
//updateCodeModel();
|
||||
}
|
||||
@@ -841,126 +813,6 @@ Qt4ProFileNode *Qt4Project::rootProjectNode() const
|
||||
return m_rootProjectNode;
|
||||
}
|
||||
|
||||
QString Qt4Project::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
QString workingDirectory;
|
||||
if (configuration->value("useShadowBuild").toBool())
|
||||
workingDirectory = configuration->value("buildDirectory").toString();
|
||||
if (workingDirectory.isEmpty())
|
||||
workingDirectory = QFileInfo(file()->fileName()).absolutePath();
|
||||
return workingDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment Qt4Project::baseEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = useSystemEnvironment(configuration) ? Environment::systemEnvironment() : Environment();
|
||||
qtVersion(configuration)->addToEnvironment(env);
|
||||
ToolChain *tc = toolChain(configuration);
|
||||
if (tc)
|
||||
tc->addToEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment Qt4Project::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = baseEnvironment(configuration);
|
||||
env.modify(userEnvironmentChanges(configuration));
|
||||
return env;
|
||||
}
|
||||
|
||||
void Qt4Project::setUseSystemEnvironment(BuildConfiguration *configuration, bool b)
|
||||
{
|
||||
if (useSystemEnvironment(configuration) == b)
|
||||
return;
|
||||
configuration->setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged(configuration->name());
|
||||
}
|
||||
|
||||
bool Qt4Project::useSystemEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
bool b = !(configuration->value("clearSystemEnvironment").isValid()
|
||||
&& configuration->value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> Qt4Project::userEnvironmentChanges(BuildConfiguration *configuration) const
|
||||
{
|
||||
return EnvironmentItem::fromStringList(configuration->value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void Qt4Project::setUserEnvironmentChanges(BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = EnvironmentItem::toStringList(diff);
|
||||
if (list == configuration->value("userEnvironmentChanges").toStringList())
|
||||
return;
|
||||
configuration->setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged(configuration->name());
|
||||
}
|
||||
|
||||
QString Qt4Project::qtDir(BuildConfiguration *configuration) const
|
||||
{
|
||||
QtVersion *version = qtVersion(configuration);
|
||||
if (version)
|
||||
return version->versionInfo().value("QT_INSTALL_DATA");
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
QtVersion *Qt4Project::qtVersion(BuildConfiguration *configuration) const
|
||||
{
|
||||
return QtVersionManager::instance()->version(qtVersionId(configuration));
|
||||
}
|
||||
|
||||
int Qt4Project::qtVersionId(BuildConfiguration *configuration) const
|
||||
{
|
||||
QtVersionManager *vm = QtVersionManager::instance();
|
||||
if (debug)
|
||||
qDebug()<<"Looking for qtVersion ID of "<<configuration->name();
|
||||
int id = 0;
|
||||
QVariant vid = configuration->value(KEY_QT_VERSION_ID);
|
||||
if (vid.isValid()) {
|
||||
id = vid.toInt();
|
||||
if (vm->version(id)->isValid()) {
|
||||
return id;
|
||||
} else {
|
||||
configuration->setValue(KEY_QT_VERSION_ID, 0);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// Backward compatibilty, we might have just the name:
|
||||
QString vname = configuration->value("QtVersion").toString();
|
||||
if (debug)
|
||||
qDebug()<<" Backward compatibility reading QtVersion"<<vname;
|
||||
if (!vname.isEmpty()) {
|
||||
const QList<QtVersion *> &versions = vm->versions();
|
||||
foreach (const QtVersion * const version, versions) {
|
||||
if (version->name() == vname) {
|
||||
if (debug)
|
||||
qDebug()<<"found name in versions";
|
||||
configuration->setValue(KEY_QT_VERSION_ID, version->uniqueId());
|
||||
return version->uniqueId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug)
|
||||
qDebug()<<" using qtversion with id ="<<id;
|
||||
// Nothing found, reset to default
|
||||
configuration->setValue(KEY_QT_VERSION_ID, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
void Qt4Project::setQtVersion(BuildConfiguration *configuration, int id)
|
||||
{
|
||||
configuration->setValue(KEY_QT_VERSION_ID, id);
|
||||
emit qtVersionChanged(configuration);
|
||||
updateActiveRunConfiguration();
|
||||
}
|
||||
|
||||
void Qt4Project::setToolChainType(BuildConfiguration *configuration, ProjectExplorer::ToolChain::ToolChainType type)
|
||||
{
|
||||
configuration->setValue("ToolChain", (int)type);
|
||||
updateActiveRunConfiguration();
|
||||
}
|
||||
|
||||
void Qt4Project::updateActiveRunConfiguration()
|
||||
{
|
||||
@@ -968,76 +820,7 @@ void Qt4Project::updateActiveRunConfiguration()
|
||||
emit targetInformationChanged();
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType Qt4Project::toolChainType(BuildConfiguration *configuration) const
|
||||
{
|
||||
ToolChain::ToolChainType originalType = ToolChain::ToolChainType(configuration->value("ToolChain").toInt());
|
||||
ToolChain::ToolChainType type = originalType;
|
||||
const QtVersion *version = qtVersion(configuration);
|
||||
if (!version->possibleToolChainTypes().contains(type)) // use default tool chain
|
||||
type = version->defaultToolchainType();
|
||||
if (type != originalType)
|
||||
const_cast<Qt4Project *>(this)->setToolChainType(configuration, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
QString Qt4Project::extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version)
|
||||
{
|
||||
int index = list.indexOf("-spec");
|
||||
if (index == -1)
|
||||
index = list.indexOf("-platform");
|
||||
if (index == -1)
|
||||
return QString();
|
||||
|
||||
++index;
|
||||
|
||||
if (index >= list.length())
|
||||
return QString();
|
||||
|
||||
QString baseMkspecDir = version->versionInfo().value("QMAKE_MKSPECS");
|
||||
if (baseMkspecDir.isEmpty())
|
||||
baseMkspecDir = version->versionInfo().value("QT_INSTALL_DATA") + "/mkspecs";
|
||||
|
||||
QString parsedSpec = QDir::cleanPath(list.at(index));
|
||||
#ifdef Q_OS_WIN
|
||||
baseMkspecDir = baseMkspecDir.toLower();
|
||||
parsedSpec = parsedSpec.toLower();
|
||||
#endif
|
||||
// if the path is relative it can be
|
||||
// relative to the working directory (as found in the Makefiles)
|
||||
// or relatively to the mkspec directory
|
||||
// if it is the former we need to get the canonical form
|
||||
// for the other one we don't need to do anything
|
||||
if (QFileInfo(parsedSpec).isRelative()) {
|
||||
if(QFileInfo(directory + "/" + parsedSpec).exists()) {
|
||||
parsedSpec = QDir::cleanPath(directory + "/" + parsedSpec);
|
||||
#ifdef Q_OS_WIN
|
||||
parsedSpec = parsedSpec.toLower();
|
||||
#endif
|
||||
} else {
|
||||
parsedSpec = baseMkspecDir + "/" + parsedSpec;
|
||||
}
|
||||
}
|
||||
|
||||
QFileInfo f2(parsedSpec);
|
||||
while (f2.isSymLink()) {
|
||||
parsedSpec = f2.symLinkTarget();
|
||||
f2.setFile(parsedSpec);
|
||||
}
|
||||
|
||||
if (parsedSpec.startsWith(baseMkspecDir)) {
|
||||
parsedSpec = parsedSpec.mid(baseMkspecDir.length() + 1);
|
||||
} else {
|
||||
QString sourceMkSpecPath = version->sourcePath() + "/mkspecs";
|
||||
if (parsedSpec.startsWith(sourceMkSpecPath)) {
|
||||
parsedSpec = parsedSpec.mid(sourceMkSpecPath.length() + 1);
|
||||
}
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
parsedSpec = parsedSpec.toLower();
|
||||
#endif
|
||||
return parsedSpec;
|
||||
|
||||
}
|
||||
|
||||
BuildConfigWidget *Qt4Project::createConfigWidget()
|
||||
{
|
||||
@@ -1167,24 +950,6 @@ void Qt4Project::proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *nod
|
||||
}
|
||||
}
|
||||
|
||||
QMakeStep *Qt4Project::qmakeStep(ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
QMakeStep *qs = 0;
|
||||
foreach(BuildStep *bs, bc->buildSteps())
|
||||
if ((qs = qobject_cast<QMakeStep *>(bs)) != 0)
|
||||
return qs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
MakeStep *Qt4Project::makeStep(ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
MakeStep *qs = 0;
|
||||
foreach(BuildStep *bs, bc->buildSteps())
|
||||
if ((qs = qobject_cast<MakeStep *>(bs)) != 0)
|
||||
return qs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Qt4Project::hasSubNode(Qt4PriFileNode *root, const QString &path)
|
||||
{
|
||||
if (root->path() == path)
|
||||
@@ -1225,88 +990,6 @@ void Qt4Project::invalidateCachedTargetInformation()
|
||||
emit targetInformationChanged();
|
||||
}
|
||||
|
||||
void Qt4Project::emitBuildDirectoryChanged()
|
||||
{
|
||||
emit buildDirectoryChanged();
|
||||
}
|
||||
|
||||
// We match -spec and -platfrom separetly
|
||||
// We ignore -cache, because qmake contained a bug that it didn't
|
||||
// mention the -cache in the Makefile
|
||||
// That means changing the -cache option in the additional arguments
|
||||
// does not automatically rerun qmake. Alas, we could try more
|
||||
// intelligent matching for -cache, but i guess people rarely
|
||||
// do use that.
|
||||
|
||||
QStringList Qt4Project::removeSpecFromArgumentList(const QStringList &old)
|
||||
{
|
||||
if (!old.contains("-spec") && !old.contains("-platform") && !old.contains("-cache"))
|
||||
return old;
|
||||
QStringList newList;
|
||||
bool ignoreNext = false;
|
||||
foreach(const QString &item, old) {
|
||||
if (ignoreNext) {
|
||||
ignoreNext = false;
|
||||
} else if (item == "-spec" || item == "-platform" || item == "-cache") {
|
||||
ignoreNext = true;
|
||||
} else {
|
||||
newList << item;
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
// returns true if both are equal
|
||||
bool Qt4Project::compareBuildConfigurationToImportFrom(BuildConfiguration *bc, const QString &workingDirectory)
|
||||
{
|
||||
QMakeStep *qs = qmakeStep(bc);
|
||||
if (QDir(workingDirectory).exists(QLatin1String("Makefile")) && qs) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
|
||||
QtVersion *version = qtVersion(bc);
|
||||
if (version->qmakeCommand() == qmakePath) {
|
||||
// same qtversion
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QtVersionManager::scanMakeFile(workingDirectory, version->defaultBuildConfig());
|
||||
if (QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt()) == result.first) {
|
||||
// The QMake Build Configuration are the same,
|
||||
// now compare arguments lists
|
||||
// we have to compare without the spec/platform cmd argument
|
||||
// and compare that on its own
|
||||
QString actualSpec = extractSpecFromArgumentList(qs->m_qmakeArgs, workingDirectory, version);
|
||||
if (actualSpec.isEmpty()) {
|
||||
// Easy one the user has choosen not to override the settings
|
||||
actualSpec = version->mkspec();
|
||||
}
|
||||
|
||||
|
||||
QString parsedSpec = extractSpecFromArgumentList(result.second, workingDirectory, version);
|
||||
QStringList actualArgs = removeSpecFromArgumentList(qs->m_qmakeArgs);
|
||||
QStringList parsedArgs = removeSpecFromArgumentList(result.second);
|
||||
|
||||
if (debug) {
|
||||
qDebug()<<"Actual args:"<<actualArgs;
|
||||
qDebug()<<"Parsed args:"<<parsedArgs;
|
||||
qDebug()<<"Actual spec:"<<actualSpec;
|
||||
qDebug()<<"Parsed spec:"<<parsedSpec;
|
||||
}
|
||||
|
||||
if (actualArgs == parsedArgs) {
|
||||
// Specs match exactly
|
||||
if (actualSpec == parsedSpec)
|
||||
return true;
|
||||
// Actual spec is the default one
|
||||
// qDebug()<<"AS vs VS"<<actualSpec<<version->mkspec();
|
||||
if ((actualSpec == version->mkspec() || actualSpec == "default")
|
||||
&& (parsedSpec == version->mkspec() || parsedSpec == "default" || parsedSpec.isEmpty()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Handle special case were a subproject of the qt directory is opened, and
|
||||
qt was configured to be built as a shadow build -> also build in the sub-
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace Internal {
|
||||
class GCCPreprocessor;
|
||||
struct Qt4ProjectFiles;
|
||||
class Qt4ProjectConfigWidget;
|
||||
class Qt4BuildConfiguration;
|
||||
|
||||
class CodeModelInfo
|
||||
{
|
||||
@@ -130,7 +131,9 @@ public:
|
||||
QStringList availableCreationTypes() const;
|
||||
QString displayNameForType(const QString &type) const;
|
||||
|
||||
bool create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||
ProjectExplorer::BuildConfiguration *restore() const;
|
||||
|
||||
void update();
|
||||
|
||||
@@ -155,16 +158,18 @@ public:
|
||||
explicit Qt4Project(Qt4Manager *manager, const QString &proFile);
|
||||
virtual ~Qt4Project();
|
||||
|
||||
Internal::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
||||
|
||||
QString name() const;
|
||||
Core::IFile *file() const;
|
||||
ProjectExplorer::IProjectManager *projectManager() const;
|
||||
Qt4Manager *qt4ProjectManager() const;
|
||||
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
|
||||
void addQt4BuildConfiguration(QString buildConfigurationName,
|
||||
QtVersion *qtversion,
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
||||
QStringList additionalArguments = QStringList());
|
||||
Internal::Qt4BuildConfiguration *addQt4BuildConfiguration(QString displayName,
|
||||
QtVersion *qtversion,
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
||||
QStringList additionalArguments = QStringList());
|
||||
|
||||
QList<Core::IFile *> dependencies(); //NBS remove
|
||||
QList<ProjectExplorer::Project *>dependsOn();
|
||||
@@ -175,70 +180,31 @@ public:
|
||||
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
|
||||
//building environment
|
||||
ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
ProjectExplorer::Environment baseEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUserEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
bool useSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUseSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration, bool b);
|
||||
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
// returns the CONFIG variable from the .pro file
|
||||
QStringList qmakeConfig() const;
|
||||
// returns the qtdir (depends on the current QtVersion)
|
||||
QString qtDir(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
//returns the qtVersion, if the project is set to use the default qt version, then
|
||||
// that is returned
|
||||
// to check wheter the project uses the default qt version use qtVersionId
|
||||
QtVersion *qtVersion(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
// returns the id of the qt version, if the project is using the default qt version
|
||||
// this function returns 0
|
||||
int qtVersionId(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
//returns the name of the qt version, might be QString::Null, which means default qt version
|
||||
// qtVersion is in general the better method to use
|
||||
QString qtVersionName(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setToolChainType(ProjectExplorer::BuildConfiguration *configuration, ProjectExplorer::ToolChain::ToolChainType type);
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
void setQtVersion(ProjectExplorer::BuildConfiguration *configuration, int id);
|
||||
|
||||
QList<Internal::Qt4ProFileNode *> applicationProFiles() const;
|
||||
|
||||
// Those functions are used in a few places.
|
||||
// The drawback is that we shouldn't actually depend on them beeing always there
|
||||
// That is generally the stuff that is asked should normally be transfered to
|
||||
// Qt4Project *
|
||||
// So that we can later enable people to build qt4projects the way they would like
|
||||
QMakeStep *qmakeStep(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
MakeStep *makeStep(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
void notifyChanged(const QString &name);
|
||||
|
||||
QString makeCommand(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
QString defaultMakeTarget(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
// Is called by qmakestep qt4configurationwidget if the settings change
|
||||
// Informs all Qt4RunConfigurations that their cached values are now invalid
|
||||
// the Qt4RunConfigurations will update as soon as asked
|
||||
|
||||
// TODO remove
|
||||
void invalidateCachedTargetInformation();
|
||||
|
||||
virtual QByteArray predefinedMacros(const QString &fileName) const;
|
||||
virtual QStringList includePaths(const QString &fileName) const;
|
||||
virtual QStringList frameworkPaths(const QString &fileName) const;
|
||||
|
||||
bool compareBuildConfigurationToImportFrom(ProjectExplorer::BuildConfiguration *configuration, const QString &workingDirectory);
|
||||
|
||||
static QStringList removeSpecFromArgumentList(const QStringList &old);
|
||||
static QString extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version);
|
||||
// TODO can i remove this?
|
||||
void updateActiveRunConfiguration();
|
||||
signals:
|
||||
void targetInformationChanged();
|
||||
void qtVersionChanged(ProjectExplorer::BuildConfiguration *);
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
@@ -268,17 +234,12 @@ private:
|
||||
static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list);
|
||||
static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path);
|
||||
|
||||
// called by Qt4ProjectConfigWidget
|
||||
// TODO remove once there's a setBuildDirectory call
|
||||
void emitBuildDirectoryChanged();
|
||||
|
||||
QList<Internal::Qt4ProFileNode *> m_applicationProFileChange;
|
||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
|
||||
|
||||
void addDefaultBuild();
|
||||
|
||||
static QString qmakeVarName(ProjectExplorer::FileType type);
|
||||
void updateActiveRunConfiguration();
|
||||
|
||||
Qt4Manager *m_manager;
|
||||
Internal::Qt4ProFileNode *m_rootProjectNode;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "qt4project.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qt4projectmanager.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "ui_qt4projectconfigwidget.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -53,8 +54,9 @@ using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
|
||||
: BuildConfigWidget(),
|
||||
m_pro(project)
|
||||
m_buildConfiguration(0)
|
||||
{
|
||||
Q_UNUSED(project);
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
m_detailsContainer = new Utils::DetailsWidget(this);
|
||||
@@ -111,10 +113,9 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
|
||||
|
||||
void Qt4ProjectConfigWidget::updateDetails()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
QtVersion *version = m_pro->qtVersion(bc);
|
||||
QtVersion *version = m_buildConfiguration->qtVersion();
|
||||
QString versionString;
|
||||
if (m_pro->qtVersionId(bc) == 0) {
|
||||
if (m_buildConfiguration->qtVersionId() == 0) {
|
||||
versionString = tr("Default Qt Version (%1)").arg(version->name());
|
||||
} else if(version){
|
||||
versionString = version->name();
|
||||
@@ -126,8 +127,8 @@ void Qt4ProjectConfigWidget::updateDetails()
|
||||
"with tool chain <b>%2</b><br>"
|
||||
"building in <b>%3</b>")
|
||||
.arg(versionString,
|
||||
ProjectExplorer::ToolChain::toolChainName(m_pro->toolChainType(bc)),
|
||||
QDir::toNativeSeparators(m_pro->buildDirectory(bc))));
|
||||
ProjectExplorer::ToolChain::toolChainName(m_buildConfiguration->toolChainType()),
|
||||
QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
|
||||
}
|
||||
|
||||
void Qt4ProjectConfigWidget::manageQtVersions()
|
||||
@@ -142,22 +143,21 @@ QString Qt4ProjectConfigWidget::displayName() const
|
||||
return tr("General");
|
||||
}
|
||||
|
||||
void Qt4ProjectConfigWidget::init(const QString &buildConfiguration)
|
||||
void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << "Qt4ProjectConfigWidget::init() for"<<buildConfiguration;
|
||||
qDebug() << "Qt4ProjectConfigWidget::init() for"<<bc->displayName();
|
||||
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfiguration);
|
||||
m_ui->nameLineEdit->setText(bc->displayName());
|
||||
m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
|
||||
m_ui->nameLineEdit->setText(m_buildConfiguration->displayName());
|
||||
|
||||
setupQtVersionsComboBox();
|
||||
|
||||
bool shadowBuild = bc->value("useShadowBuild").toBool();
|
||||
bool shadowBuild = m_buildConfiguration->value("useShadowBuild").toBool();
|
||||
m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
|
||||
m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
|
||||
m_browseButton->setEnabled(shadowBuild);
|
||||
m_ui->shadowBuildDirEdit->setPath(m_pro->buildDirectory(bc));
|
||||
m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->buildDirectory());
|
||||
updateImportLabel();
|
||||
updateToolChainCombo();
|
||||
updateDetails();
|
||||
@@ -165,13 +165,12 @@ void Qt4ProjectConfigWidget::init(const QString &buildConfiguration)
|
||||
|
||||
void Qt4ProjectConfigWidget::changeConfigName(const QString &newName)
|
||||
{
|
||||
m_pro->setDisplayNameFor(
|
||||
m_pro->buildConfiguration(m_buildConfiguration), newName);
|
||||
m_buildConfiguration->setDisplayName(newName);
|
||||
}
|
||||
|
||||
void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
|
||||
{
|
||||
if (m_buildConfiguration.isEmpty()) // not yet initialized
|
||||
if (!m_buildConfiguration) // not yet initialized
|
||||
return;
|
||||
|
||||
disconnect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
|
||||
@@ -182,7 +181,7 @@ void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
|
||||
m_ui->qtVersionComboBox->clear();
|
||||
m_ui->qtVersionComboBox->addItem(tr("Default Qt Version (%1)").arg(vm->defaultVersion()->name()), 0);
|
||||
|
||||
int qtVersionId = m_pro->qtVersionId(m_pro->buildConfiguration(m_buildConfiguration));
|
||||
int qtVersionId = m_buildConfiguration->qtVersionId();
|
||||
|
||||
if (qtVersionId == 0) {
|
||||
m_ui->qtVersionComboBox->setCurrentIndex(0);
|
||||
@@ -206,7 +205,7 @@ void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
|
||||
|
||||
void Qt4ProjectConfigWidget::onBeforeBeforeShadowBuildDirBrowsed()
|
||||
{
|
||||
QString initialDirectory = QFileInfo(m_pro->file()->fileName()).absolutePath();
|
||||
QString initialDirectory = QFileInfo(m_buildConfiguration->project()->file()->fileName()).absolutePath();
|
||||
if (!initialDirectory.isEmpty())
|
||||
m_ui->shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory);
|
||||
}
|
||||
@@ -216,14 +215,13 @@ void Qt4ProjectConfigWidget::shadowBuildCheckBoxClicked(bool checked)
|
||||
m_ui->shadowBuildDirEdit->setEnabled(checked);
|
||||
m_browseButton->setEnabled(checked);
|
||||
bool b = m_ui->shadowBuildCheckBox->isChecked();
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
bc->setValue("useShadowBuild", b);
|
||||
m_buildConfiguration->setValue("useShadowBuild", b);
|
||||
if (b)
|
||||
bc->setValue("buildDirectory", m_ui->shadowBuildDirEdit->path());
|
||||
m_buildConfiguration->setValue("buildDirectory", m_ui->shadowBuildDirEdit->path());
|
||||
else
|
||||
bc->setValue("buildDirectory", QVariant(QString::null));
|
||||
m_buildConfiguration->setValue("buildDirectory", QVariant(QString::null));
|
||||
updateDetails();
|
||||
m_pro->invalidateCachedTargetInformation();
|
||||
m_buildConfiguration->qt4Project()->invalidateCachedTargetInformation();
|
||||
updateImportLabel();
|
||||
}
|
||||
|
||||
@@ -232,10 +230,9 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
bool visible = false;
|
||||
|
||||
// we only show if we actually have a qmake and makestep
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
if (m_pro->qmakeStep(bc) && m_pro->makeStep(bc)) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(m_pro->buildDirectory(bc));
|
||||
QtVersion *version = m_pro->qtVersion(bc);
|
||||
if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(m_buildConfiguration->buildDirectory());
|
||||
QtVersion *version = m_buildConfiguration->qtVersion();
|
||||
// check that there's a makefile
|
||||
if (!qmakePath.isEmpty()) {
|
||||
// and that the qmake path is different from the current version
|
||||
@@ -244,7 +241,7 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
visible = true;
|
||||
} else {
|
||||
// check that the qmake flags, arguments match
|
||||
visible = !m_pro->compareBuildConfigurationToImportFrom(bc, m_pro->buildDirectory(bc));
|
||||
visible = !m_buildConfiguration->compareToImportFrom(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
} else {
|
||||
visible = false;
|
||||
@@ -256,25 +253,23 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
|
||||
void Qt4ProjectConfigWidget::shadowBuildLineEditTextChanged()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
if (bc->value("buildDirectory").toString() == m_ui->shadowBuildDirEdit->path())
|
||||
if (m_buildConfiguration->value("buildDirectory").toString() == m_ui->shadowBuildDirEdit->path())
|
||||
return;
|
||||
bc->setValue("buildDirectory", m_ui->shadowBuildDirEdit->path());
|
||||
m_buildConfiguration->setValue("buildDirectory", m_ui->shadowBuildDirEdit->path());
|
||||
// if the directory already exists
|
||||
// check if we have a build in there and
|
||||
// offer to import it
|
||||
updateImportLabel();
|
||||
|
||||
m_pro->invalidateCachedTargetInformation();
|
||||
m_buildConfiguration->qt4Project()->invalidateCachedTargetInformation();
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
if (!m_pro->qmakeStep(bc) || !m_pro->makeStep(bc))
|
||||
if (!m_buildConfiguration->qmakeStep() || !m_buildConfiguration->makeStep())
|
||||
return;
|
||||
QString directory = m_pro->buildDirectory(bc);
|
||||
QString directory = m_buildConfiguration->buildDirectory();
|
||||
if (!directory.isEmpty()) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(directory);
|
||||
if (!qmakePath.isEmpty()) {
|
||||
@@ -288,8 +283,8 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QtVersionManager::scanMakeFile(directory, version->defaultBuildConfig());
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first;
|
||||
QStringList additionalArguments = Qt4Project::removeSpecFromArgumentList(result.second);
|
||||
QString parsedSpec = Qt4Project::extractSpecFromArgumentList(result.second, directory, version);
|
||||
QStringList additionalArguments = Qt4BuildConfiguration::removeSpecFromArgumentList(result.second);
|
||||
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArgumentList(result.second, directory, version);
|
||||
QString versionSpec = version->mkspec();
|
||||
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
|
||||
// using the default spec, don't modify additional arguments
|
||||
@@ -299,19 +294,19 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
}
|
||||
|
||||
// So we got all the information now apply it...
|
||||
m_pro->setQtVersion(bc, version->uniqueId());
|
||||
m_buildConfiguration->setQtVersion(version->uniqueId());
|
||||
// Combo box will be updated at the end
|
||||
|
||||
QMakeStep *qmakeStep = m_pro->qmakeStep(bc);
|
||||
qmakeStep->setQMakeArguments(additionalArguments);
|
||||
MakeStep *makeStep = m_pro->makeStep(bc);
|
||||
QMakeStep *qmakeStep = m_buildConfiguration->qmakeStep();
|
||||
qmakeStep->setUserArguments(additionalArguments);
|
||||
MakeStep *makeStep = m_buildConfiguration->makeStep();
|
||||
|
||||
bc->setValue("buildConfiguration", int(qmakeBuildConfig));
|
||||
m_buildConfiguration->setValue("buildConfiguration", int(qmakeBuildConfig));
|
||||
// Adjust command line arguments, this is ugly as hell
|
||||
// If we are switching to BuildAll we want "release" in there and no "debug"
|
||||
// or "debug" in there and no "release"
|
||||
// If we are switching to not BuildAl we want neither "release" nor "debug" in there
|
||||
QStringList makeCmdArguments = makeStep->makeArguments();
|
||||
QStringList makeCmdArguments = makeStep->userArguments();
|
||||
bool debug = qmakeBuildConfig & QtVersion::DebugBuild;
|
||||
if (qmakeBuildConfig & QtVersion::BuildAll) {
|
||||
makeCmdArguments.removeAll(debug ? "release" : "debug");
|
||||
@@ -321,7 +316,7 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
makeCmdArguments.removeAll("debug");
|
||||
makeCmdArguments.removeAll("release");
|
||||
}
|
||||
makeStep->setMakeArguments(makeCmdArguments);
|
||||
makeStep->setUserArguments(makeCmdArguments);
|
||||
}
|
||||
}
|
||||
setupQtVersionsComboBox();
|
||||
@@ -341,10 +336,10 @@ void Qt4ProjectConfigWidget::qtVersionComboBoxCurrentIndexChanged(const QString
|
||||
QtVersionManager *vm = QtVersionManager::instance();
|
||||
bool isValid = vm->version(newQtVersion)->isValid();
|
||||
m_ui->invalidQtWarningLabel->setVisible(!isValid);
|
||||
if (newQtVersion != m_pro->qtVersionId(m_pro->buildConfiguration(m_buildConfiguration))) {
|
||||
m_pro->setQtVersion(m_pro->buildConfiguration(m_buildConfiguration), newQtVersion);
|
||||
if (newQtVersion != m_buildConfiguration->qtVersionId()) {
|
||||
m_buildConfiguration->setQtVersion(newQtVersion);
|
||||
updateToolChainCombo();
|
||||
m_pro->update();
|
||||
m_buildConfiguration->qt4Project()->update();
|
||||
}
|
||||
updateDetails();
|
||||
}
|
||||
@@ -352,20 +347,19 @@ void Qt4ProjectConfigWidget::qtVersionComboBoxCurrentIndexChanged(const QString
|
||||
void Qt4ProjectConfigWidget::updateToolChainCombo()
|
||||
{
|
||||
m_ui->toolChainComboBox->clear();
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
QList<ProjectExplorer::ToolChain::ToolChainType> toolchains = m_pro->qtVersion(bc)->possibleToolChainTypes();
|
||||
QList<ProjectExplorer::ToolChain::ToolChainType> toolchains = m_buildConfiguration->qtVersion()->possibleToolChainTypes();
|
||||
using namespace ProjectExplorer;
|
||||
foreach (ToolChain::ToolChainType toolchain, toolchains) {
|
||||
m_ui->toolChainComboBox->addItem(ToolChain::toolChainName(toolchain), qVariantFromValue(toolchain));
|
||||
}
|
||||
m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1);
|
||||
setToolChain(toolchains.indexOf(m_pro->toolChainType(bc)));
|
||||
setToolChain(toolchains.indexOf(m_buildConfiguration->toolChainType()));
|
||||
}
|
||||
|
||||
void Qt4ProjectConfigWidget::selectToolChain(int index)
|
||||
{
|
||||
setToolChain(index);
|
||||
m_pro->update();
|
||||
m_buildConfiguration->qt4Project()->update();
|
||||
}
|
||||
|
||||
void Qt4ProjectConfigWidget::setToolChain(int index)
|
||||
@@ -373,7 +367,7 @@ void Qt4ProjectConfigWidget::setToolChain(int index)
|
||||
ProjectExplorer::ToolChain::ToolChainType selectedToolChainType =
|
||||
m_ui->toolChainComboBox->itemData(index,
|
||||
Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>();
|
||||
m_pro->setToolChainType(m_pro->buildConfiguration(m_buildConfiguration), selectedToolChainType);
|
||||
m_buildConfiguration->setToolChainType(selectedToolChainType);
|
||||
if (m_ui->toolChainComboBox->currentIndex() != index)
|
||||
m_ui->toolChainComboBox->setCurrentIndex(index);
|
||||
updateDetails();
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Qt4ProjectManager {
|
||||
class Qt4Project;
|
||||
|
||||
namespace Internal {
|
||||
class Qt4BuildConfiguration;
|
||||
|
||||
namespace Ui {
|
||||
class Qt4ProjectConfigWidget;
|
||||
@@ -52,7 +53,7 @@ public:
|
||||
~Qt4ProjectConfigWidget();
|
||||
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void changeConfigName(const QString &newName);
|
||||
@@ -72,8 +73,7 @@ private:
|
||||
void setToolChain(int index);
|
||||
Ui::Qt4ProjectConfigWidget *m_ui;
|
||||
QAbstractButton *m_browseButton;
|
||||
Qt4Project *m_pro;
|
||||
QString m_buildConfiguration;
|
||||
Qt4BuildConfiguration *m_buildConfiguration;
|
||||
Utils::DetailsWidget *m_detailsContainer;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ HEADERS += qt4projectmanagerplugin.h \
|
||||
qt4projectmanagerconstants.h \
|
||||
makestep.h \
|
||||
qmakestep.h \
|
||||
embeddedpropertiespage.h \
|
||||
qt4runconfiguration.h \
|
||||
qtmodulesinfo.h \
|
||||
qt4projectconfigwidget.h \
|
||||
@@ -39,7 +38,9 @@ HEADERS += qt4projectmanagerplugin.h \
|
||||
qtuicodemodelsupport.h \
|
||||
externaleditors.h \
|
||||
gettingstartedwelcomepagewidget.h \
|
||||
gettingstartedwelcomepage.h
|
||||
gettingstartedwelcomepage.h \
|
||||
qt4buildconfiguration.h \
|
||||
qmakeparser.h
|
||||
SOURCES += qt4projectmanagerplugin.cpp \
|
||||
qt4projectmanager.cpp \
|
||||
qt4project.cpp \
|
||||
@@ -63,7 +64,6 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
||||
wizards/qtwizard.cpp \
|
||||
makestep.cpp \
|
||||
qmakestep.cpp \
|
||||
embeddedpropertiespage.cpp \
|
||||
qt4runconfiguration.cpp \
|
||||
qtmodulesinfo.cpp \
|
||||
qt4projectconfigwidget.cpp \
|
||||
@@ -74,11 +74,12 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
||||
qtuicodemodelsupport.cpp \
|
||||
externaleditors.cpp \
|
||||
gettingstartedwelcomepagewidget.cpp \
|
||||
gettingstartedwelcomepage.cpp
|
||||
gettingstartedwelcomepage.cpp \
|
||||
qt4buildconfiguration.cpp \
|
||||
qmakeparser.cpp
|
||||
FORMS += makestep.ui \
|
||||
qmakestep.ui \
|
||||
qt4projectconfigwidget.ui \
|
||||
embeddedpropertiespage.ui \
|
||||
qtversionmanager.ui \
|
||||
showbuildlog.ui \
|
||||
gettingstartedwelcomepagewidget.ui
|
||||
|
||||
@@ -77,6 +77,9 @@ const char * const QT_SETTINGS_CATEGORY = "L.Qt4";
|
||||
const char * const QT_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Qt4");
|
||||
const char * const QTVERSION_SETTINGS_PAGE_ID = "Qt Versions";
|
||||
const char * const QTVERSION_SETTINGS_PAGE_NAME = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Qt Versions");
|
||||
|
||||
// BuildParser
|
||||
const char * const BUILD_PARSER_QMAKE = "BuildParser.QMake";
|
||||
} // namespace Constants
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "profileeditorfactory.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qt4project.h"
|
||||
#include "embeddedpropertiespage.h"
|
||||
#include "qt4runconfiguration.h"
|
||||
#include "profilereader.h"
|
||||
#include "qtversionmanager.h"
|
||||
@@ -46,6 +45,7 @@
|
||||
#include "externaleditors.h"
|
||||
#include "gettingstartedwelcomepage.h"
|
||||
#include "gettingstartedwelcomepagewidget.h"
|
||||
#include "qmakeparser.h"
|
||||
|
||||
#ifdef QTCREATOR_WITH_S60
|
||||
#include "qt-s60/s60manager.h"
|
||||
@@ -150,6 +150,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
||||
|
||||
addAutoReleasedObject(new QMakeStepFactory);
|
||||
addAutoReleasedObject(new MakeStepFactory);
|
||||
addAutoReleasedObject(new QMakeParserFactory);
|
||||
|
||||
addAutoReleasedObject(new Qt4RunConfigurationFactory);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "profilereader.h"
|
||||
#include "qt4nodes.h"
|
||||
#include "qt4project.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
@@ -80,14 +81,20 @@ Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, const QString &proFile
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
connect(pro, SIGNAL(environmentChanged(QString)),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
// TODO
|
||||
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||
// this, SIGNAL(baseEnvironmentChanged()));
|
||||
}
|
||||
|
||||
Qt4RunConfiguration::~Qt4RunConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
Qt4Project *Qt4RunConfiguration::qt4Project() const
|
||||
{
|
||||
return static_cast<Qt4Project *>(project());
|
||||
}
|
||||
|
||||
QString Qt4RunConfiguration::type() const
|
||||
{
|
||||
return "Qt4ProjectManager.Qt4RunConfiguration";
|
||||
@@ -96,9 +103,9 @@ QString Qt4RunConfiguration::type() const
|
||||
bool Qt4RunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const
|
||||
{
|
||||
#if defined(QTCREATOR_WITH_S60) || defined(QTCREATOR_WITH_MAEMO)
|
||||
Qt4Project *pro = qobject_cast<Qt4Project*>(project());
|
||||
QTC_ASSERT(pro, return false);
|
||||
ProjectExplorer::ToolChain::ToolChainType type = pro->toolChainType(configuration);
|
||||
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(configuration);
|
||||
QTC_ASSERT(qt4bc, return false);
|
||||
ProjectExplorer::ToolChain::ToolChainType type = qt4bc->toolChainType();
|
||||
#ifdef QTCREATOR_WITH_S60
|
||||
if (type == ProjectExplorer::ToolChain::WINSCW
|
||||
|| type == ProjectExplorer::ToolChain::GCCE
|
||||
@@ -479,7 +486,7 @@ ProjectExplorer::Environment Qt4RunConfiguration::baseEnvironment() const
|
||||
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) {
|
||||
env = ProjectExplorer::Environment::systemEnvironment();
|
||||
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) {
|
||||
env = project()->environment(project()->activeBuildConfiguration());
|
||||
env = project()->activeBuildConfiguration()->environment();
|
||||
}
|
||||
if (m_isUsingDyldImageSuffix) {
|
||||
env.set("DYLD_IMAGE_SUFFIX", "_debug");
|
||||
@@ -554,8 +561,8 @@ void Qt4RunConfiguration::updateTarget()
|
||||
if (m_cachedTargetInformationValid)
|
||||
return;
|
||||
//qDebug()<<"updateTarget";
|
||||
Qt4Project *pro = static_cast<Qt4Project *>(project());
|
||||
Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
|
||||
Qt4PriFileNode * priFileNode = qt4Project()->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||
if (!priFileNode) {
|
||||
m_workingDir = QString::null;
|
||||
m_executable = QString::null;
|
||||
@@ -565,11 +572,11 @@ void Qt4RunConfiguration::updateTarget()
|
||||
}
|
||||
ProFileReader *reader = priFileNode->createProFileReader();
|
||||
reader->setCumulative(false);
|
||||
reader->setQtVersion(pro->qtVersion(pro->activeBuildConfiguration()));
|
||||
reader->setQtVersion(qt4bc->qtVersion());
|
||||
|
||||
// Find out what flags we pass on to qmake, this code is duplicated in the qmake step
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = pro->qtVersion(pro->activeBuildConfiguration())->defaultBuildConfig();
|
||||
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(pro->activeBuildConfiguration()->value("buildConfiguration").toInt());
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qt4bc->qtVersion()->defaultBuildConfig();
|
||||
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(qt4bc->value("buildConfiguration").toInt());
|
||||
QStringList addedUserConfigArguments;
|
||||
QStringList removedUserConfigArguments;
|
||||
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
|
||||
@@ -592,7 +599,7 @@ void Qt4RunConfiguration::updateTarget()
|
||||
// Extract data
|
||||
QDir baseProjectDirectory = QFileInfo(project()->file()->fileName()).absoluteDir();
|
||||
QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path());
|
||||
QDir baseBuildDirectory = project()->buildDirectory(project()->activeBuildConfiguration());
|
||||
QDir baseBuildDirectory = project()->activeBuildConfiguration()->buildDirectory();
|
||||
QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
|
||||
|
||||
//qDebug()<<relSubDir<<baseDir;
|
||||
@@ -653,8 +660,7 @@ void Qt4RunConfiguration::invalidateCachedTargetInformation()
|
||||
|
||||
QString Qt4RunConfiguration::dumperLibrary() const
|
||||
{
|
||||
Qt4Project *pro = qobject_cast<Qt4Project *>(project());
|
||||
QtVersion *version = pro->qtVersion(pro->activeBuildConfiguration());
|
||||
QtVersion *version = qt4Project()->activeQt4BuildConfiguration()->qtVersion();
|
||||
if (version)
|
||||
return version->debuggingHelperLibrary();
|
||||
else
|
||||
@@ -663,8 +669,7 @@ QString Qt4RunConfiguration::dumperLibrary() const
|
||||
|
||||
QStringList Qt4RunConfiguration::dumperLibraryLocations() const
|
||||
{
|
||||
Qt4Project *pro = qobject_cast<Qt4Project *>(project());
|
||||
QtVersion *version = pro->qtVersion(pro->activeBuildConfiguration());
|
||||
QtVersion *version = qt4Project()->activeQt4BuildConfiguration()->qtVersion();
|
||||
if (version)
|
||||
return version->debuggingHelperLibraryLocations();
|
||||
else
|
||||
@@ -685,8 +690,8 @@ Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBas
|
||||
}
|
||||
ProjectExplorer::ToolChain::ToolChainType Qt4RunConfiguration::toolChainType() const
|
||||
{
|
||||
Qt4Project *pro = qobject_cast<Qt4Project *>(project());
|
||||
return pro->toolChainType(pro->activeBuildConfiguration());
|
||||
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
|
||||
return qt4bc->toolChainType();
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
@@ -65,6 +65,8 @@ public:
|
||||
Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath);
|
||||
virtual ~Qt4RunConfiguration();
|
||||
|
||||
Qt4Project *qt4Project() const;
|
||||
|
||||
virtual QString type() const;
|
||||
virtual bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
virtual QWidget *configurationWidget();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user