From 7a37897f79b7fdfd821c110b5777df94caa37394 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 11 Oct 2012 11:40:56 +0200 Subject: [PATCH] Kit: Allow creation of kits with a given id This is to avoid creating lots of Core::Ids due to temporary kits, etc. Change-Id: Id786e3412aadae7a594f6caf64d0dd364744d296 Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/kit.cpp | 13 ++++++++----- src/plugins/projectexplorer/kit.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp index ace5407d198..147a72bc183 100644 --- a/src/plugins/projectexplorer/kit.cpp +++ b/src/plugins/projectexplorer/kit.cpp @@ -78,11 +78,14 @@ namespace Internal { class KitPrivate { public: - KitPrivate() : - m_id(QUuid::createUuid().toString().toLatin1().constData()), + KitPrivate(Core::Id id) : + m_id(id), m_autodetected(false), m_isValid(true) - { } + { + if (!id.isValid()) + m_id = Core::Id(QUuid::createUuid().toString().toLatin1().constData()); + } QString m_displayName; Core::Id m_id; @@ -100,8 +103,8 @@ public: // Kit: // ------------------------------------------------------------------------- -Kit::Kit() : - d(new Internal::KitPrivate) +Kit::Kit(Core::Id id) : + d(new Internal::KitPrivate(id)) { KitManager *stm = KitManager::instance(); foreach (KitInformation *sti, stm->kitInformation()) diff --git a/src/plugins/projectexplorer/kit.h b/src/plugins/projectexplorer/kit.h index d275fb59137..c67fba42eb9 100644 --- a/src/plugins/projectexplorer/kit.h +++ b/src/plugins/projectexplorer/kit.h @@ -55,7 +55,7 @@ class KitPrivate; class PROJECTEXPLORER_EXPORT Kit { public: - Kit(); + Kit(Core::Id id = Core::Id()); ~Kit(); bool isValid() const;