aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2024-02-01 17:58:54 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2024-02-01 17:51:36 +0000
commit0bd3fafb0a24fa7f3b2ff210c497ad1587e6f1a1 (patch)
treef42dd134417e82cd70164d4dcda2aec099cc24ad /src/plugins/projectexplorer
parentd89bb4ef1e513d7fedd3bd05677e01840907c1f4 (diff)
CustomWizard: Replace QSharedPointer with std::shared_ptr
According to https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews QSharedPointer impl is poor and it's going to be removed from Qt 7. Change-Id: I7b7a715c1e2b8092ce7cb5f3686c3a3a02e0ad9e Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizard.cpp12
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizard.h5
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardpage.cpp10
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardpage.h15
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardparameters.h5
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp1
6 files changed, 22 insertions, 26 deletions
diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp
index c18926cbfc..c2ff5082bb 100644
--- a/src/plugins/projectexplorer/customwizard/customwizard.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp
@@ -78,8 +78,8 @@ class CustomWizardPrivate {
public:
CustomWizardPrivate() : m_context(new CustomWizardContext) {}
- QSharedPointer<CustomWizardParameters> m_parameters;
- QSharedPointer<CustomWizardContext> m_context;
+ std::shared_ptr<CustomWizardParameters> m_parameters;
+ std::shared_ptr<CustomWizardContext> m_context;
static int verbose;
};
@@ -140,7 +140,7 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p)
BaseFileWizard *CustomWizard::create(QWidget *parent, const WizardDialogParameters &p) const
{
- QTC_ASSERT(!d->m_parameters.isNull(), return nullptr);
+ QTC_ASSERT(d->m_parameters, return nullptr);
auto wizard = new BaseFileWizard(this, p.extraValues(), parent);
d->m_context->reset();
@@ -217,8 +217,8 @@ template <class WizardPage>
// Determine where to run the generator script. The user may specify
// an expression subject to field replacement, default is the target path.
-static inline QString scriptWorkingDirectory(const QSharedPointer<CustomWizardContext> &ctx,
- const QSharedPointer<CustomWizardParameters> &p)
+static inline QString scriptWorkingDirectory(const std::shared_ptr<CustomWizardContext> &ctx,
+ const std::shared_ptr<CustomWizardParameters> &p)
{
if (p->filesGeneratorScriptWorkingDirectory.isEmpty())
return ctx->targetPath.toString();
@@ -476,7 +476,7 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
const QList<QWizardPage *> &extensionPages) const
{
const CustomWizardParametersPtr pa = parameters();
- QTC_ASSERT(!pa.isNull(), return);
+ QTC_ASSERT(pa, return);
const CustomWizardContextPtr ctx = context();
ctx->reset();
diff --git a/src/plugins/projectexplorer/customwizard/customwizard.h b/src/plugins/projectexplorer/customwizard/customwizard.h
index c0a50a2fab..e1c1813f31 100644
--- a/src/plugins/projectexplorer/customwizard/customwizard.h
+++ b/src/plugins/projectexplorer/customwizard/customwizard.h
@@ -7,7 +7,6 @@
#include <coreplugin/basefilewizardfactory.h>
-#include <QSharedPointer>
#include <QList>
#include <QMap>
@@ -77,8 +76,8 @@ public:
static int verbose();
protected:
- using CustomWizardParametersPtr = QSharedPointer<Internal::CustomWizardParameters>;
- using CustomWizardContextPtr = QSharedPointer<Internal::CustomWizardContext>;
+ using CustomWizardParametersPtr = std::shared_ptr<Internal::CustomWizardParameters>;
+ using CustomWizardContextPtr = std::shared_ptr<Internal::CustomWizardContext>;
// generate files in path
Core::GeneratedFiles generateWizardFiles(QString *errorMessage) const;
diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
index 1337e2183f..a479627fa9 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardpage.cpp
@@ -63,8 +63,8 @@ CustomWizardFieldPage::PathChooserData::PathChooserData(PathChooser *pe, const Q
{
}
-CustomWizardFieldPage::CustomWizardFieldPage(const QSharedPointer<CustomWizardContext> &ctx,
- const QSharedPointer<CustomWizardParameters> &parameters,
+CustomWizardFieldPage::CustomWizardFieldPage(const std::shared_ptr<CustomWizardContext> &ctx,
+ const std::shared_ptr<CustomWizardParameters> &parameters,
QWidget *parent) :
QWizardPage(parent),
m_parameters(parameters),
@@ -376,7 +376,7 @@ bool CustomWizardFieldPage::validatePage()
}
QMap<QString, QString> CustomWizardFieldPage::replacementMap(const QWizard *w,
- const QSharedPointer<CustomWizardContext> &ctx,
+ const std::shared_ptr<CustomWizardContext> &ctx,
const FieldList &f)
{
QMap<QString, QString> fieldReplacementMap = ctx->baseReplacements;
@@ -402,8 +402,8 @@ QMap<QString, QString> CustomWizardFieldPage::replacementMap(const QWizard *w,
\sa ProjectExplorer::CustomWizard
*/
-CustomWizardPage::CustomWizardPage(const QSharedPointer<CustomWizardContext> &ctx,
- const QSharedPointer<CustomWizardParameters> &parameters,
+CustomWizardPage::CustomWizardPage(const std::shared_ptr<CustomWizardContext> &ctx,
+ const std::shared_ptr<CustomWizardParameters> &parameters,
QWidget *parent) :
CustomWizardFieldPage(ctx, parameters, parent),
m_pathChooser(new PathChooser)
diff --git a/src/plugins/projectexplorer/customwizard/customwizardpage.h b/src/plugins/projectexplorer/customwizard/customwizardpage.h
index 347fbf31c0..d4fa3947e8 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardpage.h
+++ b/src/plugins/projectexplorer/customwizard/customwizardpage.h
@@ -8,7 +8,6 @@
#include <QComboBox>
#include <QCheckBox>
#include <QWizardPage>
-#include <QSharedPointer>
QT_BEGIN_NAMESPACE
class QFormLayout;
@@ -32,8 +31,8 @@ class CustomWizardFieldPage : public QWizardPage {
public:
using FieldList = QList<CustomWizardField>;
- explicit CustomWizardFieldPage(const QSharedPointer<CustomWizardContext> &ctx,
- const QSharedPointer<CustomWizardParameters> &parameters,
+ explicit CustomWizardFieldPage(const std::shared_ptr<CustomWizardContext> &ctx,
+ const std::shared_ptr<CustomWizardParameters> &parameters,
QWidget *parent = nullptr);
bool validatePage() override;
@@ -41,7 +40,7 @@ public:
void cleanupPage() override;
static QMap<QString, QString> replacementMap(const QWizard *w,
- const QSharedPointer<CustomWizardContext> &ctx,
+ const std::shared_ptr<CustomWizardContext> &ctx,
const FieldList &f);
protected:
@@ -85,8 +84,8 @@ private:
const CustomWizardField &field);
void addField(const CustomWizardField &f);
- const QSharedPointer<CustomWizardParameters> m_parameters;
- const QSharedPointer<CustomWizardContext> m_context;
+ const std::shared_ptr<CustomWizardParameters> m_parameters;
+ const std::shared_ptr<CustomWizardContext> m_context;
QFormLayout *m_formLayout;
LineEditDataList m_lineEdits;
TextEditDataList m_textEdits;
@@ -100,8 +99,8 @@ class CustomWizardPage : public CustomWizardFieldPage
Q_OBJECT
public:
- explicit CustomWizardPage(const QSharedPointer<CustomWizardContext> &ctx,
- const QSharedPointer<CustomWizardParameters> &parameters,
+ explicit CustomWizardPage(const std::shared_ptr<CustomWizardContext> &ctx,
+ const std::shared_ptr<CustomWizardParameters> &parameters,
QWidget *parent = nullptr);
Utils::FilePath filePath() const;
diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.h b/src/plugins/projectexplorer/customwizard/customwizardparameters.h
index 8cc11ed903..28ae1862f5 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardparameters.h
+++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.h
@@ -7,9 +7,8 @@
#include <utils/filepath.h>
-#include <QStringList>
#include <QMap>
-#include <QSharedPointer>
+#include <QStringList>
QT_BEGIN_NAMESPACE
class QIODevice;
@@ -117,7 +116,7 @@ public:
class CustomWizardContext {
public:
using FieldReplacementMap = QMap<QString, QString>;
- using TemporaryFilePtr = QSharedPointer<Utils::TemporaryFile>;
+ using TemporaryFilePtr = std::shared_ptr<Utils::TemporaryFile>;
using TemporaryFilePtrList = QList<TemporaryFilePtr>;
void reset();
diff --git a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
index 7562abbe6e..fa1f455af4 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
@@ -13,7 +13,6 @@
#include <QFileInfo>
#include <QDebug>
-#include <QSharedPointer>
using namespace Utils;