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