Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/NotepadNext/ApplicationSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ CREATE_SETTING(Editor, FontSize, fontSize, int, []() { return qApp->font().point
CREATE_SETTING(Editor, AdditionalWordChars, additionalWordChars, QString, QStringLiteral(""));
CREATE_SETTING(Editor, DefaultEOLMode, defaultEOLMode, QString, QStringLiteral(""))
CREATE_SETTING(Editor, URLHighlighting, urlHighlighting, bool, true)
CREATE_SETTING(Editor, ShowLineNumbers, showLineNumbers, bool, true)
1 change: 1 addition & 0 deletions src/NotepadNext/ApplicationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ class ApplicationSettings : public QSettings
DEFINE_SETTING(AdditionalWordChars, additionalWordChars, QString);
DEFINE_SETTING(DefaultEOLMode, defaultEOLMode, QString)
DEFINE_SETTING(URLHighlighting, urlHighlighting, bool)
DEFINE_SETTING(ShowLineNumbers, showLineNumbers, bool)
};
17 changes: 13 additions & 4 deletions src/NotepadNext/EditorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,18 @@ EditorManager::EditorManager(ApplicationSettings *settings, QObject *parent)

connect(settings, &ApplicationSettings::urlHighlightingChanged, this, [=](bool b){
for (auto &editor : getEditors()) {
URLFinder *urlFinder = editor->findChild<URLFinder *>(QString(), Qt::FindDirectChildrenOnly);
if (urlFinder) {
urlFinder->setEnabled(b);
URLFinder *decorator = editor->findChild<URLFinder *>(QString(), Qt::FindDirectChildrenOnly);
if (decorator) {
decorator->setEnabled(b);
}
}
});

connect(settings, &ApplicationSettings::showLineNumbersChanged, this, [=](bool b){
for (auto &editor : getEditors()) {
LineNumbers *decorator = editor->findChild<LineNumbers *>(QString(), Qt::FindDirectChildrenOnly);
if (decorator) {
decorator->setEnabled(b);
}
}
});
Expand Down Expand Up @@ -302,7 +311,7 @@ void EditorManager::setupEditor(ScintillaNext *editor)
b->setEnabled(true);

LineNumbers *l = new LineNumbers(editor);
l->setEnabled(true);
l->setEnabled(settings->showLineNumbers());

SurroundSelection *ss = new SurroundSelection(editor);
ss->setEnabled(true);
Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext/dialogs/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ PreferencesDialog::PreferencesDialog(ApplicationSettings *settings, QWidget *par
});

MapSettingToCheckBox(ui->checkBoxHighlightURLs, &ApplicationSettings::urlHighlighting, &ApplicationSettings::setURLHighlighting, &ApplicationSettings::urlHighlightingChanged);
MapSettingToCheckBox(ui->checkBoxShowLineNumbers, &ApplicationSettings::showLineNumbers, &ApplicationSettings::setShowLineNumbers, &ApplicationSettings::showLineNumbersChanged);
}

PreferencesDialog::~PreferencesDialog()
Expand Down
11 changes: 9 additions & 2 deletions src/NotepadNext/dialogs/PreferencesDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>803</width>
<height>564</height>
<height>597</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -25,7 +25,7 @@
<x>0</x>
<y>0</y>
<width>783</width>
<height>512</height>
<height>545</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
Expand Down Expand Up @@ -201,6 +201,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowLineNumbers">
<property name="text">
<string>Show Line Numbers</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
Expand Down