From e8a9dc249a098eb95965ff9992b57c3f30a95f43 Mon Sep 17 00:00:00 2001 From: "Dr. Peter Droste" Date: Sun, 19 Mar 2023 00:18:37 +0100 Subject: [PATCH] Release version 6.4.4 #135 Decreasing UI performance of QListView #129 UIC to Kotlin errors and exceptions #139 Does qtJambi work also for STM32MP1? #130 How to use QtJambi Generator to create Java bindings to Qt C++ dependency library --- README.md | 6 +- antcontrib.properties | 22 - antfiles/autotests.xml | 39 +- antfiles/generator.xml | 3 + antfiles/native.xml | 6 +- antfiles/setenv.xml | 120 - build.properties | 4 + build.xml | 78 +- releases.properties | 6 +- src/cpp/QtJambi/configure.pri | 10 +- src/cpp/QtJambi/convert.cpp | 307 +- src/cpp/QtJambi/coreapi.cpp | 20 +- src/cpp/QtJambi/coreapi.h | 2 - src/cpp/QtJambi/events.cpp | 12 +- src/cpp/QtJambi/fileengine.cpp | 15 +- src/cpp/QtJambi/functionpointer.cpp | 24 +- src/cpp/QtJambi/functionpointer.h | 18 +- src/cpp/QtJambi/future.cpp | 79 +- src/cpp/QtJambi/java.cpp | 86 +- src/cpp/QtJambi/javaapi.h | 37 + src/cpp/QtJambi/javainvalidate.cpp | 80 +- src/cpp/QtJambi/javainvalidate.h | 5 +- src/cpp/QtJambi/jna.cpp | 100 +- src/cpp/QtJambi/jni_nativepointer.cpp | 24 +- src/cpp/QtJambi/jni_utilities.cpp | 119 +- src/cpp/QtJambi/jobjectwrapper.cpp | 14 +- src/cpp/QtJambi/jobjectwrapper.h | 26 +- .../qtjambi_cast_impl_container_associative.h | 6 +- .../qtjambi_cast_impl_container_sequential.h | 3 +- src/cpp/QtJambi/qtjambi_cast_impl_jnitype.h | 73 +- src/cpp/QtJambi/qtjambi_cast_impl_template1.h | 183 +- src/cpp/QtJambi/qtjambi_cast_impl_template2.h | 8 +- src/cpp/QtJambi/qtjambi_cast_impl_template3.h | 4 +- src/cpp/QtJambi/qtjambi_cast_impl_template4.h | 18 +- src/cpp/QtJambi/qtjambi_cast_impl_template5.h | 16 +- src/cpp/QtJambi/qtjambi_cast_impl_util.h | 24 + src/cpp/QtJambi/qtjambiapi.cpp | 32 +- src/cpp/QtJambi/qtjambiapi.h | 44 +- src/cpp/QtJambi/qtjambilink.cpp | 1158 +- src/cpp/QtJambi/qtjambilink_p.h | 230 +- src/cpp/QtJambi/qtjambimetaobject.cpp | 12 +- src/cpp/QtJambi/qtjambishell.cpp | 10 +- src/cpp/QtJambi/registry.cpp | 137 +- src/cpp/QtJambi/registryapi.h | 126 +- src/cpp/QtJambi/scope.cpp | 14 + src/cpp/QtJambi/scope.h | 1 + src/cpp/QtJambi/typeentry.cpp | 1783 +++- src/cpp/QtJambi/typeentry_p.h | 456 +- src/cpp/QtJambi/typemanager.cpp | 61 +- src/cpp/QtJambi/utils_p.h | 7 + src/cpp/QtJambi3DAnimation/hashes.h | 37 +- src/cpp/QtJambi3DRender/hashes.h | 52 +- src/cpp/QtJambiBluetooth/hashes.h | 253 +- src/cpp/QtJambiCore/hashes.h | 587 +- src/cpp/QtJambiCore/impl.cpp | 63 +- src/cpp/QtJambiDataVisualization/hashes.h | 59 +- src/cpp/QtJambiDesigner/QtJambiDesigner.pro | 2 + src/cpp/QtJambiDesigner/impl.cpp | 8 + src/cpp/QtJambiDesigner/utils_p.h | 44 + .../QtJambiGenerator/abstractgenerator.cpp | 193 +- src/cpp/QtJambiGenerator/abstractgenerator.h | 4 + src/cpp/QtJambiGenerator/asttoxml.cpp | 21 +- src/cpp/QtJambiGenerator/cppgenerator.cpp | 182 +- src/cpp/QtJambiGenerator/cppgenerator.h | 73 +- .../QtJambiGenerator/cppheadergenerator.cpp | 56 +- src/cpp/QtJambiGenerator/cppheadergenerator.h | 22 +- src/cpp/QtJambiGenerator/cppimplgenerator.cpp | 1729 ++- src/cpp/QtJambiGenerator/cppimplgenerator.h | 22 +- .../QtJambiGenerator/docindex/docfunction.cpp | 7 + .../QtJambiGenerator/docindex/docfunction.h | 2 + src/cpp/QtJambiGenerator/generator.cpp | 620 +- src/cpp/QtJambiGenerator/generator.h | 8 + src/cpp/QtJambiGenerator/javagenerator.cpp | 2044 ++-- src/cpp/QtJambiGenerator/javagenerator.h | 291 +- src/cpp/QtJambiGenerator/library.pro | 6 +- src/cpp/QtJambiGenerator/metabuilder.cpp | 5167 +++++---- src/cpp/QtJambiGenerator/metabuilder.h | 96 +- .../QtJambiGenerator/metainfogenerator.cpp | 112 +- src/cpp/QtJambiGenerator/metainfogenerator.h | 11 +- src/cpp/QtJambiGenerator/metalang.cpp | 693 +- src/cpp/QtJambiGenerator/metalang.h | 745 +- src/cpp/QtJambiGenerator/parser/ast.h | 7 +- src/cpp/QtJambiGenerator/parser/binder.cpp | 521 +- src/cpp/QtJambiGenerator/parser/binder.h | 22 +- .../parser/class_compiler.cpp | 70 + .../QtJambiGenerator/parser/class_compiler.h | 84 +- src/cpp/QtJambiGenerator/parser/codemodel.cpp | 345 +- src/cpp/QtJambiGenerator/parser/codemodel.h | 227 +- .../parser/codemodel_finder.cpp | 2 +- .../parser/codemodel_finder.h | 6 +- .../QtJambiGenerator/parser/codemodel_fwd.h | 1 + .../parser/compiler_utils.cpp | 14 +- .../parser/declarator_compiler.cpp | 6 +- .../parser/declarator_compiler.h | 4 + src/cpp/QtJambiGenerator/parser/lexer.cpp | 47 +- src/cpp/QtJambiGenerator/parser/lexer.h | 11 +- .../QtJambiGenerator/parser/name_compiler.cpp | 238 +- .../QtJambiGenerator/parser/name_compiler.h | 12 +- src/cpp/QtJambiGenerator/parser/parser.cpp | 248 +- src/cpp/QtJambiGenerator/parser/parser.h | 3 +- .../parser/rpp/pp-engine-bits.cpp | 1 + .../parser/rpp/pp-engine-bits.h | 31 +- .../parser/rpp/pp-environment.cpp | 8 + .../parser/rpp/pp-environment.h | 4 + .../parser/rpp/pp-macro-expander.h | 48 +- .../QtJambiGenerator/parser/rpp/pp-scanner.h | 9 +- .../parser/rpp/preprocessor.cpp | 2 +- src/cpp/QtJambiGenerator/parser/tokens.cpp | 13 +- src/cpp/QtJambiGenerator/parser/tokens.h | 11 +- .../QtJambiGenerator/parser/type_compiler.cpp | 1 + .../QtJambiGenerator/parser/type_compiler.h | 2 + .../QtJambiGenerator/preprocesshandler.cpp | 2 +- src/cpp/QtJambiGenerator/targets/all.h | 101 +- src/cpp/QtJambiGenerator/typeparser.cpp | 179 +- src/cpp/QtJambiGenerator/typeparser.h | 12 +- .../QtJambiGenerator/typesystem/codesnip.h | 1 + .../typesystem/java/QtJambi3DCore.java | 14 +- .../typesystem/java/QtJambiCharts.java | 8 +- .../typesystem/java/QtJambiConcurrent.java | 3078 +++--- .../typesystem/java/QtJambiCore.java | 3417 +++--- .../typesystem/java/QtJambiGui.java | 168 +- .../typesystem/java/QtJambiHttpServer.java | 362 +- .../typesystem/java/QtJambiLocation.java | 12 +- .../typesystem/java/QtJambiMultimedia.java | 78 +- .../typesystem/java/QtJambiNetwork.java | 16 +- .../typesystem/java/QtJambiQml.java | 141 +- .../typesystem/java/QtJambiQuick.java | 6 +- .../typesystem/java/QtJambiQuickTest.java | 18 +- .../typesystem/java/QtJambiRemoteObjects.java | 26 +- .../typesystem/java/QtJambiScxml.java | 4 +- .../typesystem/java/QtJambiTest.java | 318 +- .../typesystem/java/QtJambiWidgets.java | 521 +- .../typesystem/java/QtJambiXml.java | 25 +- .../typesystem/modification.h | 21 +- .../typesystem/qml/Qt3DAnimation.qml | 238 +- .../typesystem/qml/Qt3DCore.qml | 454 +- .../typesystem/qml/Qt3DExtras.qml | 63 +- .../typesystem/qml/Qt3DInput.qml | 114 +- .../typesystem/qml/Qt3DLogic.qml | 12 +- .../typesystem/qml/Qt3DQuick.qml | 23 +- .../typesystem/qml/Qt3DQuickExtras.qml | 17 +- .../typesystem/qml/Qt3DQuickRender.qml | 27 +- .../typesystem/qml/Qt3DQuickScene2D.qml | 16 +- .../typesystem/qml/Qt3DRender.qml | 1271 +-- .../typesystem/qml/QtActiveX.qml | 171 +- .../typesystem/qml/QtBluetooth.qml | 536 +- .../typesystem/qml/QtBodymovin.qml | 2 +- .../typesystem/qml/QtCharts.qml | 158 +- .../typesystem/qml/QtConcurrent.qml | 1465 ++- .../typesystem/qml/QtCore.qml | 9319 ++++++----------- .../typesystem/qml/QtDBus.qml | 900 +- .../typesystem/qml/QtDataVisualization.qml | 407 +- .../typesystem/qml/QtDesigner.qml | 572 +- .../typesystem/qml/QtGamepad.qml | 16 +- .../QtJambiGenerator/typesystem/qml/QtGui.qml | 4066 +++---- .../typesystem/qml/QtHelp.qml | 98 +- .../typesystem/qml/QtHttpServer.qml | 234 +- .../typesystem/qml/QtLocation.qml | 140 +- .../typesystem/qml/QtMacExtras.qml | 4 +- .../typesystem/qml/QtMultimedia.qml | 593 +- .../typesystem/qml/QtMultimediaWidgets.qml | 6 +- .../typesystem/qml/QtNetwork.qml | 398 +- .../typesystem/qml/QtNetworkAuth.qml | 57 +- .../QtJambiGenerator/typesystem/qml/QtNfc.qml | 168 +- .../typesystem/qml/QtOpenGL.qml | 930 +- .../typesystem/qml/QtOpenGLWidgets.qml | 2 +- .../QtJambiGenerator/typesystem/qml/QtPdf.qml | 126 +- .../typesystem/qml/QtPdfWidgets.qml | 2 +- .../typesystem/qml/QtPositioning.qml | 83 +- .../typesystem/qml/QtPrintSupport.qml | 197 +- .../typesystem/qml/QtPurchasing.qml | 2 +- .../QtJambiGenerator/typesystem/qml/QtQml.qml | 885 +- .../typesystem/qml/QtQuick.qml | 1430 +-- .../typesystem/qml/QtQuick3D.qml | 85 +- .../typesystem/qml/QtQuickControls2.qml | 4 +- .../typesystem/qml/QtQuickTest.qml | 30 +- .../typesystem/qml/QtQuickWidgets.qml | 2 +- .../typesystem/qml/QtRemoteObjects.qml | 59 +- .../typesystem/qml/QtScript.qml | 57 +- .../typesystem/qml/QtScriptTools.qml | 2 +- .../typesystem/qml/QtScxml.qml | 275 +- .../typesystem/qml/QtSensors.qml | 139 +- .../typesystem/qml/QtSerialBus.qml | 429 +- .../typesystem/qml/QtSerialPort.qml | 8 +- .../typesystem/qml/QtSpatialAudio.qml | 2 +- .../QtJambiGenerator/typesystem/qml/QtSql.qml | 95 +- .../typesystem/qml/QtStateMachine.qml | 23 +- .../QtJambiGenerator/typesystem/qml/QtSvg.qml | 2 +- .../typesystem/qml/QtSvgWidgets.qml | 2 +- .../typesystem/qml/QtTest.qml | 1048 +- .../typesystem/qml/QtTextToSpeech.qml | 6 +- .../typesystem/qml/QtUiTools.qml | 2 +- .../typesystem/qml/QtVirtualKeyboard.qml | 12 +- .../typesystem/qml/QtWebChannel.qml | 4 +- .../typesystem/qml/QtWebEngine.qml | 7 +- .../typesystem/qml/QtWebEngineCore.qml | 478 +- .../typesystem/qml/QtWebEngineQuick.qml | 7 +- .../typesystem/qml/QtWebEngineWidgets.qml | 218 +- .../typesystem/qml/QtWebSockets.qml | 98 +- .../typesystem/qml/QtWebView.qml | 2 +- .../typesystem/qml/QtWidgets.qml | 2532 ++--- .../typesystem/qml/QtWinExtras.qml | 26 +- .../typesystem/qml/QtX11Extras.qml | 19 +- .../QtJambiGenerator/typesystem/qml/QtXml.qml | 215 +- .../typesystem/qml/QtXmlPatterns.qml | 217 +- .../QtJambiGenerator/typesystem/qml/ui4.qml | 619 +- .../typesystem/qml_abstractobject.h | 4 +- .../typesystem/qml_modify.cpp | 78 + .../QtJambiGenerator/typesystem/qml_modify.h | 53 + .../typesystem/qmltypesystemreader.cpp | 422 +- .../typesystem/typedatabase.cpp | 59 +- .../typesystem/typedatabase.h | 33 +- .../QtJambiGenerator/typesystem/typeentry.cpp | 74 +- .../QtJambiGenerator/typesystem/typeentry.h | 368 +- src/cpp/QtJambiGenerator/typesystem/utils.cpp | 13 +- src/cpp/QtJambiGenerator/typesystem/utils.h | 6 +- .../typesystem/xmltypesystemreader.cpp | 8 +- src/cpp/QtJambiGui/hashes.h | 859 +- src/cpp/QtJambiGui/impl.cpp | 34 +- src/cpp/QtJambiHelp/hashes.h | 9 +- src/cpp/QtJambiLocation/hashes.h | 267 +- src/cpp/QtJambiMultimedia/hashes.h | 370 +- src/cpp/QtJambiMultimedia/impl.cpp | 2 +- src/cpp/QtJambiNetwork/hashes.h | 307 +- src/cpp/QtJambiNfc/hashes.h | 18 +- src/cpp/QtJambiPlugin/QtJambiPlugin.pro | 3 +- src/cpp/QtJambiPositioning/hashes.h | 164 +- src/cpp/QtJambiQml/hashes.h | 50 +- src/cpp/QtJambiQml/impl.cpp | 389 +- src/cpp/QtJambiQml/utils_p.h | 14 + src/cpp/QtJambiQuick/hashes.h | 163 +- src/cpp/QtJambiRemoteObjects/hashes.h | 9 +- src/cpp/QtJambiScript/hashes.h | 38 +- src/cpp/QtJambiSensors/QtJambiSensors.pro | 7 + src/cpp/QtJambiSensors/impl.cpp | 48 + src/cpp/QtJambiSensors/utils_p.h | 7 + src/cpp/QtJambiSerialBus/hashes.h | 185 +- src/cpp/QtJambiSerialBus/impl.cpp | 4 + src/cpp/QtJambiSerialBus/utils_p.h | 3 + src/cpp/QtJambiSql/hashes.h | 58 +- src/cpp/QtJambiTextToSpeech/hashes.h | 11 +- src/cpp/QtJambiWebEngineCore/hashes.h | 106 +- src/cpp/QtJambiWebEngineQuick/impl.cpp | 4 +- src/cpp/QtJambiWebEngineWidgets/hashes.h | 119 +- src/cpp/QtJambiWidgets/hashes.h | 21 +- src/cpp/QtJambiXml/hashes.h | 105 +- .../QtJambiXmlPatterns/QtJambiXmlPatterns.pro | 3 + src/cpp/QtJambiXmlPatterns/hashes.h | 91 + src/cpp/autotests/autotests.qml | 202 +- src/cpp/autotests/global.cpp | 18 +- src/cpp/autotests/nativepointertester.h | 6 - src/cpp/functionpointers/functionpointers.pri | 1 + src/cpp/jarimport/jarimport.pro | 1 + src/cpp/modules.pro | 2 +- src/java/ant/io/qt/tools/ant/Constants.java | 2 + .../tools/ant/CreateNativeDeploymentTask.java | 130 +- .../io/qt/tools/ant/ForeachVersionTask.java | 2 +- .../ant/io/qt/tools/ant/GeneratorTask.java | 29 + src/java/ant/io/qt/tools/ant/IfTask.java | 94 + .../io/qt/tools/ant/InitializeBuildTask.java | 40 +- src/java/ant/io/qt/tools/ant/IsLessThan.java | 75 + src/java/ant/io/qt/tools/ant/MakeTask.java | 4 +- src/java/ant/io/qt/tools/ant/OSInfo.java | 18 + src/java/ant/io/qt/tools/ant/QMakeTask.java | 3 + .../ant/io/qt/tools/ant/TryCatchTask.java | 106 + src/java/ant/io/qt/tools/ant/ant-qtjambi.xml | 32 +- .../qt/autotests/ApplicationInitializer.java | 51 +- .../qt/autotests/TestBluetoothDiscovery.java | 12 +- .../qt/autotests/TestClassFunctionality.java | 9 +- .../io/qt/autotests/TestConnections.java | 6 +- .../io/qt/autotests/TestExceptions.java | 1 - .../io/qt/autotests/TestFileEngine.java | 8 +- .../autotests/io/qt/autotests/TestFuture.java | 23 +- .../io/qt/autotests/TestInjectedCode.java | 15 +- .../io/qt/autotests/TestNativePointer.java | 8 - .../autotests/io/qt/autotests/TestPlugin.java | 4 +- .../io/qt/autotests/TestQThread.java | 95 +- .../io/qt/autotests/TestQmlPlugin.java | 2 +- .../io/qt/autotests/TestSignals.java | 5 +- .../io/qt/autotests/TestThreadAffinity.java | 10 +- src/java/modules/modules.xml | 81 +- .../qt/qtjambi/deployer/BundleGenerator.java | 102 +- .../deployer/ContainerAccessGenerator.java | 2 +- .../qt/qtjambi/deployer/containeraccess.pro | 1 + .../io/qt/qtjambi/deployer/plugin.pro | 1 + .../io/qt/uic/java/WriteInitialization.java | 22 +- .../io/qt/uic/kotlin/WriteClass.java | 8 +- .../io/qt/uic/kotlin/WriteInitialization.java | 293 +- .../qtjambi/Qt6/io/qt/core/QPermission.java | 15 + src/java/modules/qtjambi/build.xml | 53 +- .../modules/qtjambi/jsr305/io/qt/NonNull.java | 45 + .../qtjambi/jsr305/io/qt/Nullable.java | 45 + .../qtjambi/jsr305/io/qt/StrictNonNull.java | 47 + .../qtjambi/main/io/qt/QNativePointer.java | 22 +- .../qtjambi/main/io/qt/QtUtilities.java | 16 + .../AbstractAssociativeContainer.java | 4 - .../main/io/qt/internal/AbstractHash.java | 4 - .../main/io/qt/internal/AbstractList.java | 4 - .../main/io/qt/internal/AbstractMap.java | 4 - .../AbstractMultiAssociativeContainer.java | 4 - .../io/qt/internal/AbstractMultiHash.java | 4 - .../main/io/qt/internal/AbstractMultiMap.java | 4 - .../internal/AbstractSequentialContainer.java | 4 - .../main/io/qt/internal/LibraryUtility.java | 12 +- .../main/io/qt/internal/MetaTypeUtility.java | 16 +- .../main/io/qt/internal/SignalUtility.java | 2 - .../qtjambi/non-jsr305/io/qt/NonNull.java | 43 + .../qtjambi/non-jsr305/io/qt/Nullable.java | 43 + .../non-jsr305/io/qt/StrictNonNull.java | 43 + src/java/plugins/plugins.xml | 2 +- src/java/qml/qml.xml | 2 +- 311 files changed, 32567 insertions(+), 35310 deletions(-) delete mode 100644 antcontrib.properties delete mode 100644 antfiles/setenv.xml create mode 100644 src/cpp/QtJambiDesigner/utils_p.h create mode 100644 src/cpp/QtJambiXmlPatterns/hashes.h create mode 100644 src/java/ant/io/qt/tools/ant/IfTask.java create mode 100644 src/java/ant/io/qt/tools/ant/IsLessThan.java create mode 100644 src/java/ant/io/qt/tools/ant/TryCatchTask.java create mode 100644 src/java/modules/qtjambi/Qt6/io/qt/core/QPermission.java create mode 100644 src/java/modules/qtjambi/jsr305/io/qt/NonNull.java create mode 100644 src/java/modules/qtjambi/jsr305/io/qt/Nullable.java create mode 100644 src/java/modules/qtjambi/jsr305/io/qt/StrictNonNull.java create mode 100644 src/java/modules/qtjambi/non-jsr305/io/qt/NonNull.java create mode 100644 src/java/modules/qtjambi/non-jsr305/io/qt/Nullable.java create mode 100644 src/java/modules/qtjambi/non-jsr305/io/qt/StrictNonNull.java diff --git a/README.md b/README.md index 72c5ae10..f49be09b 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ Make yourself familiar with [developing applications with QtJambi](www/How-to-de * [Apache Ant](https://ant.apache.org/) (min. 1.10.x) * Java Development Kit (e.g. [OpenJDK](https://adoptopenjdk.net/), tested with Java 1.8 and 18) * Qt 5.15 or 6.x (using the Qt Online Installer) -* C++ compiler (Gcc, Clang, MSVC2019) -* chrpath (Linux only) +* Minimum required Qt modules: QtCore, QtQml, QtNetwork, QtConcurrent and QtXml +* C++ compiler and make (Gcc, Clang, MSVC2019) * XCode command line tools (macOS only) ### Building QtJambi If you do'nt need the entire set of Qt modules available in Java edit property `qtjambi.skipped.modules` in `build.properties` and exclude Qt modules you don't need. -This saves compilation time. +This saves compilation time. Although QtJambi build process requires the availability of QtQml, QtNetwork, QtConcurrent and QtXml, you can skip them from being generated as QtJambi module. #### Pre-Build Steps On Windows * Open the Visual Studio command prompt for x64 architecture. diff --git a/antcontrib.properties b/antcontrib.properties deleted file mode 100644 index 7e9cee0d..00000000 --- a/antcontrib.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# This file contains the necessary properties to download ant-contrib and have -# it known throughout the build system. -# -# You have two options: -# * either you fill in the antcontrib.system.location property below, which -# should point to the place where you have the JAR for ant-contrib (there's no -# need to put it in the CLASSPATH); -# * either you don't have ant-contrib on your system, in which case the two -# other properties tell where to download the binary distribution and where, -# in the binary distribution, the ant-contrib jar itself is located. -# -# Ideally, you want the first solution, of course. -# -# Example: where to find ant-contrib.jar on a Gentoo Linux system (if -# installed): -#antcontrib.system.location = /usr/share/ant-contrib/lib/ant-contrib.jar - -# -# Where to download it from: -# -antcontrib.download.url=https://repo1.maven.org/maven2/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar diff --git a/antfiles/autotests.xml b/antfiles/autotests.xml index f9b1eed3..f03fe9f9 100644 --- a/antfiles/autotests.xml +++ b/antfiles/autotests.xml @@ -178,6 +178,7 @@ importdirectories="generator/${psep}${basedir}/src/cpp/autotests" outputDirectory="${outputDir}/tests" generatorDirectory="${generator.builddir}/../bin" + nullness="${qtjambi.generate.nullness}" qtlibdirectory="${generator.builddir}/../lib${psep}${tools.qt.libdir}" qtbindirectory="${generator.builddir}/../bin${psep}${tools.qt.bindir}" qtjambiVersion="${qtjambi.patchversion}" @@ -606,12 +607,12 @@ - + - + @@ -675,21 +676,6 @@ - - - - - - - - - - - - - - - @@ -730,21 +716,6 @@ - - - - - - - - - - - - - - - @@ -903,7 +874,7 @@ + depends="log, init.taskdef" description="Generates all test reports"> @@ -1065,7 +1036,7 @@ - + diff --git a/antfiles/generator.xml b/antfiles/generator.xml index 7de5a7fd..8d4261c9 100644 --- a/antfiles/generator.xml +++ b/antfiles/generator.xml @@ -5,10 +5,13 @@ + - + @@ -338,6 +338,9 @@ + + + @@ -357,6 +360,7 @@ + diff --git a/antfiles/setenv.xml b/antfiles/setenv.xml deleted file mode 100644 index 6aca9720..00000000 --- a/antfiles/setenv.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build.properties b/build.properties index 0e0c604e..0d39d9e6 100644 --- a/build.properties +++ b/build.properties @@ -17,5 +17,9 @@ qt.docs=https://doc.qt.io/qt-${qtjambi.soname.version.major}/ io.qt.debug.level=255 minimum.java.version=11 qtjambi.macos.frameworks=true +org.eclipse.jdt.annotation.url=https://repo1.maven.org/maven2/org/eclipse/jdt/org.eclipse.jdt.annotation/2.2.700/org.eclipse.jdt.annotation-2.2.700.jar +antcontrib.download.url=https://repo1.maven.org/maven2/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar +jsr305.url=https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar +kotlin-annotations-jvm.url=https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-annotations-jvm/1.8.10/kotlin-annotations-jvm-1.8.10.jar #qtjambi.skipped.modules=xmlpatterns,macextras,winextras,x11extras,serialport,script,scripttools,networkauth,help,multimedia,dbus,test,webengine,webview,remoteobjects,gamepad,scxml,nfc,texttospeech,serialbus,sensors,location,positioning,bluetooth,3d,3dlogic,3dquickextras,3dquickrender,3dquick,3dinput,3drender,3danimation,3dextras,websockets,webchannel,purchasing,quickcontrols2,statemachine,charts,datavisualization,virtualkeyboard,quick3d,opengl, #quick,quickwidgets,svg,printsupport,xml,network,sql,widgets,gui,qml,concurrent \ No newline at end of file diff --git a/build.xml b/build.xml index 1c73a9d9..206db83d 100644 --- a/build.xml +++ b/build.xml @@ -22,7 +22,6 @@ Import files containing tasks for the compilation. --> - @@ -33,6 +32,7 @@ but no one is expected to change them. --> + - - - - - - - - - - + + + + + + diff --git a/src/java/autotests/io/qt/autotests/ApplicationInitializer.java b/src/java/autotests/io/qt/autotests/ApplicationInitializer.java index ee0916a7..eabd60a3 100644 --- a/src/java/autotests/io/qt/autotests/ApplicationInitializer.java +++ b/src/java/autotests/io/qt/autotests/ApplicationInitializer.java @@ -69,6 +69,14 @@ public abstract class ApplicationInitializer extends UnitTestInitializer{ + @org.junit.Rule public final org.junit.rules.TestRule testRule = new org.junit.rules.TestRule(){ + @Override + public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) { + java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.INFO, "Start test "+description.getClassName()+"."+description.getMethodName()); + return base; + } + }; + protected static final List> instances = Collections.synchronizedList(new ArrayList<>()); @BeforeClass @@ -87,7 +95,7 @@ public static void testInitializeWithWidgets() throws Exception { private static void testInitialize(int mode) throws Exception { try { if(QCoreApplication.instance()==null) { - java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.FINE, "testInitialize: begin"); + java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.INFO, "testInitialize: BEGIN"); QResource.addClassPath("."); QCoreApplication.setApplicationName("QtJambiUnitTest"); switch(mode){ @@ -102,7 +110,7 @@ private static void testInitialize(int mode) throws Exception { break; } QThread.currentThread().setObjectName("main"); - java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.FINE, "testInitialize: done"); + java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.INFO, "testInitialize: DONE"); } } catch (Throwable e) { e.printStackTrace(); @@ -113,6 +121,7 @@ private static void testInitialize(int mode) throws Exception { @AfterClass public static void testDispose() throws Exception { try { + java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.INFO, "testDispose: BEGIN"); Object currentThread = QThread.currentThread(); while(!instances.isEmpty()) { WeakReference weak = instances.remove(0); @@ -125,7 +134,6 @@ public static void testDispose() throws Exception { } } } - java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.FINE, "testDispose: BEGIN"); runGC(); // We are attempting to reach a point here where memory should be reclaimed @@ -228,7 +236,7 @@ public static void testDispose() throws Exception { TestUtility.flushErr(); // fflush(stderr) java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.FINE, "testDispose: end objectCount="+objectCount); }finally { - java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.FINE, "testDispose: DONE"); + java.util.logging.Logger.getLogger("io.qt.autotests").log(java.util.logging.Level.INFO, "testDispose: DONE"); } } @@ -247,58 +255,23 @@ static void testDeployerApp(String applicationName, String...modules) throws Int String classPath; String modulePath; String executable = ""; - String platform; String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("windows")) { if(isDebug) executable += "d"; executable += ".exe"; - platform = "windows"; - switch(System.getProperty("os.arch").toLowerCase()) { - case "arm": - case "arm32": - platform += "-arm32"; break; - case "arm64": - case "aarch64": - platform += "-arm64"; break; - case "x86_64": - case "x64": - case "amd64": - platform += "-x64"; break; - default: - platform += "-x86"; break; - } }else if(osName.startsWith("mac")) { if(isDebug) executable += "_debug"; executable += ".app"; - platform = "macos"; }else if(osName.startsWith("android")) { Assume.assumeFalse("Cannot run on android", true); return; }else { if(isDebug) executable += "_debug"; - platform = "linux"; - switch(System.getProperty("os.arch").toLowerCase()) { - case "arm": - case "arm32": - platform += "-arm32"; break; - case "arm64": - case "aarch64": - platform += "-arm64"; break; - case "x86_64": - case "x64": - case "amd64": - platform += "-x64"; break; - default: - platform += "-x86"; break; - } } String qtBinariesPath = TestUtility.qtLibraryPath(); - if(isDebug) { - platform += "-debug"; - } File utilitiesDir = new File(new File(testsDir.getParentFile(), "qtjambi"), "bin"); String macosPrefix = ""; if(osName.startsWith("mac")) { diff --git a/src/java/autotests/io/qt/autotests/TestBluetoothDiscovery.java b/src/java/autotests/io/qt/autotests/TestBluetoothDiscovery.java index d75737af..527fbc73 100644 --- a/src/java/autotests/io/qt/autotests/TestBluetoothDiscovery.java +++ b/src/java/autotests/io/qt/autotests/TestBluetoothDiscovery.java @@ -30,8 +30,8 @@ import org.junit.BeforeClass; -import io.qt.autotests.generated.UI_DeviceDiscovery; -import io.qt.autotests.generated.UI_ServiceDiscovery; +import io.qt.autotests.generated.Ui_DeviceDiscovery; +import io.qt.autotests.generated.Ui_ServiceDiscovery; import io.qt.bluetooth.QBluetoothAddress; import io.qt.bluetooth.QBluetoothDeviceDiscoveryAgent; import io.qt.bluetooth.QBluetoothDeviceInfo; @@ -78,7 +78,7 @@ public DeviceDiscoveryDialog() { public DeviceDiscoveryDialog(QWidget parent) { super(parent); this.localDevice = new QBluetoothLocalDevice(); - this.ui = new UI_DeviceDiscovery(); + this.ui = new Ui_DeviceDiscovery(); ui.setupUi(this); @@ -194,7 +194,7 @@ private void hostModeStateChanged(QBluetoothLocalDevice.HostMode mode){ private final QBluetoothDeviceDiscoveryAgent discoveryAgent; private final QBluetoothLocalDevice localDevice; - private final UI_DeviceDiscovery ui; + private final Ui_DeviceDiscovery ui; }; @@ -205,7 +205,7 @@ public ServiceDiscoveryDialog(String name, QBluetoothAddress address) { } public ServiceDiscoveryDialog(String name, QBluetoothAddress address, QWidget parent) { - this.ui = new UI_ServiceDiscovery(); + this.ui = new Ui_ServiceDiscovery(); ui.setupUi(this); //Using default Bluetooth adapter @@ -245,5 +245,5 @@ public void addService(QBluetoothServiceInfo info){ } private final QBluetoothServiceDiscoveryAgent discoveryAgent; - private final UI_ServiceDiscovery ui; + private final Ui_ServiceDiscovery ui; }; \ No newline at end of file diff --git a/src/java/autotests/io/qt/autotests/TestClassFunctionality.java b/src/java/autotests/io/qt/autotests/TestClassFunctionality.java index e315a458..80ec3ecb 100644 --- a/src/java/autotests/io/qt/autotests/TestClassFunctionality.java +++ b/src/java/autotests/io/qt/autotests/TestClassFunctionality.java @@ -72,6 +72,7 @@ import io.qt.core.QRectF; import io.qt.core.QResource; import io.qt.core.QSize; +import io.qt.core.QString; import io.qt.core.QTimer; import io.qt.core.QUuid; import io.qt.core.Qt; @@ -740,9 +741,11 @@ static class MySpinBox extends QDoubleSpinBox { public int receivedPos; @Override - public String fixup(String input) { - receivedString = input; - return "As aught of " + input.substring(2, 8) + " birth"; + public void fixup(QString input) { + receivedString = input.toString(); + input.assign("As aught of "); + input.append(receivedString.substring(2, 8)); + input.append(" birth"); } @Override diff --git a/src/java/autotests/io/qt/autotests/TestConnections.java b/src/java/autotests/io/qt/autotests/TestConnections.java index 7c475b93..edc995e7 100644 --- a/src/java/autotests/io/qt/autotests/TestConnections.java +++ b/src/java/autotests/io/qt/autotests/TestConnections.java @@ -187,11 +187,7 @@ class SignalEmitter implements QtSignalEmitterInterface, QInstanceMemberSignals QNoSuchSlotException f = null; try { - if(!hasSerializableLambdas) { - sas.signal1.connect(sas, "non_slot()test_javaToJavaConnect"); - }else { - sas.signal1.connect(sas::non_slot); - } + sas.signal1.connect(sas, "non_slot()"); } catch (QNoSuchSlotException e) { f = e; } diff --git a/src/java/autotests/io/qt/autotests/TestExceptions.java b/src/java/autotests/io/qt/autotests/TestExceptions.java index f18477b6..76261192 100644 --- a/src/java/autotests/io/qt/autotests/TestExceptions.java +++ b/src/java/autotests/io/qt/autotests/TestExceptions.java @@ -48,7 +48,6 @@ import io.qt.gui.QPaintDevice; import io.qt.gui.QPaintEngine; import io.qt.widgets.QApplication; -import io.qt.widgets.QDialog; import io.qt.widgets.QWizard; import io.qt.widgets.QWizardPage; diff --git a/src/java/autotests/io/qt/autotests/TestFileEngine.java b/src/java/autotests/io/qt/autotests/TestFileEngine.java index 65457aee..88218d5c 100644 --- a/src/java/autotests/io/qt/autotests/TestFileEngine.java +++ b/src/java/autotests/io/qt/autotests/TestFileEngine.java @@ -302,15 +302,15 @@ public void testClassPathFileEngine() { QDir dirtwo = new QDir("classpath:TestClassFunctionality_dirtwo/"); assertTrue(dirtwo.exists()); // CHECKME FIXME On Windows we see ".." entry, we should explain why this is different and if necessary fix something - List direntList = dirtwo.entryList(); + QStringList direntList = dirtwo.entryList(); int direntCount = direntList.size(); if(direntCount == 2) { assertEquals(direntList.size(), 2); - assertTrue(direntList.get(0).equals("..")); - assertTrue(direntList.get(1).equals("TestClassFunctionality_dir22")); + assertEquals("..", direntList.get(0)); + assertEquals("TestClassFunctionality_dir22", direntList.get(1)); } else { assertEquals(direntList.size(), 1); - assertTrue(direntList.get(0).equals("TestClassFunctionality_dir22")); + assertEquals("TestClassFunctionality_dir22", direntList.get(0)); } List dirTwoEntryInfoList = dirtwo.entryInfoList(); diff --git a/src/java/autotests/io/qt/autotests/TestFuture.java b/src/java/autotests/io/qt/autotests/TestFuture.java index f04c54a3..c0c6c0b1 100644 --- a/src/java/autotests/io/qt/autotests/TestFuture.java +++ b/src/java/autotests/io/qt/autotests/TestFuture.java @@ -265,17 +265,6 @@ public void test_type_missmatch() { Assert.assertFalse(future.isStarted()); } - { - QFutureInterface promise = new QFutureInterface<>(); - promise.reportStarted(); - QFuture future = (QFuture)(QFuture)promise.future(); - Assert.assertTrue(future.isStarted()); - future = FutureHandler.forwardInt(future); - promise.reportResult("5"); - promise.reportFinished(); - Assert.assertEquals(Integer.valueOf(5), future.result()); - } - { QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); @@ -289,6 +278,18 @@ public void test_type_missmatch() { Assert.assertEquals(3, future.resultCount()); Assert.assertEquals(null, future.result()); } + + { + QFutureInterface promise = new QFutureInterface<>(); + promise.reportStarted(); + QFuture future = (QFuture)(QFuture)promise.future(); + Assert.assertTrue(future.isStarted()); + future = FutureHandler.forwardInt(future); + promise.reportResult("5"); + promise.reportFinished(); + Assert.assertEquals(1, future.resultCount()); + Assert.assertEquals(Integer.valueOf(5), future.result()); + } } @Test diff --git a/src/java/autotests/io/qt/autotests/TestInjectedCode.java b/src/java/autotests/io/qt/autotests/TestInjectedCode.java index c7fec02c..b97fb4f4 100644 --- a/src/java/autotests/io/qt/autotests/TestInjectedCode.java +++ b/src/java/autotests/io/qt/autotests/TestInjectedCode.java @@ -267,9 +267,10 @@ static class ValidatorSubclassSubclass extends ValidatorSubclass { public int inputPos; @Override - public String fixup(String input) { - inputString = input; - return super.fixup(input) + "javaPostfix"; + public void fixup(QString input) { + inputString = input.toString(); + super.fixup(input); + input.append("javaPostfix"); } @Override @@ -861,20 +862,20 @@ public void testQGridLayout_getItemPosition() { public void testValidatorFixup() { ValidatorSubclassSubclass vss = new ValidatorSubclassSubclass(); - String[] str = {"acceptable"}; + final QString str = new QString("acceptable"); int[] i = {13}; assertEquals(QValidator.State.Acceptable, vss.callValidate(str, i)); - assertEquals("javaPrefixacceptablesomePostfix", str[0]); + assertEquals("javaPrefixacceptablesomePostfix", str.toString()); assertEquals("acceptable".length(), i[0]); assertEquals("acceptable", vss.inputString); assertEquals(13, vss.inputPos); assertEquals("acceptable", vss.inputString()); assertEquals(13, vss.inputPos()); - str[0] = "intermediate"; + str.assign("intermediate"); i[0] = 14; assertEquals(QValidator.State.Intermediate, vss.callValidate(str, i)); - assertEquals("javaPrefixintermediatesomePostfix", str[0]); + assertEquals("javaPrefixintermediatesomePostfix", str.toString()); assertEquals("intermediate".length(), i[0]); assertEquals("intermediate", vss.inputString); assertEquals(14, vss.inputPos); diff --git a/src/java/autotests/io/qt/autotests/TestNativePointer.java b/src/java/autotests/io/qt/autotests/TestNativePointer.java index f7146c12..83eecd36 100644 --- a/src/java/autotests/io/qt/autotests/TestNativePointer.java +++ b/src/java/autotests/io/qt/autotests/TestNativePointer.java @@ -357,14 +357,6 @@ public void run_testInOut() { assertEquals(returned, 14); assertEquals(np_int.intValue(), 15); } - - { - QNativePointer np_string = new QNativePointer(QNativePointer.Type.String); - np_string.setStringValue("First"); - String returned = npt.testString(np_string, "Second"); - assertEquals(returned, "First"); - assertEquals(np_string.stringValue(), "Second"); - } } @Test diff --git a/src/java/autotests/io/qt/autotests/TestPlugin.java b/src/java/autotests/io/qt/autotests/TestPlugin.java index 0355f41b..ed65aa32 100644 --- a/src/java/autotests/io/qt/autotests/TestPlugin.java +++ b/src/java/autotests/io/qt/autotests/TestPlugin.java @@ -50,7 +50,6 @@ import io.qt.gui.QIconEnginePlugin; import io.qt.gui.QImageIOHandler; import io.qt.gui.QImageIOPlugin; -import io.qt.widgets.QDialog; import io.qt.widgets.QGraphicsItem; import io.qt.widgets.QGraphicsObject; import io.qt.widgets.QGraphicsWidget; @@ -129,10 +128,9 @@ public void testCustomPlugin() { Assert.assertTrue(plugin instanceof QGraphicsWidget); } -// @Test + @Test public void testLoadPluginLibrary() { Assume.assumeTrue("macos only", QOperatingSystemVersion.current().isAnyOfType(OSType.MacOS)); - new QDialog().exec(); for(String path : QCoreApplication.libraryPaths()) { QFileInfo file = new QFileInfo(path+"/designer/libcustomwidgets.dylib"); if(file.exists()) { diff --git a/src/java/autotests/io/qt/autotests/TestQThread.java b/src/java/autotests/io/qt/autotests/TestQThread.java index 7cf988a3..85c210c7 100644 --- a/src/java/autotests/io/qt/autotests/TestQThread.java +++ b/src/java/autotests/io/qt/autotests/TestQThread.java @@ -517,21 +517,28 @@ public void testThreadRequestInterruption() throws InterruptedException, ClassNo } @org.junit.Test - public void testDeleteTopLevelRunnerThread() { + public void testDeleteTopLevelRunnerThread() throws Throwable { WeakReference reference; { boolean[] javaOwnership = {false}; Thread[] javaThreads = {null,null}; QThread[] qtarray = {null}; + Throwable[] exception = {null}; QThread thread = QThread.create(()->{ - qtarray[0] = QThread.currentThread(); - javaOwnership[0] = General.internalAccess.isJavaOwnership(qtarray[0]); - javaThreads[0] = Thread.currentThread(); - javaThreads[1] = qtarray[0].javaThread(); + try { + qtarray[0] = QThread.currentThread(); + javaOwnership[0] = General.internalAccess.isJavaOwnership(qtarray[0]); + javaThreads[0] = Thread.currentThread(); + javaThreads[1] = qtarray[0].javaThread(); + }catch(Throwable t) { + exception[0] = t; + } }); reference = new WeakReference<>(thread); thread.start(); thread.join(); + if(exception[0]!=null) + throw exception[0]; Assert.assertEquals(javaThreads[0], javaThreads[1]); Assert.assertEquals(thread, qtarray[0]); Assert.assertTrue(javaOwnership[0]); @@ -544,22 +551,29 @@ public void testDeleteTopLevelRunnerThread() { } @org.junit.Test - public void testDeleteChildRunnerThread() throws InterruptedException { + public void testDeleteChildRunnerThread() throws Throwable { QObject parent = new QObject(); WeakReference reference; { boolean[] cppOwnership = {false}; Thread[] javaThreads = {null,null}; QThread[] qtarray = {null}; + Throwable[] exception = {null}; QThread thread = QThread.create(()->{ - qtarray[0] = QThread.currentThread(); - cppOwnership[0] = General.internalAccess.isCppOwnership(qtarray[0]); - javaThreads[0] = Thread.currentThread(); - javaThreads[1] = qtarray[0].javaThread(); + try { + qtarray[0] = QThread.currentThread(); + cppOwnership[0] = General.internalAccess.isCppOwnership(qtarray[0]); + javaThreads[0] = Thread.currentThread(); + javaThreads[1] = qtarray[0].javaThread(); + }catch(Throwable t) { + exception[0] = t; + } }, parent); reference = new WeakReference<>(thread); thread.start(); thread.join(); + if(exception[0]!=null) + throw exception[0]; Assert.assertEquals(javaThreads[0], javaThreads[1]); Assert.assertEquals(thread, qtarray[0]); Assert.assertTrue(cppOwnership[0]); @@ -586,22 +600,28 @@ public void testDeleteChildRunnerThread() throws InterruptedException { } @org.junit.Test - public void testDeleteTopLevelEventThread() { + public void testDeleteTopLevelEventThread() throws Throwable { WeakReference reference; { boolean[] javaOwnership = {false}; Thread[] javaThreads = {null,null}; QThread[] qtarray = {null}; QThread thread = new QThread(); + Throwable[] exception = {null}; QObject obj = new QObject() { @Override public boolean event(QEvent event) { if(event.type()==QEvent.Type.DeferredDispose) { - qtarray[0] = QThread.currentThread(); - javaOwnership[0] = General.internalAccess.isJavaOwnership(qtarray[0]); - javaThreads[0] = Thread.currentThread(); - javaThreads[1] = qtarray[0].javaThread(); - qtarray[0].exit(); + try { + qtarray[0] = QThread.currentThread(); + javaOwnership[0] = General.internalAccess.isJavaOwnership(qtarray[0]); + javaThreads[0] = Thread.currentThread(); + javaThreads[1] = qtarray[0].javaThread(); + }catch(Throwable t) { + exception[0] = t; + }finally { + qtarray[0].exit(); + } } return super.event(event); } @@ -611,6 +631,8 @@ public boolean event(QEvent event) { reference = new WeakReference<>(thread); thread.start(); thread.join(); + if(exception[0]!=null) + throw exception[0]; Assert.assertEquals(javaThreads[0], javaThreads[1]); Assert.assertEquals(thread, qtarray[0]); Assert.assertTrue(javaOwnership[0]); @@ -623,23 +645,29 @@ public boolean event(QEvent event) { } @org.junit.Test - public void testDeleteChildEventThread() { + public void testDeleteChildEventThread() throws Throwable { QObject parent = new QObject(); WeakReference reference; { boolean[] cppOwnership = {false}; Thread[] javaThreads = {null,null}; QThread[] qtarray = {null}; + Throwable[] exception = {null}; QThread thread = new QThread(parent); QObject obj = new QObject() { @Override public boolean event(QEvent event) { if(event.type()==QEvent.Type.DeferredDispose) { - qtarray[0] = QThread.currentThread(); - cppOwnership[0] = General.internalAccess.isCppOwnership(qtarray[0]); - javaThreads[0] = Thread.currentThread(); - javaThreads[1] = qtarray[0].javaThread(); - qtarray[0].exit(); + try { + qtarray[0] = QThread.currentThread(); + cppOwnership[0] = General.internalAccess.isCppOwnership(qtarray[0]); + javaThreads[0] = Thread.currentThread(); + javaThreads[1] = qtarray[0].javaThread(); + }catch(Throwable t) { + exception[0] = t; + }finally { + qtarray[0].exit(); + } } return super.event(event); } @@ -649,6 +677,8 @@ public boolean event(QEvent event) { reference = new WeakReference<>(thread); thread.start(); thread.join(); + if(exception[0]!=null) + throw exception[0]; Assert.assertEquals(javaThreads[0], javaThreads[1]); Assert.assertEquals(thread, qtarray[0]); Assert.assertTrue(cppOwnership[0]); @@ -679,23 +709,32 @@ public boolean event(QEvent event) { } @org.junit.Test - public void testDeleteAdoptedThread() throws InterruptedException { + public void testDeleteAdoptedThread() throws Throwable { AtomicBoolean threadCleaned = new AtomicBoolean(); AtomicBoolean qthreadCleaned = new AtomicBoolean(); { boolean[] cppOwnership = {false}; Thread[] javaThreads = {null,null}; QThread[] qtarray = {null}; + Throwable[] exception = {null}; Thread thread = new Thread(()->{ - qtarray[0] = QThread.currentThread(); - cppOwnership[0] = General.internalAccess.isCppOwnership(qtarray[0]); - javaThreads[0] = Thread.currentThread(); - javaThreads[1] = qtarray[0].javaThread(); - General.internalAccess.registerCleaner(qtarray[0], ()->qthreadCleaned.set(true)); + try { + qtarray[0] = QThread.currentThread(); + cppOwnership[0] = General.internalAccess.isCppOwnership(qtarray[0]); + javaThreads[0] = Thread.currentThread(); + javaThreads[1] = qtarray[0].javaThread(); + General.internalAccess.registerCleaner(qtarray[0], ()->qthreadCleaned.set(true)); + }catch(Throwable t) { + exception[0] = t; + }finally { + qtarray[0].exit(); + } }); General.internalAccess.registerCleaner(thread, ()->threadCleaned.set(true)); thread.start(); thread.join(); + if(exception[0]!=null) + throw exception[0]; Assert.assertEquals(thread, javaThreads[0]); Assert.assertEquals(javaThreads[0], javaThreads[1]); Assert.assertTrue(cppOwnership[0]); diff --git a/src/java/autotests/io/qt/autotests/TestQmlPlugin.java b/src/java/autotests/io/qt/autotests/TestQmlPlugin.java index 5aded137..8cd87246 100644 --- a/src/java/autotests/io/qt/autotests/TestQmlPlugin.java +++ b/src/java/autotests/io/qt/autotests/TestQmlPlugin.java @@ -55,7 +55,7 @@ public static void testInitialize() throws Exception { public void run_testQmlPlugin() { QByteArray data = new QByteArray("import io.qt.test.car 2.0; Car {}"); QQmlEngine qmlengine = new QQmlEngine(); - String imports = System.getProperty("io.qt.qml.imports", ""); + String imports = System.getProperty("io.qt.qml-imports", ""); if(!imports.isEmpty()) { for(String i : imports.split(File.pathSeparator)) qmlengine.addImportPath(i); diff --git a/src/java/autotests/io/qt/autotests/TestSignals.java b/src/java/autotests/io/qt/autotests/TestSignals.java index 0299967d..0997e3b0 100644 --- a/src/java/autotests/io/qt/autotests/TestSignals.java +++ b/src/java/autotests/io/qt/autotests/TestSignals.java @@ -31,6 +31,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; import java.util.ArrayList; @@ -198,7 +199,7 @@ public void testInstanceMemberSignalInQObject() { o.testSignal.emit("test1"); assertEquals("test1", receiver.completionPrefix()); QMetaMethod m = QMetaMethod.fromSignal(o.testSignal); - assertTrue(m!=null); + assertTrue(m.isValid()); m.invoke(o, "test2"); assertEquals("test2", receiver.completionPrefix()); } @@ -212,7 +213,7 @@ public void testDeclarableMemberSignalInQObject() { o.testSignal.emit("test1"); assertEquals("test1", receiver.completionPrefix()); QMetaMethod m = QMetaMethod.fromSignal(o.testSignal); - assertTrue(m==null); + assertFalse(m.isValid()); } @Test diff --git a/src/java/autotests/io/qt/autotests/TestThreadAffinity.java b/src/java/autotests/io/qt/autotests/TestThreadAffinity.java index 96593da2..ca1f1ad2 100644 --- a/src/java/autotests/io/qt/autotests/TestThreadAffinity.java +++ b/src/java/autotests/io/qt/autotests/TestThreadAffinity.java @@ -284,6 +284,10 @@ public void testQObject() { parent.removeEventFilter(null); fail("QThreadAffinityException expected to be thrown."); }catch(QThreadAffinityException e) {} + try{ + QtUtilities.threadCheck(parent); + fail("QThreadAffinityException expected to be thrown."); + }catch(QThreadAffinityException e) {} }finally { parent.disposeLater(); thread.quit(); @@ -309,6 +313,10 @@ public void testQGraphicsWidget() throws Throwable{ widget.setWidget(comboBox); fail("QThreadAffinityException expected to be thrown."); }catch(QThreadAffinityException e) {} + try{ + QtUtilities.uiThreadCheck(); + fail("QThreadAffinityException expected to be thrown."); + }catch(QThreadAffinityException e) {} }); thread.setUncaughtExceptionHandler((Thread t, Throwable e)->throwable = e); thread.finished.connect(loop::quit); @@ -498,7 +506,7 @@ public void testQWidget() throws Throwable{ fail("QThreadAffinityException expected to be thrown."); }catch(QThreadAffinityException e) {} try{ - QFontDialog.getFont(); + QFontDialog.getFont((QWidget)null); fail("QThreadAffinityException expected to be thrown."); }catch(QThreadAffinityException e) {} try{ diff --git a/src/java/modules/modules.xml b/src/java/modules/modules.xml index d29c64b2..f0a68eae 100644 --- a/src/java/modules/modules.xml +++ b/src/java/modules/modules.xml @@ -115,21 +115,20 @@ - + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/BundleGenerator.java b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/BundleGenerator.java index 20cd8b7a..66aecaa6 100644 --- a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/BundleGenerator.java +++ b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/BundleGenerator.java @@ -140,6 +140,7 @@ static void generate(QCommandLineParser parser, String[] args, QCommandLineOptio QCommandLineOption versionOption = new QCommandLineOption(QStringList.of("target-version"), "Qt version", "version"); QCommandLineOption utilitiesOption = new QCommandLineOption(QStringList.of("utilities"), "Path to android utilities.\nExamples:\n--utilities=utilities/QtAndroidBindings.jar", "file"); QCommandLineOption utilitiesLocationOption = new QCommandLineOption(QStringList.of("utilities-location"), "Directory containing android utilities", "path"); + QCommandLineOption forceDebugInfoOption = new QCommandLineOption(QStringList.of("force-debug-info"), "Forces to also bundle release debug info if available"); parser.addOptions(Arrays.asList(platformOption, dirOption, configurationOption, qtdirOption, @@ -153,6 +154,7 @@ static void generate(QCommandLineParser parser, String[] args, QCommandLineOptio translationsOption, versionOption, utilitiesOption, + forceDebugInfoOption, utilitiesLocationOption)); parser.process(new QStringList(args)); QStringList unusedArguments = new QStringList(parser.positionalArguments()); @@ -161,6 +163,7 @@ static void generate(QCommandLineParser parser, String[] args, QCommandLineOptio if(unusedArguments.size()>1) throw new Error("Qt bundle generation, illegal argument: "+unusedArguments.join(", ")); boolean isDebug = parser.isSet(configurationOption) && parser.value(configurationOption).equals("debug"); + boolean isForceDebugInfo = parser.isSet(forceDebugInfoOption); File targetDir = new File(parser.isSet(dirOption) ? parser.value(dirOption) : System.getProperty("user.dir")); File qtdir = null; File qtbase = null; @@ -452,7 +455,7 @@ && new File(subdir, "plugins").isDirectory()) { if(!targetDir.exists()) targetDir.mkdirs(); for (QPair qPair : qtdirs) { - generateBundles(targetDir, qPair.second, qPair.first, androidBindingsURL, isDebug, isMinGWBuilt, version); + generateBundles(targetDir, qPair.second, qPair.first, androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); } }else if(parser.isSet(qtbaseOption)) { throw new Error(String.format("Qt bundle generation: Unable to find Qt in directory specified by --%1$s.", qtbaseOption.valueName())); @@ -507,12 +510,12 @@ else if(qtdir.getName().endsWith("_arm64")) else version = null; if("android".equals(osArchName)) { - generateBundles(targetDir, qtdir, "android-arm64", androidBindingsURL, isDebug, isMinGWBuilt, version); - generateBundles(targetDir, qtdir, "android-arm", androidBindingsURL, isDebug, isMinGWBuilt, version); - generateBundles(targetDir, qtdir, "android-x64", androidBindingsURL, isDebug, isMinGWBuilt, version); - generateBundles(targetDir, qtdir, "android-x86", androidBindingsURL, isDebug, isMinGWBuilt, version); + generateBundles(targetDir, qtdir, "android-arm64", androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); + generateBundles(targetDir, qtdir, "android-arm", androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); + generateBundles(targetDir, qtdir, "android-x64", androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); + generateBundles(targetDir, qtdir, "android-x86", androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); }else { - generateBundles(targetDir, qtdir, osArchName, androidBindingsURL, isDebug, isMinGWBuilt, version); + generateBundles(targetDir, qtdir, osArchName, androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); } }else if(parser.isSet(binsOption) || parser.isSet(libsOption) @@ -559,7 +562,7 @@ else if(qtdir.getName().endsWith("_arm64")) if(isMinGWBuilt==null) { isMinGWBuilt = binDir.getParentFile().getName().startsWith("mingw"); } - generateBundles(targetDir, binDir, libDir, pluginsDir, qmlDir, libExecDir, resourcesDir, translationsDir, osArchName, androidBindingsURL, isDebug, isMinGWBuilt, version); + generateBundles(targetDir, binDir, libDir, pluginsDir, qmlDir, libExecDir, resourcesDir, translationsDir, osArchName, androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); }else { if(args.length==1) parser.showHelp(); @@ -606,7 +609,7 @@ private static String findTargetModule(String name) { return null; } - private static void generateBundles(File targetDir, File qtdir, String osArchName, URL androidBindingsURL, boolean isDebug, boolean isMinGWBuilt, QVersionNumber version) { + private static void generateBundles(File targetDir, File qtdir, String osArchName, URL androidBindingsURL, boolean isDebug, boolean isForceDebugInfo, boolean isMinGWBuilt, QVersionNumber version) { File binDir = new File(qtdir, "bin"); File libDir = new File(qtdir, "lib"); File pluginsDir = new File(qtdir, "plugins"); @@ -614,7 +617,7 @@ private static void generateBundles(File targetDir, File qtdir, String osArchNam File libexecDir = new File(qtdir, "libexec"); File resourcesDir = new File(qtdir, "resources"); File translationsDir = new File(qtdir, "translations"); - generateBundles(targetDir, binDir, libDir, pluginsDir, qmlDir, libexecDir, resourcesDir, translationsDir, osArchName, androidBindingsURL, isDebug, isMinGWBuilt, version); + generateBundles(targetDir, binDir, libDir, pluginsDir, qmlDir, libexecDir, resourcesDir, translationsDir, osArchName, androidBindingsURL, isDebug, isForceDebugInfo, isMinGWBuilt, version); } private static void generateBundles(File targetDir, @@ -627,7 +630,8 @@ private static void generateBundles(File targetDir, File translationsDir, String osArchName, URL androidBindingsURL, - boolean isDebug, + boolean isDebug, + boolean isForceDebugInfo, boolean isMinGWBuilt, QVersionNumber version) { if(System.getProperty("os.name").toLowerCase().startsWith("windows")) { @@ -1073,7 +1077,7 @@ public void close() throws IOException { libraryElement.setAttribute("name", libraryFile.getParentFile().getName()+"/"+libName+".framework.dSYM"); doc.getDocumentElement().appendChild(libraryElement); }else if(debugSym.isDirectory()) { - copyDirectory(debugSym, jarFile, jarUtilFile, libraryFile.getParentFile().getName(), osArchName, isDebug, doc); + copyDirectory(debugSym, jarFile, jarUtilFile, libraryFile.getParentFile().getName(), osArchName, isDebug, isForceDebugInfo, doc); } } String libFilePath = libraryFile.getName()+(version.majorVersion()==5 ? "/Versions/5" : "/Versions/A"); @@ -1085,10 +1089,10 @@ public void close() throws IOException { doc.getDocumentElement().appendChild(libraryElement); File macResourcesDir = new File(versionDir, "Resources"); if(macResourcesDir.isDirectory()) - copyDirectory(macResourcesDir, jarFile, jarUtilFile, libraryFile.getParentFile().getName()+"/"+libFilePath, osArchName, isDebug, doc); + copyDirectory(macResourcesDir, jarFile, jarUtilFile, libraryFile.getParentFile().getName()+"/"+libFilePath, osArchName, isDebug, isForceDebugInfo, doc); File helpersDir = new File(versionDir, "Helpers"); if(helpersDir.isDirectory()) - copyDirectory(helpersDir, jarFile, jarUtilFile, libraryFile.getParentFile().getName()+"/"+libFilePath, osArchName, isDebug, doc); + copyDirectory(helpersDir, jarFile, jarUtilFile, libraryFile.getParentFile().getName()+"/"+libFilePath, osArchName, isDebug, isForceDebugInfo, doc); Element symlinkElement = doc.createElement("symlink"); symlinkElement.setAttribute("name", libraryFile.getParentFile().getName()+"/"+libraryFile.getName()+"/Versions/Current"); symlinkElement.setAttribute("target", libraryFile.getParentFile().getName()+"/"+libFilePath); @@ -1225,7 +1229,7 @@ public void close() throws IOException { String plugin = libResource.getParentFile().getName(); File pluginFile = plugins.remove(plugin); if(pluginFile!=null) { - copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins", osArchName, isDebug, doc); + copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins", osArchName, isDebug, isForceDebugInfo, doc); } } } @@ -1253,7 +1257,7 @@ public void close() throws IOException { libraryElement.setAttribute("name", libraryFile.getParentFile().getName()+"/"+libraryFile.getName()); doc.getDocumentElement().appendChild(libraryElement); - if(isDebug) { + if(isDebug || isForceDebugInfo) { File pdb = new File(libraryFile.getParentFile(), libraryFile.getName().substring(0, libraryFile.getName().length()-3)+"pdb"); if(pdb.exists()) { jarFile.putNextEntry(new ZipEntry(pdb.getParentFile().getName()+"/"+pdb.getName())); @@ -1262,7 +1266,7 @@ public void close() throws IOException { libraryElement = doc.createElement("file"); libraryElement.setAttribute("name", pdb.getParentFile().getName()+"/"+pdb.getName()); doc.getDocumentElement().appendChild(libraryElement); - }else { + }else if(isDebug){ pdb = new File(libraryFile.getParentFile(), libraryFile.getName()+".debug"); if(pdb.exists()) { jarFile.putNextEntry(new ZipEntry(pdb.getParentFile().getName()+"/"+pdb.getName())); @@ -1279,11 +1283,11 @@ public void close() throws IOException { switch(libPair.getKey()) { case "webenginecore": { if(resourcesDir.isDirectory()) { - copyDirectory(resourcesDir, jarFile, jarUtilFile, "", osArchName, isDebug, doc); + copyDirectory(resourcesDir, jarFile, jarUtilFile, "", osArchName, isDebug, isForceDebugInfo, doc); } File qtwebengine_locales; if(translationsDir.isDirectory() && (qtwebengine_locales = new File(translationsDir, "qtwebengine_locales")).isDirectory()) { - copyDirectory(qtwebengine_locales, jarFile, jarUtilFile, "translations/", osArchName, isDebug, doc); + copyDirectory(qtwebengine_locales, jarFile, jarUtilFile, "translations/", osArchName, isDebug, isForceDebugInfo, doc); } File exe = null; String path = null; @@ -1320,6 +1324,12 @@ public void close() throws IOException { if(new File(pluginFile.getParentFile(), libNoSuffix+"dd.pdb").exists()) continue; }else continue; + }else if(isForceDebugInfo) { + if(pluginFile.getName().endsWith("d.pdb")) { + String libNoSuffix = pluginFile.getName().substring(0, pluginFile.getName().length()-5); + if(new File(pluginFile.getParentFile(), libNoSuffix+".pdb").exists()) + continue; + }else continue; }else { continue; } @@ -1360,7 +1370,7 @@ public void close() throws IOException { libraryElement.setAttribute("name", targetDirName + pluginFile.getName()); doc.getDocumentElement().appendChild(libraryElement); }else if(pluginFile.getName().endsWith("dSYM") && isDebug) { - copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins/"+subdir, osArchName, isDebug, doc); + copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins/"+subdir, osArchName, isDebug, isForceDebugInfo, doc); } } } @@ -1381,6 +1391,12 @@ public void close() throws IOException { if(new File(pluginFile.getParentFile(), libNoSuffix+"dd.pdb").exists()) continue; }else continue; + }else if(isForceDebugInfo) { + if(pluginFile.getName().endsWith("d.pdb")) { + String libNoSuffix = pluginFile.getName().substring(0, pluginFile.getName().length()-5); + if(new File(pluginFile.getParentFile(), libNoSuffix+".pdb").exists()) + continue; + }else continue; }else { continue; } @@ -1421,7 +1437,7 @@ public void close() throws IOException { libraryElement.setAttribute("name", targetDirName + pluginFile.getName()); doc.getDocumentElement().appendChild(libraryElement); }else if(pluginFile.getName().endsWith("dSYM") && isDebug) { - copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins/"+subdir, osArchName, isDebug, doc); + copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins/"+subdir, osArchName, isDebug, isForceDebugInfo, doc); } } } @@ -1436,28 +1452,28 @@ public void close() throws IOException { for(String plugin : associatedPlugins) { File pluginFile = plugins.remove(plugin); if(pluginFile!=null && pluginFile.isDirectory()) { - copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins", osArchName, isDebug, doc); + copyDirectory(pluginFile, jarFile, jarUtilFile, "plugins", osArchName, isDebug, isForceDebugInfo, doc); } } } if("pdfquick".equals(libPair.getKey())) { - copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/Pdf"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/Pdf"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); }else if("waylandclient".equals(libPair.getKey())) { - copyQmlPaths(qmllibs, Collections.singletonList("QtWayland/Client"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList("QtWayland/Client"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); }else if("waylandcompositor".equals(libPair.getKey())) { - copyQmlPaths(qmllibs, Collections.singletonList("QtWayland/Compositor"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList("QtWayland/Compositor"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); }else if("virtualkeyboard".equals(libPair.getKey())) { - copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/VirtualKeyboard"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/VirtualKeyboard"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); }else if("qml".equals(libPair.getKey())) { copyQmlPaths(qmllibs, Arrays.asList("QtQuick/LocalStorage", "QtQml", "QtQuick/Window", - "QtQuick/tooling"), jarFile, jarUtilFile, osArchName, isDebug, doc); + "QtQuick/tooling"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); if(version.majorVersion()==5) { - copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/LocalStorage"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/LocalStorage"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); } }else if("qt3dcore".equals(libPair.getKey())) { - copyQmlPaths(qmllibs, Arrays.asList("QtQuick/Scene2D", "QtQuick/Scene3D"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Arrays.asList("QtQuick/Scene2D", "QtQuick/Scene3D"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); }else if("quick".equals(libPair.getKey())) { copyQmlPaths(qmllibs, Arrays.asList( "QtQuick/NativeStyle", @@ -1470,7 +1486,7 @@ public void close() throws IOException { "QtQuick/Controls", "QtQuick/Dialogs", "QtQuick/Layouts", - "QtQuick/Timeline"), jarFile, jarUtilFile, osArchName, isDebug, doc); + "QtQuick/Timeline"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); if(version.majorVersion()==5) { copyQmlPaths(qmllibs, Arrays.asList("QtGraphicalEffects", "QtQuick/Window.2", @@ -1479,12 +1495,12 @@ public void close() throws IOException { "QtQuick/Particles.2", "QtQuick.2", "QtQuick/Extras", - "QtQuick/PrivateWidgets"), jarFile, jarUtilFile, osArchName, isDebug, doc); + "QtQuick/PrivateWidgets"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); } }else if("webenginequick".equals(libPair.getKey())) { - copyQmlPaths(qmllibs, Collections.singletonList("QtWebEngine"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList("QtWebEngine"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); }else if("xmlpatterns".equals(libPair.getKey())) { - copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/XmlListModel"), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList("QtQuick/XmlListModel"), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); } if(!"core".equals(libPair.getKey())) { for(String key : new ArrayList<>(qmllibs.keySet())) { @@ -1529,7 +1545,7 @@ else if(libPair.getKey().endsWith("quick")) { if(libName.equals(libPair.getKey())) { if(!libraries.containsKey(libPair.getKey()+"qml") && !libraries.containsKey(libPair.getKey()+"quick")) { - copyQmlPaths(qmllibs, Collections.singletonList(key), jarFile, jarUtilFile, osArchName, isDebug, doc); + copyQmlPaths(qmllibs, Collections.singletonList(key), jarFile, jarUtilFile, osArchName, isDebug, isForceDebugInfo, doc); } } } @@ -1615,7 +1631,7 @@ else if(libPair.getKey().endsWith("quick")) { doc.getDocumentElement().setAttribute("system", osArchName); doc.getDocumentElement().setAttribute("version", version.toString()); doc.getDocumentElement().setAttribute("configuration", isDebug ? "debug" : "release"); - copyDirectory(libPair.getValue(), jarFile, jarUtilFile, "plugins", osArchName, isDebug, doc); + copyDirectory(libPair.getValue(), jarFile, jarUtilFile, "plugins", osArchName, isDebug, isForceDebugInfo, doc); jarFile.putNextEntry(new ZipEntry(JarFile.MANIFEST_NAME)); manifest.write(jarFile); jarFile.closeEntry(); @@ -1671,7 +1687,7 @@ else if(libPair.getKey().endsWith("quick")) { path.add("qml"); path.addAll(Arrays.asList(libPair.getKey().split("/"))); path.remove(path.size()-1); - copyDirectory(libPair.getValue(), jarFile, jarUtilFile, String.join("/", path), osArchName, isDebug, doc); + copyDirectory(libPair.getValue(), jarFile, jarUtilFile, String.join("/", path), osArchName, isDebug, isForceDebugInfo, doc); jarFile.putNextEntry(new ZipEntry(JarFile.MANIFEST_NAME)); manifest.write(jarFile); jarFile.closeEntry(); @@ -1693,7 +1709,7 @@ else if(libPair.getKey().endsWith("quick")) { } } - private static void copyQmlPaths(Map qmllibs, Iterable paths, JarOutputStream jarFile, JarOutputStream jarUtilFile, String osArchName, boolean isDebug, Document doc) throws IOException { + private static void copyQmlPaths(Map qmllibs, Iterable paths, JarOutputStream jarFile, JarOutputStream jarUtilFile, String osArchName, boolean isDebug, boolean isForceDebugInfo, Document doc) throws IOException { for (String path : paths) { File qmlLib = qmllibs.remove(path); if(qmlLib!=null && qmlLib.isDirectory()) { @@ -1701,12 +1717,12 @@ private static void copyQmlPaths(Map qmllibs, Iterable path _path.add("qml"); _path.addAll(Arrays.asList(path.split("/"))); _path.remove(_path.size()-1); - copyDirectory(qmlLib, jarFile, jarUtilFile, String.join("/", _path), osArchName, isDebug, doc); + copyDirectory(qmlLib, jarFile, jarUtilFile, String.join("/", _path), osArchName, isDebug, isForceDebugInfo, doc); } } } - private static void copyDirectory(File dir, JarOutputStream jarFile, JarOutputStream jarUtilFile, String path, String osArchName, boolean isDebug, Document doc) throws IOException { + private static void copyDirectory(File dir, JarOutputStream jarFile, JarOutputStream jarUtilFile, String path, String osArchName, boolean isDebug, boolean isForceDebugInfo, Document doc) throws IOException { if(osArchName.equals("macos") && !isDebug && dir.getName().endsWith(".dSYM")) return; if(path==null) @@ -1741,7 +1757,7 @@ private static void copyDirectory(File dir, JarOutputStream jarFile, JarOutputSt continue; if(osArchName.equals("macos") && !isDebug && file.getName().endsWith(".dSYM")) continue; - copyDirectory(file, jarFile, jarUtilFile, path + dir.getName() + "/", osArchName, isDebug, doc); + copyDirectory(file, jarFile, jarUtilFile, path + dir.getName() + "/", osArchName, isDebug, isForceDebugInfo, doc); }else { if(file.getName().contains("qsvg") || file.getName().contains("qtvirtualkeyboardplugin")) { continue; @@ -1755,7 +1771,13 @@ private static void copyDirectory(File dir, JarOutputStream jarFile, JarOutputSt if(isDebug) { if(file.getName().endsWith("d.pdb")) { String libNoSuffix = file.getName().substring(0, file.getName().length()-5); - if(new File(dir, libNoSuffix+"dd.pdb").exists()) + if(new File(file.getParentFile(), libNoSuffix+"dd.pdb").exists()) + continue; + }else continue; + }else if(isForceDebugInfo) { + if(file.getName().endsWith("d.pdb")) { + String libNoSuffix = file.getName().substring(0, file.getName().length()-5); + if(new File(file.getParentFile(), libNoSuffix+".pdb").exists()) continue; }else continue; }else { diff --git a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/ContainerAccessGenerator.java b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/ContainerAccessGenerator.java index ca3628dd..1d0df57e 100644 --- a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/ContainerAccessGenerator.java +++ b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/ContainerAccessGenerator.java @@ -417,7 +417,7 @@ private static void generateFiles(File dir, String flatTypeName, StringBuilder i for(String target : targets) { targetArray.append(new QJsonValue(target)); } - metaData.setValue("Keys", new QJsonValue(targetArray)); + metaData.insert("Keys", new QJsonValue(targetArray)); cborValue.setValue(/*QtPluginMetaDataKeys::MetaData*/ 4, new QCborValue(QCborMap.fromJsonObject(metaData))); QByteArray cborData = cborValue.toCborValue().toCbor(); byte[] data = cborData.toByteArray(); diff --git a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/containeraccess.pro b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/containeraccess.pro index 4af7d0ba..e2a10bed 100644 --- a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/containeraccess.pro +++ b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/containeraccess.pro @@ -49,6 +49,7 @@ INCLUDEPATH += $$QTJAMBIPATH DEPENDPATH += $$QTJAMBIPATH macx:{ + CONFIG+=no_default_rpath no_qt_rpath INCLUDEPATH += $$JAVA_HOME_TARGET/include INCLUDEPATH += $$JAVA_HOME_TARGET/include/darwin # this option is necessary to properly compile on mountain lion because of std::string to char* casts diff --git a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/plugin.pro b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/plugin.pro index e6c45234..9abbe222 100644 --- a/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/plugin.pro +++ b/src/java/modules/qtjambi.deployer/io/qt/qtjambi/deployer/plugin.pro @@ -22,6 +22,7 @@ contains(QT_CONFIG, release):contains(QT_CONFIG, debug) { } macx:{ + CONFIG+=no_default_rpath no_qt_rpath contains(QT_CONFIG, x86):CONFIG += x86 contains(QT_CONFIG, ppc):CONFIG += ppc contains(QT_CONFIG, x86_64):CONFIG += x86_64 diff --git a/src/java/modules/qtjambi.uic/io/qt/uic/java/WriteInitialization.java b/src/java/modules/qtjambi.uic/io/qt/uic/java/WriteInitialization.java index f8b4e6fb..0f44482c 100644 --- a/src/java/modules/qtjambi.uic/io/qt/uic/java/WriteInitialization.java +++ b/src/java/modules/qtjambi.uic/io/qt/uic/java/WriteInitialization.java @@ -1663,6 +1663,8 @@ private void writeProperties(String varName, String objectName, String className } // QTextStream String varNewName = varName; + boolean needBracket = false; + QTextStream o = delayProperty ? m_delayedOut : autoTrOutput(p); switch (p.kind()) { case Bool: { @@ -1798,15 +1800,27 @@ private void writeProperties(String varName, String objectName, String className } break; case Font: + o.append(m_indent).append('{').endl().flush(); + m_indent = m_indent+" "; + needBracket = true; propertyValue = writeFontProperties(p.elementFont()); break; case IconSet: + o.append(m_indent).append('{').endl().flush(); + m_indent = m_indent+" "; + needBracket = true; propertyValue = writeIconProperties(p.elementIconSet()); break; case Pixmap: + o.append(m_indent).append('{').endl().flush(); + m_indent = m_indent+" "; + needBracket = true; propertyValue = pixCall(p); break; case Palette: { + o.append(m_indent).append('{').endl().flush(); + m_indent = m_indent+" "; + needBracket = true; DomPalette pal = p.elementPalette(); String paletteName = m_driver.unique("palette"); m_output.append(m_indent).append("QPalette ").append(paletteName).append(" = new QPalette();").endl(); @@ -1951,6 +1965,9 @@ private void writeProperties(String varName, String objectName, String className break; } case Brush: + o.append(m_indent).append('{').endl().flush(); + m_indent = m_indent+" "; + needBracket = true; propertyValue = writeBrushInitialization(p.elementBrush()); break; case Unknown: @@ -1958,8 +1975,11 @@ private void writeProperties(String varName, String objectName, String className } if (!propertyValue.isEmpty()) { - QTextStream o = delayProperty ? m_delayedOut : autoTrOutput(p); o.append(m_indent).append(varNewName).append(setFunction.toString()).append(propertyValue).append(");").endl().flush(); + if(needBracket) { + m_indent = m_indent.substring(4); + o.append(m_indent).append('}').endl().flush(); + } } } if (leftMargin != -1 || topMargin != -1 || rightMargin != -1 || bottomMargin != -1) { diff --git a/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteClass.java b/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteClass.java index 123d66e0..5b171be1 100644 --- a/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteClass.java +++ b/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteClass.java @@ -39,6 +39,7 @@ import java.util.logging.Level; import java.util.logging.Logger; +import io.qt.core.QObject; import io.qt.core.QTextStream; import io.qt.uic.CustomWidgetsInfo; import io.qt.uic.Option; @@ -193,6 +194,9 @@ else if(customWidget.hasElementHeader()) { m_output.append(parameters[i].getName()); m_output.append(": "); m_output.append(typeName); + if(QObject.class.isAssignableFrom(parameters[i].getType())) { + m_output.append("?"); + } } m_output.append(") : super("); for (int i = 0; i < parameters.length; i++) { @@ -218,9 +222,9 @@ else if(customWidget.hasElementHeader()) { } m_output.endl() - .append(m_option.indent).append("protected override fun changeEvent(e: io.qt.core.QEvent) {").endl() + .append(m_option.indent).append("protected override fun changeEvent(e: io.qt.core.QEvent?) {").endl() .append(m_option.indent).append(m_option.indent).append("super.changeEvent(e)").endl() - .append(m_option.indent).append(m_option.indent).append("when (e.type()) {").endl() + .append(m_option.indent).append(m_option.indent).append("when (e?.type()) {").endl() .append(m_option.indent).append(m_option.indent).append("io.qt.core.QEvent.Type.LanguageChange -> ui.retranslateUi(this)").endl() .append(m_option.indent).append(m_option.indent).append("else -> {}").endl() .append(m_option.indent).append(m_option.indent).append("}").endl() diff --git a/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteInitialization.java b/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteInitialization.java index 95437298..d5741fe6 100644 --- a/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteInitialization.java +++ b/src/java/modules/qtjambi.uic/io/qt/uic/kotlin/WriteInitialization.java @@ -89,6 +89,7 @@ import io.qt.uic.ui4.DomLayoutDefault; import io.qt.uic.ui4.DomLayoutFunction; import io.qt.uic.ui4.DomLayoutItem; +import io.qt.uic.ui4.DomLayoutItem.Kind; import io.qt.uic.ui4.DomLocale; import io.qt.uic.ui4.DomPalette; import io.qt.uic.ui4.DomPoint; @@ -328,7 +329,7 @@ public String writeSetupUi(String parent, EmptyItemPolicy emptyItemPolicy) { String uniqueName = m_driver.unique("__" + m_itemClassName.toLowerCase()); m_setupUiStream.append(m_indent); - m_setupUiStream.append("var "); + m_setupUiStream.append("val "); m_setupUiStream.append(uniqueName); m_setupUiStream.append(" = "); m_setupUiStream.append(m_itemClassName); @@ -356,16 +357,16 @@ public void writeRetranslateUi(String parentPath) { String uniqueName = m_driver.unique("___" + m_itemClassName.toLowerCase()); m_retranslateUiStream.append(m_indent); - m_retranslateUiStream.append(m_itemClassName).append(" "); + m_retranslateUiStream.append("val "); m_retranslateUiStream.append(uniqueName).append(" = ").append(parentPath).endl(); for(QPair pair : m_retranslateUiData.setters) { - m_retranslateUiStream.append(m_indent).append(uniqueName).append(pair.second).endl(); + m_retranslateUiStream.append(m_indent).append(uniqueName).append("?").append(pair.second).endl(); } for (int i = 0; i < m_children.size(); i++) { StringBuilder method = new StringBuilder(); - method.append(uniqueName).append(".child(").append(i).append(')'); + method.append(uniqueName).append("?").append(".child(").append(i).append(')'); m_children.get(i).writeRetranslateUi(method.toString()); } } @@ -467,7 +468,10 @@ void acceptLayoutFunction(DomLayoutFunction node) { } private static void writeSetter(String indent, String varName, String setter, String v, QTextStream str) { - str.append(indent).append(varName).append('.').append(setter) + str.append(indent).append(varName); + if(varName.startsWith("this.")) + str.append('?'); + str.append('.').append(setter) .append('(').append(v).append(")").endl(); } @@ -607,7 +611,10 @@ public void acceptUI(DomUI node){ continue; } - m_output.append(m_indent).append(b.labelVarName).append(".setBuddy(").append(buddyVarName).append(")").endl(); + m_output.append(m_indent).append(b.labelVarName); + if(b.labelVarName.startsWith("this.")) + m_output.append('?'); + m_output.append(".setBuddy(").append(buddyVarName).append(")").endl(); } if (node.elementTabStops()!=null) @@ -657,10 +664,13 @@ private void addWizardPage(String pageVarName, DomWidget page, String parentWidg } } } + m_output.append(m_indent).append(parentWidget); + if(parentWidget.startsWith("this.")) + m_output.append('?'); if (id.isEmpty()) { - m_output.append(m_indent).append(parentWidget).append(".addPage(").append(pageVarName).append(")").endl(); + m_output.append(".addPage(").append(pageVarName).append(")").endl(); } else { - m_output.append(m_indent).append(parentWidget).append(".setPage(").append(id).append(", ").append(pageVarName).append(")").endl(); + m_output.append(".setPage(").append(id).append(", ").append(pageVarName).append(")").endl(); } } @@ -684,6 +694,7 @@ public void acceptWidget(DomWidget node){ m_layoutMarginType = m_widgetChain.count() == 1 ? Enum.TopLevelMargin : Enum.ChildMargin; String className = node.attributeClass(); String varName = m_driver.findOrInsertWidget(node); + final String qm = varName!=null && varName.startsWith("this.") ? "?" : ""; String objectName = node.attributeName(); String parentWidget = "", parentClass = ""; @@ -700,10 +711,11 @@ public void acceptWidget(DomWidget node){ CustomWidgetsInfo cwi = m_uic.customWidgetsInfo(); if (m_widgetChain.size() != 1) { - m_output.append(m_indent).append(varName).append(" = ").append(cwi.realClassName(className)).append('(').append(parentWidget).append(")").endl(); + m_output.append(m_indent).append(varName).append(" = ").append(cwi.realClassName(className)).append('(').append(parentWidget).append(")").endl(); } parentWidget = savedParentWidget; + final String pqm = parentWidget!=null && parentWidget.startsWith("this.") ? "?" : ""; if (cwi._extends(className, "QComboBox")) { @@ -754,28 +766,28 @@ public void acceptWidget(DomWidget node){ if (cwi._extends(parentClass, "QMainWindow")) { if (cwi._extends(className, "QMenuBar")) { - m_output.append(m_indent).append(parentWidget).append("?.setMenuBar(").append(varName).append(")").endl(); + m_output.append(m_indent).append(parentWidget).append(pqm).append(".setMenuBar(").append(varName).append(")").endl(); } else if (cwi._extends(className, "QToolBar")) { - m_output.append(m_indent).append(parentWidget).append("?.addToolBar(" + m_output.append(m_indent).append(parentWidget).append(pqm).append(".addToolBar(" ).append(toolBarAreaStringFromDOMAttributes(attributes).replace("::", ".")).append(varName ).append(")").endl(); DomProperty pbreak = attributes.get("toolBarBreak"); if (pbreak!=null && Boolean.parseBoolean(pbreak.elementBool())) { - m_output.append(m_indent).append(parentWidget).append("?.insertToolBarBreak(").append( varName).append(")").endl(); + m_output.append(m_indent).append(parentWidget).append(pqm).append(".insertToolBarBreak(").append(varName).append(")").endl(); } } else if (cwi._extends(className, "QDockWidget")) { - m_output.append(m_indent).append(parentWidget).append("?.addDockWidget("); + m_output.append(m_indent).append(parentWidget).append(pqm).append(".addDockWidget("); DomProperty pstyle = attributes.get("dockWidgetArea"); if (pstyle!=null) { m_output.append("Qt.DockWidgetArea.").append(Qt.DockWidgetArea.resolve(pstyle.elementNumber()).name()).append(", "); } m_output.append(varName).append(")").endl(); } else if (m_uic.customWidgetsInfo()._extends(className, "QStatusBar")) { - m_output.append(m_indent).append(parentWidget).append("?.setStatusBar(").append(varName).append(")").endl(); + m_output.append(m_indent).append(parentWidget).append(pqm).append(".setStatusBar(").append(varName).append(")").endl(); } else { - m_output.append(m_indent).append(parentWidget).append("?.setCentralWidget(").append(varName).append(")").endl(); + m_output.append(m_indent).append(parentWidget).append(pqm).append(".setCentralWidget(").append(varName).append(")").endl(); } } @@ -784,7 +796,7 @@ public void acceptWidget(DomWidget node){ if (addPageMethod.isEmpty()) addPageMethod = cwi.simpleContainerAddPageMethod(parentClass); if (!addPageMethod.isEmpty()) { - m_output.append(m_indent).append(parentWidget).append('.').append(addPageMethod).append('(').append(varName).append(")").endl(); + m_output.append(m_indent).append(parentWidget).append(pqm).append(".").append(addPageMethod).append('(').append(varName).append(")").endl(); } else if (m_uic.customWidgetsInfo()._extends(parentClass, "QWizard")) { addWizardPage(varName, node, parentWidget); } else if (m_uic.customWidgetsInfo()._extends(parentClass, "QToolBox")) { @@ -794,21 +806,19 @@ public void acceptWidget(DomWidget node){ DomProperty picon = attributes.get("icon"); if (picon!=null) icon = ", " + iconCall(picon); // Side effect: Writes icon definition - m_output.append(m_indent).append(parentWidget).append("?.addItem(" + m_output.append(m_indent).append(parentWidget).append(pqm).append(".addItem(" ).append(varName).append(icon).append(", ").append(noTrCall(plabelString, pageDefaultString) ).append(")").endl(); - autoTrOutput(plabelString, pageDefaultString).append(m_indent).append(parentWidget - ).append("?.setItemText(").append(parentWidget - ).append("?.indexOf(" ).append(varName).append("), " - ).append(autoTrCall(plabelString, pageDefaultString)).append(")").flush(); + autoTrOutput(plabelString, pageDefaultString).append(m_indent).append(parentWidget).append(pqm) + .append(".setItemText(").append(parentWidget).append(pqm).append(".indexOf(" ).append(varName).append(")").append(pqm.isEmpty() ? "" : " as Int") + .append(", ").append(autoTrCall(plabelString, pageDefaultString)).append(")").endl().flush(); DomProperty ptoolTip = attributes.get("toolTip"); if (ptoolTip!=null) { autoTrOutput(ptoolTip.elementString()) - .append(m_indent).append(parentWidget).append("?.setItemToolTip(").append(parentWidget - ).append("?.indexOf(").append(varName).append("), " - ).append(autoTrCall(ptoolTip.elementString())).append(")").flush(); + .append(m_indent).append(parentWidget).append(pqm).append(".setItemToolTip(").append(parentWidget).append(pqm).append(".indexOf(").append(varName) + .append(")").append(pqm.isEmpty() ? "" : " as Int").append(", ").append(autoTrCall(ptoolTip.elementString())).append(")").flush(); } } else if (m_uic.customWidgetsInfo()._extends(parentClass, "QTabWidget")) { DomProperty ptitle = attributes.get("title"); @@ -817,27 +827,24 @@ public void acceptWidget(DomWidget node){ DomProperty picon = attributes.get("icon"); if (picon!=null) icon = ", " + iconCall(picon); // Side effect: Writes icon definition - m_output.append(m_indent).append(parentWidget).append("?.addTab(" - ).append(varName).append(icon).append(", \"\")").endl(); + m_output.append(m_indent).append(parentWidget).append(pqm).append(".addTab(").append(varName).append(icon).append(", \"\")").endl(); - autoTrOutput(ptitleString, pageDefaultString).append(m_indent).append(parentWidget - ).append("?.setTabText(").append(parentWidget - ).append("?.indexOf(").append(varName).append("), " - ).append(autoTrCall(ptitleString, pageDefaultString)).append(")").flush(); + autoTrOutput(ptitleString, pageDefaultString).append(m_indent) + .append(parentWidget).append(pqm).append(".setTabText(").append(parentWidget).append(pqm).append(".indexOf(").append(varName) + .append(")").append(pqm.isEmpty() ? "" : " as Int").append(", ").append(autoTrCall(ptitleString, pageDefaultString)).append(")").endl().flush(); DomProperty ptoolTip = attributes.get("toolTip"); if (ptoolTip!=null) { autoTrOutput(ptoolTip.elementString()) - .append(m_indent).append(parentWidget).append("?.setTabToolTip(" - ).append(parentWidget).append("?.indexOf(").append(varName - ).append("), ").append(autoTrCall(ptoolTip.elementString())).append(")").flush(); + .append(m_indent).append(parentWidget).append(pqm).append(".setTabToolTip(") + .append(parentWidget).append(pqm).append(".indexOf(").append(varName).append(")").append(pqm.isEmpty() ? "" : " as Int").append(", ").append(autoTrCall(ptoolTip.elementString())).append(")").endl().flush(); } DomProperty pwhatsThis = attributes.get("whatsThis"); if (pwhatsThis!=null) { autoTrOutput(pwhatsThis.elementString()) - .append(m_indent).append(parentWidget).append("?.setTabWhatsThis(" - ).append(parentWidget).append("?.indexOf(").append(varName - ).append("), ").append(autoTrCall(pwhatsThis.elementString())).append(")").flush(); + .append(m_indent).append(parentWidget).append(pqm) + .append(".setTabWhatsThis(").append(parentWidget).append(pqm).append(".indexOf(") + .append(varName).append(")").append(pqm.isEmpty() ? "" : " as Int").append(", ").append(autoTrCall(pwhatsThis.elementString())).append(")").endl().flush(); } } @@ -851,7 +858,7 @@ public void acceptWidget(DomWidget node){ headerProperties.add(fakeProperty); } } - writeProperties(varName + "?.header()", objectName + "_headerView", + writeProperties(varName + qm + ".header()", objectName + "_headerView", "QHeaderView", headerProperties, Flag.WritePropertyIgnoreObjectName.value()); @@ -867,7 +874,7 @@ public void acceptWidget(DomWidget node){ headerProperties.add(fakeProperty); } } - String headerVar = varName + "?." + headerPrefix + "()"; + String headerVar = varName + qm + "." + headerPrefix + "()"; writeProperties(headerVar, objectName+"_"+headerPrefix, "QHeaderView", headerProperties, Flag.WritePropertyIgnoreObjectName.value()); } @@ -884,7 +891,7 @@ public void acceptWidget(DomWidget node){ m_option.messagePrefix(), name)); } else { - m_output.append(m_indent).append(_varName).append("?.raise_()").endl(); + m_output.append(m_indent).append(_varName).append(qm).append(".raise_()").endl(); } } } @@ -1084,7 +1091,7 @@ void writeSpacerItem(DomSpacer node, QTextStream output) { public void acceptSpacer(DomSpacer node){ m_output.append(m_indent).append(m_driver.findOrInsertSpacer(node)).append(" = "); writeSpacerItem(node, m_output); - m_output.append(';').endl(); + m_output.endl(); } @Override @@ -1099,8 +1106,10 @@ public void acceptLayoutItem(DomLayoutItem node){ String layoutName = m_driver.findOrInsertLayout(layout); String itemName = m_driver.findOrInsertLayoutItem(node); - m_output.endl().append(m_indent).append(layoutName).append("?.").append(layoutAddMethod(node.kind(), layout.attributeClass())).append('('); - + m_output.endl().append(m_indent).append(layoutName); + if(layoutName.startsWith("this.")) + m_output.append("?"); + m_output.append(".").append(layoutAddMethod(node.kind(), layout.attributeClass())).append('('); if ("QGridLayout".equals(layout.attributeClass())) { int row = node.attributeRow(); int col = node.attributeColumn(); @@ -1120,6 +1129,9 @@ public void acceptLayoutItem(DomLayoutItem node){ if (layout.attributeClass().contains("Box") && !node.attributeAlignment().isEmpty()) m_output.append(", 0, ").append(node.attributeAlignment().replace("::", ".")); } + if (node.kind()==Kind.Spacer) { + m_output.append(" as QSpacerItem"); + } m_output.append(")").endl(); } @@ -1167,17 +1179,18 @@ public void acceptActionRef(DomActionRef node){ return; } - String varName = m_driver.findOrInsertWidget(m_widgetChain.top()); + final String varName = m_driver.findOrInsertWidget(m_widgetChain.top()); + final String qm = varName.startsWith("this.") ? "?" : ""; if (m_widgetChain.top()!=null && "separator".equals(actionName)) { // separator is always reserved! - m_actionOut.append(m_indent).append(varName).append("?.addSeparator()").endl(); + m_actionOut.append(m_indent).append(varName).append(qm).append(".addSeparator()").endl(); return; } DomWidget domWidget = m_driver.widgetByName(actionName); if (domWidget!=null && m_uic.isMenu(domWidget.attributeClass())) { - m_actionOut.append(m_indent).append(varName).append("?.addAction(").append(m_driver.findOrInsertWidget(domWidget)).append("?.menuAction())").endl(); + m_actionOut.append(m_indent).append(varName).append(qm).append(".addAction(").append(m_driver.findOrInsertWidget(domWidget)).append("?.menuAction())").endl(); return; } @@ -1187,7 +1200,7 @@ public void acceptActionRef(DomActionRef node){ return; } - m_actionOut.append(m_indent).append(varName).append("?.addAction(").append(m_driver.findOrInsertAction(domAction)).append(")").endl(); + m_actionOut.append(m_indent).append(varName).append(qm).append(".addAction(").append(m_driver.findOrInsertAction(domAction)).append(")").endl(); } // @@ -1346,7 +1359,7 @@ private String trCall(String str, String commentHint, String id){ boolean idBasedTranslations = m_driver.useIdBasedTranslations(); if (m_option.translateFunction.isEmpty()) { - result.append("io.qt.core.QCoreApplication.translate(" + result.append("QCoreApplication.translate(" ).append('"').append(m_generatedClass.replace("::", ".")).append("\", "); } else { result.append(m_option.translateFunction).append('('); @@ -1538,13 +1551,14 @@ private static boolean checkProperty(CustomWidgetsInfo customWidgetsInfo, @SuppressWarnings({ "rawtypes", "unchecked" }) private void writeProperties(String varName, String objectName, String className, List lst, int flags) { + final String qm = varName.startsWith("this.") ? "?" : ""; boolean isTopLevel = m_widgetChain.count() == 1; if (m_uic.customWidgetsInfo()._extends(className, "QAxWidget")) { Map properties = propertyMap(lst); DomProperty p = properties.get("control"); if (p!=null) { - m_output.append(m_indent).append(varName).append("?.setControl(" + m_output.append(m_indent).append(varName).append(qm).append(".setControl(" ).append(formatString(Utils.toString(p.elementString())) ).append(")").endl(); } @@ -1553,14 +1567,14 @@ private void writeProperties(String varName, String objectName, String className String indent = ""; if (m_widgetChain.top()==null) { indent = m_option.indent; - m_output.append(m_indent).append("if (").append(varName).append("?.objectName().isEmpty())\n"); + m_output.append(m_indent).append("if (").append(varName).append(qm).append(".objectName.isEmpty())\n"); } if (0==(flags & Flag.WritePropertyIgnoreObjectName.value())) { if (objectName.startsWith("this.")) objectName = objectName.substring(5); m_output.append(m_indent).append(indent - ).append(varName).append("?.setObjectName(" - ).append(formatString(objectName)).append(")").endl(); + ).append(varName).append(qm).append(".objectName = " + ).append(formatString(objectName)).endl(); } int leftMargin, topMargin, rightMargin, bottomMargin; @@ -1577,23 +1591,23 @@ private void writeProperties(String varName, String objectName, String className // special case for the property `geometry': Do not use position if (isTopLevel && "geometry".equals(propertyName) && p.elementRect()!=null) { DomRect r = p.elementRect(); - m_output.append(m_indent).append(varName).append("?.resize(" + m_output.append(m_indent).append(varName).append(qm).append(".resize(" ).append(r.elementWidth()).append(", ").append(r.elementHeight()).append(")").endl(); continue; } if (propertyName.equals("currentRow") // QListWidget::currentRow && m_uic.customWidgetsInfo()._extends(className, "QListWidget")) { - m_delayedOut.append(m_indent).append(varName).append("?.setCurrentRow(").append(p.elementNumber()).append(")").endl(); + m_delayedOut.append(m_indent).append(varName).append(qm).append(".setCurrentRow(").append(p.elementNumber()).append(")").endl(); continue; } if (propertyName.equals("currentIndex") // set currentIndex later && (m_uic.customWidgetsInfo().extendsOneOf(className, currentIndexWidgets))) { - m_delayedOut.append(m_indent).append(varName).append("?.setCurrentIndex(").append(p.elementNumber()).append(")").endl(); + m_delayedOut.append(m_indent).append(varName).append(qm).append(".setCurrentIndex(").append(p.elementNumber()).append(")").endl(); continue; } if (propertyName.equals("tabSpacing") && m_uic.customWidgetsInfo()._extends(className, "QToolBox")) { - m_delayedOut.append(m_indent).append(varName).append("?.layout().setSpacing(").append(p.elementNumber()).append(")").endl(); + m_delayedOut.append(m_indent).append(varName).append(qm).append(".layout().setSpacing(").append(p.elementNumber()).append(")").endl(); continue; } if (propertyName.equals("control") // ActiveQt support @@ -1620,10 +1634,10 @@ private void writeProperties(String varName, String objectName, String className if (p.elementEnum().equals("Qt.Orientation.Vertical")) shape = "QFrame.Shape.VLine"; - m_output.append(m_indent).append(varName).append("?.setFrameShape(").append(shape).append(")").endl(); + m_output.append(m_indent).append(varName).append(qm).append(".frameShape = ").append(shape).endl(); // QFrame Default is 'Plain'. Make the line 'Sunken' unless otherwise specified if (!frameShadowEncountered) { - m_output.append(m_indent).append(varName).append("?.setFrameShadow(QFrame.Shadow.Sunken)").endl(); + m_output.append(m_indent).append(varName).append(qm).append(".frameShadow = QFrame.Shadow.Sunken").endl(); } continue; } else if ((flags & Flag.WritePropertyIgnoreMargin.value())!=0 && propertyName.equals("margin")) { @@ -1655,16 +1669,20 @@ private void writeProperties(String varName, String objectName, String className stdset = p.attributeStdset()!=0; StringBuilder setFunction = new StringBuilder(); + boolean needPar = false; { if (stdset) { - setFunction.append("?.set").append(Character.toUpperCase(propertyName.charAt(0)) - ).append(propertyName.substring(1)).append('('); + setFunction.append(".").append(propertyName).append(" = "); } else { - setFunction.append("?.setProperty(\"").append(propertyName).append("\", "); + needPar = true; + setFunction.append(".setProperty(\"").append(propertyName).append("\", "); } } // QTextStream String varNewName = varName; + + boolean needBracket = false; + QTextStream o = delayProperty ? m_delayedOut : autoTrOutput(p); switch (p.kind()) { case Bool: { @@ -1693,7 +1711,7 @@ private void writeProperties(String varName, String objectName, String className break; case CursorShape: if (p.hasAttributeStdset() && p.attributeStdset()==0) - varNewName += "?.viewport()"; + varNewName += ".viewport()"; propertyValue = String.format("QCursor(Qt.CursorShape.%1$s)", p.elementCursorShape()); break; case Enum: @@ -1800,18 +1818,30 @@ private void writeProperties(String varName, String objectName, String className } break; case Font: +// o.append(m_indent).append('{').endl().flush(); +// m_indent = m_indent+" "; +// needBracket = true; propertyValue = writeFontProperties(p.elementFont()); break; case IconSet: +// o.append(m_indent).append('{').endl().flush(); +// m_indent = m_indent+" "; +// needBracket = true; propertyValue = writeIconProperties(p.elementIconSet()); break; case Pixmap: +// o.append(m_indent).append('{').endl().flush(); +// m_indent = m_indent+" "; +// needBracket = true; propertyValue = pixCall(p); break; case Palette: { +// o.append(m_indent).append('{').endl().flush(); +// m_indent = m_indent+" "; +// needBracket = true; DomPalette pal = p.elementPalette(); String paletteName = m_driver.unique("palette"); - m_output.append(m_indent).append("var ").append(paletteName).append(" = QPalette()").endl(); + m_output.append(m_indent).append("val ").append(paletteName).append(" = QPalette()").endl(); writeColorGroup(pal.elementActive(), "QPalette.ColorGroup.Active", paletteName); writeColorGroup(pal.elementInactive(), "QPalette.ColorGroup.Inactive", paletteName); writeColorGroup(pal.elementDisabled(), "QPalette.ColorGroup.Disabled", paletteName); @@ -1850,8 +1880,8 @@ private void writeProperties(String varName, String objectName, String className } case SizePolicy: { String spName = writeSizePolicy( p.elementSizePolicy()); - m_output.append(m_indent).append(spName).append("?.setHeightForWidth(" - ).append(varName).append("?.sizePolicy().hasHeightForWidth())").endl(); + m_output.append(m_indent).append(spName).append(".setHeightForWidth(" + ).append(varName).append(qm).append(".sizePolicy").append(qm).append(".hasHeightForWidth()").append(qm.isEmpty() ? "" : "==true").append(")").endl(); propertyValue = spName; break; @@ -1953,6 +1983,9 @@ private void writeProperties(String varName, String objectName, String className break; } case Brush: +// o.append(m_indent).append('{').endl().flush(); +// m_indent = m_indent+" "; +// needBracket = true; propertyValue = writeBrushInitialization(p.elementBrush()); break; case Unknown: @@ -1960,12 +1993,18 @@ private void writeProperties(String varName, String objectName, String className } if (!propertyValue.isEmpty()) { - QTextStream o = delayProperty ? m_delayedOut : autoTrOutput(p); - o.append(m_indent).append(varNewName).append(setFunction.toString()).append(propertyValue).append(")").endl().flush(); + o.append(m_indent).append(varNewName).append(qm).append(setFunction.toString()).append(propertyValue); + if(needPar) + o.append(")"); + o.endl().flush(); + if(needBracket) { + m_indent = m_indent.substring(4); + o.append(m_indent).append('}').endl().flush(); + } } } if (leftMargin != -1 || topMargin != -1 || rightMargin != -1 || bottomMargin != -1) { - m_output.append(m_indent).append(varName).append("?.setContentsMargins(" + m_output.append(m_indent).append(varName).append(qm).append(".setContentsMargins(" ).append(leftMargin).append(", ").append(topMargin).append(", " ).append(rightMargin).append(", ").append(bottomMargin).append(")").endl(); } @@ -2013,14 +2052,14 @@ private void writeBrush(DomBrush brush, String brushName) { String gradientName = m_driver.unique("gradient"); if (gradientType.equals("LinearGradient")) { m_output.append(m_indent - ).append("var ").append(gradientName).append(" = QLinearGradient(" + ).append("val ").append(gradientName).append(" = QLinearGradient(" ).append(gradient.attributeStartX() ).append(", ").append(gradient.attributeStartY() ).append(", ").append(gradient.attributeEndX() ).append(", ").append(gradient.attributeEndY()).append(")").endl(); } else if (gradientType.equals("RadialGradient")) { m_output.append(m_indent - ).append("var ").append(gradientName).append(" = QRadialGradient(" + ).append("val ").append(gradientName).append(" = QRadialGradient(" ).append(gradient.attributeCentralX() ).append(", ").append(gradient.attributeCentralY() ).append(", ").append(gradient.attributeRadius() @@ -2028,7 +2067,7 @@ private void writeBrush(DomBrush brush, String brushName) { ).append(", ").append(gradient.attributeFocalY()).append(")").endl(); } else if (gradientType.equals("ConicalGradient")) { m_output.append(m_indent - ).append("var ").append(gradientName).append(" = QConicalGradient(" + ).append("val ").append(gradientName).append(" = QConicalGradient(" ).append(gradient.attributeCentralX() ).append(", ").append(gradient.attributeCentralY() ).append(", ").append(gradient.attributeAngle()).append(")").endl(); @@ -2049,17 +2088,17 @@ private void writeBrush(DomBrush brush, String brushName) { ).append(stop.attributePosition()).append(", " ).append(domColor2QString(color)).append(")").endl(); } - m_output.append(m_indent).append("var ").append(brushName) + m_output.append(m_indent).append("val ").append(brushName) .append(" = QBrush(").append(gradientName).append(")").endl(); } else if (style.equals("TexturePattern")) { DomProperty property = brush.elementTexture(); String iconValue = iconCall(property); - m_output.append(m_indent).append("var ").append(brushName) + m_output.append(m_indent).append("val ").append(brushName) .append(" = QBrush(").append(iconValue).append(")").endl(); } else { DomColor color = brush.elementColor(); - m_output.append(m_indent).append("var ").append(brushName) + m_output.append(m_indent).append("val ").append(brushName) .append(" = QBrush(").append(domColor2QString(color)).append(")").endl(); m_output.append(m_indent).append(brushName) @@ -2074,7 +2113,7 @@ private void addInitializer(Item item, String name, int column, String value) { private void addInitializer(Item item, String name, int column, String value, String directive, boolean translatable) { if (!value.isEmpty()) { StringBuilder setter = new StringBuilder(); - setter.append("?.set").append(Character.toUpperCase(name.charAt(0))).append(name.substring(1)).append('('); + setter.append(".set").append(Character.toUpperCase(name.charAt(0))).append(name.substring(1)).append('('); if (column >= 0) setter.append(column).append(", "); setter.append(value).append(")"); @@ -2170,7 +2209,8 @@ private void initializeMenu(DomWidget w, String parentWidget) { } private void initializeComboBox(DomWidget w) { - String varName = m_driver.findOrInsertWidget(w); + final String varName = m_driver.findOrInsertWidget(w); + final String qm = varName.startsWith("this.") ? "?" : ""; List items = w.elementItem(); @@ -2187,13 +2227,13 @@ private void initializeComboBox(DomWidget w) { if (icon!=null) iconValue = iconCall(icon); - m_output.append(m_indent).append(varName).append("?.addItem("); + m_output.append(m_indent).append(varName).append(qm).append(".addItem("); if (icon!=null) m_output.append(iconValue).append(", "); if (needsTranslation(text.elementString())) { m_output.append("\"\")").endl(); - m_refreshOut.append(m_indent).append(varName).append("?.setItemText(").append(i).append(", ").append(trCall(text.elementString()) + m_refreshOut.append(m_indent).append(varName).append(qm).append(".setItemText(").append(i).append(", ").append(trCall(text.elementString()) ).append(")").endl(); } else { m_output.append(noTrCall(text.elementString())).append(")").endl(); @@ -2203,7 +2243,8 @@ private void initializeComboBox(DomWidget w) { } private void initializeListWidget(DomWidget w) { - String varName = m_driver.findOrInsertWidget(w); + final String varName = m_driver.findOrInsertWidget(w); + final String qm = varName.startsWith("this.") ? "?" : ""; List items = w.elementItem(); @@ -2223,14 +2264,15 @@ private void initializeListWidget(DomWidget w) { item.writeSetupUi(varName); StringBuilder parentPath = new StringBuilder(); - parentPath.append(varName).append("?.item(").append(i).append(')'); + parentPath.append(varName).append(qm).append(".item(").append(i).append(')'); item.writeRetranslateUi(parentPath.toString()); } enableSorting(w, varName, tempName); } private void initializeTreeWidget(DomWidget w) { - String varName = m_driver.findOrInsertWidget(w); + final String varName = m_driver.findOrInsertWidget(w); + final String qm = varName.startsWith("this.") ? "?" : ""; // columns Item item = new Item("QTreeWidgetItem", m_indent, m_output, m_refreshOut, m_driver); @@ -2246,14 +2288,14 @@ private void initializeTreeWidget(DomWidget w) { if (p!=null) { DomString str = p.elementString(); if (str!=null && str.text().isEmpty()) { - m_output.append(m_indent).append(varName).append("?.headerItem().setText(").append(i).append(", \"\")").endl(); + m_output.append(m_indent).append(varName).append(qm).append(".headerItem()").append(qm).append(".setText(").append(i).append(", \"\")").endl(); } } } String itemName = item.writeSetupUi("", Item.EmptyItemPolicy.DontConstruct); - item.writeRetranslateUi(varName + "?.headerItem()"); + item.writeRetranslateUi(varName + qm + ".headerItem()"); if (itemName!=null && !itemName.isEmpty()) { - m_output.append(m_indent).append(varName).append("?.setHeaderItem(").append(itemName).append(")").endl(); + m_output.append(m_indent).append(varName).append(qm).append(".setHeaderItem(").append(itemName).append(")").endl(); } if (w.elementItem().isEmpty()) @@ -2266,7 +2308,7 @@ private void initializeTreeWidget(DomWidget w) { Item itm = items.get(i); itm.writeSetupUi(varName); StringBuilder parentPath = new StringBuilder(); - parentPath.append(varName).append("?.topLevelItem(").append(i).append(')'); + parentPath.append(varName).append(qm).append(".topLevelItem(").append(i).append(')'); itm.writeRetranslateUi(parentPath.toString()); } @@ -2310,15 +2352,15 @@ private List initializeTreeWidgetItems(List domItems) { } private void initializeTableWidget(DomWidget w) { - String varName = m_driver.findOrInsertWidget(w); + final String varName = m_driver.findOrInsertWidget(w); + final String qm = varName.startsWith("this.") ? "?" : ""; // columns List columns = w.elementColumn(); if (!columns.isEmpty()) { - m_output.append(m_indent).append("if (").append(varName).append("?.columnCount() < ").append(columns.size()).append(')'); - m_output.endl().append(m_indent).append(m_option.indent).append(varName).append("?.setColumnCount(" - ).append(columns.size()).append(")").endl(); + m_output.append(m_indent).append("if (").append(qm.isEmpty() ? "" : "(").append(varName).append(qm).append(".columnCount").append(qm.isEmpty() ? "" : " as Int)").append(" < ").append(columns.size()).append(')'); + m_output.endl().append(m_indent).append(m_option.indent).append(varName).append(qm).append(".columnCount = ").append(columns.size()).endl(); } for (int i = 0; i < columns.size(); ++i) { @@ -2331,9 +2373,9 @@ private void initializeTableWidget(DomWidget w) { String itemName = item.writeSetupUi("", Item.EmptyItemPolicy.ConstructItemAndVariable); StringBuilder parentPath = new StringBuilder(); - parentPath.append(varName).append("?.horizontalHeaderItem(").append(i).append(')'); + parentPath.append(varName).append(qm).append(".horizontalHeaderItem(").append(i).append(')'); item.writeRetranslateUi(parentPath.toString()); - m_output.append(m_indent).append(varName).append("?.setHorizontalHeaderItem(" + m_output.append(m_indent).append(varName).append(qm).append(".setHorizontalHeaderItem(" ).append(i).append(", ").append(itemName).append(")").endl(); } } @@ -2342,8 +2384,8 @@ private void initializeTableWidget(DomWidget w) { List rows = w.elementRow(); if (!rows.isEmpty()) { - m_output.append(m_indent).append("if (").append(varName).append("?.rowCount() < ").append(rows.size()).append(')').endl() - .append(m_indent).append(m_option.indent).append(varName).append("?.setRowCount(").append(rows.size()).append(")").endl(); + m_output.append(m_indent).append("if (").append(qm.isEmpty() ? "" : "(").append(varName).append(qm).append(".rowCount").append(qm.isEmpty() ? "" : " as Int)").append(" < ").append(rows.size()).append(')').endl() + .append(m_indent).append(m_option.indent).append(varName).append(qm).append(".rowCount = ").append(rows.size()).endl(); } for (int i = 0; i < rows.size(); ++i) { @@ -2356,9 +2398,9 @@ private void initializeTableWidget(DomWidget w) { String itemName = item.writeSetupUi("", Item.EmptyItemPolicy.ConstructItemAndVariable); StringBuilder parentPath = new StringBuilder(); - parentPath.append(varName).append("?.verticalHeaderItem(").append(i).append(')'); + parentPath.append(varName).append(qm).append(".verticalHeaderItem(").append(i).append(')'); item.writeRetranslateUi(parentPath.toString()); - m_output.append(m_indent).append(varName).append("?.setVerticalHeaderItem(" + m_output.append(m_indent).append(varName).append(qm).append(".setVerticalHeaderItem(" ).append(i).append(", ").append(itemName).append(")").endl(); } } @@ -2380,10 +2422,10 @@ private void initializeTableWidget(DomWidget w) { String itemName = item.writeSetupUi("", Item.EmptyItemPolicy.ConstructItemAndVariable); StringBuilder parentPath = new StringBuilder(); - parentPath.append(varName).append("?.item(").append(r + parentPath.append(varName).append(qm).append(".item(").append(r ).append(", ").append(c).append(')'); item.writeRetranslateUi(parentPath.toString()); - m_output.append(m_indent).append(varName).append("?.setItem(").append(r).append(", ").append(c).append(", ").append(itemName).append(")").endl(); + m_output.append(m_indent).append(varName).append(qm).append(".setItem(").append(r).append(", ").append(c).append(", ").append(itemName).append(")").endl(); } } enableSorting(w, varName, tempName); @@ -2393,19 +2435,21 @@ private String disableSorting(DomWidget w, String varName) { // turn off sortingEnabled to force programmatic item order (setItem()) String tempName = ""; if (!w.elementItem().isEmpty()) { + final String qm = varName.startsWith("this.") ? "?" : ""; tempName = m_driver.unique("__sortingEnabled"); m_refreshOut.endl(); m_refreshOut.append(m_indent); - m_refreshOut.append("boolean "); - m_refreshOut.append(tempName).append(" = ").append(varName).append("?.isSortingEnabled()").endl() - .append(m_indent).append(varName).append("?.setSortingEnabled(false)").endl(); + m_refreshOut.append("val "); + m_refreshOut.append(tempName).append(" = ").append(varName).append(qm).append(".isSortingEnabled()==true").endl() + .append(m_indent).append(varName).append(qm).append(".setSortingEnabled(false)").endl(); } return tempName; } private void enableSorting(DomWidget w, String varName, String tempName) { if (!w.elementItem().isEmpty()) { - m_refreshOut.append(m_indent).append(varName).append("?.setSortingEnabled(").append(tempName).append(")").append('\n'); + final String qm = varName.startsWith("this.") ? "?" : ""; + m_refreshOut.append(m_indent).append(varName).append(qm).append(".setSortingEnabled(").append(tempName).append(")").append('\n'); } } @@ -2432,45 +2476,45 @@ private String writeFontProperties(DomFont f) { String fontName = m_driver.unique("font"); m_fontPropertiesNameMap.put(f, fontName); - m_output.append(m_indent).append("var ").append(fontName).append(" = QFont()").endl(); + m_output.append(m_indent).append("val ").append(fontName).append(" = QFont()").endl(); if (f.hasElementFamily() && !f.elementFamily().isEmpty()) { - m_output.append(m_indent).append(fontName).append("?.setFamilies(" - ).append("java.util.Arrays.asList(" + m_output.append(m_indent).append(fontName).append(".setFamilies(" + ).append("QList.of(" ).append(formatString(f.elementFamily()) ).append("))").endl(); } if (f.hasElementPointSize() && f.elementPointSize() > 0) { - m_output.append(m_indent).append(fontName).append("?.setPointSize(").append(f.elementPointSize() + m_output.append(m_indent).append(fontName).append(".setPointSize(").append(f.elementPointSize() ).append(")").endl(); } if (f.hasElementBold()) { - m_output.append(m_indent).append(fontName).append("?.setBold(" + m_output.append(m_indent).append(fontName).append(".setBold(" ).append(Boolean.toString(f.elementBold())).append(")").endl(); } if (f.hasElementItalic()) { - m_output.append(m_indent).append(fontName).append("?.setItalic(" + m_output.append(m_indent).append(fontName).append(".setItalic(" ).append(Boolean.toString(f.elementItalic())).append(")").endl(); } if (f.hasElementUnderline()) { - m_output.append(m_indent).append(fontName).append("?.setUnderline(" + m_output.append(m_indent).append(fontName).append(".setUnderline(" ).append(Boolean.toString(f.elementUnderline())).append(")").endl(); } if (f.hasElementStrikeOut()) { - m_output.append(m_indent).append(fontName).append("?.setStrikeOut(" + m_output.append(m_indent).append(fontName).append(".setStrikeOut(" ).append(Boolean.toString(f.elementStrikeOut())).append(")").endl(); } if (f.hasElementKerning()) { - m_output.append(m_indent).append(fontName).append("?.setKerning(" + m_output.append(m_indent).append(fontName).append(".setKerning(" ).append(Boolean.toString(f.elementKerning())).append(")").endl(); } if (f.hasElementAntialiasing()) { - m_output.append(m_indent).append(fontName).append("?.setStyleStrategy(QFont.StyleStrategy." + m_output.append(m_indent).append(fontName).append(".setStyleStrategy(QFont.StyleStrategy." ).append((f.elementAntialiasing() ? "PreferDefault" : "NoAntialias") ).append(")").endl(); } if (f.hasElementStyleStrategy()) { - m_output.append(m_indent).append(fontName).append("?.setStyleStrategy(QFont.StyleStrategy.") + m_output.append(m_indent).append(fontName).append(".setStyleStrategy(QFont.StyleStrategy.") .append(f.elementStyleStrategy()).append(")").endl(); } return fontName; @@ -2479,7 +2523,7 @@ private String writeFontProperties(DomFont f) { private static void writeIconAddFile(QTextStream output, String indent, String iconName, String fileName, String mode, String state){ - output.append(indent).append(iconName).append("?.addFile(").append(formatString(fileName)).append(", QSize(), QIcon.Mode.") + output.append(indent).append(iconName).append(".addFile(").append(formatString(fileName)).append(", QSize(), QIcon.Mode.") .append(mode).append(", QIcon.State.").append(state).append(")").endl(); } @@ -2524,7 +2568,7 @@ private static void writeResourceIcon(QTextStream output, private static void writeIconAddPixmap(QTextStream output, String indent, String iconName, String call, String mode, String state){ - output.append(indent).append(iconName).append("?.addPixmap(").append(call) + output.append(indent).append(iconName).append(".addPixmap(").append(call) .append(", QIcon.Mode.").append(mode).append(", QIcon.State.") .append(state).append(")").endl(); } @@ -2551,7 +2595,7 @@ private String writeIconProperties(DomResourceIcon i) { if (!isIconFormat44(i)) { // pre-4.4 legacy m_output.append(m_indent); - m_output.append("var "); + m_output.append("val "); m_output.append(iconName).append(" = ").append(pixCall("QIcon", i.text())).append(';').endl(); return iconName; } @@ -2559,17 +2603,17 @@ private String writeIconProperties(DomResourceIcon i) { // 4.4 onwards if (i.attributeTheme().isEmpty()) { // No theme: Write resource icon as is - m_output.append(m_indent).append("var ").append(iconName).append(" = QIcon()").endl(); + m_output.append(m_indent).append("val ").append(iconName).append(" = QIcon()").endl(); if (m_uic.pixmapFunction().isEmpty()) writeResourceIcon(m_output, iconName, m_indent, i); else writePixmapFunctionIcon(m_output, iconName, m_indent, i); return iconName; }else if(i.attributeTheme().startsWith(":") || i.attributeTheme().startsWith("classpath:") || i.attributeTheme().startsWith("/:classpath:")) { - m_output.append(m_indent).append("var ").append(iconName).append(" = QIcon(").append(formatString(i.attributeTheme())).append(")").endl(); + m_output.append(m_indent).append("val ").append(iconName).append(" = QIcon(").append(formatString(i.attributeTheme())).append(")").endl(); return iconName; }else if(i.attributeResource().startsWith(":") || i.attributeResource().startsWith("classpath:") || i.attributeResource().startsWith("/:classpath:")) { - m_output.append(m_indent).append("var ").append(iconName).append(" = QIcon(").append(formatString(i.attributeResource())).append(")").endl(); + m_output.append(m_indent).append("val ").append(iconName).append(" = QIcon(").append(formatString(i.attributeResource())).append(")").endl(); return iconName; } @@ -2577,7 +2621,7 @@ private String writeIconProperties(DomResourceIcon i) { if (iconHasStatePixmaps(i)) { // Theme + default state pixmaps: // Generate code to check the theme and default to state pixmaps - m_output.append(m_indent).append("var ").append(iconName).append(" = QIcon()").endl(); + m_output.append(m_indent).append("val ").append(iconName).append(" = QIcon()").endl(); String themeNameStringVariableC = "iconThemeName"; // Store theme name in a variable m_output.append(m_indent); @@ -2602,7 +2646,7 @@ private String writeIconProperties(DomResourceIcon i) { } // Theme, but no state pixmaps: Construct from theme directly. - m_output.append(m_indent).append("var ").append(iconName).append(" = QIcon(QIcon.fromTheme(") + m_output.append(m_indent).append("val ").append(iconName).append(" = QIcon(QIcon.fromTheme(") .append(formatString(i.attributeTheme())).append("))").endl(); return iconName; } @@ -2662,7 +2706,7 @@ private String writeSizePolicy(DomSizePolicy sp) { String spName = m_driver.unique("sizePolicy"); m_sizePolicyNameMap.put(sp, spName); - m_output.append(m_indent).append("var ").append(spName).append(" = QSizePolicy("); + m_output.append(m_indent).append("val ").append(spName).append(" = QSizePolicy("); if (sp.hasElementHSizeType() && sp.hasElementVSizeType()) { m_output.append("QSizePolicy.Policy.") .append(QSizePolicy.Policy.resolve(sp.elementHSizeType()).name()) @@ -2674,9 +2718,9 @@ private String writeSizePolicy(DomSizePolicy sp) { } m_output.append(")").endl(); - m_output.append(m_indent).append(spName).append("?.setHorizontalStretch(" + m_output.append(m_indent).append(spName).append(".setHorizontalStretch(" ).append(sp.elementHorStretch()).append(")").endl(); - m_output.append(m_indent).append(spName).append("?.setVerticalStretch(" + m_output.append(m_indent).append(spName).append(".setVerticalStretch(" ).append(sp.elementVerStretch()).append(")").endl(); return spName; } @@ -2728,13 +2772,12 @@ private void addButtonGroup(DomWidget buttonNode, String varName) { String className = "QButtonGroup"; m_output.append(m_indent); if (createGroupOnTheFly) - m_output.append("var "); + m_output.append("val "); m_output.append(groupName).append(" = ").append(className).append('(').append(m_mainFormVarName).append(")").endl(); m_buttonGroups.add(groupName); writeProperties(groupName, objectName, className, group.elementProperty()); } - m_output.append(m_indent).append(groupName).append("?.addButton(" - ).append(varName).append(")").endl(); + m_output.append(m_indent).append(groupName).append(".addButton(").append(varName).append(")").endl(); } @SuppressWarnings("unused") diff --git a/src/java/modules/qtjambi/Qt6/io/qt/core/QPermission.java b/src/java/modules/qtjambi/Qt6/io/qt/core/QPermission.java new file mode 100644 index 00000000..ba947f53 --- /dev/null +++ b/src/java/modules/qtjambi/Qt6/io/qt/core/QPermission.java @@ -0,0 +1,15 @@ +package io.qt.core; + +import io.qt.QtObject; + +/** + *

