forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: src/plugins/qt4projectmanager/qt4buildconfiguration.cpp src/plugins/qtsupport/baseqtversion.cpp Change-Id: Id870f70aa35c232dbbd455f83429bab80f266c2d
This commit is contained in:
@@ -142,7 +142,6 @@ ProjectExplorer::IOutputParser *CMakeBuildConfiguration::createOutputParser() co
|
||||
Utils::Environment CMakeBuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
Utils::Environment env = BuildConfiguration::baseEnvironment();
|
||||
target()->kit()->addToEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,32 +203,23 @@ QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, N
|
||||
CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, Utils::Environment env)
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(sourceDirectory),
|
||||
m_creatingCbpFiles(false),
|
||||
m_environment(env),
|
||||
m_useNinja(false),
|
||||
m_kit(0)
|
||||
{
|
||||
int startid;
|
||||
if (hasInSourceBuild()) {
|
||||
startid = InSourcePageId;
|
||||
m_buildDirectory = m_sourceDirectory;
|
||||
addPage(new InSourceBuildPage(this));
|
||||
} else {
|
||||
startid = ShadowBuildPageId;
|
||||
m_buildDirectory = m_sourceDirectory + QLatin1String("-build");
|
||||
addPage(new ShadowBuildPage(this));
|
||||
}
|
||||
|
||||
setPage(InSourcePageId, new InSourceBuildPage(this));
|
||||
setPage(ShadowBuildPageId, new ShadowBuildPage(this));
|
||||
setPage(CMakeRunPageId, new CMakeRunPage(this));
|
||||
if (!m_cmakeManager->isCMakeExecutableValid())
|
||||
addPage(new ChooseCMakePage(this));
|
||||
|
||||
Utils::WizardProgress *wp = wizardProgress();
|
||||
Utils::WizardProgressItem *inSourceItem = wp->item(InSourcePageId);
|
||||
Utils::WizardProgressItem *shadowBuildItem = wp->item(ShadowBuildPageId);
|
||||
Utils::WizardProgressItem *cmakeRunItem = wp->item(CMakeRunPageId);
|
||||
inSourceItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);
|
||||
shadowBuildItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);
|
||||
addPage(new CMakeRunPage(this));
|
||||
|
||||
setStartId(startid);
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -236,7 +227,6 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMake
|
||||
const BuildInfo &info)
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(info.sourceDirectory),
|
||||
m_creatingCbpFiles(true),
|
||||
m_environment(info.environment),
|
||||
m_useNinja(info.useNinja),
|
||||
m_kit(info.kit)
|
||||
@@ -255,6 +245,8 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMake
|
||||
m_buildDirectory = info.buildDirectory;
|
||||
addPage(new ShadowBuildPage(this, true));
|
||||
}
|
||||
if (!m_cmakeManager->isCMakeExecutableValid())
|
||||
addPage(new ChooseCMakePage(this));
|
||||
|
||||
addPage(new CMakeRunPage(this, rmode, info.buildDirectory));
|
||||
init();
|
||||
@@ -271,20 +263,6 @@ CMakeManager *CMakeOpenProjectWizard::cmakeManager() const
|
||||
return m_cmakeManager;
|
||||
}
|
||||
|
||||
int CMakeOpenProjectWizard::nextId() const
|
||||
{
|
||||
if (m_creatingCbpFiles)
|
||||
return QWizard::nextId();
|
||||
int cid = currentId();
|
||||
if (cid == InSourcePageId) {
|
||||
return CMakeRunPageId;
|
||||
} else if (cid == ShadowBuildPageId) {
|
||||
return CMakeRunPageId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool CMakeOpenProjectWizard::hasInSourceBuild() const
|
||||
{
|
||||
QFileInfo fi(m_sourceDirectory + "/CMakeCache.txt");
|
||||
@@ -401,6 +379,61 @@ void ShadowBuildPage::buildDirectoryChanged()
|
||||
m_cmakeWizard->setBuildDirectory(m_pc->path());
|
||||
}
|
||||
|
||||
ChooseCMakePage::ChooseCMakePage(CMakeOpenProjectWizard *cmakeWizard)
|
||||
: QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout;
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
setLayout(fl);
|
||||
|
||||
m_cmakeLabel = new QLabel;
|
||||
m_cmakeLabel->setWordWrap(true);
|
||||
fl->addRow(m_cmakeLabel);
|
||||
// Show a field for the user to enter
|
||||
m_cmakeExecutable = new Utils::PathChooser(this);
|
||||
m_cmakeExecutable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
fl->addRow("cmake Executable:", m_cmakeExecutable);
|
||||
|
||||
connect(m_cmakeExecutable, SIGNAL(editingFinished()),
|
||||
this, SLOT(cmakeExecutableChanged()));
|
||||
connect(m_cmakeExecutable, SIGNAL(browsingFinished()),
|
||||
this, SLOT(cmakeExecutableChanged()));
|
||||
|
||||
setTitle(tr("Choose Cmake Executable"));
|
||||
}
|
||||
|
||||
void ChooseCMakePage::updateErrorText()
|
||||
{
|
||||
QString cmakeExecutable = m_cmakeWizard->cmakeManager()->cmakeExecutable();
|
||||
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
|
||||
m_cmakeLabel->setText(tr("The cmake executable is valid."));
|
||||
} else {
|
||||
QString text = tr("Please specify the path to the cmake executable. No cmake executable was found in the path.");
|
||||
if (!cmakeExecutable.isEmpty()) {
|
||||
QFileInfo fi(cmakeExecutable);
|
||||
if (!fi.exists())
|
||||
text += tr(" The cmake executable (%1) does not exist.").arg(cmakeExecutable);
|
||||
else if (!fi.isExecutable())
|
||||
text += tr(" The path %1 is not a executable.").arg(cmakeExecutable);
|
||||
else
|
||||
text += tr(" The path %1 is not a valid cmake.").arg(cmakeExecutable);
|
||||
}
|
||||
m_cmakeLabel->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
void ChooseCMakePage::cmakeExecutableChanged()
|
||||
{
|
||||
m_cmakeWizard->cmakeManager()->setCMakeExecutable(m_cmakeExecutable->path());
|
||||
updateErrorText();
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
bool ChooseCMakePage::isComplete() const
|
||||
{
|
||||
return m_cmakeWizard->cmakeManager()->isCMakeExecutableValid();
|
||||
}
|
||||
|
||||
CMakeRunPage::CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode, const QString &buildDirectory)
|
||||
: QWizardPage(cmakeWizard),
|
||||
m_cmakeWizard(cmakeWizard),
|
||||
@@ -423,30 +456,6 @@ void CMakeRunPage::initWidgets()
|
||||
|
||||
fl->addRow(m_descriptionLabel);
|
||||
|
||||
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
|
||||
m_cmakeExecutable = 0;
|
||||
} else {
|
||||
QString text = tr("Please specify the path to the cmake executable. No cmake executable was found in the path.");
|
||||
QString cmakeExecutable = m_cmakeWizard->cmakeManager()->cmakeExecutable();
|
||||
if (!cmakeExecutable.isEmpty()) {
|
||||
QFileInfo fi(cmakeExecutable);
|
||||
if (!fi.exists())
|
||||
text += tr(" The cmake executable (%1) does not exist.").arg(cmakeExecutable);
|
||||
else if (!fi.isExecutable())
|
||||
text += tr(" The path %1 is not a executable.").arg(cmakeExecutable);
|
||||
else
|
||||
text += tr(" The path %1 is not a valid cmake.").arg(cmakeExecutable);
|
||||
}
|
||||
|
||||
QLabel *cmakeLabel = new QLabel(text);
|
||||
cmakeLabel->setWordWrap(true);
|
||||
fl->addRow(cmakeLabel);
|
||||
// Show a field for the user to enter
|
||||
m_cmakeExecutable = new Utils::PathChooser(this);
|
||||
m_cmakeExecutable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
fl->addRow("cmake Executable:", m_cmakeExecutable);
|
||||
}
|
||||
|
||||
// Run CMake Line (with arguments)
|
||||
m_argumentsLineEdit = new Utils::FancyLineEdit(this);
|
||||
m_argumentsLineEdit->setHistoryCompleter(QLatin1String("CMakeArgumentsLineEdit"));
|
||||
@@ -612,10 +621,6 @@ bool CMakeRunPage::validatePage()
|
||||
|
||||
void CMakeRunPage::runCMake()
|
||||
{
|
||||
if (m_cmakeExecutable)
|
||||
// We asked the user for the cmake executable
|
||||
m_cmakeWizard->cmakeManager()->setCMakeExecutable(m_cmakeExecutable->path());
|
||||
|
||||
m_optionalCMake = false;
|
||||
m_complete = false;
|
||||
|
||||
|
||||
@@ -62,12 +62,6 @@ class CMakeOpenProjectWizard : public Utils::Wizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum PageId {
|
||||
InSourcePageId,
|
||||
ShadowBuildPageId,
|
||||
CMakeRunPageId
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
Nothing,
|
||||
NeedToCreate,
|
||||
@@ -105,8 +99,6 @@ public:
|
||||
/// Also used to change the build directory of one buildconfiguration or create a new buildconfiguration
|
||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, Mode mode, const BuildInfo &info);
|
||||
|
||||
|
||||
virtual int nextId() const;
|
||||
QString buildDirectory() const;
|
||||
QString sourceDirectory() const;
|
||||
void setBuildDirectory(const QString &directory);
|
||||
@@ -127,7 +119,6 @@ private:
|
||||
QString m_buildDirectory;
|
||||
QString m_sourceDirectory;
|
||||
QString m_arguments;
|
||||
bool m_creatingCbpFiles;
|
||||
Utils::Environment m_environment;
|
||||
bool m_useNinja;
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
@@ -154,6 +145,22 @@ private:
|
||||
Utils::PathChooser *m_pc;
|
||||
};
|
||||
|
||||
class ChooseCMakePage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChooseCMakePage(CMakeOpenProjectWizard *cmakeWizard);
|
||||
|
||||
virtual bool isComplete() const;
|
||||
public slots:
|
||||
void cmakeExecutableChanged();
|
||||
private:
|
||||
void updateErrorText();
|
||||
QLabel *m_cmakeLabel;
|
||||
CMakeOpenProjectWizard *m_cmakeWizard;
|
||||
Utils::PathChooser *m_cmakeExecutable;
|
||||
};
|
||||
|
||||
class CMakeRunPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -178,7 +185,6 @@ private:
|
||||
QPushButton *m_runCMake;
|
||||
Utils::QtcProcess *m_cmakeProcess;
|
||||
Utils::FancyLineEdit *m_argumentsLineEdit;
|
||||
Utils::PathChooser *m_cmakeExecutable;
|
||||
QComboBox *m_generatorComboBox;
|
||||
QLabel *m_descriptionLabel;
|
||||
QLabel *m_exitCodeLabel;
|
||||
|
||||
Reference in New Issue
Block a user