diff options
author | Yasser Grimes <yasser.grimes@qt.io> | 2023-10-23 16:34:27 +0300 |
---|---|---|
committer | Yasser Grimes <yasser.grimes@qt.io> | 2023-11-02 15:54:57 +0200 |
commit | 5e928dc0c3657ab068573a26ef4606675bb86ed2 (patch) | |
tree | 6b607cba4d273584110054214591f9480027c0ab | |
parent | 8fae5634ede6dadcb0403da8e41702b33ca4c35b (diff) |
QmlDesigner: Add missing QtQuickUltralite 2.6 Components
The Componenets are:
- Profiling.QulPerfOverlay (New Profiling module)
- Extras.AnimatedSpriteDirectory
Task-number: QDS-10392
Change-Id: Iff1a92da25a55c803d0422b4215504c52ea00387
Reviewed-by: Aleksei German <aleksei.german@qt.io>
16 files changed, 433 insertions, 1 deletions
diff --git a/src/imports/compat/CMakeLists.txt b/src/imports/compat/CMakeLists.txt index d35facf..1578454 100644 --- a/src/imports/compat/CMakeLists.txt +++ b/src/imports/compat/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(Extras) add_subdirectory(Layers) +add_subdirectory(Profiling) diff --git a/src/imports/compat/Extras/AnimatedSpriteDirectory.qml b/src/imports/compat/Extras/AnimatedSpriteDirectory.qml index 6488268..900d0b6 100644 --- a/src/imports/compat/Extras/AnimatedSpriteDirectory.qml +++ b/src/imports/compat/Extras/AnimatedSpriteDirectory.qml @@ -32,15 +32,18 @@ import QtQuick 2.15 // Draws a sprite animation stored in a directory. Item { property int currentFrame: 0 - property int frameDuration: -2 + property int frameDuration: 0 property int loops: -1 //-1 = AnimatedSpriteDirectory.Infinite property bool running: true + property bool paused: false property string sourcePath signal finished function advance() {} + function pause() {} function restart() {} + function resume() {} function start() {} function stop() {} } diff --git a/src/imports/compat/Extras/designer/AnimatedSpriteDirectorySpecifics.qml b/src/imports/compat/Extras/designer/AnimatedSpriteDirectorySpecifics.qml new file mode 100644 index 0000000..6fff621 --- /dev/null +++ b/src/imports/compat/Extras/designer/AnimatedSpriteDirectorySpecifics.qml @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Ultralite compatibility. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Layouts 1.15 +import HelperWidgets 2.0 +import StudioTheme 1.0 as StudioTheme + +Column { + anchors.left: parent.left + anchors.right: parent.right + + Section { + anchors.left: parent.left + anchors.right: parent.right + + caption: qsTr("Animated Sprite Directory") + + SectionLayout { + PropertyLabel { + text: qsTr("Current frame") + tooltip: qsTr("Set this property to advance the current frame") + } + + SecondColumnLayout { + SpinBox { + backendValue: backendValues.currentFrame + minimumValue: 0 + maximumValue: Number.MAX_VALUE + decimals: 0 + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + enabled: backendValue.isAvailable + } + + ExpandingSpacer {} + } + + PropertyLabel { + text: qsTr("Frame duration") + tooltip: qsTr("Duration of each frame of the animation in milliseconds") + } + + SecondColumnLayout { + SpinBox { + backendValue: backendValues.frameDuration + minimumValue: 0 + maximumValue: Number.MAX_VALUE + decimals: 0 + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + enabled: backendValue.isAvailable + } + + ExpandingSpacer {} + } + + PropertyLabel { + text: qsTr("Loops") + tooltip: qsTr("Indicate the number of times the animation should reply, set to -1 for Infinite") + } + + SecondColumnLayout { + SpinBox { + backendValue: backendValues.loops + minimumValue: -1 + maximumValue: Number.MAX_VALUE + decimals: 0 + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + enabled: backendValue.isAvailable + } + + ExpandingSpacer {} + } + + PropertyLabel { + text: qsTr("Running") + tooltip: qsTr("Indicates whether the application is running or not") + } + + SecondColumnLayout { + CheckBox { + enabled: backendValues.running + text: backendValues.running.valueToString + backendValue: backendValues.running + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + } + + ExpandingSpacer {} + } + + PropertyLabel { + text: qsTr("Paused") + tooltip: qsTr("Indicate whether the animation is paused or not") + } + + SecondColumnLayout { + CheckBox { + enabled: backendValues.paused + text: backendValues.paused.valueToString + backendValue: backendValues.paused + implicitWidth: StudioTheme.Values.twoControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + } + + ExpandingSpacer {} + } + PropertyLabel { + text: qsTr("Source path") + tooltip: qsTr("Path to the directory with images for the sprite animation") + } + + SecondColumnLayout { + + // QDS-11080: use UrlChooser instead when it supports folder selection + LineEdit { + backendValue: backendValues.sourcePath + showTranslateCheckBox: false + implicitWidth: StudioTheme.Values.singleControlColumnWidth + + StudioTheme.Values.actionIndicatorWidth + } + + ExpandingSpacer {} + } + + } + } +} diff --git a/src/imports/compat/Extras/designer/QtQuickUltraliteExtras.metainfo b/src/imports/compat/Extras/designer/QtQuickUltraliteExtras.metainfo index 755a3bd..43cce99 100644 --- a/src/imports/compat/Extras/designer/QtQuickUltraliteExtras.metainfo +++ b/src/imports/compat/Extras/designer/QtQuickUltraliteExtras.metainfo @@ -34,4 +34,28 @@ MetaInfo { toolTip: qsTr("Enables optimized drawing of text.") } } + + Type { + name: "QtQuickUltralite.Extras.AnimatedSpriteDirectory" + icon: "images/animated-image-icon.png" + + ItemLibraryEntry { + name: "AnimatedSprite Directory" + category: "QtQuickUltralite - Extras" + libraryIcon: "images/animated-image-icon@2x.png" + version: "1.0" + requiredImport: "QtQuickUltralite.Extras" + + Property { name: "width"; type: "int"; value: 100; } + Property { name: "height"; type: "int"; value: 100; } + Property { name: "currentFrame"; type: "int"; value: 0; } + Property { name: "frameDuration"; type: "int"; value: 30; } + Property { name: "loops"; type: "int"; value: -1; } + Property { name: "running"; type: "bool"; value: true; } + Property { name: "paused"; type: "bool"; value: false; } + Property { name: "sourcePath"; type: "string"; value: ""; } + + toolTip: qsTr("Draws a sprite animation stored in a directory.") + } + } } diff --git a/src/imports/compat/Extras/designer/images/animated-image-icon.png b/src/imports/compat/Extras/designer/images/animated-image-icon.png Binary files differnew file mode 100644 index 0000000..71371f9 --- /dev/null +++ b/src/imports/compat/Extras/designer/images/animated-image-icon.png diff --git a/src/imports/compat/Extras/designer/images/animated-image-icon@2x.png b/src/imports/compat/Extras/designer/images/animated-image-icon@2x.png Binary files differnew file mode 100644 index 0000000..4ad2a90 --- /dev/null +++ b/src/imports/compat/Extras/designer/images/animated-image-icon@2x.png diff --git a/src/imports/compat/Profiling/CMakeLists.txt b/src/imports/compat/Profiling/CMakeLists.txt new file mode 100644 index 0000000..28092bc --- /dev/null +++ b/src/imports/compat/Profiling/CMakeLists.txt @@ -0,0 +1,17 @@ +qt_internal_add_qml_module(QuickUltraLiteStudioProfiling + URI "QtQuickUltralite.Profiling" + VERSION "${PROJECT_VERSION}" + DESIGNER_SUPPORTED + NO_SYNC_QT + PAST_MAJOR_VERSIONS + 1 + 2 + QML_FILES + QulPerfOverlay.qml +) + +if(QT_FEATURE_quick_designer AND QT_BUILD_SHARED_LIBS) + add_subdirectory(designer) +endif() + + diff --git a/src/imports/compat/Profiling/QulPerfOverlay.qml b/src/imports/compat/Profiling/QulPerfOverlay.qml new file mode 100644 index 0000000..84907a6 --- /dev/null +++ b/src/imports/compat/Profiling/QulPerfOverlay.qml @@ -0,0 +1,69 @@ +/****************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Ultralite module. +** +** $QT_BEGIN_LICENSE:COMM$ +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** $QT_END_LICENSE$ +** +******************************************************************************/ + +import QtQuick 2.15 +import QtQuickUltralite.Extras + +Column { + id: root + + onVisibleChanged: { + if (root.visible) { + console.log("Benchmark Results:"); + console.log("Total frames: ", QulPerf.totalFrames); + console.log("Average fps: ", QulPerf.averageFps.toFixed(2)); + console.log("Minimum fps: ", QulPerf.minimumFps.toFixed(1)); + console.log("Max heap usage: ", QulPerf.maxHeapUsage, "Bytes"); + console.log("Max stack usage: ", QulPerf.maxStackUsage, "Bytes"); + console.log("Average CPU load:", QulPerf.averageCpuLoad.toFixed(1), "%"); + } + } + + Text { + color: "#ffb6c1" + text: "Total frames: " + QulPerf.totalFrames + } + + Text { + color: "#ffb6c1" + text: "Average fps: " + QulPerf.averageFps.toFixed(2) + } + + Text { + color: "#ffb6c1" + text: "Minimum fps: " + QulPerf.minimumFps.toFixed(1) + } + + Text { + color: "#ffb6c1" + text: "Max heap usage: " + QulPerf.maxHeapUsage + " Bytes" + } + + Text { + color: "#ffb6c1" + text: "Max stack usage: " + QulPerf.maxStackUsage + " Bytes" + } + + Text { + color: "#ffb6c1" + text: "Average CPU load: " + QulPerf.averageCpuLoad.toFixed(1) + "%" + } +} diff --git a/src/imports/compat/Profiling/designer/CMakeLists.txt b/src/imports/compat/Profiling/designer/CMakeLists.txt new file mode 100644 index 0000000..b93c569 --- /dev/null +++ b/src/imports/compat/Profiling/designer/CMakeLists.txt @@ -0,0 +1,16 @@ +qt_path_join(installdesignerdir "${INSTALL_QMLDIR}" "QtQuickUltralite/Profiling") +qt_path_join(targetdesignerdir "${CMAKE_BINARY_DIR}" "${installdesignerdir}/designer") + +file( + COPY . + DESTINATION ${targetdesignerdir} + FILES_MATCHING PATTERN "*qml" + PATTERN "*metainfo" + PATTERN "images/*png" + PATTERN "CMakeFiles" EXCLUDE +) + +qt_install( + DIRECTORY ${targetdesignerdir} + DESTINATION ${installdesignerdir} +) diff --git a/src/imports/compat/Profiling/designer/QtQuickUltraliteProfiling.metainfo b/src/imports/compat/Profiling/designer/QtQuickUltraliteProfiling.metainfo new file mode 100644 index 0000000..25b3f01 --- /dev/null +++ b/src/imports/compat/Profiling/designer/QtQuickUltraliteProfiling.metainfo @@ -0,0 +1,19 @@ +MetaInfo { + Type { + name: "QtQuickUltralite.Profiling.QulPerfOverlay" + icon: "images/levels-icon.png" + + ItemLibraryEntry { + name: "QulPerf Overlay" + category: "QtQuickUltralite - Profiling" + libraryIcon: "images/levels-icon@2x.png" + version: "1.0" + requiredImport: "QtQuickUltralite.Profiling" + + Property { name: "width"; type: "int"; value: 100; } + Property { name: "height"; type: "int"; value: 100; } + + toolTip: qsTr("Logs and displays Qul application performance metrics.") + } + } +} diff --git a/src/imports/compat/Profiling/designer/QulPerfOverlaySpecifics.qml b/src/imports/compat/Profiling/designer/QulPerfOverlaySpecifics.qml new file mode 100644 index 0000000..e6c0dcc --- /dev/null +++ b/src/imports/compat/Profiling/designer/QulPerfOverlaySpecifics.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Ultralite compatibility. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Layouts +import HelperWidgets +import StudioTheme + +//! [QulPerfOverlay compatibility] +Column { + anchors.left: parent.left + anchors.right: parent.right + + Section { + anchors.left: parent.left + anchors.right: parent.right + caption: qsTr("QulPerf Overlay") + } + +} +//! [QulPerfOverlay compatibility] diff --git a/src/imports/compat/Profiling/designer/images/levels-icon.png b/src/imports/compat/Profiling/designer/images/levels-icon.png Binary files differnew file mode 100644 index 0000000..de33760 --- /dev/null +++ b/src/imports/compat/Profiling/designer/images/levels-icon.png diff --git a/src/imports/compat/Profiling/designer/images/levels-icon@2x.png b/src/imports/compat/Profiling/designer/images/levels-icon@2x.png Binary files differnew file mode 100644 index 0000000..514d4a5 --- /dev/null +++ b/src/imports/compat/Profiling/designer/images/levels-icon@2x.png diff --git a/src/imports/compat/Profiling/plugins.qmltypes b/src/imports/compat/Profiling/plugins.qmltypes new file mode 100644 index 0000000..c058e79 --- /dev/null +++ b/src/imports/compat/Profiling/plugins.qmltypes @@ -0,0 +1,13 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.15' + +Module { + dependencies: [ + "QtQuick 2.15" + ] +} diff --git a/src/imports/compat/Profiling/qmldir b/src/imports/compat/Profiling/qmldir new file mode 100644 index 0000000..ff33cc0 --- /dev/null +++ b/src/imports/compat/Profiling/qmldir @@ -0,0 +1,10 @@ +module QtQuickUltralite.Profiling +designersupported +linktarget studioqtquickultraliteprofilingplugin +optional plugin studioqtquickultraliteprofilingplugin +classname QtQuickUltralite_ProfilingPlugin +typeinfo studioqtquickultraliteprofiling.qmltypes +prefer :/QtQuickUltralite/Profiling/ +QulPerfOverlay 1.0 QulPerfOverlay.qml +QulPerfOverlay 2.0 QulPerfOverlay.qml +QulPerfOverlay 6.0 QulPerfOverlay.qml diff --git a/src/imports/compat/Profiling/studiocompatibilityqulprofiling.cpp b/src/imports/compat/Profiling/studiocompatibilityqulprofiling.cpp new file mode 100644 index 0000000..ba8396f --- /dev/null +++ b/src/imports/compat/Profiling/studiocompatibilityqulprofiling.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Ultralite compatibility. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QQmlEngine> +#include <QQmlContext> +#include <QtQml/qqmlextensionplugin.h> + +QT_BEGIN_NAMESPACE + +class StudioCompatibilityQULProfiling: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + StudioCompatibilityQULProfiling(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +StudioCompatibilityQULProfiling::StudioCompatibilityQULProfiling(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void StudioCompatibilityQULProfiling::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "studiocompatibilityqulprofiling.moc" |