2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include "texteditor_global.h"
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
#include <utils/id.h>
|
2012-11-21 21:47:17 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-03 15:48:14 +01:00
|
|
|
QT_BEGIN_NAMESPACE
|
2016-08-24 00:41:03 +03:00
|
|
|
template <typename Key, typename T>
|
2011-02-03 15:48:14 +01:00
|
|
|
class QMap;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace TextEditor {
|
|
|
|
|
|
|
|
|
|
class FontSettings;
|
2011-08-16 10:45:23 +02:00
|
|
|
class TypingSettings;
|
2010-08-13 12:53:36 +02:00
|
|
|
class StorageSettings;
|
|
|
|
|
class BehaviorSettings;
|
2014-01-09 14:44:25 +01:00
|
|
|
class MarginSettings;
|
2010-08-13 12:53:36 +02:00
|
|
|
class DisplaySettings;
|
|
|
|
|
class CompletionSettings;
|
2010-06-04 10:13:38 +02:00
|
|
|
class HighlighterSettings;
|
2011-02-01 14:13:54 +01:00
|
|
|
class ExtraEncodingSettings;
|
2011-08-16 10:45:23 +02:00
|
|
|
class ICodeStylePreferences;
|
|
|
|
|
class ICodeStylePreferencesFactory;
|
|
|
|
|
class CodeStylePool;
|
2016-05-19 12:25:16 +02:00
|
|
|
class CommentsSettings;
|
2010-05-10 18:30:09 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
/**
|
|
|
|
|
* This class provides a central place for basic text editor settings. These
|
2009-12-08 17:37:40 +01:00
|
|
|
* settings include font settings, tab settings, storage settings, behavior
|
2010-05-10 18:30:09 +02:00
|
|
|
* settings, display settings and completion settings.
|
2008-12-02 12:01:29 +01:00
|
|
|
*/
|
|
|
|
|
class TEXTEDITOR_EXPORT TextEditorSettings : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-02-06 14:00:12 +01:00
|
|
|
TextEditorSettings();
|
2018-05-07 15:02:41 +02:00
|
|
|
~TextEditorSettings() override;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
static TextEditorSettings *instance();
|
|
|
|
|
|
2013-09-19 17:59:27 +02:00
|
|
|
static const FontSettings &fontSettings();
|
|
|
|
|
static const TypingSettings &typingSettings();
|
|
|
|
|
static const StorageSettings &storageSettings();
|
|
|
|
|
static const BehaviorSettings &behaviorSettings();
|
2014-01-09 14:44:25 +01:00
|
|
|
static const MarginSettings &marginSettings();
|
2013-09-19 17:59:27 +02:00
|
|
|
static const DisplaySettings &displaySettings();
|
|
|
|
|
static const CompletionSettings &completionSettings();
|
|
|
|
|
static const HighlighterSettings &highlighterSettings();
|
|
|
|
|
static const ExtraEncodingSettings &extraEncodingSettings();
|
2016-05-19 12:25:16 +02:00
|
|
|
static const CommentsSettings &commentsSettings();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
static ICodeStylePreferencesFactory *codeStyleFactory(Utils::Id languageId);
|
|
|
|
|
static const QMap<Utils::Id, ICodeStylePreferencesFactory *> &codeStyleFactories();
|
2013-09-19 17:59:27 +02:00
|
|
|
static void registerCodeStyleFactory(ICodeStylePreferencesFactory *codeStyleFactory);
|
2020-06-26 13:59:38 +02:00
|
|
|
static void unregisterCodeStyleFactory(Utils::Id languageId);
|
2011-02-03 15:48:14 +01:00
|
|
|
|
2013-09-19 17:59:27 +02:00
|
|
|
static CodeStylePool *codeStylePool();
|
2020-06-26 13:59:38 +02:00
|
|
|
static CodeStylePool *codeStylePool(Utils::Id languageId);
|
|
|
|
|
static void registerCodeStylePool(Utils::Id languageId, CodeStylePool *pool);
|
|
|
|
|
static void unregisterCodeStylePool(Utils::Id languageId);
|
2011-08-16 10:45:23 +02:00
|
|
|
|
2013-09-19 17:59:27 +02:00
|
|
|
static ICodeStylePreferences *codeStyle();
|
2020-06-26 13:59:38 +02:00
|
|
|
static ICodeStylePreferences *codeStyle(Utils::Id languageId);
|
|
|
|
|
static QMap<Utils::Id, ICodeStylePreferences *> codeStyles();
|
|
|
|
|
static void registerCodeStyle(Utils::Id languageId, ICodeStylePreferences *prefs);
|
|
|
|
|
static void unregisterCodeStyle(Utils::Id languageId);
|
2011-02-03 15:48:14 +01:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
static void registerMimeTypeForLanguageId(const char *mimeType, Utils::Id languageId);
|
|
|
|
|
static Utils::Id languageId(const QString &mimeType);
|
2015-12-18 10:28:00 +02:00
|
|
|
static int increaseFontZoom(int step);
|
|
|
|
|
static void resetFontZoom();
|
2011-08-05 09:59:28 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
|
|
|
|
void fontSettingsChanged(const TextEditor::FontSettings &);
|
2011-08-16 10:45:23 +02:00
|
|
|
void typingSettingsChanged(const TextEditor::TypingSettings &);
|
2008-12-02 12:01:29 +01:00
|
|
|
void storageSettingsChanged(const TextEditor::StorageSettings &);
|
2009-12-08 17:37:40 +01:00
|
|
|
void behaviorSettingsChanged(const TextEditor::BehaviorSettings &);
|
2014-01-09 14:44:25 +01:00
|
|
|
void marginSettingsChanged(const TextEditor::MarginSettings &);
|
2008-12-02 12:01:29 +01:00
|
|
|
void displaySettingsChanged(const TextEditor::DisplaySettings &);
|
2010-05-10 18:30:09 +02:00
|
|
|
void completionSettingsChanged(const TextEditor::CompletionSettings &);
|
2011-02-01 14:13:54 +01:00
|
|
|
void extraEncodingSettingsChanged(const TextEditor::ExtraEncodingSettings &);
|
2016-05-19 12:25:16 +02:00
|
|
|
void commentsSettingsChanged(const TextEditor::CommentsSettings &);
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace TextEditor
|