CMake: Fix includes all over the CMake plugin

Keep internals internal, remove some unnecessary includes, add
some that should have been there.

This reduces the number of files that get rebuild when working
on CMake internals from over 1000 to about 200.

This patch also moves some code around that ended up being
in the wrong file.

Change-Id: Icd7366ac760dc85031040720418fbb16336dce9b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2020-04-17 15:30:05 +02:00
parent 9f981e7e23
commit 5350288e45
54 changed files with 241 additions and 389 deletions

View File

@@ -27,29 +27,20 @@
#include "cmakebuildconfiguration.h"
#include "cmakebuildstep.h"
#include "cmakekitinformation.h"
#include "cmakebuildsystem.h"
#include "cmakeprojectnodes.h"
#include "cmaketool.h"
#include <coreplugin/icore.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QDir>
#include <QLoggingCategory>
#include <QMessageBox>
#include <QPointer>
#include <QPushButton>
#include <QSet>
#include <app/app_version.h>

View File

@@ -28,7 +28,6 @@
#include "builddirparameters.h"
#include "builddirreader.h"
#include "cmakebuildtarget.h"
#include "cmakeconfigitem.h"
#include <projectexplorer/rawprojectpart.h>
@@ -36,9 +35,8 @@
#include <utils/temporarydirectory.h>
#include <QObject>
#include <QTimer>
#include <QString>
#include <functional>
#include <memory>
#include <unordered_map>

View File

@@ -31,12 +31,11 @@
#include "cmakespecificsettings.h"
#include "cmaketoolmanager.h"
#include <projectexplorer/kit.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;

View File

@@ -27,18 +27,12 @@
#include "builddirparameters.h"
#include "cmakebuildtarget.h"
#include "cmakeconfigitem.h"
#include "cmaketool.h"
#include <projectexplorer/rawprojectpart.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/macroexpander.h>
#include <QFutureInterface>
#include <QObject>
#include <QVector>
#include <memory>
namespace ProjectExplorer { class FileNode; }

View File

