diff options
Diffstat (limited to 'src/plugins/qmakeprojectmanager')
20 files changed, 271 insertions, 420 deletions
diff --git a/src/plugins/qmakeprojectmanager/CMakeLists.txt b/src/plugins/qmakeprojectmanager/CMakeLists.txt index 90d48c0347e..f61d50d0c3d 100644 --- a/src/plugins/qmakeprojectmanager/CMakeLists.txt +++ b/src/plugins/qmakeprojectmanager/CMakeLists.txt @@ -32,7 +32,6 @@ add_qtc_plugin(QmakeProjectManager qmakeparsernodes.cpp qmakeparsernodes.h qmakeproject.cpp qmakeproject.h qmakeprojectimporter.cpp qmakeprojectimporter.h - qmakeprojectmanager.cpp qmakeprojectmanager.h qmakeprojectmanager.qrc qmakeprojectmanager_global.h qmakeprojectmanagerconstants.h diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp index 6c6a3ad7c67..1dcca7754c6 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/classlist.cpp @@ -147,6 +147,7 @@ void ClassList::removeCurrentClass() void ClassList::keyPressEvent(QKeyEvent *event) { switch (event->key()) { + case Qt::Key_Backspace: case Qt::Key_Delete: removeCurrentClass(); break; diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index a00e26d39e1..6443af2635c 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -30,8 +30,6 @@ #include "profilehoverhandler.h" #include "qmakenodes.h" #include "qmakeproject.h" -#include "qmakeprojectmanager.h" -#include "qmakeprojectmanagerconstants.h" #include "qmakeprojectmanagerconstants.h" #include <coreplugin/fileiconprovider.h> diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index b44ae9fba31..632782b11dd 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -424,11 +424,6 @@ TriState QmakeBuildConfiguration::qmlDebugging() const return aspect<QmlDebuggingAspect>()->setting(); } -bool QmakeBuildConfiguration::linkQmlDebuggingLibrary() const -{ - return qmlDebugging() == TriState::Enabled; -} - void QmakeBuildConfiguration::forceQmlDebugging(bool enable) { aspect<QmlDebuggingAspect>()->setSetting(enable ? TriState::Enabled : TriState::Disabled); @@ -829,7 +824,7 @@ QmakeBuildConfiguration::LastKitState::LastKitState(Kit *k) m_sysroot(SysRootKitAspect::sysRoot(k).toString()), m_mkspec(QmakeKitAspect::mkspec(k)) { - ToolChain *tc = ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID); + ToolChain *tc = ToolChainKitAspect::cxxToolChain(k); m_toolchain = tc ? tc->id() : QByteArray(); } diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h index 53d92c3c59c..058af3e7965 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h @@ -44,9 +44,6 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfiguration : public ProjectExplore { Q_OBJECT - // used in DebuggerRunConfigurationAspect - Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary NOTIFY qmlDebuggingChanged) - public: QmakeBuildConfiguration(ProjectExplorer::Target *target, Core::Id id); ~QmakeBuildConfiguration() override; @@ -103,7 +100,6 @@ public: void forceSeparateDebugInfo(bool sepDebugInfo); ProjectExplorer::TriState qmlDebugging() const; - bool linkQmlDebuggingLibrary() const; void forceQmlDebugging(bool enable); ProjectExplorer::TriState useQtQuickCompiler() const; diff --git a/src/plugins/qmakeprojectmanager/qmakekitinformation.cpp b/src/plugins/qmakeprojectmanager/qmakekitinformation.cpp index be619435b44..9333f753309 100644 --- a/src/plugins/qmakeprojectmanager/qmakekitinformation.cpp +++ b/src/plugins/qmakeprojectmanager/qmakekitinformation.cpp @@ -159,8 +159,7 @@ QString QmakeKitAspect::defaultMkspec(const Kit *k) if (!version) // No version, so no qmake return {}; - return version->mkspecFor(ToolChainKitAspect::toolChain(k, - ProjectExplorer::Constants::CXX_LANGUAGE_ID)); + return version->mkspecFor(ToolChainKitAspect::cxxToolChain(k)); } } // namespace Internal diff --git a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp index 83809bc77ad..dbf1ed25691 100644 --- a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp @@ -65,8 +65,6 @@ QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl, Core::Id id) bool QmakeMakeStep::init() { const auto bc = static_cast<QmakeBuildConfiguration *>(buildConfiguration()); - if (!bc) - emit addTask(Task::buildConfigurationMissingTask()); const Utils::CommandLine unmodifiedMake = effectiveMakeCommand(Execution); const Utils::FilePath makeExecutable = unmodifiedMake.executable(); @@ -107,7 +105,7 @@ bool QmakeMakeStep::init() // for file builds, since the rules for that are // only in those files. if (subProFile->isDebugAndRelease() && bc->fileNodeBuild()) { - if (bc->buildType() == QmakeBuildConfiguration::Debug) + if (buildType() == QmakeBuildConfiguration::Debug) makefile += ".Debug"; else makefile += ".Release"; @@ -162,13 +160,12 @@ bool QmakeMakeStep::init() makeCmd.addArg(objectFile); } - pp->setEnvironment(environment(bc)); + pp->setEnvironment(makeEnvironment()); pp->setCommandLine(makeCmd); pp->resolveAll(); setOutputParser(new ProjectExplorer::GnuMakeParser()); - ToolChain *tc = ToolChainKitAspect::toolChain(target()->kit(), - ProjectExplorer::Constants::CXX_LANGUAGE_ID); + ToolChain *tc = ToolChainKitAspect::cxxToolChain(target()->kit()); if (tc && tc->targetAbi().os() == Abi::DarwinOS) appendOutputParser(new XcodebuildParser); IOutputParser *parser = target()->kit()->createOutputParser(); @@ -178,7 +175,7 @@ bool QmakeMakeStep::init() appendOutputParser(new QMakeParser); // make may cause qmake to be run, add last to make sure // it has a low priority. - auto rootNode = dynamic_cast<QmakeProFileNode *>(bc->project()->rootProjectNode()); + auto rootNode = dynamic_cast<QmakeProFileNode *>(project()->rootProjectNode()); QTC_ASSERT(rootNode, return false); m_scriptTarget = rootNode->projectType() == ProjectType::ScriptTemplate; m_unalignedBuildDir = !bc->isBuildDirAtSafeLocation(); diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 25397d92d65..a09fdc6afd1 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -26,7 +26,7 @@ #include "qmakenodes.h" #include "qmakeproject.h" -#include "qmakeprojectmanager.h" +#include "qmakeprojectmanagerplugin.h" #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/runconfiguration.h> @@ -342,7 +342,7 @@ bool QmakeProFileNode::validParse() const void QmakeProFileNode::build() { - QmakeManager::buildProduct(getProject(), this); + QmakeProjectManagerPlugin::buildProduct(getProject(), this); } QStringList QmakeProFileNode::targetApplications() const diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h index c1029bde85f..b30aafd6af9 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.h +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.h @@ -42,6 +42,8 @@ #include <memory> +namespace ProjectExplorer { class BuildConfiguration; } + namespace Utils { class FilePath; class FileSystemWatcher; @@ -50,7 +52,6 @@ class FileSystemWatcher; namespace QtSupport { class ProFileReader; } namespace QmakeProjectManager { -class QmakeBuildConfiguration; class QmakeBuildSystem; class QmakeProFile; class QmakeProject; diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 8db751584c1..15040d8f942 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -25,7 +25,6 @@ #include "qmakeproject.h" -#include "qmakeprojectmanager.h" #include "qmakeprojectimporter.h" #include "qmakebuildinfo.h" #include "qmakestep.h" @@ -74,6 +73,7 @@ #include <QDir> #include <QFileSystemWatcher> #include <QLoggingCategory> +#include <QTimer> using namespace QmakeProjectManager::Internal; using namespace ProjectExplorer; @@ -188,9 +188,7 @@ QmakeBuildSystem::QmakeBuildSystem(QmakeBuildConfiguration *bc) const QTextCodec *codec = Core::EditorManager::defaultTextCodec(); m_qmakeVfs->setTextCodec(codec); - m_asyncUpdateTimer.setSingleShot(true); - m_asyncUpdateTimer.setInterval(0); - connect(&m_asyncUpdateTimer, &QTimer::timeout, this, &QmakeBuildSystem::asyncUpdate); + setParseDelay(0); m_rootProFile = std::make_unique<QmakeProFile>(this, projectFilePath()); @@ -221,7 +219,7 @@ QmakeBuildSystem::QmakeBuildSystem(QmakeBuildConfiguration *bc) connect(ToolChainManager::instance(), &ToolChainManager::toolChainUpdated, this, [this](ToolChain *tc) { - if (ToolChainKitAspect::toolChain(kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID) == tc) + if (ToolChainKitAspect::cxxToolChain(kit()) == tc) scheduleUpdateAllNowOrLater(); }); @@ -498,13 +496,10 @@ void QmakeBuildSystem::startAsyncTimer(QmakeProFile::AsyncUpdateDelay delay) return; } - const int interval = qMin(m_asyncUpdateTimer.interval(), + const int interval = qMin(parseDelay(), delay == QmakeProFile::ParseLater ? UPDATE_INTERVAL : 0); qCDebug(qmakeBuildSystemLog) << __FUNCTION__ << interval; - - m_asyncUpdateTimer.stop(); - m_asyncUpdateTimer.setInterval(interval); - m_asyncUpdateTimer.start(); + requestParseWithCustomDelay(interval); } void QmakeBuildSystem::incrementPendingEvaluateFutures() @@ -565,7 +560,7 @@ bool QmakeBuildSystem::wasEvaluateCanceled() void QmakeBuildSystem::asyncUpdate() { - m_asyncUpdateTimer.setInterval(UPDATE_INTERVAL); + setParseDelay(UPDATE_INTERVAL); qCDebug(qmakeBuildSystemLog) << __FUNCTION__; if (m_invalidateQmakeVfsContents) { @@ -620,7 +615,7 @@ Tasks QmakeProject::projectIssues(const Kit *k) const result.append(createProjectTask(Task::TaskType::Error, tr("No Qt version set in kit."))); else if (!qtFromKit->isValid()) result.append(createProjectTask(Task::TaskType::Error, tr("Qt version is invalid."))); - if (!ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID)) + if (!ToolChainKitAspect::cxxToolChain(k)) result.append(createProjectTask(Task::TaskType::Error, tr("No C++ compiler set in kit."))); const QtSupport::BaseQtVersion *const qtThatContainsProject = projectIsPartOfQt(this); @@ -1132,7 +1127,7 @@ void QmakeBuildSystem::collectLibraryData(const QmakeProFile *file, DeploymentDa if (targetPath.isEmpty()) return; const Kit * const kit = target()->kit(); - const ToolChain * const toolchain = ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); + const ToolChain * const toolchain = ToolChainKitAspect::cxxToolChain(kit); if (!toolchain) return; @@ -1280,16 +1275,16 @@ void QmakeBuildSystem::warnOnToolChainMismatch(const QmakeProFile *pro) const if (!bc) return; - testToolChain(ToolChainKitAspect::toolChain(t->kit(), ProjectExplorer::Constants::C_LANGUAGE_ID), + testToolChain(ToolChainKitAspect::cToolChain(t->kit()), getFullPathOf(pro, Variable::QmakeCc, bc)); - testToolChain(ToolChainKitAspect::toolChain(t->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID), + testToolChain(ToolChainKitAspect::cxxToolChain(t->kit()), getFullPathOf(pro, Variable::QmakeCxx, bc)); } QString QmakeBuildSystem::executableFor(const QmakeProFile *file) { const Kit *const kit = target()->kit(); - const ToolChain *const tc = ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); + const ToolChain *const tc = ToolChainKitAspect::cxxToolChain(kit); if (!tc) return QString(); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h index 9cd8902dbbf..c25dfcc32d2 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.h +++ b/src/plugins/qmakeprojectmanager/qmakeproject.h @@ -26,16 +26,15 @@ #pragma once #include "qmakeprojectmanager_global.h" -#include "qmakeprojectmanager.h" #include "qmakenodes.h" #include "qmakeparsernodes.h" #include <projectexplorer/deploymentdata.h> #include <projectexplorer/project.h> +#include <projectexplorer/toolchain.h> #include <QStringList> #include <QFutureInterface> -#include <QTimer> #include <QFuture> QT_BEGIN_NAMESPACE @@ -48,6 +47,7 @@ namespace ProjectExplorer { class DeploymentData; } namespace QtSupport { class ProFileReader; } namespace QmakeProjectManager { +class QmakeBuildConfiguration; namespace Internal { class CentralizedFolderWatcher; } @@ -188,7 +188,6 @@ public: QString m_qmakeSysroot; - QTimer m_asyncUpdateTimer; QFutureInterface<void> m_asyncUpdateFutureInterface; int m_pendingEvaluateFuturesCount = 0; AsyncUpdateState m_asyncUpdateState = Base; diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp index 71fd912e102..c4ef9ce815b 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp @@ -206,7 +206,7 @@ bool QmakeProjectImporter::matchKit(void *directoryData, const Kit *k) const BaseQtVersion *kitVersion = QtKitAspect::qtVersion(k); QString kitSpec = QmakeKitAspect::mkspec(k); - ToolChain *tc = ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID); + ToolChain *tc = ToolChainKitAspect::cxxToolChain(k); if (kitSpec.isEmpty() && kitVersion) kitSpec = kitVersion->mkspecFor(tc); QMakeStepConfig::TargetArchConfig kitTargetArch = QMakeStepConfig::NoArch; diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp deleted file mode 100644 index ba7b44b7d64..00000000000 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "qmakeprojectmanager.h" - -#include "qmakeprojectmanagerconstants.h" -#include "qmakeprojectmanagerplugin.h" -#include "qmakenodes.h" -#include "qmakeproject.h" -#include "profileeditor.h" -#include "qmakestep.h" -#include "qmakebuildconfiguration.h" -#include "addlibrarywizard.h" - -#include <coreplugin/icore.h> -#include <coreplugin/editormanager/editormanager.h> -#include <projectexplorer/projectexplorer.h> -#include <projectexplorer/projecttree.h> -#include <projectexplorer/buildmanager.h> -#include <projectexplorer/session.h> -#include <projectexplorer/target.h> -#include <utils/qtcassert.h> -#include <texteditor/texteditor.h> - -#include <QDir> -#include <QFileInfo> -#include <QVariant> - -using namespace ProjectExplorer; -using namespace TextEditor; - -namespace QmakeProjectManager { - -static QmakeProFileNode *buildableFileProFile(Node *node) -{ - if (node) { - auto subPriFileNode = dynamic_cast<QmakePriFileNode *>(node); - if (!subPriFileNode) - subPriFileNode = dynamic_cast<QmakePriFileNode *>(node->parentProjectNode()); - if (subPriFileNode) - return subPriFileNode->proFileNode(); - } - return nullptr; -} - -FileNode *QmakeManager::contextBuildableFileNode() -{ - Node *node = ProjectTree::currentNode(); - - QmakeProFileNode *subProjectNode = buildableFileProFile(node); - FileNode *fileNode = node ? node->asFileNode() : nullptr; - bool buildFilePossible = subProjectNode && fileNode - && (fileNode->fileType() == ProjectExplorer::FileType::Source); - - return buildFilePossible ? fileNode : nullptr; -} - -void QmakeManager::addLibrary() -{ - if (auto editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor())) - addLibraryImpl(editor->document()->filePath().toString(), editor); -} - -void QmakeManager::addLibraryContextMenu() -{ - QString projectPath; - - Node *node = ProjectTree::currentNode(); - if (ContainerNode *cn = node->asContainerNode()) - projectPath = cn->project()->projectFilePath().toString(); - else if (dynamic_cast<QmakeProFileNode *>(node)) - projectPath = node->filePath().toString(); - - addLibraryImpl(projectPath, nullptr); -} - -void QmakeManager::addLibraryImpl(const QString &fileName, BaseTextEditor *editor) -{ - if (fileName.isEmpty()) - return; - - Internal::AddLibraryWizard wizard(fileName, Core::ICore::dialogParent()); - if (wizard.exec() != QDialog::Accepted) - return; - - if (!editor) - editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::openEditor(fileName, - Constants::PROFILE_EDITOR_ID, Core::EditorManager::DoNotMakeVisible)); - if (!editor) - return; - - const int endOfDoc = editor->position(EndOfDocPosition); - editor->setCursorPosition(endOfDoc); - QString snippet = wizard.snippet(); - - // add extra \n in case the last line is not empty - int line, column; - editor->convertPosition(endOfDoc, &line, &column); - const int positionInBlock = column - 1; - if (!editor->textAt(endOfDoc - positionInBlock, positionInBlock).simplified().isEmpty()) - snippet = QLatin1Char('\n') + snippet; - - editor->insert(snippet); -} - -void QmakeManager::runQMake() -{ - runQMakeImpl(SessionManager::startupProject(), nullptr); -} - -void QmakeManager::runQMakeContextMenu() -{ - runQMakeImpl(ProjectTree::currentProject(), ProjectTree::currentNode()); -} - -void QmakeManager::runQMakeImpl(ProjectExplorer::Project *p, ProjectExplorer::Node *node) -{ - if (!ProjectExplorerPlugin::saveModifiedFiles()) - return; - auto *qmakeProject = qobject_cast<QmakeProject *>(p); - QTC_ASSERT(qmakeProject, return); - - if (!qmakeProject->activeTarget() || !qmakeProject->activeTarget()->activeBuildConfiguration()) - return; - - auto *bc = static_cast<QmakeBuildConfiguration *>(qmakeProject->activeTarget()->activeBuildConfiguration()); - QMakeStep *qs = bc->qmakeStep(); - if (!qs) - return; - - //found qmakeStep, now use it - qs->setForced(true); - - if (node && node != qmakeProject->rootProjectNode()) - if (auto *profile = dynamic_cast<QmakeProFileNode *>(node)) - bc->setSubNodeBuild(profile); - - BuildManager::appendStep(qs, tr("QMake")); - bc->setSubNodeBuild(nullptr); -} - -void QmakeManager::buildSubDirContextMenu() -{ - handleSubDirContextMenu(BUILD, false); -} - -void QmakeManager::cleanSubDirContextMenu() -{ - handleSubDirContextMenu(CLEAN, false); -} - -void QmakeManager::rebuildSubDirContextMenu() -{ - handleSubDirContextMenu(REBUILD, false); -} - -void QmakeManager::buildFileContextMenu() -{ - handleSubDirContextMenu(BUILD, true); -} - -void QmakeManager::buildFile() -{ - if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) { - const Utils::FilePath file = currentDocument->filePath(); - Node *n = ProjectTree::nodeForFile(file); - FileNode *node = n ? n->asFileNode() : nullptr; - Project *project = SessionManager::projectForFile(file); - - if (project && node) - handleSubDirContextMenu(BUILD, true, project, node->parentProjectNode(), node); - } -} - -void QmakeManager::buildProduct(Project *project, Node *proFileNode) -{ - handleSubDirContextMenu(BUILD, false, project, proFileNode, nullptr); -} - -void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild) -{ - handleSubDirContextMenu(action, - isFileBuild, - ProjectTree::currentProject(), - buildableFileProFile(ProjectTree::currentNode()), - contextBuildableFileNode()); -} - -void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild, - Project *contextProject, Node *contextNode, - FileNode *buildableFile) -{ - QTC_ASSERT(contextProject, return); - Target *target = contextProject->activeTarget(); - if (!target) - return; - - auto *bc = qobject_cast<QmakeBuildConfiguration *>(target->activeBuildConfiguration()); - if (!bc) - return; - - if (!contextNode || !buildableFile) - isFileBuild = false; - - if (auto *prifile = dynamic_cast<QmakePriFileNode *>(contextNode)) { - if (QmakeProFileNode *profile = prifile->proFileNode()) { - if (profile != contextProject->rootProjectNode() || isFileBuild) - bc->setSubNodeBuild(profile->proFileNode()); - } - } - - if (isFileBuild) - bc->setFileNodeBuild(buildableFile); - if (ProjectExplorerPlugin::saveModifiedFiles()) { - const Core::Id buildStep = ProjectExplorer::Constants::BUILDSTEPS_BUILD; - const Core::Id cleanStep = ProjectExplorer::Constants::BUILDSTEPS_CLEAN; - if (action == BUILD) { - BuildManager::buildList(bc->buildSteps()); - } else if (action == CLEAN) { - BuildManager::buildList(bc->cleanSteps()); - } else if (action == REBUILD) { - QStringList names; - names << ProjectExplorerPlugin::displayNameForStepId(cleanStep) - << ProjectExplorerPlugin::displayNameForStepId(buildStep); - - BuildManager::buildLists({bc->cleanSteps(), bc->buildSteps()}, names); - } - } - - bc->setSubNodeBuild(nullptr); - bc->setFileNodeBuild(nullptr); -} - -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h deleted file mode 100644 index 722ab075773..00000000000 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "qmakeprojectmanager_global.h" - -#include <projectexplorer/projectnodes.h> - -namespace Core { class IEditor; } -namespace TextEditor { class BaseTextEditor; } - -namespace ProjectExplorer { -class Project; -class Node; -class ToolChain; -} - -namespace QmakeProjectManager { - -class QMAKEPROJECTMANAGER_EXPORT QmakeManager : public QObject -{ - Q_OBJECT - -public: - void notifyChanged(const Utils::FilePath &name); - - // Context information used in the slot implementations - static ProjectExplorer::FileNode *contextBuildableFileNode(); - - enum Action { BUILD, REBUILD, CLEAN }; - - void addLibrary(); - void addLibraryContextMenu(); - void runQMake(); - void runQMakeContextMenu(); - void buildSubDirContextMenu(); - void rebuildSubDirContextMenu(); - void cleanSubDirContextMenu(); - void buildFileContextMenu(); - void buildFile(); - - static void buildProduct(ProjectExplorer::Project *project, ProjectExplorer::Node *proFileNode); - -private: - void handleSubDirContextMenu(Action action, bool isFileBuild); - static void handleSubDirContextMenu(QmakeManager::Action action, bool isFileBuild, - ProjectExplorer::Project *contextProject, - ProjectExplorer::Node *contextProFileNode, - ProjectExplorer::FileNode *buildableFile); - void addLibraryImpl(const QString &fileName, TextEditor::BaseTextEditor *editor); - void runQMakeImpl(ProjectExplorer::Project *p, ProjectExplorer::Node *node); -}; - -} // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro index aa56251ada3..90a6a78a8fe 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro @@ -10,7 +10,6 @@ HEADERS += \ qmakeparsernodes.h \ qmakeprojectimporter.h \ qmakeprojectmanagerplugin.h \ - qmakeprojectmanager.h \ qmakeproject.h \ qmakesettings.h \ qmakenodes.h \ @@ -39,7 +38,6 @@ SOURCES += \ qmakeparsernodes.cpp \ qmakeprojectimporter.cpp \ qmakeprojectmanagerplugin.cpp \ - qmakeprojectmanager.cpp \ qmakeproject.cpp \ qmakenodes.cpp \ qmakesettings.cpp \ diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index 24a4fce4315..e46f7c90b45 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -46,7 +46,6 @@ Project { "qmakenodes.cpp", "qmakenodes.h", "qmakenodetreebuilder.cpp", "qmakenodetreebuilder.h", "qmakeproject.cpp", "qmakeproject.h", - "qmakeprojectmanager.cpp", "qmakeprojectmanager.h", "qmakeprojectmanager.qrc", "qmakeprojectmanager_global.h", "qmakeprojectmanagerconstants.h", diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index 6ca690f6f06..e1899418dd9 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -25,8 +25,8 @@ #include "qmakeprojectmanagerplugin.h" +#include "addlibrarywizard.h" #include "profileeditor.h" -#include "qmakeprojectmanager.h" #include "qmakenodes.h" #include "qmakesettings.h" #include "qmakestep.h" @@ -49,12 +49,15 @@ #include <coreplugin/editormanager/ieditor.h> #include <projectexplorer/buildmanager.h> +#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectmanager.h> #include <projectexplorer/projecttree.h> #include <projectexplorer/runcontrol.h> #include <projectexplorer/session.h> #include <projectexplorer/target.h> +#include <projectexplorer/projectexplorer.h> +#include <texteditor/texteditor.h> #include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditorconstants.h> @@ -67,6 +70,7 @@ using namespace Core; using namespace ProjectExplorer; +using namespace TextEditor; namespace QmakeProjectManager { namespace Internal { @@ -86,7 +90,6 @@ public: void disableBuildFileMenus(); void enableBuildFileMenus(const Utils::FilePath &file); - QmakeManager qmakeProjectManager; Core::Context projectContext; CustomWizardMetaFactory<CustomQmakeProjectWizard> @@ -105,7 +108,7 @@ public: ExternalQtEditor *m_linguistEditor{ExternalQtEditor::createLinguistEditor()}; QmakeProject *m_previousStartupProject = nullptr; - ProjectExplorer::Target *m_previousTarget = nullptr; + Target *m_previousTarget = nullptr; QAction *m_runQMakeAction = nullptr; QAction *m_runQMakeActionContextMenu = nullptr; @@ -122,6 +125,26 @@ public: QAction *m_addLibraryActionContextMenu = nullptr; QmakeKitAspect qmakeKitAspect; + + enum Action { BUILD, REBUILD, CLEAN }; + + void addLibrary(); + void addLibraryContextMenu(); + void runQMake(); + void runQMakeContextMenu(); + void buildSubDirContextMenu(); + void rebuildSubDirContextMenu(); + void cleanSubDirContextMenu(); + void buildFileContextMenu(); + void buildFile(); + + void handleSubDirContextMenu(Action action, bool isFileBuild); + static void handleSubDirContextMenu(Action action, bool isFileBuild, + Project *contextProject, + Node *contextProFileNode, + FileNode *buildableFile); + void addLibraryImpl(const QString &fileName, TextEditor::BaseTextEditor *editor); + void runQMakeImpl(Project *p, ProjectExplorer::Node *node); }; QmakeProjectManagerPlugin::~QmakeProjectManagerPlugin() @@ -170,7 +193,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString command->setDescription(d->m_buildSubProjectContextMenu->text()); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(d->m_buildSubProjectContextMenu, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::buildSubDirContextMenu); + d, &QmakeProjectManagerPluginPrivate::buildSubDirContextMenu); d->m_runQMakeActionContextMenu = new QAction(tr("Run qmake"), this); command = ActionManager::registerAction(d->m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext); @@ -178,7 +201,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(d->m_runQMakeActionContextMenu, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::runQMakeContextMenu); + d, &QmakeProjectManagerPluginPrivate::runQMakeContextMenu); command = msubproject->addSeparator(projectContext, ProjectExplorer::Constants::G_PROJECT_BUILD, &d->m_subProjectRebuildSeparator); @@ -190,7 +213,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString command->setAttribute(Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(d->m_rebuildSubProjectContextMenu, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::rebuildSubDirContextMenu); + d, &QmakeProjectManagerPluginPrivate::rebuildSubDirContextMenu); d->m_cleanSubProjectContextMenu = new QAction(tr("Clean"), this); command = ActionManager::registerAction( @@ -198,14 +221,14 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString command->setAttribute(Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(d->m_cleanSubProjectContextMenu, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::cleanSubDirContextMenu); + d, &QmakeProjectManagerPluginPrivate::cleanSubDirContextMenu); d->m_buildFileContextMenu = new QAction(tr("Build"), this); command = ActionManager::registerAction(d->m_buildFileContextMenu, Constants::BUILDFILECONTEXTMENU, projectContext); command->setAttribute(Command::CA_Hide); mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER); connect(d->m_buildFileContextMenu, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::buildFileContextMenu); + d, &QmakeProjectManagerPluginPrivate::buildFileContextMenu); d->m_buildSubProjectAction = new Utils::ParameterAction(tr("Build &Subproject"), tr("Build &Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); @@ -215,13 +238,14 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString command->setDescription(d->m_buildSubProjectAction->text()); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); connect(d->m_buildSubProjectAction, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::buildSubDirContextMenu); + d, &QmakeProjectManagerPluginPrivate::buildSubDirContextMenu); d->m_runQMakeAction = new QAction(tr("Run qmake"), this); const Context globalcontext(Core::Constants::C_GLOBAL); command = ActionManager::registerAction(d->m_runQMakeAction, Constants::RUNQMAKE, globalcontext); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(d->m_runQMakeAction, &QAction::triggered, &d->qmakeProjectManager, &QmakeManager::runQMake); + connect(d->m_runQMakeAction, &QAction::triggered, + d, &QmakeProjectManagerPluginPrivate::runQMake); d->m_rebuildSubProjectAction = new Utils::ParameterAction(tr("Rebuild Subproject"), tr("Rebuild Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); @@ -231,7 +255,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString command->setDescription(d->m_rebuildSubProjectAction->text()); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_REBUILD); connect(d->m_rebuildSubProjectAction, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::rebuildSubDirContextMenu); + d, &QmakeProjectManagerPluginPrivate::rebuildSubDirContextMenu); d->m_cleanSubProjectAction = new Utils::ParameterAction(tr("Clean Subproject"), tr("Clean Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); @@ -241,7 +265,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString command->setDescription(d->m_cleanSubProjectAction->text()); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_CLEAN); connect(d->m_cleanSubProjectAction, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::cleanSubDirContextMenu); + d, &QmakeProjectManagerPluginPrivate::cleanSubDirContextMenu); d->m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); @@ -251,7 +275,8 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString command->setDescription(d->m_buildFileAction->text()); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+B"))); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(d->m_buildFileAction, &QAction::triggered, &d->qmakeProjectManager, &QmakeManager::buildFile); + connect(d->m_buildFileAction, &QAction::triggered, + d, &QmakeProjectManagerPluginPrivate::buildFile); connect(BuildManager::instance(), &BuildManager::buildStateChanged, d, &QmakeProjectManagerPluginPrivate::buildStateChanged); @@ -273,14 +298,15 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString d->m_addLibraryAction = new QAction(tr("Add Library..."), this); command = ActionManager::registerAction(d->m_addLibraryAction, Constants::ADDLIBRARY, proFileEditorContext); - connect(d->m_addLibraryAction, &QAction::triggered, &d->qmakeProjectManager, &QmakeManager::addLibrary); + connect(d->m_addLibraryAction, &QAction::triggered, + d, &QmakeProjectManagerPluginPrivate::addLibrary); contextMenu->addAction(command); d->m_addLibraryActionContextMenu = new QAction(tr("Add Library..."), this); command = ActionManager::registerAction(d->m_addLibraryActionContextMenu, Constants::ADDLIBRARY, projectTreeContext); connect(d->m_addLibraryActionContextMenu, &QAction::triggered, - &d->qmakeProjectManager, &QmakeManager::addLibraryContextMenu); + d, &QmakeProjectManagerPluginPrivate::addLibraryContextMenu); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES); @@ -322,6 +348,196 @@ void QmakeProjectManagerPluginPrivate::projectChanged() activeTargetChanged(); } +static QmakeProFileNode *buildableFileProFile(Node *node) +{ + if (node) { + auto subPriFileNode = dynamic_cast<QmakePriFileNode *>(node); + if (!subPriFileNode) + subPriFileNode = dynamic_cast<QmakePriFileNode *>(node->parentProjectNode()); + if (subPriFileNode) + return subPriFileNode->proFileNode(); + } + return nullptr; +} + +void QmakeProjectManagerPluginPrivate::addLibrary() +{ + if (auto editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor())) + addLibraryImpl(editor->document()->filePath().toString(), editor); +} + +void QmakeProjectManagerPluginPrivate::addLibraryContextMenu() +{ + QString projectPath; + + Node *node = ProjectTree::currentNode(); + if (ContainerNode *cn = node->asContainerNode()) + projectPath = cn->project()->projectFilePath().toString(); + else if (dynamic_cast<QmakeProFileNode *>(node)) + projectPath = node->filePath().toString(); + + addLibraryImpl(projectPath, nullptr); +} + +void QmakeProjectManagerPluginPrivate::addLibraryImpl(const QString &fileName, BaseTextEditor *editor) +{ + if (fileName.isEmpty()) + return; + + Internal::AddLibraryWizard wizard(fileName, Core::ICore::dialogParent()); + if (wizard.exec() != QDialog::Accepted) + return; + + if (!editor) + editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::openEditor(fileName, + Constants::PROFILE_EDITOR_ID, Core::EditorManager::DoNotMakeVisible)); + if (!editor) + return; + + const int endOfDoc = editor->position(EndOfDocPosition); + editor->setCursorPosition(endOfDoc); + QString snippet = wizard.snippet(); + + // add extra \n in case the last line is not empty + int line, column; + editor->convertPosition(endOfDoc, &line, &column); + const int positionInBlock = column - 1; + if (!editor->textAt(endOfDoc - positionInBlock, positionInBlock).simplified().isEmpty()) + snippet = QLatin1Char('\n') + snippet; + + editor->insert(snippet); +} + +void QmakeProjectManagerPluginPrivate::runQMake() +{ + runQMakeImpl(SessionManager::startupProject(), nullptr); +} + +void QmakeProjectManagerPluginPrivate::runQMakeContextMenu() +{ + runQMakeImpl(ProjectTree::currentProject(), ProjectTree::currentNode()); +} + +void QmakeProjectManagerPluginPrivate::runQMakeImpl(Project *p, Node *node) +{ + if (!ProjectExplorerPlugin::saveModifiedFiles()) + return; + auto *qmakeProject = qobject_cast<QmakeProject *>(p); + QTC_ASSERT(qmakeProject, return); + + if (!qmakeProject->activeTarget() || !qmakeProject->activeTarget()->activeBuildConfiguration()) + return; + + auto *bc = static_cast<QmakeBuildConfiguration *>(qmakeProject->activeTarget()->activeBuildConfiguration()); + QMakeStep *qs = bc->qmakeStep(); + if (!qs) + return; + + //found qmakeStep, now use it + qs->setForced(true); + + if (node && node != qmakeProject->rootProjectNode()) + if (auto *profile = dynamic_cast<QmakeProFileNode *>(node)) + bc->setSubNodeBuild(profile); + + BuildManager::appendStep(qs, tr("QMake")); + bc->setSubNodeBuild(nullptr); +} + +void QmakeProjectManagerPluginPrivate::buildSubDirContextMenu() +{ + handleSubDirContextMenu(BUILD, false); +} + +void QmakeProjectManagerPluginPrivate::cleanSubDirContextMenu() +{ + handleSubDirContextMenu(CLEAN, false); +} + +void QmakeProjectManagerPluginPrivate::rebuildSubDirContextMenu() +{ + handleSubDirContextMenu(REBUILD, false); +} + +void QmakeProjectManagerPluginPrivate::buildFileContextMenu() +{ + handleSubDirContextMenu(BUILD, true); +} + +void QmakeProjectManagerPluginPrivate::buildFile() +{ + if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) { + const Utils::FilePath file = currentDocument->filePath(); + Node *n = ProjectTree::nodeForFile(file); + FileNode *node = n ? n->asFileNode() : nullptr; + Project *project = SessionManager::projectForFile(file); + + if (project && node) + handleSubDirContextMenu(BUILD, true, project, buildableFileProFile(node), node); + } +} + +void QmakeProjectManagerPlugin::buildProduct(Project *project, Node *proFileNode) +{ + QmakeProjectManagerPluginPrivate::handleSubDirContextMenu( + QmakeProjectManagerPluginPrivate::BUILD, false, project, proFileNode, nullptr); +} + +void QmakeProjectManagerPluginPrivate::handleSubDirContextMenu(Action action, bool isFileBuild) +{ + Node *node = ProjectTree::currentNode(); + + QmakeProFileNode *subProjectNode = buildableFileProFile(node); + FileNode *fileNode = node ? node->asFileNode() : nullptr; + bool buildFilePossible = subProjectNode && fileNode && fileNode->fileType() == FileType::Source; + + FileNode *buildableFileNode = buildFilePossible ? fileNode : nullptr; + + handleSubDirContextMenu(action, + isFileBuild, + ProjectTree::currentProject(), + buildableFileProFile(ProjectTree::currentNode()), + buildableFileNode); +} + +void QmakeProjectManagerPluginPrivate::handleSubDirContextMenu(Action action, bool isFileBuild, + Project *contextProject, Node *contextNode, + FileNode *buildableFile) +{ + QTC_ASSERT(contextProject, return); + Target *target = contextProject->activeTarget(); + if (!target) + return; + + auto *bc = qobject_cast<QmakeBuildConfiguration *>(target->activeBuildConfiguration()); + if (!bc) + return; + + if (!contextNode || !buildableFile) + isFileBuild = false; + + if (auto *prifile = dynamic_cast<QmakePriFileNode *>(contextNode)) { + if (QmakeProFileNode *profile = prifile->proFileNode()) { + if (profile != contextProject->rootProjectNode() || isFileBuild) + bc->setSubNodeBuild(profile->proFileNode()); + } + } + + if (isFileBuild) + bc->setFileNodeBuild(buildableFile); + if (ProjectExplorerPlugin::saveModifiedFiles()) { + if (action == BUILD) + BuildManager::buildList(bc->buildSteps()); + else if (action == CLEAN) + BuildManager::buildList(bc->cleanSteps()); + else if (action == REBUILD) + BuildManager::buildLists({bc->cleanSteps(), bc->buildSteps()}); + } + + bc->setSubNodeBuild(nullptr); + bc->setFileNodeBuild(nullptr); +} + void QmakeProjectManagerPluginPrivate::activeTargetChanged() { if (m_previousTarget) diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h index 5b3176b9b72..1d11bb45cb5 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h @@ -27,6 +27,11 @@ #include <extensionsystem/iplugin.h> +namespace ProjectExplorer { +class Project; +class Node; +} // ProjectExplorer + namespace QmakeProjectManager { namespace Internal { @@ -38,6 +43,8 @@ class QmakeProjectManagerPlugin final : public ExtensionSystem::IPlugin public: ~QmakeProjectManagerPlugin() final; + static void buildProduct(ProjectExplorer::Project *project, ProjectExplorer::Node *proFileNode); + #ifdef WITH_TESTS private slots: void testQmakeOutputParsers_data(); diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 0c735869380..7bee09695f0 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -141,16 +141,14 @@ QString QMakeStep::allArguments(const BaseQtVersion *v, ArgumentFlags flags) con QMakeStepConfig QMakeStep::deducedArguments() const { - ProjectExplorer::Kit *kit = target()->kit(); + Kit *kit = target()->kit(); QMakeStepConfig config; - ProjectExplorer::ToolChain *tc - = ProjectExplorer::ToolChainKitAspect::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); - ProjectExplorer::Abi targetAbi; - if (tc) { + Abi targetAbi; + if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit)) { targetAbi = tc->targetAbi(); if (HostOsInfo::isWindowsHost() && tc->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) { - config.sysRoot = ProjectExplorer::SysRootKitAspect::sysRoot(kit).toString(); + config.sysRoot = SysRootKitAspect::sysRoot(kit).toString(); config.targetTriple = tc->originalTargetTriple(); } } @@ -571,14 +569,8 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) connect(step->target(), &Target::kitChanged, this, &QMakeStepConfigWidget::qtVersionChanged); connect(abisListWidget, &QListWidget::itemChanged, this, [this]{ abisChanged(); - QmakeBuildConfiguration *bc = m_step->qmakeBuildConfiguration(); - if (!bc) - return; - - QList<ProjectExplorer::BuildStepList *> stepLists; - const Core::Id clean = ProjectExplorer::Constants::BUILDSTEPS_CLEAN; - stepLists << bc->cleanSteps(); - BuildManager::buildLists(stepLists, {ProjectExplorerPlugin::displayNameForStepId(clean)}); + if (QmakeBuildConfiguration *bc = m_step->qmakeBuildConfiguration()) + BuildManager::buildLists({bc->cleanSteps()}); }); auto chooser = new Core::VariableChooser(qmakeAdditonalArgumentsLineEdit); chooser->addMacroExpanderProvider([step] { return step->macroExpander(); }); @@ -751,15 +743,8 @@ void QMakeStepConfigWidget::updateEffectiveQMakeCall() void QMakeStepConfigWidget::recompileMessageBoxFinished(int button) { if (button == QMessageBox::Yes) { - BuildConfiguration *bc = m_step->buildConfiguration(); - if (!bc) - return; - - const Core::Id clean = ProjectExplorer::Constants::BUILDSTEPS_CLEAN; - const Core::Id build = ProjectExplorer::Constants::BUILDSTEPS_BUILD; - BuildManager::buildLists({bc->cleanSteps(), bc->buildSteps()}, - QStringList() << ProjectExplorerPlugin::displayNameForStepId(clean) - << ProjectExplorerPlugin::displayNameForStepId(build)); + if (BuildConfiguration *bc = m_step->buildConfiguration()) + BuildManager::buildLists({bc->cleanSteps(), bc->buildSteps()}); } } diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp index 38074cb0c61..f9d66de3ed6 100644 --- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp @@ -26,7 +26,6 @@ #include "qtwizard.h" #include <qmakeprojectmanager/qmakeproject.h> -#include <qmakeprojectmanager/qmakeprojectmanager.h> #include <qmakeprojectmanager/qmakeprojectmanagerconstants.h> #include <coreplugin/icore.h> |