diff --git a/src/plugins/projectexplorer/profile.cpp b/src/plugins/projectexplorer/profile.cpp index a183e13d165..906235ea583 100644 --- a/src/plugins/projectexplorer/profile.cpp +++ b/src/plugins/projectexplorer/profile.cpp @@ -97,22 +97,24 @@ Profile::Profile() : setIconPath(QLatin1String(":///DESKTOP///")); } -Profile::Profile(const Profile &other) : - d(new Internal::ProfilePrivate) -{ - d->m_displayName = QCoreApplication::translate("ProjectExplorer::Profile", "Clone of %1").arg(other.d->m_displayName); - d->m_autodetected = false; - d->m_data = other.d->m_data; - d->m_isValid = other.d->m_isValid; - d->m_icon = other.d->m_icon; - d->m_iconPath = other.d->m_iconPath; -} - Profile::~Profile() { delete d; } +Profile *Profile::clone() const +{ + Profile *p = new Profile; + p->d->m_displayName = QCoreApplication::translate("ProjectExplorer::Profile", "Clone of %1") + .arg(d->m_displayName); + p->d->m_autodetected = false; + p->d->m_data = d->m_data; + p->d->m_isValid = d->m_isValid; + p->d->m_icon = d->m_icon; + p->d->m_iconPath = d->m_iconPath; + return p; +} + bool Profile::isValid() const { return d->m_id.isValid() && d->m_isValid; diff --git a/src/plugins/projectexplorer/profile.h b/src/plugins/projectexplorer/profile.h index 775100f5228..30ba98c1aa7 100644 --- a/src/plugins/projectexplorer/profile.h +++ b/src/plugins/projectexplorer/profile.h @@ -59,7 +59,6 @@ class PROJECTEXPLORER_EXPORT Profile { public: Profile(); - Profile(const Profile &other); ~Profile(); bool isValid() const; @@ -85,8 +84,13 @@ public: void addToEnvironment(Utils::Environment &env) const; QString toHtml(); + Profile *clone() const; private: + // Unimplemented. + Profile(const Profile &other); + void operator=(const Profile &other); + void setAutoDetected(bool detected); void setId(const Core::Id &id); void setValid(bool valid); diff --git a/src/plugins/projectexplorer/profileoptionspage.cpp b/src/plugins/projectexplorer/profileoptionspage.cpp index 7cc7d80a894..1aacee57854 100644 --- a/src/plugins/projectexplorer/profileoptionspage.cpp +++ b/src/plugins/projectexplorer/profileoptionspage.cpp @@ -189,11 +189,11 @@ void ProfileOptionsPage::addNewProfile() void ProfileOptionsPage::cloneProfile() { - Profile *clone = m_model->profile(currentIndex()); - if (!clone) + Profile *current = m_model->profile(currentIndex()); + if (!current) return; - Profile *p = new Profile(*clone); + Profile *p = current->clone(); m_model->markForAddition(p);