summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/scriptengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix QDesktopServices propertiesKatja Marttila2024-04-021-1/+6
| | | | | | | | | | QStandardPaths has changed in Qt 6.6, changing the script properties for script usage accordingly. Task-number: QTIFW-3334 Change-Id: Ib0bf1f0370d8f8691436df0df28a445e39bdb39f Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Add possibility to change button textKatja Marttila2024-02-221-1/+7
| | | | | | | | | | Sometimes the button texts in installer are not something that is suitable. Added possibility to change button texts from script to a specific installer page. Task-number: QTIFW-711 Change-Id: I2883cda6d770843c3617fda4e6b07d102a357730 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Omit thisObject creation in javascript codeKatja Marttila2023-06-121-36/+0
| | | | | | | | | | | | | | | | Originally, new Component object was created for javascript so that the garbage collector would not destroy the object. This caused the thisObject in javascript to differ from the object in packageManagerCore, which in Qt6.5 lead to warning messages when each script was evaluated: "Warning: :1: Calling C++ methods with 'this' objects different from the one they were retrieved from is broken, due to historical reasons. The original object is used as 'this' object." Fixes so that the new object creation is omitted and QJSEngine::CppOwnership is set to Component object so that garbage collector won't destroy it. Task-number: QTIFW-1829 Change-Id: Ia131d88fc83122f11c5b19a431e7db45e0ba18f9 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Remove unnecessary ConsoleProxyKatja Marttila2023-05-101-10/+3
| | | | | | | | | From 5.x onwards javascript has had ConsoleExtension, no need to create own custom console.log and print functions. Task-number: QTIFW-1829 Change-Id: I892106824e0aa7139f4b2f75df7011525625c27d Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Add more detailed error messagesKatja Marttila2023-03-211-8/+12
| | | | | | | | | | | Once installer is started, metadata is downloaded to cache and that cache is used later to speed the installation process. Cache should not get invalid but sometimes that can happen. Informing user where the cache exists and that clearing it might help when the error occurs. Task-number: QTIFW-2998 Change-Id: Ia2c2a1209fa84070f9ad337c63a429a1afd721a7 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Adapt to differences between Qt5 and Qt6Christian Stenger2022-12-161-1/+1
| | | | | | Task-number: QTIFW-1829 Change-Id: Ieae92a7736784784bc548433eda8b073b1a4b8f8 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* InstallerProxy: optimize querying components by nameArttu Tarkiainen2022-11-071-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | For some API compatibility with QtScript, the QInstaller::ScriptEngine's implementation of newQObject(QObject *object) method adds findChild() and findChildren() functions as properties for the JS object wrapping the QObject, QInstaller::Component in this case. This results in two extra QJSEngine::evaluate() calls, adding some overhead. The Component class does not utilize the QObject's object tree & ownership feature in the C++ side, so the functions do not add extra value in this context. InstallerProxy::ComponentByName() creates the JavaScript object of the component with the aforementioned ScriptEngine::newQObject() implementation. We inject a snippet resulting in a call to InstallerProxy's componentByName() function for each component script. Measuring with callgrind, the time spent in the extra evaluations was around fifth of the whole evaluation cycle. Modify the function to to make the addition of the extra properties optional, and omit them when querying components by name from script. Task-number: QTIFW-2790 Change-Id: I58040809dcf69599e0fabd98def2dc9464aadf84 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Windows: Allow asking installer value with different formatsKatja Marttila2022-05-271-0/+16
| | | | | | | | | | | | | | | | This change expands installer.value() -function allowing QSettings::Format setting when asking registry key. Windows 32bit registry keys on 64bit Windows and 64bit application can be accessed using QSettings::Registry32Format. Window 64bit registry keys on 64bit windows and 32bit application can be accessed using QSettings::Registy64Format. If no format is set, QSettings::NativeFormat is used. Task-number: QTIFW-2657 Change-Id: Ie30e31886526db5b9d72793d5883c11bd1910737 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Replace unnecessary includes with forward declarationsArttu Tarkiainen2022-01-201-1/+3
| | | | | Change-Id: I4e5d627ae1832f6db63decfe1df4309bee938972 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Add possibility to list components with regexpKatja Marttila2021-05-211-3/+3
| | | | | | Task-number: QTIFW-2225 Change-Id: I6a7fdfc1070ad54d520563cae7d2446e97e2e87c Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* CLI: Exit when expecting user input and the output device is not a TTYArttu Tarkiainen2021-02-041-1/+8
| | | | | | | | | | - For arbitrary text input queries, fail and exit. - For file/directory queries, fail and exit. - For message boxes, default to negative option and exit if necessary. Task-number: QTIFW-1949 Change-Id: Iaf8a07247a0e358d4544a856788e48447c6720d9 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Fix translating from component scriptKatja Marttila2021-01-141-6/+1
| | | | | | | | | Translate using QCoreApplication::translate instead of QObject::tr. Removed the use of obsolete installTranslatorFunctions() function. Task-number: QTIFW-392 Change-Id: Icdd67efb6889acd26d63297fb89945c3431c881c Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Fix loading controller script with comment on last lineMartin Kampas2020-11-041-1/+1
| | | | | | | Task-number: QTIFW-1062 Change-Id: I3deb46cae74d1e5851d4ddd4b58c0ba19375ddbd Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Doc: Remove internal classes and structs from generated documentationArttu Tarkiainen2020-09-211-0/+24
| | | | | | | | | | After migration to using 5.12.7 based qdoc, the generated documentation contains also empty declarations for members of undocumented internal classes. Mark them internal as needed. Task-number: QTIFW-1483 Change-Id: Iad40e4efdd098f09a825ce1c8d0aafcc76bd83bf Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Doc: Fix documentation warningsTopi Reinio2020-09-161-1/+1
| | | | | | | | | These changes fix many of the documentation warnings when building with a recent version of (Clang-integrated) QDoc. Change-Id: I5714635a25707cd7ab7bec209fa043a95f0b9832 Reviewed-by: Katja Marttila <katja.marttila@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Add function to enable button click with objectnameKatja Marttila2020-06-041-0/+10
| | | | | | Task-number: QTIFW-1707 Change-Id: I8574ef96df6a00e577549342d4a4336207dcd9ec Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* CLI: Add new option --file-query to auto answer QFileDialogKatja Marttila2020-05-261-2/+67
| | | | | | | | | | | | | QFileDialog.getExistingDirectory and QFileDialog.getOpenFileName can be called from scipt. If command line interface is used, user must type the correct directory or file name from command line during install. With --file-query option user can give the values when running the installer or maintenancetool with syntax --file-query filedialogId=C:/temp,filedialogId2=C:/temp/file.txt. Task-number: QTIFW-1631 Change-Id: I5e58be6b509cf00de832646ef31ec4eda90773be Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Replace 0 with nullptrKatja Marttila2019-01-091-1/+1
| | | | | | | Prevents a lot of warnings seen in QtCreator Change-Id: I63bf95aca68a04fc9fd0eecbe29c63e9b9c47efd Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Merge remote-tracking branch 'origin/3.0' into masterKatja Marttila2018-09-171-1/+10
|\ | | | | | | Change-Id: I77d539e079f3c7d61c4a965b222f4e02c35b1108
| * Prepend file:// on Windows when calling QJSEngine::evaluate()Andy Shaw2018-09-101-1/+10
| | | | | | | | | | | | | | | | | | | | Due to a bug reported at QTBUG-70425, it is necessary to ensure that QJSEngine will see the filename passed in as a valid URL. So we prepend file:// for those cases to ensure qsTr() will find the right context when looking for translations. Change-Id: Ib38b1f8467de78ec82c2c6c6909487f3a06c09bb Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* | Add findFiles methodKatja Marttila2018-03-261-1/+23
|/ | | | | | | Task-number: QTIFW-1094 Change-Id: Ibc37e9b568f7f54e37f6ed6a5b040940cab5aebd Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Add line number information when throwing an Error regarding the scriptAndy Shaw2018-01-241-2/+3
| | | | | Change-Id: I5bc3ca4779ed12d927c3a6a041a81d8e39d5bd1f Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Merge remote-tracking branch 'origin/2.0'Katja Marttila2017-01-301-17/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Changelog dist/config/config.xml dist/packages/org.qtproject.ifw.binaries/meta/package.xml dist/packages/org.qtproject.ifw/meta/package.xml installerfw.pri src/libs/installer/lib7z_create.h src/libs/kdtools/kdgenericfactory.cpp src/libs/kdtools/kdgenericfactory.h src/libs/kdtools/kdupdaterapplication.cpp src/libs/kdtools/kdupdaterapplication.h src/libs/kdtools/kdupdaterupdatesourcesinfo.cpp src/libs/kdtools/kdupdaterupdatesourcesinfo.h src/libs/kdtools/localpackagehub.cpp src/libs/kdtools/localpackagehub.h src/libs/kdtools/updatefinder.cpp src/libs/kdtools/updatefinder.h tools/binarycreator/resources/mkdmg.sh Change-Id: Iab2513f549832d2e750e77131c673457ab265af4
| * License header update to GPL-EXCEPTKatja Marttila2017-01-261-17/+12
| | | | | | | | | | Change-Id: I6426c4e8f932cf26c6c638dec18d0c12e22972d1 Reviewed-by: Janne Anttila <janne.anttila@theqtcompany.com>
* | Introduced gui.setTextItems() methodFrerich Raabe2016-06-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This utility function can be used to populate a Qt control which is backed by some QAbstractItemModel with a list of strings. E.g. this can be used to populate a QComboBox or any QAbstractItemView with some items. This is very useful since in many cases, the methods for adding elements to such controls are neither slots, nor marked with Q_INVOKABLE and such unreachable from the script code. Change-Id: I2195f41e53765ef3a798477ed08d8f09ab5c4379 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* | Merge remote-tracking branch 'origin/2.0'Iikka Eklund2016-01-201-4/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: installerfw.pri src/libs/kdtools/kdgenericfactory.cpp src/libs/kdtools/kdgenericfactory.h src/libs/kdtools/kdupdaterapplication.cpp src/libs/kdtools/kdupdaterapplication.h src/libs/kdtools/kdupdaterupdatesourcesinfo.cpp src/libs/kdtools/kdupdaterupdatesourcesinfo.h sync.profile Change-Id: Ifdc8b065f89b7e241bd3788ed79768e21888161f
| * Update license headersIikka Eklund2015-12-291-4/+3
| | | | | | | | | | | | | | | | | | Update existing license headers. LGPL -> LGPLv21. Update copyright year as well. Change-Id: Ie1d71f8c68186b8f625f409ddf94691f178093c9 Reviewed-by: Katja Marttila <katja.marttila@theqtcompany.com> Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* | add silent modeChristoph Vogtländer2015-07-171-0/+9
| | | | | | | | | | | | | | | | | | | | Add possibility to run silently without a gui. Silent mode can be enabled in a controller script using gui.setSilent(true). Change-Id: I5c5d0cc2be734e8e447edfe4e71106fe08f87188 Task-number: QTIFW-166 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
* | Unify translated error messagesKai Koehne2015-06-241-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | * Enclose file paths in "" * Localize file paths with QDir::toNativeSeparators. * Make sure sentences end with a '.' * Append error details always by ':', e.g. tr("Failed to copy file '%1': %2").(...) * Use 'directory' instead of 'folder' everywhere Change-Id: Ie045f429f72ad5045c96537465c5fb9d2e99d250 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* | Convert to Qt 5 connect syntaxKai Koehne2015-06-151-1/+1
|/ | | | | | | | | | | | Convert to new signal/slot syntax where it does not make things more complicated: connections where the signal or slot is an overloaded method, or where the receiver method is not in a QObject, are left alone. The new syntax allows compile-time checking of the connection. Change-Id: I2cc3c93b9812797bd67f64a8728569491eeec668 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
* Doc: add docs for ScriptEngine::newArrayLeena Miettinen2015-05-271-0/+4
| | | | | Change-Id: I69462de7442612c35634cead37572db387031c3e Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* fix empty installer.components arrayChristoph Vogtländer2015-03-131-10/+21
| | | | | | | | | | Make sure the current list of components is used when referencing installer.components in a controller script. Change-Id: I9468110d61a958f13edba66da0059d6622aa7037 Task-number: QTIFW-601 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* Doc: move ScriptEngine scripting docs to separate filesLeena Miettinen2015-03-061-313/+0
| | | | | Change-Id: Iac1c810cf52fb4a480ebde956d62830af97b6f8c Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Doc: add docs for ScriptEngine methodsLeena Miettinen2015-02-251-3/+17
| | | | | | | Fix the formatting of a list. Change-Id: I93bcd369f5e685fecacab632b801084199b06d4b Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* Update CopyrightKai Koehne2015-02-181-7/+7
| | | | | Change-Id: I8dde6629cfd461104364d5cdc255cb54b58283fa Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Doc: fix language and QDoc command issuesLeena Miettinen2015-02-121-2/+2
| | | | | | | | To follow the Qt documentation guidelines. Change-Id: I8f533737b39d7d58645a05b033fc966f70918369 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Doc: add docs for arguments and return valuesLeena Miettinen2015-01-301-3/+4
| | | | | | | | To get rid of QDoc errors. Change-Id: I4932f1f3ff5fab87eebf24536d63be550582b195 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Doc: add docs for QDesktopServices JavaScript objectLeena Miettinen2015-01-281-3/+32
| | | | | | | | | Based on Qt 5 documentation for QDesktopServices. Change-Id: Ib1a42505b1c046b5175aae0a76f3c71d58c0e86f Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Make sure component wrapper is not deleted in advanceKai Koehne2015-01-281-1/+11
| | | | | | | | | | Use ScriptEngine::newQObject instead of the stock QScriptEngine one. This one (among other things) sets object ownership to Cpp, preventing dubious "cannot call name on undefined" script failures if the garbage collector runs. Change-Id: Ib3275012d307533c13de3520f4630d1eeee66869 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Doc: Add docs for QInstaller JavaScript objectLeena Miettinen2015-01-231-19/+38
| | | | | Change-Id: Ied88c365fdbd1cb7fe07d4ed196e7b568f6e892c Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Doc: add docs for QFileDialog JavaScript objectLeena Miettinen2015-01-221-0/+32
| | | | | | | | Based on Qt reference docs for QFileDialog. Change-Id: Ic56fd5a48b290608f7810bc8f9260367389c5896 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Doc: add docs for the gui JavaScript objectLeena Miettinen2015-01-221-0/+12
| | | | | | | | Based on the example code in the Manual. Change-Id: I4b933fe49768fe296c89d715ea5aef30b6e3430b Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Doc: add docs for the console JavaScript objectLeena Miettinen2015-01-211-0/+19
| | | | | | | Change-Id: I0560178f9a1fbd60fa4a5f7c25706b2c826ecd14 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Doc: add docs for buttons JavaScript objectLeena Miettinen2015-01-131-11/+26
| | | | | | | | | Based on Qt 5 QWizard documentation. Change-Id: Ic61ed428d1513fc21131992b1b40bf63a93b4fd2 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Doc: remove "type" from briefs in Scripting APILeena Miettinen2015-01-131-2/+2
| | | | | | | | These are not QML types, but JavaScript objects. Change-Id: Ib50656c764270a1184c74a2c653438a2f42846fd Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Fix objects returned by gui methodsKai Koehne2015-01-081-9/+146
| | | | | | | | | | | | | We need to make sure objects like pageWidgetByObjectName are augmented too (so that one can access child objects). This is achieved by a proxy object that augments all raw QObject * and QWidget * return values. This fixes e.g. the dynamicpage example. Task-number: QTIFW-605 Change-Id: If26dc59220946a7445ef0f9ec7caa15e5b04eaa8 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Simplify registration of objects into script engineKai Koehne2015-01-071-29/+36
| | | | | | | | | | | | Rename addQObjectChildren, removeQObjectChildren methods to addToGlobalObject, removeToGlobalObject, and merge the augmentation of the properties with newQObject. Also, don't recursively register all objects with their objectNames in the global scope. This avoids name pollution. Change-Id: I28f1bc67e6febecc7b5142982c918432b61ed96f Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Expose findChild, findChildren methods to JSKai Koehne2014-12-101-0/+31
| | | | | | | | Re-add the findChild, findChildren methods known from Qt Script. Change-Id: I3db6be53ccd89a09b2c7de14ba7f96ebb26dbdbb Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Expose systemInfo APIKai Koehne2014-12-051-0/+3
| | | | | | | | | Add systemInfo as a wrapper for QSystemInfo. Task-number: QTIFW-592 Change-Id: Ib54fcea8b0ef3a397a74f5315202f3000abd63cd Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
* Set the object ownership -before- adding the widget as property.kh12014-11-171-0/+1
| | | | | Change-Id: I0af2c4ae71bcf89466826024b8a2af4584d805be Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>