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() ...@@ -122,7 +122,7 @@ ExternalToolManager::~ExternalToolManager()
delete d; delete d;
} }
QObject *ExternalToolManager::instance() ExternalToolManager *ExternalToolManager::instance()
{ {
return m_instance; return m_instance;
} }
......
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
ExternalToolManager(); ExternalToolManager();
~ExternalToolManager(); ~ExternalToolManager();
static QObject *instance(); static ExternalToolManager *instance();
static QMap<QString, QList<Internal::ExternalTool *> > toolsByCategory(); static QMap<QString, QList<Internal::ExternalTool *> > toolsByCategory();
static QMap<QString, Internal::ExternalTool *> toolsById(); static QMap<QString, Internal::ExternalTool *> toolsById();
static void setToolsByCategory(const QMap<QString, QList<Internal::ExternalTool *> > &tools); static void setToolsByCategory(const QMap<QString, QList<Internal::ExternalTool *> > &tools);
......
...@@ -147,17 +147,15 @@ void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags, ...@@ -147,17 +147,15 @@ void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
parameters.nameFilters = fileNameFilters(); parameters.nameFilters = fileNameFilters();
parameters.additionalParameters = additionalParameters(); parameters.additionalParameters = additionalParameters();
search->setUserData(qVariantFromValue(parameters)); search->setUserData(qVariantFromValue(parameters));
connect(search, SIGNAL(activated(Core::SearchResultItem)), this, SLOT(openEditor(Core::SearchResultItem))); connect(search, &SearchResult::activated, this, &BaseFileFind::openEditor);
if (searchMode == SearchResultWindow::SearchAndReplace) { if (searchMode == SearchResultWindow::SearchAndReplace)
connect(search, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), connect(search, &SearchResult::replaceButtonClicked, this, &BaseFileFind::doReplace);
this, SLOT(doReplace(QString,QList<Core::SearchResultItem>,bool))); connect(search, &SearchResult::visibilityChanged, this, &BaseFileFind::hideHighlightAll);
} connect(search, &SearchResult::cancelled, this, &BaseFileFind::cancel);
connect(search, SIGNAL(visibilityChanged(bool)), this, SLOT(hideHighlightAll(bool))); connect(search, &SearchResult::paused, this, &BaseFileFind::setPaused);
connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); connect(search, &SearchResult::searchAgainRequested, this, &BaseFileFind::searchAgain);
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); connect(this, &BaseFileFind::enabledChanged, search, &SearchResult::requestEnabledCheck);
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain())); connect(search, &SearchResult::requestEnabledCheck, this, &BaseFileFind::recheckEnabled);
connect(this, SIGNAL(enabledChanged(bool)), search, SIGNAL(requestEnabledCheck()));
connect(search, SIGNAL(requestEnabledCheck()), this, SLOT(recheckEnabled()));
runSearch(search); runSearch(search);
} }
...@@ -166,15 +164,15 @@ void BaseFileFind::runSearch(SearchResult *search) ...@@ -166,15 +164,15 @@ void BaseFileFind::runSearch(SearchResult *search)
{ {
FileFindParameters parameters = search->userData().value<FileFindParameters>(); FileFindParameters parameters = search->userData().value<FileFindParameters>();
CountingLabel *label = new CountingLabel; CountingLabel *label = new CountingLabel;
connect(search, SIGNAL(countChanged(int)), label, SLOT(updateCount(int))); connect(search, &SearchResult::countChanged, label, &CountingLabel::updateCount);
CountingLabel *statusLabel = new CountingLabel; 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)); SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus));
QFutureWatcher<FileSearchResultList> *watcher = new QFutureWatcher<FileSearchResultList>(); QFutureWatcher<FileSearchResultList> *watcher = new QFutureWatcher<FileSearchResultList>();
d->m_watchers.insert(watcher, search); d->m_watchers.insert(watcher, search);
watcher->setPendingResultsLimit(1); watcher->setPendingResultsLimit(1);
connect(watcher, SIGNAL(resultReadyAt(int)), this, SLOT(displayResult(int))); connect(watcher, &QFutureWatcherBase::resultReadyAt, this, &BaseFileFind::displayResult);
connect(watcher, SIGNAL(finished()), this, SLOT(searchFinished())); connect(watcher, &QFutureWatcherBase::finished, this, &BaseFileFind::searchFinished);
if (parameters.flags & FindRegularExpression) { if (parameters.flags & FindRegularExpression) {
watcher->setFuture(Utils::findInFilesRegExp(parameters.text, watcher->setFuture(Utils::findInFilesRegExp(parameters.text,
files(parameters.nameFilters, parameters.additionalParameters), files(parameters.nameFilters, parameters.additionalParameters),
...@@ -190,7 +188,7 @@ void BaseFileFind::runSearch(SearchResult *search) ...@@ -190,7 +188,7 @@ void BaseFileFind::runSearch(SearchResult *search)
ProgressManager::addTask(watcher->future(), tr("Searching"), Constants::TASK_SEARCH); ProgressManager::addTask(watcher->future(), tr("Searching"), Constants::TASK_SEARCH);
progress->setWidget(label); progress->setWidget(label);
progress->setStatusBarWidget(statusLabel); 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) void BaseFileFind::findAll(const QString &txt, FindFlags findFlags)
......
...@@ -85,7 +85,7 @@ protected: ...@@ -85,7 +85,7 @@ protected:
void updateComboEntries(QComboBox *combo, bool onTop); void updateComboEntries(QComboBox *combo, bool onTop);
QStringList fileNameFilters() const; QStringList fileNameFilters() const;
private slots: private:
void displayResult(int index); void displayResult(int index);
void searchFinished(); void searchFinished();
void cancel(); void cancel();
...@@ -98,7 +98,6 @@ private slots: ...@@ -98,7 +98,6 @@ private slots:
void searchAgain(); void searchAgain();
void recheckEnabled(); void recheckEnabled();
private:
void runNewSearch(const QString &txt, Core::FindFlags findFlags, void runNewSearch(const QString &txt, Core::FindFlags findFlags,
Core::SearchResultWindow::SearchMode searchMode); Core::SearchResultWindow::SearchMode searchMode);
void runSearch(Core::SearchResult *search); void runSearch(Core::SearchResult *search);
......
...@@ -131,8 +131,8 @@ QWidget *BehaviorSettingsPage::widget() ...@@ -131,8 +131,8 @@ QWidget *BehaviorSettingsPage::widget()
TabSettingsWidget *tabSettingsWidget = d->m_page->behaviorWidget->tabSettingsWidget(); TabSettingsWidget *tabSettingsWidget = d->m_page->behaviorWidget->tabSettingsWidget();
tabSettingsWidget->setCodingStyleWarningVisible(true); tabSettingsWidget->setCodingStyleWarningVisible(true);
connect(tabSettingsWidget, SIGNAL(codingStyleLinkClicked(TextEditor::TabSettingsWidget::CodingStyleLink)), connect(tabSettingsWidget, &TabSettingsWidget::codingStyleLinkClicked,
this, SLOT(openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink))); this, &BehaviorSettingsPage::openCodingStylePreferences);
settingsToUI(); settingsToUI();
} }
......
...@@ -80,10 +80,9 @@ signals: ...@@ -80,10 +80,9 @@ signals:
void behaviorSettingsChanged(const TextEditor::BehaviorSettings &); void behaviorSettingsChanged(const TextEditor::BehaviorSettings &);
void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &); void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &);
private slots: private:
void openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink link); void openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink link);
private:
void settingsFromUI(TypingSettings *typingSettings, void settingsFromUI(TypingSettings *typingSettings,
StorageSettings *storageSettings, StorageSettings *storageSettings,
BehaviorSettings *behaviorSettings, BehaviorSettings *behaviorSettings,
......
...@@ -85,36 +85,37 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent) ...@@ -85,36 +85,37 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent)
d->m_codecs.prepend(QTextCodec::codecForLocale()); d->m_codecs.prepend(QTextCodec::codecForLocale());
} }
connect(d->m_ui.autoIndent, SIGNAL(toggled(bool)), auto currentIndexChanged = static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged);
this, SLOT(slotTypingSettingsChanged())); connect(d->m_ui.autoIndent, &QAbstractButton::toggled,
connect(d->m_ui.smartBackspaceBehavior, SIGNAL(currentIndexChanged(int)), this, &BehaviorSettingsWidget::slotTypingSettingsChanged);
this, SLOT(slotTypingSettingsChanged())); connect(d->m_ui.smartBackspaceBehavior, currentIndexChanged,
connect(d->m_ui.tabKeyBehavior, SIGNAL(currentIndexChanged(int)), this, &BehaviorSettingsWidget::slotTypingSettingsChanged);
this, SLOT(slotTypingSettingsChanged())); connect(d->m_ui.tabKeyBehavior, currentIndexChanged,
connect(d->m_ui.cleanWhitespace, SIGNAL(clicked(bool)), this, &BehaviorSettingsWidget::slotTypingSettingsChanged);
this, SLOT(slotStorageSettingsChanged())); connect(d->m_ui.cleanWhitespace, &QAbstractButton::clicked,
connect(d->m_ui.inEntireDocument, SIGNAL(clicked(bool)), this, &BehaviorSettingsWidget::slotStorageSettingsChanged);
this, SLOT(slotStorageSettingsChanged())); connect(d->m_ui.inEntireDocument, &QAbstractButton::clicked,
connect(d->m_ui.addFinalNewLine, SIGNAL(clicked(bool)), this, &BehaviorSettingsWidget::slotStorageSettingsChanged);
this, SLOT(slotStorageSettingsChanged())); connect(d->m_ui.addFinalNewLine, &QAbstractButton::clicked,
connect(d->m_ui.cleanIndentation, SIGNAL(clicked(bool)), this, &BehaviorSettingsWidget::slotStorageSettingsChanged);
this, SLOT(slotStorageSettingsChanged())); connect(d->m_ui.cleanIndentation, &QAbstractButton::clicked,
connect(d->m_ui.mouseHiding, SIGNAL(clicked()), this, &BehaviorSettingsWidget::slotStorageSettingsChanged);
this, SLOT(slotBehaviorSettingsChanged())); connect(d->m_ui.mouseHiding, &QAbstractButton::clicked,
connect(d->m_ui.mouseNavigation, SIGNAL(clicked()), this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged);
this, SLOT(slotBehaviorSettingsChanged())); connect(d->m_ui.mouseNavigation, &QAbstractButton::clicked,
connect(d->m_ui.scrollWheelZooming, SIGNAL(clicked(bool)), this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged);
this, SLOT(slotBehaviorSettingsChanged())); connect(d->m_ui.scrollWheelZooming, &QAbstractButton::clicked,
connect(d->m_ui.camelCaseNavigation, SIGNAL(clicked()), this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged);
this, SLOT(slotBehaviorSettingsChanged())); connect(d->m_ui.camelCaseNavigation, &QAbstractButton::clicked,
connect(d->m_ui.utf8BomBox, SIGNAL(currentIndexChanged(int)), this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged);
this, SLOT(slotExtraEncodingChanged())); connect(d->m_ui.utf8BomBox, currentIndexChanged,
connect(d->m_ui.encodingBox, SIGNAL(currentIndexChanged(int)), this, &BehaviorSettingsWidget::slotExtraEncodingChanged);
this, SLOT(slotEncodingBoxChanged(int))); connect(d->m_ui.encodingBox, currentIndexChanged,
connect(d->m_ui.constrainTooltipsBox, SIGNAL(currentIndexChanged(int)), this, &BehaviorSettingsWidget::slotEncodingBoxChanged);
this, SLOT(slotBehaviorSettingsChanged())); connect(d->m_ui.constrainTooltipsBox, currentIndexChanged,
connect(d->m_ui.keyboardTooltips, SIGNAL(clicked()), this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged);
this, SLOT(slotBehaviorSettingsChanged())); connect(d->m_ui.keyboardTooltips, &QAbstractButton::clicked,
this, &BehaviorSettingsWidget::slotBehaviorSettingsChanged);
} }
BehaviorSettingsWidget::~BehaviorSettingsWidget() BehaviorSettingsWidget::~BehaviorSettingsWidget()
......
...@@ -86,14 +86,12 @@ signals: ...@@ -86,14 +86,12 @@ signals:
void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &settings); void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &settings);
void textCodecChanged(QTextCodec *codec); void textCodecChanged(QTextCodec *codec);
private slots: private:
void slotTypingSettingsChanged(); void slotTypingSettingsChanged();
void slotStorageSettingsChanged(); void slotStorageSettingsChanged();
void slotBehaviorSettingsChanged(); void slotBehaviorSettingsChanged();
void slotExtraEncodingChanged(); void slotExtraEncodingChanged();
void slotEncodingBoxChanged(int index); void slotEncodingBoxChanged(int index);
private:
void updateConstrainTooltipsBoxTooltip() const; void updateConstrainTooltipsBoxTooltip() const;
BehaviorSettingsWidgetPrivate *d; BehaviorSettingsWidgetPrivate *d;
......
...@@ -113,8 +113,8 @@ FunctionHintProposalWidget::FunctionHintProposalWidget() ...@@ -113,8 +113,8 @@ FunctionHintProposalWidget::FunctionHintProposalWidget()
popupLayout->addWidget(d->m_pager); popupLayout->addWidget(d->m_pager);
popupLayout->addWidget(d->m_hintLabel); popupLayout->addWidget(d->m_hintLabel);
connect(upArrow, SIGNAL(clicked()), SLOT(previousPage())); connect(upArrow, &QAbstractButton::clicked, this, &FunctionHintProposalWidget::previousPage);
connect(downArrow, SIGNAL(clicked()), SLOT(nextPage())); connect(downArrow, &QAbstractButton::clicked, this, &FunctionHintProposalWidget::nextPage);
connect(d->m_popupFrame.data(), &QObject::destroyed, this, &FunctionHintProposalWidget::abort); connect(d->m_popupFrame.data(), &QObject::destroyed, this, &FunctionHintProposalWidget::abort);
setFocusPolicy(Qt::NoFocus); setFocusPolicy(Qt::NoFocus);
......
...@@ -61,11 +61,9 @@ public: ...@@ -61,11 +61,9 @@ public:
protected: protected:
bool eventFilter(QObject *o, QEvent *e) override; bool eventFilter(QObject *o, QEvent *e) override;
private slots: private:
void nextPage(); void nextPage();
void previousPage(); void previousPage();
private:
bool updateAndCheck(const QString &prefix); bool updateAndCheck(const QString &prefix);
void updateContent(); void updateContent();
void updatePosition(); void updatePosition();
......
...@@ -265,7 +265,6 @@ public: ...@@ -265,7 +265,6 @@ public:
CodeAssistant *m_assistant; CodeAssistant *m_assistant;
bool m_autoWidth; bool m_autoWidth;
public slots:
void handleActivation(const QModelIndex &modelIndex); void handleActivation(const QModelIndex &modelIndex);
void maybeShowInfoTip(); void maybeShowInfoTip();
}; };
...@@ -280,12 +279,12 @@ GenericProposalWidgetPrivate::GenericProposalWidgetPrivate(QWidget *completionWi ...@@ -280,12 +279,12 @@ GenericProposalWidgetPrivate::GenericProposalWidgetPrivate(QWidget *completionWi
, m_assistant(0) , m_assistant(0)
, m_autoWidth(true) , m_autoWidth(true)
{ {
connect(m_completionListView, SIGNAL(activated(QModelIndex)), connect(m_completionListView, &QAbstractItemView::activated,
this, SLOT(handleActivation(QModelIndex))); this, &GenericProposalWidgetPrivate::handleActivation);
m_infoTimer.setInterval(Constants::COMPLETION_ASSIST_TOOLTIP_DELAY); m_infoTimer.setInterval(Constants::COMPLETION_ASSIST_TOOLTIP_DELAY);
m_infoTimer.setSingleShot(true); 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) void GenericProposalWidgetPrivate::handleActivation(const QModelIndex &modelIndex)
...@@ -342,12 +341,12 @@ GenericProposalWidget::GenericProposalWidget() ...@@ -342,12 +341,12 @@ GenericProposalWidget::GenericProposalWidget()
d->m_completionListView->setSelectionMode(QAbstractItemView::SingleSelection); d->m_completionListView->setSelectionMode(QAbstractItemView::SingleSelection);
d->m_completionListView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); d->m_completionListView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
d->m_completionListView->setMinimumSize(1, 1); d->m_completionListView->setMinimumSize(1, 1);
connect(d->m_completionListView->verticalScrollBar(), SIGNAL(valueChanged(int)), connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::valueChanged,
this, SLOT(updatePositionAndSize())); this, &GenericProposalWidget::updatePositionAndSize);
connect(d->m_completionListView->verticalScrollBar(), SIGNAL(sliderPressed()), connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::sliderPressed,
this, SLOT(turnOffAutoWidth())); this, &GenericProposalWidget::turnOffAutoWidth);
connect(d->m_completionListView->verticalScrollBar(), SIGNAL(sliderReleased()), connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::sliderReleased,
this, SLOT(turnOnAutoWidth())); this, &GenericProposalWidget::turnOnAutoWidth);
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0); layout->setMargin(0);
...@@ -394,10 +393,8 @@ void GenericProposalWidget::setModel(IAssistProposalModel *model) ...@@ -394,10 +393,8 @@ void GenericProposalWidget::setModel(IAssistProposalModel *model)
d->m_model = static_cast<GenericProposalModel *>(model); d->m_model = static_cast<GenericProposalModel *>(model);
d->m_completionListView->setModel(new ModelAdapter(d->m_model, d->m_completionListView)); d->m_completionListView->setModel(new ModelAdapter(d->m_model, d->m_completionListView));
connect(d->m_completionListView->selectionModel(), connect(d->m_completionListView->selectionModel(), &QItemSelectionModel::currentChanged,
SIGNAL(currentChanged(QModelIndex,QModelIndex)), &d->m_infoTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
&d->m_infoTimer,
SLOT(start()));
} }
void GenericProposalWidget::setDisplayRect(const QRect &rect) void GenericProposalWidget::setDisplayRect(const QRect &rect)
......
...@@ -66,8 +66,6 @@ private: ...@@ -66,8 +66,6 @@ private:
bool updateAndCheck(const QString &prefix); bool updateAndCheck(const QString &prefix);
void notifyActivation(int index); void notifyActivation(int index);
void abort(); void abort();
private slots:
void updatePositionAndSize(); void updatePositionAndSize();
void turnOffAutoWidth(); void turnOffAutoWidth();
void turnOnAutoWidth(); void turnOnAutoWidth();
......
...@@ -122,14 +122,14 @@ CodecSelector::CodecSelector(QWidget *parent, TextDocument *doc) ...@@ -122,14 +122,14 @@ CodecSelector::CodecSelector(QWidget *parent, TextDocument *doc)
if (currentIndex >= 0) if (currentIndex >= 0)
m_listWidget->setCurrentRow(currentIndex); 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_dialogButtonBox = new QDialogButtonBox(this);
m_reloadButton = m_dialogButtonBox->addButton(tr("Reload with Encoding"), QDialogButtonBox::DestructiveRole); m_reloadButton = m_dialogButtonBox->addButton(tr("Reload with Encoding"), QDialogButtonBox::DestructiveRole);
m_saveButton = m_dialogButtonBox->addButton(tr("Save with Encoding"), QDialogButtonBox::DestructiveRole); m_saveButton = m_dialogButtonBox->addButton(tr("Save with Encoding"), QDialogButtonBox::DestructiveRole);
m_dialogButtonBox->addButton(QDialogButtonBox::Cancel); m_dialogButtonBox->addButton(QDialogButtonBox::Cancel);
connect(m_dialogButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); connect(m_dialogButtonBox, &QDialogButtonBox::clicked, this, &CodecSelector::buttonClicked);
connect(m_listWidget, SIGNAL(activated(QModelIndex)), m_reloadButton, SLOT(click())); connect(m_listWidget, &QAbstractItemView::activated, m_reloadButton, &QAbstractButton::click);
QVBoxLayout *vbox = new QVBoxLayout(this); QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->addWidget(m_label); vbox->addWidget(m_label);
......
...@@ -60,11 +60,10 @@ public: ...@@ -60,11 +60,10 @@ public:
Cancel, Reload, Save Cancel, Reload, Save
}; };
private slots: private:
void updateButtons(); void updateButtons();
void buttonClicked(QAbstractButton *button); void buttonClicked(QAbstractButton *button);
private:
bool m_hasDecodingError; bool m_hasDecodingError;
bool m_isModified; bool m_isModified;
QLabel *m_label; QLabel *m_label;
......
...@@ -73,12 +73,12 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, ...@@ -73,12 +73,12 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory,
m_layout->addWidget(selector); m_layout->addWidget(selector);
m_layout->addWidget(m_preview); m_layout->addWidget(m_preview);
m_layout->addWidget(label); m_layout->addWidget(label);
connect(codeStyle, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), connect(codeStyle, &ICodeStylePreferences::currentTabSettingsChanged,
this, SLOT(updatePreview())); this, &CodeStyleEditor::updatePreview);
connect(codeStyle, SIGNAL(currentValueChanged(QVariant)), connect(codeStyle, &ICodeStylePreferences::currentValueChanged,
this, SLOT(updatePreview())); this, &CodeStyleEditor::updatePreview);
connect(codeStyle, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), connect(codeStyle, &ICodeStylePreferences::currentPreferencesChanged,
this, SLOT(updatePreview())); this, &CodeStyleEditor::updatePreview);
m_preview->setCodeStyle(m_codeStyle); m_preview->setCodeStyle(m_codeStyle);
m_preview->setPlainText(factory->previewText()); m_preview->setPlainText(factory->previewText());
......
...@@ -54,10 +54,9 @@ public: ...@@ -54,10 +54,9 @@ public:
void clearMargins(); void clearMargins();
private slots: private:
void updatePreview(); void updatePreview();
private:
QVBoxLayout *m_layout; QVBoxLayout *m_layout;
ICodeStylePreferencesFactory *m_factory; ICodeStylePreferencesFactory *m_factory;
ICodeStylePreferences *m_codeStyle; ICodeStylePreferences *m_codeStyle;
......
...@@ -185,9 +185,12 @@ void CodeStylePool::addCodeStyle(ICodeStylePreferences *codeStyle) ...@@ -185,9 +185,12 @@ void CodeStylePool::addCodeStyle(ICodeStylePreferences *codeStyle)
// take ownership // take ownership
codeStyle->setParent(this); codeStyle->setParent(this);
connect(codeStyle, SIGNAL(valueChanged(QVariant)), this, SLOT(slotSaveCodeStyle())); connect(codeStyle, &ICodeStylePreferences::valueChanged,
connect(codeStyle, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)), this, SLOT(slotSaveCodeStyle())); this, &CodeStylePool::slotSaveCodeStyle);
connect(codeStyle, SIGNAL(displayNameChanged(QString)), this, SLOT(slotSaveCodeStyle())); connect(codeStyle, &ICodeStylePreferences::tabSettingsChanged,
this, &CodeStylePool::slotSaveCodeStyle);
connect(codeStyle, &ICodeStylePreferences::displayNameChanged,
this, &CodeStylePool::slotSaveCodeStyle);
emit codeStyleAdded(codeStyle); emit codeStyleAdded(codeStyle);
} }
......
...@@ -74,10 +74,9 @@ signals: ...@@ -74,10 +74,9 @@ signals:
void codeStyleAdded(ICodeStylePreferences *); void codeStyleAdded(ICodeStylePreferences *);
void codeStyleRemoved(ICodeStylePreferences *); void codeStyleRemoved(ICodeStylePreferences *);
private slots: private:
void slotSaveCodeStyle(); void slotSaveCodeStyle();
private:
QString settingsDir() const; QString settingsDir() const;
Utils::FileName settingsPath(const QByteArray &id) const; Utils::FileName settingsPath(const QByteArray &id) const;
ICodeStylePreferences *loadCodeStyle(const Utils::FileName &fileName); ICodeStylePreferences *loadCodeStyle(const Utils::FileName &fileName);
......
...@@ -60,10 +60,10 @@ public: ...@@ -60,10 +60,10 @@ public:
ICodeStylePreferences *codeStyle, QWidget *parent = 0); ICodeStylePreferences *codeStyle, QWidget *parent = 0);
~CodeStyleDialog(); ~CodeStyleDialog();
ICodeStylePreferences *codeStyle() const; ICodeStylePreferences *codeStyle() const;
private slots: private:
void slotCopyClicked(); void slotCopyClicked();
void slotDisplayNameChanged(); void slotDisplayNameChanged();
private:
ICodeStylePreferences *m_codeStyle; ICodeStylePreferences *m_codeStyle;
QLineEdit *m_lineEdit; QLineEdit *m_lineEdit;
QDialogButtonBox *m_buttons; QDialogButtonBox *m_buttons;
...@@ -98,8 +98,7 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory, ...@@ -98,8 +98,7 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory,
m_warningLabel->setWordWrap(true); m_warningLabel->setWordWrap(true);
m_copyButton = new QPushButton(tr("Copy Built-in Code Style"), this); m_copyButton = new QPushButton(tr("Copy Built-in Code Style"), this);
m_copyButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_copyButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(m_copyButton, SIGNAL(clicked()), connect(m_copyButton, &QAbstractButton::clicked, this, &CodeStyleDialog::slotCopyClicked);
this, SLOT(slotCopyClicked()));
warningLayout->addWidget(m_warningLabel); warningLayout->addWidget(m_warningLabel);
warningLayout->addWidget(m_copyButton); warningLayout->addWidget(m_copyButton);
layout->addLayout(warningLayout); layout->addLayout(warningLayout);
...@@ -125,9 +124,9 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory, ...@@ -125,9 +124,9 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory,
layout->addWidget(m_buttons); layout->addWidget(m_buttons);
resize(850, 600); resize(850, 600);
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotDisplayNameChanged())); connect(m_lineEdit, &QLineEdit::textChanged, this,