Changeset View
Changeset View
Standalone View
Standalone View
src/lib/repository.h
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | |||||
77 | * | 77 | * | ||
78 | * @section repo_search_paths Search Paths | 78 | * @section repo_search_paths Search Paths | ||
79 | * | 79 | * | ||
80 | * All highlighting Definition and Theme files are compiled into the shared | 80 | * All highlighting Definition and Theme files are compiled into the shared | ||
81 | * KSyntaxHighlighting library by using the Qt resource system. Loading | 81 | * KSyntaxHighlighting library by using the Qt resource system. Loading | ||
82 | * additional files from disk is supported as well. | 82 | * additional files from disk is supported as well. | ||
83 | * | 83 | * | ||
84 | * Loading syntax Definition files works as follows: | 84 | * Loading syntax Definition files works as follows: | ||
85 | * | ||||
85 | * -# First, all syntax highlighting files are loaded that are located in | 86 | * -# First, all syntax highlighting files are loaded that are located in | ||
86 | * QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("org.kde.syntax-highlighting/syntax"), QStandardPaths::LocateDirectory); | 87 | * QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("org.kde.syntax-highlighting/syntax"), QStandardPaths::LocateDirectory); | ||
87 | * Under Unix, this uses $XDG_DATA_HOME and $XDG_DATA_DIRS, which could | 88 | * Under Unix, this uses $XDG_DATA_HOME and $XDG_DATA_DIRS, which could | ||
88 | * map to $HOME/.local5/share/org.kde.syntax-highlighting/syntax and | 89 | * map to $HOME/.local5/share/org.kde.syntax-highlighting/syntax and | ||
89 | * /usr/share/org.kde.syntax-highlighting/syntax. | 90 | * /usr/share/org.kde.syntax-highlighting/syntax. | ||
91 | * | ||||
90 | * -# Next, for backwards compatibility with Kate, all syntax highlighting | 92 | * -# Next, for backwards compatibility with Kate, all syntax highlighting | ||
91 | * files are loaded that are located in | 93 | * files are loaded that are located in | ||
92 | * QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("katepart5/syntax"), QStandardPaths::LocateDirectory); | 94 | * QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("katepart5/syntax"), QStandardPaths::LocateDirectory); | ||
93 | * Again, under Unix, this uses $XDG_DATA_HOME and $XDG_DATA_DIRS, which | 95 | * Again, under Unix, this uses $XDG_DATA_HOME and $XDG_DATA_DIRS, which | ||
94 | * could map to $HOME/.local5/share/katepart5/syntax and | 96 | * could map to $HOME/.local5/share/katepart5/syntax and | ||
95 | * /usr/share/katepart5/syntax. | 97 | * /usr/share/katepart5/syntax. | ||
98 | * | ||||
96 | * -# Then, all files compiled into the library through resources are loaded. | 99 | * -# Then, all files compiled into the library through resources are loaded. | ||
97 | * The internal resource path is ":/org.kde.syntax-highlighting/syntax". | 100 | * The internal resource path is ":/org.kde.syntax-highlighting/syntax". | ||
98 | * This path should never be touched by other applications. | 101 | * This path should never be touched by other applications. | ||
102 | * | ||||
99 | * -# Finally, the search path can be extended by calling addCustomSearchPath(). | 103 | * -# Finally, the search path can be extended by calling addCustomSearchPath(). | ||
100 | * A custom search path can either be a path on disk or again a path to | 104 | * A custom search path can either be a path on disk or again a path to | ||
101 | * a Qt resoruce. | 105 | * a Qt resource. | ||
102 | * | 106 | * | ||
103 | * Similarly, loading Theme files works as follows: | 107 | * Similarly, loading Theme files works as follows: | ||
108 | * | ||||
104 | * -# First, all Theme files are loaded that are located in | 109 | * -# First, all Theme files are loaded that are located in | ||
105 | * QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("org.kde.syntax-highlighting/themes"), QStandardPaths::LocateDirectory); | 110 | * QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("org.kde.syntax-highlighting/themes"), QStandardPaths::LocateDirectory); | ||
106 | * Under Unix, this uses $XDG_DATA_HOME and $XDG_DATA_DIRS, which could | 111 | * Under Unix, this uses $XDG_DATA_HOME and $XDG_DATA_DIRS, which could | ||
107 | * map to $HOME/.local5/share/org.kde.syntax-highlighting/themes and | 112 | * map to $HOME/.local5/share/org.kde.syntax-highlighting/themes and | ||
108 | * /usr/share/org.kde.syntax-highlighting/themes. | 113 | * /usr/share/org.kde.syntax-highlighting/themes. | ||
114 | * | ||||
109 | * -# Then, all files compiled into the library through resources are loaded. | 115 | * -# Then, all files compiled into the library through resources are loaded. | ||
110 | * The internal resource path is ":/org.kde.syntax-highlighting/themes". | 116 | * The internal resource path is ":/org.kde.syntax-highlighting/themes". | ||
111 | * This path should never be touched by other applications. | 117 | * This path should never be touched by other applications. | ||
118 | * | ||||
112 | * -# Finally, all Theme%s located in the paths added addCustomSearchPath() | 119 | * -# Finally, all Theme%s located in the paths added addCustomSearchPath() | ||
113 | * are loaded. | 120 | * are loaded. | ||
114 | * | 121 | * | ||
115 | * @note Whenever a Definition or a Theme exists twice, the variant with | 122 | * @note Whenever a Definition or a Theme exists twice, the variant with | ||
116 | * higher version is used. | 123 | * higher version is used. | ||
117 | * | 124 | * | ||
125 | * @note The QStandardPaths lookup can be disabled by compiling the framework with the -DNO_STANDARD_PATHS define. | ||||
126 | * | ||||
118 | * @see Definition, Theme, AbstractHighlighter | 127 | * @see Definition, Theme, AbstractHighlighter | ||
119 | * @since 5.28 | 128 | * @since 5.28 | ||
120 | */ | 129 | */ | ||
121 | class KSYNTAXHIGHLIGHTING_EXPORT Repository | 130 | class KSYNTAXHIGHLIGHTING_EXPORT Repository | ||
122 | { | 131 | { | ||
123 | public: | 132 | public: | ||
124 | /** | 133 | /** | ||
125 | * Create a new syntax definition repository. | 134 | * Create a new syntax definition repository. | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | |||||
205 | * and theme definition files. Both locations on disk as well as Qt | 214 | * and theme definition files. Both locations on disk as well as Qt | ||
206 | * resource paths are supported. | 215 | * resource paths are supported. | ||
207 | * | 216 | * | ||
208 | * @note Internally, the two sub-folders @p path/syntax as well as | 217 | * @note Internally, the two sub-folders @p path/syntax as well as | ||
209 | * @p path/themes are searched for additional Definition%s and | 218 | * @p path/themes are searched for additional Definition%s and | ||
210 | * Theme%s. Do not append @e syntax or @e themes to @p path | 219 | * Theme%s. Do not append @e syntax or @e themes to @p path | ||
211 | * yourself. | 220 | * yourself. | ||
212 | * | 221 | * | ||
222 | * @note Calling this triggers a reload() of the repository. | ||||
223 | * | ||||
213 | * @since 5.39 | 224 | * @since 5.39 | ||
214 | */ | 225 | */ | ||
215 | void addCustomSearchPath(const QString &path); | 226 | void addCustomSearchPath(const QString &path); | ||
216 | 227 | | |||
217 | /** | 228 | /** | ||
218 | * Returns the list of custom search paths added to the repository. | 229 | * Returns the list of custom search paths added to the repository. | ||
219 | * By default, this list is empty. | 230 | * By default, this list is empty. | ||
220 | * | 231 | * | ||
Show All 14 Lines |