TextEditor: Drop some indirection of texteditor signalling

This is one of the few remaining users of the QObject inheritance of
IOptionPage.  While ok from an architectural point of view, this setup
is not and has not been used elsewhere, and eats a few bytes and cycles.

Change-Id: Id067f501d284d0726e8952345a2acd058dabbcd5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2020-02-03 08:54:44 +01:00
parent 4e4916ce35
commit 481a00c298
5 changed files with 10 additions and 30 deletions

View File

@@ -34,6 +34,7 @@
#include "simplecodestylepreferences.h"
#include "texteditorconstants.h"
#include "codestylepool.h"
#include "texteditorsettings.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
@@ -159,7 +160,7 @@ void BehaviorSettingsPage::apply()
if (s)
d->m_typingSettings.toSettings(d->m_settingsPrefix, s);
emit typingSettingsChanged(newTypingSettings);
emit TextEditorSettings::instance()->typingSettingsChanged(newTypingSettings);
}
if (newStorageSettings != d->m_storageSettings) {
@@ -167,7 +168,7 @@ void BehaviorSettingsPage::apply()
if (s)
d->m_storageSettings.toSettings(d->m_settingsPrefix, s);
emit storageSettingsChanged(newStorageSettings);
emit TextEditorSettings::instance()->storageSettingsChanged(newStorageSettings);
}
if (newBehaviorSettings != d->m_behaviorSettings) {
@@ -175,7 +176,7 @@ void BehaviorSettingsPage::apply()
if (s)
d->m_behaviorSettings.toSettings(d->m_settingsPrefix, s);
emit behaviorSettingsChanged(newBehaviorSettings);
emit TextEditorSettings::instance()->behaviorSettingsChanged(newBehaviorSettings);
}
if (newExtraEncodingSettings != d->m_extraEncodingSettings) {
@@ -183,7 +184,7 @@ void BehaviorSettingsPage::apply()
if (s)
d->m_extraEncodingSettings.toSettings(d->m_settingsPrefix, s);
emit extraEncodingSettingsChanged(newExtraEncodingSettings);
emit TextEditorSettings::instance()->extraEncodingSettingsChanged(newExtraEncodingSettings);
}
if (s) {

View File

@@ -61,12 +61,6 @@ public:
const BehaviorSettings &behaviorSettings() const;
const ExtraEncodingSettings &extraEncodingSettings() const;
signals:
void typingSettingsChanged(const TextEditor::TypingSettings &);
void storageSettingsChanged(const TextEditor::StorageSettings &);
void behaviorSettingsChanged(const TextEditor::BehaviorSettings &);
void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &);
private:
void openCodingStylePreferences(TextEditor::TabSettingsWidget::CodingStyleLink link);

View File

@@ -28,6 +28,7 @@
#include "displaysettings.h"
#include "marginsettings.h"
#include "texteditorconstants.h"
#include "texteditorsettings.h"
#include "ui_displaysettingspage.h"
#include <coreplugin/icore.h>
@@ -178,14 +179,14 @@ void DisplaySettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySe
d->m_displaySettings = newDisplaySettings;
d->m_displaySettings.toSettings(d->m_settingsPrefix, Core::ICore::settings());
emit displaySettingsChanged(newDisplaySettings);
emit TextEditorSettings::instance()->displaySettingsChanged(newDisplaySettings);
}
if (newMarginSettings != d->m_marginSettings) {
d->m_marginSettings = newMarginSettings;
d->m_marginSettings.toSettings(d->m_settingsPrefix, Core::ICore::settings());
emit marginSettingsChanged(newMarginSettings);
emit TextEditorSettings::instance()->marginSettingsChanged(newMarginSettings);
}
}

View File

@@ -50,10 +50,6 @@ public:
const DisplaySettings &displaySettings() const;
const MarginSettings &marginSettings() const;
signals:
void displaySettingsChanged(const TextEditor::DisplaySettings &);
void marginSettingsChanged(const TextEditor::MarginSettings &);
private:
void settingsFromUI(DisplaySettings &displaySettings, MarginSettings &marginSettings) const;
void settingsToUI();

View File

@@ -361,30 +361,18 @@ TextEditorSettings::TextEditorSettings()
connect(this, &TextEditorSettings::fontSettingsChanged,
this, updateGeneralMessagesFontSettings);
updateGeneralMessagesFontSettings();
connect(&d->m_behaviorSettingsPage, &BehaviorSettingsPage::typingSettingsChanged,
this, &TextEditorSettings::typingSettingsChanged);
connect(&d->m_behaviorSettingsPage, &BehaviorSettingsPage::storageSettingsChanged,
this, &TextEditorSettings::storageSettingsChanged);
auto updateGeneralMessagesBehaviorSettings = []() {
bool wheelZoom = d->m_behaviorSettingsPage.behaviorSettings().m_scrollWheelZooming;
Core::MessageManager::setWheelZoomEnabled(wheelZoom);
};
connect(&d->m_behaviorSettingsPage, &BehaviorSettingsPage::behaviorSettingsChanged,
this, &TextEditorSettings::behaviorSettingsChanged);
connect(&d->m_behaviorSettingsPage, &BehaviorSettingsPage::behaviorSettingsChanged,
connect(this, &TextEditorSettings::behaviorSettingsChanged,
this, updateGeneralMessagesBehaviorSettings);
updateGeneralMessagesBehaviorSettings();
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);
auto updateCamelCaseNavigation = [] {
Utils::FancyLineEdit::setCamelCaseNavigationEnabled(behaviorSettings().m_camelCaseNavigation);
};
connect(&d->m_behaviorSettingsPage, &BehaviorSettingsPage::behaviorSettingsChanged,
connect(this, &TextEditorSettings::behaviorSettingsChanged,
this, updateCamelCaseNavigation);
updateCamelCaseNavigation();
}