summaryrefslogtreecommitdiffstats
path: root/src/linguist
Commit message (Collapse)AuthorAgeFilesLines
* Qt Linguist: Fix the phrase view suggestion shortcuts to workFriedemann Kleint2021-02-243-29/+8
| | | | | | | | | | | | Remove class GuessShortcut which had a bug (connect to wrong signal of QShortcut) by a lambda expression. Do not create a shortcut for phrase 10 which resulted in CTRL+':'. Change-Id: I26f35ece1bcdd2e75a56b8e4f1f69987a8054e52 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 4ad7a232cce5fd4e5ec88c2df46ca1e564772913) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bump copyright year to 2021Friedemann Kleint2021-02-031-1/+1
| | | | | | | | Fixes: QTBUG-89980 Change-Id: Ice588f78d392f1dfd1f96de8840a3c7e28e4edd1 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 0a097b742dcffc04690e98ce2e574febad25014d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* lupdate: Fix warning about copy of loop variableFriedemann Kleint2021-01-191-1/+1
| | | | | | | | | src/linguist/lupdate/cpp_clang.cpp:118:21: warning: loop variable 'source' of type 'const QString' creates a copy from type 'const QString' [-Wrange-loop-analysis] Change-Id: If46d469da6653b9b59a2926080f0b37b74893b52 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit b990c0eef564e7c0d35cb3d800e2e558bae45640) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix handling of -extensions argumentKai Koehne2020-12-011-3/+3
| | | | | | | | | | | | | | | | | | | Do not expand _lupdate_options for list commands; depending on the content, this might cause CMake to treat it's content as separate elements. Also avoid IN_LIST; it was only introduced in CMake 3.3, while Qt 5.15 still also supports CMake 3.1, 3.2. Anyhow, we can as well just directly list(FIND...). Amends 2834bebc9e6ba9bf0577db1d7da42a52e622adc6 Change-Id: Ib4c73956477803cc8ec2f4048ffbab8daf2136e5 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> (cherry picked from commit 71ed18ed4b07c47e42f60c770bf7f5b4f8be4b20) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Linguist: Install phrasebooksKai Koehne2020-11-302-8/+185
| | | | | | | | Fixes: QTBUG-88972 Change-Id: Icb720cf7b9cdc7ac0cbeead5fee25e590685b1bd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit afd117a4a465e21f33980e495d8883b0f9c41244) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Linguist: Use QDesktopServices to show linguist manual"Kai Koehne2020-11-272-5/+32
| | | | | | | | | | | | | This reverts commit cbf658dff28e20ae0f2b0dc87a931cf9444559b4 and parts of commit 1d994b1471bd43d7003697b47e3f7d2ebfc808df Reason for revert: Assistant is enabled again Change-Id: I8d39a7c62cb401fdb7ecc6ffb972b57c01969c9b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit 42838108d04a114b109379544e1cc2228a74b257) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use https instead of http when opening docsJarek Kobus2020-11-251-1/+1
| | | | | | | Change-Id: I10dfbd66b2510ae23ef91a2048f1ead6ddfb588f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 1d994b1471bd43d7003697b47e3f7d2ebfc808df) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* lupdate: Fix assertion in C++ parserJoerg Bornemann2020-11-201-1/+3
| | | | | | | | | | | | | | | | | | The parser reserves space for the the string yyWord: the length of the input string, e.g. the file. Later, it checks via Q_ASSERT whether the string is still attached to the initial buffer. In Qt6 we cannot rely anymore on QString staying attached to it's buffer for all operations. Therefore, the assertion cannot hold in all cases. Change the assertion to something weaker: ensure that the buffer size (the string's capacity) stays the same during the parser run. Fixes: QTBUG-88647 Change-Id: I62ef2598b7023bc5bbc44aa477ac3bca60d6f355 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 6f3c749f0e85c0bfd93a6d176fce2f25edf58962) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmake: Fix qHash-related integer conversion warningsFriedemann Kleint2020-11-203-11/+11
| | | | | | | | | | Use size_t instead of uint, following qtbase/008343a05e16081e2ed2b7f5166c6d5381a427ca. Change-Id: I98809c2208bf270835d5e55fcb28d9aeecd087dc Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit b34a39904c8bb03ef37bb3d9278cde5cfb69f6ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Update documentation of CMake commands for Qt 6 for Qt LinguistToolsKai Koehne2020-11-162-19/+24
| | | | | | Task-number: QTBUG-88530 Change-Id: I730ceccac5e5b93c93b15bc39c2c0ed6e7f4f670 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* lupdate: Fix compiler warningFriedemann Kleint2020-11-161-1/+1
| | | | | | | | Add override, fixing: src/linguist/lupdate/lupdatepreprocessoraction.h:79:10: warning: ‘virtual void LupdatePPCallbacks::SourceRangeSkipped(clang::SourceRange, clang::SourceLocation)’ can be marked override [-Wsuggest-override] Change-Id: I5b131bc71d1e8f7f4d3cb5fc0350cf2d54b2fa31 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qttools: compile with explicit QChar(int)David Faure2020-11-111-2/+2
| | | | | | | | | | Notice how this caught a bad bug: the code was generating "listitem\001" instead of "listitem1" It seems no unittest covers this, they all pass, still. Change-Id: Ibb22231c9dc3e61d3ea0a84894e451c621d50121 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Enforce zero documentation warning policyTopi Reinio2020-11-071-0/+2
| | | | | | Task-number: QTBUG-78069 Change-Id: I3809c090fd46fefeefaad003d648f9d9db56f8f5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Linguist: Use QDesktopServices to show linguist manualJarek Kobus2020-11-062-32/+5
| | | | | | | Task-number: QTBUG-86746 Change-Id: Iead8fd3f8149432e99e19057c797b2f0c202a6a0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Linguist: Remove code path for reading config files from Qt < 4.5Friedemann Kleint2020-11-051-5/+1
| | | | | | | | It was causing a deprecation warning about QVariant::Type. Change-Id: I87a2aedea630d5105eebffbf0787ec43ebe79cd0 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Port linguist macros to Qt 6Kai Koehne2020-11-042-5/+10
| | | | | | | Fixes: QTBUG-87870 Change-Id: I554b0ededd59dc60fec6a18759e2a400ce594f4d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix usage of qt_create_translation in a CTestKai Koehne2020-11-041-1/+1
| | | | | | | | | | | | | | | | | | Commit 1b006ab3d8954 declared an input file generated by CMake as a BYPRODUCT of the consuming file to fix a policy warning CMP0058. Anyhow, this is technically incorrect, since the file is actually not produced, but consumed by the lupdate command. The incorrect fix also had the side-effect that ninja clean did remove the file, which prevents the use of the macro in CTest. Just remove the BYPRODUCT declaration. The file is written by CMake, so it actually doesn't need neither to be listed in DEPENDENCIES nor in BYPRODUCT. Task-number: QTBUG-71354 Pick-to: 5.15 Change-Id: I7e5677f2bbd84b8a9fffdcb73465dfae6012ceb5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qt5_create_translation: Fix handling of directory dependenciesKai Koehne2020-11-041-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | lupdate supports whole directories as sources. Anyhow, in this case we cannot just declare the directory as dependency; it will force lupdate to re-run every time and emit a warning: warning MSB8064: Custom build for item "..." succeeded, but specified dependency "<the directory specified as a source>" does not exist. This may cause incremental builds to work incorrectly. The patch checks if each specified source is a directory, and if so: * Generates globbing expressions for the list of extensions to be used. * Search the specified directory for matching files. * Add those files to the list of dependencies to give to CMake instead of the directory itself. The list of source file extensions is derived from lupdate defaults, but can be tweaked by a new '-extensions' argument. Original patch done by Chris Djali. Fixes: QTBUG-86192 Pick-to: 5.15 Change-Id: Icc22be4f3ee096361ac319208261cdc8191d9adf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Partially revert "Remove old Qt 5 CMake build system files"Kai Koehne2020-11-041-0/+136
| | | | | | | | | | | This reverts parts of commit 8d100101aa7e8635718d97c0621699e20e5c272e. We should not just get rid of the cmake macros, but instead make it ready for Qt 6... Task-number: TBUG-87870 Change-Id: I03331ce97ba60629f16977c88fe06a80172bdedd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Build: Skip separate debug info for lupdate on MinGWCristian Adam2020-11-021-0/+4
| | | | | | | | | With MinGW 8.1.0 objcopy / strip fails when doing the separation of the debug information. Fixes: QTBUG-87613 Change-Id: Ica3f11eaef0748fc300fdda6e57fa3db08b77908 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Clear out deprecated QLocale::Language valuesEdward Welbourne2020-10-271-6/+2
| | | | | | | | | CLDR provides no Bihari locale data, so we're retiring it. Tagalog is now called Filipino. Various aliases mentioned in comments are going away. Change-Id: Ie31353911be2de908f53e9b84d6b819677ad946b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix lupdate compilation with Clang 11Kai Koehne2020-10-223-15/+43
| | | | | | Fixes: QTBUG-87477 Change-Id: Ib78e890b18a6cd0469591a20a9675681da147748 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Update QStringConverter usageMårten Nordheim2020-10-121-1/+1
| | | | | | | Following fa8d021fa6fcb040fb702b6ffd2deee52a3b748a in qtbase Change-Id: I46495c1f0cde4e304e414b05cd66d14b00afd6b1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* lupdate/clang: Stabilize order of translator messagesJoerg Bornemann2020-10-092-9/+46
| | | | | | | | | | | | | | The multiple threads lupdate/clang runs lead to an unpredictable order of translation messages in the generated .ts files. This is particularly bad for autotests that compare the generated .ts file with expected output. We now collect the TranslatorMessage objects in a vector, and sort them according to the original order of input files. Then, we sequentially call Translator::extend with the messages. Change-Id: Ibc6df056477fe221c4cc50f6f6c394225d340dba Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Remove old Qt 5 CMake build system filesKai Koehne2020-10-063-276/+0
| | | | | | Fixes: QTBUG-87185 Change-Id: I8ed1244196b2e0d6cfbc087384b1933ba60a753c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* lupdate: Fix return-type warningv6.0.0-alpha1Joerg Bornemann2020-10-011-3/+1
| | | | | | | | | Fix "warning: control reaches end of non-void function" in lookForContext by unconditionally returning the result of exploreBases. The result of lookForContext is checked for emptiness at the call sites. Change-Id: I115710e4093c7ebf0f66079fadb3c3dacc4622d4 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Support -clang-parser option with qmake projectsJoerg Bornemann2020-10-011-1/+51
| | | | | | | | | Automatically generate a compile_commands.json if it could not be detected. For now, default to some common compiler arguments, which should really be read from qmake/CMake. Change-Id: Ib92fbe55621c6927803399ba96182a4255b5e2d7 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-0114-24/+24
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I84f5fc4eb26f95d81ce5b5b8cc72706bb9185026 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* lupdate: Revisit how to specify the compilation databaseJoerg Bornemann2020-10-014-29/+41
| | | | | | | | | | | | | | | | | | | | | | | | The compilation database's file path was passed to clang's CommonOptionsParser with the "-p" argument. This, however, specifies a directory, not the path to the compilation database itself. There doesn't seem to be a way to directly specify the file path of the compilation database itself. The whole API revolves around directories. This is also what I observe in other clang-based tools, see for example the -compile-commands-dir option of clangd. Remove CommonOptionsParser, and directly use CompilationDatabase to explicitly control how to search for the compilation database, and actually do what the help output claims. Reflect in the help output that lupdate expects a directory path, not a file path. Properly forward the error message from CompilationDatabase, and bail out with an error exit code. Change-Id: I935da6078d020431d0f69509da69a52089e23f8a Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Clarify constness in ReadSynchronizedRefJoerg Bornemann2020-10-012-12/+5
| | | | | | | | | | | | | | | The const/const_cast dance we do in the constructor is only needed, because m_vector isn't a const ref. It isn't const to allow for the reset() member function. As this class represents a reference and references are usually not supposed to change what they point to (*pointers* do that job), it's questionable to have the reset() method at all. This patch removes the reset() method and makes m_vector a const ref again, which simplifies the class. Change-Id: I827150b756050f5bf17bb7354315035e74a091a8 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Yield error if -clang-parser requested in non-clang buildJoerg Bornemann2020-10-011-5/+8
| | | | | | | | If lupdate is built without clang support, -clang-parser must be an error. Change-Id: I88c7d47452c48e01d6a1609e25094c514e88f953 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Fix issues in LupdatePPCallbacks::storeMacroArgumentsJoerg Bornemann2020-10-011-5/+2
| | | | | | | | | | | | The QT_TR_[N_]NOOP macros take exactly one argument. The fall-through is apparently not intended. The remaining Q_FALLTHROUGH macros are unnecessary. Fix the coding style, and remove a comment that's out of context by now. Change-Id: I66f78510df99f0f5fee71575c9759a58c4497bc8 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Fix WriteSynchronizedRef::emplace_back(T &&)Joerg Bornemann2020-10-011-2/+2
| | | | | | | | | This method must call std::move to actually avoid a copy. Also, push_back suffices here as were moving an already constructed object into the vector. Change-Id: Ie435e661080cbc4769c69fc73af406e292b8dc3b Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Fix int/size_t warnings and inconsistenciesJoerg Bornemann2020-09-302-13/+13
| | | | | | | | Use size_t for ReadSynchronizedRef::m_next, because that's going to be compared to std::vector's size, and return size_t in the size() method. Change-Id: I25b28a66becb8ae0c15d9323c3b82b8471a44b41 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Fix warnings about unused parametersJoerg Bornemann2020-09-301-0/+4
| | | | | Change-Id: Ie2d8bdea0760a072eeb6515eea1dd0d18392204b Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Fix warnings about unused cleanQuote functionsJoerg Bornemann2020-09-301-2/+2
| | | | | | | | | Define the cleanQuote functions as inline, not static. They're used in different translation units, and in every TU that doesn't use both functions, we get a warning that one cleanQuote function is unused. Change-Id: Id547298fcbc73cf9953edee54069880781da7f3f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* lupdate: Use std::optional for Project::translationsJoerg Bornemann2020-09-303-10/+4
| | | | | | | ...to resolve a todo comment and simplify the code a bit. Change-Id: Ic3437449362d2fcae56d2b1a4bdbb99c185ff0de Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Find context for QT_TR_NOOP macroLucie Gerard2020-09-306-76/+214
| | | | | | | | | The QT_TR_NOOP context is found during AST visit by localising the Q_OBJECT or Q_DECLARE_TR_FUNCTIONS in the closest CXXRecordDecl that includes the QT_TR_NOOP macro call. Change-Id: I55ac1fa5c35124fdefc35a65d88b0cf82cc0fdd9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* lupdate: Extend the help text for -clang-parserJoerg Bornemann2020-09-281-6/+9
| | | | | | | | | That we can specify the compilation database on the command line was only known to people reading the code. Change-Id: I82c458ff228b8bfb76a7c57f3fb45534ca813d15 Reviewed-by: Lucie Gerard <lucie.gerard@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Linguist: Refactor iteratorsJarek Kobus2020-09-1714-100/+82
| | | | | | | | | Use more const iterators. Fix mixing const iterators with non-const iterators. Use auto for iterators wherever easily possible. Change-Id: Ib6e73319971396e47bb0b0f5c252b8cf246de008 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix warnings from using deprecated QLibraryInfo APIVolker Hilsheimer2020-09-166-6/+6
| | | | | | | | As of 557623cc4f22295e5e89462dfdff20d78b3b9cdc in qtbase, QLibraryInfo::location is QLibraryInfo::path. Change-Id: I6e4788011fd8f64f5a433b00cb327c2afcf68527 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix more compiler warnings from deprecated application attributesVolker Hilsheimer2020-09-161-1/+1
| | | | | Change-Id: I0c5679eb77b1a38348017279e5949c65e4b0cf35 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix compile warning from deprecated application attributesVolker Hilsheimer2020-09-151-3/+0
| | | | | | | | | | | | | | AA_DisableHighDpiScaling and AA_UseHighDpiPixmaps have been deprecated. As of 90358f6042d1fe2db849e17e1b0c875fb0560b20 and 2dc46c09026362cc267b1183faf09fb29479ef93 in qtbase, respectively, these settings are deprecated and have no effect. Remove their setting, and also the respective command line options in Qt Designer and the pixeltool. Change-Id: Iaa057f6a8a8396b822d9190f17e5f9c73e9cc2bb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Linguist: Replace foreach with range-based forJarek Kobus2020-09-1528-161/+177
| | | | | Change-Id: I8b1aed7bc5f4f1d14ff9db4cf7c09fbc4267246d Reviewed-by: hjk <hjk@qt.io>
* Linguist: Port to typed signal-slot connectionsJarek Kobus2020-09-1515-266/+354
| | | | | Change-Id: I9967811117eb040c3a3ccf058454aee50ce385a6 Reviewed-by: hjk <hjk@qt.io>
* Fix build errors due to forward declarations of QStringListFriedemann Kleint2020-09-151-1/+0
| | | | | | | | Remove forward declarations of QStringList, adapting to qtbase/652bd1efca34b7e114836f79c33b5e4a248faaee. Change-Id: I486106ee749aaa906c19e993c429c1fa0514663f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix Translator::resolveDuplicates()Lars Knoll2020-09-091-3/+8
| | | | | | | | | | | | | | The method was relying on undefined behavior by assuming that the references to the items inside the list of messages did not change even though entries were removed from the list. Fix this by only remembering the duplicate indices and removing them all in one go at the end. Fixes: QTBUG-86507 Change-Id: I41995961945d513fe793b2cea99b78334e3c7425 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Use operator| to compose key sequencesFriedemann Kleint2020-09-071-1/+2
| | | | | | | | | | | In preparation for deprecating operator+. It's deprecated in C++20. Insert casts as necessary. Drive-by, prepare for deprecation of operator+ for building key sequences. Initial-patch-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Pick-to: 5.15 Change-Id: Iaae4e35a56aa1c2365bc25af2582cf820de38d5e Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* CMake: Regenerate load(qt_app) projectsAlexandru Croitor2020-08-261-12/+36
| | | | | | | | | | These now use the new qt_internal_add_app function. Also the script will output necessary code to set the icons and resource files for each of the apps. Task-number: QTBUG-85757 Change-Id: I1a336243fc53a7f329ca17e6c1e40818dabeae30 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* lupdate: Cross-compilation compilation fixesCristian Adam2020-08-193-5/+6
| | | | | | | | | | | For the MinGW Android builds the compiler feature detection that is being done for the target is also applied for the host tools. This requires 85b41d10b8c7355ad525270cfbafc36f8298cb4e from qtbase as a prerequisite. Change-Id: I60d3d473cfaa84875668a432558994fcba4f40c7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>