diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.cpp b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.cpp deleted file mode 100644 index cec6c29cf64..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (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 qt-sales@nokia.com. -** -**************************************************************************/ - -#include "cmakeconfigurewidget.h" -#include "cmakeprojectmanager.h" -#include -#include -#include -#include - -using namespace CMakeProjectManager; -using namespace CMakeProjectManager::Internal; - -CMakeConfigureWidget::CMakeConfigureWidget(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory) - : QWidget(parent), m_configureSucceded(false), m_cmakeManager(manager), m_sourceDirectory(sourceDirectory) -{ - m_ui.setupUi(this); - m_ui.buildDirectoryLineEdit->setPath(sourceDirectory + "/qtcreator-build"); - - connect(m_ui.configureButton, SIGNAL(clicked()), this, SLOT(runCMake())); - // TODO make the configure button do stuff - // TODO set initial settings - // TODO note if there's already a build in that directory - // detect which generators we have - // let the user select generator -} - -QString CMakeConfigureWidget::buildDirectory() -{ - return m_ui.buildDirectoryLineEdit->path(); -} - -QStringList CMakeConfigureWidget::arguments() -{ - return ProjectExplorer::Environment::parseCombinedArgString(m_ui.cmakeArgumentsLineEdit->text()); -} - -bool CMakeConfigureWidget::configureSucceded() -{ - return m_configureSucceded; -} - -void CMakeConfigureWidget::runCMake() -{ - // TODO run project createCbp() - // get output and display it - - // TODO analyse wheter this worked out - m_ui.cmakeOutput->setPlainText(tr("Waiting for cmake...")); - QString string = m_cmakeManager->createXmlFile(arguments(), m_sourceDirectory, buildDirectory()); - m_ui.cmakeOutput->setPlainText(string); -} - -////// -// CMakeConfigureDialog -///// - -CMakeConfigureDialog::CMakeConfigureDialog(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory) - : QDialog(parent) -{ - QVBoxLayout *vbox = new QVBoxLayout(this); - setLayout(vbox); - - m_cmakeConfigureWidget = new CMakeConfigureWidget(this, manager, sourceDirectory); - vbox->addWidget(m_cmakeConfigureWidget); - - QHBoxLayout *hboxlayout = new QHBoxLayout(this); - hboxlayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed)); - - - QPushButton *okButton = new QPushButton(this); - okButton->setText(tr("Ok")); - okButton->setDefault(true); - connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); - - hboxlayout->addWidget(okButton); - vbox->addLayout(hboxlayout); -} - -QString CMakeConfigureDialog::buildDirectory() -{ - return m_cmakeConfigureWidget->buildDirectory(); -} - -QStringList CMakeConfigureDialog::arguments() -{ - return m_cmakeConfigureWidget->arguments(); -} - -bool CMakeConfigureDialog::configureSucceded() -{ - return m_cmakeConfigureWidget->configureSucceded(); -} diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.h b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.h deleted file mode 100644 index ef9c19708e9..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (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 qt-sales@nokia.com. -** -**************************************************************************/ - -#ifndef CMAKECONFIGUREWIDGET_H -#define CMAKECONFIGUREWIDGET_H - -#include "ui_cmakeconfigurewidget.h" -#include -#include - -namespace CMakeProjectManager { -namespace Internal { - -class CMakeManager; - -class CMakeConfigureWidget : public QWidget -{ - Q_OBJECT -public: - CMakeConfigureWidget(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory); - Ui::CMakeConfigureWidget m_ui; - - QString buildDirectory(); - QStringList arguments(); - bool configureSucceded(); - -private slots: - void runCMake(); -private: - bool m_configureSucceded; - CMakeManager *m_cmakeManager; - QString m_sourceDirectory; -}; - -class CMakeConfigureDialog : public QDialog -{ -public: - CMakeConfigureDialog(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory); - - QString buildDirectory(); - QStringList arguments(); - bool configureSucceded(); - -private: - CMakeConfigureWidget *m_cmakeConfigureWidget; -}; - -} -} - -#endif // CMAKECONFIGUREWIDGET_H diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.ui b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.ui deleted file mode 100644 index cdca9035e6f..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.ui +++ /dev/null @@ -1,95 +0,0 @@ - - - CMakeProjectManager::Internal::CMakeConfigureWidget - - - - 0 - 0 - 521 - 662 - - - - Form - - - - - - - - CMake Arguments: - - - - - - - - - - Builddirectory: - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Run cmake - - - - - - - - - - - - - Core::Utils::PathChooser - QLineEdit -
utils/pathchooser.h
-
-
- - -
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index d3cd433bbde..05ae4c52b44 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -28,13 +28,11 @@ **************************************************************************/ #include "cmakeproject.h" -#include "ui_cmakeconfigurewidget.h" -#include "cmakeconfigurewidget.h" #include "cmakeprojectconstants.h" #include "cmakeprojectnodes.h" #include "cmakerunconfiguration.h" -#include "cmakestep.h" #include "makestep.h" +#include "cmakeopenprojectwizard.h" #include #include @@ -84,9 +82,8 @@ void CMakeProject::parseCMakeLists() { ProjectExplorer::ToolChain *newToolChain = 0; QString sourceDirectory = QFileInfo(m_fileName).absolutePath(); - m_manager->createXmlFile(cmakeStep()->userArguments(activeBuildConfiguration()), sourceDirectory, buildDirectory(activeBuildConfiguration())); - QString cbpFile = findCbpFile(buildDirectory(activeBuildConfiguration())); + QString cbpFile = CMakeManager::findCbpFile(buildDirectory(activeBuildConfiguration())); CMakeCbpParser cbpparser; qDebug()<<"Parsing file "<type() == ProjectExplorer::ToolChain::GCC @@ -182,20 +181,6 @@ QStringList CMakeProject::targets() const return results; } -QString CMakeProject::findCbpFile(const QDir &directory) -{ - // Find the cbp file - // TODO the cbp file is named like the project() command in the CMakeList.txt file - // so this method below could find the wrong cbp file, if the user changes the project() - // name - foreach (const QString &cbpFile , directory.entryList()) { - if (cbpFile.endsWith(".cbp")) - return directory.path() + "/" + cbpFile; - } - return QString::null; -} - - void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList list) { //m_rootNode->addFileNodes(fileList, m_rootNode); @@ -324,47 +309,39 @@ MakeStep *CMakeProject::makeStep() const return 0; } -CMakeStep *CMakeProject::cmakeStep() const -{ - foreach (ProjectExplorer::BuildStep *bs, buildSteps()) { - if (CMakeStep *cs = qobject_cast(bs)) - return cs; - } - return 0; -} - void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader) { - // TODO Project::restoreSettingsImpl(reader); bool hasUserFile = !buildConfigurations().isEmpty(); if (!hasUserFile) { // Ask the user for where he wants to build it // and the cmake command line - // TODO check wheter there's already a CMakeCache.txt in the src directory, - // then we don't need to ask, we simply need to build in the src directory + CMakeOpenProjectWizard copw(m_manager, QFileInfo(m_fileName).absolutePath()); + copw.exec(); + // TODO handle cancel.... - CMakeConfigureDialog ccd(Core::ICore::instance()->mainWindow(), m_manager, QFileInfo(m_fileName).absolutePath()); - ccd.exec(); - - qDebug()<<"ccd.buildDirectory()"<setBuildTarget("all", "all", true); - if (!ccd.buildDirectory().isEmpty()) - setValue("all", "buildDirectory", ccd.buildDirectory()); - cmakeStep->setUserArguments("all", ccd.arguments()); + if (!copw.buildDirectory().isEmpty()) + setValue("all", "buildDirectory", copw.buildDirectory()); + //TODO save arguments somewhere copw.arguments() + } else { + // We have a user file, but we could still be missing the cbp file + // TODO check that we have a cbp file and if not, open up a dialog ? + // or simply run createXml with the saved settings + } + parseCMakeLists(); // Gets the directory from the active buildconfiguration if (!hasUserFile) { diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index 5712b7957dc..1627356d8e7 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -33,7 +33,6 @@ #include "cmakeprojectmanager.h" #include "cmakeprojectnodes.h" #include "makestep.h" -#include "cmakestep.h" #include #include @@ -99,13 +98,11 @@ public: virtual QStringList files(FilesMode fileMode) const; MakeStep *makeStep() const; - CMakeStep *cmakeStep() const; QStringList targets() const; QString buildParser(const QString &buildConfiguration) const; private: void parseCMakeLists(); - QString findCbpFile(const QDir &); void buildTree(CMakeProjectNode *rootNode, QList list); ProjectExplorer::FolderNode *findOrCreateFolder(CMakeProjectNode *rootNode, QString directory); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index ce1c8508b20..a81340fc7b1 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -35,7 +35,6 @@ namespace Constants { const char * const PROJECTCONTEXT = "CMakeProject.ProjectContext"; const char * const CMAKEMIMETYPE = "text/x-cmake"; // TOOD check that this is correct -const char * const CMAKESTEP = "CMakeProjectManager.CMakeStep"; const char * const MAKESTEP = "CMakeProjectManager.MakeStep"; const char * const CMAKERUNCONFIGURATION = "CMakeProjectManager.CMakeRunConfiguration"; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 1a8e2fd49a7..4032b142336 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -94,7 +94,7 @@ QString CMakeManager::cmakeExecutable() const // we probably want the process instead of this function // cmakeproject then could even run the cmake process in the background, adding the files afterwards // sounds like a plan -QString CMakeManager::createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory) +QProcess *CMakeManager::createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory) { // We create a cbp file, only if we didn't find a cbp file in the base directory // Yet that can still override cbp files in subdirectories @@ -108,20 +108,29 @@ QString CMakeManager::createXmlFile(const QStringList &arguments, const QString QString buildDirectoryPath = buildDirectory.absolutePath(); qDebug()<<"Creating cbp file in"<setWorkingDirectory(buildDirectoryPath); QString generator = "-GCodeBlocks - Unix Makefiles"; - cmake.start(cmakeExecutable(), QStringList() << sourceDirectory << arguments << generator); - - qDebug()<start(cmakeExecutable(), QStringList() << sourceDirectory << arguments << generator); + return cmake; } +QString CMakeManager::findCbpFile(const QDir &directory) +{ + // Find the cbp file + // TODO the cbp file is named like the project() command in the CMakeList.txt file + // so this method below could find the wrong cbp file, if the user changes the project() + // 2name + foreach (const QString &cbpFile , directory.entryList()) { + if (cbpFile.endsWith(".cbp")) + return directory.path() + "/" + cbpFile; + } + return QString::null; +} + + ///// // CMakeRunner diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h index 9d8be1c0f4f..f4c18f906ad 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h @@ -37,6 +37,8 @@ #include #include +QT_FORWARD_DECLARE_CLASS(QProcess) + namespace CMakeProjectManager { namespace Internal { @@ -56,7 +58,8 @@ public: virtual QString mimeType() const; QString cmakeExecutable() const; - QString createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory); + QProcess* createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory); + static QString findCbpFile(const QDir &); private: int m_projectContext; int m_projectLanguage; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro index c6f238c822c..c5e260b8e9b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro @@ -7,17 +7,15 @@ HEADERS = cmakeproject.h \ cmakeprojectmanager.h \ cmakeprojectconstants.h \ cmakeprojectnodes.h \ - cmakestep.h \ makestep.h \ cmakerunconfiguration.h \ - cmakeconfigurewidget.h + cmakeopenprojectwizard.h SOURCES = cmakeproject.cpp \ cmakeprojectplugin.cpp \ cmakeprojectmanager.cpp \ cmakeprojectnodes.cpp \ - cmakestep.cpp \ makestep.cpp \ cmakerunconfiguration.cpp \ - cmakeconfigurewidget.cpp + cmakeopenprojectwizard.cpp RESOURCES += cmakeproject.qrc -FORMS += cmakeconfigurewidget.ui +FORMS += diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index 1a7d41c17db..de077c2dc94 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -30,7 +30,6 @@ #include "cmakeprojectplugin.h" #include "cmakeprojectmanager.h" #include "cmakerunconfiguration.h" -#include "cmakestep.h" #include "makestep.h" #include @@ -58,7 +57,6 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString * CMakeSettingsPage *cmp = new CMakeSettingsPage(); addAutoReleasedObject(cmp); addAutoReleasedObject(new CMakeManager(cmp)); - addAutoReleasedObject(new CMakeBuildStepFactory()); addAutoReleasedObject(new MakeBuildStepFactory()); addAutoReleasedObject(new CMakeRunConfigurationFactory()); return true; diff --git a/src/plugins/cmakeprojectmanager/cmakestep.cpp b/src/plugins/cmakeprojectmanager/cmakestep.cpp deleted file mode 100644 index 7c95e082821..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakestep.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (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 qt-sales@nokia.com. -** -**************************************************************************/ - -#include "cmakestep.h" - -#include "cmakeproject.h" -#include "cmakeprojectconstants.h" - -#include -#include -#include -#include - -using namespace CMakeProjectManager; -using namespace CMakeProjectManager::Internal; - -CMakeStep::CMakeStep(CMakeProject *pro) - : AbstractProcessStep(pro), m_pro(pro) -{ -} - -CMakeStep::~CMakeStep() -{ -} - -bool CMakeStep::init(const QString &buildConfiguration) -{ - setEnabled(buildConfiguration, true); - setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration)); - - CMakeManager *cmakeProjectManager = static_cast(m_pro->projectManager()); - - setCommand(buildConfiguration, cmakeProjectManager->cmakeExecutable()); - - QString sourceDir = QFileInfo(m_pro->file()->fileName()).absolutePath(); - setArguments(buildConfiguration, - QStringList() - << sourceDir - << "-GUnix Makefiles" - << value(buildConfiguration, "userArguments").toStringList()); // TODO - - setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration)); - return AbstractProcessStep::init(buildConfiguration); -} - -void CMakeStep::run(QFutureInterface &fi) -{ - // TODO we want to only run cmake if the command line arguments or - // the CmakeLists.txt has actually changed - // And we want all of them to share the SAME command line arguments - // Shadow building ruins this, hmm, hmm - // - AbstractProcessStep::run(fi); -} - -QString CMakeStep::name() -{ - return Constants::CMAKESTEP; -} - -QString CMakeStep::displayName() -{ - return "CMake"; -} - -ProjectExplorer::BuildStepConfigWidget *CMakeStep::createConfigWidget() -{ - return new CMakeBuildStepConfigWidget(this); -} - -bool CMakeStep::immutable() const -{ - return true; -} - -QStringList CMakeStep::userArguments(const QString &buildConfiguration) const -{ - return value(buildConfiguration, "userArguments").toStringList(); -} - -void CMakeStep::setUserArguments(const QString &buildConfiguration, const QStringList &arguments) -{ - setValue(buildConfiguration, "userArguments", arguments); -} - -// -// CMakeBuildStepConfigWidget -// - -CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeStep *cmakeStep) - : m_cmakeStep(cmakeStep) -{ - QFormLayout *fl = new QFormLayout(this); - setLayout(fl); - m_arguments = new QLineEdit(this); - fl->addRow("Additional arguments", m_arguments); - connect(m_arguments, SIGNAL(textChanged(QString)), this, SLOT(argumentsLineEditChanged())); -} - -QString CMakeBuildStepConfigWidget::displayName() const -{ - return "CMake"; -} - -void CMakeBuildStepConfigWidget::init(const QString &buildConfiguration) -{ - m_buildConfiguration = buildConfiguration; - disconnect(m_arguments, SIGNAL(textChanged(QString)), this, SLOT(argumentsLineEditChanged())); - m_arguments->setText(ProjectExplorer::Environment::joinArgumentList(m_cmakeStep->userArguments(buildConfiguration))); - connect(m_arguments, SIGNAL(textChanged(QString)), this, SLOT(argumentsLineEditChanged())); -} - -void CMakeBuildStepConfigWidget::argumentsLineEditChanged() -{ - m_cmakeStep->setUserArguments(m_buildConfiguration, ProjectExplorer::Environment::parseCombinedArgString(m_arguments->text())); -} - -// -// CMakeBuildStepFactory -// - -bool CMakeBuildStepFactory::canCreate(const QString &name) const -{ - return (Constants::CMAKESTEP == name); -} - -ProjectExplorer::BuildStep *CMakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const -{ - Q_ASSERT(name == Constants::CMAKESTEP); - CMakeProject *pro = qobject_cast(project); - Q_ASSERT(pro); - return new CMakeStep(pro); -} - -QStringList CMakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const -{ - return QStringList(); -} - -QString CMakeBuildStepFactory::displayNameForName(const QString & /* name */) const -{ - return "CMake"; -} - diff --git a/src/plugins/cmakeprojectmanager/cmakestep.h b/src/plugins/cmakeprojectmanager/cmakestep.h deleted file mode 100644 index 768fe49306d..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakestep.h +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (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 qt-sales@nokia.com. -** -**************************************************************************/ - -#ifndef CMAKESTEP_H -#define CMAKESTEP_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QLineEdit; -QT_END_NAMESPACE - -namespace CMakeProjectManager { -namespace Internal { - -class CMakeProject; - -class CMakeBuildStepConfigWidget; - -class CMakeStep : public ProjectExplorer::AbstractProcessStep -{ - Q_OBJECT -public: - CMakeStep(CMakeProject *pro); - ~CMakeStep(); - virtual bool init(const QString &buildConfiguration); - - virtual void run(QFutureInterface &fi); - - virtual QString name(); - virtual QString displayName(); - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - virtual bool immutable() const; - - void setUserArguments(const QString &buildConfiguration, const QStringList &arguments); - QStringList userArguments(const QString &buildConfiguration) const; -private: - CMakeProject *m_pro; -}; - -class CMakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT -public: - CMakeBuildStepConfigWidget(CMakeStep *cmakeStep); - virtual QString displayName() const; - virtual void init(const QString &buildConfiguration); -private slots: - void argumentsLineEditChanged(); -private: - CMakeStep *m_cmakeStep; - QString m_buildConfiguration; - QLineEdit *m_arguments; -}; - -class CMakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory -{ - virtual bool canCreate(const QString &name) const; - virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const; - virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const; - virtual QString displayNameForName(const QString &name) const; -}; - - -} -} -#endif // CMAKESTEP_H diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 216dd21c433..2aa251b4da4 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -803,10 +803,7 @@ void MainWindow::openFiles(const QStringList &fileNames) void MainWindow::setFocusToEditor() { QWidget *focusWidget = qApp->focusWidget(); - // ### Duplicated code from EditMode::makeSureEditorManagerVisible - IMode *currentMode = m_coreImpl->modeManager()->currentMode(); - if (currentMode && currentMode->uniqueModeName() != QLatin1String(Constants::MODE_EDIT) && - currentMode->uniqueModeName() != QLatin1String("GdbDebugger.Mode.Debug")) + if (!EditorManager::instance()->isVisible()) { m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT)); } @@ -814,11 +811,23 @@ void MainWindow::setFocusToEditor() if (IEditor *editor = m_editorManager->currentEditor()) editor->widget()->setFocus(); - if (focusWidget && focusWidget == qApp->focusWidget()) { - if (FindToolBarPlaceHolder::getCurrent()) - FindToolBarPlaceHolder::getCurrent()->hide(); - OutputPaneManager::instance()->slotHide(); - RightPaneWidget::instance()->setShown(false); + bool focusWasAlreadyInEditor = (focusWidget && focusWidget == qApp->focusWidget()); + if (focusWasAlreadyInEditor) { + bool stuffVisible = + (FindToolBarPlaceHolder::getCurrent() && + FindToolBarPlaceHolder::getCurrent()->isVisible()) + || (OutputPanePlaceHolder::getCurrent() && + OutputPanePlaceHolder::getCurrent()->isVisible()) + || (RightPanePlaceHolder::current() && + RightPanePlaceHolder::current()->isVisible()); + if (stuffVisible) { + if (FindToolBarPlaceHolder::getCurrent()) + FindToolBarPlaceHolder::getCurrent()->hide(); + OutputPaneManager::instance()->slotHide(); + RightPaneWidget::instance()->setShown(false); + } else { + m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT)); + } } } diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index accff656e85..58f345b2021 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -88,5 +88,5 @@ DEFINES += USE_MODEL_TEST=1 win32 { include(win/win.pri) - CONFIG(cdbdebugger):include(cdb\cdb.pri) + CONFIG(cdbdebugger):include(cdb/cdb.pri) } diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index 32125bb1007..2d0fcc5dc25 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -247,7 +247,7 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env) tf.flush(); tf.waitForBytesWritten(30000); - QProcess run; + QProcess run; // TODO run in the environment we want to add to... QString cmdPath = env.searchInPath("cmd"); run.start(cmdPath, QStringList()<<"/c"< m_profileStack; // To handle 'include(a.pri), so we can track back to 'a.pro' when finished with 'a.pri' + // we need the following two variables for handling + // CONFIG = foo bar $$CONFIG + QHash m_tempValuemap; // used while evaluating (variable operator value1 value2 ...) + QHash > m_tempFilevaluemap; // used while evaluating (variable operator value1 value2 ...) + QHash m_valuemap; // VariableName must be us-ascii, the content however can be non-us-ascii. QHash > m_filevaluemap; // Variables per include file QHash m_properties; @@ -229,6 +235,7 @@ ProFileEvaluator::Private::Private(ProFileEvaluator *q_) m_condition = ConditionFalse; m_invertNext = false; m_skipLevel = 0; + m_isFirstVariableValue = true; } bool ProFileEvaluator::Private::read(ProFile *pro) @@ -556,12 +563,17 @@ bool ProFileEvaluator::Private::visitBeginProVariable(ProVariable *variable) { m_lastVarName = variable->variable(); m_variableOperator = variable->variableOperator(); + m_isFirstVariableValue = true; + m_tempValuemap = m_valuemap; + m_tempFilevaluemap = m_filevaluemap; return true; } bool ProFileEvaluator::Private::visitEndProVariable(ProVariable *variable) { Q_UNUSED(variable); + m_valuemap = m_tempValuemap; + m_filevaluemap = m_tempFilevaluemap; m_lastVarName.clear(); return true; } @@ -702,8 +714,8 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) if (varName == QLatin1String("TARGET") && m_lineNo == m_prevLineNo && currentProFile() == m_prevProFile) { - QStringList targets = m_valuemap.value(QLatin1String("TARGET")); - m_valuemap.remove(QLatin1String("TARGET")); + QStringList targets = m_tempValuemap.value(QLatin1String("TARGET")); + m_tempValuemap.remove(QLatin1String("TARGET")); QStringList lastTarget(targets.takeLast()); lastTarget << v.join(QLatin1String(" ")); targets.push_back(lastTarget.join(QLatin1String(" "))); @@ -740,25 +752,30 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) case ProVariable::SetOperator: // = if (!m_cumulative) { if (!m_skipLevel) { - m_valuemap[varName] = v; - m_filevaluemap[currentProFile()][varName] = v; + if (m_isFirstVariableValue) { + m_tempValuemap[varName] = v; + m_tempFilevaluemap[currentProFile()][varName] = v; + } else { // handle lines "CONFIG = foo bar" + m_tempValuemap[varName] += v; + m_tempFilevaluemap[currentProFile()][varName] += v; + } } } else { // We are greedy for values. - m_valuemap[varName] += v; - m_filevaluemap[currentProFile()][varName] += v; + m_tempValuemap[varName] += v; + m_tempFilevaluemap[currentProFile()][varName] += v; } break; case ProVariable::UniqueAddOperator: // *= if (!m_skipLevel || m_cumulative) { - insertUnique(&m_valuemap, varName, v); - insertUnique(&m_filevaluemap[currentProFile()], varName, v); + insertUnique(&m_tempValuemap, varName, v); + insertUnique(&m_tempFilevaluemap[currentProFile()], varName, v); } break; case ProVariable::AddOperator: // += if (!m_skipLevel || m_cumulative) { - m_valuemap[varName] += v; - m_filevaluemap[currentProFile()][varName] += v; + m_tempValuemap[varName] += v; + m_tempFilevaluemap[currentProFile()][varName] += v; } break; case ProVariable::RemoveOperator: // -= @@ -766,16 +783,16 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) if (!m_skipLevel) { // the insertUnique is a hack for the moment to fix the // CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before) - if (removeEach(&m_valuemap, varName, v) == 0) - insertUnique(&m_valuemap, QString("-%1").arg(varName), v); - if (removeEach(&m_filevaluemap[currentProFile()], varName, v) == 0) - insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v); + if (removeEach(&m_tempValuemap, varName, v) == 0) + insertUnique(&m_tempValuemap, QString("-%1").arg(varName), v); + if (removeEach(&m_tempFilevaluemap[currentProFile()], varName, v) == 0) + insertUnique(&m_tempFilevaluemap[currentProFile()], QString("-%1").arg(varName), v); } } else if (!m_skipLevel) { // the insertUnique is a hack for the moment to fix the // CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before) - insertUnique(&m_valuemap, QString("-%1").arg(varName), v); - insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v); + insertUnique(&m_tempValuemap, QString("-%1").arg(varName), v); + insertUnique(&m_tempFilevaluemap[currentProFile()], QString("-%1").arg(varName), v); } else { // We are stingy with our values, too. } @@ -812,13 +829,14 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) if (!m_skipLevel || m_cumulative) { // We could make a union of modified and unmodified values, // but this will break just as much as it fixes, so leave it as is. - replaceInList(&m_valuemap[varName], regexp, replace, global); - replaceInList(&m_filevaluemap[currentProFile()][varName], regexp, replace, global); + replaceInList(&m_tempValuemap[varName], regexp, replace, global); + replaceInList(&m_tempFilevaluemap[currentProFile()][varName], regexp, replace, global); } } break; } + m_isFirstVariableValue = false; return true; }