summaryrefslogtreecommitdiffstats
path: root/src/assistant/help/qhelpcollectionhandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* qhelpgenerator: Fix evaluation of timestampsMarcus Tillmanns2024-03-071-3/+3
| | | | | | | | | | | | Amends f11d7e4af73ca474ab71310961b155f6c9bc71da and b860d48aabfe43d1eb3c9c1c10bd3698d367c255 to correctly parse and compare timestamps. Fixes: QTBUG-122994 Change-Id: I1fb12200ef6fc1fdc58dd629d92a7c39e14ca29e Pick-to: 6.6 6.7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* QtHelp: More _L1Jarek Kobus2024-02-221-16/+10
| | | | | | | Task-number: QTBUG-122025 Change-Id: Icbdb003e9bd1b05bfb9d92002aab2aa5cc1aa0f7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtHelp: Remove unused methods from QHelpCollectionHandlerJarek Kobus2024-02-191-34/+0
| | | | | | | Task-number: QTBUG-122025 Change-Id: Ie2470fcf4337ea5dd4cb26b29f7058beff0cc415 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtHelp: More _L1Jarek Kobus2024-02-141-470/+445
| | | | | | Task-number: QTBUG-122025 Change-Id: I13ac3b88573956448ee2ff91becd4168cd0f7d30 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtHelp: Use more std::unique_ptrJarek Kobus2024-02-141-56/+46
| | | | | | | Task-number: QTBUG-122025 Change-Id: Ib29b14f56dd0401b986631bc685e652695857ff8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtHelp: Avoid using contains()Jarek Kobus2024-02-141-2/+1
| | | | | | | | | Eliminate double lookups. Task-number: QTBUG-122025 Change-Id: I346c61e4e4c6e556405f70f33701c68ed2cf3172 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtHelp: Bit more cleanup in cpp filesJarek Kobus2024-02-131-113/+65
| | | | | | | | | | | | Inline some short methods in private API. Use more {} for default constructed values. Fix indentations. Add some TODOs. Task-number: QTBUG-122025 Change-Id: I29062709f6d302a8768ead1c20eda3af5c256c74 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtHelp: Simplify string list creationsJarek Kobus2024-02-101-93/+97
| | | | | | Task-number: QTBUG-122025 Change-Id: I4536437fafda8d131b4f947d9fecb4d2d383e4a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtHelp: Port includes to standard conventionJarek Kobus2024-02-071-11/+10
| | | | | | | | | | According to today's content of: https://wiki.qt.io/Coding_Conventions. Task-number: QTBUG-122025 Change-Id: I55f417060c989e28c38e1abaea1259bb87ccafe7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtHelp: Cleanup includesJarek Kobus2024-02-071-5/+3
| | | | | | | | | | Get rid of unused includes and forward declarations. Order includes and forward declarations alphabetically. Replace some includes with forward declarations. Task-number: QTBUG-122025 Change-Id: I224dc5371c982137b33f5b63c54f5da6cd435ce7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* qhelpgenerator: read file modification time in UTCJames Addison2024-01-091-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During help collection construction when the SOURCE_DATE_EPOCH[1] environment variable is set, each file modification timestamp recorded in the TimeStampTable is clamped (capped) to a maximum of the value specified in the environment variable. The SOURCE_DATE_EPOCH value is an offset in seconds from the Unix epoch, and is relative to the UTC timezone. Therefore we can avoid some timezone conversion operations and make it clearer in the code that we are comparing UTC-with-UTC by adding a timezone argument[2] of UTC when calling lastModified to retrieve the modification timestamp for each file. This argument is available in Qt 6.6 onwards. This change is not intended to produce any functional change in the behavior of the code; instead readability/comprehensibility and, to a lesser extent, a performance benefit described by QTBUG-100349 when reading UTC-native filesystem timestamps are the two reasons behind this change. [1] - https://reproducible-builds.org/specs/source-date-epoch/ [2] - https://doc.qt.io/qt-6.6/qfileinfo.html#lastModified-1 Task-number: QTBUG-62697 Change-Id: Iffb1aed5ee326ed40acb6285078c6682f76750c8 Pick-to: 6.6 6.7 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* qhelpgenerator: localize SOURCE_DATE_EPOCH to UTCJames Addison2024-01-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | The SOURCE_DATE_EPOCH environment variable is used as an anchor timestamp that software builds can use when they embed timestamps that refer to the build-time into their build artifacts. The value of the variable is specified[1] as an integer number of seconds since the Unix epoch (1970-01-01T00:00:00Z). To ensure that the value is interpreted correctly, and to ensure that the resulting timestamps embedded by qhelpgenerator cannot drift with the build environment's timezone settings, we should store the SOURCE_DATE_EPOCH in QDateTime instances that have a UTC timezone. [1] - https://reproducible-builds.org/specs/source-date-epoch/ Task-number: QTBUG-62697 Change-Id: I24a79088886adf9334cd7c3c6f723eb9f064007d Pick-to: 6.6 6.7 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Fix some clazy/Axivion warnings about Rule Of Three/FiveFriedemann Kleint2023-05-241-0/+2
| | | | | | | | | | | - Add missing destructors or copy/move constructors via Qt convenience macros - Remove deleted copy/move constructors for classes declared Q_OBJECT - Add Q_DISABLE_COPY_MOVE to RAI-like classes Pick-to: 6.5 Change-Id: I2f1d330ad28a89a35fb306fd9813fbb60a710756 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QHelpCollectionHandler: Fix static analysis warning about const-signalsFriedemann Kleint2023-05-031-2/+3
| | | | | | Pick-to: 6.5 Change-Id: I422dc9df9dfcbafbdde99708692e4b59d112e99e Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Assistant: Deduplicate helper buildQUrl()Friedemann Kleint2023-01-131-2/+2
| | | | | | | | | It causes clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I40ae560ff7e15aa8240736fe9bca14e756a67716 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-061-3/+3
| | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I234704ba429750ddee958a82f6c941d041da0653 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-061-12/+12
| | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: I95f6410e57a6a92b1cf91bbedfbe3d517cab6b44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-191-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I5335388c0472b0ee554234fc7eca60769e504660 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* tools: do not rely on transitive includesFabian Kosmale2022-03-181-0/+1
| | | | | Change-Id: Ib78f984827988a39f56c4423eae40c67797549ea Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Clamp registered collection time-stamp to SOURCE_DATE_EPOCH if setKai Pastor2020-12-011-1/+9
| | | | | | | Task-number: QTBUG-62697 Pick-to: 6.0 5.15 Change-Id: I73cc41db9c57d050783e963896f9696c294126c3 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QtHelp: Fix documentsFor() when not using filter engineJarek Kobus2020-09-111-28/+64
| | | | | | | | Fixes: QTBUG-84727 Pick-to: 5.15 Change-Id: Id66cc071a24cc761dc63d044b7f74d0e1959cd22 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Assistant: Fix compilation issues with QMultiMapKai Koehne2020-08-131-22/+22
| | | | | | | Fixes: QTBUG-86030 Change-Id: I87387a795dbf6609d8f22a84d93f95d68bbb646e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Assistant: Use QList instead of QVectorJarek Kobus2020-06-091-4/+4
| | | | | | Task-number: QTBUG-84469 Change-Id: I92541d8a81574af605c206ddcd482cff26ec8765 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Plug memory leak when tables can't be createdVolker Hilsheimer2020-05-011-0/+1
| | | | | | | | | | | Delete the query object if function has to return prematurely. Fixes: QTBUG-83913 Change-Id: I82e4ca54f95970cb4ccb3985cec5389288e23fde Coverity-Id: 21930 Pick-to: 5.15 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Adapt the QtHelp API according to recent QMap changesJarek Kobus2020-03-191-8/+35
| | | | | | | | | | The usage of QMap as a multi map has just been deprecated. Adapt the QtHelp API accordingly. Introduce QHelpLink data structure. Fixes: QTBUG-82334 Change-Id: I8ff15710b1a433ddcb3000e5bcf58790c983e63f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Assistant: Fix deprecation warningsJarek Kobus2020-01-231-2/+4
| | | | | | Change-Id: Id4464651828d4c4e5e00f8dffb5378380fed9a2f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtHelp: add new useful methodsJarek Kobus2019-12-101-3/+3
| | | | | | | | This methods are going to be used in QtCreator help integration. Change-Id: If226ba3e612af013694afc8508527516e3e0daea Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-111-4/+16
|\ | | | | | | Change-Id: Ib0252441ebf43cbd0857bae7b72a7567473105fa
| * Close the last SELECT query with pending resultsJarek Kobus2019-05-291-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | Ensure we close the last SELECT query in case we read just one result. If we don't iterate over all results available, the query may block the database connection. The other database connection won't be able to interact with database until the open query is closed. Fixes: QDS-779 Change-Id: I30cece520918a10972deaa3d093ffaea11cab5c0 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* | Use QVersionNumber for version instead of QStringJarek Kobus2019-03-011-9/+15
| | | | | | | | | | | | Change-Id: Ib44d3965f45272f7b791f1d164b0901d170c239d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Fix filtering in case when using empty optionJarek Kobus2019-03-011-2/+4
| | | | | | | | | | | | | | | | It may happen that version or component value is empty for a specific documentation. Make this case work. Change-Id: I7133f1554d2fe72e3b9a4731e80245ceb051e596 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Create default version filterJarek Kobus2019-03-011-2/+20
| | | | | | | | | | | | | | | | | | This mimics the behavior of old filters, where in 98% of use cases the qch file provided a separate filter for its module. Change-Id: I537d8336ea3cc0c6c894b494d7f2346df7499572 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Enhance filtering by documentation version numberJarek Kobus2019-03-011-4/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | Make it possible to filter the documentation by version number. This easily allows for showing the docs for one or more specified versions inside a custom filter. Task-number: QTCREATORBUG-19724 Task-number: QTCREATORBUG-7301 Change-Id: Ia0bc63666ab8152e43ffb6a6b6b99610e30575f7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-181-0/+8
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf src/assistant/help/qhelpcollectionhandler.cpp Change-Id: If1408a5893bc9ade9088e01c00aab695eff131aa
| * Merge remote-tracking branch 'origin/5.12.1' into 5.12Qt Forward Merge Bot2019-01-181-0/+8
| |\ | | | | | | | | | Change-Id: I8ea54fdacbda23e07d79a543e3c70c0a02cf5092
| | * Assistant: Mark the readonly collection filesJarek Kobus2019-01-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The qhc file may be installed in readonly location. Don't try to fix tables there, we leave it for the cached qhc file. Task-number: QTBUG-72174 Change-Id: I513c799d2b571a9dd9bc77b7c122e635c863fcff Reviewed-by: Kai Pastor <dg0yt@darc.de> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
| * | Fix fileExists() queryJarek Kobus2019-01-171-2/+2
| |/ | | | | | | | | Change-Id: I6f71e5f47f1cb3e22594a7f596292d04c6e2a303 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-041-2/+6
|\| | | | | | | | | | | | | | | | | Conflicts: src/qdoc/htmlgenerator.cpp src/qtattributionsscanner/qdocgenerator.cpp Done-With: Martin Smith <martin.smith@qt.io> Change-Id: I56a23175579a1a699939179da2f35bbcd6c73367
| * assistant: Set error string when failing to openCollectionFile()Kai Koehne2018-12-061-2/+6
| | | | | | | | | | | | Task-number: QTBUG-72095 Change-Id: I13063afe493232db4c60c3dee686473a3f6e5804 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Add new filter API, enclosed in QHelpFilterEngineJarek Kobus2018-11-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | Implement new filter mechanism and provide component filtering. Task-number: QTCREATORBUG-19724 Task-number: QTCREATORBUG-7301 Change-Id: I48400e3bc969495a66c3002fed13a7c3ddb1e249 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Create new filter tables inside qch filesJarek Kobus2018-10-171-20/+569
|/ | | | | | | Add a new internal API for dealing with new filters. Change-Id: Id26d90fe3e20aa576f6c2403cd36aa5e679a96b7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Order contents items alphabetically by titleJarek Kobus2018-07-091-7/+45
| | | | | | | | | | | | | If many different doc versions are installed order them by version number in the reverse order (the bigger version in front) Task-number: QTBUG-21357 Task-number: QTBUG-59364 Task-number: QTCREATORBUG-10004 Task-number: QTCREATORBUG-17949 Change-Id: I8429c3d63fedf9811ea41ca13f754b677ff55a1e Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Don't substitute table names in queriesJarek Kobus2018-06-191-3/+10
| | | | | Change-Id: I54a5058419dbec0f864d9726d040d887f298a507 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Detect doc version number and fix jumping to the proper docJarek Kobus2018-06-051-9/+72
| | | | | | | | | | | | | | | | Add version-name metadata pair for the new documentation generated by qdoc. Use heuristics to detect version number when version inside metadata is not specified (applies to old docs). We do that only for qt documentation (we detect the qtproject prefix inside namespace). In order to match the proper namespace we compare the version numbers of the original location with the version number of the candidate list and pick up the matching one. Otherwise we behave like before. Task-number: QTBUG-59363 Change-Id: Id9f3d7d91e53647e2ad8d485d96888e80ce4f5b2 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Assistant: Fix clang warningsJarek Kobus2018-05-141-2/+2
| | | | | Change-Id: I8315c97fcd20ea9be90f4258628b88c809dc7fdb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Don't fail when we can't register new tablesJarek Kobus2018-05-021-1/+3
| | | | | | | | | In case when we can't register new tables don't fail, but try to unregister doc. The doc might got removed from disk in meantime. Change-Id: I6405556fcc8b0e1f820cf1afaffe25e53c1a98a8 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Store the copy of the index inside the help collection fileJarek Kobus2018-04-231-57/+1087
| | | | | | | | | | | | | | | | | | | | This avoids having to open all .qch files at startup, which is slow and can lead to contention on open file handles. This change is backward compatible. The old help lib won't use the new tables. The new help lib will generate the new tables on first run or regenerate them when it detects they are not anymore in sync. Store also the timestamp info about the qch files and compare it upon every startup. If it doesn't match then new tables' data is regenerated. The case when running new Creator, then running old Creator and reconfiguring doc set and then running new Creator again should work properly. Task-number: QTCREATORBUG-18242 Change-Id: I7f656935ae2383b866b27e256eec23dab588efc5 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Create QHelpCollectionHandler's query dynamicallyJarek Kobus2018-04-051-178/+201
| | | | | | | | | | | | | | | | It fixes a warning about the use of db from the wrong thread. Before, the default m_query object was created in QHelpCollectionHandler constructor which caused the warning to appear. Now we create m_query object dynamically instead. This also fixed a leak in QHelpCollectionHandler::openCollectionFile() where two early returns, after the database had been opened, neither closed it nor set m_dbOpened. Change-Id: I24484d25d9d90b1a5d6fe4a5acb61c834e2b9599 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Assistant: Don't query the database for unneeded dataUlf Hermann2018-03-221-3/+12
| | | | | | | | | If we only need registered documentations of a specific namespace we can restrict the SQL query accordingly, so that we don't have to iterate through all the results afterwards. Change-Id: I124cf16ed95e1010b8a05d8cb723c2a1f03120d4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Fix stringsJarek Kobus2018-03-061-6/+6
| | | | | Change-Id: Ide8d1fb32e1e371716d5576d0f51771484463fb5 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>