aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/common/qqmltranslation_p.h
Commit message (Collapse)AuthorAgeFilesLines
* CRA review: mark qml/common subfolderFabian Kosmale2025-11-101-0/+1
| | | | | | | | | | | | | | | | Give most things default significance, except for qjsnumbercoercion.cpp which only contains documentation and qv4compileddata.cpp which gets flagged as critical for being a data-parser. That's somewhat debatable, given that we also excepect qmlc files to be as trustworthy as qml files, but while that is not explicitly stated anywhere we might want to err on the side of caution. Pick-to: 6.10 6.8 Task-number: QTBUG-136194 QUIP: 23 Change-Id: I2987cea2453dcc3b828dc4ecf0ad22fdfd0d1000 Reviewed-by: Olivier De Cannière <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* QQmlTranslation: fix build errorZhao Yuhang2025-04-291-2/+2
| | | | | | | | | | There will be compilation errors if QByteArray's implicit conversion to const char* is disabled (which is possible in some user configurations). Just convert QByteArray to const char* manually, don't rely on such implicit conversions. Change-Id: I7b68066bc82a0a64f38ad8f9903d06ffe4bb0754 Reviewed-by: Ulf Hermann <[email protected]>
* QtQml: Dissolve qqmltranslation.cppUlf Hermann2025-04-111-26/+76
| | | | | | | | | We don't want to export those symbols from QtQml. Move the code that's exclusive to the debug service into the debug service and the code exclusive to qmltc into qmltc. The remaining code can be inline. Change-Id: Icf146af8d4e5931b7ac7bac61a5ba94449ca9402 Reviewed-by: Sami Shalayel <[email protected]>
* QtQml: Add some consistency to QV4::RegExpUlf Hermann2024-12-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The RegExp JIT should behave the same as the V4 JIT. In particular, it should honor the same JIT call threshold and not second guess any manually set thresholds. To do this we need to store the match count in 32 bits. In turn we can store the 5 flags we may have in 8 bits. To make this safe, pass typed flags to the initialization functions. Also, consider the flags when calculating hash values. Finally, in the init() function, we don't need to initialize members to zero, since that is already guaranteed by the memory manager. And we can delete the flagsAsString() method since it's unused. This requires shuffling some #includes into the places where they actually belong. [ChangeLog][QtQml] The JavaScript regular expression engine now honors QV4_JIT_CALL_THRESHOLD for its own JIT. If QV4_JIT_CALL_THRESHOLD is not set, it uses the JIT after 3 interpreted matches for any regular expression, rather than the previous 5. Matching a regular expression on a string longer than 1024 bytes counts as 3 matches. This is to retain the default behavior of JIT'ing regular expressions right away when encountering long strings. Task-number: QTBUG-131957 Change-Id: I269ccea55d34b191ef18d7cd5fccd4cad8aec7cd Reviewed-by: Sami Shalayel <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Remove the use of Q_QML_PRIVATE_EXPORTAlexey Edelev2024-01-111-3/+3
| | | | | | Task-number: QTBUG-117983 Change-Id: I5790f01d614cd70c7fcc9bd817ec6ace3f3e3730 Reviewed-by: Ulf Hermann <[email protected]>
* QQmlTranslation: Use std::nullptr_t rather than std::monostateUlf Hermann2022-10-111-1/+4
| | | | | | | | | | | | Wrapping a std::monostate into a std::variant gives the static analyzer all kinds of headaches. std::nullptr_t should have the same effect without the interesting special cases. Coverity-Id: 401041 Coverity-Id: 401042 Coverity-Id: 401046 Change-Id: I786aefbe0392b5f961c99d7de8bd592bdf591143 Reviewed-by: Fabian Kosmale <[email protected]>
* qmltc: translation binding supportSami Shalayel2022-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Implement and test support for translation bindings in qmltc: * qsTr() * QT_TR_NOOP() * qsTrId() * QT_TRID_NOOP() Not compiled by qmltc, but instead interpreted as script bindings: * combinations like qsTr(qsTr()) * qsTranslate() (as in qmlsc) * QT_TRANSLATE_NOOP() (as in qmlsc) Add the *.qm files directly to the resources as qt_add_translations() is not available from qtdeclarative (the cmake function lives in qttools that depends on qtdeclarative). Fixes: QTBUG-104637 Task-Id: QTBUG-105346 Change-Id: Ia9433c2bcef01f3486358d963059d9779c67708c Reviewed-by: Sami Shalayel <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* Create Translation Bindings without CompiledData::BindingSami Shalayel2022-08-151-0/+70
To add translation bindings to qmltc, the methods used to create translation bindings need to be adapted to work without QV4::CompiledData::Binding as it is not available from qmltc. Instead, information already available from the QQmlJSScope should be used, along with a newly introduced helper class QQmlTranslation. Details: Add a QQmlTranslation class that represents a call to qsTr, qsTrId etc that knows how to translate itself (without needing any ExecutableCompilationUnit or Binding). It encapsulates the information needed to create a translation binding. ExecutableCompilationUnit::bindingValueAsString refactored so its functionality can be used without Binding. Instead, it uses only the translationId, see ExecutableCompilationUnit::translateFromId and ExecutableCompilationUnit::translateFrom. Refactored QQmlTranslationBinding to work with QQmlTranslation instead of CompiledData::Binding. Same for QQmlCppBinding::createTranslationBindingForBindable, QQmlTranslationPropertyBinding::create and QQmlCppBinding::createTranslationBindingForNonBindable. Changed TranslationBindingInformation to work without CompiledData::Binding, and also removed static unused QString ProxyTranslator::originStringFromInformation( const TranslationBindingInformation &translationBindingInformation) as I could not find out what this origin string is. Same for the translation debugging in qmldb_preview. Added QmltcCodeGenerator::generate_createTranslationBindingOnProperty. Added #if to avoid compilation error for standalone DOM compilation due to the new QQmlTranslation class. Task-number: QTBUG-105345 Change-Id: Iccd94d5cba4eaf63901233451fec48051c855c2a Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>