summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes
Commit message (Collapse)AuthorAgeFilesLines
* Fix compilation when using -no-mimetype-databaseHelio Chissini de Castro2020-10-211-0/+4
| | | | | | Change-Id: I4f706a26d73f61e4a6022338e0fc0be48627e4a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Whitespace cleanup in corelib/ mimetypes, plugin and threadAllan Sandfeld Jensen2020-10-211-2/+3
| | | | | | | Done with selective application of clang-format Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Centralize the implementation of move assignment operatorsGiuseppe D'Angelo2020-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have two main strategies for dealing with move assignment in Qt: 1) move-and-swap, used by "containers" (in the broad sense): containers, but also smart pointers and similar classes that can hold user-defined types; 2) pure swap, used by containers that hold only memory (e.g. QString, QByteArray, ...) as well as most implicitly shared datatypes. Given the fact that a move assignment operator's code is just boilerplate (whether it's move-and-swap or pure swap), provide two _strictly internal_ macros to help write them, and apply the macros across corelib and gui, porting away from the hand-rolled implementations. The rule of thumb when porting to the new macros is: * Try to stick to the existing code behavior, unless broken * if changing, then follow this checklist: * if the class does not have a move constructor => pure swap (but consider ADDING a move constructor, if possible!) * if the class does have a move constructor, try to follow the criteria above, namely: * if the class holds only memory, pure swap; * if the class may hold anything else but memory (file handles, etc.), then move and swap. Noteworthy details: * some operators planned to be removed in Qt 6 were not ported; * as drive-by, some move constructors were simplified to be using qExchange(); others were outright broken and got fixed; * some contained some more interesting code and were not touched. Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-1/+1
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMimeDatabase: fix handling of glob-deleteallDavid Faure2020-09-224-17/+26
| | | | | | | | | | | | | | | | Binary provider: It was not possible to remove the first glob in a local override, because the mainPattern handling would re-add the first glob back. XML provider: It didn't support glob-deleteall. Also, the order of the providers was wrong. We want to pick local overrides first, the internal DB has to go last in the list. Fixes: QTBUG-85436 Pick-to: 5.15 Change-Id: I9a4523f37cd962c730df9a6ed992bd01c075bf03 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase: fix performance regression when using the internal XMLDavid Faure2020-09-183-3/+26
| | | | | | | | | That XML was parsed over and over again, because the QMimeXMLProvider was re-created instead of re-used. Pick-to: 5.15 Change-Id: I07ff005d3f238afc1490b69a58cf4815e67d418c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port the QXmlStream API from QStringRef to QStringViewKarsten Heimrich2020-08-193-11/+11
| | | | | | | | | | | | | | This gives some source incompatibilities, most of them can be handled by using auto instead of QStringRef explicitly. [ChangeLog][Important API changes] QXmlStream now uses QStringView insteead of QStringRef in it's API. Using auto forvariables returning a QStringRef in Qt 5 should lead to code that can be used against both Qt versions. Fixes: QTBUG-84317 Change-Id: I6df3a9507276f5d16d044a6bdbe0e4810cf99440 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Use QList instead of QVector in corelibJarek Kobus2020-06-251-1/+1
| | | | | | | | | | Applied to headers only. Source file to be changed separately. Omitted statemachine for now to avoid conflicts. Omitted qmetatype.h for now - to be handled later. Task-number: QTBUG-84469 Change-Id: I317376037a62467c313467d92955ad0b7473aa97 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QMimeDatabase/zlib: fix build with z_const macro emptyThiago Macieira2020-06-231-1/+1
| | | | | | | | | | | The next_in pointer in z_stream is defined as "z_const Bytef *" but z_const is actually an empty macro in most builds. Since our data is read-only constexpr, we need this const_cast to compile. Fixes: QTBUG-84457 Pick-to: 5.15 Change-Id: Ied637aece2a7427b8a2dfffd1612a01ae46f7c1a Reviewed-by: David Faure <david.faure@kdab.com>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-3/+3
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QMimeDatabase/zstd: use -T1 instead of --single-threadThiago Macieira2020-06-121-1/+1
| | | | | | | | | | | | Some older versions of the command-line tool don't have --single-thread but do have -T1. They're slightly different according to the documentation, but it's not important to us. What we want is to make sure we consume a single CPU during build. Fixes: QTBUG-84792 Pick-to: 5.15 Change-Id: Ied637aece2a7427b8a2dfffd16129fe88a0466ee Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Port mimetypes away from QStringRefLars Knoll2020-06-117-8/+8
| | | | | | Task-number: QTBUG-84319 Change-Id: I2bed1149df7f11495fd9dc3577828c0790b17dab Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QMimeType::suffixForFileName shouldn't lowercase the file suffixDavid Faure2020-06-014-16/+27
| | | | | | | | | | | | | It was returning a lowercased suffix because it was extracting it from the pattern (*.txt) rather than from the filename ("README.TXT"). This broke expectations on the application side, since this method is documented to return a suffix from the given filename. Ref: https://bugs.kde.org/show_bug.cgi?id=402388 Change-Id: I7dae13db31280249d3f592fa9592c4067804e22d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase/xml: use xmlstarlet instead of xmlEric Lemanissier2020-05-261-2/+2
| | | | | | | | some distributions (eg Ubuntu) don't provide xml executable, but only xmlstarlet executable Change-Id: Icc801ded8d4ec1ec4d1dab93289a2365f8cd9cbd Pick-to: 5.15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a QRegularExpression::fromWildcard() convenience methodLars Knoll2020-05-061-1/+1
| | | | | | | | | Simplify constructing QRegularExpression objects from a glob pattern. Change-Id: I06f60b1dfea3da969e2474dedd44b6ca5d456d7d Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QMimeDatabase: remove unused QSet includeMarc Mutz2020-05-051-1/+0
| | | | | Change-Id: Id69ef8f09baf276cc0de8d8b9534cd370608531b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Don't use a QTextStream to read lines from a fileLars Knoll2020-05-021-5/+6
| | | | | | | | QFile::readLine() can do the same at a fraction of the cost of QTextStream. Change-Id: I8c542756bcbd893dfa76d03e76e3ce0810aa2871 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: fix a few more char/int/uint -> QChar conversionsMarc Mutz2020-04-301-1/+1
| | | | | | | | They were masked by all QChar ctors being made explicit, except the char16_t one, which was left as the only viable choice. Change-Id: I5632795f3c7dd1de3830285d5446d9b994613466 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change qHash() to work with size_t instead of uintLars Knoll2020-04-092-3/+3
| | | | | | | | | | | This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-111-2/+5
|\ | | | | | | Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
| * Mimetypes: Build fix for Android builds on WindowsCristian Adam2020-03-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | Due to Android's multi-abi the build will fail due to concurrent access: cmd /c C:\Projects\Qt\repo\qtbase\src\corelib\mimetypes\mime\generate.bat C:\Projects\Qt\repo\qtbase\src\corelib\mimetypes\mime\packages\freedesktop.org.xml > .rcc\qmimeprovider_database.cpp The process cannot access the file because it is being used by another process. Change-Id: I647e0a6d8aa03cf116b08a1dce6e61e8882661f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-03-042-5/+10
|\| | | | | | | Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
| * QMimeXMLProvider: fix another issue with -no-mimetype-databaseThiago Macieira2020-03-032-5/+10
| | | | | | | | | | | | | | | | | | | | | | The compiler must emit the destructor for the members of a class in an inline constructor, in case the constructor throws. This won't work in Qt 5.15 due to QList requiring knowing whether QMimeMagicRuleMatcher is trivial or not. Another solution would be to use QVector. Fixes: QTBUG-82547 Change-Id: Ia8b65350cd5d49debca9fffd15f79db872ed7c0c Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-02-281-1/+1
|\| | | | | | | Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
| * QMimeXMLProvider: add missing semi-colon in the #else caseThiago Macieira2020-02-271-1/+1
| | | | | | | | | | | | Fixes: QTBUG-82547 Change-Id: Ia8b65350cd5d49debca9fffd15f74e22c0536805 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/dev' into merge-devLeander Beernaert2020-01-247-14/+367
|\ \ | | | | | | | | | Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
| * | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-01-047-11/+364
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h Make QVector(DataPointer dd) public to be able to properly merge 5b4b437b30b320e2cd7c9a566999a39772e5d431 from 5.15 into dev. src/widgets/kernel/qapplication.cpp tests/auto/tools/moc/allmocs_baseline_in.json Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
| | * MIME: Make the internal database direct content, not a Qt resourceThiago Macieira2019-12-107-11/+364
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This saves us from having to bootstrap rcc in regular (non-cross) compilations, as it can now link to QtCore. Actually un-bootstrapping rcc is left as an exercise for the reader. This commit discovered that MSVC cannot handle constexpr arrays bigger than 256 kB, at which point it simply starts claiming that the constant expressions using it are not constexpr. ICC has a similar problem at 64 kB, but it tells you why ("note: type "const unsigned char [65537]" too large for constant-expression evaluation"). Note also that this requires gzip or zstd to be in PATH for compression to happen. RCC linked to zlib, which is always present due to the bundled copy. gzip's presence is not likely to be a problem on Unix systems, but could be for Windows users, especially MSVC ones. If gzip is not present, QtCore's size will increase by about 1910 kB of read-only (sharable) data. Change-Id: I2b1955a995ad40f3b89afffd15a3e65a94670242 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-092-3/+3
| |\| | | | | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| | * Tidy nullptr usageAllan Sandfeld Jensen2019-12-062-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix qmimedatabase testsLeander Beernaert2020-01-101-1/+1
| | | | | | | | | | | | | | | | | | Change-Id: I89fbd0d277746b594199a6c1992f35a789b90049 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Regenerate src/*Alexandru Croitor2019-11-141-1/+1
| | | | | | | | | | | | | | | | | | Change-Id: I0314b4faa1e4860e86198eea4189987e527dfec2 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-141-2/+2
|\| | | | | | | | | | | Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
| * | Use same condition for QT_USE_MMAP as in qresource.cppTobias Hunger2019-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Consistently use the same condition to decide whether or not to set QT_USE_MMAP. Change-Id: Ica83d40c8051a8957d875334b821037b25fa8677 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add special case handling for corelib mimetypes resourcesLeander Beernaert2019-07-181-0/+21
|/ / | | | | | | | | | | | | | | | | | | | | | | | | We have to treat the resources from mimetypes in corelibs specially as they are reused for two test cases. Since we no longer use the qrc files, we have wrapped the relevant code in a function that can be called for every target that depends on it. This change also corrects formatting for the generate CMake code regarding resource commands. Change-Id: I50a05c81151d75aefc9ca165f5ffeb9f5cd77162 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/qt6Simon Hausmann2019-06-262-12/+16
|\| | | | | | | Change-Id: I4ea2b77cc201daed94fbe321f146dfd20365a534
| * QMimeType: towards re-entrancy: do not cache iconName made from mimetype nameMarc Mutz2019-06-161-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | To not write into a shared object without mutex protection. If the stored icon name is empty, just calculate a new one on each call. Task-number: QTBUG-45684 Change-Id: I01dfb6697b5275e69451da91fdc7346f40bc424e Reviewed-by: David Faure <david.faure@kdab.com>
| * QMimeType: make deep const breakages explicitMarc Mutz2019-06-161-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | QExplicitlySharedDataPointer is propagating const in my tree, and I will be proposing this for inclusion into Qt 6, so proactively fix the breakage here. QMimeType is known to be non-reentrant (QTBUG-45684), and this patch doesn't fix it. Change-Id: If68b148c44439d76ab1d95e8db93b90d12650e51 Reviewed-by: David Faure <david.faure@kdab.com>
| * Remove a few usages of deprecated APIShawn Rutledge2019-06-131-1/+1
| | | | | | | | | | | | Change-Id: I94bad0b8d3891c6b4a55178836cfff2a4312e330 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/dev' into wip/qt6Alexandru Croitor2019-06-062-1/+7
|\| | | | | | | Change-Id: Iac12a37fa6536ebe30e6548f7c54ec0c402c9f5d
| * QtCore: use qUtf16Printable and %ls, qErrnoWarning()Marc Mutz2019-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | ... instead of qPrintable(), %s, and explicit qt_error_string(). Saves 2KiB in text size on optimized Linux AMD64 GCC 9.1 builds. Change-Id: I98b6717da1ed1b678f01167d704a96f10da47966 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Fix corelib build without feature.regularexpressionTasuku Suzuki2019-05-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I208d6cb7f57a74873fae3a36fe094a92d287c2f0 Reviewed-by: David Faure <david.faure@kdab.com>
* | Bump version to Qt 6Lars Knoll2019-05-141-0/+1
|/ | | | | | | | | | | | | | | | | | Needed to disable QT_NO_UNSHARABLE_CONTAINERS, as this triggers asserts. QMetaType also has some Qt 6 specific code disabled to get things to compile. Fix various details in autotests to accommodate for the changes with Qt 6. Add a workaround for black lists on macos, where QSysInfo::productType() now returns 'macos' and not 'osx' anymore. Change-Id: Ie26afb12a2aac36521472715934a7e34639ea4d0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-011-19/+0
| | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-04-082-4/+0
| | | | | Change-Id: I7bc6c455fbae4cdad584c76773299a6d8cd40c82 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-035-8/+8
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-03-312-1/+3
|\ | | | | | | | | | | | | Conflicts: src/corelib/configure.json Change-Id: I93ac67f3bf4844bc7c691183e94bceb922b7b919
| * QMimeDatabase: allow building without our internal copyThiago Macieira2019-03-262-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Saves 234kB of read-only data (when compressed with zstd) in QtCore, plus one load-time execution. With Zlib, the size was 315 kB. [ChangeLog][QtCore][QMimeDatabase] Added configure option -no-mimetype-database that tells Qt not to bundle its own copy of the XDG MIME database. If this option is passed, QMimeDatabase will only work if there's a system copy in $XDG_DATA_DIRS/mime. This option is useful for Linux distributions that ensure the data is always present. Change-Id: I1004b4b819774c4c9296fffd158e69c490e88fb6 Reviewed-by: David Faure <david.faure@kdab.com>
* | Fix warnings when compiling with QT_NO_XMLSTREAMJędrzej Nowacki2019-03-042-1/+3
|/ | | | | | | | Some of function arguments were unused. Change-Id: I29e8e4acbed87836044cac4f0b7ac59168181f5a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QMimeGlobPattern: update use of wildcardToRegularExpresionSamuel Gaist2019-01-261-1/+1
| | | | | | | | | | | Following the update of qtbase because of QTBUG-72539, the code using wildcardToRegularExpression must be updated as anchoredPattern is not needed anymore. Task-number: QTBUG-72539 Change-Id: I4989b42c737eb17d65c6b1d3cefab3ffd2163bfc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>