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) m_progressPageId(-1)
{ {
Q_UNUSED(path); Q_UNUSED(path);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotPageChanged(int))); connect(this, &QWizard::currentIdChanged, this, &BaseCheckoutWizard::slotPageChanged);
connect(m_progressPage, SIGNAL(terminated(bool)), this, SLOT(slotTerminated(bool))); connect(m_progressPage, &Internal::CheckoutProgressWizardPage::terminated,
this, &BaseCheckoutWizard::slotTerminated);
setOption(QWizard::NoBackButtonOnLastPage); setOption(QWizard::NoBackButtonOnLastPage);
} }

View File

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

View File

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

View File

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

View File

@@ -189,12 +189,12 @@ NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
} }
m_ui->filterTreeView->setMinimumWidth(treeWidth + 20); m_ui->filterTreeView->setMinimumWidth(treeWidth + 20);
m_ui->filterLineEdit->setFiltering(true); m_ui->filterLineEdit->setFiltering(true);
connect(m_ui->filterTreeView, SIGNAL(activated(QModelIndex)), this, connect(m_ui->filterTreeView, &QAbstractItemView::activated, this,
SLOT(slotActivated(QModelIndex))); &NickNameDialog::slotActivated);
connect(m_ui->filterTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), connect(m_ui->filterTreeView->selectionModel(), &QItemSelectionModel::currentRowChanged,
this, SLOT(slotCurrentItemChanged(QModelIndex))); this, &NickNameDialog::slotCurrentItemChanged);
connect(m_ui->filterLineEdit, SIGNAL(filterChanged(QString)), connect(m_ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged,
m_filterModel, SLOT(setFilterFixedString(QString))); m_filterModel, &QSortFilterProxyModel::setFilterFixedString);
} }
NickNameDialog::~NickNameDialog() 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) if (!d->hasBrowseButton)
fe.browseButton->setVisible(false); fe.browseButton->setVisible(false);
if (d->completer) if (d->completer)
fe.lineEdit->setCompleter(d->completer); fe.lineEdit->setCompleter(d->completer);
connect(fe.combo, SIGNAL(currentIndexChanged(int)), connect(fe.combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, SLOT(slotComboIndexChanged(int))); this, &SubmitFieldWidget::slotComboIndexChanged);
connect(fe.clearButton, SIGNAL(clicked()), connect(fe.clearButton, &QAbstractButton::clicked,
this, SLOT(slotRemove())); this, &SubmitFieldWidget::slotRemove);
d->layout->addLayout(fe.layout); d->layout->addLayout(fe.layout);
d->fieldEntries.push_back(fe); d->fieldEntries.push_back(fe);
} }

View File

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

View File

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

View File

@@ -116,8 +116,10 @@ VcsConfigurationPage::VcsConfigurationPage() : d(new Internal::VcsConfigurationP
auto 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, &IVersionControl::configurationChanged,
connect(d->m_configureButton, SIGNAL(clicked()), SLOT(openConfiguration())); this, &QWizardPage::completeChanged);
connect(d->m_configureButton, &QAbstractButton::clicked,
this, &VcsConfigurationPage::openConfiguration);
} }
VcsConfigurationPage::~VcsConfigurationPage() VcsConfigurationPage::~VcsConfigurationPage()