File indexing completed on 2024-03-24 03:54:33
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 "*.tfstate*", // Terraform state files 0080 0081 // Bytecode files 0082 "*.class", // Java 0083 "*.pyc", // Python 0084 "*.pyo", // More Python 0085 "*.elc", // Emacs Lisp 0086 "*.qmlc", // QML 0087 "*.jsc", // Javascript 0088 0089 // files known in bioinformatics containing huge amount of unindexable data 0090 "*.fastq", 0091 "*.fq", 0092 "*.gb", 0093 "*.fasta", 0094 "*.fna", 0095 "*.gbff", 0096 "*.faa", 0097 "*.fna", 0098 // end of list 0099 nullptr 0100 }; 0101 0102 const int s_defaultFileExcludeFiltersVersion = 9; 0103 0104 const char* const s_defaultFolderExcludeFilters[] = { 0105 "po", 0106 0107 // VCS 0108 "CVS", 0109 ".svn", 0110 ".git", 0111 "_darcs", 0112 ".bzr", 0113 ".hg", 0114 0115 // development 0116 "CMakeFiles", 0117 "CMakeTmp", 0118 "CMakeTmpQmake", 0119 ".moc", 0120 ".obj", 0121 ".pch", 0122 ".uic", 0123 ".npm", 0124 ".yarn", 0125 ".yarn-cache", 0126 "__pycache__", 0127 "node_modules", 0128 "node_packages", 0129 "nbproject", 0130 ".terraform", 0131 ".venv", 0132 "venv", 0133 0134 //misc 0135 "core-dumps", 0136 "lost+found", 0137 0138 // end of list 0139 nullptr 0140 }; 0141 0142 const int s_defaultFolderExcludeFiltersVersion = 4; 0143 0144 const char* const s_sourceCodeMimeTypes[] = { 0145 "text/css", 0146 "text/x-c++src", 0147 "text/x-c++hdr", 0148 "text/x-csrc", 0149 "text/x-chdr", // c header files 0150 "text/x-python", 0151 "text/x-assembly", 0152 "text/x-java", 0153 "text/x-objsrc", 0154 "text/x-ruby", 0155 "text/x-scheme", 0156 "text/x-pascal", 0157 "text/x-fortran", 0158 "text/x-erlang", 0159 "text/x-cmake", 0160 "text/x-lua", 0161 "text/x-yacc", 0162 "text/x-sed", 0163 "text/x-haskell", 0164 "text/x-copying", // COPYING files 0165 "text/x-readme", // README files 0166 "text/x-qml", 0167 "text/asp", 0168 "text/jsx", 0169 "text/csx", 0170 "text/vnd.trolltech.linguist", 0171 "application/x-awk", 0172 "application/x-cgi", 0173 "application/x-csh", 0174 "application/x-ipynb+json", 0175 "application/x-java", 0176 "application/x-javascript", 0177 "application/x-perl", 0178 "application/x-php", 0179 "application/x-python", 0180 "application/x-sh", 0181 "application/xml", 0182 "application/javascript", 0183 "application/json", 0184 "application/geo+json", 0185 "application/json-patch+json", 0186 "application/ld+json", 0187 "application/x-ipynb+json", // Jupyter notebooks 0188 0189 // Not really source code, but inherited from text/plain 0190 "application/pgp-encrypted", // pgp encrypted, with or without ASCII Armor 0191 0192 // end of list 0193 nullptr 0194 }; 0195 const int s_sourceCodeMimeTypesVersion = 3; 0196 } 0197 0198 QStringList Baloo::defaultExcludeFilterList() 0199 { 0200 QStringList l; 0201 for (int i = 0; s_defaultFileExcludeFilters[i]; ++i) { 0202 l << QLatin1String(s_defaultFileExcludeFilters[i]); 0203 } 0204 for (int i = 0; s_defaultFolderExcludeFilters[i]; ++i) { 0205 l << QLatin1String(s_defaultFolderExcludeFilters[i]); 0206 } 0207 return l; 0208 } 0209 0210 int Baloo::defaultExcludeFilterListVersion() 0211 { 0212 return qMax(s_defaultFileExcludeFiltersVersion, s_defaultFolderExcludeFiltersVersion); 0213 } 0214 0215 QStringList Baloo::sourceCodeMimeTypes() 0216 { 0217 QStringList l; 0218 for (int i = 0; s_sourceCodeMimeTypes[i]; ++i) { 0219 l << QLatin1String(s_sourceCodeMimeTypes[i]); 0220 } 0221 0222 return l; 0223 } 0224 0225 QStringList Baloo::defaultExcludeMimetypes() 0226 { 0227 return sourceCodeMimeTypes(); 0228 } 0229 0230 int Baloo::defaultExcludeMimetypesVersion() 0231 { 0232 // The +1 is the image, video and audio mimetypes 0233 return s_sourceCodeMimeTypesVersion + 1; 0234 }