Java wrapper for Qt's class QPermission

+ */ +public abstract class QPermission extends QtObject implements java.lang.Cloneable{ + QPermission(QPrivateConstructor p) { + super(p); + } + + @Override + public abstract QPermission clone(); +} diff --git a/src/java/modules/qtjambi/build.xml b/src/java/modules/qtjambi/build.xml index d3509ba1..6229af53 100644 --- a/src/java/modules/qtjambi/build.xml +++ b/src/java/modules/qtjambi/build.xml @@ -9,10 +9,45 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -20,10 +55,24 @@ + - - + + + + + + + + + + + + + + + diff --git a/src/java/modules/qtjambi/jsr305/io/qt/NonNull.java b/src/java/modules/qtjambi/jsr305/io/qt/NonNull.java new file mode 100644 index 00000000..4c88e193 --- /dev/null +++ b/src/java/modules/qtjambi/jsr305/io/qt/NonNull.java @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2009-2023 Dr. Peter Droste, Omix Visualization GmbH & Co. KG. All rights reserved. +** +** This file is part of Qt Jambi. +** +** $BEGIN_LICENSE$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** $END_LICENSE$ + +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ +package io.qt; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation marks a parameter not to be null. + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE_USE) +@javax.annotation.Nonnull(when=javax.annotation.meta.When.ALWAYS) +@javax.annotation.meta.TypeQualifierNickname +public @interface NonNull { +} diff --git a/src/java/modules/qtjambi/jsr305/io/qt/Nullable.java b/src/java/modules/qtjambi/jsr305/io/qt/Nullable.java new file mode 100644 index 00000000..9652ddcf --- /dev/null +++ b/src/java/modules/qtjambi/jsr305/io/qt/Nullable.java @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2009-2023 Dr. Peter Droste, Omix Visualization GmbH & Co. KG. All rights reserved. +** +** This file is part of Qt Jambi. +** +** $BEGIN_LICENSE$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** $END_LICENSE$ + +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ +package io.qt; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation marks a parameter to accept null. + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE_USE) +@javax.annotation.Nonnull(when=javax.annotation.meta.When.NEVER) +@javax.annotation.meta.TypeQualifierNickname +public @interface Nullable { +} diff --git a/src/java/modules/qtjambi/jsr305/io/qt/StrictNonNull.java b/src/java/modules/qtjambi/jsr305/io/qt/StrictNonNull.java new file mode 100644 index 00000000..7393e38d --- /dev/null +++ b/src/java/modules/qtjambi/jsr305/io/qt/StrictNonNull.java @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009-2023 Dr. Peter Droste, Omix Visualization GmbH & Co. KG. All rights reserved. +** +** This file is part of Qt Jambi. +** +** $BEGIN_LICENSE$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** $END_LICENSE$ + +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ +package io.qt; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation marks a parameter to not accept null. + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE_USE) +@javax.annotation.Nonnull(when=javax.annotation.meta.When.ALWAYS) +@javax.annotation.meta.TypeQualifierNickname +@kotlin.annotations.jvm.UnderMigration(status = kotlin.annotations.jvm.MigrationStatus.STRICT) +@SuppressWarnings("deprecartion") +public @interface StrictNonNull { +} diff --git a/src/java/modules/qtjambi/main/io/qt/QNativePointer.java b/src/java/modules/qtjambi/main/io/qt/QNativePointer.java index 86d2bb2b..735a543e 100644 --- a/src/java/modules/qtjambi/main/io/qt/QNativePointer.java +++ b/src/java/modules/qtjambi/main/io/qt/QNativePointer.java @@ -808,7 +808,7 @@ public T objectAt(Class valueType, long pos) { }else { verifyAccess(Type.Pointer, pos); } - T object = readObject(data.m_ptr, valueType, pos, data.m_isReadonly); + T object = readObject(data.m_ptr, valueType, pos, data.m_isReadonly, data.m_type.value(), data.m_knownSize); if(data.m_autodelete!=AutoDeleteMode.None) { if(data.m_dependentObjects==null) { data.m_dependentObjects = new ArrayList<>(); @@ -1104,6 +1104,24 @@ public long pointer() { return data.m_ptr; } + /** + * This function creates a QNativePointer from an existing c++ + * pointer of unknown type. The long is the void * (i.e., address) + * value of the pointer. + * + * @param ptr the void * value of the pointer. + * @return a QNativePointer object with ptr as the native pointer + */ + public static QNativePointer fromNative(long ptr) { + QNativePointer nativePointer = new QNativePointer(); + nativePointer.data.m_ptr = ptr; + nativePointer.data.m_knownSize = -1; + nativePointer.data.m_type = Type.Pointer; + nativePointer.data.m_indirections = 1; + nativePointer.data.m_isReadonly = true; + return nativePointer; + } + /** * This function creates a QNativePointer from an existing c++ * pointer. The long is the void * (i.e., address) @@ -1400,7 +1418,7 @@ public QIODevice openAsDevice(QIODevice.OpenMode openMode) { private static native double readDouble(long ptr, long pos); private static native ByteBuffer toByteBuffer(long ptr, long capacity, boolean readOnly); private static native long readPointer(long ptr, long pos); - private static native T readObject(long ptr, Class valueType, long pos, boolean readOnly); + private static native T readObject(long ptr, Class valueType, long pos, boolean readOnly, int type, long size); private static native String readString(long ptr, long pos); private static native void writeBoolean(long ptr, long pos, boolean value); private static native void writeByte(long ptr, long pos, byte value); diff --git a/src/java/modules/qtjambi/main/io/qt/QtUtilities.java b/src/java/modules/qtjambi/main/io/qt/QtUtilities.java index 2923de93..92494a20 100644 --- a/src/java/modules/qtjambi/main/io/qt/QtUtilities.java +++ b/src/java/modules/qtjambi/main/io/qt/QtUtilities.java @@ -317,4 +317,20 @@ public interface Supplier extends java.util.function.Supplier, java.io.Ser public static QVersionNumber qtjambiVersion() { return new QVersionNumber(Utility.majorVersion(), Utility.minorVersion(), Utility.qtjambiPatchVersion()); } + + /** + * Checks if the current thread is UI thread and throws QThreadAffinityException otherwise. + * @throws QThreadAffinityException + */ + public static native void uiThreadCheck() throws QThreadAffinityException; + + /** + * Checks if the current thread is the given object's thread and throws QThreadAffinityException otherwise. + * @throws QThreadAffinityException + */ + public static void threadCheck(io.qt.core.QObject object) throws QThreadAffinityException{ + threadCheck(QtJambi_LibraryUtilities.internal.checkedNativeId(object)); + } + + private static native void threadCheck(long objectId) throws QThreadAffinityException; } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractAssociativeContainer.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractAssociativeContainer.java index 7ad4f936..a2fb80b0 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractAssociativeContainer.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractAssociativeContainer.java @@ -75,10 +75,6 @@ public final Iterator> iterator() { return constBegin().toJavaMapIterator(); } - protected AbstractAssociativeContainer() { - super(); - } - protected AbstractAssociativeContainer(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractHash.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractHash.java index e94f6475..f27b98ec 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractHash.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractHash.java @@ -38,10 +38,6 @@ public abstract class AbstractHash extends AbstractAssociativeContainer { - protected AbstractHash() { - super(); - } - protected AbstractHash(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractList.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractList.java index 3da84110..fbd3db73 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractList.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractList.java @@ -39,10 +39,6 @@ public abstract class AbstractList extends AbstractSequentialContainer implements List { - protected AbstractList() { - super(); - } - protected AbstractList(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMap.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMap.java index 5567a8fd..b53321ce 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMap.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMap.java @@ -43,10 +43,6 @@ public abstract class AbstractMap extends AbstractAssociativeContainer implements NavigableMap { - protected AbstractMap() { - super(); - } - protected AbstractMap(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiAssociativeContainer.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiAssociativeContainer.java index bfac19c1..32638acd 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiAssociativeContainer.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiAssociativeContainer.java @@ -84,10 +84,6 @@ public final Iterator> iterator() { return constBegin().toJavaMapIterator(); } - protected AbstractMultiAssociativeContainer() { - super(); - } - protected AbstractMultiAssociativeContainer(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiHash.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiHash.java index f688a199..e872b71e 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiHash.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiHash.java @@ -41,10 +41,6 @@ public abstract class AbstractMultiHash extends AbstractMultiAssociativeContainer { - protected AbstractMultiHash() { - super(); - } - protected AbstractMultiHash(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiMap.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiMap.java index 72ae2c31..6514394f 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiMap.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractMultiMap.java @@ -45,10 +45,6 @@ public abstract class AbstractMultiMap extends AbstractMultiAssociativeContainer implements NavigableMap> { - protected AbstractMultiMap() { - super(); - } - protected AbstractMultiMap(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/AbstractSequentialContainer.java b/src/java/modules/qtjambi/main/io/qt/internal/AbstractSequentialContainer.java index f0d3369b..c1586b53 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/AbstractSequentialContainer.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/AbstractSequentialContainer.java @@ -40,10 +40,6 @@ public abstract class AbstractSequentialContainer extends QtObject implements Collection { - protected AbstractSequentialContainer() { - super(); - } - protected AbstractSequentialContainer(QPrivateConstructor p) { super(p); } diff --git a/src/java/modules/qtjambi/main/io/qt/internal/LibraryUtility.java b/src/java/modules/qtjambi/main/io/qt/internal/LibraryUtility.java index 2e909fcb..35afc6af 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/LibraryUtility.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/LibraryUtility.java @@ -838,7 +838,8 @@ private static List resolveSystemLibraries(List tmpSystemLibrari } private static Architecture decideArchitecture() { - switch(System.getProperty("os.arch").toLowerCase()) { + String arch = System.getProperty("os.arch").toLowerCase(); + switch(arch) { case "arm": case "arm32": return Architecture.arm; @@ -850,7 +851,12 @@ private static Architecture decideArchitecture() { case "amd64": return Architecture.x86_64; default: - return Architecture.x86; + if(arch.startsWith("arm-")) + return Architecture.arm; + else if(arch.startsWith("aarch64-")) + return Architecture.arm64; + else + return Architecture.x86; } } @@ -1796,7 +1802,7 @@ private static Library.ExtractionFunction getLibraryExtractor(String urlBase, St break; } } - List dependencies = qtLibName==null ? Collections.emptyList() : QtJambi_LibraryUtilities.getDependencies().getOrDefault("Qt"+qtLibName, Collections.emptyList()); + List dependencies = qtLibName==null ? Collections.emptyList() : QtJambi_LibraryUtilities.dependencies.getOrDefault("Qt"+qtLibName, Collections.emptyList()); return ()->{ URL entryURL = new URL(urlBase+libName); diff --git a/src/java/modules/qtjambi/main/io/qt/internal/MetaTypeUtility.java b/src/java/modules/qtjambi/main/io/qt/internal/MetaTypeUtility.java index 87427778..120951d2 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/MetaTypeUtility.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/MetaTypeUtility.java @@ -401,56 +401,56 @@ private static void writeSerializableJavaObject(QDataStream s, Object o) throws s.writeInt(BYTE_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeByte(array[i]); + s.append(array[i]); } }else if(objectClass==short[].class) { short[] array = (short[])o; s.writeInt(SHORT_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeShort(array[i]); + s.append(array[i]); } }else if(objectClass==int[].class) { int[] array = (int[])o; s.writeInt(INT_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeInt(array[i]); + s.append(array[i]); } }else if(objectClass==long[].class) { long[] array = (long[])o; s.writeInt(LONG_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeLong(array[i]); + s.append(array[i]); } }else if(objectClass==float[].class) { float[] array = (float[])o; s.writeInt(FLOAT_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeFloat(array[i]); + s.append(array[i]); } }else if(objectClass==double[].class) { double[] array = (double[])o; s.writeInt(DOUBLE_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeDouble(array[i]); + s.append(array[i]); } }else if(objectClass==boolean[].class) { boolean[] array = (boolean[])o; s.writeInt(BOOLEAN_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeBoolean(array[i]); + s.append(array[i]); } }else if(objectClass==char[].class) { char[] array = (char[])o; s.writeInt(CHAR_ARRAY_MAGIC); s.writeInt(array.length); for (int i = 0; i < array.length; i++) { - s.writeChar(array[i]); + s.append(array[i]); } }else { Object[] array = (Object[])o; diff --git a/src/java/modules/qtjambi/main/io/qt/internal/SignalUtility.java b/src/java/modules/qtjambi/main/io/qt/internal/SignalUtility.java index b4e037e9..241a1896 100644 --- a/src/java/modules/qtjambi/main/io/qt/internal/SignalUtility.java +++ b/src/java/modules/qtjambi/main/io/qt/internal/SignalUtility.java @@ -2774,8 +2774,6 @@ private QMetaObject.Connection addConnectionToSlotOb QMetaMethod method = QMetaMethod.fromReflectedMethod(reflectiveMethod); if(method.isValid()) { reflectiveMethod = method.toReflectedMethod(); - }else { - throw new QUninvokableSlotException(reflectiveMethod); } } Object[] lambdaArgs = null; diff --git a/src/java/modules/qtjambi/non-jsr305/io/qt/NonNull.java b/src/java/modules/qtjambi/non-jsr305/io/qt/NonNull.java new file mode 100644 index 00000000..31ecaa33 --- /dev/null +++ b/src/java/modules/qtjambi/non-jsr305/io/qt/NonNull.java @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2009-2023 Dr. Peter Droste, Omix Visualization GmbH & Co. KG. All rights reserved. +** +** This file is part of Qt Jambi. +** +** $BEGIN_LICENSE$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** $END_LICENSE$ + +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ +package io.qt; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation marks a parameter to be not null. + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE_USE) +public @interface NonNull { +} diff --git a/src/java/modules/qtjambi/non-jsr305/io/qt/Nullable.java b/src/java/modules/qtjambi/non-jsr305/io/qt/Nullable.java new file mode 100644 index 00000000..c9b068bb --- /dev/null +++ b/src/java/modules/qtjambi/non-jsr305/io/qt/Nullable.java @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2009-2023 Dr. Peter Droste, Omix Visualization GmbH & Co. KG. All rights reserved. +** +** This file is part of Qt Jambi. +** +** $BEGIN_LICENSE$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** $END_LICENSE$ + +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ +package io.qt; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation marks a parameter to accept null. + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE_USE) +public @interface Nullable { +} diff --git a/src/java/modules/qtjambi/non-jsr305/io/qt/StrictNonNull.java b/src/java/modules/qtjambi/non-jsr305/io/qt/StrictNonNull.java new file mode 100644 index 00000000..ecad50ec --- /dev/null +++ b/src/java/modules/qtjambi/non-jsr305/io/qt/StrictNonNull.java @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2009-2023 Dr. Peter Droste, Omix Visualization GmbH & Co. KG. All rights reserved. +** +** This file is part of Qt Jambi. +** +** $BEGIN_LICENSE$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** $END_LICENSE$ + +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +****************************************************************************/ +package io.qt; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation marks a parameter to not accept null. + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE_USE) +public @interface StrictNonNull { +} diff --git a/src/java/plugins/plugins.xml b/src/java/plugins/plugins.xml index 5944dfb1..a6dd3743 100644 --- a/src/java/plugins/plugins.xml +++ b/src/java/plugins/plugins.xml @@ -311,7 +311,7 @@ - + diff --git a/src/java/qml/qml.xml b/src/java/qml/qml.xml index 524a7af7..ffde41a9 100644 --- a/src/java/qml/qml.xml +++ b/src/java/qml/qml.xml @@ -389,7 +389,7 @@ - +