File indexing completed on 2024-04-28 11:32:48
0001 /* 0002 This file is part of the KDE Project 0003 SPDX-FileCopyrightText: 2008-2010 Sebastian Trueg <trueg@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "fileexcludefilters.h" 0009 0010 namespace 0011 { 0012 const char* const s_defaultFileExcludeFilters[] = { 0013 // tmp files 0014 "*~", 0015 "*.part", 0016 0017 // temporary build files 0018 "*.o", 0019 "*.la", 0020 "*.lo", 0021 "*.loT", 0022 "*.moc", 0023 "moc_*.cpp", 0024 "qrc_*.cpp", 0025 "ui_*.h", 0026 "cmake_install.cmake", 0027 "CMakeCache.txt", 0028 "CTestTestfile.cmake", 0029 "libtool", 0030 "config.status", 0031 "confdefs.h", 0032 "autom4te", 0033 "conftest", 0034 "confstat", 0035 "Makefile.am", 0036 "*.gcode", // CNC machine/3D printer toolpath files 0037 ".ninja_deps", 0038 ".ninja_log", 0039 "build.ninja", 0040 0041 // misc 0042 "*.csproj", 0043 "*.m4", 0044 "*.rej", 0045 "*.gmo", 0046 "*.pc", 0047 "*.omf", 0048 "*.aux", 0049 "*.tmp", 0050 "*.po", 0051 "*.vm*", 0052 "*.nvram", 0053 "*.rcore", 0054 "*.swp", 0055 "*.swap", 0056 "lzo", 0057 "litmain.sh", 0058 "*.orig", 0059 ".histfile.*", 0060 ".xsession-errors*", 0061 "*.map", 0062 "*.so", 0063 "*.a", 0064 "*.db", 0065 "*.qrc", 0066 "*.ini", 0067 "*.init", 0068 "*.img", // typical extension for raw disk images 0069 "*.vdi", // Virtualbox disk images 0070 "*.vbox*", // Virtualbox VM files 0071 "vbox.log", // Virtualbox log files 0072 "*.qcow2", // QEMU QCOW2 disk images 0073 "*.vmdk", // VMware disk images 0074 "*.vhd", // Hyper-V disk images 0075 "*.vhdx", // Hyper-V disk images 0076 "*.sql", // SQL database dumps 0077 "*.sql.gz", // Compressed SQL database dumps 0078 "*.ytdl", // youtube-dl temp files 0079 0080 // Bytecode files 0081 "*.class", // Java 0082 "*.pyc", // Python 0083 "*.pyo", // More Python 0084 "*.elc", // Emacs Lisp 0085 "*.qmlc", // QML 0086 "*.jsc", // Javascript 0087 0088 // files known in bioinformatics containing huge amount of unindexable data 0089 "*.fastq", 0090 "*.fq", 0091 "*.gb", 0092 "*.fasta", 0093 "*.fna", 0094 "*.gbff", 0095 "*.faa", 0096 "*.fna", 0097 // end of list 0098 nullptr 0099 }; 0100 0101 const int s_defaultFileExcludeFiltersVersion = 8; 0102 0103 const char* const s_defaultFolderExcludeFilters[] = { 0104 "po", 0105 0106 // VCS 0107 "CVS", 0108 ".svn", 0109 ".git", 0110 "_darcs", 0111 ".bzr", 0112 ".hg", 0113 0114 // development 0115 "CMakeFiles", 0116 "CMakeTmp", 0117 "CMakeTmpQmake", 0118 ".moc", 0119 ".obj", 0120 ".pch", 0121 ".uic", 0122 ".npm", 0123 ".yarn", 0124 ".yarn-cache", 0125 "__pycache__", 0126 "node_modules", 0127 "node_packages", 0128 "nbproject", 0129 ".venv", 0130 "venv", 0131 0132 //misc 0133 "core-dumps", 0134 "lost+found", 0135 0136 // end of list 0137 nullptr 0138 }; 0139 0140 const int s_defaultFolderExcludeFiltersVersion = 3; 0141 0142 const char* const s_sourceCodeMimeTypes[] = { 0143 "text/css", 0144 "text/x-c++src", 0145 "text/x-c++hdr", 0146 "text/x-csrc", 0147 "text/x-chdr", // c header files 0148 "text/x-python", 0149 "text/x-assembly", 0150 "text/x-java", 0151 "text/x-objsrc", 0152 "text/x-ruby", 0153 "text/x-scheme", 0154 "text/x-pascal", 0155 "text/x-fortran", 0156 "text/x-erlang", 0157 "text/x-cmake", 0158 "text/x-lua", 0159 "text/x-yacc", 0160 "text/x-sed", 0161 "text/x-haskell", 0162 "text/x-copying", // COPYING files 0163 "text/x-readme", // README files 0164 "text/x-qml", 0165 "text/asp", 0166 "text/jsx", 0167 "text/csx", 0168 "text/vnd.trolltech.linguist", 0169 "application/x-awk", 0170 "application/x-cgi", 0171 "application/x-csh", 0172 "application/x-ipynb+json", 0173 "application/x-java", 0174 "application/x-javascript", 0175 "application/x-perl", 0176 "application/x-php", 0177 "application/x-python", 0178 "application/x-sh", 0179 "application/xml", 0180 "application/javascript", 0181 "application/json", 0182 "application/geo+json", 0183 "application/json-patch+json", 0184 "application/ld+json", 0185 "application/x-ipynb+json", // Jupyter notebooks 0186 0187 // Not really source code, but inherited from text/plain 0188 "application/pgp-encrypted", // pgp encrypted, with or without ASCII Armor 0189 0190 // end of list 0191 nullptr 0192 }; 0193 const int s_sourceCodeMimeTypesVersion = 3; 0194 } 0195 0196 QStringList Baloo::defaultExcludeFilterList() 0197 { 0198 QStringList l; 0199 for (int i = 0; s_defaultFileExcludeFilters[i]; ++i) { 0200 l << QLatin1String(s_defaultFileExcludeFilters[i]); 0201 } 0202 for (int i = 0; s_defaultFolderExcludeFilters[i]; ++i) { 0203 l << QLatin1String(s_defaultFolderExcludeFilters[i]); 0204 } 0205 return l; 0206 } 0207 0208 int Baloo::defaultExcludeFilterListVersion() 0209 { 0210 return qMax(s_defaultFileExcludeFiltersVersion, s_defaultFolderExcludeFiltersVersion); 0211 } 0212 0213 QStringList Baloo::sourceCodeMimeTypes() 0214 { 0215 QStringList l; 0216 for (int i = 0; s_sourceCodeMimeTypes[i]; ++i) { 0217 l << QLatin1String(s_sourceCodeMimeTypes[i]); 0218 } 0219 0220 return l; 0221 } 0222 0223 QStringList Baloo::defaultExcludeMimetypes() 0224 { 0225 return sourceCodeMimeTypes(); 0226 } 0227 0228 int Baloo::defaultExcludeMimetypesVersion() 0229 { 0230 // The +1 is the image, video and audio mimetypes 0231 return s_sourceCodeMimeTypesVersion + 1; 0232 } 0233