forked from qt-creator/qt-creator
Vcs/Text search: Remove a few addAutoReleaseObject uses
Using a QObject parent suffices here. Change-Id: I4dc5448511d55bf14fbd8f810e91336a49e94094 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -293,7 +293,7 @@ bool GerritPlugin::initialize(ActionContainer *ac)
|
||||
connect(pushAction, &QAction::triggered, this, [this]() { push(); });
|
||||
ac->addAction(m_pushToGerritCommand);
|
||||
|
||||
GitPlugin::instance()->addAutoReleasedObject(new GerritOptionsPage(m_parameters));
|
||||
new GerritOptionsPage(m_parameters, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,8 @@ static bool isGitDirectory(const QString &path)
|
||||
return gitVc == VcsManager::findVersionControlForDirectory(path, 0);
|
||||
}
|
||||
|
||||
GitGrep::GitGrep()
|
||||
GitGrep::GitGrep(QObject *parent)
|
||||
: SearchEngine(parent)
|
||||
{
|
||||
m_widget = new QWidget;
|
||||
auto layout = new QHBoxLayout(m_widget);
|
||||
|
||||
@@ -39,7 +39,7 @@ class GitGrep : public TextEditor::SearchEngine
|
||||
Q_DECLARE_TR_FUNCTIONS(GitGrep)
|
||||
|
||||
public:
|
||||
GitGrep();
|
||||
explicit GitGrep(QObject *parent);
|
||||
~GitGrep() override;
|
||||
QString title() const override;
|
||||
QString toolTip() const override;
|
||||
|
||||
@@ -299,12 +299,11 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
auto vc = initializeVcs<GitVersionControl>(context, m_gitClient);
|
||||
|
||||
// Create the settings Page
|
||||
auto settingsPage = new SettingsPage(vc);
|
||||
addAutoReleasedObject(settingsPage);
|
||||
auto settingsPage = new SettingsPage(vc, this);
|
||||
connect(settingsPage, &SettingsPage::settingsChanged,
|
||||
this, &GitPlugin::updateRepositoryBrowserAction);
|
||||
|
||||
addAutoReleasedObject(new GitGrep);
|
||||
new GitGrep(this);
|
||||
|
||||
const auto describeFunc = [this](const QString &source, const QString &id) {
|
||||
m_gitClient->show(source, id);
|
||||
@@ -312,14 +311,13 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
const int editorCount = sizeof(editorParameters) / sizeof(editorParameters[0]);
|
||||
const auto widgetCreator = []() { return new GitEditorWidget; };
|
||||
for (int i = 0; i < editorCount; i++)
|
||||
addAutoReleasedObject(new VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc));
|
||||
new VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc, this);
|
||||
|
||||
addAutoReleasedObject(new VcsSubmitEditorFactory(&submitParameters,
|
||||
[]() { return new GitSubmitEditor(&submitParameters); }));
|
||||
new VcsSubmitEditorFactory(&submitParameters,
|
||||
[]() { return new GitSubmitEditor(&submitParameters); }, this);
|
||||
|
||||
const QString prefix = "git";
|
||||
m_commandLocator = new CommandLocator("Git", prefix, prefix);
|
||||
addAutoReleasedObject(m_commandLocator);
|
||||
m_commandLocator = new CommandLocator("Git", prefix, prefix, this);
|
||||
|
||||
//register actions
|
||||
ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS);
|
||||
|
||||
@@ -106,8 +106,8 @@ void SettingsPageWidget::updateNoteField()
|
||||
}
|
||||
|
||||
// -------- SettingsPage
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control) :
|
||||
VcsClientOptionsPage(control, GitPlugin::client())
|
||||
SettingsPage::SettingsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
VcsClientOptionsPage(control, GitPlugin::client(), parent)
|
||||
{
|
||||
setId(VcsBase::Constants::VCS_ID_GIT);
|
||||
setDisplayName(tr("Git"));
|
||||
|
||||
@@ -59,7 +59,7 @@ class SettingsPage : public VcsBase::VcsClientOptionsPage
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsPage(Core::IVersionControl *control);
|
||||
SettingsPage(Core::IVersionControl *control, QObject *parent);
|
||||
void apply() override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user