From 03c9b935de0885656ca23cb448187db0fbeda453 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 22 Jan 2015 13:52:48 +0100 Subject: [PATCH] Git: Sprinkle with auto Change-Id: I13886e17ee49702a69450e0f0b7d161cdfed1385 Reviewed-by: Orgad Shaneh --- src/plugins/git/branchmodel.cpp | 4 ++-- src/plugins/git/changeselectiondialog.cpp | 2 +- src/plugins/git/clonewizard.cpp | 4 ++-- src/plugins/git/clonewizardpage.cpp | 4 ++-- src/plugins/git/gitclient.cpp | 15 +++++++-------- src/plugins/git/gitplugin.cpp | 2 +- src/plugins/git/gitsubmiteditorwidget.cpp | 6 +++--- src/plugins/git/logchangedialog.cpp | 6 +++--- src/plugins/git/stashdialog.cpp | 6 +++--- 9 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index ce461ade759..dd7ffbfb48c 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -614,7 +614,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel local = child; } int pos = positionForName(local, leafName); - BranchNode *newNode = new BranchNode(leafName, startSha, track ? trackedBranch : QString()); + auto newNode = new BranchNode(leafName, startSha, track ? trackedBranch : QString()); if (!added) beginInsertRows(nodeToIndex(local), pos, pos); newNode->parent = local; @@ -677,7 +677,7 @@ void BranchModel::parseOutputLine(const QString &line) const QString name = nameParts.last(); nameParts.removeLast(); - BranchNode *newNode = new BranchNode(name, sha, lineParts.at(2)); + auto newNode = new BranchNode(name, sha, lineParts.at(2)); root->insert(nameParts, newNode); if (current) m_currentBranch = newNode; diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 78fa053b3c4..1b0e9b35a90 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -85,7 +85,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co else m_ui->showButton->setDefault(true); m_changeModel = new QStringListModel(this); - QCompleter *changeCompleter = new QCompleter(m_changeModel, this); + auto changeCompleter = new QCompleter(m_changeModel, this); m_ui->changeNumberEdit->setCompleter(changeCompleter); changeCompleter->setCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/plugins/git/clonewizard.cpp b/src/plugins/git/clonewizard.cpp index fd987989163..b15065dc567 100644 --- a/src/plugins/git/clonewizard.cpp +++ b/src/plugins/git/clonewizard.cpp @@ -55,11 +55,11 @@ CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) : const Internal::GitVersionControl *vc = Internal::GitPlugin::instance()->gitVersionControl(); if (!vc->isConfigured()) { - VcsConfigurationPage *configPage = new VcsConfigurationPage; + auto configPage = new VcsConfigurationPage; configPage->setVersionControl(vc); addPage(configPage); } - CloneWizardPage *cwp = new CloneWizardPage; + auto cwp = new CloneWizardPage; cwp->setPath(path.toString()); addPage(cwp); } diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp index cdbc8651cb3..8c71b9f3007 100644 --- a/src/plugins/git/clonewizardpage.cpp +++ b/src/plugins/git/clonewizardpage.cpp @@ -123,8 +123,8 @@ VcsCommand *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPath) co if (d->recursiveCheckBox->isChecked()) args << QLatin1String("--recursive"); args << QLatin1String("--progress") << repository() << checkoutDir; - VcsCommand *command = new VcsCommand(client->gitExecutable(), workingDirectory, - client->processEnvironment()); + auto command = new VcsCommand(client->gitExecutable(), workingDirectory, + client->processEnvironment()); command->addFlags(VcsBasePlugin::MergeOutputChannels); command->addJob(args, -1); return command; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 433c193693d..69c0e9f17f5 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -222,7 +222,7 @@ void GitDiffHandler::postCollectShowDescription(const QString &id) m_controller->requestSaveState(); m_controller->clear(m_waitMessage); - VcsCommand *command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment()); + auto command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment()); command->setCodec(m_gitClient->encoding(m_workingDirectory, "i18n.commitEncoding")); connect(command, SIGNAL(output(QString)), @@ -311,7 +311,7 @@ void GitDiffHandler::postCollectTextualDiffOutput(const QString &gitCommand, con m_controller->requestSaveState(); m_controller->clear(m_waitMessage); - VcsCommand *command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment()); + auto command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment()); command->setCodec(EditorManager::defaultTextCodec()); connect(command, SIGNAL(output(QString)), this, SLOT(slotTextualDiffOutputReceived(QString))); @@ -415,8 +415,7 @@ GitDiffEditorReloader::GitDiffEditorReloader() void GitDiffEditorReloader::reload() { - GitDiffHandler *handler = new GitDiffHandler(controller(), - m_workingDirectory); + auto handler = new GitDiffHandler(controller(), m_workingDirectory); connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished())); switch (m_diffType) { @@ -1011,7 +1010,7 @@ void GitClient::diffBranch(const QString &workingDirectory, void GitClient::merge(const QString &workingDirectory, const QStringList &unmergedFileNames) { - MergeTool *mergeTool = new MergeTool(this); + auto mergeTool = new MergeTool(this); if (!mergeTool->start(workingDirectory, unmergedFileNames)) delete mergeTool; } @@ -1715,7 +1714,7 @@ void GitClient::branchesForCommit(const QString &revision) DiffEditor::DiffEditorController *controller = qobject_cast(sender()); QString workingDirectory = controller->workingDirectory(); - VcsCommand *command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment()); + auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment()); command->setCodec(getSourceCodec(currentDocumentPath())); connect(command, SIGNAL(output(QString)), controller, @@ -2117,7 +2116,7 @@ VcsCommand *GitClient::createCommand(const QString &workingDirectory, bool useOutputToWindow, int editorLineNumber) { - VcsCommand *command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment()); + auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment()); command->setCodec(getSourceCodec(currentDocumentPath())); command->setCookie(QVariant(editorLineNumber)); if (editor) { @@ -2576,7 +2575,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, // the child), but that does not have an environment parameter. bool success = false; if (!settings()->stringValue(GitSettings::pathKey).isEmpty()) { - QProcess *process = new QProcess(this); + auto process = new QProcess(this); process->setWorkingDirectory(workingDirectory); process->setProcessEnvironment(env); process->start(binary, arguments); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 472166bea44..61c8d20b0ca 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -226,7 +226,7 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac, const Context &context, bool addToLocator, const QKeySequence &keys) { - QAction *action = new QAction(text, this); + auto action = new QAction(text, this); Core::Command *command = ActionManager::registerAction(action, id, context); if (!keys.isEmpty()) command->setDefaultKeySequence(keys); diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp index 0cfff5ec283..88335a121bc 100644 --- a/src/plugins/git/gitsubmiteditorwidget.cpp +++ b/src/plugins/git/gitsubmiteditorwidget.cpp @@ -94,8 +94,8 @@ void GitSubmitEditorWidget::initialize(CommitType commitType, return; m_isInitialized = true; if (commitType == FixupCommit) { - QGroupBox *logChangeGroupBox = new QGroupBox(tr("Select Change")); - QVBoxLayout *logChangeLayout = new QVBoxLayout; + auto logChangeGroupBox = new QGroupBox(tr("Select Change")); + auto logChangeLayout = new QVBoxLayout; logChangeGroupBox->setLayout(logChangeLayout); m_logChangeWidget = new LogChangeWidget; m_logChangeWidget->init(repository); @@ -110,7 +110,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType, setPanelInfo(info); if (enablePush) { - QMenu *menu = new QMenu(this); + auto menu = new QMenu(this); menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot())); menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot())); menu->addAction(tr("Commit and Push to &Gerrit"), this, SLOT(commitAndPushToGerritSlot())); diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 8989f8d0ed2..848e9e6714a 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -171,7 +171,7 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm if (colonPos != -1) { QList row; for (int c = 0; c < ColumnCount; ++c) { - QStandardItem *item = new QStandardItem; + auto item = new QStandardItem; item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); if (line.endsWith(QLatin1Char(')'))) { QFont font = item->font(); @@ -206,10 +206,10 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) : , m_dialogButtonBox(new QDialogButtonBox(this)) , m_resetTypeComboBox(0) { - QVBoxLayout *layout = new QVBoxLayout(this); + auto layout = new QVBoxLayout(this); layout->addWidget(new QLabel(isReset ? tr("Reset to:") : tr("Select change:"), this)); layout->addWidget(m_widget); - QHBoxLayout *popUpLayout = new QHBoxLayout; + auto popUpLayout = new QHBoxLayout; if (isReset) { popUpLayout->addWidget(new QLabel(tr("Reset type:"), this)); m_resetTypeComboBox = new QComboBox(this); diff --git a/src/plugins/git/stashdialog.cpp b/src/plugins/git/stashdialog.cpp index 254fc7f9e5c..d110bfc2327 100644 --- a/src/plugins/git/stashdialog.cpp +++ b/src/plugins/git/stashdialog.cpp @@ -59,11 +59,11 @@ static inline GitClient *gitClient() static inline QList stashModelRowItems(const Stash &s) { Qt::ItemFlags itemFlags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; - QStandardItem *nameItem = new QStandardItem(s.name); + auto nameItem = new QStandardItem(s.name); nameItem->setFlags(itemFlags); - QStandardItem *branchItem = new QStandardItem(s.branch); + auto branchItem = new QStandardItem(s.branch); branchItem->setFlags(itemFlags); - QStandardItem *messageItem = new QStandardItem(s.message); + auto messageItem = new QStandardItem(s.message); messageItem->setFlags(itemFlags); QList rc; rc << nameItem << branchItem << messageItem;