VcsBase: use Qt5 connects

Change-Id: I386da06c9abe27913e85b2ed9984a83938f5457c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Hugues Delorme
2015-03-04 15:51:32 +01:00
parent f7bdbc66e0
commit 7a05c9ea5b
9 changed files with 71 additions and 53 deletions

View File

@@ -51,8 +51,9 @@ BaseCheckoutWizard::BaseCheckoutWizard(const Utils::FileName &path, QWidget *par
m_progressPageId(-1)
{
Q_UNUSED(path);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotPageChanged(int)));
connect(m_progressPage, SIGNAL(terminated(bool)), this, SLOT(slotTerminated(bool)));
connect(this, &QWizard::currentIdChanged, this, &BaseCheckoutWizard::slotPageChanged);
connect(m_progressPage, &Internal::CheckoutProgressWizardPage::terminated,
this, &BaseCheckoutWizard::slotTerminated);
setOption(QWizard::NoBackButtonOnLastPage);
}

View File

@@ -68,21 +68,27 @@ BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) :
{
d->ui.setupUi(this);
connect(d->ui.repositoryLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotRepositoryChanged(QString)));
connect(d->ui.repositoryLineEdit, &QLineEdit::textChanged,
this, &BaseCheckoutWizardPage::slotRepositoryChanged);
connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(slotChanged()));
connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotDirectoryEdited()));
connect(d->ui.branchComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotChanged()));
connect(d->ui.checkoutDirectoryLineEdit, &QLineEdit::textChanged,
this, &BaseCheckoutWizardPage::slotChanged);
connect(d->ui.checkoutDirectoryLineEdit, &QLineEdit::textEdited,
this, &BaseCheckoutWizardPage::slotDirectoryEdited);
connect(d->ui.branchComboBox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &BaseCheckoutWizardPage::slotChanged);
d->ui.pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
d->ui.pathChooser->setHistoryCompleter(QLatin1String("Vcs.CheckoutDir.History"));
connect(d->ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged()));
connect(d->ui.pathChooser,
static_cast<void (Utils::PathChooser::*)()>(&Utils::PathChooser::validChanged),
this, &BaseCheckoutWizardPage::slotChanged);
d->ui.branchComboBox->setEnabled(false);
d->ui.branchRefreshToolButton->setIcon(QIcon(QLatin1String(":/locator/images/reload.png")));
connect(d->ui.branchRefreshToolButton, SIGNAL(clicked()), this, SLOT(slotRefreshBranches()));
connect(d->ui.branchRefreshToolButton, &QAbstractButton::clicked,
this, &BaseCheckoutWizardPage::slotRefreshBranches);
}
BaseCheckoutWizardPage::~BaseCheckoutWizardPage()

View File

@@ -169,10 +169,12 @@ CleanDialog::CleanDialog(QWidget *parent) :
d->ui.filesTreeView->setSelectionMode(QAbstractItemView::NoSelection);
d->ui.filesTreeView->setAllColumnsShowFocus(true);
d->ui.filesTreeView->setRootIsDecorated(false);
connect(d->ui.filesTreeView, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(slotDoubleClicked(QModelIndex)));
connect(d->ui.selectAllCheckBox, SIGNAL(clicked(bool)), this, SLOT(selectAllItems(bool)));
connect(d->ui.filesTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateSelectAllCheckBox()));
connect(d->ui.filesTreeView, &QAbstractItemView::doubleClicked,
this, &CleanDialog::slotDoubleClicked);
connect(d->ui.selectAllCheckBox, &QAbstractButton::clicked,
this, &CleanDialog::selectAllItems);
connect(d->ui.filesTreeView, &QAbstractItemView::clicked,
this, &CleanDialog::updateSelectAllCheckBox);
}
CleanDialog::~CleanDialog()
@@ -262,8 +264,8 @@ bool CleanDialog::promptToDelete()
// Remove in background
auto cleanTask = new Internal::CleanFilesTask(d->m_workingDirectory, selectedFiles);
connect(cleanTask, SIGNAL(error(QString)),
VcsOutputWindow::instance(), SLOT(appendSilently(QString)),
connect(cleanTask, &Internal::CleanFilesTask::error,
VcsOutputWindow::instance(), &VcsOutputWindow::appendSilently,
Qt::QueuedConnection);
QFuture<void> task = QtConcurrent::run(cleanTask, &Internal::CleanFilesTask::run);

View File

@@ -34,6 +34,7 @@
#include "ui_commonsettingspage.h"
#include <coreplugin/icore.h>
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
#include <utils/environment.h>
@@ -62,8 +63,8 @@ CommonSettingsWidget::CommonSettingsWidget(QWidget *parent) :
updatePath();
connect(Core::VcsManager::instance(), SIGNAL(configurationChanged(const IVersionControl*)),
this, SLOT(updatePath()));
connect(Core::VcsManager::instance(), &Core::VcsManager::configurationChanged,
this, &CommonSettingsWidget::updatePath);
}
CommonSettingsWidget::~CommonSettingsWidget()

