forked from qt-creator/qt-creator
Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.
Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
Utils::Environment environment;
|
||||
|
||||
Core::Id cmakeToolId;
|
||||
Utils::Id cmakeToolId;
|
||||
|
||||
QStringList initialCMakeArguments;
|
||||
QStringList extraCMakeArguments;
|
||||
|
||||
@@ -98,7 +98,7 @@ static QStringList defaultInitialCMakeArguments(const Kit *k, const QString buil
|
||||
// CMakeBuildConfiguration:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Core::Id id)
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Utils::Id id)
|
||||
: BuildConfiguration(target, id)
|
||||
{
|
||||
m_buildSystem = new CMakeBuildSystem(this);
|
||||
|
||||
@@ -44,7 +44,7 @@ class CMakeBuildConfiguration final : public ProjectExplorer::BuildConfiguration
|
||||
Q_OBJECT
|
||||
|
||||
friend class ProjectExplorer::BuildConfigurationFactory;
|
||||
CMakeBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
CMakeBuildConfiguration(ProjectExplorer::Target *target, Utils::Id id);
|
||||
~CMakeBuildConfiguration() final;
|
||||
|
||||
public:
|
||||
|
||||
@@ -85,7 +85,7 @@ static bool isCurrentExecutableTarget(const QString &target)
|
||||
return target == ADD_RUNCONFIGURATION_TEXT;
|
||||
}
|
||||
|
||||
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Core::Id id) :
|
||||
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
||||
AbstractProcessStep(bsl, id)
|
||||
{
|
||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||
@@ -268,7 +268,7 @@ QString CMakeBuildStep::defaultBuildTarget() const
|
||||
{
|
||||
const BuildStepList *const bsl = stepList();
|
||||
QTC_ASSERT(bsl, return {});
|
||||
const Core::Id parentId = bsl->id();
|
||||
const Utils::Id parentId = bsl->id();
|
||||
if (parentId == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
||||
return cleanTarget();
|
||||
if (parentId == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
|
||||
@@ -43,7 +43,7 @@ class CMakeBuildStep : public ProjectExplorer::AbstractProcessStep
|
||||
friend class CMakeBuildStepFactory;
|
||||
|
||||
public:
|
||||
CMakeBuildStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
||||
CMakeBuildStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
|
||||
|
||||
CMakeBuildConfiguration *cmakeBuildConfiguration() const;
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ namespace CMakeProjectManager {
|
||||
// CMakeKitAspect:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static Core::Id defaultCMakeToolId()
|
||||
static Utils::Id defaultCMakeToolId()
|
||||
{
|
||||
CMakeTool *defaultTool = CMakeToolManager::defaultCMakeTool();
|
||||
return defaultTool ? defaultTool->id() : Core::Id();
|
||||
return defaultTool ? defaultTool->id() : Utils::Id();
|
||||
}
|
||||
|
||||
static const char TOOL_ID[] = "CMakeProjectManager.CMakeKitInformation";
|
||||
@@ -125,10 +125,10 @@ private:
|
||||
m_comboBox->setCurrentIndex(tool ? indexOf(tool->id()) : -1);
|
||||
}
|
||||
|
||||
int indexOf(const Core::Id &id)
|
||||
int indexOf(const Utils::Id &id)
|
||||
{
|
||||
for (int i = 0; i < m_comboBox->count(); ++i) {
|
||||
if (id == Core::Id::fromSetting(m_comboBox->itemData(i)))
|
||||
if (id == Utils::Id::fromSetting(m_comboBox->itemData(i)))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
@@ -137,20 +137,20 @@ private:
|
||||
void updateComboBox()
|
||||
{
|
||||
// remove unavailable cmake tool:
|
||||
int pos = indexOf(Core::Id());
|
||||
int pos = indexOf(Utils::Id());
|
||||
if (pos >= 0)
|
||||
m_comboBox->removeItem(pos);
|
||||
|
||||
if (m_comboBox->count() == 0) {
|
||||
m_comboBox->addItem(tr("<No CMake Tool available>"),
|
||||
Core::Id().toSetting());
|
||||
Utils::Id().toSetting());
|
||||
m_comboBox->setEnabled(false);
|
||||
} else {
|
||||
m_comboBox->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void cmakeToolAdded(const Core::Id &id)
|
||||
void cmakeToolAdded(const Utils::Id &id)
|
||||
{
|
||||
const CMakeTool *tool = CMakeToolManager::findById(id);
|
||||
QTC_ASSERT(tool, return);
|
||||
@@ -160,7 +160,7 @@ private:
|
||||
refresh();
|
||||
}
|
||||
|
||||
void cmakeToolUpdated(const Core::Id &id)
|
||||
void cmakeToolUpdated(const Utils::Id &id)
|
||||
{
|
||||
const int pos = indexOf(id);
|
||||
QTC_ASSERT(pos >= 0, return);
|
||||
@@ -171,7 +171,7 @@ private:
|
||||
m_comboBox->setItemText(pos, tool->displayName());
|
||||
}
|
||||
|
||||
void cmakeToolRemoved(const Core::Id &id)
|
||||
void cmakeToolRemoved(const Utils::Id &id)
|
||||
{
|
||||
const int pos = indexOf(id);
|
||||
QTC_ASSERT(pos >= 0, return);
|
||||
@@ -191,7 +191,7 @@ private:
|
||||
if (m_removingItem)
|
||||
return;
|
||||
|
||||
const Core::Id id = Core::Id::fromSetting(m_comboBox->itemData(index));
|
||||
const Utils::Id id = Utils::Id::fromSetting(m_comboBox->itemData(index));
|
||||
CMakeKitAspect::setCMakeTool(m_kit, id);
|
||||
}
|
||||
|
||||
@@ -223,16 +223,16 @@ CMakeKitAspect::CMakeKitAspect()
|
||||
[this]() { foreach (Kit *k, KitManager::kits()) fix(k); });
|
||||
}
|
||||
|
||||
Core::Id CMakeKitAspect::id()
|
||||
Utils::Id CMakeKitAspect::id()
|
||||
{
|
||||
return TOOL_ID;
|
||||
}
|
||||
|
||||
Core::Id CMakeKitAspect::cmakeToolId(const Kit *k)
|
||||
Utils::Id CMakeKitAspect::cmakeToolId(const Kit *k)
|
||||
{
|
||||
if (!k)
|
||||
return {};
|
||||
return Core::Id::fromSetting(k->value(TOOL_ID));
|
||||
return Utils::Id::fromSetting(k->value(TOOL_ID));
|
||||
}
|
||||
|
||||
CMakeTool *CMakeKitAspect::cmakeTool(const Kit *k)
|
||||
@@ -240,9 +240,9 @@ CMakeTool *CMakeKitAspect::cmakeTool(const Kit *k)
|
||||
return CMakeToolManager::findById(cmakeToolId(k));
|
||||
}
|
||||
|
||||
void CMakeKitAspect::setCMakeTool(Kit *k, const Core::Id id)
|
||||
void CMakeKitAspect::setCMakeTool(Kit *k, const Utils::Id id)
|
||||
{
|
||||
const Core::Id toSet = id.isValid() ? id : defaultCMakeToolId();
|
||||
const Utils::Id toSet = id.isValid() ? id : defaultCMakeToolId();
|
||||
QTC_ASSERT(!id.isValid() || CMakeToolManager::findById(toSet), return);
|
||||
if (k)
|
||||
k->setValue(TOOL_ID, toSet.toSetting());
|
||||
@@ -298,7 +298,7 @@ void CMakeKitAspect::addToMacroExpander(Kit *k, Utils::MacroExpander *expander)
|
||||
});
|
||||
}
|
||||
|
||||
QSet<Core::Id> CMakeKitAspect::availableFeatures(const Kit *k) const
|
||||
QSet<Utils::Id> CMakeKitAspect::availableFeatures(const Kit *k) const
|
||||
{
|
||||
if (cmakeTool(k))
|
||||
return { CMakeProjectManager::Constants::CMAKE_FEATURE_ID };
|
||||
|
||||
@@ -40,11 +40,11 @@ class CMAKE_EXPORT CMakeKitAspect : public ProjectExplorer::KitAspect
|
||||
public:
|
||||
CMakeKitAspect();
|
||||
|
||||
static Core::Id id();
|
||||
static Utils::Id id();
|
||||
|
||||
static Core::Id cmakeToolId(const ProjectExplorer::Kit *k);
|
||||
static Utils::Id cmakeToolId(const ProjectExplorer::Kit *k);
|
||||
static CMakeTool *cmakeTool(const ProjectExplorer::Kit *k);
|
||||
static void setCMakeTool(ProjectExplorer::Kit *k, const Core::Id id);
|
||||
static void setCMakeTool(ProjectExplorer::Kit *k, const Utils::Id id);
|
||||
|
||||
// KitAspect interface
|
||||
ProjectExplorer::Tasks validate(const ProjectExplorer::Kit *k) const final;
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
void addToMacroExpander(ProjectExplorer::Kit *k, Utils::MacroExpander *expander) const final;
|
||||
|
||||
QSet<Core::Id> availableFeatures(const ProjectExplorer::Kit *k) const final;
|
||||
QSet<Utils::Id> availableFeatures(const ProjectExplorer::Kit *k) const final;
|
||||
};
|
||||
|
||||
class CMAKE_EXPORT CMakeGeneratorKitAspect : public ProjectExplorer::KitAspect
|
||||
|
||||
@@ -217,13 +217,13 @@ static QVector<ToolChainDescription> extractToolChainsFromCache(const CMakeConfi
|
||||
if (!i.key.startsWith("CMAKE_") || !i.key.endsWith("_COMPILER"))
|
||||
continue;
|
||||
const QByteArray language = i.key.mid(6, i.key.count() - 6 - 9); // skip "CMAKE_" and "_COMPILER"
|
||||
Core::Id languageId;
|
||||
Utils::Id languageId;
|
||||
if (language == "CXX")
|
||||
languageId = ProjectExplorer::Constants::CXX_LANGUAGE_ID;
|
||||
else if (language == "C")
|
||||
languageId = ProjectExplorer::Constants::C_LANGUAGE_ID;
|
||||
else
|
||||
languageId = Core::Id::fromName(language);
|
||||
languageId = Utils::Id::fromName(language);
|
||||
result.append({Utils::FilePath::fromUtf8(i.value), languageId});
|
||||
}
|
||||
return result;
|
||||
@@ -380,8 +380,8 @@ void CMakeProjectImporter::cleanupTemporaryCMake(Kit *k, const QVariantList &vl)
|
||||
if (vl.isEmpty())
|
||||
return; // No temporary CMake
|
||||
QTC_ASSERT(vl.count() == 1, return);
|
||||
CMakeKitAspect::setCMakeTool(k, Core::Id()); // Always mark Kit as not using this Qt
|
||||
CMakeToolManager::deregisterCMakeTool(Core::Id::fromSetting(vl.at(0)));
|
||||
CMakeKitAspect::setCMakeTool(k, Utils::Id()); // Always mark Kit as not using this Qt
|
||||
CMakeToolManager::deregisterCMakeTool(Utils::Id::fromSetting(vl.at(0)));
|
||||
qCDebug(cmInputLog) << "Temporary CMake tool cleaned up.";
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ void CMakeProjectImporter::persistTemporaryCMake(Kit *k, const QVariantList &vl)
|
||||
return; // No temporary CMake
|
||||
QTC_ASSERT(vl.count() == 1, return);
|
||||
const QVariant data = vl.at(0);
|
||||
CMakeTool *tmpCmake = CMakeToolManager::findById(Core::Id::fromSetting(data));
|
||||
CMakeTool *tmpCmake = CMakeToolManager::findById(Utils::Id::fromSetting(data));
|
||||
CMakeTool *actualCmake = CMakeKitAspect::cmakeTool(k);
|
||||
|
||||
// User changed Kit away from temporary CMake that was set up:
|
||||
|
||||
@@ -109,7 +109,7 @@ void CMakeTargetNode::setBuildDirectory(const Utils::FilePath &directory)
|
||||
m_buildDirectory = directory;
|
||||
}
|
||||
|
||||
QVariant CMakeTargetNode::data(Core::Id role) const
|
||||
QVariant CMakeTargetNode::data(Utils::Id role) const
|
||||
{
|
||||
auto value = [this](const QByteArray &key) -> QVariant {
|
||||
for (const CMakeConfigItem &configItem : m_config) {
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
void build() override;
|
||||
|
||||
QVariant data(Core::Id role) const override;
|
||||
QVariant data(Utils::Id role) const override;
|
||||
void setConfig(const CMakeConfig &config);
|
||||
|
||||
private:
|
||||
|
||||
@@ -71,7 +71,7 @@ class CMakeToolItemModel : public TreeModel<TreeItem, TreeItem, CMakeToolTreeIte
|
||||
public:
|
||||
CMakeToolItemModel();
|
||||
|
||||
CMakeToolTreeItem *cmakeToolItem(const Core::Id &id) const;
|
||||
CMakeToolTreeItem *cmakeToolItem(const Utils::Id &id) const;
|
||||
CMakeToolTreeItem *cmakeToolItem(const QModelIndex &index) const;
|
||||
QModelIndex addCMakeTool(const QString &name,
|
||||
const FilePath &executable,
|
||||
@@ -83,22 +83,22 @@ public:
|
||||
TreeItem *autoGroupItem() const;
|
||||
TreeItem *manualGroupItem() const;
|
||||
void reevaluateChangedFlag(CMakeToolTreeItem *item) const;
|
||||
void updateCMakeTool(const Core::Id &id,
|
||||
void updateCMakeTool(const Utils::Id &id,
|
||||
const QString &displayName,
|
||||
const FilePath &executable,
|
||||
const FilePath &qchFile,
|
||||
bool autoRun,
|
||||
bool autoCreate);
|
||||
void removeCMakeTool(const Core::Id &id);
|
||||
void removeCMakeTool(const Utils::Id &id);
|
||||
void apply();
|
||||
|
||||
Core::Id defaultItemId() const;
|
||||
void setDefaultItemId(const Core::Id &id);
|
||||
Utils::Id defaultItemId() const;
|
||||
void setDefaultItemId(const Utils::Id &id);
|
||||
|
||||
QString uniqueDisplayName(const QString &base) const;
|
||||
private:
|
||||
Core::Id m_defaultItemId;
|
||||
QList<Core::Id> m_removedItems;
|
||||
Utils::Id m_defaultItemId;
|
||||
QList<Utils::Id> m_removedItems;
|
||||
};
|
||||
|
||||
class CMakeToolTreeItem : public TreeItem
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
bool autoRun,
|
||||
bool autoCreate,
|
||||
bool autodetected)
|
||||
: m_id(Core::Id::fromString(QUuid::createUuid().toString()))
|
||||
: m_id(Utils::Id::fromString(QUuid::createUuid().toString()))
|
||||
, m_name(name)
|
||||
, m_executable(executable)
|
||||
, m_qchFile(qchFile)
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Core::Id m_id;
|
||||
Utils::Id m_id;
|
||||
QString m_name;
|
||||
QString m_tooltip;
|
||||
FilePath m_executable;
|
||||
@@ -238,11 +238,11 @@ CMakeToolItemModel::CMakeToolItemModel()
|
||||
addCMakeTool(item, false);
|
||||
|
||||
CMakeTool *defTool = CMakeToolManager::defaultCMakeTool();
|
||||
m_defaultItemId = defTool ? defTool->id() : Core::Id();
|
||||
m_defaultItemId = defTool ? defTool->id() : Utils::Id();
|
||||
connect(CMakeToolManager::instance(), &CMakeToolManager::cmakeRemoved,
|
||||
this, &CMakeToolItemModel::removeCMakeTool);
|
||||
connect(CMakeToolManager::instance(), &CMakeToolManager::cmakeAdded,
|
||||
this, [this](const Core::Id &id) { addCMakeTool(CMakeToolManager::findById(id), false); });
|
||||
this, [this](const Utils::Id &id) { addCMakeTool(CMakeToolManager::findById(id), false); });
|
||||
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ void CMakeToolItemModel::reevaluateChangedFlag(CMakeToolTreeItem *item) const
|
||||
|
||||
//make sure the item is marked as changed when the default cmake was changed
|
||||
CMakeTool *origDefTool = CMakeToolManager::defaultCMakeTool();
|
||||
Core::Id origDefault = origDefTool ? origDefTool->id() : Core::Id();
|
||||
Utils::Id origDefault = origDefTool ? origDefTool->id() : Utils::Id();
|
||||
if (origDefault != m_defaultItemId) {
|
||||
if (item->m_id == origDefault || item->m_id == m_defaultItemId)
|
||||
item->m_changed = true;
|
||||
@@ -304,7 +304,7 @@ void CMakeToolItemModel::reevaluateChangedFlag(CMakeToolTreeItem *item) const
|
||||
item->update(); // Notify views.
|
||||
}
|
||||
|
||||
void CMakeToolItemModel::updateCMakeTool(const Core::Id &id,
|
||||
void CMakeToolItemModel::updateCMakeTool(const Utils::Id &id,
|
||||
const QString &displayName,
|
||||
const FilePath &executable,
|
||||
const FilePath &qchFile,
|
||||
@@ -325,7 +325,7 @@ void CMakeToolItemModel::updateCMakeTool(const Core::Id &id,
|
||||
reevaluateChangedFlag(treeItem);
|
||||
}
|
||||
|
||||
CMakeToolTreeItem *CMakeToolItemModel::cmakeToolItem(const Core::Id &id) const
|
||||
CMakeToolTreeItem *CMakeToolItemModel::cmakeToolItem(const Utils::Id &id) const
|
||||
{
|
||||
return findItemAtLevel<2>([id](CMakeToolTreeItem *n) { return n->m_id == id; });
|
||||
}
|
||||
@@ -335,7 +335,7 @@ CMakeToolTreeItem *CMakeToolItemModel::cmakeToolItem(const QModelIndex &index) c
|
||||
return itemForIndexAtLevel<2>(index);
|
||||
}
|
||||
|
||||
void CMakeToolItemModel::removeCMakeTool(const Core::Id &id)
|
||||
void CMakeToolItemModel::removeCMakeTool(const Utils::Id &id)
|
||||
{
|
||||
if (m_removedItems.contains(id))
|
||||
return; // Item has already been removed in the model!
|
||||
@@ -349,7 +349,7 @@ void CMakeToolItemModel::removeCMakeTool(const Core::Id &id)
|
||||
|
||||
void CMakeToolItemModel::apply()
|
||||
{
|
||||
foreach (const Core::Id &id, m_removedItems)
|
||||
foreach (const Utils::Id &id, m_removedItems)
|
||||
CMakeToolManager::deregisterCMakeTool(id);
|
||||
|
||||
QList<CMakeToolTreeItem *> toRegister;
|
||||
@@ -380,17 +380,17 @@ void CMakeToolItemModel::apply()
|
||||
CMakeToolManager::setDefaultCMakeTool(defaultItemId());
|
||||
}
|
||||
|
||||
Core::Id CMakeToolItemModel::defaultItemId() const
|
||||
Utils::Id CMakeToolItemModel::defaultItemId() const
|
||||
{
|
||||
return m_defaultItemId;
|
||||
}
|
||||
|
||||
void CMakeToolItemModel::setDefaultItemId(const Core::Id &id)
|
||||
void CMakeToolItemModel::setDefaultItemId(const Utils::Id &id)
|
||||
{
|
||||
if (m_defaultItemId == id)
|
||||
return;
|
||||
|
||||
Core::Id oldDefaultId = m_defaultItemId;
|
||||
Utils::Id oldDefaultId = m_defaultItemId;
|
||||
m_defaultItemId = id;
|
||||
|
||||
CMakeToolTreeItem *newDefault = cmakeToolItem(id);
|
||||
@@ -432,7 +432,7 @@ private:
|
||||
QCheckBox *m_autoCreateBuildDirectoryCheckBox;
|
||||
PathChooser *m_binaryChooser;
|
||||
PathChooser *m_qchFileChooser;
|
||||
Core::Id m_id;
|
||||
Utils::Id m_id;
|
||||
bool m_loadingItem;
|
||||
};
|
||||
|
||||
@@ -503,7 +503,7 @@ void CMakeToolItemConfigWidget::updateQchFilePath()
|
||||
void CMakeToolItemConfigWidget::load(const CMakeToolTreeItem *item)
|
||||
{
|
||||
m_loadingItem = true; // avoid intermediate signal handling
|
||||
m_id = Core::Id();
|
||||
m_id = Utils::Id();
|
||||
if (!item) {
|
||||
m_loadingItem = false;
|
||||
return;
|
||||
|
||||
@@ -109,17 +109,17 @@ public:
|
||||
///////////////////////////
|
||||
// CMakeTool
|
||||
///////////////////////////
|
||||
CMakeTool::CMakeTool(Detection d, const Core::Id &id)
|
||||
CMakeTool::CMakeTool(Detection d, const Utils::Id &id)
|
||||
: m_id(id)
|
||||
, m_isAutoDetected(d == AutoDetection)
|
||||
, m_introspection(std::make_unique<Internal::IntrospectionData>())
|
||||
{
|
||||
QTC_ASSERT(m_id.isValid(), m_id = Core::Id::fromString(QUuid::createUuid().toString()));
|
||||
QTC_ASSERT(m_id.isValid(), m_id = Utils::Id::fromString(QUuid::createUuid().toString()));
|
||||
}
|
||||
|
||||
CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) :
|
||||
CMakeTool(fromSdk ? CMakeTool::AutoDetection : CMakeTool::ManualDetection,
|
||||
Core::Id::fromSetting(map.value(CMAKE_INFORMATION_ID)))
|
||||
Utils::Id::fromSetting(map.value(CMAKE_INFORMATION_ID)))
|
||||
{
|
||||
m_displayName = map.value(CMAKE_INFORMATION_DISPLAYNAME).toString();
|
||||
m_isAutoRun = map.value(CMAKE_INFORMATION_AUTORUN, true).toBool();
|
||||
@@ -141,9 +141,9 @@ CMakeTool::CMakeTool(const QVariantMap &map, bool fromSdk) :
|
||||
|
||||
CMakeTool::~CMakeTool() = default;
|
||||
|
||||
Core::Id CMakeTool::createId()
|
||||
Utils::Id CMakeTool::createId()
|
||||
{
|
||||
return Core::Id::fromString(QUuid::createUuid().toString());
|
||||
return Utils::Id::fromString(QUuid::createUuid().toString());
|
||||
}
|
||||
|
||||
void CMakeTool::setFilePath(const Utils::FilePath &executable)
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
|
||||
#include "cmake_global.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
#include <texteditor/codeassist/keywordscompletionassist.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/id.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
|
||||
@@ -74,15 +74,15 @@ public:
|
||||
|
||||
using PathMapper = std::function<Utils::FilePath (const Utils::FilePath &)>;
|
||||
|
||||
explicit CMakeTool(Detection d, const Core::Id &id);
|
||||
explicit CMakeTool(Detection d, const Utils::Id &id);
|
||||
explicit CMakeTool(const QVariantMap &map, bool fromSdk);
|
||||
~CMakeTool();
|
||||
|
||||
static Core::Id createId();
|
||||
static Utils::Id createId();
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
Core::Id id() const { return m_id; }
|
||||
Utils::Id id() const { return m_id; }
|
||||
QVariantMap toMap () const;
|
||||
|
||||
void setAutorun(bool autoRun);
|
||||
@@ -123,7 +123,7 @@ private:
|
||||
void fetchFromCapabilities() const;
|
||||
void parseFromCapabilities(const QString &input) const;
|
||||
|
||||
Core::Id m_id;
|
||||
Utils::Id m_id;
|
||||
QString m_displayName;
|
||||
Utils::FilePath m_executable;
|
||||
Utils::FilePath m_qchFilePath;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
@@ -90,7 +91,7 @@ bool CMakeToolManager::registerCMakeTool(std::unique_ptr<CMakeTool> &&tool)
|
||||
if (!tool || Utils::contains(d->m_cmakeTools, tool.get()))
|
||||
return true;
|
||||
|
||||
const Core::Id toolId = tool->id();
|
||||
const Utils::Id toolId = tool->id();
|
||||
QTC_ASSERT(toolId.isValid(),return false);
|
||||
|
||||
//make sure the same id was not used before
|
||||
@@ -184,9 +185,9 @@ void CMakeToolManager::saveCMakeTools()
|
||||
|
||||
void CMakeToolManager::ensureDefaultCMakeToolIsValid()
|
||||
{
|
||||
const Core::Id oldId = d->m_defaultCMake;
|
||||
const Utils::Id oldId = d->m_defaultCMake;
|
||||
if (d->m_cmakeTools.size() == 0) {
|
||||
d->m_defaultCMake = Core::Id();
|
||||
d->m_defaultCMake = Utils::Id();
|
||||
} else {
|
||||
if (findById(d->m_defaultCMake))
|
||||
return;
|
||||
|
||||
@@ -29,9 +29,8 @@
|
||||
|
||||
#include "cmaketool.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/id.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@@ -51,12 +50,12 @@ public:
|
||||
static QList<CMakeTool *> cmakeTools();
|
||||
|
||||
static bool registerCMakeTool(std::unique_ptr<CMakeTool> &&tool);
|
||||
static void deregisterCMakeTool(const Core::Id &id);
|
||||
static void deregisterCMakeTool(const Utils::Id &id);
|
||||
|
||||
static CMakeTool *defaultCMakeTool();
|
||||
static void setDefaultCMakeTool(const Core::Id &id);
|
||||
static void setDefaultCMakeTool(const Utils::Id &id);
|
||||
static CMakeTool *findByCommand(const Utils::FilePath &command);
|
||||
static CMakeTool *findById(const Core::Id &id);
|
||||
static CMakeTool *findById(const Utils::Id &id);
|
||||
|
||||
static void notifyAboutUpdate(CMakeTool *);
|
||||
static void restoreCMakeTools();
|
||||
@@ -64,9 +63,9 @@ public:
|
||||
static void updateDocumentation();
|
||||
|
||||
signals:
|
||||
void cmakeAdded (const Core::Id &id);
|
||||
void cmakeRemoved (const Core::Id &id);
|
||||
void cmakeUpdated (const Core::Id &id);
|
||||
void cmakeAdded (const Utils::Id &id);
|
||||
void cmakeRemoved (const Utils::Id &id);
|
||||
void cmakeUpdated (const Utils::Id &id);
|
||||
void cmakeToolsChanged ();
|
||||
void cmakeToolsLoaded ();
|
||||
void defaultCMakeChanged ();
|
||||
|
||||
@@ -201,7 +201,7 @@ CMakeToolSettingsAccessor::CMakeTools CMakeToolSettingsAccessor::restoreCMakeToo
|
||||
}
|
||||
|
||||
void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTools,
|
||||
const Core::Id &defaultId,
|
||||
const Utils::Id &defaultId,
|
||||
QWidget *parent)
|
||||
{
|
||||
QVariantMap data;
|
||||
@@ -246,8 +246,8 @@ CMakeToolSettingsAccessor::cmakeTools(const QVariantMap &data, bool fromSdk) con
|
||||
result.cmakeTools.emplace_back(std::move(item));
|
||||
}
|
||||
|
||||
result.defaultToolId = Core::Id::fromSetting(data.value(CMAKE_TOOL_DEFAULT_KEY,
|
||||
Core::Id().toSetting()));
|
||||
result.defaultToolId = Utils::Id::fromSetting(data.value(CMAKE_TOOL_DEFAULT_KEY,
|
||||
Utils::Id().toSetting()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -25,10 +25,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/id.h>
|
||||
#include <utils/settingsaccessor.h>
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
class CMakeTool;
|
||||
@@ -41,14 +40,14 @@ public:
|
||||
CMakeToolSettingsAccessor();
|
||||
|
||||
struct CMakeTools {
|
||||
Core::Id defaultToolId;
|
||||
Utils::Id defaultToolId;
|
||||
std::vector<std::unique_ptr<CMakeTool>> cmakeTools;
|
||||
};
|
||||
|
||||
CMakeTools restoreCMakeTools(QWidget *parent) const;
|
||||
|
||||
void saveCMakeTools(const QList<CMakeTool *> &cmakeTools,
|
||||
const Core::Id &defaultId,
|
||||
const Utils::Id &defaultId,
|
||||
QWidget *parent);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user