Baloo

fileexcludefilters.cpp
1/*
2 This file is part of the KDE Project
3 SPDX-FileCopyrightText: 2008-2010 Sebastian Trueg <trueg@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "fileexcludefilters.h"
9
10namespace
11{
12const char* const s_defaultFileExcludeFilters[] = {
13 // tmp files
14 "*~",
15 "*.part",
16
17 // temporary build files
18 "*.o",
19 "*.la",
20 "*.lo",
21 "*.loT",
22 "*.moc",
23 "moc_*.cpp",
24 "qrc_*.cpp",
25 "ui_*.h",
26 "cmake_install.cmake",
27 "CMakeCache.txt",
28 "CTestTestfile.cmake",
29 "libtool",
30 "config.status",
31 "confdefs.h",
32 "autom4te",
33 "conftest",
34 "confstat",
35 "Makefile.am",
36 "*.gcode", // CNC machine/3D printer toolpath files
37 ".ninja_deps",
38 ".ninja_log",
39 "build.ninja",
40
41 // misc
42 "*.csproj",
43 "*.m4",
44 "*.rej",
45 "*.gmo",
46 "*.pc",
47 "*.omf",
48 "*.aux",
49 "*.tmp",
50 "*.po",
51 "*.vm*",
52 "*.nvram",
53 "*.rcore",
54 "*.swp",
55 "*.swap",
56 "lzo",
57 "litmain.sh",
58 "*.orig",
59 ".histfile.*",
60 ".xsession-errors*",
61 "*.map",
62 "*.so",
63 "*.a",
64 "*.db",
65 "*.qrc",
66 "*.ini",
67 "*.init",
68 "*.img", // typical extension for raw disk images
69 "*.vdi", // Virtualbox disk images
70 "*.vbox*", // Virtualbox VM files
71 "vbox.log", // Virtualbox log files
72 "*.qcow2", // QEMU QCOW2 disk images
73 "*.vmdk", // VMware disk images
74 "*.vhd", // Hyper-V disk images
75 "*.vhdx", // Hyper-V disk images
76 "*.sql", // SQL database dumps
77 "*.sql.gz", // Compressed SQL database dumps
78 "*.ytdl", // youtube-dl temp files
79 "*.tfstate*", // Terraform state files
80
81 // Bytecode files
82 "*.class", // Java
83 "*.pyc", // Python
84 "*.pyo", // More Python
85 "*.elc", // Emacs Lisp
86 "*.qmlc", // QML
87 "*.jsc", // Javascript
88
89 // files known in bioinformatics containing huge amount of unindexable data
90 "*.fastq",
91 "*.fq",
92 "*.gb",
93 "*.fasta",
94 "*.fna",
95 "*.gbff",
96 "*.faa",
97 "*.fna",
98 // end of list
99 nullptr
100};
101
102const int s_defaultFileExcludeFiltersVersion = 9;
103
104const char* const s_defaultFolderExcludeFilters[] = {
105 "po",
106
107 // VCS
108 "CVS",
109 ".svn",
110 ".git",
111 "_darcs",
112 ".bzr",
113 ".hg",
114
115 // development
116 "CMakeFiles",
117 "CMakeTmp",
118 "CMakeTmpQmake",
119 ".moc",
120 ".obj",
121 ".pch",
122 ".uic",
123 ".npm",
124 ".yarn",
125 ".yarn-cache",
126 "__pycache__",
127 "node_modules",
128 "node_packages",
129 "nbproject",
130 ".terraform",
131 ".venv",
132 "venv",
133
134 //misc
135 "core-dumps",
136 "lost+found",
137
138 // end of list
139 nullptr
140};
141
142const int s_defaultFolderExcludeFiltersVersion = 4;
143
144const char *const s_sourceCodeMimeTypes[] = {
145 "text/css",
146 "text/x-c++src",
147 "text/x-c++hdr",
148 "text/x-csrc",
149 "text/x-chdr", // c header files
150 "text/x-python",
151 "text/x-assembly",
152 "text/x-java",
153 "text/x-objsrc",
154 "text/x-ruby",
155 "text/x-scheme",
156 "text/x-pascal",
157 "text/x-fortran",
158 "text/x-erlang",
159 "text/x-cmake",
160 "text/x-lua",
161 "text/x-yacc",
162 "text/x-sed",
163 "text/x-haskell",
164 "text/x-copying", // COPYING files
165 "text/x-readme", // README files
166 "text/x-qml",
167 "text/asp",
168 "text/jsx",
169 "text/csx",
170 "text/rust", // Rust source (often .rs)
171 "text/vnd.trolltech.linguist",
172 "application/x-awk",
173 "application/x-cgi",
174 "application/x-csh",
175 "application/x-ipynb+json",
176 "application/x-java",
177 "application/x-javascript",
178 "application/x-perl",
179 "application/x-php",
180 "application/x-python",
181 "application/x-sh",
182 "application/xml",
183 "application/javascript",
184 "application/json",
185 "application/geo+json",
186 "application/json-patch+json",
187 "application/ld+json",
188 "application/x-ipynb+json", // Jupyter notebooks
189
190 // Not really source code, but inherited from text/plain
191 "application/pgp-encrypted", // pgp encrypted, with or without ASCII Armor
192
193 // model/obj subtype of text/plain
194 "model/obj", // OBJ 3D model
195
196 // end of list
197 nullptr,
198};
199const int s_sourceCodeMimeTypesVersion = 4;
200}
201
203{
204 QStringList l;
205 for (int i = 0; s_defaultFileExcludeFilters[i]; ++i) {
206 l << QLatin1String(s_defaultFileExcludeFilters[i]);
207 }
208 for (int i = 0; s_defaultFolderExcludeFilters[i]; ++i) {
209 l << QLatin1String(s_defaultFolderExcludeFilters[i]);
210 }
211 return l;
212}
213
215{
216 return qMax(s_defaultFileExcludeFiltersVersion, s_defaultFolderExcludeFiltersVersion);
217}
218
219QStringList Baloo::sourceCodeMimeTypes()
220{
221 QStringList l;
222 for (int i = 0; s_sourceCodeMimeTypes[i]; ++i) {
223 l << QLatin1String(s_sourceCodeMimeTypes[i]);
224 }
225
226 return l;
227}
228
229QStringList Baloo::defaultExcludeMimetypes()
230{
231 return sourceCodeMimeTypes();
232}
233
234int Baloo::defaultExcludeMimetypesVersion()
235{
236 // The +1 is the image, video and audio mimetypes
237 return s_sourceCodeMimeTypesVersion + 1;
238}
int defaultExcludeFilterListVersion()
QStringList defaultExcludeFilterList()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.