Commit e29a49ca authored by Tobias Hunger's avatar Tobias Hunger

VcsBase: Sprinkle with auto

Change-Id: Icd1e1ec16b1ff918162d3c6f564348d47177ffc7
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 85388398
......@@ -61,7 +61,7 @@ CheckoutProgressWizardPage::CheckoutProgressWizardPage(QWidget *parent) :
m_state(Idle)
{
resize(264, 200);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
auto verticalLayout = new QVBoxLayout(this);
m_logPlainTextEdit = new QPlainTextEdit;
m_formatter = new Utils::OutputFormatter;
m_logPlainTextEdit->setReadOnly(true);
......
......@@ -214,7 +214,7 @@ void CleanDialog::addFile(const QString &workingDirectory, QString fileName, boo
bool isDir = fi.isDir();
if (isDir)
checked = false;
QStandardItem *nameItem = new QStandardItem(QDir::toNativeSeparators(fileName));
auto nameItem = new QStandardItem(QDir::toNativeSeparators(fileName));
nameItem->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
nameItem->setIcon(isDir ? folderIcon : fileIcon);
nameItem->setCheckable(true);
......@@ -261,7 +261,7 @@ bool CleanDialog::promptToDelete()
return false;
// Remove in background
Internal::CleanFilesTask *cleanTask = new Internal::CleanFilesTask(d->m_workingDirectory, selectedFiles);
auto cleanTask = new Internal::CleanFilesTask(d->m_workingDirectory, selectedFiles);
connect(cleanTask, SIGNAL(error(QString)),
VcsOutputWindow::instance(), SLOT(appendSilently(QString)),
Qt::QueuedConnection);
......
......@@ -137,16 +137,16 @@ QList<QStandardItem *> NickNameEntry::toModelRow() const
{
const QVariant nickNameData = nickName();
const Qt::ItemFlags flags = Qt::ItemIsSelectable|Qt::ItemIsEnabled;
QStandardItem *i1 = new QStandardItem(name);
auto i1 = new QStandardItem(name);
i1->setFlags(flags);
i1->setData(nickNameData, NickNameRole);
QStandardItem *i2 = new QStandardItem(email);
auto i2 = new QStandardItem(email);
i1->setFlags(flags);
i2->setData(nickNameData, NickNameRole);
QStandardItem *i3 = new QStandardItem(aliasName);
auto i3 = new QStandardItem(aliasName);
i3->setFlags(flags);
i3->setData(nickNameData, NickNameRole);
QStandardItem *i4 = new QStandardItem(aliasEmail);
auto i4 = new QStandardItem(aliasEmail);
i4->setFlags(flags);
i4->setData(nickNameData, NickNameRole);
QList<QStandardItem *> row;
......@@ -231,7 +231,7 @@ QString NickNameDialog::nickName() const
QStandardItemModel *NickNameDialog::createModel(QObject *parent)
{
QStandardItemModel *model = new QStandardItemModel(parent);
auto model = new QStandardItemModel(parent);
QStringList headers;
headers << tr("Name") << tr("Email")
<< tr("Alias") << tr("Alias email");
......
......@@ -600,7 +600,7 @@ void SubmitEditorWidget::addSubmitFieldWidget(SubmitFieldWidget *f)
if (!d->m_fieldLayout) {
// VBox with horizontal, expanding spacer
d->m_fieldLayout = new QVBoxLayout;
QHBoxLayout *outerLayout = new QHBoxLayout;
auto outerLayout = new QHBoxLayout;
outerLayout->addLayout(d->m_fieldLayout);
outerLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
d->m_ui.descriptionLayout->addLayout(outerLayout);
......
......@@ -48,7 +48,7 @@ enum { fileColumn = 1 };
static QList<QStandardItem *> createFileRow(const QString &fileName, const QString &status,
CheckMode checked, const QVariant &v)
{
QStandardItem *statusItem = new QStandardItem(status);
auto statusItem = new QStandardItem(status);
Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
if (checked != Uncheckable) {
flags |= Qt::ItemIsUserCheckable;
......@@ -56,7 +56,7 @@ static QList<QStandardItem *> createFileRow(const QString &fileName, const QStri
}
statusItem->setFlags(flags);
statusItem->setData(v);
QStandardItem *fileItem = new QStandardItem(fileName);
auto fileItem = new QStandardItem(fileName);
fileItem->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
fileItem->setIcon(Core::FileIconProvider::icon(fileName));
QList<QStandardItem *> row;
......
......@@ -596,8 +596,8 @@ VcsCommand *VcsBaseClient::createCommand(const QString &workingDirectory,
VcsBaseEditorWidget *editor,
JobOutputBindMode mode) const
{
VcsCommand *cmd = new VcsCommand(d->m_clientSettings->binaryPath(), workingDirectory,
processEnvironment());
auto cmd = new VcsCommand(d->m_clientSettings->binaryPath(), workingDirectory,
processEnvironment());
cmd->setDefaultTimeout(d->m_clientSettings->intValue(VcsBaseClientSettings::timeoutKey));
if (editor)
d->bindCommandToEditor(cmd, editor);
......
......@@ -344,7 +344,7 @@ void ChangeTextCursorHandler::slotCopyRevision()
QAction *ChangeTextCursorHandler::createDescribeAction(const QString &change) const
{
QAction *a = new QAction(VcsBaseEditorWidget::tr("Describe Change %1").arg(change), 0);
auto a = new QAction(VcsBaseEditorWidget::tr("Describe Change %1").arg(change), 0);
connect(a, SIGNAL(triggered()), this, SLOT(slotDescribe()));
return a;
}
......@@ -356,7 +356,7 @@ QAction *ChangeTextCursorHandler::createAnnotateAction(const QString &change, bo
previous && !editorWidget()->annotatePreviousRevisionTextFormat().isEmpty() ?
editorWidget()->annotatePreviousRevisionTextFormat() :
editorWidget()->annotateRevisionTextFormat();
QAction *a = new QAction(format.arg(change), 0);
auto a = new QAction(format.arg(change), 0);
a->setData(change);
connect(a, SIGNAL(triggered()), editorWidget(), SLOT(slotAnnotateRevision()));
return a;
......@@ -364,7 +364,7 @@ QAction *ChangeTextCursorHandler::createAnnotateAction(const QString &change, bo
QAction *ChangeTextCursorHandler::createCopyRevisionAction(const QString &change) const
{
QAction *a = new QAction(editorWidget()->copyRevisionTextFormat().arg(change), 0);
auto a = new QAction(editorWidget()->copyRevisionTextFormat().arg(change), 0);
a->setData(change);
connect(a, SIGNAL(triggered()), this, SLOT(slotCopyRevision()));
return a;
......@@ -496,7 +496,7 @@ void UrlTextCursorHandler::slotOpenUrl()
QAction *UrlTextCursorHandler::createOpenUrlAction(const QString &text) const
{
QAction *a = new QAction(text, 0);
auto a = new QAction(text, 0);
a->setData(m_urlData.url);
connect(a, SIGNAL(triggered()), this, SLOT(slotOpenUrl()));
return a;
......@@ -504,7 +504,7 @@ QAction *UrlTextCursorHandler::createOpenUrlAction(const QString &text) const
QAction *UrlTextCursorHandler::createCopyUrlAction(const QString &text) const
{
QAction *a = new QAction(text, 0);
auto a = new QAction(text, 0);
a->setData(m_urlData.url);
connect(a, SIGNAL(triggered()), this, SLOT(slotCopyUrl()));
return a;
......@@ -729,7 +729,7 @@ void VcsBaseEditorWidget::init()
break;
}
if (hasDiff()) {
DiffHighlighter *dh = new DiffHighlighter(d->m_diffFilePattern);
auto dh = new DiffHighlighter(d->m_diffFilePattern);
setCodeFoldingSupported(true);
textDocument()->setSyntaxHighlighter(dh);
}
......
......@@ -155,7 +155,7 @@ QToolButton *VcsBaseEditorParameterWidget::addToggleButton(const QString &option
QToolButton *VcsBaseEditorParameterWidget::addToggleButton(const QStringList &options, const QString &label, const QString &tooltip)
{
QToolButton *tb = new QToolButton;
auto tb = new QToolButton;
tb->setText(label);
tb->setToolTip(tooltip);
tb->setCheckable(true);
......@@ -168,7 +168,7 @@ QToolButton *VcsBaseEditorParameterWidget::addToggleButton(const QStringList &op
QComboBox *VcsBaseEditorParameterWidget::addComboBox(const QStringList &options,
const QList<ComboBoxItem> &items)
{
QComboBox *cb = new QComboBox;
auto cb = new QComboBox;
foreach (const ComboBoxItem &item, items)
cb->addItem(item.displayText, item.value);
connect(cb, SIGNAL(currentIndexChanged(int)), this, SIGNAL(argumentsChanged()));
......
......@@ -171,7 +171,7 @@ VcsBaseSubmitEditorPrivate::VcsBaseSubmitEditorPrivate(const VcsBaseSubmitEditor
m_file(new SubmitEditorFile(parameters, q)),
m_nickNameDialog(0)
{
QCompleter *completer = new QCompleter(q);
auto completer = new QCompleter(q);
completer->setCaseSensitivity(Qt::CaseSensitive);
completer->setModelSorting(QCompleter::CaseSensitivelySortedModel);
m_widget->descriptionEdit()->setCompleter(completer);
......@@ -209,18 +209,18 @@ VcsBaseSubmitEditor::VcsBaseSubmitEditor(const VcsBaseSubmitEditorParameters *pa
const CommonVcsSettings settings = VcsPlugin::instance()->settings();
// Add additional context menu settings
if (!settings.submitMessageCheckScript.isEmpty() || !settings.nickNameMailMap.isEmpty()) {
QAction *sep = new QAction(this);
auto sep = new QAction(this);
sep->setSeparator(true);
d->m_widget->addDescriptionEditContextMenuAction(sep);
// Run check action
if (!settings.submitMessageCheckScript.isEmpty()) {
QAction *checkAction = new QAction(tr("Check Message"), this);
auto checkAction = new QAction(tr("Check Message"), this);
connect(checkAction, SIGNAL(triggered()), this, SLOT(slotCheckSubmitMessage()));
d->m_widget->addDescriptionEditContextMenuAction(checkAction);
}
// Insert nick
if (!settings.nickNameMailMap.isEmpty()) {
QAction *insertAction = new QAction(tr("Insert Name..."), this);
auto insertAction = new QAction(tr("Insert Name..."), this);
connect(insertAction, SIGNAL(triggered()), this, SLOT(slotInsertNickName()));
d->m_widget->addDescriptionEditContextMenuAction(insertAction);
}
......@@ -240,7 +240,7 @@ VcsBaseSubmitEditor::VcsBaseSubmitEditor(const VcsBaseSubmitEditorParameters *pa
connect(Core::ICore::mainWindow(), SIGNAL(windowActivated()),
this, SLOT(slotRefreshCommitData()), Qt::QueuedConnection);
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
auto aggregate = new Aggregation::Aggregate;
aggregate->add(new Core::BaseTextFind(descriptionEdit));
aggregate->add(this);
}
......@@ -288,9 +288,9 @@ void VcsBaseSubmitEditor::createUserFields(const QString &fieldConfigFile)
return;
// Create a completer on user names
const QStandardItemModel *nickNameModel = VcsPlugin::instance()->nickNameModel();
QCompleter *completer = new QCompleter(NickNameDialog::nickNameList(nickNameModel), this);
auto completer = new QCompleter(NickNameDialog::nickNameList(nickNameModel), this);
SubmitFieldWidget *fieldWidget = new SubmitFieldWidget;
auto fieldWidget = new SubmitFieldWidget;
connect(fieldWidget, SIGNAL(browseButtonClicked(int,QString)),
this, SLOT(slotSetFieldNickName(int)));
fieldWidget->setCompleter(completer);
......@@ -395,7 +395,7 @@ void VcsBaseSubmitEditor::setCheckScriptWorkingDirectory(const QString &s)
static QToolBar *createToolBar(const QWidget *someWidget, QAction *submitAction, QAction *diffAction)
{
// Create
QToolBar *toolBar = new QToolBar;
auto toolBar = new QToolBar;
toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
const int size = someWidget->style()->pixelMetric(QStyle::PM_SmallIconSize);
toolBar->setIconSize(QSize(size, size));
......
......@@ -68,7 +68,7 @@ Utils::WizardPage *VcsConfigurationPageFactory::create(JsonWizard *wizard, Id ty
const QString vcsId = tmp.value(QLatin1String("vcsId")).toString();
QTC_ASSERT(!vcsId.isEmpty(), return 0);
VcsConfigurationPage *page = new VcsConfigurationPage;
auto page = new VcsConfigurationPage;
page->setVersionControlId(vcsId);
return page;
......@@ -113,7 +113,7 @@ VcsConfigurationPage::VcsConfigurationPage() : d(new Internal::VcsConfigurationP
d->m_configureButton = new QPushButton(ICore::msgShowOptionsDialog(), this);
d->m_configureButton->setEnabled(false);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
auto verticalLayout = new QVBoxLayout(this);
verticalLayout->addWidget(d->m_configureButton);
connect(d->m_versionControl, SIGNAL(configurationChanged()), SIGNAL(completeChanged()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment