From 935a54c167cfde312f56f83193da3ad588785c77 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Fri, 3 Jul 2009 12:46:19 +0200
Subject: [PATCH] Always show the wizard even if we already have a recent
 enough cbp file.

That case is a corner case, it can happen if the user has run the codeblocks generator on the command line or if the user deleted the .user file. We mostly ask to get the user a chance to check that we set the correct generator. Or let him select the correct one if there are multiple msvc versions.
---
 .../cmakeopenprojectwizard.cpp                | 38 +++++++------------
 .../cmakeopenprojectwizard.h                  | 14 +------
 2 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
index ae955202252..9d07264c745 100644
--- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
@@ -82,7 +82,6 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
 
     setPage(InSourcePageId, new InSourceBuildPage(this));
     setPage(ShadowBuildPageId, new ShadowBuildPage(this));
-    setPage(XmlFileUpToDatePageId, new XmlFileUpToDatePage(this));
     setPage(CMakeRunPageId, new CMakeRunPage(this));
 
     setStartId(startid);
@@ -137,15 +136,9 @@ int CMakeOpenProjectWizard::nextId() const
         return QWizard::nextId();
     int cid = currentId();
     if (cid == InSourcePageId) {
-        if (existsUpToDateXmlFile())
-            return XmlFileUpToDatePageId;
-        else
-            return CMakeRunPageId;
+        return CMakeRunPageId;
     } else if (cid == ShadowBuildPageId) {
-        if (existsUpToDateXmlFile())
-            return XmlFileUpToDatePageId;
-        else
-            return CMakeRunPageId;
+        return CMakeRunPageId;
     }
     return -1;
 }
@@ -227,18 +220,6 @@ InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard)
 }
 
 
-XmlFileUpToDatePage::XmlFileUpToDatePage(CMakeOpenProjectWizard *cmakeWizard)
-    : QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
-{
-    setLayout(new QVBoxLayout);
-    QLabel *label = new QLabel(this);
-    label->setWordWrap(true);
-    label->setText(tr("Qt Creator has found a recent cbp file, which Qt Creator will parse to gather information about the project. "
-                   "You can change the command line arguments used to create this file in the project mode. "
-                   "Click finish to load the project."));
-    layout()->addWidget(label);
-}
-
 ShadowBuildPage::ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool change)
     : QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
 {
@@ -313,10 +294,19 @@ void CMakeRunPage::initWidgets()
 void CMakeRunPage::initializePage()
 {
     if (m_mode == Initial) {
+        m_complete = m_cmakeWizard->existsUpToDateXmlFile();
         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));
+
+        if (m_cmakeWizard->existsUpToDateXmlFile()) {
+            m_descriptionLabel->setText(
+                    tr("The directoyr %1 already contains a cbp file, which is recent enough. "
+                       "You can pass special arguments or change the used toolchain here and rerun cmake. "
+                       "Or simply finish the wizard directly").arg(m_buildDirectory));
+        } else {
+            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 if (m_mode == CMakeRunPage::Update) {
         m_descriptionLabel->setText(tr("The directory %1 contains an outdated .cbp file. Qt "
                                        "Creator needs to update this file by running cmake. "
diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
index 908ea70d7be..e60dcc153d0 100644
--- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
+++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
@@ -58,7 +58,6 @@ public:
     enum PageId {
         InSourcePageId,
         ShadowBuildPageId,
-        XmlFileUpToDatePageId,
         CMakeRunPageId
     };
 
@@ -85,9 +84,9 @@ public:
     ProjectExplorer::Environment environment() const;
     QString msvcVersion() const;
     void setMsvcVersion(const QString &version);
+    bool existsUpToDateXmlFile() const;
 private:
     void init();
-    bool existsUpToDateXmlFile() const;
     bool hasInSourceBuild() const;
     CMakeManager *m_cmakeManager;
     QString m_buildDirectory;
@@ -107,17 +106,6 @@ private:
     CMakeOpenProjectWizard *m_cmakeWizard;
 };
 
-
-class XmlFileUpToDatePage : public QWizardPage
-{
-    Q_OBJECT
-public:
-    XmlFileUpToDatePage(CMakeOpenProjectWizard *cmakeWizard);
-private:
-    CMakeOpenProjectWizard *m_cmakeWizard;
-};
-
-
 class ShadowBuildPage : public QWizardPage
 {
     Q_OBJECT
-- 
GitLab