Git: Sprinkle with auto

Change-Id: I13886e17ee49702a69450e0f0b7d161cdfed1385
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2015-01-22 13:52:48 +01:00
parent b0a4921b5b
commit 03c9b935de
9 changed files with 24 additions and 25 deletions

View File

@@ -614,7 +614,7 @@ QModelIndex BranchModel::addBranch(const QString &name, bool track, const QModel
local = child; local = child;
} }
int pos = positionForName(local, leafName); 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) if (!added)
beginInsertRows(nodeToIndex(local), pos, pos); beginInsertRows(nodeToIndex(local), pos, pos);
newNode->parent = local; newNode->parent = local;
@@ -677,7 +677,7 @@ void BranchModel::parseOutputLine(const QString &line)
const QString name = nameParts.last(); const QString name = nameParts.last();
nameParts.removeLast(); nameParts.removeLast();
BranchNode *newNode = new BranchNode(name, sha, lineParts.at(2)); auto newNode = new BranchNode(name, sha, lineParts.at(2));
root->insert(nameParts, newNode); root->insert(nameParts, newNode);
if (current) if (current)
m_currentBranch = newNode; m_currentBranch = newNode;

View File

@@ -85,7 +85,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co
else else
m_ui->showButton->setDefault(true); m_ui->showButton->setDefault(true);
m_changeModel = new QStringListModel(this); m_changeModel = new QStringListModel(this);
QCompleter *changeCompleter = new QCompleter(m_changeModel, this); auto changeCompleter = new QCompleter(m_changeModel, this);
m_ui->changeNumberEdit->setCompleter(changeCompleter); m_ui->changeNumberEdit->setCompleter(changeCompleter);
changeCompleter->setCaseSensitivity(Qt::CaseInsensitive); changeCompleter->setCaseSensitivity(Qt::CaseInsensitive);

View File

@@ -55,11 +55,11 @@ CloneWizard::CloneWizard(const Utils::FileName &path, QWidget *parent) :
const Internal::GitVersionControl *vc = Internal::GitPlugin::instance()->gitVersionControl(); const Internal::GitVersionControl *vc = Internal::GitPlugin::instance()->gitVersionControl();
if (!vc->isConfigured()) { if (!vc->isConfigured()) {
VcsConfigurationPage *configPage = new VcsConfigurationPage; auto configPage = new VcsConfigurationPage;
configPage->setVersionControl(vc); configPage->setVersionControl(vc);
addPage(configPage); addPage(configPage);
} }
CloneWizardPage *cwp = new CloneWizardPage; auto cwp = new CloneWizardPage;
cwp->setPath(path.toString()); cwp->setPath(path.toString());
addPage(cwp); addPage(cwp);
} }

View File

@@ -123,8 +123,8 @@ VcsCommand *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPath) co
if (d->recursiveCheckBox->isChecked()) if (d->recursiveCheckBox->isChecked())
args << QLatin1String("--recursive"); args << QLatin1String("--recursive");
args << QLatin1String("--progress") << repository() << checkoutDir; args << QLatin1String("--progress") << repository() << checkoutDir;
VcsCommand *command = new VcsCommand(client->gitExecutable(), workingDirectory, auto command = new VcsCommand(client->gitExecutable(), workingDirectory,
client->processEnvironment()); client->processEnvironment());
command->addFlags(VcsBasePlugin::MergeOutputChannels); command->addFlags(VcsBasePlugin::MergeOutputChannels);
command->addJob(args, -1); command->addJob(args, -1);
return command; return command;

View File

