forked from qt-creator/qt-creator
ProjectExplorer: Modernize even more
Use unique_ptr for all *Private classes, except for those in singletons. Change-Id: Ib56c31ddedc6e9cf321f15de1f1e697a27ad4089 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -75,7 +75,7 @@ public:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
|
||||
d(new Internal::AbiWidgetPrivate)
|
||||
d(std::make_unique<Internal::AbiWidgetPrivate>())
|
||||
{
|
||||
auto *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
@@ -152,10 +152,7 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
|
||||
setAbis(QList<Abi>(), Abi::hostAbi());
|
||||
}
|
||||
|
||||
AbiWidget::~AbiWidget()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
AbiWidget::~AbiWidget() = default;
|
||||
|
||||
static Abi selectAbi(const Abi ¤t, const QList<Abi> &abiList)
|
||||
{
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Abi;
|
||||
|
||||
@@ -64,7 +66,7 @@ private:
|
||||
|
||||
void emitAbiChanged(const Abi ¤t);
|
||||
|
||||
Internal::AbiWidgetPrivate *const d;
|
||||
const std::unique_ptr<Internal::AbiWidgetPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -165,14 +165,10 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *pare
|
||||
}
|
||||
|
||||
ApplicationLauncher::ApplicationLauncher(QObject *parent) : QObject(parent),
|
||||
d(new ApplicationLauncherPrivate(this))
|
||||
{
|
||||
}
|
||||
d(std::make_unique<ApplicationLauncherPrivate>(this))
|
||||
{ }
|
||||
|
||||
ApplicationLauncher::~ApplicationLauncher()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
ApplicationLauncher::~ApplicationLauncher() = default;
|
||||
|
||||
void ApplicationLauncher::setProcessChannelMode(QProcess::ProcessChannelMode mode)
|
||||
{
|
||||
|
@@ -34,6 +34,8 @@
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Utils { class ProcessHandle; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -79,7 +81,7 @@ signals:
|
||||
void finished(bool success);
|
||||
|
||||
private:
|
||||
Internal::ApplicationLauncherPrivate *d;
|
||||
std::unique_ptr<Internal::ApplicationLauncherPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -64,7 +64,7 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFacto
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||
d(new BaseProjectWizardDialogPrivate(new Utils::ProjectIntroPage))
|
||||
d(std::make_unique<BaseProjectWizardDialogPrivate>(new Utils::ProjectIntroPage))
|
||||
{
|
||||
setPath(parameters.defaultPath());
|
||||
setSelectedPlatform(parameters.selectedPlatform());
|
||||
@@ -77,7 +77,7 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFacto
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||
d(new BaseProjectWizardDialogPrivate(introPage, introId))
|
||||
d(std::make_unique<BaseProjectWizardDialogPrivate>(introPage, introId))
|
||||
{
|
||||
setPath(parameters.defaultPath());
|
||||
setSelectedPlatform(parameters.selectedPlatform());
|
||||
@@ -96,10 +96,7 @@ void BaseProjectWizardDialog::init()
|
||||
connect(this, &QDialog::accepted, this, &BaseProjectWizardDialog::slotAccepted);
|
||||
}
|
||||
|
||||
BaseProjectWizardDialog::~BaseProjectWizardDialog()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
BaseProjectWizardDialog::~BaseProjectWizardDialog() = default;
|
||||
|
||||
QString BaseProjectWizardDialog::projectName() const
|
||||
{
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <coreplugin/basefilewizard.h>
|
||||
#include <coreplugin/basefilewizardfactory.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Utils { class ProjectIntroPage; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -82,7 +84,7 @@ private:
|
||||
void slotAccepted();
|
||||
bool validateCurrentPage() override;
|
||||
|
||||
BaseProjectWizardDialogPrivate *d;
|
||||
std::unique_ptr<BaseProjectWizardDialogPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -103,6 +103,7 @@ static BuildManager *m_instance = nullptr;
|
||||
BuildManager::BuildManager(QObject *parent, QAction *cancelBuildAction)
|
||||
: QObject(parent)
|
||||
{
|
||||
QTC_CHECK(!m_instance);
|
||||
m_instance = this;
|
||||
d = new BuildManagerPrivate;
|
||||
|
||||
@@ -166,6 +167,7 @@ BuildManager::~BuildManager()
|
||||
delete d->m_outputWindow;
|
||||
|
||||
delete d;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
void BuildManager::aboutToRemoveProject(Project *p)
|
||||
|
@@ -45,7 +45,7 @@ public:
|
||||
using namespace Internal;
|
||||
|
||||
DeploymentDataView::DeploymentDataView(Target *target, QWidget *parent) : NamedWidget(parent),
|
||||
d(new DeploymentDataViewPrivate)
|
||||
d(std::make_unique<DeploymentDataViewPrivate>())
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle);
|
||||
@@ -60,10 +60,7 @@ DeploymentDataView::DeploymentDataView(Target *target, QWidget *parent) : NamedW
|
||||
updateDeploymentDataModel();
|
||||
}
|
||||
|
||||
DeploymentDataView::~DeploymentDataView()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
DeploymentDataView::~DeploymentDataView() = default;
|
||||
|
||||
void DeploymentDataView::updateDeploymentDataModel()
|
||||
{
|
||||
|
@@ -28,6 +28,8 @@
|
||||
#include "namedwidget.h"
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Target;
|
||||
|
||||
@@ -44,7 +46,7 @@ public:
|
||||
private:
|
||||
void updateDeploymentDataModel();
|
||||
|
||||
Internal::DeploymentDataViewPrivate * const d;
|
||||
const std::unique_ptr<Internal::DeploymentDataViewPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include <QVariantList>
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
@@ -348,7 +349,7 @@ const IDeviceFactory *DeviceManager::restoreFactory(const QVariantMap &map)
|
||||
return factory;
|
||||
}
|
||||
|
||||
DeviceManager::DeviceManager(bool isInstance) : d(new DeviceManagerPrivate)
|
||||
DeviceManager::DeviceManager(bool isInstance) : d(std::make_unique<DeviceManagerPrivate>())
|
||||
{
|
||||
if (isInstance) {
|
||||
QTC_ASSERT(!m_instance, return);
|
||||
@@ -370,7 +371,6 @@ DeviceManager::~DeviceManager()
|
||||
delete d->writer;
|
||||
if (m_instance == this)
|
||||
m_instance = nullptr;
|
||||
delete d;
|
||||
}
|
||||
|
||||
IDevice::ConstPtr DeviceManager::deviceAt(int idx) const
|
||||
|
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace QSsh { class SshHostKeyDatabase; }
|
||||
namespace Utils { class FileName; }
|
||||
|
||||
@@ -101,7 +103,7 @@ private:
|
||||
static Utils::FileName systemSettingsFilePath(const QString &deviceFileRelativePath);
|
||||
static void copy(const DeviceManager *source, DeviceManager *target, bool deep);
|
||||
|
||||
Internal::DeviceManagerPrivate * const d;
|
||||
const std::unique_ptr<Internal::DeviceManagerPrivate> d;
|
||||
|
||||
static DeviceManager *m_instance;
|
||||
|
||||
|
@@ -44,7 +44,7 @@ public:
|
||||
} // namespace Internal
|
||||
|
||||
DeviceManagerModel::DeviceManagerModel(const DeviceManager *deviceManager, QObject *parent) :
|
||||
QAbstractListModel(parent), d(new Internal::DeviceManagerModelPrivate)
|
||||
QAbstractListModel(parent), d(std::make_unique<Internal::DeviceManagerModelPrivate>())
|
||||
{
|
||||
d->deviceManager = deviceManager;
|
||||
handleDeviceListChanged();
|
||||
@@ -58,10 +58,7 @@ DeviceManagerModel::DeviceManagerModel(const DeviceManager *deviceManager, QObje
|
||||
this, &DeviceManagerModel::handleDeviceListChanged);
|
||||
}
|
||||
|
||||
DeviceManagerModel::~DeviceManagerModel()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
DeviceManagerModel::~DeviceManagerModel() = default;
|
||||
|
||||
void DeviceManagerModel::setFilter(const QList<Core::Id> &filter)
|
||||
{
|
||||
|
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal { class DeviceManagerModelPrivate; }
|
||||
class IDevice;
|
||||
@@ -62,7 +64,7 @@ private:
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool matchesTypeFilter(const IDevice::ConstPtr &dev) const;
|
||||
|
||||
Internal::DeviceManagerModelPrivate * const d;
|
||||
const std::unique_ptr<Internal::DeviceManagerModelPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -316,19 +316,14 @@ DeviceProcessItem DeviceProcessesDialogPrivate::selectedProcess() const
|
||||
*/
|
||||
|
||||
DeviceProcessesDialog::DeviceProcessesDialog(QWidget *parent)
|
||||
: QDialog(parent), d(new Internal::DeviceProcessesDialogPrivate(new KitChooser(this), this))
|
||||
{
|
||||
}
|
||||
: QDialog(parent), d(std::make_unique<Internal::DeviceProcessesDialogPrivate>(new KitChooser(this), this))
|
||||
{ }
|
||||
|
||||
DeviceProcessesDialog::DeviceProcessesDialog(KitChooser *chooser, QWidget *parent)
|
||||
: QDialog(parent), d(new Internal::DeviceProcessesDialogPrivate(chooser, this))
|
||||
{
|
||||
}
|
||||
: QDialog(parent), d(std::make_unique<Internal::DeviceProcessesDialogPrivate>(chooser, this))
|
||||
{ }
|
||||
|
||||
DeviceProcessesDialog::~DeviceProcessesDialog()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
DeviceProcessesDialog::~DeviceProcessesDialog() = default;
|
||||
|
||||
void DeviceProcessesDialog::addAcceptButton(const QString &label)
|
||||
{
|
||||
|
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class DeviceProcessItem;
|
||||
@@ -58,7 +60,7 @@ public:
|
||||
private:
|
||||
void setKitVisible(bool);
|
||||
|
||||
Internal::DeviceProcessesDialogPrivate * const d;
|
||||
const std::unique_ptr<Internal::DeviceProcessesDialogPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -51,14 +51,10 @@ public:
|
||||
using namespace Internal;
|
||||
|
||||
DeviceProcessList::DeviceProcessList(const IDevice::ConstPtr &device, QObject *parent)
|
||||
: QAbstractItemModel(parent), d(new DeviceProcessListPrivate(device))
|
||||
{
|
||||
}
|
||||
: QAbstractItemModel(parent), d(std::make_unique<DeviceProcessListPrivate>(device))
|
||||
{ }
|
||||
|
||||
DeviceProcessList::~DeviceProcessList()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
DeviceProcessList::~DeviceProcessList() = default;
|
||||
|
||||
QModelIndex DeviceProcessList::parent(const QModelIndex &) const
|
||||
{
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QList>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
namespace Internal { class DeviceProcessListPrivate; }
|
||||
@@ -86,7 +88,7 @@ private:
|
||||
|
||||
void setFinished();
|
||||
|
||||
Internal::DeviceProcessListPrivate * const d;
|
||||
const std::unique_ptr<Internal::DeviceProcessListPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -50,7 +50,8 @@ public:
|
||||
|
||||
DeviceTestDialog::DeviceTestDialog(const IDevice::ConstPtr &deviceConfiguration,
|
||||
QWidget *parent)
|
||||
: QDialog(parent), d(new DeviceTestDialogPrivate(deviceConfiguration->createDeviceTester()))
|
||||
: QDialog(parent)
|
||||
, d(std::make_unique<DeviceTestDialogPrivate>(deviceConfiguration->createDeviceTester()))
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
|
||||
@@ -64,10 +65,7 @@ DeviceTestDialog::DeviceTestDialog(const IDevice::ConstPtr &deviceConfiguration,
|
||||
d->deviceTester->testDevice(deviceConfiguration);
|
||||
}
|
||||
|
||||
DeviceTestDialog::~DeviceTestDialog()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
DeviceTestDialog::~DeviceTestDialog() = default;
|
||||
|
||||
void DeviceTestDialog::reject()
|
||||
{
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
@@ -37,7 +39,7 @@ class DeviceTestDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceTestDialog(const IDevice::ConstPtr &deviceConfiguration, QWidget *parent = 0);
|
||||
DeviceTestDialog(const IDevice::ConstPtr &deviceConfiguration, QWidget *parent = nullptr);
|
||||
~DeviceTestDialog() override;
|
||||
|
||||
void reject() override;
|
||||
@@ -50,7 +52,7 @@ private:
|
||||
void addText(const QString &text, const QString &color, bool bold);
|
||||
|
||||
class DeviceTestDialogPrivate;
|
||||
DeviceTestDialogPrivate * const d;
|
||||
const std::unique_ptr<DeviceTestDialogPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -165,7 +165,7 @@ IDevice::IDevice() : d(new Internal::IDevicePrivate)
|
||||
}
|
||||
|
||||
IDevice::IDevice(Core::Id type, Origin origin, MachineType machineType, Core::Id id)
|
||||
: d(new Internal::IDevicePrivate)
|
||||
: d(std::make_unique<Internal::IDevicePrivate>())
|
||||
{
|
||||
d->type = type;
|
||||
d->origin = origin;
|
||||
@@ -177,15 +177,12 @@ IDevice::IDevice(Core::Id type, Origin origin, MachineType machineType, Core::Id
|
||||
|
||||
IDevice::IDevice(const IDevice &other)
|
||||
: QEnableSharedFromThis<IDevice>(other)
|
||||
, d(new Internal::IDevicePrivate)
|
||||
, d(std::make_unique<Internal::IDevicePrivate>())
|
||||
{
|
||||
*d = *other.d;
|
||||
}
|
||||
|
||||
IDevice::~IDevice()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
IDevice::~IDevice() = default;
|
||||
|
||||
/*!
|
||||
Specifies a free-text name for the device to be displayed in GUI elements.
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#include <QVariantMap>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QWidget;
|
||||
@@ -214,7 +215,7 @@ private:
|
||||
|
||||
int version() const;
|
||||
|
||||
Internal::IDevicePrivate *d;
|
||||
const std::unique_ptr<Internal::IDevicePrivate> d;
|
||||
friend class DeviceManager;
|
||||
};
|
||||
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
};
|
||||
|
||||
SshDeviceProcess::SshDeviceProcess(const IDevice::ConstPtr &device, QObject *parent)
|
||||
: DeviceProcess(device, parent), d(new SshDeviceProcessPrivate(this))
|
||||
: DeviceProcess(device, parent), d(std::make_unique<SshDeviceProcessPrivate>(this))
|
||||
{
|
||||
connect(&d->killTimer, &QTimer::timeout, this, &SshDeviceProcess::handleKillOperationTimeout);
|
||||
}
|
||||
@@ -71,7 +71,6 @@ SshDeviceProcess::SshDeviceProcess(const IDevice::ConstPtr &device, QObject *par
|
||||
SshDeviceProcess::~SshDeviceProcess()
|
||||
{
|
||||
d->setState(SshDeviceProcessPrivate::Inactive);
|
||||
delete d;
|
||||
}
|
||||
|
||||
void SshDeviceProcess::start(const Runnable &runnable)
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "deviceprocess.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Runnable;
|
||||
@@ -72,7 +74,7 @@ private:
|
||||
|
||||
class SshDeviceProcessPrivate;
|
||||
friend class SshDeviceProcessPrivate;
|
||||
SshDeviceProcessPrivate * const d;
|
||||
const std::unique_ptr<SshDeviceProcessPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -42,14 +42,11 @@ public:
|
||||
};
|
||||
|
||||
SshDeviceProcessList::SshDeviceProcessList(const IDevice::ConstPtr &device, QObject *parent) :
|
||||
DeviceProcessList(device, parent), d(new SshDeviceProcessListPrivate)
|
||||
DeviceProcessList(device, parent), d(std::make_unique<SshDeviceProcessListPrivate>())
|
||||
{
|
||||
}
|
||||
|
||||
SshDeviceProcessList::~SshDeviceProcessList()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
SshDeviceProcessList::~SshDeviceProcessList() = default;
|
||||
|
||||
void SshDeviceProcessList::doUpdate()
|
||||
{
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "deviceprocesslist.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT SshDeviceProcessList : public DeviceProcessList
|
||||
@@ -51,7 +53,7 @@ private:
|
||||
void setFinished();
|
||||
|
||||
class SshDeviceProcessListPrivate;
|
||||
SshDeviceProcessListPrivate * const d;
|
||||
const std::unique_ptr<SshDeviceProcessListPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -83,7 +83,7 @@ struct EditorConfigurationPrivate
|
||||
QList<BaseTextEditor *> m_editors;
|
||||
};
|
||||
|
||||
EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate)
|
||||
EditorConfiguration::EditorConfiguration() : d(std::make_unique<EditorConfigurationPrivate>())
|
||||
{
|
||||
const QMap<Core::Id, ICodeStylePreferences *> languageCodeStylePreferences = TextEditorSettings::codeStyles();
|
||||
QMapIterator<Core::Id, ICodeStylePreferences *> itCodeStyle(languageCodeStylePreferences);
|
||||
@@ -119,7 +119,6 @@ EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate)
|
||||
EditorConfiguration::~EditorConfiguration()
|
||||
{
|
||||
qDeleteAll(d->m_languageCodeStylePreferences);
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool EditorConfiguration::useGlobalSettings() const
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class Id;
|
||||
@@ -107,7 +109,7 @@ signals:
|
||||
private:
|
||||
void switchSettings(TextEditor::TextEditorWidget *baseTextEditor) const;
|
||||
|
||||
EditorConfigurationPrivate *d;
|
||||
const std::unique_ptr<EditorConfigurationPrivate> d;
|
||||
};
|
||||
|
||||
// Return the editor settings in the case it's not null. Otherwise, try to find the project
|
||||
|
@@ -132,7 +132,7 @@ public:
|
||||
};
|
||||
|
||||
EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget)
|
||||
: QWidget(parent), d(new EnvironmentWidgetPrivate)
|
||||
: QWidget(parent), d(std::make_unique<EnvironmentWidgetPrivate>())
|
||||
{
|
||||
d->m_model = new Utils::EnvironmentModel();
|
||||
connect(d->m_model, &Utils::EnvironmentModel::userChangesChanged,
|
||||
@@ -235,7 +235,6 @@ EnvironmentWidget::~EnvironmentWidget()
|
||||
{
|
||||
delete d->m_model;
|
||||
d->m_model = nullptr;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void EnvironmentWidget::focusIndex(const QModelIndex &index)
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QModelIndex)
|
||||
|
||||
namespace Utils {
|
||||
@@ -71,7 +73,7 @@ private:
|
||||
void updateButtons();
|
||||
void linkActivated(const QString &link);
|
||||
|
||||
EnvironmentWidgetPrivate *d;
|
||||
const std::unique_ptr<EnvironmentWidgetPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
ExtraCompiler::ExtraCompiler(const Project *project, const Utils::FileName &source,
|
||||
const Utils::FileNameList &targets, QObject *parent) :
|
||||
QObject(parent), d(new ExtraCompilerPrivate)
|
||||
QObject(parent), d(std::make_unique<ExtraCompilerPrivate>())
|
||||
{
|
||||
d->project = project;
|
||||
d->source = source;
|
||||
@@ -129,10 +129,7 @@ ExtraCompiler::ExtraCompiler(const Project *project, const Utils::FileName &sour
|
||||
}
|
||||
}
|
||||
|
||||
ExtraCompiler::~ExtraCompiler()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
ExtraCompiler::~ExtraCompiler() = default;
|
||||
|
||||
const Project *ExtraCompiler::project() const
|
||||
{
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <QList>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QProcess);
|
||||
QT_FORWARD_DECLARE_CLASS(QThreadPool);
|
||||
@@ -89,7 +90,7 @@ private:
|
||||
virtual void run(const QByteArray &sourceContent) = 0;
|
||||
virtual void run(const Utils::FileName &file) = 0;
|
||||
|
||||
ExtraCompilerPrivate *const d;
|
||||
const std::unique_ptr<ExtraCompilerPrivate> d;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ProcessExtraCompiler : public ExtraCompiler
|
||||
|
@@ -139,14 +139,13 @@ private:
|
||||
// JsonFieldPage::FieldData:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
JsonFieldPage::Field::Field() : d(new FieldPrivate)
|
||||
JsonFieldPage::Field::Field() : d(std::make_unique<FieldPrivate>())
|
||||
{ }
|
||||
|
||||
JsonFieldPage::Field::~Field()
|
||||
{
|
||||
delete d->m_widget;
|
||||
delete d->m_label;
|
||||
delete d;
|
||||
}
|
||||
|
||||
QString JsonFieldPage::Field::type()
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#include <QRegularExpression>
|
||||
#include <QVariant>
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QFormLayout;
|
||||
class QLabel;
|
||||
@@ -105,7 +107,7 @@ public:
|
||||
|
||||
friend class JsonFieldPage;
|
||||
|
||||
FieldPrivate *const d;
|
||||
const std::unique_ptr<FieldPrivate> d;
|
||||
};
|
||||
|
||||
JsonFieldPage(Utils::MacroExpander *expander, QWidget *parent = 0);
|
||||
|
@@ -132,14 +132,14 @@ public:
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Kit::Kit(Id id) :
|
||||
d(new Internal::KitPrivate(id, this))
|
||||
d(std::make_unique<Internal::KitPrivate>(id, this))
|
||||
{
|
||||
foreach (KitInformation *sti, KitManager::kitInformation())
|
||||
d->m_data.insert(sti->id(), sti->defaultValue(this));
|
||||
}
|
||||
|
||||
Kit::Kit(const QVariantMap &data) :
|
||||
d(new Internal::KitPrivate(Id(), this))
|
||||
d(std::make_unique<Internal::KitPrivate>(Id(), this))
|
||||
{
|
||||
d->m_id = Id::fromSetting(data.value(QLatin1String(ID_KEY)));
|
||||
|
||||
@@ -174,10 +174,7 @@ Kit::Kit(const QVariantMap &data) :
|
||||
d->m_sticky.insert(Id::fromString(stickyInfo));
|
||||
}
|
||||
|
||||
Kit::~Kit()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
Kit::~Kit() = default;
|
||||
|
||||
void Kit::blockNotification()
|
||||
{
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#include <QSet>
|
||||
#include <QVariant>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Utils {
|
||||
class Environment;
|
||||
class MacroExpander;
|
||||
@@ -139,7 +141,7 @@ private:
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
Internal::KitPrivate *const d;
|
||||
const std::unique_ptr<Internal::KitPrivate> d;
|
||||
|
||||
friend class KitInformation;
|
||||
friend class KitManager;
|
||||
|
@@ -526,6 +526,8 @@ ProjectExplorerPlugin::~ProjectExplorerPlugin()
|
||||
delete dd->m_toolChainManager;
|
||||
ProjectPanelFactory::destroyFactories();
|
||||
delete dd;
|
||||
dd = nullptr;
|
||||
m_instance = nullptr;
|
||||
|
||||
RunWorkerFactory::destroyRemainingRunWorkerFactories();
|
||||
}
|
||||
|
@@ -606,7 +606,7 @@ public:
|
||||
//
|
||||
|
||||
ProjectWindow::ProjectWindow()
|
||||
: d(new ProjectWindowPrivate(this))
|
||||
: d(std::make_unique<ProjectWindowPrivate>(this))
|
||||
{
|
||||
setBackgroundRole(QPalette::Base);
|
||||
|
||||
@@ -615,10 +615,7 @@ ProjectWindow::ProjectWindow()
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
}
|
||||
|
||||
ProjectWindow::~ProjectWindow()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
ProjectWindow::~ProjectWindow() = default;
|
||||
|
||||
QSize SelectorDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <utils/fancymainwindow.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
@@ -59,7 +61,7 @@ public:
|
||||
~ProjectWindow() override;
|
||||
|
||||
private:
|
||||
ProjectWindowPrivate *d;
|
||||
const std::unique_ptr<ProjectWindowPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -949,7 +949,7 @@ public:
|
||||
using namespace Internal;
|
||||
|
||||
RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) :
|
||||
d(new RunControlPrivate(this, runConfiguration, mode))
|
||||
d(std::make_unique<RunControlPrivate>(this, runConfiguration, mode))
|
||||
{
|
||||
#ifdef WITH_JOURNALD
|
||||
JournaldWatcher::instance()->subscribe(this, [this](const JournaldWatcher::LogEntry &entry) {
|
||||
@@ -981,8 +981,6 @@ RunControl::~RunControl()
|
||||
#ifdef WITH_JOURNALD
|
||||
JournaldWatcher::instance()->unsubscribe(this);
|
||||
#endif
|
||||
delete d;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
void RunControl::initiateStart()
|
||||
@@ -1009,7 +1007,7 @@ void RunControl::forceStop()
|
||||
|
||||
void RunControl::initiateFinish()
|
||||
{
|
||||
QTimer::singleShot(0, d, &RunControlPrivate::initiateFinish);
|
||||
QTimer::singleShot(0, d.get(), &RunControlPrivate::initiateFinish);
|
||||
}
|
||||
|
||||
using WorkerCreators = QHash<Core::Id, RunControl::WorkerCreator>;
|
||||
@@ -1878,14 +1876,10 @@ void RunWorkerPrivate::timerEvent(QTimerEvent *ev)
|
||||
*/
|
||||
|
||||
RunWorker::RunWorker(RunControl *runControl)
|
||||
: d(new RunWorkerPrivate(this, runControl))
|
||||
{
|
||||
}
|
||||
: d(std::make_unique<RunWorkerPrivate>(this, runControl))
|
||||
{ }
|
||||
|
||||
RunWorker::~RunWorker()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
RunWorker::~RunWorker() = default;
|
||||
|
||||
/*!
|
||||
* This function is called by the RunControl once all dependencies
|
||||
|
@@ -417,7 +417,7 @@ protected:
|
||||
private:
|
||||
friend class Internal::RunControlPrivate;
|
||||
friend class Internal::RunWorkerPrivate;
|
||||
Internal::RunWorkerPrivate *d;
|
||||
const std::unique_ptr<Internal::RunWorkerPrivate> d;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT RunWorkerFactory
|
||||
@@ -551,7 +551,7 @@ private:
|
||||
friend class RunWorker;
|
||||
friend class Internal::RunWorkerPrivate;
|
||||
|
||||
Internal::RunControlPrivate *d;
|
||||
const std::unique_ptr<Internal::RunControlPrivate> d;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -153,6 +153,7 @@ SessionManager::~SessionManager()
|
||||
emit m_instance->aboutToUnloadSession(d->m_sessionName);
|
||||
delete d->m_writer;
|
||||
delete d;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
SessionManager *SessionManager::instance()
|
||||
|
@@ -110,7 +110,7 @@ TargetPrivate::TargetPrivate(Kit *k) :
|
||||
|
||||
Target::Target(Project *project, Kit *k, _constructor_tag) :
|
||||
ProjectConfiguration(project, k->id()),
|
||||
d(new TargetPrivate(k))
|
||||
d(std::make_unique<TargetPrivate>(k))
|
||||
{
|
||||
QTC_CHECK(d->m_kit);
|
||||
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
||||
@@ -144,7 +144,6 @@ Target::~Target()
|
||||
qDeleteAll(d->m_buildConfigurations);
|
||||
qDeleteAll(d->m_deployConfigurations);
|
||||
qDeleteAll(d->m_runConfigurations);
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Target::handleKitUpdates(Kit *k)
|
||||
|
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "subscription.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QIcon)
|
||||
|
||||
namespace Utils { class Environment; }
|
||||
@@ -180,7 +182,7 @@ private:
|
||||
|
||||
void setActiveBuildConfiguration(BuildConfiguration *configuration);
|
||||
void setActiveDeployConfiguration(DeployConfiguration *configuration);
|
||||
TargetPrivate *d;
|
||||
const std::unique_ptr<TargetPrivate> d;
|
||||
|
||||
friend class Project;
|
||||
};
|
||||
|
@@ -690,22 +690,19 @@ public:
|
||||
};
|
||||
|
||||
TargetGroupItem::TargetGroupItem(const QString &displayName, Project *project)
|
||||
: d(new TargetGroupItemPrivate(this, project))
|
||||
: d(std::make_unique<TargetGroupItemPrivate>(this, project))
|
||||
{
|
||||
d->m_displayName = displayName;
|
||||
QObject::connect(project, &Project::addedTarget,
|
||||
d, &TargetGroupItemPrivate::handleTargetAdded,
|
||||
d.get(), &TargetGroupItemPrivate::handleTargetAdded,
|
||||
Qt::QueuedConnection);
|
||||
QObject::connect(project, &Project::removedTarget,
|
||||
d, &TargetGroupItemPrivate::handleTargetRemoved);
|
||||
d.get(), &TargetGroupItemPrivate::handleTargetRemoved);
|
||||
QObject::connect(project, &Project::activeTargetChanged,
|
||||
d, &TargetGroupItemPrivate::handleTargetChanged, Qt::QueuedConnection);
|
||||
d.get(), &TargetGroupItemPrivate::handleTargetChanged, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
TargetGroupItem::~TargetGroupItem()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
TargetGroupItem::~TargetGroupItem() = default;
|
||||
|
||||
TargetGroupItemPrivate::TargetGroupItemPrivate(TargetGroupItem *q, Project *project)
|
||||
: q(q), m_project(project)
|
||||
|
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Target;
|
||||
@@ -57,7 +59,7 @@ public:
|
||||
TargetItem *targetItem(Target *target) const;
|
||||
|
||||
private:
|
||||
TargetGroupItemPrivate *d;
|
||||
const std::unique_ptr<TargetGroupItemPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -242,7 +242,7 @@ static QToolButton *createFilterButton(const QIcon &icon, const QString &toolTip
|
||||
return button;
|
||||
}
|
||||
|
||||
TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
|
||||
TaskWindow::TaskWindow() : d(std::make_unique<TaskWindowPrivate>())
|
||||
{
|
||||
d->m_model = new Internal::TaskModel(this);
|
||||
d->m_filter = new Internal::TaskFilterModel(d->m_model);
|
||||
@@ -321,7 +321,6 @@ TaskWindow::~TaskWindow()
|
||||
delete d->m_listview;
|
||||
delete d->m_filter;
|
||||
delete d->m_model;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void TaskWindow::delayedInitialization()
|
||||
|
@@ -28,6 +28,8 @@
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/ioutputpane.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QModelIndex;
|
||||
@@ -100,7 +102,7 @@ private:
|
||||
|
||||
int sizeHintForColumn(int column) const;
|
||||
|
||||
TaskWindowPrivate *d;
|
||||
const std::unique_ptr<TaskWindowPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -117,12 +117,11 @@ QString languageId(Language l)
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
ToolChain::ToolChain(Core::Id typeId, Detection d) :
|
||||
d(new Internal::ToolChainPrivate(typeId, d))
|
||||
d(std::make_unique<Internal::ToolChainPrivate>(typeId, d))
|
||||
{
|
||||
}
|
||||
|
||||
ToolChain::ToolChain(const ToolChain &other) :
|
||||
d(new Internal::ToolChainPrivate(other.d->m_typeId, ManualDetection))
|
||||
ToolChain::ToolChain(const ToolChain &other) : ToolChain(other.d->m_typeId, ManualDetection)
|
||||
{
|
||||
d->m_language = other.d->m_language;
|
||||
|
||||
@@ -140,10 +139,7 @@ void ToolChain::setLanguage(Core::Id language)
|
||||
d->m_language = language;
|
||||
}
|
||||
|
||||
ToolChain::~ToolChain()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
ToolChain::~ToolChain() = default;
|
||||
|
||||
QString ToolChain::displayName() const
|
||||
{
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <QVariantMap>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace Utils { class Environment; }
|
||||
|
||||
@@ -168,7 +169,7 @@ protected:
|
||||
private:
|
||||
void setDetection(Detection d);
|
||||
|
||||
Internal::ToolChainPrivate *const d;
|
||||
const std::unique_ptr<Internal::ToolChainPrivate> d;
|
||||
|
||||
friend class Internal::ToolChainSettingsAccessor;
|
||||
friend class ToolChainFactory;
|
||||
|
@@ -76,7 +76,7 @@ ToolChainManagerPrivate::~ToolChainManagerPrivate()
|
||||
}
|
||||
|
||||
static ToolChainManager *m_instance = nullptr;
|
||||
static ToolChainManagerPrivate *d;
|
||||
static ToolChainManagerPrivate *d = nullptr;
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -103,8 +103,9 @@ ToolChainManager::ToolChainManager(QObject *parent) :
|
||||
|
||||
ToolChainManager::~ToolChainManager()
|
||||
{
|
||||
delete d;
|
||||
m_instance = nullptr;
|
||||
delete d;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
ToolChainManager *ToolChainManager::instance()
|
||||
|
Reference in New Issue
Block a user