From 9d3b2f09986ef23afc9907c60acc9331697225ea Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 13 Dec 2015 01:18:33 +0200 Subject: TextEditor: Use Qt5-style connects The heavy lifting was done by clazy. Change-Id: I380120e3419d2a3c0e272f51cc3e0d5f6aaa5e9b Reviewed-by: Tobias Hunger --- src/plugins/coreplugin/externaltoolmanager.cpp | 2 +- src/plugins/coreplugin/externaltoolmanager.h | 2 +- src/plugins/texteditor/basefilefind.cpp | 30 ++++---- src/plugins/texteditor/basefilefind.h | 3 +- src/plugins/texteditor/behaviorsettingspage.cpp | 4 +- src/plugins/texteditor/behaviorsettingspage.h | 3 +- src/plugins/texteditor/behaviorsettingswidget.cpp | 61 +++++++++-------- src/plugins/texteditor/behaviorsettingswidget.h | 4 +- .../codeassist/functionhintproposalwidget.cpp | 4 +- .../codeassist/functionhintproposalwidget.h | 4 +- .../codeassist/genericproposalwidget.cpp | 25 +++---- .../texteditor/codeassist/genericproposalwidget.h | 2 - src/plugins/texteditor/codecselector.cpp | 6 +- src/plugins/texteditor/codecselector.h | 3 +- src/plugins/texteditor/codestyleeditor.cpp | 12 ++-- src/plugins/texteditor/codestyleeditor.h | 3 +- src/plugins/texteditor/codestylepool.cpp | 9 ++- src/plugins/texteditor/codestylepool.h | 3 +- src/plugins/texteditor/codestyleselectorwidget.cpp | 79 +++++++++++----------- src/plugins/texteditor/codestyleselectorwidget.h | 3 +- src/plugins/texteditor/colorschemeedit.cpp | 40 +++++------ src/plugins/texteditor/colorschemeedit.h | 3 +- src/plugins/texteditor/findincurrentfile.cpp | 4 +- src/plugins/texteditor/findincurrentfile.h | 3 +- src/plugins/texteditor/findinfiles.cpp | 6 +- src/plugins/texteditor/findinfiles.h | 7 +- src/plugins/texteditor/findinopenfiles.cpp | 8 +-- src/plugins/texteditor/findinopenfiles.h | 2 +- src/plugins/texteditor/fontsettingspage.cpp | 8 +-- src/plugins/texteditor/fontsettingspage.h | 3 +- .../generichighlighter/highlightersettingspage.cpp | 32 ++++----- .../generichighlighter/highlightersettingspage.h | 3 +- .../texteditor/generichighlighter/manager.cpp | 22 +++--- .../texteditor/generichighlighter/manager.h | 6 +- src/plugins/texteditor/icodestylepreferences.cpp | 32 ++++----- src/plugins/texteditor/icodestylepreferences.h | 2 - src/plugins/texteditor/outlinefactory.cpp | 8 ++- src/plugins/texteditor/outlinefactory.h | 3 - .../simplecodestylepreferenceswidget.cpp | 24 +++---- .../texteditor/simplecodestylepreferenceswidget.h | 3 +- .../texteditor/snippets/snippetscollection.cpp | 3 +- .../texteditor/snippets/snippetscollection.h | 3 +- .../texteditor/snippets/snippetssettingspage.cpp | 67 ++++++++++-------- src/plugins/texteditor/tabsettingswidget.cpp | 22 +++--- src/plugins/texteditor/tabsettingswidget.h | 5 +- src/plugins/texteditor/textdocument.h | 3 +- src/plugins/texteditor/texteditor.cpp | 16 ++--- src/plugins/texteditor/texteditorplugin.cpp | 4 +- src/plugins/texteditor/texteditorplugin.h | 3 +- src/plugins/texteditor/texteditorsettings.cpp | 28 ++++---- src/plugins/texteditor/texteditorsettings.h | 6 +- src/plugins/texteditor/textmark.cpp | 12 ++-- src/plugins/texteditor/textmarkregistry.h | 4 +- 53 files changed, 316 insertions(+), 341 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/coreplugin/externaltoolmanager.cpp b/src/plugins/coreplugin/externaltoolmanager.cpp index a95f93c0b2..aa1bfc6f39 100644 --- a/src/plugins/coreplugin/externaltoolmanager.cpp +++ b/src/plugins/coreplugin/externaltoolmanager.cpp @@ -122,7 +122,7 @@ ExternalToolManager::~ExternalToolManager() delete d; } -QObject *ExternalToolManager::instance() +ExternalToolManager *ExternalToolManager::instance() { return m_instance; } diff --git a/src/plugins/coreplugin/externaltoolmanager.h b/src/plugins/coreplugin/externaltoolmanager.h index 62fcdc833c..9893e96713 100644 --- a/src/plugins/coreplugin/externaltoolmanager.h +++ b/src/plugins/coreplugin/externaltoolmanager.h @@ -50,7 +50,7 @@ public: ExternalToolManager(); ~ExternalToolManager(); - static QObject *instance(); + static ExternalToolManager *instance(); static QMap > toolsByCategory(); static QMap toolsById(); static void setToolsByCategory(const QMap > &tools); diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index ff6b4e3d6b..3f4b46b508 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -147,17 +147,15 @@ void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags, parameters.nameFilters = fileNameFilters(); parameters.additionalParameters = additionalParameters(); search->setUserData(qVariantFromValue(parameters)); - connect(search, SIGNAL(activated(Core::SearchResultItem)), this, SLOT(openEditor(Core::SearchResultItem))); - if (searchMode == SearchResultWindow::SearchAndReplace) { - connect(search, SIGNAL(replaceButtonClicked(QString,QList,bool)), - this, SLOT(doReplace(QString,QList,bool))); - } - connect(search, SIGNAL(visibilityChanged(bool)), this, SLOT(hideHighlightAll(bool))); - connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); - connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); - connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain())); - connect(this, SIGNAL(enabledChanged(bool)), search, SIGNAL(requestEnabledCheck())); - connect(search, SIGNAL(requestEnabledCheck()), this, SLOT(recheckEnabled())); + connect(search, &SearchResult::activated, this, &BaseFileFind::openEditor); + if (searchMode == SearchResultWindow::SearchAndReplace) + connect(search, &SearchResult::replaceButtonClicked, this, &BaseFileFind::doReplace); + connect(search, &SearchResult::visibilityChanged, this, &BaseFileFind::hideHighlightAll); + connect(search, &SearchResult::cancelled, this, &BaseFileFind::cancel); + connect(search, &SearchResult::paused, this, &BaseFileFind::setPaused); + connect(search, &SearchResult::searchAgainRequested, this, &BaseFileFind::searchAgain); + connect(this, &BaseFileFind::enabledChanged, search, &SearchResult::requestEnabledCheck); + connect(search, &SearchResult::requestEnabledCheck, this, &BaseFileFind::recheckEnabled); runSearch(search); } @@ -166,15 +164,15 @@ void BaseFileFind::runSearch(SearchResult *search) { FileFindParameters parameters = search->userData().value(); CountingLabel *label = new CountingLabel; - connect(search, SIGNAL(countChanged(int)), label, SLOT(updateCount(int))); + connect(search, &SearchResult::countChanged, label, &CountingLabel::updateCount); CountingLabel *statusLabel = new CountingLabel; - connect(search, SIGNAL(countChanged(int)), statusLabel, SLOT(updateCount(int))); + connect(search, &SearchResult::countChanged, statusLabel, &CountingLabel::updateCount); SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus)); QFutureWatcher *watcher = new QFutureWatcher(); d->m_watchers.insert(watcher, search); watcher->setPendingResultsLimit(1); - connect(watcher, SIGNAL(resultReadyAt(int)), this, SLOT(displayResult(int))); - connect(watcher, SIGNAL(finished()), this, SLOT(searchFinished())); + connect(watcher, &QFutureWatcherBase::resultReadyAt, this, &BaseFileFind::displayResult); + connect(watcher, &QFutureWatcherBase::finished, this, &BaseFileFind::searchFinished); if (parameters.flags & FindRegularExpression) { watcher->setFuture(Utils::findInFilesRegExp(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), @@ -190,7 +188,7 @@ void BaseFileFind::runSearch(SearchResult *search) ProgressManager::addTask(watcher->future(), tr("Searching"), Constants::TASK_SEARCH); progress->setWidget(label); progress->setStatusBarWidget(statusLabel); - connect(progress, SIGNAL(clicked()), search, SLOT(popup())); + connect(progress, &FutureProgress::clicked, search, &SearchResult::popup); } void BaseFileFind::findAll(const QString &txt, FindFlags findFlags) diff --git a/src/plugins/texteditor/basefilefind.h b/src/plugins/texteditor/basefilefind.h index f4f1725c41..d76827a2dc 100644 --- a/src/plugins/texteditor/basefilefind.h +++ b/src/plugins/texteditor/basefilefind.h @@ -85,7 +85,7 @@ protected: void updateComboEntries(QComboBox *combo, bool onTop); QStringList fileNameFilters() const; -private slots: +private: void displayResult(int index); void searchFinished(); void cancel(); @@ -98,7 +98,6 @@ private slots: void searchAgain(); void recheckEnabled(); -private: void runNewSearch(const QString &txt, Core::FindFlags findFlags, Core::SearchResultWindow::SearchMode searchMode); void runSearch(Core::SearchResult *search); diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp index 4f2d6b4ae4..cdbf7dadee 100644 --- a/src/plugins/texteditor/behaviorsettingspage.cpp +++ b/src/plugins/texteditor/behaviorsettingspage.cpp @@ -131,8 +131,8 @@ QWidget *BehaviorSettingsPage::widget() TabSettingsWidget *tabSettingsWidget = d->m_page->behaviorWidget->tabSettingsWidget(); tabSettingsWidget->setCodingStyleWarningVisible(true); - connect(tabSettingsWidget, SIGNAL(codingStyleLinkClicked(TextEditor::TabSettingsWidget::CodingStyleLink)), - this, SLOT(openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink))); + connect(tabSettingsWidget, &TabSettingsWidget::codingStyleLinkClicked, + this, &BehaviorSettingsPage::openCodingStylePreferences); settingsToUI(); } diff --git a/src/plugins/texteditor/behaviorsettingspage.h b/src/plugins/texteditor/behaviorsettingspage.h index e68e2bd5dc..509cc8909b 100644 --- a/src/plugins/texteditor/behaviorsettingspage.h +++ b/src/plugins/texteditor/behaviorsettingspage.h @@ -80,10 +80,9 @@ signals: void behaviorSettingsChanged(const TextEditor::BehaviorSettings &); void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &); -private slots: +private: void openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink link); -private: void settingsFromUI(TypingSettings *typingSettings, StorageSettings *storageSettings, BehaviorSettings *behaviorSettings, diff --git a/src/plugins/texteditor/behaviorsettingswidget.cpp b/src/plugins/texteditor/behaviorsettingswidget.cpp index 05048fabd8..1e825a3bc9 100644 --- a/src/plugins/texteditor/behaviorsettingswidget.cpp +++ b/src/plugins/texteditor/behaviorsettingswidget.cpp @@ -85,36 +85,37 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent) d->m_codecs.prepend(QTextCodec::codecForLocale()); } - connect(d->m_ui.autoIndent, SIGNAL(toggled(bool)), - this, SLOT(slotTypingSettingsChanged())); - connect(d->m_ui.smartBackspaceBehavior, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotTypingSettingsChanged())); - connect(d->m_ui.tabKeyBehavior, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotTypingSettingsChanged())); - connect(d->m_ui.cleanWhitespace, SIGNAL(clicked(bool)), - this, SLOT(slotStorageSettingsChanged())); - connect(d->m_ui.inEntireDocument, SIGNAL(clicked(bool)), - this, SLOT(slotStorageSettingsChanged())); - connect(d->m_ui.addFinalNewLine, SIGNAL(clicked(bool)), - this, SLOT(slotStorageSettingsChanged())); - connect(d->m_ui.cleanIndentation, SIGNAL(clicked(bool)), - this, SLOT(slotStorageSettingsChanged())); - connect(d->m_ui.mouseHiding, SIGNAL(clicked()), - this, SLOT(slotBehaviorSettingsChanged())); - connect(d->m_ui.mouseNavigation, SIGNAL(clicked()), - this, SLOT(slotBehaviorSettingsChanged())); - connect(d->m_ui.scrollWheelZooming, SIGNAL(clicked(bool)), - this, SLOT(slotBehaviorSettingsChanged())); - connect(d->m_ui.camelCaseNavigation, SIGNAL(clicked()), - this, SLOT(slotBehaviorSettingsChanged())); - connect(d->m_ui.utf8BomBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotExtraEncodingChanged())); - connect(d->m_ui.encodingBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotEncodingBoxChanged(int))); - connect(d->m_ui.constrainTooltipsBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotBehaviorSettingsChanged())); - connect(d->m_ui.keyboardTooltips, SIGNAL(clicked()), - this, SLOT(slotBehaviorSettingsChanged())); + auto currentIndexChanged = static_cast(&QComboBox::currentIndexChanged); + connect(d->m_ui.autoIndent, &QAbstractButton::toggled, + this, &BehaviorSettingsWidget::slotTypingSettingsChanged); + connect(d->m_ui.smartBackspaceBehavior, currentIndexChanged, + this, &BehaviorSettingsWidget::slotTypingSettingsChanged); + connect(d->m_ui.tabKeyBehavior, currentIndexChanged, + this, &BehaviorSettingsWidget::slotTypingSettingsChanged); + connect(d->m_ui.cleanWhitespace, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotStorageSettingsChanged); + connect(d->m_ui.inEntireDocument, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotStorageSettingsChanged); + connect(d->m_ui.addFinalNewLine, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotStorageSettingsChanged); + connect(d->m_ui.cleanIndentation, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotStorageSettingsChanged); + connect(d->m_ui.mouseHiding, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged); + connect(d->m_ui.mouseNavigation, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged); + connect(d->m_ui.scrollWheelZooming, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged); + connect(d->m_ui.camelCaseNavigation, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged); + connect(d->m_ui.utf8BomBox, currentIndexChanged, + this, &BehaviorSettingsWidget::slotExtraEncodingChanged); + connect(d->m_ui.encodingBox, currentIndexChanged, + this, &BehaviorSettingsWidget::slotEncodingBoxChanged); + connect(d->m_ui.constrainTooltipsBox, currentIndexChanged, + this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged); + connect(d->m_ui.keyboardTooltips, &QAbstractButton::clicked, + this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged); } BehaviorSettingsWidget::~BehaviorSettingsWidget() diff --git a/src/plugins/texteditor/behaviorsettingswidget.h b/src/plugins/texteditor/behaviorsettingswidget.h index df43b44cf7..4d3c9fd4ea 100644 --- a/src/plugins/texteditor/behaviorsettingswidget.h +++ b/src/plugins/texteditor/behaviorsettingswidget.h @@ -86,14 +86,12 @@ signals: void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &settings); void textCodecChanged(QTextCodec *codec); -private slots: +private: void slotTypingSettingsChanged(); void slotStorageSettingsChanged(); void slotBehaviorSettingsChanged(); void slotExtraEncodingChanged(); void slotEncodingBoxChanged(int index); - -private: void updateConstrainTooltipsBoxTooltip() const; BehaviorSettingsWidgetPrivate *d; diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp index 1123778c8f..30d84cfce5 100644 --- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp @@ -113,8 +113,8 @@ FunctionHintProposalWidget::FunctionHintProposalWidget() popupLayout->addWidget(d->m_pager); popupLayout->addWidget(d->m_hintLabel); - connect(upArrow, SIGNAL(clicked()), SLOT(previousPage())); - connect(downArrow, SIGNAL(clicked()), SLOT(nextPage())); + connect(upArrow, &QAbstractButton::clicked, this, &FunctionHintProposalWidget::previousPage); + connect(downArrow, &QAbstractButton::clicked, this, &FunctionHintProposalWidget::nextPage); connect(d->m_popupFrame.data(), &QObject::destroyed, this, &FunctionHintProposalWidget::abort); setFocusPolicy(Qt::NoFocus); diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.h b/src/plugins/texteditor/codeassist/functionhintproposalwidget.h index 3b4b68d141..05acfbd40b 100644 --- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.h +++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.h @@ -61,11 +61,9 @@ public: protected: bool eventFilter(QObject *o, QEvent *e) override; -private slots: +private: void nextPage(); void previousPage(); - -private: bool updateAndCheck(const QString &prefix); void updateContent(); void updatePosition(); diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp index 063bedb956..992cd8bd23 100644 --- a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp +++ b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp @@ -265,7 +265,6 @@ public: CodeAssistant *m_assistant; bool m_autoWidth; -public slots: void handleActivation(const QModelIndex &modelIndex); void maybeShowInfoTip(); }; @@ -280,12 +279,12 @@ GenericProposalWidgetPrivate::GenericProposalWidgetPrivate(QWidget *completionWi , m_assistant(0) , m_autoWidth(true) { - connect(m_completionListView, SIGNAL(activated(QModelIndex)), - this, SLOT(handleActivation(QModelIndex))); + connect(m_completionListView, &QAbstractItemView::activated, + this, &GenericProposalWidgetPrivate::handleActivation); m_infoTimer.setInterval(Constants::COMPLETION_ASSIST_TOOLTIP_DELAY); m_infoTimer.setSingleShot(true); - connect(&m_infoTimer, SIGNAL(timeout()), SLOT(maybeShowInfoTip())); + connect(&m_infoTimer, &QTimer::timeout, this, &GenericProposalWidgetPrivate::maybeShowInfoTip); } void GenericProposalWidgetPrivate::handleActivation(const QModelIndex &modelIndex) @@ -342,12 +341,12 @@ GenericProposalWidget::GenericProposalWidget() d->m_completionListView->setSelectionMode(QAbstractItemView::SingleSelection); d->m_completionListView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); d->m_completionListView->setMinimumSize(1, 1); - connect(d->m_completionListView->verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(updatePositionAndSize())); - connect(d->m_completionListView->verticalScrollBar(), SIGNAL(sliderPressed()), - this, SLOT(turnOffAutoWidth())); - connect(d->m_completionListView->verticalScrollBar(), SIGNAL(sliderReleased()), - this, SLOT(turnOnAutoWidth())); + connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::valueChanged, + this, &GenericProposalWidget::updatePositionAndSize); + connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::sliderPressed, + this, &GenericProposalWidget::turnOffAutoWidth); + connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::sliderReleased, + this, &GenericProposalWidget::turnOnAutoWidth); QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); @@ -394,10 +393,8 @@ void GenericProposalWidget::setModel(IAssistProposalModel *model) d->m_model = static_cast(model); d->m_completionListView->setModel(new ModelAdapter(d->m_model, d->m_completionListView)); - connect(d->m_completionListView->selectionModel(), - SIGNAL(currentChanged(QModelIndex,QModelIndex)), - &d->m_infoTimer, - SLOT(start())); + connect(d->m_completionListView->selectionModel(), &QItemSelectionModel::currentChanged, + &d->m_infoTimer, static_cast(&QTimer::start)); } void GenericProposalWidget::setDisplayRect(const QRect &rect) diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.h b/src/plugins/texteditor/codeassist/genericproposalwidget.h index 39ae7c4e29..c016e2a862 100644 --- a/src/plugins/texteditor/codeassist/genericproposalwidget.h +++ b/src/plugins/texteditor/codeassist/genericproposalwidget.h @@ -66,8 +66,6 @@ private: bool updateAndCheck(const QString &prefix); void notifyActivation(int index); void abort(); - -private slots: void updatePositionAndSize(); void turnOffAutoWidth(); void turnOnAutoWidth(); diff --git a/src/plugins/texteditor/codecselector.cpp b/src/plugins/texteditor/codecselector.cpp index 94de229f02..f4cfd833b1 100644 --- a/src/plugins/texteditor/codecselector.cpp +++ b/src/plugins/texteditor/codecselector.cpp @@ -122,14 +122,14 @@ CodecSelector::CodecSelector(QWidget *parent, TextDocument *doc) if (currentIndex >= 0) m_listWidget->setCurrentRow(currentIndex); - connect(m_listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons())); + connect(m_listWidget, &QListWidget::itemSelectionChanged, this, &CodecSelector::updateButtons); m_dialogButtonBox = new QDialogButtonBox(this); m_reloadButton = m_dialogButtonBox->addButton(tr("Reload with Encoding"), QDialogButtonBox::DestructiveRole); m_saveButton = m_dialogButtonBox->addButton(tr("Save with Encoding"), QDialogButtonBox::DestructiveRole); m_dialogButtonBox->addButton(QDialogButtonBox::Cancel); - connect(m_dialogButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); - connect(m_listWidget, SIGNAL(activated(QModelIndex)), m_reloadButton, SLOT(click())); + connect(m_dialogButtonBox, &QDialogButtonBox::clicked, this, &CodecSelector::buttonClicked); + connect(m_listWidget, &QAbstractItemView::activated, m_reloadButton, &QAbstractButton::click); QVBoxLayout *vbox = new QVBoxLayout(this); vbox->addWidget(m_label); diff --git a/src/plugins/texteditor/codecselector.h b/src/plugins/texteditor/codecselector.h index 9700bfe27c..2f78f2b5a3 100644 --- a/src/plugins/texteditor/codecselector.h +++ b/src/plugins/texteditor/codecselector.h @@ -60,11 +60,10 @@ public: Cancel, Reload, Save }; -private slots: +private: void updateButtons(); void buttonClicked(QAbstractButton *button); -private: bool m_hasDecodingError; bool m_isModified; QLabel *m_label; diff --git a/src/plugins/texteditor/codestyleeditor.cpp b/src/plugins/texteditor/codestyleeditor.cpp index f4f567c7bf..a2be17cdc3 100644 --- a/src/plugins/texteditor/codestyleeditor.cpp +++ b/src/plugins/texteditor/codestyleeditor.cpp @@ -73,12 +73,12 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, m_layout->addWidget(selector); m_layout->addWidget(m_preview); m_layout->addWidget(label); - connect(codeStyle, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), - this, SLOT(updatePreview())); - connect(codeStyle, SIGNAL(currentValueChanged(QVariant)), - this, SLOT(updatePreview())); - connect(codeStyle, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), - this, SLOT(updatePreview())); + connect(codeStyle, &ICodeStylePreferences::currentTabSettingsChanged, + this, &CodeStyleEditor::updatePreview); + connect(codeStyle, &ICodeStylePreferences::currentValueChanged, + this, &CodeStyleEditor::updatePreview); + connect(codeStyle, &ICodeStylePreferences::currentPreferencesChanged, + this, &CodeStyleEditor::updatePreview); m_preview->setCodeStyle(m_codeStyle); m_preview->setPlainText(factory->previewText()); diff --git a/src/plugins/texteditor/codestyleeditor.h b/src/plugins/texteditor/codestyleeditor.h index 443270a9c7..d4ee018e40 100644 --- a/src/plugins/texteditor/codestyleeditor.h +++ b/src/plugins/texteditor/codestyleeditor.h @@ -54,10 +54,9 @@ public: void clearMargins(); -private slots: +private: void updatePreview(); -private: QVBoxLayout *m_layout; ICodeStylePreferencesFactory *m_factory; ICodeStylePreferences *m_codeStyle; diff --git a/src/plugins/texteditor/codestylepool.cpp b/src/plugins/texteditor/codestylepool.cpp index 9528e913bc..02e98f5d38 100644 --- a/src/plugins/texteditor/codestylepool.cpp +++ b/src/plugins/texteditor/codestylepool.cpp @@ -185,9 +185,12 @@ void CodeStylePool::addCodeStyle(ICodeStylePreferences *codeStyle) // take ownership codeStyle->setParent(this); - connect(codeStyle, SIGNAL(valueChanged(QVariant)), this, SLOT(slotSaveCodeStyle())); - connect(codeStyle, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)), this, SLOT(slotSaveCodeStyle())); - connect(codeStyle, SIGNAL(displayNameChanged(QString)), this, SLOT(slotSaveCodeStyle())); + connect(codeStyle, &ICodeStylePreferences::valueChanged, + this, &CodeStylePool::slotSaveCodeStyle); + connect(codeStyle, &ICodeStylePreferences::tabSettingsChanged, + this, &CodeStylePool::slotSaveCodeStyle); + connect(codeStyle, &ICodeStylePreferences::displayNameChanged, + this, &CodeStylePool::slotSaveCodeStyle); emit codeStyleAdded(codeStyle); } diff --git a/src/plugins/texteditor/codestylepool.h b/src/plugins/texteditor/codestylepool.h index 9a20d1d00e..6a2887db96 100644 --- a/src/plugins/texteditor/codestylepool.h +++ b/src/plugins/texteditor/codestylepool.h @@ -74,10 +74,9 @@ signals: void codeStyleAdded(ICodeStylePreferences *); void codeStyleRemoved(ICodeStylePreferences *); -private slots: +private: void slotSaveCodeStyle(); -private: QString settingsDir() const; Utils::FileName settingsPath(const QByteArray &id) const; ICodeStylePreferences *loadCodeStyle(const Utils::FileName &fileName); diff --git a/src/plugins/texteditor/codestyleselectorwidget.cpp b/src/plugins/texteditor/codestyleselectorwidget.cpp index 5d7a5355d8..3028ed44bd 100644 --- a/src/plugins/texteditor/codestyleselectorwidget.cpp +++ b/src/plugins/texteditor/codestyleselectorwidget.cpp @@ -60,10 +60,10 @@ public: ICodeStylePreferences *codeStyle, QWidget *parent = 0); ~CodeStyleDialog(); ICodeStylePreferences *codeStyle() const; -private slots: +private: void slotCopyClicked(); void slotDisplayNameChanged(); -private: + ICodeStylePreferences *m_codeStyle; QLineEdit *m_lineEdit; QDialogButtonBox *m_buttons; @@ -98,8 +98,7 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory, m_warningLabel->setWordWrap(true); m_copyButton = new QPushButton(tr("Copy Built-in Code Style"), this); m_copyButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - connect(m_copyButton, SIGNAL(clicked()), - this, SLOT(slotCopyClicked())); + connect(m_copyButton, &QAbstractButton::clicked, this, &CodeStyleDialog::slotCopyClicked); warningLayout->addWidget(m_warningLabel); warningLayout->addWidget(m_copyButton); layout->addLayout(warningLayout); @@ -125,9 +124,9 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory, layout->addWidget(m_buttons); resize(850, 600); - connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotDisplayNameChanged())); - connect(m_buttons, SIGNAL(accepted()), this, SLOT(accept())); - connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject())); + connect(m_lineEdit, &QLineEdit::textChanged, this, &CodeStyleDialog::slotDisplayNameChanged); + connect(m_buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(m_buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); } ICodeStylePreferences *CodeStyleDialog::codeStyle() const @@ -172,18 +171,18 @@ CodeStyleSelectorWidget::CodeStyleSelectorWidget(ICodeStylePreferencesFactory *f m_ui->importButton->setEnabled(false); m_ui->exportButton->setEnabled(false); - connect(m_ui->delegateComboBox, SIGNAL(activated(int)), - this, SLOT(slotComboBoxActivated(int))); - connect(m_ui->copyButton, SIGNAL(clicked()), - this, SLOT(slotCopyClicked())); - connect(m_ui->editButton, SIGNAL(clicked()), - this, SLOT(slotEditClicked())); - connect(m_ui->removeButton, SIGNAL(clicked()), - this, SLOT(slotRemoveClicked())); - connect(m_ui->importButton, SIGNAL(clicked()), - this, SLOT(slotImportClicked())); - connect(m_ui->exportButton, SIGNAL(clicked()), - this, SLOT(slotExportClicked())); + connect(m_ui->delegateComboBox, static_cast(&QComboBox::activated), + this, &CodeStyleSelectorWidget::slotComboBoxActivated); + connect(m_ui->copyButton, &QAbstractButton::clicked, + this, &CodeStyleSelectorWidget::slotCopyClicked); + connect(m_ui->editButton, &QAbstractButton::clicked, + this, &CodeStyleSelectorWidget::slotEditClicked); + connect(m_ui->removeButton, &QAbstractButton::clicked, + this, &CodeStyleSelectorWidget::slotRemoveClicked); + connect(m_ui->importButton, &QAbstractButton::clicked, + this, &CodeStyleSelectorWidget::slotImportClicked); + connect(m_ui->exportButton, &QAbstractButton::clicked, + this, &CodeStyleSelectorWidget::slotExportClicked); } CodeStyleSelectorWidget::~CodeStyleSelectorWidget() @@ -200,13 +199,13 @@ void CodeStyleSelectorWidget::setCodeStyle(ICodeStylePreferences *codeStyle) if (m_codeStyle) { CodeStylePool *codeStylePool = m_codeStyle->delegatingPool(); if (codeStylePool) { - disconnect(codeStylePool, SIGNAL(codeStyleAdded(ICodeStylePreferences*)), - this, SLOT(slotCodeStyleAdded(ICodeStylePreferences*))); - disconnect(codeStylePool, SIGNAL(codeStyleRemoved(ICodeStylePreferences*)), - this, SLOT(slotCodeStyleRemoved(ICodeStylePreferences*))); + disconnect(codeStylePool, &CodeStylePool::codeStyleAdded, + this, &CodeStyleSelectorWidget::slotCodeStyleAdded); + disconnect(codeStylePool, &CodeStylePool::codeStyleRemoved, + this, &CodeStyleSelectorWidget::slotCodeStyleRemoved); } - disconnect(m_codeStyle, SIGNAL(currentDelegateChanged(ICodeStylePreferences*)), - this, SLOT(slotCurrentDelegateChanged(ICodeStylePreferences*))); + disconnect(m_codeStyle, &ICodeStylePreferences::currentDelegateChanged, + this, &CodeStyleSelectorWidget::slotCurrentDelegateChanged); m_ui->exportButton->setEnabled(false); m_ui->importButton->setEnabled(false); @@ -220,10 +219,10 @@ void CodeStyleSelectorWidget::setCodeStyle(ICodeStylePreferences *codeStyle) if (codeStylePool) { delegates = codeStylePool->codeStyles(); - connect(codeStylePool, SIGNAL(codeStyleAdded(ICodeStylePreferences*)), - this, SLOT(slotCodeStyleAdded(ICodeStylePreferences*))); - connect(codeStylePool, SIGNAL(codeStyleRemoved(ICodeStylePreferences*)), - this, SLOT(slotCodeStyleRemoved(ICodeStylePreferences*))); + connect(codeStylePool, &CodeStylePool::codeStyleAdded, + this, &CodeStyleSelectorWidget::slotCodeStyleAdded); + connect(codeStylePool, &CodeStylePool::codeStyleRemoved, + this, &CodeStyleSelectorWidget::slotCodeStyleRemoved); m_ui->exportButton->setEnabled(true); m_ui->importButton->setEnabled(true); } @@ -233,8 +232,8 @@ void CodeStyleSelectorWidget::setCodeStyle(ICodeStylePreferences *codeStyle) slotCurrentDelegateChanged(m_codeStyle->currentDelegate()); - connect(m_codeStyle, SIGNAL(currentDelegateChanged(TextEditor::ICodeStylePreferences*)), - this, SLOT(slotCurrentDelegateChanged(TextEditor::ICodeStylePreferences*))); + connect(m_codeStyle, &ICodeStylePreferences::currentDelegateChanged, + this, &CodeStyleSelectorWidget::slotCurrentDelegateChanged); } } @@ -331,7 +330,7 @@ void CodeStyleSelectorWidget::slotRemoveClicked() messageBox.addButton(deleteButton, QMessageBox::AcceptRole); messageBox.setDefaultButton(deleteButton); - connect(deleteButton, SIGNAL(clicked()), &messageBox, SLOT(accept())); + connect(deleteButton, &QAbstractButton::clicked, &messageBox, &QDialog::accept); if (messageBox.exec() == QDialog::Accepted) codeStylePool->removeCodeStyle(currentPreferences); } @@ -374,11 +373,11 @@ void CodeStyleSelectorWidget::slotCodeStyleAdded(ICodeStylePreferences *codeStyl const QString name = displayName(codeStylePreferences); m_ui->delegateComboBox->addItem(name, data); m_ui->delegateComboBox->setItemData(m_ui->delegateComboBox->count() - 1, name, Qt::ToolTipRole); - connect(codeStylePreferences, SIGNAL(displayNameChanged(QString)), - this, SLOT(slotUpdateName())); + connect(codeStylePreferences, &ICodeStylePreferences::displayNameChanged, + this, &CodeStyleSelectorWidget::slotUpdateName); if (codeStylePreferences->delegatingPool()) { - connect(codeStylePreferences, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), - this, SLOT(slotUpdateName())); + connect(codeStylePreferences, &ICodeStylePreferences::currentPreferencesChanged, + this, &CodeStyleSelectorWidget::slotUpdateName); } } @@ -386,11 +385,11 @@ void CodeStyleSelectorWidget::slotCodeStyleRemoved(ICodeStylePreferences *codeSt { m_ignoreGuiSignals = true; m_ui->delegateComboBox->removeItem(m_ui->delegateComboBox->findData(QVariant::fromValue(codeStylePreferences))); - disconnect(codeStylePreferences, SIGNAL(displayNameChanged(QString)), - this, SLOT(slotUpdateName())); + disconnect(codeStylePreferences, &ICodeStylePreferences::displayNameChanged, + this, &CodeStyleSelectorWidget::slotUpdateName); if (codeStylePreferences->delegatingPool()) { - disconnect(codeStylePreferences, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), - this, SLOT(slotUpdateName())); + disconnect(codeStylePreferences, &ICodeStylePreferences::currentPreferencesChanged, + this, &CodeStyleSelectorWidget::slotUpdateName); } m_ignoreGuiSignals = false; } diff --git a/src/plugins/texteditor/codestyleselectorwidget.h b/src/plugins/texteditor/codestyleselectorwidget.h index 1a8bdbdabd..150d62b4f4 100644 --- a/src/plugins/texteditor/codestyleselectorwidget.h +++ b/src/plugins/texteditor/codestyleselectorwidget.h @@ -59,7 +59,7 @@ public: void setCodeStyle(TextEditor::ICodeStylePreferences *codeStyle); -private slots: +private: void slotComboBoxActivated(int index); void slotCurrentDelegateChanged(TextEditor::ICodeStylePreferences *delegate); void slotCopyClicked(); @@ -71,7 +71,6 @@ private slots: void slotCodeStyleRemoved(ICodeStylePreferences*); void slotUpdateName(); -private: void updateName(ICodeStylePreferences *codeStyle); ICodeStylePreferencesFactory *m_factory; ICodeStylePreferences *m_codeStyle; diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp index 7e198532a3..f3c08e1350 100644 --- a/src/plugins/texteditor/colorschemeedit.cpp +++ b/src/plugins/texteditor/colorschemeedit.cpp @@ -158,26 +158,26 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : populateUnderlineStyleComboBox(); - connect(m_ui->itemList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), - SLOT(currentItemChanged(QModelIndex))); - connect(m_ui->foregroundToolButton, SIGNAL(clicked()), SLOT(changeForeColor())); - connect(m_ui->backgroundToolButton, SIGNAL(clicked()), SLOT(changeBackColor())); - connect(m_ui->eraseBackgroundToolButton, SIGNAL(clicked()), SLOT(eraseBackColor())); - connect(m_ui->eraseForegroundToolButton, SIGNAL(clicked()), SLOT(eraseForeColor())); - connect(m_ui->boldCheckBox, SIGNAL(toggled(bool)), SLOT(checkCheckBoxes())); - connect(m_ui->italicCheckBox, SIGNAL(toggled(bool)), SLOT(checkCheckBoxes())); - connect(m_ui->underlineColorToolButton, - &QToolButton::clicked, - this, - &ColorSchemeEdit::changeUnderlineColor); - connect(m_ui->eraseUnderlineColorToolButton, - &QToolButton::clicked, - this, - &ColorSchemeEdit::eraseUnderlineColor); - connect(m_ui->underlineComboBox, - static_cast(&QComboBox::currentIndexChanged), - this, - &ColorSchemeEdit::changeUnderlineStyle); + connect(m_ui->itemList->selectionModel(), &QItemSelectionModel::currentRowChanged, + this, &ColorSchemeEdit::currentItemChanged); + connect(m_ui->foregroundToolButton, &QAbstractButton::clicked, + this, &ColorSchemeEdit::changeForeColor); + connect(m_ui->backgroundToolButton, &QAbstractButton::clicked, + this, &ColorSchemeEdit::changeBackColor); + connect(m_ui->eraseBackgroundToolButton, &QAbstractButton::clicked, + this, &ColorSchemeEdit::eraseBackColor); + connect(m_ui->eraseForegroundToolButton, &QAbstractButton::clicked, + this, &ColorSchemeEdit::eraseForeColor); + connect(m_ui->boldCheckBox, &QAbstractButton::toggled, + this, &ColorSchemeEdit::checkCheckBoxes); + connect(m_ui->italicCheckBox, &QAbstractButton::toggled, + this, &ColorSchemeEdit::checkCheckBoxes); + connect(m_ui->underlineColorToolButton, &QToolButton::clicked, + this, &ColorSchemeEdit::changeUnderlineColor); + connect(m_ui->eraseUnderlineColorToolButton, &QToolButton::clicked, + this, &ColorSchemeEdit::eraseUnderlineColor); + connect(m_ui->underlineComboBox, static_cast(&QComboBox::currentIndexChanged), + this, &ColorSchemeEdit::changeUnderlineStyle); } ColorSchemeEdit::~ColorSchemeEdit() diff --git a/src/plugins/texteditor/colorschemeedit.h b/src/plugins/texteditor/colorschemeedit.h index 979b7db657..b6130137d9 100644 --- a/src/plugins/texteditor/colorschemeedit.h +++ b/src/plugins/texteditor/colorschemeedit.h @@ -65,7 +65,7 @@ public: void setColorScheme(const ColorScheme &colorScheme); const ColorScheme &colorScheme() const; -private slots: +private: void currentItemChanged(const QModelIndex &index); void changeForeColor(); void changeBackColor(); @@ -76,7 +76,6 @@ private slots: void eraseUnderlineColor(); void changeUnderlineStyle(int index); -private: void updateControls(); void updateForegroundControls(); void updateBackgroundControls(); diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp index da18ab7b44..ca4d3549a6 100644 --- a/src/plugins/texteditor/findincurrentfile.cpp +++ b/src/plugins/texteditor/findincurrentfile.cpp @@ -46,8 +46,8 @@ using namespace TextEditor::Internal; FindInCurrentFile::FindInCurrentFile() : m_currentDocument(0) { - connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), - this, SLOT(handleFileChange(Core::IEditor*))); + connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, + this, &FindInCurrentFile::handleFileChange); handleFileChange(Core::EditorManager::currentEditor()); } diff --git a/src/plugins/texteditor/findincurrentfile.h b/src/plugins/texteditor/findincurrentfile.h index 7af8e1807b..0202ee93d5 100644 --- a/src/plugins/texteditor/findincurrentfile.h +++ b/src/plugins/texteditor/findincurrentfile.h @@ -63,10 +63,9 @@ protected: QString label() const; QString toolTip() const; -private slots: +private: void handleFileChange(Core::IEditor *editor); -private: QPointer m_currentDocument; }; diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp index fc33b2cb49..dff00b9cef 100644 --- a/src/plugins/texteditor/findinfiles.cpp +++ b/src/plugins/texteditor/findinfiles.cpp @@ -56,8 +56,8 @@ FindInFiles::FindInFiles() m_directory(0) { m_instance = this; - connect(EditorManager::instance(), SIGNAL(findOnFileSystemRequest(QString)), - this, SLOT(findOnFileSystem(QString))); + connect(EditorManager::instance(), &EditorManager::findOnFileSystemRequest, + this, &FindInFiles::findOnFileSystem); } FindInFiles::~FindInFiles() @@ -132,7 +132,7 @@ QWidget *FindInFiles::createConfigWidget() gridLayout->addWidget(m_directory, 0, 1); QPushButton *browseButton = new QPushButton(Utils::PathChooser::browseButtonLabel()); gridLayout->addWidget(browseButton, 0, 2); - connect(browseButton, SIGNAL(clicked()), this, SLOT(openFileBrowser())); + connect(browseButton, &QAbstractButton::clicked, this, &FindInFiles::openFileBrowser); QLabel * const filePatternLabel = new QLabel(tr("Fi&le pattern:")); filePatternLabel->setMinimumWidth(80); diff --git a/src/plugins/texteditor/findinfiles.h b/src/plugins/texteditor/findinfiles.h index ac0fb0f6cc..7ae66546a3 100644 --- a/src/plugins/texteditor/findinfiles.h +++ b/src/plugins/texteditor/findinfiles.h @@ -59,6 +59,7 @@ public: void readSettings(QSettings *settings); void setDirectory(const Utils::FileName &directory); + static void findOnFileSystem(const QString &path); protected: Utils::FileIterator *files(const QStringList &nameFilters, @@ -67,13 +68,9 @@ protected: QString label() const; QString toolTip() const; -public slots: - static void findOnFileSystem(const QString &path); - -private slots: +private: void openFileBrowser(); -private: Utils::FileName path() const; QStringListModel m_directoryStrings; diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp index 3e2a63c6fe..d4f16d1438 100644 --- a/src/plugins/texteditor/findinopenfiles.cpp +++ b/src/plugins/texteditor/findinopenfiles.cpp @@ -44,10 +44,10 @@ using namespace TextEditor::Internal; FindInOpenFiles::FindInOpenFiles() { - connect(Core::EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)), - this, SLOT(updateEnabledState())); - connect(Core::EditorManager::instance(), SIGNAL(editorsClosed(QList)), - this, SLOT(updateEnabledState())); + connect(Core::EditorManager::instance(), &Core::EditorManager::editorOpened, + this, &FindInOpenFiles::updateEnabledState); + connect(Core::EditorManager::instance(), &Core::EditorManager::editorsClosed, + this, &FindInOpenFiles::updateEnabledState); } QString FindInOpenFiles::id() const diff --git a/src/plugins/texteditor/findinopenfiles.h b/src/plugins/texteditor/findinopenfiles.h index 594077a59e..561517869c 100644 --- a/src/plugins/texteditor/findinopenfiles.h +++ b/src/plugins/texteditor/findinopenfiles.h @@ -56,7 +56,7 @@ protected: QString label() const; QString toolTip() const; -private slots: +private: void updateEnabledState(); }; diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index de69d19f84..5d08ba911a 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -507,7 +507,7 @@ void FontSettingsPage::openCopyColorSchemeDialog() dialog->setLabelText(tr("Color scheme name:")); dialog->setTextValue(tr("%1 (copy)").arg(d_ptr->m_value.colorScheme().displayName())); - connect(dialog, SIGNAL(textValueSelected(QString)), this, SLOT(copyColorScheme(QString))); + connect(dialog, &QInputDialog::textValueSelected, this, &FontSettingsPage::copyColorScheme); dialog->open(); } @@ -561,8 +561,8 @@ void FontSettingsPage::confirmDeleteColorScheme() messageBox->addButton(deleteButton, QMessageBox::AcceptRole); messageBox->setDefaultButton(deleteButton); - connect(deleteButton, SIGNAL(clicked()), messageBox, SLOT(accept())); - connect(messageBox, SIGNAL(accepted()), this, SLOT(deleteColorScheme())); + connect(deleteButton, &QAbstractButton::clicked, messageBox, &QDialog::accept); + connect(messageBox, &QDialog::accepted, this, &FontSettingsPage::deleteColorScheme); messageBox->setAttribute(Qt::WA_DeleteOnClose); messageBox->open(); } @@ -676,7 +676,7 @@ void FontSettingsPage::saveSettings() d_ptr->m_lastValue = d_ptr->m_value; d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, Core::ICore::settings()); - QTimer::singleShot(0, this, SLOT(delayedChange())); + QTimer::singleShot(0, this, &FontSettingsPage::delayedChange); } } diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h index 7ab4771db1..9c07839a8c 100644 --- a/src/plugins/texteditor/fontsettingspage.h +++ b/src/plugins/texteditor/fontsettingspage.h @@ -135,7 +135,7 @@ public: signals: void changed(const TextEditor::FontSettings&); -private slots: +private: void delayedChange(); void fontSelected(const QFont &font); void fontSizeSelected(const QString &sizeString); @@ -147,7 +147,6 @@ private slots: void confirmDeleteColorScheme(); void deleteColorScheme(); -private: void maybeSaveColorScheme(); void updatePointSizes(); QList pointSizesForSelectedFont() const; diff --git a/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp b/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp index fd5a41649a..5780029ce3 100644 --- a/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp +++ b/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp @@ -106,11 +106,12 @@ QWidget *HighlighterSettingsPage::widget() settingsToUI(); - connect(m_d->m_page->useFallbackLocation, SIGNAL(clicked(bool)), - this, SLOT(setFallbackLocationState(bool))); - connect(m_d->m_page->definitionFilesPath, SIGNAL(validChanged(bool)), - this, SLOT(setDownloadDefinitionsState(bool))); - connect(m_d->m_widget, SIGNAL(destroyed()), this, SLOT(ignoreDownloadReply())); + connect(m_d->m_page->useFallbackLocation, &QAbstractButton::clicked, + this, &HighlighterSettingsPage::setFallbackLocationState); + connect(m_d->m_page->definitionFilesPath, &Utils::PathChooser::validChanged, + this, &HighlighterSettingsPage::setDownloadDefinitionsState); + connect(m_d->m_widget.data(), &QObject::destroyed, + this, &HighlighterSettingsPage::ignoreDownloadReply); } return m_d->m_widget; } @@ -187,24 +188,19 @@ void HighlighterSettingsPage::requestAvailableDefinitionsMetaData() { setDownloadDefinitionsState(false); - connect(Manager::instance(), - SIGNAL(definitionsMetaDataReady(QList)), - this, - SLOT(manageDefinitions(QList)), - Qt::UniqueConnection); - connect(Manager::instance(), SIGNAL(errorDownloadingDefinitionsMetaData()), - this, SLOT(showError()), Qt::UniqueConnection); + connect(Manager::instance(), &Manager::definitionsMetaDataReady, + this, &HighlighterSettingsPage::manageDefinitions, Qt::UniqueConnection); + connect(Manager::instance(), &Manager::errorDownloadingDefinitionsMetaData, + this, &HighlighterSettingsPage::showError, Qt::UniqueConnection); Manager::instance()->downloadAvailableDefinitionsMetaData(); } void HighlighterSettingsPage::ignoreDownloadReply() { - disconnect(Manager::instance(), - SIGNAL(definitionsMetaDataReady(QList)), - this, - SLOT(manageDefinitions(QList))); - disconnect(Manager::instance(), SIGNAL(errorDownloadingDefinitionsMetaData()), - this, SLOT(showError())); + disconnect(Manager::instance(), &Manager::definitionsMetaDataReady, + this, &HighlighterSettingsPage::manageDefinitions); + disconnect(Manager::instance(), &Manager::errorDownloadingDefinitionsMetaData, + this, &HighlighterSettingsPage::showError); } void HighlighterSettingsPage::manageDefinitions(const QList &metaData) diff --git a/src/plugins/texteditor/generichighlighter/highlightersettingspage.h b/src/plugins/texteditor/generichighlighter/highlightersettingspage.h index 2cc35af0b8..19ce67d421 100644 --- a/src/plugins/texteditor/generichighlighter/highlightersettingspage.h +++ b/src/plugins/texteditor/generichighlighter/highlightersettingspage.h @@ -56,14 +56,13 @@ public: const HighlighterSettings &highlighterSettings() const; -private slots: +private: void manageDefinitions(const QList &metaData); void showError(); void ignoreDownloadReply(); void setFallbackLocationState(bool checked); void setDownloadDefinitionsState(bool valid); -private: void resetDefinitionsLocation(); void requestAvailableDefinitionsMetaData(); void settingsFromUI(); diff --git a/src/plugins/texteditor/generichighlighter/manager.cpp b/src/plugins/texteditor/generichighlighter/manager.cpp index 6cf1b53ced..96458b51fa 100644 --- a/src/plugins/texteditor/generichighlighter/manager.cpp +++ b/src/plugins/texteditor/generichighlighter/manager.cpp @@ -86,7 +86,8 @@ public: m_installedDefinitions(installedDefinitions), m_downloadPath(savePath) { - connect(&m_downloadWatcher, SIGNAL(finished()), this, SLOT(downloadDefinitionsFinished())); + connect(&m_downloadWatcher, &QFutureWatcherBase::finished, + this, &MultiDefinitionDownloader::downloadDefinitionsFinished); } ~MultiDefinitionDownloader() @@ -100,11 +101,10 @@ public: signals: void finished(); -private slots: +private: void downloadReferencedDefinition(const QString &name); void downloadDefinitionsFinished(); -private: QFutureWatcher m_downloadWatcher; QList m_downloaders; QList m_installedDefinitions; @@ -116,7 +116,8 @@ Manager::Manager() : m_multiDownloader(0), m_hasQueuedRegistration(false) { - connect(&m_registeringWatcher, SIGNAL(finished()), this, SLOT(registerHighlightingFilesFinished())); + connect(&m_registeringWatcher, &QFutureWatcherBase::finished, + this, &Manager::registerHighlightingFilesFinished); } Manager::~Manager() @@ -328,7 +329,8 @@ void Manager::registerHighlightingFiles() ManagerProcessor *processor = new ManagerProcessor; QFuture future = QtConcurrent::run(&ManagerProcessor::process, processor); - connect(&m_registeringWatcher, SIGNAL(finished()), processor, SLOT(deleteLater())); + connect(&m_registeringWatcher, &QFutureWatcherBase::finished, + processor, &QObject::deleteLater); m_registeringWatcher.setFuture(future); } else { m_hasQueuedRegistration = true; @@ -418,7 +420,8 @@ void Manager::downloadAvailableDefinitionsMetaData() QNetworkRequest request(url); // Currently this takes a couple of seconds on Windows 7: QTBUG-10106. QNetworkReply *reply = Utils::NetworkAccessManager::instance()->get(request); - connect(reply, SIGNAL(finished()), this, SLOT(downloadAvailableDefinitionsListFinished())); + connect(reply, &QNetworkReply::finished, + this, &Manager::downloadAvailableDefinitionsListFinished); } void Manager::downloadAvailableDefinitionsListFinished() @@ -435,7 +438,8 @@ void Manager::downloadAvailableDefinitionsListFinished() void Manager::downloadDefinitions(const QList &urls, const QString &savePath) { m_multiDownloader = new MultiDefinitionDownloader(savePath, m_register.m_idByName.keys()); - connect(m_multiDownloader, SIGNAL(finished()), this, SLOT(downloadDefinitionsFinished())); + connect(m_multiDownloader, &MultiDefinitionDownloader::finished, + this, &Manager::downloadDefinitionsFinished); m_multiDownloader->downloadDefinitions(urls); } @@ -444,8 +448,8 @@ void MultiDefinitionDownloader::downloadDefinitions(const QList &urls) m_downloaders.clear(); foreach (const QUrl &url, urls) { DefinitionDownloader *downloader = new DefinitionDownloader(url, m_downloadPath); - connect(downloader, SIGNAL(foundReferencedDefinition(QString)), - this, SLOT(downloadReferencedDefinition(QString))); + connect(downloader, &DefinitionDownloader::foundReferencedDefinition, + this, &MultiDefinitionDownloader::downloadReferencedDefinition); m_downloaders.append(downloader); } diff --git a/src/plugins/texteditor/generichighlighter/manager.h b/src/plugins/texteditor/generichighlighter/manager.h index c760a16a49..80f7a2b4f0 100644 --- a/src/plugins/texteditor/generichighlighter/manager.h +++ b/src/plugins/texteditor/generichighlighter/manager.h @@ -81,13 +81,11 @@ public: void downloadAvailableDefinitionsMetaData(); void downloadDefinitions(const QList &urls, const QString &savePath); bool isDownloadingDefinitions() const; + void registerHighlightingFiles(); static DefinitionMetaDataPtr parseMetadata(const QFileInfo &fileInfo); -public slots: - void registerHighlightingFiles(); - -private slots: +private: void registerHighlightingFilesFinished(); void downloadAvailableDefinitionsListFinished(); void downloadDefinitionsFinished(); diff --git a/src/plugins/texteditor/icodestylepreferences.cpp b/src/plugins/texteditor/icodestylepreferences.cpp index ba4073ffec..ed475cec93 100644 --- a/src/plugins/texteditor/icodestylepreferences.cpp +++ b/src/plugins/texteditor/icodestylepreferences.cpp @@ -151,13 +151,13 @@ void ICodeStylePreferences::setDelegatingPool(CodeStylePool *pool) setCurrentDelegate(0); if (d->m_pool) { - disconnect(d->m_pool, SIGNAL(codeStyleRemoved(ICodeStylePreferences*)), - this, SLOT(slotCodeStyleRemoved(ICodeStylePreferences*))); + disconnect(d->m_pool, &CodeStylePool::codeStyleRemoved, + this, &ICodeStylePreferences::slotCodeStyleRemoved); } d->m_pool = pool; if (d->m_pool) { - connect(d->m_pool, SIGNAL(codeStyleRemoved(ICodeStylePreferences*)), - this, SLOT(slotCodeStyleRemoved(ICodeStylePreferences*))); + connect(d->m_pool, &CodeStylePool::codeStyleRemoved, + this, &ICodeStylePreferences::slotCodeStyleRemoved); } } @@ -182,21 +182,21 @@ void ICodeStylePreferences::setCurrentDelegate(ICodeStylePreferences *delegate) return; // nothing changes if (d->m_currentDelegate) { - disconnect(d->m_currentDelegate, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), - this, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings))); - disconnect(d->m_currentDelegate, SIGNAL(currentValueChanged(QVariant)), - this, SIGNAL(currentValueChanged(QVariant))); - disconnect(d->m_currentDelegate, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), - this, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*))); + disconnect(d->m_currentDelegate, &ICodeStylePreferences::currentTabSettingsChanged, + this, &ICodeStylePreferences::currentTabSettingsChanged); + disconnect(d->m_currentDelegate, &ICodeStylePreferences::currentValueChanged, + this, &ICodeStylePreferences::currentValueChanged); + disconnect(d->m_currentDelegate, &ICodeStylePreferences::currentPreferencesChanged, + this, &ICodeStylePreferences::currentPreferencesChanged); } d->m_currentDelegate = delegate; if (d->m_currentDelegate) { - connect(d->m_currentDelegate, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), - this, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings))); - connect(d->m_currentDelegate, SIGNAL(currentValueChanged(QVariant)), - this, SIGNAL(currentValueChanged(QVariant))); - connect(d->m_currentDelegate, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), - this, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*))); + connect(d->m_currentDelegate, &ICodeStylePreferences::currentTabSettingsChanged, + this, &ICodeStylePreferences::currentTabSettingsChanged); + connect(d->m_currentDelegate, &ICodeStylePreferences::currentValueChanged, + this, &ICodeStylePreferences::currentValueChanged); + connect(d->m_currentDelegate, &ICodeStylePreferences::currentPreferencesChanged, + this, &ICodeStylePreferences::currentPreferencesChanged); } emit currentDelegateChanged(d->m_currentDelegate); emit currentPreferencesChanged(currentPreferences()); diff --git a/src/plugins/texteditor/icodestylepreferences.h b/src/plugins/texteditor/icodestylepreferences.h index 6e5d6964a7..c8cfebc845 100644 --- a/src/plugins/texteditor/icodestylepreferences.h +++ b/src/plugins/texteditor/icodestylepreferences.h @@ -103,8 +103,6 @@ signals: protected: virtual QString settingsSuffix() const = 0; - -protected slots: void slotCodeStyleRemoved(ICodeStylePreferences *preferences); private: diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp index 7daca4a895..c1bf1baf06 100644 --- a/src/plugins/texteditor/outlinefactory.cpp +++ b/src/plugins/texteditor/outlinefactory.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -62,7 +63,8 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) : m_toggleSync->setCheckable(true); m_toggleSync->setChecked(true); m_toggleSync->setToolTip(tr("Synchronize with Editor")); - connect(m_toggleSync, SIGNAL(clicked(bool)), this, SLOT(toggleCursorSynchronization())); + connect(m_toggleSync, &QAbstractButton::clicked, + this, &OutlineWidgetStack::toggleCursorSynchronization); m_filterButton = new QToolButton; m_filterButton->setIcon(Core::Icons::FILTER.icon()); @@ -72,8 +74,8 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) : m_filterMenu = new QMenu(m_filterButton); m_filterButton->setMenu(m_filterMenu); - connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), - this, SLOT(updateCurrentEditor(Core::IEditor*))); + connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, + this, &OutlineWidgetStack::updateCurrentEditor); updateCurrentEditor(Core::EditorManager::currentEditor()); } diff --git a/src/plugins/texteditor/outlinefactory.h b/src/plugins/texteditor/outlinefactory.h index dd7b1db496..7f91c6dfed 100644 --- a/src/plugins/texteditor/outlinefactory.h +++ b/src/plugins/texteditor/outlinefactory.h @@ -60,12 +60,9 @@ private: bool isCursorSynchronized() const; QWidget *dummyWidget() const; void updateFilterMenu(); - -private slots: void toggleCursorSynchronization(); void updateCurrentEditor(Core::IEditor *editor); -private: QStackedWidget *m_widgetStack; OutlineFactory *m_factory; QToolButton *m_toggleSync; diff --git a/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp b/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp index a46d044aee..ae395baec5 100644 --- a/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp +++ b/src/plugins/texteditor/simplecodestylepreferenceswidget.cpp @@ -55,12 +55,12 @@ void SimpleCodeStylePreferencesWidget::setPreferences(ICodeStylePreferences *pre // cleanup old if (m_preferences) { - disconnect(m_preferences, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), - m_tabSettingsWidget, SLOT(setTabSettings(TextEditor::TabSettings))); - disconnect(m_preferences, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), - this, SLOT(slotCurrentPreferencesChanged(TextEditor::ICodeStylePreferences*))); - disconnect(m_tabSettingsWidget, SIGNAL(settingsChanged(TextEditor::TabSettings)), - this, SLOT(slotTabSettingsChanged(TextEditor::TabSettings))); + disconnect(m_preferences, &ICodeStylePreferences::currentTabSettingsChanged, + m_tabSettingsWidget, &TabSettingsWidget::setTabSettings); + disconnect(m_preferences, &ICodeStylePreferences::currentPreferencesChanged, + this, &SimpleCodeStylePreferencesWidget::slotCurrentPreferencesChanged); + disconnect(m_tabSettingsWidget, &TabSettingsWidget::settingsChanged, + this, &SimpleCodeStylePreferencesWidget::slotTabSettingsChanged); } m_preferences = preferences; // fillup new @@ -68,12 +68,12 @@ void SimpleCodeStylePreferencesWidget::setPreferences(ICodeStylePreferences *pre slotCurrentPreferencesChanged(m_preferences->currentPreferences()); m_tabSettingsWidget->setTabSettings(m_preferences->currentTabSettings()); - connect(m_preferences, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), - m_tabSettingsWidget, SLOT(setTabSettings(TextEditor::TabSettings))); - connect(m_preferences, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), - this, SLOT(slotCurrentPreferencesChanged(TextEditor::ICodeStylePreferences*))); - connect(m_tabSettingsWidget, SIGNAL(settingsChanged(TextEditor::TabSettings)), - this, SLOT(slotTabSettingsChanged(TextEditor::TabSettings))); + connect(m_preferences, &ICodeStylePreferences::currentTabSettingsChanged, + m_tabSettingsWidget, &TabSettingsWidget::setTabSettings); + connect(m_preferences, &ICodeStylePreferences::currentPreferencesChanged, + this, &SimpleCodeStylePreferencesWidget::slotCurrentPreferencesChanged); + connect(m_tabSettingsWidget, &TabSettingsWidget::settingsChanged, + this, &SimpleCodeStylePreferencesWidget::slotTabSettingsChanged); } m_tabSettingsWidget->setEnabled(m_preferences); } diff --git a/src/plugins/texteditor/simplecodestylepreferenceswidget.h b/src/plugins/texteditor/simplecodestylepreferenceswidget.h index f3c5bb1f8c..0f433a746f 100644 --- a/src/plugins/texteditor/simplecodestylepreferenceswidget.h +++ b/src/plugins/texteditor/simplecodestylepreferenceswidget.h @@ -55,11 +55,10 @@ public: void setFlat(bool on); TabSettingsWidget *tabSettingsWidget() const; -private slots: +private: void slotCurrentPreferencesChanged(TextEditor::ICodeStylePreferences *preferences); void slotTabSettingsChanged(const TextEditor::TabSettings &settings); -private: TabSettingsWidget *m_tabSettingsWidget; ICodeStylePreferences *m_preferences; }; diff --git a/src/plugins/texteditor/snippets/snippetscollection.cpp b/src/plugins/texteditor/snippets/snippetscollection.cpp index 235eff9989..2efd8e7e0d 100644 --- a/src/plugins/texteditor/snippets/snippetscollection.cpp +++ b/src/plugins/texteditor/snippets/snippetscollection.cpp @@ -101,7 +101,8 @@ SnippetsCollection::SnippetsCollection() : foreach (const QFileInfo &fi, dir.entryInfoList()) m_builtInSnippetsFiles.append(fi.absoluteFilePath()); - connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(identifyGroups())); + connect(Core::ICore::instance(), &Core::ICore::coreOpened, + this, &SnippetsCollection::identifyGroups); } SnippetsCollection::~SnippetsCollection() diff --git a/src/plugins/texteditor/snippets/snippetscollection.h b/src/plugins/texteditor/snippets/snippetscollection.h index 447a6e19fe..18d1df6524 100644 --- a/src/plugins/texteditor/snippets/snippetscollection.h +++ b/src/plugins/texteditor/snippets/snippetscollection.h @@ -97,10 +97,9 @@ public: void reload(); bool synchronize(QString *errorString); -private slots: +private: void identifyGroups(); -private: SnippetsCollection(); int groupIndex(const QString &groupId) const; diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp index 44bbc6353a..96260eff2f 100644 --- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp +++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp @@ -281,7 +281,7 @@ public: QPointer m_widget; -private slots: +private: void loadSnippetGroup(int index); void markSnippetsCollection(); void addSnippet(); @@ -295,7 +295,6 @@ private slots: void updateCurrentSnippetDependent(const QModelIndex &modelIndex = QModelIndex()); void decorateEditors(const TextEditor::FontSettings &fontSettings); -private: SnippetEditorWidget *currentEditor() const; SnippetEditorWidget *editorAt(int i) const; @@ -341,7 +340,8 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w) SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w); provider->decorateEditor(snippetEditor); m_ui.snippetsEditorStack->insertWidget(m_ui.groupCombo->count() - 1, snippetEditor); - connect(snippetEditor, SIGNAL(snippetContentChanged()), this, SLOT(setSnippetContent())); + connect(snippetEditor, &SnippetEditorWidget::snippetContentChanged, + this, &SnippetsSettingsPagePrivate::setSnippetContent); } m_ui.snippetsTable->setModel(m_model); @@ -352,33 +352,40 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w) loadSettings(); loadSnippetGroup(m_ui.groupCombo->currentIndex()); - connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(selectSnippet(QModelIndex,int))); - connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(markSnippetsCollection())); - connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(markSnippetsCollection())); - connect(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), - this, SLOT(selectMovedSnippet(QModelIndex,int,int,QModelIndex,int))); - connect(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), - this, SLOT(markSnippetsCollection())); - connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(markSnippetsCollection())); - connect(m_model, SIGNAL(modelReset()), this, SLOT(updateCurrentSnippetDependent())); - connect(m_model, SIGNAL(modelReset()), this, SLOT(markSnippetsCollection())); - - connect(m_ui.groupCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSnippetGroup(int))); - connect(m_ui.addButton, SIGNAL(clicked()), this, SLOT(addSnippet())); - connect(m_ui.removeButton, SIGNAL(clicked()), this, SLOT(removeSnippet())); - connect(m_ui.resetAllButton, SIGNAL(clicked()), this, SLOT(resetAllSnippets())); - connect(m_ui.restoreRemovedButton, SIGNAL(clicked()), - this, SLOT(restoreRemovedBuiltInSnippets())); - connect(m_ui.revertButton, SIGNAL(clicked()), this, SLOT(revertBuiltInSnippet())); - connect(m_ui.snippetsTable->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(updateCurrentSnippetDependent(QModelIndex))); - - connect(TextEditorSettings::instance(), SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), - this, SLOT(decorateEditors(TextEditor::FontSettings))); + connect(m_model, &QAbstractItemModel::rowsInserted, + this, &SnippetsSettingsPagePrivate::selectSnippet); + connect(m_model, &QAbstractItemModel::rowsInserted, + this, &SnippetsSettingsPagePrivate::markSnippetsCollection); + connect(m_model, &QAbstractItemModel::rowsRemoved, + this, &SnippetsSettingsPagePrivate::markSnippetsCollection); + connect(m_model, &QAbstractItemModel::rowsMoved, + this, &SnippetsSettingsPagePrivate::selectMovedSnippet); + connect(m_model, &QAbstractItemModel::rowsMoved, + this, &SnippetsSettingsPagePrivate::markSnippetsCollection); + connect(m_model, &QAbstractItemModel::dataChanged, + this, &SnippetsSettingsPagePrivate::markSnippetsCollection); + connect(m_model, &QAbstractItemModel::modelReset, + this, [this] { this->updateCurrentSnippetDependent(); }); + connect(m_model, &QAbstractItemModel::modelReset, + this, &SnippetsSettingsPagePrivate::markSnippetsCollection); + + connect(m_ui.groupCombo, static_cast(&QComboBox::currentIndexChanged), + this, &SnippetsSettingsPagePrivate::loadSnippetGroup); + connect(m_ui.addButton, &QAbstractButton::clicked, + this, &SnippetsSettingsPagePrivate::addSnippet); + connect(m_ui.removeButton, &QAbstractButton::clicked, + this, &SnippetsSettingsPagePrivate::removeSnippet); + connect(m_ui.resetAllButton, &QAbstractButton::clicked, + this, &SnippetsSettingsPagePrivate::resetAllSnippets); + connect(m_ui.restoreRemovedButton, &QAbstractButton::clicked, + this, &SnippetsSettingsPagePrivate::restoreRemovedBuiltInSnippets); + connect(m_ui.revertButton, &QAbstractButton::clicked, + this, &SnippetsSettingsPagePrivate::revertBuiltInSnippet); + connect(m_ui.snippetsTable->selectionModel(), &QItemSelectionModel::currentChanged, + this, &SnippetsSettingsPagePrivate::updateCurrentSnippetDependent); + + connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged, + this, &SnippetsSettingsPagePrivate::decorateEditors); } void SnippetsSettingsPagePrivate::apply() diff --git a/src/plugins/texteditor/tabsettingswidget.cpp b/src/plugins/texteditor/tabsettingswidget.cpp index cafe17ac94..c3a8a97300 100644 --- a/src/plugins/texteditor/tabsettingswidget.cpp +++ b/src/plugins/texteditor/tabsettingswidget.cpp @@ -43,16 +43,18 @@ TabSettingsWidget::TabSettingsWidget(QWidget *parent) : ui->setupUi(this); ui->codingStyleWarning->setVisible(false); - connect(ui->codingStyleWarning, SIGNAL(linkActivated(QString)), - this, SLOT(codingStyleLinkActivated(QString))); - connect(ui->tabPolicy, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotSettingsChanged())); - connect(ui->tabSize, SIGNAL(valueChanged(int)), - this, SLOT(slotSettingsChanged())); - connect(ui->indentSize, SIGNAL(valueChanged(int)), - this, SLOT(slotSettingsChanged())); - connect(ui->continuationAlignBehavior, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotSettingsChanged())); + auto comboIndexChanged = static_cast(&QComboBox::currentIndexChanged); + auto spinValueChanged = static_cast(&QSpinBox::valueChanged); + connect(ui->codingStyleWarning, &QLabel::linkActivated, + this, &TabSettingsWidget::codingStyleLinkActivated); + connect(ui->tabPolicy, comboIndexChanged, + this, &TabSettingsWidget::slotSettingsChanged); + connect(ui->tabSize, spinValueChanged, + this, &TabSettingsWidget::slotSettingsChanged); + connect(ui->indentSize, spinValueChanged, + this, &TabSettingsWidget::slotSettingsChanged); + connect(ui->continuationAlignBehavior, comboIndexChanged, + this, &TabSettingsWidget::slotSettingsChanged); } TabSettingsWidget::~TabSettingsWidget() diff --git a/src/plugins/texteditor/tabsettingswidget.h b/src/plugins/texteditor/tabsettingswidget.h index 524b4559de..b139b04f12 100644 --- a/src/plugins/texteditor/tabsettingswidget.h +++ b/src/plugins/texteditor/tabsettingswidget.h @@ -58,19 +58,16 @@ public: void setFlat(bool on); void setCodingStyleWarningVisible(bool visible); - -public slots: void setTabSettings(const TextEditor::TabSettings& s); signals: void settingsChanged(const TextEditor::TabSettings &); void codingStyleLinkClicked(TextEditor::TabSettingsWidget::CodingStyleLink link); -private slots: +private: void slotSettingsChanged(); void codingStyleLinkActivated(const QString &linkString); -private: Internal::Ui::TabSettingsWidget *ui; }; diff --git a/src/plugins/texteditor/textdocument.h b/src/plugins/texteditor/textdocument.h index e33af2300e..0780b35e5c 100644 --- a/src/plugins/texteditor/textdocument.h +++ b/src/plugins/texteditor/textdocument.h @@ -136,7 +136,6 @@ public: void setCompletionAssistProvider(CompletionAssistProvider *provider); virtual CompletionAssistProvider *completionAssistProvider() const; -public slots: void setTabSettings(const TextEditor::TabSettings &tabSettings); void setFontSettings(const TextEditor::FontSettings &fontSettings); @@ -148,7 +147,7 @@ signals: void tabSettingsChanged(); void fontSettingsChanged(); -protected slots: +protected: virtual void applyFontSettings(); private: diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index fcd41336c2..5569d514d0 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -5311,17 +5311,17 @@ void TextEditorWidget::setCodeStyle(ICodeStylePreferences *preferences) { textDocument()->indenter()->setCodeStylePreferences(preferences); if (d->m_codeStylePreferences) { - disconnect(d->m_codeStylePreferences, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), - d->m_document.data(), SLOT(setTabSettings(TextEditor::TabSettings))); - disconnect(d->m_codeStylePreferences, SIGNAL(currentValueChanged(QVariant)), - this, SLOT(slotCodeStyleSettingsChanged(QVariant))); + disconnect(d->m_codeStylePreferences, &ICodeStylePreferences::currentTabSettingsChanged, + d->m_document.data(), &TextDocument::setTabSettings); + disconnect(d->m_codeStylePreferences, &ICodeStylePreferences::currentValueChanged, + this, &TextEditorWidget::slotCodeStyleSettingsChanged); } d->m_codeStylePreferences = preferences; if (d->m_codeStylePreferences) { - connect(d->m_codeStylePreferences, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), - d->m_document.data(), SLOT(setTabSettings(TextEditor::TabSettings))); - connect(d->m_codeStylePreferences, SIGNAL(currentValueChanged(QVariant)), - this, SLOT(slotCodeStyleSettingsChanged(QVariant))); + connect(d->m_codeStylePreferences, &ICodeStylePreferences::currentTabSettingsChanged, + d->m_document.data(), &TextDocument::setTabSettings); + connect(d->m_codeStylePreferences, &ICodeStylePreferences::currentValueChanged, + this, &TextEditorWidget::slotCodeStyleSettingsChanged); d->m_document->setTabSettings(d->m_codeStylePreferences->currentTabSettings()); slotCodeStyleSettingsChanged(d->m_codeStylePreferences->currentValue()); } diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 1333f77016..6cc4eb76e7 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -204,8 +204,8 @@ void TextEditorPlugin::extensionsInitialized() }); - connect(ExternalToolManager::instance(), SIGNAL(replaceSelectionRequested(QString)), - this, SLOT(updateCurrentSelection(QString))); + connect(ExternalToolManager::instance(), &ExternalToolManager::replaceSelectionRequested, + this, &TextEditorPlugin::updateCurrentSelection); } LineNumberFilter *TextEditorPlugin::lineNumberFilter() diff --git a/src/plugins/texteditor/texteditorplugin.h b/src/plugins/texteditor/texteditorplugin.h index 0303a6b859..b140a634af 100644 --- a/src/plugins/texteditor/texteditorplugin.h +++ b/src/plugins/texteditor/texteditorplugin.h @@ -61,12 +61,11 @@ public: static LineNumberFilter *lineNumberFilter(); static TextMarkRegistry *baseTextMarkRegistry(); -private slots: +private: void updateSearchResultsFont(const TextEditor::FontSettings &); void updateSearchResultsTabWidth(const TextEditor::TabSettings &tabSettings); void updateCurrentSelection(const QString &text); -private: TextEditorSettings *m_settings; LineNumberFilter *m_lineNumberFilter; OutlineFactory *m_outlineFactory; diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 689842add0..ccbcf77404 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -341,20 +341,20 @@ TextEditorSettings::TextEditorSettings(QObject *parent) new SnippetsSettingsPage(Constants::TEXT_EDITOR_SNIPPETS_SETTINGS, this); ExtensionSystem::PluginManager::addObject(d->m_snippetsSettingsPage); - connect(d->m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)), - this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings))); - connect(d->m_behaviorSettingsPage, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)), - this, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings))); - connect(d->m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), - this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings))); - connect(d->m_behaviorSettingsPage, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)), - this, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings))); - connect(d->m_behaviorSettingsPage, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)), - this, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings))); - connect(d->m_displaySettingsPage, SIGNAL(marginSettingsChanged(TextEditor::MarginSettings)), - this, SIGNAL(marginSettingsChanged(TextEditor::MarginSettings))); - connect(d->m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), - this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings))); + connect(d->m_fontSettingsPage, &FontSettingsPage::changed, + this, &TextEditorSettings::fontSettingsChanged); + connect(d->m_behaviorSettingsPage, &BehaviorSettingsPage::typingSettingsChanged, + this, &TextEditorSettings::typingSettingsChanged); + connect(d->m_behaviorSettingsPage, &BehaviorSettingsPage::storageSettingsChanged, + this, &TextEditorSettings::storageSettingsChanged); + connect(d->m_behaviorSettingsPage, &BehaviorSettingsPage::behaviorSettingsChanged, + this, &TextEditorSettings::behaviorSettingsChanged); + connect(d->m_behaviorSettingsPage, &BehaviorSettingsPage::extraEncodingSettingsChanged, + this, &TextEditorSettings::extraEncodingSettingsChanged); + connect(d->m_displaySettingsPage, &DisplaySettingsPage::marginSettingsChanged, + this, &TextEditorSettings::marginSettingsChanged); + connect(d->m_displaySettingsPage, &DisplaySettingsPage::displaySettingsChanged, + this, &TextEditorSettings::displaySettingsChanged); // TODO: Move these settings to TextEditor category d->m_completionSettings.fromSettings(QLatin1String("CppTools/"), Core::ICore::settings()); diff --git a/src/plugins/texteditor/texteditorsettings.h b/src/plugins/texteditor/texteditorsettings.h index 5d44425273..8607675f5e 100644 --- a/src/plugins/texteditor/texteditorsettings.h +++ b/src/plugins/texteditor/texteditorsettings.h @@ -103,6 +103,8 @@ public: static void registerMimeTypeForLanguageId(const char *mimeType, Core::Id languageId); static Core::Id languageId(const QString &mimeType); + void fontZoomRequested(int zoom); + void zoomResetRequested(); signals: void fontSettingsChanged(const TextEditor::FontSettings &); @@ -113,10 +115,6 @@ signals: void displaySettingsChanged(const TextEditor::DisplaySettings &); void completionSettingsChanged(const TextEditor::CompletionSettings &); void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &); - -public slots: - void fontZoomRequested(int zoom); - void zoomResetRequested(); }; } // namespace TextEditor diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp index f498485772..dac55472c6 100644 --- a/src/plugins/texteditor/textmark.cpp +++ b/src/plugins/texteditor/textmark.cpp @@ -221,13 +221,13 @@ void TextMark::setBaseTextDocument(TextDocument *baseTextDocument) TextMarkRegistry::TextMarkRegistry(QObject *parent) : QObject(parent) { - connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)), - SLOT(editorOpened(Core::IEditor*))); + connect(EditorManager::instance(), &EditorManager::editorOpened, + this, &TextMarkRegistry::editorOpened); - connect(DocumentManager::instance(), SIGNAL(allDocumentsRenamed(QString,QString)), - this, SLOT(allDocumentsRenamed(QString,QString))); - connect(DocumentManager::instance(), SIGNAL(documentRenamed(Core::IDocument*,QString,QString)), - this, SLOT(documentRenamed(Core::IDocument*,QString,QString))); + connect(DocumentManager::instance(), &DocumentManager::allDocumentsRenamed, + this, &TextMarkRegistry::allDocumentsRenamed); + connect(DocumentManager::instance(), &DocumentManager::documentRenamed, + this, &TextMarkRegistry::documentRenamed); } void TextMarkRegistry::add(TextMark *mark) diff --git a/src/plugins/texteditor/textmarkregistry.h b/src/plugins/texteditor/textmarkregistry.h index e68b548793..4c4745e367 100644 --- a/src/plugins/texteditor/textmarkregistry.h +++ b/src/plugins/texteditor/textmarkregistry.h @@ -61,11 +61,11 @@ public: Utils::Theme::Color categoryColor(Core::Id category); bool categoryHasColor(Core::Id category); void setCategoryColor(Core::Id category, Utils::Theme::Color color); -private slots: +private: void editorOpened(Core::IEditor *editor); void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName); void allDocumentsRenamed(const QString &oldName, const QString &newName); -private: + QHash > m_marks; QHash m_colors; }; -- cgit v1.2.3