View File

@@ -189,12 +189,12 @@ NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
}
m_ui->filterTreeView->setMinimumWidth(treeWidth + 20);
m_ui->filterLineEdit->setFiltering(true);
connect(m_ui->filterTreeView, SIGNAL(activated(QModelIndex)), this,
SLOT(slotActivated(QModelIndex)));
connect(m_ui->filterTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
this, SLOT(slotCurrentItemChanged(QModelIndex)));
connect(m_ui->filterLineEdit, SIGNAL(filterChanged(QString)),
m_filterModel, SLOT(setFilterFixedString(QString)));
connect(m_ui->filterTreeView, &QAbstractItemView::activated, this,
&NickNameDialog::slotActivated);
connect(m_ui->filterTreeView->selectionModel(), &QItemSelectionModel::currentRowChanged,
this, &NickNameDialog::slotCurrentItemChanged);
connect(m_ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged,
m_filterModel, &QSortFilterProxyModel::setFilterFixedString);
}
NickNameDialog::~NickNameDialog()

View File

@@ -298,17 +298,17 @@ void SubmitFieldWidget::createField(const QString &f)
}
}
connect(fe.browseButton, SIGNAL(clicked()), this, SLOT(slotBrowseButtonClicked()));
connect(fe.browseButton, &QAbstractButton::clicked, this, &SubmitFieldWidget::slotBrowseButtonClicked);
if (!d->hasBrowseButton)
fe.browseButton->setVisible(false);
if (d->completer)
fe.lineEdit->setCompleter(d->completer);
connect(fe.combo, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotComboIndexChanged(int)));
connect(fe.clearButton, SIGNAL(clicked()),
this, SLOT(slotRemove()));
connect(fe.combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &SubmitFieldWidget::slotComboIndexChanged);
connect(fe.clearButton, &QAbstractButton::clicked,
this, &SubmitFieldWidget::slotRemove);
d->layout->addLayout(fe.layout);
d->fieldEntries.push_back(fe);
}

View File

