From cd93d9e3ddcccd4b0e187a546c70ddc950897816 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Date: Fri, 27 Mar 2009 20:44:50 +0100 Subject: [PATCH] make changing the build dir of a shadow build work --- .../cmakeopenprojectwizard.cpp | 44 ++++++++++++------- .../cmakeopenprojectwizard.h | 3 ++ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 6907864e62d..842536f3ccd 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -214,8 +214,7 @@ void ShadowBuildPage::buildDirectoryChanged() CMakeRunPage::CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard) : QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard), - m_complete(false), - m_buildDirectory(m_cmakeWizard->buildDirectory()) + m_complete(false) { initWidgets(); } @@ -224,21 +223,10 @@ CMakeRunPage::CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, const QString &b : QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard), m_complete(false), - m_buildDirectory(buildDirectory) + m_update(update), + m_presetBuildDirectory(buildDirectory) { initWidgets(); - // TODO tell the user more? - if (update) - m_descriptionLabel->setText(tr("The directory %1 contains an outdated .cbp file. Qt " - "Creator needs to update this file by running cmake. " - "If you want to add additional command line arguments, " - "add them in the below.").arg(m_buildDirectory)); - else - m_descriptionLabel->setText(tr("The directory %1, specified in a buildconfiguration, " - "does not contain a cbp file. Qt Creator needs to " - "recreate this file, by running cmake. " - "Some projects require command line arguments to " - "the initial cmake call.").arg(m_buildDirectory)); } void CMakeRunPage::initWidgets() @@ -247,8 +235,6 @@ void CMakeRunPage::initWidgets() setLayout(fl); m_descriptionLabel = new QLabel(this); m_descriptionLabel->setWordWrap(true); - m_descriptionLabel->setText(tr("The directory %1 does not contain a cbp file. Qt Creator needs to create this file, by running cmake. " - "Some projects require command line arguments to the initial cmake call.").arg(m_buildDirectory)); fl->addRow(m_descriptionLabel); @@ -265,6 +251,30 @@ void CMakeRunPage::initWidgets() fl->addRow(m_output); } +void CMakeRunPage::initializePage() +{ + if (m_presetBuildDirectory.isEmpty()) { + m_buildDirectory = m_cmakeWizard->buildDirectory(); + m_descriptionLabel->setText( + tr("The directory %1 does not contain a cbp file. Qt Creator needs to create this file, by running cmake. " + "Some projects require command line arguments to the initial cmake call.").arg(m_buildDirectory)); + } else { + m_buildDirectory = m_presetBuildDirectory; + // TODO tell the user more? + if (m_update) + m_descriptionLabel->setText(tr("The directory %1 contains an outdated .cbp file. Qt " + "Creator needs to update this file by running cmake. " + "If you want to add additional command line arguments, " + "add them in the below.").arg(m_buildDirectory)); + else + m_descriptionLabel->setText(tr("The directory %1, specified in a buildconfiguration, " + "does not contain a cbp file. Qt Creator needs to " + "recreate this file, by running cmake. " + "Some projects require command line arguments to " + "the initial cmake call.").arg(m_buildDirectory)); + } +} + void CMakeRunPage::runCMake() { m_runCMake->setEnabled(false); diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h index 4f8c4a726b0..27277151d13 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h @@ -115,6 +115,7 @@ class CMakeRunPage : public QWizardPage public: CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard); CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, const QString &buildDirectory, bool update); + virtual void initializePage(); virtual void cleanupPage(); virtual bool isComplete() const; private slots: @@ -130,7 +131,9 @@ private: QLineEdit *m_argumentsLineEdit; QLabel *m_descriptionLabel; bool m_complete; + bool m_update; QString m_buildDirectory; + QString m_presetBuildDirectory; }; } -- GitLab