@@ -222,7 +222,7 @@ void GitDiffHandler::postCollectShowDescription(const QString &id)
m_controller->requestSaveState(); m_controller->requestSaveState();
m_controller->clear(m_waitMessage); 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, command->setCodec(m_gitClient->encoding(m_workingDirectory,
"i18n.commitEncoding")); "i18n.commitEncoding"));
connect(command, SIGNAL(output(QString)), connect(command, SIGNAL(output(QString)),
@@ -311,7 +311,7 @@ void GitDiffHandler::postCollectTextualDiffOutput(const QString &gitCommand, con
m_controller->requestSaveState(); m_controller->requestSaveState();
m_controller->clear(m_waitMessage); 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()); command->setCodec(EditorManager::defaultTextCodec());
connect(command, SIGNAL(output(QString)), connect(command, SIGNAL(output(QString)),
this, SLOT(slotTextualDiffOutputReceived(QString))); this, SLOT(slotTextualDiffOutputReceived(QString)));
@@ -415,8 +415,7 @@ GitDiffEditorReloader::GitDiffEditorReloader()
void GitDiffEditorReloader::reload() void GitDiffEditorReloader::reload()
{ {
GitDiffHandler *handler = new GitDiffHandler(controller(), auto handler = new GitDiffHandler(controller(), m_workingDirectory);
m_workingDirectory);
connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished())); connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished()));
switch (m_diffType) { switch (m_diffType) {
@@ -1011,7 +1010,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
void GitClient::merge(const QString &workingDirectory, void GitClient::merge(const QString &workingDirectory,
const QStringList &unmergedFileNames) const QStringList &unmergedFileNames)
{ {
MergeTool *mergeTool = new MergeTool(this); auto mergeTool = new MergeTool(this);
if (!mergeTool->start(workingDirectory, unmergedFileNames)) if (!mergeTool->start(workingDirectory, unmergedFileNames))
delete mergeTool; delete mergeTool;
} }
@@ -1715,7 +1714,7 @@ void GitClient::branchesForCommit(const QString &revision)
DiffEditor::DiffEditorController *controller DiffEditor::DiffEditorController *controller
= qobject_cast<DiffEditor::DiffEditorController *>(sender()); = qobject_cast<DiffEditor::DiffEditorController *>(sender());
QString workingDirectory = controller->workingDirectory(); QString workingDirectory = controller->workingDirectory();
VcsCommand *command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment()); auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment());
command->setCodec(getSourceCodec(currentDocumentPath())); command->setCodec(getSourceCodec(currentDocumentPath()));
connect(command, SIGNAL(output(QString)), controller, connect(command, SIGNAL(output(QString)), controller,
@@ -2117,7 +2116,7 @@ VcsCommand *GitClient::createCommand(const QString &workingDirectory,
bool useOutputToWindow, bool useOutputToWindow,
int editorLineNumber) int editorLineNumber)
{ {
VcsCommand *command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment()); auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment());
command->setCodec(getSourceCodec(currentDocumentPath())); command->setCodec(getSourceCodec(currentDocumentPath()));
command->setCookie(QVariant(editorLineNumber)); command->setCookie(QVariant(editorLineNumber));
if (editor) { if (editor) {
@@ -2576,7 +2575,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
// the child), but that does not have an environment parameter. // the child), but that does not have an environment parameter.
bool success = false; bool success = false;
if (!settings()->stringValue(GitSettings::pathKey).isEmpty()) { if (!settings()->stringValue(GitSettings::pathKey).isEmpty()) {
QProcess *process = new QProcess(this); auto process = new QProcess(this);
process->setWorkingDirectory(workingDirectory); process->setWorkingDirectory(workingDirectory);
process->setProcessEnvironment(env); process->setProcessEnvironment(env);
process->start(binary, arguments); process->start(binary, arguments);

View File

@@ -226,7 +226,7 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac,
const Context &context, bool addToLocator, const Context &context, bool addToLocator,
const QKeySequence &keys) const QKeySequence &keys)
{ {
QAction *action = new QAction(text, this); auto action = new QAction(text, this);
Core::Command *command = ActionManager::registerAction(action, id, context); Core::Command *command = ActionManager::registerAction(action, id, context);
if (!keys.isEmpty()) if (!keys.isEmpty())
command->setDefaultKeySequence(keys); command->setDefaultKeySequence(keys);

View File

@@ -94,8 +94,8 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
return; return;
m_isInitialized = true; m_isInitialized = true;
if (commitType == FixupCommit) { if (commitType == FixupCommit) {
QGroupBox *logChangeGroupBox = new QGroupBox(tr("Select Change")); auto logChangeGroupBox = new QGroupBox(tr("Select Change"));
QVBoxLayout *logChangeLayout = new QVBoxLayout; auto logChangeLayout = new QVBoxLayout;
logChangeGroupBox->setLayout(logChangeLayout); logChangeGroupBox->setLayout(logChangeLayout);
m_logChangeWidget = new LogChangeWidget; m_logChangeWidget = new LogChangeWidget;
m_logChangeWidget->init(repository); m_logChangeWidget->init(repository);
@@ -110,7 +110,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
setPanelInfo(info); setPanelInfo(info);
if (enablePush) { if (enablePush) {
QMenu *menu = new QMenu(this); auto menu = new QMenu(this);
menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot())); menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot()));
menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot())); menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot()));
menu->addAction(tr("Commit and Push to &Gerrit"), this, SLOT(commitAndPushToGerritSlot())); menu->addAction(tr("Commit and Push to &Gerrit"), this, SLOT(commitAndPushToGerritSlot()));

View File

@@ -171,7 +171,7 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
if (colonPos != -1) { if (colonPos != -1) {
QList<QStandardItem *> row; QList<QStandardItem *> row;
for (int c = 0; c < ColumnCount; ++c) { for (int c = 0; c < ColumnCount; ++c) {
QStandardItem *item = new QStandardItem; auto item = new QStandardItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
if (line.endsWith(QLatin1Char(')'))) { if (line.endsWith(QLatin1Char(')'))) {
QFont font = item->font(); QFont font = item->font();
@@ -206,10 +206,10 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
, m_dialogButtonBox(new QDialogButtonBox(this)) , m_dialogButtonBox(new QDialogButtonBox(this))
, m_resetTypeComboBox(0) , 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(new QLabel(isReset ? tr("Reset to:") : tr("Select change:"), this));
layout->addWidget(m_widget); layout->addWidget(m_widget);
QHBoxLayout *popUpLayout = new QHBoxLayout; auto popUpLayout = new QHBoxLayout;
if (isReset) { if (isReset) {
popUpLayout->addWidget(new QLabel(tr("Reset type:"), this)); popUpLayout->addWidget(new QLabel(tr("Reset type:"), this));
m_resetTypeComboBox = new QComboBox(this); m_resetTypeComboBox = new QComboBox(this);

View File

@@ -59,11 +59,11 @@ static inline GitClient *gitClient()
static inline QList<QStandardItem*> stashModelRowItems(const Stash &s) static inline QList<QStandardItem*> stashModelRowItems(const Stash &s)
{ {
Qt::ItemFlags itemFlags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags itemFlags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
QStandardItem *nameItem = new QStandardItem(s.name); auto nameItem = new QStandardItem(s.name);
nameItem->setFlags(itemFlags); nameItem->setFlags(itemFlags);
QStandardItem *branchItem = new QStandardItem(s.branch); auto branchItem = new QStandardItem(s.branch);
branchItem->setFlags(itemFlags); branchItem->setFlags(itemFlags);
QStandardItem *messageItem = new QStandardItem(s.message); auto messageItem = new QStandardItem(s.message);
messageItem->setFlags(itemFlags); messageItem->setFlags(itemFlags);
QList<QStandardItem*> rc; QList<QStandardItem*> rc;
rc << nameItem << branchItem << messageItem; rc << nameItem << branchItem << messageItem;