@@ -346,7 +346,7 @@ void ChangeTextCursorHandler::slotCopyRevision()
QAction *ChangeTextCursorHandler::createDescribeAction(const QString &change) const
{
auto a = new QAction(VcsBaseEditorWidget::tr("Describe Change %1").arg(change), 0);
connect(a, SIGNAL(triggered()), this, SLOT(slotDescribe()));
connect(a, &QAction::triggered, this, &ChangeTextCursorHandler::slotDescribe);
return a;
}
@@ -359,7 +359,7 @@ QAction *ChangeTextCursorHandler::createAnnotateAction(const QString &change, bo
editorWidget()->annotateRevisionTextFormat();
auto a = new QAction(format.arg(change), 0);
a->setData(change);
connect(a, SIGNAL(triggered()), editorWidget(), SLOT(slotAnnotateRevision()));
connect(a, &QAction::triggered, editorWidget(), &VcsBaseEditorWidget::slotAnnotateRevision);
return a;
}
@@ -367,7 +367,7 @@ QAction *ChangeTextCursorHandler::createCopyRevisionAction(const QString &change
{
auto a = new QAction(editorWidget()->copyRevisionTextFormat().arg(change), 0);
a->setData(change);
connect(a, SIGNAL(triggered()), this, SLOT(slotCopyRevision()));
connect(a, &QAction::triggered, this, &ChangeTextCursorHandler::slotCopyRevision);
return a;
}
@@ -499,7 +499,7 @@ QAction *UrlTextCursorHandler::createOpenUrlAction(const QString &text) const
{
auto a = new QAction(text, 0);
a->setData(m_urlData.url);
connect(a, SIGNAL(triggered()), this, SLOT(slotOpenUrl()));
connect(a, &QAction::triggered, this, &UrlTextCursorHandler::slotOpenUrl);
return a;
}
@@ -507,7 +507,7 @@ QAction *UrlTextCursorHandler::createCopyUrlAction(const QString &text) const
{
auto a = new QAction(text, 0);
a->setData(m_urlData.url);
connect(a, SIGNAL(triggered()), this, SLOT(slotCopyUrl()));
connect(a, &QAction::triggered, this, &UrlTextCursorHandler::slotCopyUrl);
return a;
}
@@ -714,19 +714,25 @@ void VcsBaseEditorWidget::init()
case OtherContent:
break;
case LogOutput:
connect(d->entriesComboBox(), SIGNAL(activated(int)), this, SLOT(slotJumpToEntry(int)));
connect(this, SIGNAL(textChanged()), this, SLOT(slotPopulateLogBrowser()));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(slotCursorPositionChanged()));
connect(d->entriesComboBox(), static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &VcsBaseEditorWidget::slotJumpToEntry);
connect(this, &QPlainTextEdit::textChanged,
this, &VcsBaseEditorWidget::slotPopulateLogBrowser);
connect(this, &QPlainTextEdit::cursorPositionChanged,
this, &VcsBaseEditorWidget::slotCursorPositionChanged);
break;
case AnnotateOutput:
// Annotation highlighting depends on contents, which is set later on
connect(this, SIGNAL(textChanged()), this, SLOT(slotActivateAnnotation()));
connect(this, &QPlainTextEdit::textChanged, this, &VcsBaseEditorWidget::slotActivateAnnotation);
break;
case DiffOutput:
// Diff: set up diff file browsing
connect(d->entriesComboBox(), SIGNAL(activated(int)), this, SLOT(slotJumpToEntry(int)));
connect(this, SIGNAL(textChanged()), this, SLOT(slotPopulateDiffBrowser()));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(slotCursorPositionChanged()));
connect(d->entriesComboBox(), static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &VcsBaseEditorWidget::slotJumpToEntry);
connect(this, &QPlainTextEdit::textChanged,
this, &VcsBaseEditorWidget::slotPopulateDiffBrowser);
connect(this, &QPlainTextEdit::cursorPositionChanged,
this, &VcsBaseEditorWidget::slotCursorPositionChanged);
break;
}
if (hasDiff()) {
@@ -948,8 +954,8 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
case LogOutput: // log might have diff
case DiffOutput: {
menu->addSeparator();
connect(menu->addAction(tr("Send to CodePaster...")), SIGNAL(triggered()),
this, SLOT(slotPaste()));
connect(menu->addAction(tr("Send to CodePaster...")), &QAction::triggered,
this, &VcsBaseEditorWidget::slotPaste);
menu->addSeparator();
// Apply/revert diff chunk.
const DiffChunk chunk = diffChunk(cursorForPosition(e->pos()));
@@ -962,11 +968,11 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
// fileNameFromDiffSpecification() works.
QAction *applyAction = menu->addAction(tr("Apply Chunk..."));
applyAction->setData(qVariantFromValue(Internal::DiffChunkAction(chunk, false)));
connect(applyAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
connect(applyAction, &QAction::triggered, this, &VcsBaseEditorWidget::slotApplyDiffChunk);
// Revert a chunk from a VCS diff, which might be linked to reloading the diff.
QAction *revertAction = menu->addAction(tr("Revert Chunk..."));
revertAction->setData(qVariantFromValue(Internal::DiffChunkAction(chunk, true)));
connect(revertAction, SIGNAL(triggered()), this, SLOT(slotApplyDiffChunk()));
connect(revertAction, &QAction::triggered, this, &VcsBaseEditorWidget::slotApplyDiffChunk);
// Custom diff actions
addDiffActions(menu, chunk);
break;
@@ -974,7 +980,7 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
default:
break;
}
connect(this, SIGNAL(destroyed()), menu, SLOT(deleteLater()));
connect(this, &QObject::destroyed, menu, &QObject::deleteLater);
menu->exec(e->globalPos());
delete menu;
}
@@ -1058,7 +1064,7 @@ void VcsBaseEditorWidget::slotActivateAnnotation()
if (changes.isEmpty())
return;
disconnect(this, SIGNAL(textChanged()), this, SLOT(slotActivateAnnotation()));
disconnect(this, &QPlainTextEdit::textChanged, this, &VcsBaseEditorWidget::slotActivateAnnotation);
if (BaseAnnotationHighlighter *ah = qobject_cast<BaseAnnotationHighlighter *>(textDocument()->syntaxHighlighter())) {
ah->setChangeNumbers(changes);

View File

@@ -86,10 +86,10 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_settingsPage = new CommonOptionsPage;
addAutoReleasedObject(m_settingsPage);
addAutoReleasedObject(VcsOutputWindow::instance());
connect(m_settingsPage, SIGNAL(settingsChanged(VcsBase::Internal::CommonVcsSettings)),
this, SIGNAL(settingsChanged(VcsBase::Internal::CommonVcsSettings)));
connect(m_settingsPage, SIGNAL(settingsChanged(VcsBase::Internal::CommonVcsSettings)),
this, SLOT(slotSettingsChanged()));
connect(m_settingsPage, &CommonOptionsPage::settingsChanged,
this, &VcsPlugin::settingsChanged);
connect(m_settingsPage, &CommonOptionsPage::settingsChanged,
this, &VcsPlugin::slotSettingsChanged);
slotSettingsChanged();
JsonWizardFactory::registerPageFactory(new Internal::VcsConfigurationPageFactory);

View File

@@ -116,8 +116,10 @@ VcsConfigurationPage::VcsConfigurationPage() : d(new Internal::VcsConfigurationP
auto verticalLayout = new QVBoxLayout(this);
verticalLayout->addWidget(d->m_configureButton);
connect(d->m_versionControl, SIGNAL(configurationChanged()), SIGNAL(completeChanged()));
connect(d->m_configureButton, SIGNAL(clicked()), SLOT(openConfiguration()));
connect(d->m_versionControl, &IVersionControl::configurationChanged,
this, &QWizardPage::completeChanged);
connect(d->m_configureButton, &QAbstractButton::clicked,
this, &VcsConfigurationPage::openConfiguration);
}
VcsConfigurationPage::~VcsConfigurationPage()