@@ -25,13 +25,6 @@
#include "cmakeautocompleter.h"
#include <QRegExp>
#include <QTextCursor>
#include <QTextBlock>
#include <QDebug>
#include <texteditor/tabsettings.h>
namespace CMakeProjectManager {
namespace Internal {

View File

@@ -26,34 +26,26 @@
#include "cmakebuildconfiguration.h"
#include "builddirmanager.h"
#include "cmakebuildsettingswidget.h"
#include "cmakebuildstep.h"
#include "cmakeconfigitem.h"
#include "cmakebuildsystem.h"
#include "cmakekitinformation.h"
#include "cmakeprojectconstants.h"
#include "cmakebuildsettingswidget.h"
#include <android/androidconstants.h>
#include <coreplugin/icore.h>
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmacroexpander.h>
#include <projectexplorer/target.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtbuildaspects.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/algorithm.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <QLoggingCategory>

View File

@@ -26,12 +26,9 @@
#pragma once
#include "cmakeconfigitem.h"
#include "cmakeproject.h"
#include "configmodel.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h>
namespace CMakeProjectManager {
class CMakeProject;

View File

@@ -25,40 +25,30 @@
#include "cmakebuildsettingswidget.h"
#include "cmakebuildconfiguration.h"
#include "cmakebuildsystem.h"
#include "cmakekitinformation.h"
#include "configmodel.h"
#include "configmodelitemdelegate.h"
#include "cmakekitinformation.h"
#include "cmakeproject.h"
#include "cmakebuildconfiguration.h"
#include <coreplugin/find/itemviewfind.h>
#include <coreplugin/icore.h>
#include <projectexplorer/buildaspects.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtbuildaspects.h>
#include <utils/categorysortfiltermodel.h>
#include <utils/detailswidget.h>
#include <utils/fancylineedit.h>
#include <utils/headerviewstretcher.h>
#include <utils/infolabel.h>
#include <utils/itemviews.h>
#include <utils/pathchooser.h>
#include <utils/progressindicator.h>
#include <utils/qtcassert.h>
#include <QBoxLayout>
#include <QCheckBox>
#include <QComboBox>
#include <QFrame>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QSortFilterProxyModel>
#include <QSpacerItem>
#include <QStyledItemDelegate>
#include <QMenu>
using namespace ProjectExplorer;

View File

@@ -55,6 +55,7 @@ class CMakeBuildConfiguration;
class CMakeBuildSettingsWidget : public ProjectExplorer::NamedWidget
{
Q_OBJECT
public:
CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc);

View File

@@ -30,32 +30,19 @@
#include "cmakekitinformation.h"
#include "cmakeparser.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
#include "cmaketool.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/processparameters.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtparser.h>
#include <coreplugin/find/itemviewfind.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/processparameters.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/target.h>
#include <utils/algorithm.h>
#include <utils/qtcprocess.h>
#include <utils/pathchooser.h>
#include <QCheckBox>
#include <QDir>
#include <QBoxLayout>
#include <QFormLayout>
#include <QGroupBox>
#include <QLineEdit>
#include <QListWidget>
#include <QRadioButton>

View File

@@ -27,33 +27,105 @@
#include "cmakebuildconfiguration.h"
#include "cmakekitinformation.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
#include "cmakeprojectplugin.h"
#include "cmakespecificsettings.h"
#include <android/androidconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/cppprojectupdater.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/generatedcodemodelsupport.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qtsupport/qtcppkitinfo.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/checkablemessagebox.h>
#include <utils/fileutils.h>
#include <utils/mimetypes/mimetype.h>
#include <utils/qtcassert.h>
#include <QClipboard>
#include <QDir>
#include <QGuiApplication>
#include <QLoggingCategory>
using namespace ProjectExplorer;
using namespace Utils;
namespace {
void copySourcePathToClipboard(Utils::optional<QString> srcPath,
const ProjectExplorer::ProjectNode *node)
{
QClipboard *clip = QGuiApplication::clipboard();
QDir projDir{node->filePath().toFileInfo().absoluteFilePath()};
clip->setText(QDir::cleanPath(projDir.relativeFilePath(srcPath.value())));
}
void noAutoAdditionNotify(const QStringList &filePaths, const ProjectExplorer::ProjectNode *node)
{
Utils::optional<QString> srcPath{};
for (const QString &file : filePaths) {
if (Utils::mimeTypeForFile(file).name() == CppTools::Constants::CPP_SOURCE_MIMETYPE) {
srcPath = file;
break;
}
}
if (srcPath) {
CMakeProjectManager::Internal::CMakeSpecificSettings *settings
= CMakeProjectManager::Internal::CMakeProjectPlugin::projectTypeSpecificSettings();
switch (settings->afterAddFileSetting()) {
case CMakeProjectManager::Internal::ASK_USER: {
bool checkValue{false};
QDialogButtonBox::StandardButton reply = Utils::CheckableMessageBox::question(
nullptr,
QMessageBox::tr("Copy to Clipboard?"),
QMessageBox::tr("Files are not automatically added to the "
"CMakeLists.txt file of the CMake project."
"\nCopy the path to the source files to the clipboard?"),
"Remember My Choice",
&checkValue,
QDialogButtonBox::Yes | QDialogButtonBox::No,
QDialogButtonBox::Yes);
if (checkValue) {
if (QDialogButtonBox::Yes == reply)
settings->setAfterAddFileSetting(
CMakeProjectManager::Internal::AfterAddFileAction::COPY_FILE_PATH);
else if (QDialogButtonBox::No == reply)
settings->setAfterAddFileSetting(
CMakeProjectManager::Internal::AfterAddFileAction::NEVER_COPY_FILE_PATH);
settings->toSettings(Core::ICore::settings());
}
if (QDialogButtonBox::Yes == reply) {
copySourcePathToClipboard(srcPath, node);
}
break;
}
case CMakeProjectManager::Internal::COPY_FILE_PATH: {
copySourcePathToClipboard(srcPath, node);
break;
}
case CMakeProjectManager::Internal::NEVER_COPY_FILE_PATH:
break;
}
}
}
} // namespace
namespace CMakeProjectManager {
namespace Internal {
@@ -264,6 +336,32 @@ void CMakeBuildSystem::triggerParsing()
m_buildDirManager.parse();
}
bool CMakeBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const
{
if (dynamic_cast<CMakeTargetNode *>(context))
return action == ProjectAction::AddNewFile;
if (dynamic_cast<CMakeListsNode *>(context))
return action == ProjectAction::AddNewFile;
return BuildSystem::supportsAction(context, action, node);
}
bool CMakeBuildSystem::addFiles(Node *context, const QStringList &filePaths, QStringList *notAdded)
{
if (auto n = dynamic_cast<CMakeProjectNode *>(context)) {
noAutoAdditionNotify(filePaths, n);
return true; // Return always true as autoadd is not supported!
}
if (auto n = dynamic_cast<CMakeTargetNode *>(context)) {
noAutoAdditionNotify(filePaths, n);
return true; // Return always true as autoadd is not supported!
}
return BuildSystem::addFiles(context, filePaths, notAdded);
}
QStringList CMakeBuildSystem::filesGeneratedFrom(const QString &sourceFile) const
{
QFileInfo fi(sourceFile);

View File

@@ -32,7 +32,8 @@
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <QString>
#include <QFile>
#include <QIODevice>
namespace CMakeProjectManager {

View File

@@ -30,16 +30,17 @@
#include <utils/optional.h>
#include <QByteArray>
#include <QList>
#include <QStringList>
#include <functional>
namespace ProjectExplorer { class Kit; }
namespace Utils {
class FilePath;
class MacroExpander;
} // namespace Utils
namespace ProjectExplorer {
class Kit;
}
namespace CMakeProjectManager {
class CMAKE_EXPORT CMakeConfigItem {

View File

@@ -27,31 +27,20 @@
#include "cmakefilecompletionassist.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
#include "cmakeindenter.h"
#include "cmakeautocompleter.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h>
#include <utils/qtcassert.h>
#include <utils/textutils.h>
#include <QDir>
#include <QTextDocument>
#include <QFileInfo>
#include <QTextBlock>
#include <functional>
using namespace Core;
using namespace ProjectExplorer;
using namespace TextEditor;
namespace CMakeProjectManager {

View File

@@ -25,7 +25,6 @@
#pragma once
#include <texteditor/textdocument.h>
#include <texteditor/texteditor.h>
namespace CMakeProjectManager {

View File

@@ -24,19 +24,17 @@
****************************************************************************/
#include "cmakefilecompletionassist.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectmanager.h"
#include "cmakesettingspage.h"
#include "cmaketoolmanager.h"
#include "cmakekitinformation.h"
#include "cmakeprojectconstants.h"
#include "cmaketool.h"
#include <texteditor/codeassist/assistinterface.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <coreplugin/editormanager/editormanager.h>
#include <QFileInfo>
using namespace CMakeProjectManager::Internal;
using namespace TextEditor;

View File

@@ -25,7 +25,6 @@
#pragma once
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/keywordscompletionassist.h>
namespace CMakeProjectManager {

View File

@@ -25,12 +25,6 @@
#include "cmakeindenter.h"
#include <QStack>
#include <QDebug>
#include <texteditor/tabsettings.h>
#include <texteditor/textdocumentlayout.h>
namespace CMakeProjectManager {
namespace Internal {

View File

@@ -24,38 +24,37 @@
****************************************************************************/
#include "cmakekitinformation.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectplugin.h"
#include "cmakespecificsettings.h"
#include "cmaketool.h"
#include "cmaketoolmanager.h"
#include <app/app_version.h>
#include <coreplugin/icore.h>
#include <coreplugin/variablechooser.h>
#include <projectexplorer/task.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/kitinformation.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <app/app_version.h>
#include <utils/algorithm.h>
#include <utils/elidinglabel.h>
#include <utils/environment.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <QComboBox>
#include <QDialog>
#include <QDialogButtonBox>
#include <QFileInfo>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPlainTextEdit>
#include <QPointer>
#include <QPushButton>
#include <QVariant>
using namespace ProjectExplorer;

View File

@@ -24,15 +24,14 @@
****************************************************************************/
#include "cmakelocatorfilter.h"
#include "cmakebuildconfiguration.h"
#include "cmakebuildstep.h"
#include "cmakebuildsystem.h"
#include "cmakeproject.h"
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>

View File

@@ -30,6 +30,8 @@
#include <projectexplorer/ioutputparser.h>
#include <projectexplorer/task.h>
#include <utils/optional.h>
#include <QDir>
#include <QRegExp>
#include <QRegularExpression>

View File

@@ -33,14 +33,9 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/taskhub.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/stringutils.h>
#include <QDir>
#include <QObject>
#include <QTime>
#include <QTimer>
namespace CMakeProjectManager {
namespace Internal {

View File

@@ -33,6 +33,8 @@
#include <QElapsedTimer>
#include <QFutureInterface>
#include <QObject>
#include <QStringList>
#include <QTimer>
#include <memory>

View File

@@ -25,41 +25,19 @@
#include "cmakeproject.h"
#include "cmakebuildconfiguration.h"
#include "cmakebuildstep.h"
#include "cmakekitinformation.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectimporter.h"
#include "cmakeprojectnodes.h"
#include "cmakeprojectmanager.h"
#include "cmaketool.h"
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/cppprojectupdater.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/generatedcodemodelsupport.h>
#include <cpptools/projectinfo.h>
#include <coreplugin/icontext.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/headerpath.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtcppkitinfo.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/stringutils.h>
#include <utils/hostosinfo.h>
#include <QDir>
#include <QElapsedTimer>
#include <QSet>
using namespace ProjectExplorer;
using namespace Utils;
@@ -87,7 +65,10 @@ CMakeProject::CMakeProject(const FilePath &fileName)
setHasMakeInstallEquivalent(true);
}
CMakeProject::~CMakeProject() = default;
CMakeProject::~CMakeProject()
{
delete m_projectImporter;
}
Tasks CMakeProject::projectIssues(const Kit *k) const
{
@@ -105,8 +86,8 @@ Tasks CMakeProject::projectIssues(const Kit *k) const
ProjectImporter *CMakeProject::projectImporter() const
{
if (!m_projectImporter)
m_projectImporter = std::make_unique<CMakeProjectImporter>(projectFilePath());
return m_projectImporter.get();
m_projectImporter = new CMakeProjectImporter(projectFilePath());
return m_projectImporter;
}
bool CMakeProject::setupTarget(Target *t)

View File

@@ -27,18 +27,14 @@
#include "cmake_global.h"
#include "builddirmanager.h"
#include "cmakebuildsystem.h"
#include "cmakebuildtarget.h"
#include "cmakeprojectimporter.h"
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/project.h>
#include <memory>
namespace CMakeProjectManager {
namespace Internal {
class CMakeProjectImporter;
}
class CMAKE_EXPORT CMakeProject final : public ProjectExplorer::Project
{
Q_OBJECT
@@ -59,7 +55,7 @@ private:
ProjectExplorer::MakeInstallCommand makeInstallCommand(const ProjectExplorer::Target *target,
const QString &installRoot) override;
mutable std::unique_ptr<Internal::CMakeProjectImporter> m_projectImporter;
mutable Internal::CMakeProjectImporter *m_projectImporter = nullptr;
friend class CMakeBuildSystem;
};

View File

@@ -25,8 +25,6 @@
#pragma once
#include <QtGlobal>
namespace CMakeProjectManager {
namespace Constants {

View File

@@ -31,8 +31,7 @@
#include "cmaketoolmanager.h"
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/qtkitinformation.h>
@@ -40,9 +39,7 @@
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QLoggingCategory>
using namespace ProjectExplorer;

View File

@@ -24,20 +24,17 @@
****************************************************************************/
#include "cmakeprojectmanager.h"
#include "cmakebuildconfiguration.h"
#include "cmakebuildsystem.h"
#include "cmakekitinformation.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
#include "cmakesettingspage.h"
#include "cmaketoolmanager.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/projectexplorer.h>
@@ -49,8 +46,6 @@
#include <utils/parameteraction.h>
#include <QAction>
#include <QDateTime>
#include <QIcon>
using namespace ProjectExplorer;
using namespace CMakeProjectManager::Internal;

View File

@@ -25,98 +25,20 @@
#include "cmakeprojectnodes.h"
#include "cmakeconfigitem.h"
#include "cmakeproject.h"
#include "cmakebuildsystem.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectplugin.h"
#include "cmakespecificsettings.h"
#include <android/androidconstants.h>
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/icore.h>
#include <cpptools/cpptoolsconstants.h>
#include <projectexplorer/target.h>
#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/optional.h>
#include <utils/qtcassert.h>
#include <QClipboard>
#include <QDir>
#include <QGuiApplication>
#include <QMessageBox>
using namespace ProjectExplorer;
namespace CMakeProjectManager {
namespace Internal {
namespace {
void copySourcePathToClipboard(Utils::optional<QString> srcPath,
const ProjectExplorer::ProjectNode *node)
{
QClipboard *clip = QGuiApplication::clipboard();
QDir projDir{node->filePath().toFileInfo().absoluteFilePath()};
clip->setText(QDir::cleanPath(projDir.relativeFilePath(srcPath.value())));
}
void noAutoAdditionNotify(const QStringList &filePaths, const ProjectExplorer::ProjectNode *node)
{
Utils::optional<QString> srcPath{};
for (const QString &file : filePaths) {
if (Utils::mimeTypeForFile(file).name() == CppTools::Constants::CPP_SOURCE_MIMETYPE) {
srcPath = file;
break;
}
}
if (srcPath) {
CMakeSpecificSettings *settings = CMakeProjectPlugin::projectTypeSpecificSettings();
switch (settings->afterAddFileSetting()) {
case CMakeProjectManager::Internal::ASK_USER: {
bool checkValue{false};
QDialogButtonBox::StandardButton reply =
Utils::CheckableMessageBox::question(nullptr,
QMessageBox::tr("Copy to Clipboard?"),
QMessageBox::tr("Files are not automatically added to the "
"CMakeLists.txt file of the CMake project."
"\nCopy the path to the source files to the clipboard?"),
"Remember My Choice", &checkValue, QDialogButtonBox::Yes | QDialogButtonBox::No,
QDialogButtonBox::Yes);
if (checkValue) {
if (QDialogButtonBox::Yes == reply)
settings->setAfterAddFileSetting(AfterAddFileAction::COPY_FILE_PATH);
else if (QDialogButtonBox::No == reply)
settings->setAfterAddFileSetting(AfterAddFileAction::NEVER_COPY_FILE_PATH);
settings->toSettings(Core::ICore::settings());
}
if (QDialogButtonBox::Yes == reply) {
copySourcePathToClipboard(srcPath, node);
}
break;
}
case CMakeProjectManager::Internal::COPY_FILE_PATH: {
copySourcePathToClipboard(srcPath, node);
break;
}
case CMakeProjectManager::Internal::NEVER_COPY_FILE_PATH:
break;
}
}
}
}
CMakeInputsNode::CMakeInputsNode(const Utils::FilePath &cmakeLists) :
ProjectExplorer::ProjectNode(cmakeLists)
{
@@ -157,21 +79,6 @@ QString CMakeProjectNode::tooltip() const
return QString();
}
bool CMakeBuildSystem::addFiles(Node *context, const QStringList &filePaths, QStringList *notAdded)
{
if (auto n = dynamic_cast<CMakeProjectNode *>(context)) {
noAutoAdditionNotify(filePaths, n);
return true; // Return always true as autoadd is not supported!
}
if (auto n = dynamic_cast<CMakeTargetNode *>(context)) {
noAutoAdditionNotify(filePaths, n);
return true; // Return always true as autoadd is not supported!
}
return BuildSystem::addFiles(context, filePaths, notAdded);
}
CMakeTargetNode::CMakeTargetNode(const Utils::FilePath &directory, const QString &target) :
ProjectExplorer::ProjectNode(directory)
{
@@ -248,17 +155,6 @@ void CMakeTargetNode::setConfig(const CMakeConfig &config)
m_config = config;
}
bool CMakeBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const
{
if (dynamic_cast<CMakeTargetNode *>(context))
return action == ProjectAction::AddNewFile;
if (dynamic_cast<CMakeListsNode *>(context))
return action == ProjectAction::AddNewFile;
return BuildSystem::supportsAction(context, action, node);
}
Utils::optional<Utils::FilePath> CMakeTargetNode::visibleAfterAddFileAction() const
{
return filePath().pathAppended("CMakeLists.txt");

View File

@@ -25,31 +25,28 @@
#include "cmakeprojectplugin.h"
#include "cmakeeditor.h"
#include "cmakebuildconfiguration.h"
#include "cmakebuildstep.h"
#include "cmakebuildsystem.h"
#include "cmakeeditor.h"
#include "cmakekitinformation.h"
#include "cmakelocatorfilter.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectmanager.h"
#include "cmakeprojectnodes.h"
#include "cmakebuildconfiguration.h"
#include "cmakeprojectconstants.h"
#include "cmakelocatorfilter.h"
#include "cmakesettingspage.h"
#include "cmaketoolmanager.h"
#include "cmakekitinformation.h"
#include "cmakespecificsettings.h"
#include "cmakespecificsettingspage.h"
#include "cmaketoolmanager.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/icore.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/projecttree.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
#include <texteditor/snippets/snippetprovider.h>
#include <utils/parameteraction.h>

View File

@@ -25,21 +25,21 @@
#pragma once
#include "cmakespecificsettingspage.h"
#include <extensionsystem/iplugin.h>
namespace CMakeProjectManager {
namespace Internal {
class CMakeProjectPlugin : public ExtensionSystem::IPlugin
class CMakeSpecificSettings;
class CMakeProjectPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CMakeProjectManager.json")
public:
static CMakeSpecificSettings *projectTypeSpecificSettings();
~CMakeProjectPlugin() override;
~CMakeProjectPlugin();
#ifdef WITH_TESTS
private slots:
@@ -60,8 +60,8 @@ private slots:
#endif
private:
bool initialize(const QStringList &arguments, QString *errorMessage) override;
void extensionsInitialized() override;
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
void updateContextActions();

View File

@@ -23,31 +23,35 @@
**
****************************************************************************/
#include "cmakeprojectconstants.h"
#include "cmakesettingspage.h"
#include "cmakeprojectconstants.h"
#include "cmaketool.h"
#include "cmaketoolmanager.h"
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorericons.h>
#include <utils/detailswidget.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <utils/treemodel.h>
#include <utils/utilsicons.h>
#include <QBoxLayout>
#include <QCheckBox>
#include <QCoreApplication>
#include <QFileInfo>
#include <QFormLayout>
#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QString>
#include <QTreeView>
#include <QUuid>
#include <QWidget>
using namespace Utils;
@@ -121,7 +125,7 @@ public:
}
CMakeToolTreeItem(const QString &name,
const Utils::FilePath &executable,
const FilePath &executable,
const FilePath &qchFile,
bool autoRun,
bool autoCreate,

View File

@@ -24,7 +24,9 @@
****************************************************************************/
#pragma once
#include <utils/fileutils.h>
#include <QSettings>
namespace CMakeProjectManager {

View File

@@ -24,23 +24,21 @@
****************************************************************************/
#include "cmaketool.h"
#include "cmaketoolmanager.h"
#include <utils/algorithm.h>
#include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDir>
#include <QFileInfo>
#include <QJsonDocument>
#include <QJsonObject>
#include <QProcess>
#include <QRegularExpression>
#include <QSet>
#include <QTextDocument>
#include <QUuid>
#include <QVariantMap>
#include <memory>
namespace CMakeProjectManager {

View File

@@ -34,10 +34,6 @@
#include <utils/optional.h>
#include <utils/synchronousprocess.h>
#include <QObject>
#include <QMap>
#include <QStringList>
QT_FORWARD_DECLARE_CLASS(QProcess)
namespace ProjectExplorer { class Kit; }

View File

@@ -34,8 +34,6 @@
#include <utils/qtcassert.h>
using namespace Core;
using namespace Utils;
using namespace ProjectExplorer;
namespace CMakeProjectManager {
@@ -139,7 +137,7 @@ void CMakeToolManager::setDefaultCMakeTool(const Id &id)
ensureDefaultCMakeToolIsValid();
}
CMakeTool *CMakeToolManager::findByCommand(const FilePath &command)
CMakeTool *CMakeToolManager::findByCommand(const Utils::FilePath &command)
{
return Utils::findOrDefault(d->m_cmakeTools, Utils::equal(&CMakeTool::cmakeExecutable, command));
}

View File

@@ -26,14 +26,17 @@
#pragma once
#include "cmake_global.h"
#include "cmaketool.h"
#include <coreplugin/id.h>
#include <utils/fileutils.h>
#include <texteditor/codeassist/keywordscompletionassist.h>
#include <functional>
#include <QObject>
#include <memory>
namespace CMakeProjectManager {
class CMAKE_EXPORT CMakeToolManager : public QObject
@@ -41,7 +44,7 @@ class CMAKE_EXPORT CMakeToolManager : public QObject
Q_OBJECT
public:
CMakeToolManager();
~CMakeToolManager() override;
~CMakeToolManager();
static CMakeToolManager *instance();

View File

@@ -31,9 +31,9 @@
#include <coreplugin/icore.h>
#include <app/app_version.h>
#include <utils/environment.h>
#include <utils/algorithm.h>
#include <utils/environment.h>
#include <QDebug>
#include <QDir>

View File

@@ -29,10 +29,6 @@
#include <coreplugin/id.h>
#include <QList>
#include <memory>
namespace Core { class Id; }
namespace CMakeProjectManager {

View File

@@ -31,7 +31,6 @@
#include <QCoreApplication>
#include <QFont>
#include <QString>
#include <QSortFilterProxyModel>
namespace CMakeProjectManager {

View File

@@ -27,9 +27,10 @@
#include "cmakeconfigitem.h"
#include <QAbstractTableModel>
#include <utils/treemodel.h>
#include <QString>
namespace CMakeProjectManager {
namespace Internal { class ConfigModelTreeItem; }

View File

@@ -25,14 +25,12 @@
****************************************************************************/
#include "configmodelitemdelegate.h"
#include "configmodel.h"
#include <utils/pathchooser.h>
#include <QComboBox>
#include <QCheckBox>
#include <QLineEdit>
#include <QPainter>
namespace CMakeProjectManager {

View File

@@ -26,11 +26,11 @@
#pragma once
#include <utils/fileutils.h>
#include <QComboBox>
#include <QStyledItemDelegate>
#include <utils/fileutils.h>
namespace CMakeProjectManager {
class ConfigModelItemDelegate : public QStyledItemDelegate

View File

@@ -25,11 +25,9 @@
#include "fileapidataextractor.h"
#include "cmakeprojectnodes.h"
#include "fileapiparser.h"
#include "projecttreehelper.h"
#include <projectexplorer/projectnodes.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>

View File

@@ -25,19 +25,24 @@
#pragma once
#include "fileapiparser.h"
#include "cmakebuildtarget.h"
#include "cmakeprocess.h"
#include "cmakeprojectnodes.h"
#include <projectexplorer/rawprojectpart.h>
#include <utils/fileutils.h>
#include <QList>
#include <QSet>
#include <QString>
#include <memory>
namespace CMakeProjectManager {
namespace Internal {
class FileApiData;
class FileApiQtcData
{
public:

View File

@@ -26,13 +26,11 @@
#include "fileapiparser.h"
#include <coreplugin/messagemanager.h>
#include <projectexplorer/headerpath.h>
#include <projectexplorer/rawprojectpart.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QDir>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>

View File

@@ -33,7 +33,11 @@
#include <utils/filesystemwatcher.h>
#include <utils/fileutils.h>
#include <QObject>
#include <QDir>
#include <QString>
#include <QVector>
#include <vector>
namespace CMakeProjectManager {
namespace Internal {

View File

@@ -25,25 +25,12 @@
#include "fileapireader.h"
#include "cmakebuildconfiguration.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectmanager.h"
#include "fileapidataextractor.h"
#include "projecttreehelper.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
#include <utils/algorithm.h>
#include <utils/optional.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
#include <QDateTime>

View File

@@ -27,15 +27,14 @@
#include "builddirreader.h"
#include "fileapiparser.h"
#include "cmakeprocess.h"
#include <utils/optional.h>
#include <memory>
#include <QFuture>
#include <memory>
namespace ProjectExplorer {
class ProjectNode;
}

View File

@@ -25,8 +25,6 @@
#include "cmakeprojectnodes.h"
#include <projectexplorer/projectnodes.h>
#include <utils/fileutils.h>
#include <memory>

View File

@@ -25,17 +25,10 @@
#include "servermode.h"
#include <coreplugin/icore.h>
#include <coreplugin/reaper.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/temporarydirectory.h>
#include <QByteArray>
#include <QCryptographicHash>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QLocalSocket>

View File

@@ -25,12 +25,15 @@
#pragma once
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/qtcprocess.h>
#include <QLoggingCategory>
#include <QObject>
#include <QTemporaryDir>
#include <QTimer>
#include <QVariantMap>
#include <QTemporaryDir>
#include <memory>
@@ -116,7 +119,6 @@ private:
const int m_minorProtocol = -1;
int m_requestCounter = 0;
};
} // namespace Internal

View File

@@ -25,26 +25,15 @@
#include "servermodereader.h"
#include "cmakebuildconfiguration.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectmanager.h"
#include "cmakeprojectnodes.h"
#include "servermode.h"
#include "cmakeparser.h"
#include "projecttreehelper.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <QVector>
using namespace ProjectExplorer;
using namespace Utils;

View File

@@ -26,16 +26,22 @@
#pragma once
#include "builddirreader.h"
#include "cmakeconfigitem.h"
#include "servermode.h"
#include "cmakeparser.h"
#include <projectexplorer/ioutputparser.h>
#include <QList>
#include <QSet>
#include <memory>
namespace ProjectExplorer { class ProjectNode; }
namespace CMakeProjectManager {
class CMakeParser;
namespace Internal {
class ServerModeReader final : public BuildDirReader