1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef CMAKEOPENPROJECTWIZARD_H
35 #define CMAKEOPENPROJECTWIZARD_H
37 #include <utils/environment.h>
38 #include <utils/wizard.h>
39 #include <utils/qtcprocess.h>
41 #include <QtGui/QPushButton>
42 #include <QtGui/QComboBox>
43 #include <QtGui/QLineEdit>
44 #include <QtGui/QLabel>
45 #include <QtGui/QPlainTextEdit>
51 namespace ProjectExplorer {
55 namespace CMakeProjectManager {
60 class CMakeOpenProjectWizard : public Utils::Wizard
77 // used at importing a project without a .user file
78 CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const Utils::Environment &env);
79 /// used to update if we have already a .user file
80 /// recreates or updates the cbp file
81 CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &buildDirectory, Mode mode, const Utils::Environment &env);
82 /// used to change the build directory of one buildconfiguration
83 /// shows a page for selecting a directory
84 /// then the run cmake page
85 CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory, const Utils::Environment &env);
87 virtual int nextId() const;
88 QString buildDirectory() const;
89 QString sourceDirectory() const;
90 void setBuildDirectory(const QString &directory);
91 CMakeManager *cmakeManager() const;
92 QString arguments() const;
93 void setArguments(const QString &args);
94 ProjectExplorer::ToolChain *toolChain() const;
95 void setToolChain(ProjectExplorer::ToolChain *);
96 Utils::Environment environment() const;
97 bool existsUpToDateXmlFile() const;
101 bool hasInSourceBuild() const;
102 CMakeManager *m_cmakeManager;
103 QString m_buildDirectory;
104 QString m_sourceDirectory;
106 bool m_creatingCbpFiles;
107 Utils::Environment m_environment;
108 ProjectExplorer::ToolChain *m_toolChain;
111 class InSourceBuildPage : public QWizardPage
115 InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard);
117 CMakeOpenProjectWizard *m_cmakeWizard;
120 class ShadowBuildPage : public QWizardPage
124 explicit ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool change = false);
126 void buildDirectoryChanged();
128 CMakeOpenProjectWizard *m_cmakeWizard;
129 Utils::PathChooser *m_pc;
132 class CMakeRunPage : public QWizardPage
136 enum Mode { Initial, NeedToUpdate, Recreate, ChangeDirectory, WantToUpdate };
137 explicit CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode = Initial, const QString &buildDirectory = QString());
139 virtual void initializePage();
140 virtual void cleanupPage();
141 virtual bool isComplete() const;
144 void cmakeFinished();
145 void cmakeReadyReadStandardOutput();
146 void cmakeReadyReadStandardError();
149 CMakeOpenProjectWizard *m_cmakeWizard;
150 QPlainTextEdit *m_output;
151 QPushButton *m_runCMake;
152 Utils::QtcProcess *m_cmakeProcess;
153 QLineEdit *m_argumentsLineEdit;
154 Utils::PathChooser *m_cmakeExecutable;
155 QComboBox *m_generatorComboBox;
156 QLabel *m_descriptionLabel;
157 QLabel *m_exitCodeLabel;
160 QString m_buildDirectory;
166 #endif // CMAKEOPENPROJECTWIZARD_H