aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/texteditorsettings.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-08-04 13:20:13 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-08-08 12:50:58 +0000
commitb92ac9a941281b22c6da551e1407314291aabcc8 (patch)
treef266696906ebcde234f628b7092ef6a1093681bb /src/plugins/texteditor/texteditorsettings.cpp
parent468a08bb2b6f23e2b7121587784b9e3414d0ed83 (diff)
TextEditor: Introduce a per-project variant of the comments settings
These settings can clearly differ per project. Note that the classes have to live in the ProjectExplorer plugin, which has a (questionable) dependency on TextEditor. Change-Id: I7e3816da30cecd1ccb66549a2226b44dc0a26cb4 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/texteditorsettings.cpp')
-rw-r--r--src/plugins/texteditor/texteditorsettings.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp
index 95d0fbfe78..d2ac16eb65 100644
--- a/src/plugins/texteditor/texteditorsettings.cpp
+++ b/src/plugins/texteditor/texteditorsettings.cpp
@@ -56,6 +56,8 @@ public:
QMap<Utils::Id, CodeStylePool *> m_languageToCodeStylePool;
QMap<QString, Utils::Id> m_mimeTypeToLanguage;
+ std::function<CommentsSettings::Data(const Utils::FilePath &)> m_retrieveCommentsSettings;
+
private:
static std::vector<FormatDescription> initialFormats();
};
@@ -503,9 +505,16 @@ const ExtraEncodingSettings &TextEditorSettings::extraEncodingSettings()
return d->m_behaviorSettingsPage.extraEncodingSettings();
}
-CommentsSettings::Data TextEditorSettings::commentsSettings()
+void TextEditorSettings::setCommentsSettingsRetriever(
+ const std::function<CommentsSettings::Data(const Utils::FilePath &)> &retrieve)
+{
+ d->m_retrieveCommentsSettings = retrieve;
+}
+
+CommentsSettings::Data TextEditorSettings::commentsSettings(const Utils::FilePath &filePath)
{
- return CommentsSettings::data();
+ QTC_ASSERT(d->m_retrieveCommentsSettings, return CommentsSettings::data());
+ return d->m_retrieveCommentsSettings(filePath);
}
void TextEditorSettings::registerCodeStyleFactory(ICodeStylePreferencesFactory *factory)