Commit 9d3b2f09 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

TextEditor: Use Qt5-style connects



The heavy lifting was done by clazy.

Change-Id: I380120e3419d2a3c0e272f51cc3e0d5f6aaa5e9b
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent b6131e1b
......@@ -122,7 +122,7 @@ ExternalToolManager::~ExternalToolManager()
delete d;
}
QObject *ExternalToolManager::instance()
ExternalToolManager *ExternalToolManager::instance()
{
return m_instance;
}
......
......@@ -50,7 +50,7 @@ public:
ExternalToolManager();
~ExternalToolManager();
static QObject *instance();
static ExternalToolManager *instance();
static QMap<QString, QList<Internal::ExternalTool *> > toolsByCategory();
static QMap<QString, Internal::ExternalTool *> toolsById();
static void setToolsByCategory(const QMap<QString, QList<Internal::ExternalTool *> > &tools);
......
......@@ -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<Core::SearchResultItem>,bool)),
this, SLOT(doReplace(QString,QList<Core::SearchResultItem>,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<FileFindParameters>();
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<FileSearchResultList> *watcher = new QFutureWatcher<FileSearchResultList>();
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)
......
......@@ -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);
......
......@@ -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();
}
......
......@@ -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,
......
......@@ -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<void (QComboBox::*)(int)>(&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()
......
......@@ -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;
......
......@@ -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);
......
......@@ -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();
......
......@@ -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<GenericProposalModel *>(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<void (QTimer::*)()>(&QTimer::start));
}
void GenericProposalWidget::setDisplayRect(const QRect &rect)
......
......@@ -66,8 +66,6 @@ private:
bool updateAndCheck(const QString &prefix);
void notifyActivation(int index);
void abort();
private slots:
void updatePositionAndSize();
void turnOffAutoWidth();
void turnOnAutoWidth();
......
......@@ -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);
......
......@@ -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;
......
......@@ -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());
......
......@@ -54,10 +54,9 @@ public:
void clearMargins();
private slots:
private:
void updatePreview();
private:
QVBoxLayout *m_layout;
ICodeStylePreferencesFactory *m_factory;
ICodeStylePreferences *m_codeStyle;
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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<void (QComboBox::*)(int)>(&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;
}
......
......@@ -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);