10#include <ktexteditor_export.h>
12#include <ktexteditor/document.h>
13#include <ktexteditor/view.h>
78 return m_parent ? m_parent->configKeys() : *m_configKeys.get();
88 return m_configEntries.find(key) != m_configEntries.end();
106 bool setValue(
const int key,
const QVariant &value);
152 , configKey(configId)
153 , commandName(command)
154 , defaultValue(defaultVal)
218 void finalizeConfigEntries();
230 const std::map<int, ConfigEntry> &fullConfigEntries()
const
232 return m_parent ? m_parent->fullConfigEntries() : m_configEntries;
240 return m_parent ? m_parent->fullConfigKeyToEntry() : *m_configKeyToEntry.get();
256 std::map<int, ConfigEntry> m_configEntries;
261 std::unique_ptr<QStringList> m_configKeys;
266 std::unique_ptr<QHash<QString, const ConfigEntry *>> m_configKeyToEntry;
272 int configSessionNumber = 0;
275class KTEXTEDITOR_EXPORT KateGlobalConfig :
public KateConfig
286 static KateGlobalConfig *global()
294 enum ConfigEntryTypes {
318 void updateConfig()
override;
321 QString fallbackEncoding()
const
323 return value(FallbackEncoding).toString();
326 bool setFallbackEncoding(
const QString &encoding)
328 return setValue(FallbackEncoding, encoding);
332 static KateGlobalConfig *s_global;
335class KTEXTEDITOR_EXPORT KateDocumentConfig :
public KateConfig
340 KateDocumentConfig();
348 inline static KateDocumentConfig *global()
356 enum ConfigEntryTypes {
380 ReplaceTabsWithSpaces,
420 StaticWordWrapColumn,
425 PageUpDownMovesCursor,
490 AllowEndOfLineDetection,
510 SwapFileSyncInterval,
543 AutoReloadIfStateIsInVersionControl,
563 void updateConfig()
override;
568 return value(TabWidth).toInt();
571 void setTabWidth(
int tabWidth)
573 setValue(TabWidth,
QVariant(tabWidth));
576 int indentationWidth()
const
578 return value(IndentationWidth).toInt();
581 void setIndentationWidth(
int indentationWidth)
583 setValue(IndentationWidth,
QVariant(indentationWidth));
586 bool onTheFlySpellCheck()
const
588 return value(OnTheFlySpellCheck).toBool();
591 void setOnTheFlySpellCheck(
bool on)
593 setValue(OnTheFlySpellCheck,
QVariant(on));
596 bool indentPastedText()
const
598 return value(IndentOnTextPaste).toBool();
601 void setIndentPastedText(
bool on)
603 setValue(IndentOnTextPaste,
QVariant(on));
606 bool replaceTabsDyn()
const
608 return value(ReplaceTabsWithSpaces).toBool();
611 void setReplaceTabsDyn(
bool on)
613 setValue(ReplaceTabsWithSpaces,
QVariant(on));
616 bool backupOnSaveLocal()
const
618 return value(BackupOnSaveLocal).toBool();
621 void setBackupOnSaveLocal(
bool on)
623 setValue(BackupOnSaveLocal,
QVariant(on));
626 bool backupOnSaveRemote()
const
628 return value(BackupOnSaveRemote).toBool();
631 void setBackupOnSaveRemote(
bool on)
633 setValue(BackupOnSaveRemote,
QVariant(on));
638 return value(BackupOnSavePrefix).toString();
641 void setBackupPrefix(
const QString &prefix)
643 setValue(BackupOnSavePrefix,
QVariant(prefix));
648 return value(BackupOnSaveSuffix).toString();
651 void setBackupSuffix(
const QString &suffix)
653 setValue(BackupOnSaveSuffix,
QVariant(suffix));
656 QString indentationMode()
const
658 return value(IndentationMode).toString();
661 void setIndentationMode(
const QString &identationMode)
663 setValue(IndentationMode, identationMode);
672 enum WhitespaceRendering {
678 int tabHandling()
const
680 return value(TabHandlingMode).toInt();
683 void setTabHandling(
int tabHandling)
685 setValue(TabHandlingMode, tabHandling);
688 bool wordWrap()
const
690 return value(StaticWordWrap).toBool();
693 void setWordWrap(
bool on)
695 setValue(StaticWordWrap, on);
698 int wordWrapAt()
const
700 return value(StaticWordWrapColumn).toInt();
703 void setWordWrapAt(
int col)
705 setValue(StaticWordWrapColumn, col);
708 bool pageUpDownMovesCursor()
const
710 return value(PageUpDownMovesCursor).toBool();
713 void setPageUpDownMovesCursor(
bool on)
715 setValue(PageUpDownMovesCursor, on);
718 void setKeepExtraSpaces(
bool on)
720 setValue(KeepExtraSpaces, on);
723 bool keepExtraSpaces()
const
725 return value(KeepExtraSpaces).toBool();
728 void setBackspaceIndents(
bool on)
730 setValue(BackspaceIndents, on);
733 bool backspaceIndents()
const
735 return value(BackspaceIndents).toBool();
738 void setSmartHome(
bool on)
740 setValue(SmartHome, on);
743 bool smartHome()
const
745 return value(SmartHome).toBool();
748 void setShowTabs(
bool on)
750 setValue(ShowTabs, on);
753 bool showTabs()
const
755 return value(ShowTabs).toBool();
758 void setShowSpaces(WhitespaceRendering mode)
760 setValue(ShowSpacesMode, mode);
763 WhitespaceRendering showSpaces()
const
765 return WhitespaceRendering(value(ShowSpacesMode).toInt());
768 void setMarkerSize(
int markerSize)
770 setValue(TrailingMarkerSize, markerSize);
773 int markerSize()
const
775 return value(TrailingMarkerSize).toInt();
784 void setRemoveSpaces(
int triState)
786 setValue(RemoveSpacesMode, triState);
789 int removeSpaces()
const
791 return value(RemoveSpacesMode).toInt();
794 void setNewLineAtEof(
bool on)
796 setValue(NewlineAtEOF, on);
799 bool newLineAtEof()
const
801 return value(NewlineAtEOF).toBool();
806 setValue(OverwriteMode, on);
811 return value(OverwriteMode).toBool();
814 void setTabIndents(
bool on)
816 setValue(IndentOnTab, on);
819 bool tabIndentsEnabled()
const
821 return value(IndentOnTab).toBool();
826 return value(Encoding).toString();
829 bool setEncoding(
const QString &encoding)
831 return setValue(Encoding, encoding);
842 return value(EndOfLine).toInt();
852 void setEol(
int mode)
854 setValue(EndOfLine, mode);
859 return value(ByteOrderMark).toBool();
862 void setBom(
bool bom)
864 setValue(ByteOrderMark, bom);
867 bool allowEolDetection()
const
869 return value(AllowEndOfLineDetection).toBool();
872 void setAllowEolDetection(
bool on)
874 setValue(AllowEndOfLineDetection, on);
879 return value(SwapFileDirectory).toString();
882 void setSwapDirectory(
const QString &directory)
884 setValue(SwapFileDirectory, directory);
890 SwapFilePresetDirectory
893 SwapFileMode swapFileMode()
const
895 return SwapFileMode(value(SwapFile).toInt());
898 void setSwapFileMode(
int mode)
900 setValue(SwapFile, mode);
903 int swapSyncInterval()
const
905 return value(SwapFileSyncInterval).toInt();
908 void setSwapSyncInterval(
int interval)
910 setValue(SwapFileSyncInterval, interval);
913 int lineLengthLimit()
const
915 return value(LineLengthLimit).toInt();
918 void setLineLengthLimit(
int limit)
920 setValue(LineLengthLimit, limit);
923 void setCamelCursor(
bool on)
925 setValue(CamelCursor, on);
928 bool camelCursor()
const
930 return value(CamelCursor).toBool();
933 void setAutoDetectIndent(
bool on)
935 setValue(AutoDetectIndent, on);
938 bool autoDetectIndent()
const
940 return value(AutoDetectIndent).toBool();
943 bool autoSave()
const
945 return value(AutoSave).toBool();
948 bool autoSaveOnFocusOut()
const
950 return value(AutoSaveOnFocusOut).toBool();
953 int autoSaveInterval()
const
955 return value(AutoSaveInteral).toInt();
959 static KateDocumentConfig *s_global;
963class KTEXTEDITOR_EXPORT KateViewConfig :
public KateConfig
971 KTEXTEDITOR_NO_EXPORT
978 explicit KateViewConfig(KTextEditor::ViewPrivate *view);
983 ~KateViewConfig()
override;
985 inline static KateViewConfig *global()
996 enum ConfigEntryTypes {
1000 AutomaticCompletionInvocation,
1001 AutomaticCompletionPreselectFirst,
1002 BackspaceRemoveComposedCharacters,
1004 CharsToEncloseSelection,
1005 ClipboardHistoryEntries,
1007 DynWordWrapAlignIndent,
1008 DynWordWrapIndicators,
1010 DynWrapAtStaticMarker,
1012 EnterToInsertCompletion,
1017 MousePasteAtCursorPosition,
1018 PersistentSelection,
1019 ScrollBarMiniMapWidth,
1023 ShowBracketMatchPreview,
1028 ShowLineModification,
1031 ShowScrollBarMiniMap,
1032 ShowScrollBarMiniMapAll,
1033 ShowScrollBarPreview,
1038 UserSetsOfCharsToEncloseSelection,
1039 ViInputModeStealKeys,
1040 ViRelativeLineNumbers,
1042 WordCompletionMinimalWordLength,
1043 WordCompletionRemoveTail,
1044 ShowDocWithCompletion,
1045 MultiCursorModifier,
1046 ShowFoldingOnHoverOnly,
1047 ShowStatusbarLineColumn,
1048 ShowStatusbarDictionary,
1049 ShowStatusbarInputMode,
1050 ShowStatusbarHighlightingMode,
1051 ShowStatusbarTabSettings,
1052 ShowStatusbarFileEncoding,
1053 StatusbarLineColumnCompact,
1055 EnableAccessibility,
1070 void updateConfig()
override;
1073 bool dynWordWrap()
const
1075 return value(DynamicWordWrap).toBool();
1077 void setDynWordWrap(
bool on)
1079 setValue(DynamicWordWrap, on);
1081 bool dynWrapAnywhere()
const
1083 return value(DynWrapAnywhere).toBool();
1086 bool dynWrapAtStaticMarker()
const
1088 return value(DynWrapAtStaticMarker).toBool();
1091 int dynWordWrapIndicators()
const
1093 return value(DynWordWrapIndicators).toInt();
1096 int dynWordWrapAlignIndent()
const
1098 return value(DynWordWrapAlignIndent).toInt();
1101 bool lineNumbers()
const
1103 return value(ShowLineNumbers).toBool();
1106 bool scrollBarMarks()
const
1108 return value(ShowScrollBarMarks).toBool();
1111 bool scrollBarPreview()
const
1113 return value(ShowScrollBarPreview).toBool();
1116 bool scrollBarMiniMap()
const
1118 return value(ShowScrollBarMiniMap).toBool();
1121 bool scrollBarMiniMapAll()
const
1123 return value(ShowScrollBarMiniMapAll).toBool();
1126 int scrollBarMiniMapWidth()
const
1128 return value(ScrollBarMiniMapWidth).toInt();
1132 enum ScrollbarMode {
1138 int showScrollbars()
const
1140 return value(ShowScrollbars).toInt();
1143 bool showDocWithCompletion()
const
1145 return value(ShowDocWithCompletion).toBool();
1155 setValue(MultiCursorModifier, (
int)m);
1158 bool iconBar()
const
1160 return value(ShowIconBar).toBool();
1163 bool foldingBar()
const
1165 return value(ShowFoldingBar).toBool();
1168 bool foldingPreview()
const
1170 return value(ShowFoldingPreview).toBool();
1173 bool lineModification()
const
1175 return value(ShowLineModification).toBool();
1178 int bookmarkSort()
const
1180 return value(BookmarkSorting).toInt();
1183 int autoCenterLines()
const
1185 return value(AutoCenterLines).toInt();
1189 IncMatchCase = 1 << 0,
1190 IncHighlightAll = 1 << 1,
1191 IncFromCursor = 1 << 2,
1192 PowerMatchCase = 1 << 3,
1193 PowerHighlightAll = 1 << 4,
1194 PowerFromCursor = 1 << 5,
1196 PowerModePlainText = 1 << 7,
1197 PowerModeWholeWords = 1 << 8,
1198 PowerModeEscapeSequences = 1 << 9,
1199 PowerModeRegularExpression = 1 << 10,
1200 PowerUsePlaceholders = 1 << 11
1203 uint searchFlags()
const
1205 return value(SearchFlags).toUInt();
1207 void setSearchFlags(uint flags)
1209 setValue(SearchFlags, flags);
1212 int maxHistorySize()
const
1214 return value(MaxHistorySize).toInt();
1217 uint defaultMarkType()
const
1219 return value(DefaultMarkType).toUInt();
1222 bool allowMarkMenu()
const
1224 return value(AllowMarkMenu).toBool();
1227 bool persistentSelection()
const
1229 return value(PersistentSelection).toBool();
1237 bool viInputModeStealKeys()
const
1239 return value(ViInputModeStealKeys).toBool();
1242 bool viRelativeLineNumbers()
const
1244 return value(ViRelativeLineNumbers).toBool();
1256 bool automaticCompletionInvocation()
const
1258 return value(AutomaticCompletionInvocation).toBool();
1261 bool automaticCompletionPreselectFirst()
const
1263 return value(AutomaticCompletionPreselectFirst).toBool();
1266 bool tabCompletion()
const
1268 return value(TabCompletion).toBool();
1271 bool wordCompletion()
const
1273 return value(WordCompletion).toBool();
1276 bool keywordCompletion()
const
1278 return value(KeywordCompletion).toBool();
1281 int wordCompletionMinimalWordLength()
const
1283 return value(WordCompletionMinimalWordLength).toInt();
1286 bool wordCompletionRemoveTail()
const
1288 return value(WordCompletionRemoveTail).toBool();
1291 bool textDragAndDrop()
const
1293 return value(TextDragAndDrop).toBool();
1296 bool smartCopyCut()
const
1298 return value(SmartCopyCut).toBool();
1301 bool mousePasteAtCursorPosition()
const
1303 return value(MousePasteAtCursorPosition).toBool();
1306 int clipboardHistoryEntries()
const
1308 return value(ClipboardHistoryEntries).toInt();
1311 bool scrollPastEnd()
const
1313 return value(ScrollPastEnd).toBool();
1316 bool foldFirstLine()
const
1318 return value(FoldFirstLine).toBool();
1321 bool showWordCount()
const
1323 return value(ShowWordCount).toBool();
1325 void setShowWordCount(
bool on)
1327 setValue(ShowWordCount, on);
1330 bool showLineCount()
const
1332 return value(ShowLineCount).toBool();
1335 void setShowLineCount(
bool on)
1337 setValue(ShowLineCount, on);
1340 bool autoBrackets()
const
1342 return value(AutoBrackets).toBool();
1345 bool encloseSelectionInChars()
const
1347 return !value(CharsToEncloseSelection).toString().isEmpty();
1350 QString charsToEncloseSelection()
const
1352 return value(CharsToEncloseSelection).toString();
1355 bool backspaceRemoveComposed()
const
1357 return value(BackspaceRemoveComposedCharacters).toBool();
1360 bool showFoldingOnHoverOnly()
const
1362 return value(ShowFoldingOnHoverOnly).toBool();
1366 static KateViewConfig *s_global;
1367 KTextEditor::ViewPrivate *m_view =
nullptr;
1370class KTEXTEDITOR_EXPORT KateRendererConfig :
public KateConfig
1378 KTEXTEDITOR_NO_EXPORT
1379 KateRendererConfig();
1390 ~KateRendererConfig()
override;
1392 inline static KateRendererConfig *global()
1401 enum ConfigEntryTypes {
1405 AutoColorThemeSelection
1420 void updateConfig()
override;
1423 const QString &schema()
const;
1424 void setSchema(
QString schema);
1431 void reloadSchema();
1438 const QFont &baseFont()
const;
1440 void setFont(
const QFont &font);
1442 bool wordWrapMarker()
const;
1443 void setWordWrapMarker(
bool on);
1445 const QColor &backgroundColor()
const;
1446 void setBackgroundColor(
const QColor &col);
1448 const QColor &selectionColor()
const;
1449 void setSelectionColor(
const QColor &col);
1451 const QColor &highlightedLineColor()
const;
1452 void setHighlightedLineColor(
const QColor &col);
1456 const QColor &highlightedBracketColor()
const;
1457 void setHighlightedBracketColor(
const QColor &col);
1459 const QColor &wordWrapMarkerColor()
const;
1460 void setWordWrapMarkerColor(
const QColor &col);
1462 const QColor &tabMarkerColor()
const;
1463 void setTabMarkerColor(
const QColor &col);
1465 const QColor &indentationLineColor()
const;
1466 void setIndentationLineColor(
const QColor &col);
1468 const QColor &iconBarColor()
const;
1469 void setIconBarColor(
const QColor &col);
1471 const QColor &foldingColor()
const;
1472 void setFoldingColor(
const QColor &col);
1475 const QColor &lineNumberColor()
const;
1476 void setLineNumberColor(
const QColor &col);
1477 const QColor ¤tLineNumberColor()
const;
1478 void setCurrentLineNumberColor(
const QColor &col);
1481 const QColor &separatorColor()
const;
1482 void setSeparatorColor(
const QColor &col);
1484 const QColor &spellingMistakeLineColor()
const;
1485 void setSpellingMistakeLineColor(
const QColor &col);
1487 bool showIndentationLines()
const;
1488 void setShowIndentationLines(
bool on);
1490 bool showWholeBracketExpression()
const;
1491 void setShowWholeBracketExpression(
bool on);
1493 static bool animateBracketMatching();
1494 void setAnimateBracketMatching(
bool on);
1496 const QColor &templateBackgroundColor()
const;
1497 const QColor &templateEditablePlaceholderColor()
const;
1498 const QColor &templateFocusedEditablePlaceholderColor()
const;
1499 const QColor &templateNotEditablePlaceholderColor()
const;
1501 const QColor &modifiedLineColor()
const;
1502 void setModifiedLineColor(
const QColor &col);
1504 const QColor &savedLineColor()
const;
1505 void setSavedLineColor(
const QColor &col);
1507 const QColor &searchHighlightColor()
const;
1508 void setSearchHighlightColor(
const QColor &col);
1510 const QColor &replaceHighlightColor()
const;
1511 void setReplaceHighlightColor(
const QColor &col);
1513 void setLineHeightMultiplier(qreal value);
1515 qreal lineHeightMultiplier()
const
1517 return s_global->m_lineHeightMultiplier;
1524 KTEXTEDITOR_NO_EXPORT
1525 void setSchemaInternal(
const QString &schema);
1530 QColor m_backgroundColor;
1532 QColor m_highlightedLineColor;
1533 QColor m_highlightedBracketColor;
1534 QColor m_wordWrapMarkerColor;
1536 QColor m_indentationLineColor;
1539 QColor m_lineNumberColor;
1540 QColor m_currentLineNumberColor;
1542 QColor m_spellingMistakeLineColor;
1543 std::vector<QColor> m_lineMarkerColor;
1545 QColor m_templateBackgroundColor;
1546 QColor m_templateEditablePlaceholderColor;
1547 QColor m_templateFocusedEditablePlaceholderColor;
1548 QColor m_templateNotEditablePlaceholderColor;
1550 QColor m_modifiedLineColor;
1552 QColor m_searchHighlightColor;
1553 QColor m_replaceHighlightColor;
1555 qreal m_lineHeightMultiplier = 1.0;
1557 bool m_wordWrapMarker =
false;
1558 bool m_showIndentationLines =
false;
1559 bool m_showWholeBracketExpression =
false;
1560 bool m_animateBracketMatching =
false;
1562 bool m_schemaSet : 1;
1564 bool m_wordWrapMarkerSet : 1;
1565 bool m_showIndentationLinesSet : 1;
1566 bool m_showWholeBracketExpressionSet : 1;
1567 bool m_backgroundColorSet : 1;
1568 bool m_selectionColorSet : 1;
1569 bool m_highlightedLineColorSet : 1;
1570 bool m_highlightedBracketColorSet : 1;
1571 bool m_wordWrapMarkerColorSet : 1;
1572 bool m_tabMarkerColorSet : 1;
1573 bool m_indentationLineColorSet : 1;
1574 bool m_iconBarColorSet : 1;
1575 bool m_foldingColorSet : 1;
1576 bool m_lineNumberColorSet : 1;
1577 bool m_currentLineNumberColorSet : 1;
1578 bool m_separatorColorSet : 1;
1579 bool m_spellingMistakeLineColorSet : 1;
1580 bool m_templateColorsSet : 1;
1581 bool m_modifiedLineColorSet : 1;
1582 bool m_savedLineColorSet : 1;
1583 bool m_searchHighlightColorSet : 1;
1584 bool m_replaceHighlightColorSet : 1;
1588 static KateRendererConfig *s_global;
Backend of KTextEditor::Document related public KTextEditor interfaces.
MarkTypes
Predefined mark types.
KTextEditor::EditorPrivate One instance of this class is hold alive during a kate part session,...
InputMode
Possible input modes.
const QString commandName
Command name as used in e.g.
const char *const configKey
KConfig entry key for this config entry, shall be unique in its group e.g.
const int enumKey
Enum key for this config entry, shall be unique.
std::function< bool(const QVariant &)> validator
An optional validator function, only when these returns true we accept a given new value.
QVariant value
The concrete value, per default == defaultValue.
const QVariant defaultValue
Default value if nothing special was configured.
ConfigEntry(int enumId, const char *configId, QString command, QVariant defaultVal, std::function< bool(const QVariant &)> valid=nullptr)
Construct one config entry.
Base Class for the Kate Config Classes Current childs are KateDocumentConfig/KateDocumentConfig/KateD...
bool isGlobal() const
Is this a global config object?
bool isSet(const int key) const
Is given key set in this config object?
virtual ~KateConfig()
Virtual Destructor.
QStringList configKeys() const
All known config keys.
virtual void updateConfig()=0
do the real update
Handles all of the work of rendering the text (used for the views and printing)
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
typedef KeyboardModifiers
QTextStream & bom(QTextStream &stream)