Merge pull request #10302 from Chocobo1/uptr

Replace QScopedPointer with std::unqiue_ptr
This commit is contained in:
Mike Tzou
2019-03-02 12:26:14 +08:00
committed by GitHub
7 changed files with 18 additions and 16 deletions

View File

@@ -29,8 +29,6 @@
#include "profile.h"
#include <QCoreApplication>
#include "private/profile_p.h"
Profile *Profile::m_instance = nullptr;
@@ -50,14 +48,14 @@ Profile::~Profile() = default;
void Profile::initialize(const QString &rootProfilePath, const QString &configurationName,
bool convertPathsToProfileRelative)
{
QScopedPointer<Private::Profile> profile(rootProfilePath.isEmpty()
std::unique_ptr<Private::Profile> profile(rootProfilePath.isEmpty()
? static_cast<Private::Profile *>(new Private::DefaultProfile(configurationName))
: static_cast<Private::Profile *>(new Private::CustomProfile(rootProfilePath, configurationName)));
QScopedPointer<Private::PathConverter> converter(convertPathsToProfileRelative
std::unique_ptr<Private::PathConverter> converter(convertPathsToProfileRelative
? static_cast<Private::PathConverter *>(new Private::Converter(profile->baseDirectory()))
: static_cast<Private::PathConverter *>(new Private::NoConvertConverter()));
m_instance = new Profile(profile.take(), converter.take());
m_instance = new Profile(profile.release(), converter.release());
}
const Profile &Profile::instance()