Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/DockedEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ DockedEditor::DockedEditor(QWidget *parent) : QObject(parent)
dockManager = new ads::CDockManager(parent);
dockManager->setStyleSheet("");

connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, this, [=](ads::CDockWidget* old, ads::CDockWidget* now) {
connect(dockManager, &ads::CDockManager::focusedDockWidgetChanged, this, [=, this](ads::CDockWidget* old, ads::CDockWidget* now) {
Q_UNUSED(old)

ScintillaNext *editor = qobject_cast<ScintillaNext *>(now->widget());
Expand All @@ -77,11 +77,11 @@ DockedEditor::DockedEditor(QWidget *parent) : QObject(parent)
emit editorActivated(editor);
});

connect(dockManager, &ads::CDockManager::dockAreaCreated, this, [=](ads::CDockAreaWidget* DockArea) {
connect(dockManager, &ads::CDockManager::dockAreaCreated, this, [=, this](ads::CDockAreaWidget* DockArea) {
DockedEditorTitleBar *titleBar = qobject_cast<DockedEditorTitleBar *>(DockArea->titleBar());
connect(titleBar, &DockedEditorTitleBar::doubleClicked, this, &DockedEditor::titleBarDoubleClicked);

connect(DockArea->titleBar()->tabBar(), &ads::CDockAreaTabBar::tabMoved, this, [=](int from, int to) {
connect(DockArea->titleBar()->tabBar(), &ads::CDockAreaTabBar::tabMoved, this, [=, this](int from, int to) {
Q_UNUSED(from);
Q_UNUSED(to);

Expand Down Expand Up @@ -175,7 +175,7 @@ void DockedEditor::addEditor(ScintillaNext *editor)
dockWidget->setFeature(ads::CDockWidget::DockWidgetFeature::DockWidgetFloatable, false);

dockWidget->tabWidget()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(dockWidget->tabWidget(), &QWidget::customContextMenuRequested, this, [=](const QPoint &pos) {
connect(dockWidget->tabWidget(), &QWidget::customContextMenuRequested, this, [=, this](const QPoint &pos) {
Q_UNUSED(pos)

emit contextMenuRequestedForEditor(editor);
Expand All @@ -195,7 +195,7 @@ void DockedEditor::addEditor(ScintillaNext *editor)
}
else {
dockWidget->tabWidget()->setIcon(QIcon(editor->canSaveToDisk() ? ":/icons/unsaved.png" : ":/icons/saved.png"));
connect(editor, &ScintillaNext::savePointChanged, dockWidget, [=](bool dirty) {
connect(editor, &ScintillaNext::savePointChanged, dockWidget, [=, this](bool dirty) {
Q_UNUSED(dirty)
const bool actuallyDirty = editor->canSaveToDisk();
const QString iconPath = actuallyDirty ? ":/icons/unsaved.png" : ":/icons/saved.png";
Expand All @@ -204,8 +204,8 @@ void DockedEditor::addEditor(ScintillaNext *editor)
}

connect(editor, &ScintillaNext::closed, dockWidget, &ads::CDockWidget::closeDockWidget);
connect(editor, &ScintillaNext::closed, this, [=]() { emit editorClosed(editor); });
connect(editor, &ScintillaNext::renamed, this, [=]() { editorRenamed(editor); });
connect(editor, &ScintillaNext::closed, this, [=, this]() { emit editorClosed(editor); });
connect(editor, &ScintillaNext::renamed, this, [=, this]() { editorRenamed(editor); });

connect(dockWidget, &ads::CDockWidget::closeRequested, this, &DockedEditor::dockWidgetCloseRequested);

Expand Down
24 changes: 12 additions & 12 deletions src/EditorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,40 @@ const int MARK_HIDELINESUNDERLINE = 21;
EditorManager::EditorManager(ApplicationSettings *settings, QObject *parent)
: QObject(parent), settings(settings)
{
connect(this, &EditorManager::editorCreated, this, [=](ScintillaNext *editor) {
connect(editor, &ScintillaNext::closed, this, [=]() {
connect(this, &EditorManager::editorCreated, this, [=, this](ScintillaNext *editor) {
connect(editor, &ScintillaNext::closed, this, [=, this]() {
emit editorClosed(editor);
});
});

connect(settings, &ApplicationSettings::showWrapSymbolChanged, this, [=](bool b) {
connect(settings, &ApplicationSettings::showWrapSymbolChanged, this, [=, this](bool b) {
for (auto &editor : getEditors()) {
editor->setWrapVisualFlags(b ? SC_WRAPVISUALFLAG_END : SC_WRAPVISUALFLAG_NONE);
}
});


connect(settings, &ApplicationSettings::showWhitespaceChanged, this, [=](bool b) {
connect(settings, &ApplicationSettings::showWhitespaceChanged, this, [=, this](bool b) {
// TODO: could make SCWS_VISIBLEALWAYS configurable via settings. Probably not worth
// taking up menu space e.g. show all, show leading, show trailing
for (auto &editor : getEditors()) {
editor->setViewWS(b ? SCWS_VISIBLEALWAYS : SCWS_INVISIBLE);
}
});

connect(settings, &ApplicationSettings::showEndOfLineChanged, this, [=](bool b) {
connect(settings, &ApplicationSettings::showEndOfLineChanged, this, [=, this](bool b) {
for (auto &editor : getEditors()) {
editor->setViewEOL(b);
}
});

connect(settings, &ApplicationSettings::showIndentGuideChanged, this, [=](bool b) {
connect(settings, &ApplicationSettings::showIndentGuideChanged, this, [=, this](bool b) {
for (auto &editor : getEditors()) {
editor->setIndentationGuides(b ? SC_IV_LOOKBOTH : SC_IV_NONE);
}
});

connect(settings, &ApplicationSettings::wordWrapChanged, this, [=](bool b) {
connect(settings, &ApplicationSettings::wordWrapChanged, this, [=, this](bool b) {
if (b) {
for (auto &editor : getEditors()) {
editor->setWrapMode(SC_WRAP_WORD);
Expand All @@ -95,23 +95,23 @@ EditorManager::EditorManager(ApplicationSettings *settings, QObject *parent)
}
});

connect(settings, &ApplicationSettings::fontNameChanged, this, [=](QString fontName){
connect(settings, &ApplicationSettings::fontNameChanged, this, [=, this](QString fontName){
for (auto &editor : getEditors()) {
for (int i = 0; i <= STYLE_MAX; ++i) {
editor->styleSetFont(i, fontName.toUtf8().data());
}
}
});

connect(settings, &ApplicationSettings::fontSizeChanged, this, [=](int fontSize){
connect(settings, &ApplicationSettings::fontSizeChanged, this, [=, this](int fontSize){
for (auto &editor : getEditors()) {
for (int i = 0; i <= STYLE_MAX; ++i) {
editor->styleSetSize(i, fontSize);
}
}
});

connect(settings, &ApplicationSettings::urlHighlightingChanged, this, [=](bool b){
connect(settings, &ApplicationSettings::urlHighlightingChanged, this, [=, this](bool b){
for (auto &editor : getEditors()) {
URLFinder *decorator = editor->findChild<URLFinder *>(QString(), Qt::FindDirectChildrenOnly);
if (decorator) {
Expand All @@ -120,7 +120,7 @@ EditorManager::EditorManager(ApplicationSettings *settings, QObject *parent)
}
});

connect(settings, &ApplicationSettings::showLineNumbersChanged, this, [=](bool b){
connect(settings, &ApplicationSettings::showLineNumbersChanged, this, [=, this](bool b){
for (auto &editor : getEditors()) {
LineNumbers *decorator = editor->findChild<LineNumbers *>(QString(), Qt::FindDirectChildrenOnly);
if (decorator) {
Expand All @@ -129,7 +129,7 @@ EditorManager::EditorManager(ApplicationSettings *settings, QObject *parent)
}
});

connect(settings, &ApplicationSettings::autoCompletionChanged, this, [=](bool b){
connect(settings, &ApplicationSettings::autoCompletionChanged, this, [=, this](bool b){
for (auto &editor : getEditors()) {
AutoCompletion *decorator = editor->findChild<AutoCompletion *>(QString(), Qt::FindDirectChildrenOnly);
if (decorator) {
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/BetterMultiSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void BetterMultiSelection::EditSelections(std::function<void(Selection &selectio
}

std::function<void(Selection &selection)> BetterMultiSelection::SimpleEdit(int message) {
return [=](Selection &selection) {
return [=, this](Selection &selection) {
editor->setSelection(selection.caret, selection.anchor);
editor->send(message);

Expand Down
2 changes: 1 addition & 1 deletion src/decorators/BraceMatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ BraceMatch::BraceMatch(ScintillaNext *editor) :
editor->indicSetUnder(braceBadlight, true);
editor->braceBadLightIndicator(true, braceBadlight);

connect(this, &EditorDecorator::stateChanged, [=](bool b) {
connect(this, &EditorDecorator::stateChanged, [=, this](bool b) {
if (b) {
doHighlighting();
}
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/HTMLAutoCompleteDecorator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static const QByteArrayList voidTags = { "area", "base", "br", "col", "embed", "
HTMLAutoCompleteDecorator::HTMLAutoCompleteDecorator(ScintillaNext *editor)
: EditorDecorator(editor)
{
connect(editor, &ScintillaNext::lexerChanged, this, [=]() {
connect(editor, &ScintillaNext::lexerChanged, this, [=, this]() {
QString language = editor->languageName;
setEnabled(language == "HTML");
});
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/LineNumbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ LineNumbers::LineNumbers(ScintillaNext *editor) :
{
editor->setMarginWidthN(0, 0);

connect(this, &EditorDecorator::stateChanged, editor, [=](bool b) {
connect(this, &EditorDecorator::stateChanged, editor, [=, this](bool b) {
if (b) {
adjustMarginWidth();
}
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/URLFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ URLFinder::URLFinder(ScintillaNext *editor) :
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, &URLFinder::findURLs);

connect(this, &EditorDecorator::stateChanged, this, [=](bool b) {
connect(this, &EditorDecorator::stateChanged, this, [=, this](bool b) {
if (b) {
connect(editor, &ScintillaNext::resized, timer, qOverload<>(&QTimer::start));
connect(editor, &ScintillaNext::reloaded, timer, qOverload<>(&QTimer::start));
Expand Down
8 changes: 4 additions & 4 deletions src/dialogs/ColumnEditorDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ ColumnEditorDialog::ColumnEditorDialog(MainWindow *parent) :
ui->sbxStep->setMaximum(std::numeric_limits<int>::max());
ui->sbxStep->setMinimum(std::numeric_limits<int>::min());

connect(ui->gbxText, &QGroupBox::toggled, ui->gbxNumbers, [=](bool on) {
connect(ui->gbxText, &QGroupBox::toggled, ui->gbxNumbers, [=, this](bool on) {
ui->gbxNumbers->setChecked(!on);
});

connect(ui->gbxNumbers, &QGroupBox::toggled, ui->gbxText, [=](bool on) {
connect(ui->gbxNumbers, &QGroupBox::toggled, ui->gbxText, [=, this](bool on) {
ui->gbxText->setChecked(!on);
});

connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [=]() {
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, [=, this]() {
if (ui->gbxText->isChecked() && !ui->txtText->text().isEmpty()) {
insertTextStartingAtCurrentColumn([=]() { return ui->txtText->text(); });
insertTextStartingAtCurrentColumn([=, this]() { return ui->txtText->text(); });
}
else if (ui->gbxNumbers->isChecked()) {
int currentValue = ui->sbxStart->value();
Expand Down
16 changes: 8 additions & 8 deletions src/dialogs/FindReplaceDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW
connect(ui->comboReplace, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), ui->comboReplace->lineEdit(), &QLineEdit::selectAll);

// Force focus on the find text box
connect(this, &FindReplaceDialog::windowActivated, [=]() {
connect(this, &FindReplaceDialog::windowActivated, [=, this]() {
ui->comboFind->setFocus();
ui->comboFind->lineEdit()->selectAll();
});

connect(this, &QDialog::rejected, [=]() {
connect(this, &QDialog::rejected, [=, this]() {
statusBar->clearMessage();
savePosition();
});

connect(ui->radioRegexSearch, &QRadioButton::toggled, this, [=](bool checked) {
connect(ui->radioRegexSearch, &QRadioButton::toggled, this, [=, this](bool checked) {
ui->checkBoxBackwardsDirection->setDisabled(checked);
ui->checkBoxMatchWholeWord->setDisabled(checked);
ui->checkBoxRegexMatchesNewline->setEnabled(checked);
Expand All @@ -102,7 +102,7 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW

connect(ui->buttonFind, &QPushButton::clicked, this, &FindReplaceDialog::find);
connect(ui->buttonCount, &QPushButton::clicked, this, &FindReplaceDialog::count);
connect(ui->buttonFindAllInCurrent, &QPushButton::clicked, this, [=]() {
connect(ui->buttonFindAllInCurrent, &QPushButton::clicked, this, [=, this]() {
prepareToPerformSearch();

searchResultsHandler->newSearch(findString());
Expand All @@ -113,7 +113,7 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW

close();
});
connect(ui->buttonFindAllInDocuments, &QPushButton::clicked, this, [=]() {
connect(ui->buttonFindAllInDocuments, &QPushButton::clicked, this, [=, this]() {
prepareToPerformSearch();

searchResultsHandler->newSearch(findString());
Expand All @@ -126,7 +126,7 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW
});
connect(ui->buttonReplace, &QPushButton::clicked, this, &FindReplaceDialog::replace);
connect(ui->buttonReplaceAll, &QPushButton::clicked, this, &FindReplaceDialog::replaceAll);
connect(ui->buttonReplaceAllInDocuments, &QPushButton::clicked, this, [=]() {
connect(ui->buttonReplaceAllInDocuments, &QPushButton::clicked, this, [=, this]() {
prepareToPerformSearch(true);

QString replaceText = replaceString();
Expand Down Expand Up @@ -424,10 +424,10 @@ void FindReplaceDialog::adjustOpacityWhenLosingFocus(bool checked)
qInfo(Q_FUNC_INFO);

if (checked) {
connect(this, &FindReplaceDialog::windowActivated, [=]() {
connect(this, &FindReplaceDialog::windowActivated, [=, this]() {
this->adjustOpacity(100);
});
connect(this, &FindReplaceDialog::windowDeactivated, [=]() {
connect(this, &FindReplaceDialog::windowDeactivated, [=, this]() {
this->adjustOpacity(ui->horizontalSlider->value());
});
adjustOpacity(100);
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/MacroRunDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MacroRunDialog::MacroRunDialog(QWidget *parent, MacroManager *mm) :
{
ui->setupUi(this);

connect(ui->buttonRun, &QPushButton::clicked, this, [=]() {
connect(ui->buttonRun, &QPushButton::clicked, this, [=, this]() {
Macro *selectedMacro = ui->comboBox->currentData().value<Macro*>();
int times = -1; // for end of file

Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/MacroSaveDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ MacroSaveDialog::MacroSaveDialog(QWidget *parent) :

ui->setupUi(this);

connect(ui->editName, &QLineEdit::textChanged, [=](const QString &text) {
connect(ui->editName, &QLineEdit::textChanged, [=, this](const QString &text) {
ui->buttonOk->setEnabled(text.trimmed().size() > 0);
});
}
Expand Down
20 changes: 10 additions & 10 deletions src/dialogs/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PreferencesDialog::PreferencesDialog(ApplicationSettings *settings, QWidget *par
MapSettingToCheckBox(ui->checkBoxRecenterSearchDialog, &ApplicationSettings::centerSearchDialog, &ApplicationSettings::setCenterSearchDialog, &ApplicationSettings::centerSearchDialogChanged);

MapSettingToGroupBox(ui->gbxRestorePreviousSession, &ApplicationSettings::restorePreviousSession, &ApplicationSettings::setRestorePreviousSession, &ApplicationSettings::restorePreviousSessionChanged);
connect(ui->gbxRestorePreviousSession, &QGroupBox::toggled, this, [=](bool checked) {
connect(ui->gbxRestorePreviousSession, &QGroupBox::toggled, this, [=, this](bool checked) {
if (!checked) {
ui->checkBoxUnsavedFiles->setChecked(false);
ui->checkBoxRestoreTempFiles->setChecked(false);
Expand All @@ -63,18 +63,18 @@ PreferencesDialog::PreferencesDialog(ApplicationSettings *settings, QWidget *par
MapSettingToCheckBox(ui->checkBoxCombineSearchResults, &ApplicationSettings::combineSearchResults, &ApplicationSettings::setCombineSearchResults, &ApplicationSettings::combineSearchResultsChanged);

populateTranslationComboBox();
connect(ui->comboBoxTranslation, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](int index) {
connect(ui->comboBoxTranslation, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=, this](int index) {
settings->setTranslation(ui->comboBoxTranslation->itemData(index).toString());
showApplicationRestartRequired();
});

MapSettingToCheckBox(ui->checkBoxExitOnLastTabClosed, &ApplicationSettings::exitOnLastTabClosed, &ApplicationSettings::setExitOnLastTabClosed, &ApplicationSettings::exitOnLastTabClosedChanged);

ui->fcbDefaultFont->setCurrentFont(QFont(settings->fontName()));
connect(ui->fcbDefaultFont, &QFontComboBox::currentFontChanged, this, [=](const QFont &f) {
connect(ui->fcbDefaultFont, &QFontComboBox::currentFontChanged, this, [=, this](const QFont &f) {
settings->setFontName(f.family());
});
connect(settings, &ApplicationSettings::fontNameChanged, this, [=](QString fontName){
connect(settings, &ApplicationSettings::fontNameChanged, this, [=, this](QString fontName){
ui->fcbDefaultFont->setCurrentFont(QFont(fontName));
});

Expand All @@ -91,10 +91,10 @@ PreferencesDialog::PreferencesDialog(ApplicationSettings *settings, QWidget *par
int index = ui->comboBoxLineEndings->findData(settings->defaultEOLMode());
ui->comboBoxLineEndings->setCurrentIndex(index == -1 ? 0 : index);

connect(ui->comboBoxLineEndings, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=](int index) {
connect(ui->comboBoxLineEndings, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=, this](int index) {
settings->setDefaultEOLMode(ui->comboBoxLineEndings->itemData(index).toString());
});
connect(settings, &ApplicationSettings::defaultEOLModeChanged, this, [=](QString defaultEOLMode) {
connect(settings, &ApplicationSettings::defaultEOLModeChanged, this, [=, this](QString defaultEOLMode) {
int index = ui->comboBoxLineEndings->findData(defaultEOLMode);
ui->comboBoxLineEndings->setCurrentIndex(index == -1 ? 0 : index);
});
Expand All @@ -108,25 +108,25 @@ PreferencesDialog::PreferencesDialog(ApplicationSettings *settings, QWidget *par
buttonGroup->addButton(ui->radioLastUsedDirectory, ApplicationSettings::RememberLastUsed);
buttonGroup->addButton(ui->radioHardCoded, ApplicationSettings::HardCoded);

connect(buttonGroup, &QButtonGroup::idClicked, this, [=](int id) {
connect(buttonGroup, &QButtonGroup::idClicked, this, [=, this](int id) {
ApplicationSettings::DefaultDirectoryBehaviorEnum e = static_cast<ApplicationSettings::DefaultDirectoryBehaviorEnum>(id);
settings->setDefaultDirectoryBehavior(e);
});

connect(ui->radioHardCoded, &QRadioButton::toggled, this, [=](bool checked){
connect(ui->radioHardCoded, &QRadioButton::toggled, this, [=, this](bool checked){
ui->btnSelectHardCodedPath->setEnabled(checked);
ui->txtHardCodedPath->setEnabled(checked);
});

connect(ui->btnSelectHardCodedPath, &QToolButton::clicked, this, [=]() {
connect(ui->btnSelectHardCodedPath, &QToolButton::clicked, this, [=, this]() {
QString dir = QFileDialog::getExistingDirectory(this, tr("Default Directory"));
if (dir.isEmpty()) return; // user cancelled

settings->setDefaultDirectory(QDir::fromNativeSeparators(dir));
ui->txtHardCodedPath->setText(QDir::toNativeSeparators(dir));
});

connect(ui->txtHardCodedPath, &QLineEdit::editingFinished, this, [=]() {
connect(ui->txtHardCodedPath, &QLineEdit::editingFinished, this, [=, this]() {
QString dir = ui->txtHardCodedPath->text();
settings->setDefaultDirectory(QDir::fromNativeSeparators(dir));
ui->txtHardCodedPath->setText(QDir::toNativeSeparators(dir));
Expand Down
2 changes: 1 addition & 1 deletion src/docks/DebugLogDock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ DebugLogDock::DebugLogDock(QWidget *parent) :
output = ui->txtDebugOutput;
DebugManager::addMessageHandler(debugLogDockMessageHandler);

connect(this, &QDockWidget::visibilityChanged, this, [=](bool visible) {
connect(this, &QDockWidget::visibilityChanged, this, [=, this](bool visible) {
if (visible) {
ui->txtDebugOutput->horizontalScrollBar()->setValue(0);
}
Expand Down
Loading
Loading