commit 96a7c71a29babfd776677152aa05cd74d9ab1e76 Author: Digital Artifex <7929434+DigitalArtifex@users.noreply.github.com> Date: Tue Jun 2 15:11:36 2026 -0400 Inital commit of the Komplex Hub diff --git a/App/CMakeLists.txt b/App/CMakeLists.txt new file mode 100644 index 0000000..170ad6f --- /dev/null +++ b/App/CMakeLists.txt @@ -0,0 +1,11 @@ + +target_sources(${CMAKE_PROJECT_NAME} PUBLIC + "main.cpp" +) + +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Quick + Qt${QT_VERSION_MAJOR}::Qml) \ No newline at end of file diff --git a/App/autogen/environment.h b/App/autogen/environment.h new file mode 100644 index 0000000..59b4ce0 --- /dev/null +++ b/App/autogen/environment.h @@ -0,0 +1,36 @@ +/* + * This file is automatically generated by Qt Design Studio. + * Do not change. +*/ +#ifndef APP_ENVIRONMENT_H +#define APP_ENVIRONMENT_H + +#include +#include "qqmlextensionplugin.h" + +Q_IMPORT_QML_PLUGIN(KomplexHubPlugin) +Q_IMPORT_QML_PLUGIN(KomplexHubContentPlugin) + +const char mainQmlFile[] = "qrc:/qt/qml/KomplexHubContent/App.qml"; + +#ifdef BUILD_QDS_COMPONENTS + +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_ComponentsPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EffectsPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_ApplicationPlugin) +Q_IMPORT_QML_PLUGIN(FlowViewPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_LogicHelperPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_MultiTextPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EventSimulatorPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EventSystemPlugin) + +#endif + +inline void set_qt_environment() { + qputenv("QML_COMPAT_RESOLVE_URLS_ON_ASSIGNMENT", "1"); + qputenv("QT_ENABLE_HIGHDPI_SCALING", "0"); + qputenv("QT_LOGGING_RULES", "qt.qml.connections=false"); + qputenv("QT_QUICK_CONTROLS_CONF", ":/qtquickcontrols2.conf"); +} + +#endif // APP_ENVIRONMENT_H diff --git a/App/main.cpp b/App/main.cpp new file mode 100644 index 0000000..6e665e2 --- /dev/null +++ b/App/main.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "autogen/environment.h" + +int main(int argc, char *argv[]) +{ + set_qt_environment(); + QCoreApplication::setOrganizationName("DigitalArtifex"); + QCoreApplication::setApplicationName("KomplexHub"); + QCoreApplication::setApplicationVersion("1.0"); + + QApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(mainQmlFile); + QObject::connect( + &engine, &QQmlApplicationEngine::objectCreated, &app, + [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + + engine.addImportPath(QCoreApplication::applicationDirPath() + "/qml"); + engine.addImportPath(":/"); + engine.load(url); + + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..fbeffe3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,125 @@ + +cmake_minimum_required(VERSION 3.21.1) + +option(LINK_INSIGHT "Link Qt Insight Tracker library" ON) +option(BUILD_QDS_COMPONENTS "Build design studio components" ON) + +project(KomplexHub LANGUAGES CXX) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml) +set(QML_IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY} + CACHE STRING "Import paths for Qt Creator's code model" + FORCE +) + +find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Widgets Qml Quick QuickControls2 QuickTimeline ShaderTools) +qt_standard_project_setup() + +qt_add_executable(${CMAKE_PROJECT_NAME}) +qt_add_resources(${CMAKE_PROJECT_NAME} "configuration" + PREFIX "/" + FILES + qtquickcontrols2.conf +) + +qt_add_resources(${CMAKE_PROJECT_NAME} "app_images" + FILES + "images/icons/icons8-back.svg" + "images/icons/icons8-bill.svg" + "images/icons/icons8-biotech.svg" + "images/icons/icons8-cancel.svg" + "images/icons/icons8-check-mark.svg" + "images/icons/icons8-close-window.svg" + "images/icons/icons8-famous.svg" + "images/icons/icons8-filter.svg" + "images/icons/icons8-forward.svg" + "images/icons/icons8-hdd.svg" + "images/icons/icons8-image.svg" + "images/icons/icons8-login.svg" + "images/icons/icons8-logout-rounded-left.svg" + "images/icons/icons8-next.svg" + "images/icons/icons8-reply-arrow.svg" + "images/icons/icons8-search.svg" + "images/icons/icons8-settings.svg" + "images/icons/icons8-shopping-cart.svg" + "images/icons/icons8-star-filled.svg" + "images/icons/icons8-store.svg" + "images/icons/icons8-user-account.svg" + "images/icons/icons8-view-more.svg" + "images/kero/kero_build_1.png" + "images/kero/kero_build_2.png" + "images/kero/kero_build_3.png" + "images/kero/kero_build_4.png" + "images/kero/kero_build_error.png" + "images/kero/kero_choice.png" + "images/kero/kero_error.png" + "images/kero/kero_hello.png" + "images/kero/kero_login.png" + "images/kero/kero_no_results.png" + "images/kero/kero_run_1.png" + "images/kero/kero_run_2.png" + "images/kero/kero_run_3.png" + "images/kero/kero_run_4.png" + "images/kero/kero_success.png" + "images/kero/kero_warning.png" + "images/icons/icons8-trash.svg" + ) + +include(qds) + +option(ENABLE_ASAN "Enable AddressSanitizer" OFF) + +if(ENABLE_ASAN) + message(STATUS "Building with AddressSanitizer") + if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + message(FATAL_ERROR "ASan supported only with Clang/GCC") + endif() + + target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -fsanitize=address -fno-omit-frame-pointer) + target_link_options(${CMAKE_PROJECT_NAME} PRIVATE -fsanitize=address) +endif() + +# this wont produce a binary due to a feature mismatch issue, but will lint + +option(ENABLE_CLANG_TIDY "Enable clang-tidy" OFF) + +if(ENABLE_CLANG_TIDY) + if(NOT DEFINED CLANG_TIDY) + if(DEFINED ENV{CLANG_TIDY}) + set(CLANG_TIDY $ENV{CLANG_TIDY}) + endif() + endif() + + find_program(CLANG_TIDY_EXE NAMES ${CLANG_TIDY} clang-tidy) + if(CLANG_TIDY_EXE) + message(STATUS ${CMAKE_CXX_FLAGS}) + message(STATUS "Found clang-tidy: ${CLANG_TIDY_EXE}") + else() + message(STATUS "clang-tidy not found") + endif() + if(CLANG_TIDY_EXE) + set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-checks=modernize-*,performance-*,readability-*,header-filter=.*;--warnings-as-errors=*;--extra-arg=-Qunused-arguments") + endif() +endif() + +if (BUILD_QDS_COMPONENTS) + include(qmlcomponents OPTIONAL) +endif() + +if (LINK_INSIGHT) + include(insight OPTIONAL) +endif () + +include(GNUInstallDirs) +install(TARGETS ${CMAKE_PROJECT_NAME} + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/CMakeLists.txt.shared b/CMakeLists.txt.shared new file mode 100644 index 0000000..6587057 --- /dev/null +++ b/CMakeLists.txt.shared @@ -0,0 +1,20 @@ + + + + + ProjectExplorer.Project.PluginSettings + + + QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE=../%{Asciify:%{Project:Name}-%{BuildConfig:Name}} + + + + + Version + 22 + + + CMake Generator + 2 + + diff --git a/Dependencies/CMakeLists.txt b/Dependencies/CMakeLists.txt new file mode 100644 index 0000000..acece12 --- /dev/null +++ b/Dependencies/CMakeLists.txt @@ -0,0 +1,4 @@ + +if (BUILD_QDS_COMPONENTS) + add_subdirectory(Components) +endif() diff --git a/Dependencies/Components/CMakeLists.txt b/Dependencies/Components/CMakeLists.txt new file mode 100644 index 0000000..056cce5 --- /dev/null +++ b/Dependencies/Components/CMakeLists.txt @@ -0,0 +1,18 @@ +find_package(Qt6 COMPONENTS ShaderTools) + +add_library(QtQuickDesignerComponents INTERFACE) + +function(register_plugin module_name) + target_link_libraries(QtQuickDesignerComponents INTERFACE ${module_name}plugin) +endfunction() + +set(qds_qml_extra_args "") +if(QT_QDS_COMPONENTS_NOWARN) + list(APPEND qds_qml_extra_args NO_LINT) +endif() + +if (Qt6_VERSION VERSION_GREATER_EQUAL "6.8") + qt_policy(SET QTP0004 NEW) +endif() + +add_subdirectory(imports) diff --git a/Dependencies/Components/ignore-in-qds b/Dependencies/Components/ignore-in-qds new file mode 100644 index 0000000..8e70753 --- /dev/null +++ b/Dependencies/Components/ignore-in-qds @@ -0,0 +1,2 @@ +#### QDS 4.8.0 +This folder is ignored in Qt Design Studio. diff --git a/Dependencies/Components/imports/CMakeLists.txt b/Dependencies/Components/imports/CMakeLists.txt new file mode 100644 index 0000000..ef70eef --- /dev/null +++ b/Dependencies/Components/imports/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(application) +add_subdirectory(compat) +add_subdirectory(components) +add_subdirectory(designeffects) +add_subdirectory(effects_qt6) +add_subdirectory(flowview) +add_subdirectory(logichelper) +add_subdirectory(multitext) +add_subdirectory(tools) +add_subdirectory(utils) diff --git a/Dependencies/Components/imports/application/CMakeLists.txt b/Dependencies/Components/imports/application/CMakeLists.txt new file mode 100644 index 0000000..4b8b86f --- /dev/null +++ b/Dependencies/Components/imports/application/CMakeLists.txt @@ -0,0 +1,15 @@ +qt_add_library(QuickStudioApplication STATIC) +qt6_add_qml_module(QuickStudioApplication + URI "QtQuick.Studio.Application" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + ${qds_qml_extra_args} + SOURCES + quickstudioapplication.cpp + quickstudioapplication.h +) + +target_link_libraries(QuickStudioApplication PRIVATE Qt6::Gui) + +register_plugin(QuickStudioApplication) diff --git a/Dependencies/Components/imports/application/quickstudioapplication.cpp b/Dependencies/Components/imports/application/quickstudioapplication.cpp new file mode 100644 index 0000000..a4e9f29 --- /dev/null +++ b/Dependencies/Components/imports/application/quickstudioapplication.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quickstudioapplication.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef Q_STATIC_LOGGING_CATEGORY // introduced with Qt 6.9 +static Q_LOGGING_CATEGORY(texttomodelMergerDebug, "qt.Studioapplication.debug", QtDebugMsg) +#else +Q_STATIC_LOGGING_CATEGORY(texttomodelMergerDebug, "qt.Studioapplication.debug", QtDebugMsg) +#endif + +QuickStudioApplication::QuickStudioApplication(QObject *parent) : QObject(parent) {} + +static void loadFont(const QString &path) +{ + qCDebug(texttomodelMergerDebug) << Q_FUNC_INFO << "Load font: " << path; + QFontDatabase::addApplicationFont(path); +} + +void QuickStudioApplication::setFontPath(const QUrl &url) +{ + if (url == fontPath()) + return; + + m_fontPath = url; + + QString localPath; + + if (url.isLocalFile()) + localPath = url.toLocalFile(); + + if (url.scheme() == QStringLiteral("qrc")) { + const QString &path = url.path(); + localPath = QStringLiteral(":") + path; + } + + if (!localPath.isEmpty()) { + QDirIterator it(localPath, + {QStringLiteral("*.ttf"), QStringLiteral("*.otf")}, + QDir::Files, + QDirIterator::Subdirectories); + + while (it.hasNext()) + loadFont(it.next()); + } + + emit fontPathChanged(); +} + +QT_END_NAMESPACE diff --git a/Dependencies/Components/imports/application/quickstudioapplication.h b/Dependencies/Components/imports/application/quickstudioapplication.h new file mode 100644 index 0000000..a8c46ab --- /dev/null +++ b/Dependencies/Components/imports/application/quickstudioapplication.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUICKSTUDIOAPPLICATION_P_H +#define QUICKSTUDIOAPPLICATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QuickStudioApplication : public QObject +{ + Q_OBJECT + + QML_NAMED_ELEMENT(StudioApplication) + QML_ADDED_IN_VERSION(6, 2) + + Q_PROPERTY(QUrl fontPath READ fontPath WRITE setFontPath NOTIFY fontPathChanged) + +public: + explicit QuickStudioApplication(QObject *parent = nullptr); + + const QUrl fontPath() { return m_fontPath; } + void setFontPath(const QUrl &path); + +signals: + void fontPathChanged(); + +private: + QUrl m_fontPath; + +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QuickStudioApplication) + +#endif // QUICKSTUDIOAPPLICATION_P_H diff --git a/Dependencies/Components/imports/compat/CMakeLists.txt b/Dependencies/Components/imports/compat/CMakeLists.txt new file mode 100644 index 0000000..454e984 --- /dev/null +++ b/Dependencies/Components/imports/compat/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(Components) +add_subdirectory(Extras) +add_subdirectory(Layers) +add_subdirectory(Profiling) diff --git a/Dependencies/Components/imports/compat/Components/ArcItem.qml b/Dependencies/Components/imports/compat/Components/ArcItem.qml new file mode 100644 index 0000000..c1a8271 --- /dev/null +++ b/Dependencies/Components/imports/compat/Components/ArcItem.qml @@ -0,0 +1,244 @@ +/**************************************************************************** +** +** 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.9 +import QtQuick.Shapes 1.12 + +//! [ArcItem compatibility] +Shape { + id: root + + implicitWidth: 100 + implicitHeight: 100 + + // These properties are not supported in Qt Quick Ultralite: + // strokeStyle, dashPattern, dashOffset + + property alias gradient: path.fillGradient + property alias strokeWidth: path.strokeWidth + property alias strokeColor: path.strokeColor + property alias joinStyle: path.joinStyle + property alias fillColor: path.fillColor + property alias capStyle: path.capStyle + property real begin: 0 + property real end: 90 + property real arcWidth: 10 + property real alpha: root.clamp(root.sortedEnd() - root.sortedBegin(), 0, 359.9) + + // antialiasing is enabled to have the same shape as Qt Quick Ultralite runtime + antialiasing: true + + layer.enabled: root.antialiasing + layer.smooth: root.antialiasing + layer.samples: root.antialiasing ? 4 : 0 + + property bool outlineArc: false + property bool round: false + property bool roundEnd: root.round + property bool roundBegin: root.round + + function clamp(num, min, max) { + return Math.max(min, Math.min(num, max)) + } + + function toRadians(degrees) { + return degrees * (Math.PI / 180.0) + } + + function myCos(angleInDegrees) { + return Math.cos(root.toRadians(angleInDegrees)) + } + + function mySin(angleInDegrees) { + return Math.sin(root.toRadians(angleInDegrees)) + } + + function polarToCartesianX(centerX, centerY, radius, angleInDegrees) { + return centerX + radius * Math.cos(root.toRadians(angleInDegrees)) + } + + function polarToCartesianY(centerX, centerY, radius, angleInDegrees) { + return centerY + radius * Math.sin(root.toRadians(angleInDegrees)) + } + + function sortedBegin() { + return Math.min(root.begin, root.end) + } + + function sortedEnd() { + return Math.min(Math.max(root.begin, root.end), root.sortedBegin() + 359.9) + } + + function isArcFull() { + return root.alpha > 359.5 + } + + onAlphaChanged: { + if (root.__wasFull !== root.isArcFull()) + root.constructArcItem() + + root.__wasFull = root.isArcFull() + } + onOutlineArcChanged: root.constructArcItem() + onRoundChanged: root.constructArcItem() + onRoundBeginChanged: root.constructArcItem() + onRoundEndChanged: root.constructArcItem() + + property bool __wasFull: false + + property real maxArcWidth: Math.min(path.__xRadius, path.__yRadius) + + ShapePath { + id: path + + property real __xRadius: root.width / 2 - root.strokeWidth / 2 + property real __yRadius: root.height / 2 - root.strokeWidth / 2 + + property real __arcWidth: Math.min(Math.min(path.__xRadius, path.__yRadius), root.arcWidth) + + property real __xCenter: root.width / 2 + property real __yCenter: root.height / 2 + + strokeColor: "red" + strokeWidth: 4 + capStyle: ShapePath.FlatCap + + startX: root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.sortedBegin() - 90) + startY: root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.sortedBegin() - 90) + } + + function constructArcItem() { + root.clearPathElements() + + // Outer arc + let outerArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + outerArc.x = Qt.binding(function() { + return root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.sortedEnd() - 90) + }) + outerArc.y = Qt.binding(function() { + return root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.sortedEnd() - 90) + }) + outerArc.radiusX = Qt.binding(function() { return path.__xRadius }) + outerArc.radiusY = Qt.binding(function() { return path.__yRadius }) + outerArc.useLargeArc = Qt.binding(function() { return root.alpha > 180 }) + path.pathElements.push(outerArc) + + // Straight end + if (!root.roundEnd && root.outlineArc && !root.isArcFull()) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.relativeX = Qt.binding(function() { + return -path.__arcWidth * root.myCos(root.sortedEnd() - 90) + }) + pathLine.relativeY = Qt.binding(function() { + return -path.__arcWidth * root.mySin(root.sortedEnd() - 90) + }) + path.pathElements.push(pathLine) + } + + // Round end + if (root.roundEnd && root.outlineArc && !root.isArcFull()) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.relativeX = Qt.binding(function() { + return -path.__arcWidth * root.myCos(root.sortedEnd() - 90) + }) + pathArc.relativeY = Qt.binding(function() { + return -path.__arcWidth * root.mySin(root.sortedEnd() - 90) + }) + pathArc.radiusX = Qt.binding(function() { return path.__arcWidth / 2 }) + pathArc.radiusY = Qt.binding(function() { return path.__arcWidth / 2 }) + path.pathElements.push(pathArc) + } + + // Open end + if (root.outlineArc && root.isArcFull()) { + let pathMove = Qt.createQmlObject('import QtQuick 2.15; PathMove {}', path) + pathMove.relativeX = Qt.binding(function() { + return -path.__arcWidth * root.myCos(root.sortedEnd() - 90) + }) + pathMove.relativeY = Qt.binding(function() { + return -path.__arcWidth * root.mySin(root.sortedEnd() - 90) + }) + path.pathElements.push(pathMove) + } + + // Inner arc + if (root.outlineArc) { + let innerArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + innerArc.x = Qt.binding(function() { + return path.startX - path.__arcWidth * root.myCos(root.sortedBegin() - 90) + }) + innerArc.y = Qt.binding(function() { + return path.startY - path.__arcWidth * root.mySin(root.sortedBegin() - 90) + }) + innerArc.radiusX = Qt.binding(function() { return path.__xRadius - path.__arcWidth }) + innerArc.radiusY = Qt.binding(function() { return path.__yRadius - path.__arcWidth }) + innerArc.useLargeArc = Qt.binding(function() { return root.alpha > 180 }) + innerArc.direction = PathArc.Counterclockwise + path.pathElements.push(innerArc) + } + + // Straight begin + if (!root.roundBegin && root.outlineArc && !root.isArcFull()) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.x = Qt.binding(function() { return path.startX }) + pathLine.y = Qt.binding(function() { return path.startY }) + path.pathElements.push(pathLine) + } + + // Round begin + if (root.roundBegin && root.outlineArc && !root.isArcFull()) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.x = Qt.binding(function() { return path.startX }) + pathArc.y = Qt.binding(function() { return path.startY }) + pathArc.radiusX = Qt.binding(function() { return path.__arcWidth / 2 }) + pathArc.radiusY = Qt.binding(function() { return path.__arcWidth / 2 }) + path.pathElements.push(pathArc) + } + + // Open begin + if (root.outlineArc && root.isArcFull()) { + let pathMove = Qt.createQmlObject('import QtQuick 2.15; PathMove {}', path) + pathMove.x = Qt.binding(function() { return path.startX }) + pathMove.y = Qt.binding(function() { return path.startY }) + path.pathElements.push(pathMove) + } + } + + function clearPathElements() { + for (var i = 0; i !== path.pathElements.length; ++i) + path.pathElements[i].destroy() + + path.pathElements = [] + } + + Component.onCompleted: { + root.__wasFull = root.isArcFull() + root.constructArcItem() + } +} +//! [ArcItem compatibility] diff --git a/Dependencies/Components/imports/compat/Components/CMakeLists.txt b/Dependencies/Components/imports/compat/Components/CMakeLists.txt new file mode 100644 index 0000000..0aff132 --- /dev/null +++ b/Dependencies/Components/imports/compat/Components/CMakeLists.txt @@ -0,0 +1,14 @@ +qt_add_library(QuickUltraLiteStudioComponents STATIC) +qt6_add_qml_module(QuickUltraLiteStudioComponents + URI "QtQuickUltralite.Studio.Components" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + QML_FILES + ArcItem.qml +) + +target_link_libraries(QuickUltraLiteStudioComponents PRIVATE Qt6::Gui) + +register_plugin(QuickUltraLiteStudioComponents) diff --git a/Dependencies/Components/imports/compat/Components/plugins.qmltypes b/Dependencies/Components/imports/compat/Components/plugins.qmltypes new file mode 100644 index 0000000..6a6c815 --- /dev/null +++ b/Dependencies/Components/imports/compat/Components/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.12" + ] +} diff --git a/Dependencies/Components/imports/compat/Components/qmldir b/Dependencies/Components/imports/compat/Components/qmldir new file mode 100644 index 0000000..6ecd448 --- /dev/null +++ b/Dependencies/Components/imports/compat/Components/qmldir @@ -0,0 +1,10 @@ +module QtQuickUltralite.Studio.Components +designersupported +linktarget studioqtquickultralitecomponentsplugin +optional plugin studioqtquickultralitecomponentsplugin +classname QtQuickUltralite_Studio_ComponentsPlugin +typeinfo studioqtquickultralitecomponents.qmltypes +prefer :/QtQuickUltralite/Studio/Components/ +ArcItem 1.0 ArcItem.qml +ArcItem 2.0 ArcItem.qml +ArcItem 6.0 ArcItem.qml diff --git a/Dependencies/Components/imports/compat/Components/studiocompatibilityqulcomponents.cpp b/Dependencies/Components/imports/compat/Components/studiocompatibilityqulcomponents.cpp new file mode 100644 index 0000000..53fbd7e --- /dev/null +++ b/Dependencies/Components/imports/compat/Components/studiocompatibilityqulcomponents.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 +#include +#include + +QT_BEGIN_NAMESPACE + +class StudioCompatibilityQULComponents: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + StudioCompatibilityQULComponents(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +StudioCompatibilityQULComponents::StudioCompatibilityQULComponents(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void StudioCompatibilityQULComponents::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "studiocompatibilityqulcomponents.moc" diff --git a/Dependencies/Components/imports/compat/Extras/AnimatedSpriteDirectory.qml b/Dependencies/Components/imports/compat/Extras/AnimatedSpriteDirectory.qml new file mode 100644 index 0000000..900d0b6 --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/AnimatedSpriteDirectory.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** 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 +//! [AnimatedSpriteDirectory compatibility] +// Draws a sprite animation stored in a directory. +Item { + property int currentFrame: 0 + 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() {} +} +//! [AnimatedSpriteDirectory compatibility] diff --git a/Dependencies/Components/imports/compat/Extras/CMakeLists.txt b/Dependencies/Components/imports/compat/Extras/CMakeLists.txt new file mode 100644 index 0000000..771b8a3 --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/CMakeLists.txt @@ -0,0 +1,23 @@ +set_source_files_properties(QulPerf.qml + PROPERTIES + QT_QML_SINGLETON_TYPE true +) + +qt_add_library(QuickUltraLiteStudioExtras STATIC) +qt6_add_qml_module(QuickUltraLiteStudioExtras + URI "QtQuickUltralite.Extras" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 2 + QML_FILES + AnimatedSpriteDirectory.qml + ColorizedImage.qml + ItemBuffer.qml + StaticText.qml + QulPerf.qml +) + +target_link_libraries(QuickUltraLiteStudioExtras PRIVATE Qt6::Gui) + +register_plugin(QuickUltraLiteStudioExtras) diff --git a/Dependencies/Components/imports/compat/Extras/ColorizedImage.qml b/Dependencies/Components/imports/compat/Extras/ColorizedImage.qml new file mode 100644 index 0000000..27235dd --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/ColorizedImage.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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.12 +import Qt5Compat.GraphicalEffects +//! [ColorizedImage compatibility] +// Displays a colorized image. +Item { + id: colorizedRoot + implicitHeight: img.implicitHeight + implicitWidth: img.implicitWidth + + property alias color: colorize.color + property alias source: img.source + property alias fillMode: img.fillMode + property alias horizontalAlignment: img.horizontalAlignment + property alias verticalAlignment: img.verticalAlignment + + Image { + id: img + anchors.fill: parent + visible: false + } + + ColorOverlay { + id: colorize + anchors.fill: img + color: "transparent" + source: img + } +} +//! [ColorizedImage compatibility] diff --git a/Dependencies/Components/imports/compat/Extras/ItemBuffer.qml b/Dependencies/Components/imports/compat/Extras/ItemBuffer.qml new file mode 100644 index 0000000..92e40ae --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/ItemBuffer.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** 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.12 +//! [ItemBuffer compatibility] +Item { + enum ExtraFlag { RedrawItemBufferFlag = 1 } +// property Transform transform; //in regular QML this property is already provided by QtQuick.Item + property bool useAlphaChannel; +} +//! [ItemBuffer compatibility] diff --git a/Dependencies/Components/imports/compat/Extras/QulPerf.qml b/Dependencies/Components/imports/compat/Extras/QulPerf.qml new file mode 100644 index 0000000..97708ab --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/QulPerf.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +pragma Singleton + +import QtQuick 2.12 +//! [QulPerf compatibility] +// Holds information about application performance. +// This data is only available if Qt Quick Ultralite is compiled with QUL_ENABLE_PERFORMANCE_LOGGING. +// Properties will be updated every two seconds. +// All properties are read-only. +QtObject { + readonly property bool enabled: false + readonly property real fps: 0 + readonly property real imageBlend: 0 + readonly property real imageTransform: 0 + readonly property int maxDirtyNodes: 0 + readonly property real rectBlend: 0 + readonly property real rectFill: 0 + readonly property real rectRounded: 0 + readonly property real repaint: 0 + readonly property real textBlend: 0 + readonly property real textLayout: 0 +} +//! [QulPerf compatibility] diff --git a/Dependencies/Components/imports/compat/Extras/StaticText.qml b/Dependencies/Components/imports/compat/Extras/StaticText.qml new file mode 100644 index 0000000..2a05b82 --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/StaticText.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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 +//! [StaticText compatibility] +// Enables optimized drawing of text. +Text { +} +//! [StaticText compatibility] diff --git a/Dependencies/Components/imports/compat/Extras/plugins.qmltypes b/Dependencies/Components/imports/compat/Extras/plugins.qmltypes new file mode 100644 index 0000000..6a6c815 --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/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.12" + ] +} diff --git a/Dependencies/Components/imports/compat/Extras/qmldir b/Dependencies/Components/imports/compat/Extras/qmldir new file mode 100644 index 0000000..cb538c9 --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/qmldir @@ -0,0 +1,22 @@ +module QtQuickUltralite.Extras +designersupported +linktarget studioqtquickultraliteextrasplugin +optional plugin studioqtquickultraliteextrasplugin +classname QtQuickUltralite_ExtrasPlugin +typeinfo studioqtquickultraliteextras.qmltypes +prefer :/QtQuickUltralite/Extras/ +AnimatedSpriteDirectory 1.0 AnimatedSpriteDirectory.qml +AnimatedSpriteDirectory 2.0 AnimatedSpriteDirectory.qml +AnimatedSpriteDirectory 6.0 AnimatedSpriteDirectory.qml +ColorizedImage 1.0 ColorizedImage.qml +ColorizedImage 2.0 ColorizedImage.qml +ColorizedImage 6.0 ColorizedImage.qml +ItemBuffer 1.0 ItemBuffer.qml +ItemBuffer 2.0 ItemBuffer.qml +ItemBuffer 6.0 ItemBuffer.qml +StaticText 1.0 StaticText.qml +StaticText 2.0 StaticText.qml +StaticText 6.0 StaticText.qml +singleton QulPerf 1.0 QulPerf.qml +singleton QulPerf 2.0 QulPerf.qml +singleton QulPerf 6.0 QulPerf.qml diff --git a/Dependencies/Components/imports/compat/Extras/studiocompatibilityqulextras.cpp b/Dependencies/Components/imports/compat/Extras/studiocompatibilityqulextras.cpp new file mode 100644 index 0000000..8b2804d --- /dev/null +++ b/Dependencies/Components/imports/compat/Extras/studiocompatibilityqulextras.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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 +#include +#include + +QT_BEGIN_NAMESPACE + +class StudioCompatibilityQULExtras: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + StudioCompatibilityQULExtras(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +StudioCompatibilityQULExtras::StudioCompatibilityQULExtras(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void StudioCompatibilityQULExtras::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "studiocompatibilityqulextras.moc" diff --git a/Dependencies/Components/imports/compat/Layers/+DesignMode/Screen.qml b/Dependencies/Components/imports/compat/Layers/+DesignMode/Screen.qml new file mode 100644 index 0000000..d926072 --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/+DesignMode/Screen.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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 + +//! [Screen compatibility] +Rectangle { + id: wnd + property string outputDevice: "device" + property alias backgroundColor: wnd.color + + property real defaultApplicationWidth: 0 + property real defaultApplicationHeight: 0 + + visible: true +} +//! [Screen compatibility] diff --git a/Dependencies/Components/imports/compat/Layers/ApplicationScreens.qml b/Dependencies/Components/imports/compat/Layers/ApplicationScreens.qml new file mode 100644 index 0000000..e4adced --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/ApplicationScreens.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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 + +//! [ApplicationScreens compatibility] +Item { +} +//! [ApplicationScreens compatibility] diff --git a/Dependencies/Components/imports/compat/Layers/CMakeLists.txt b/Dependencies/Components/imports/compat/Layers/CMakeLists.txt new file mode 100644 index 0000000..3c09530 --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/CMakeLists.txt @@ -0,0 +1,19 @@ +qt_add_library(QuickUltraLiteStudioLayers STATIC) +qt6_add_qml_module(QuickUltraLiteStudioLayers + URI "QtQuickUltralite.Layers" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 2 + QML_FILES + ApplicationScreens.qml + ImageLayer.qml + ItemLayer.qml + Screen.qml + SpriteLayer.qml + +DesignMode/Screen.qml +) + +target_link_libraries(QuickUltraLiteStudioLayers PRIVATE Qt6::Gui) + +register_plugin(QuickUltraLiteStudioLayers) diff --git a/Dependencies/Components/imports/compat/Layers/ImageLayer.qml b/Dependencies/Components/imports/compat/Layers/ImageLayer.qml new file mode 100644 index 0000000..f4c0647 --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/ImageLayer.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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 + +//! [ImageLayer compatibility] +Item { + enum RenderingHints { + OptimizeForSpeed, + OptimizeForSize, + StaticContents + } + + property int platformId: 0 + property int renderingHints: ImageLayer.RenderingHints.OptimizeForSpeed + property alias source: internalImage.source + + Image { + id: internalImage + anchors.fill: parent + } +} +//! [ImageLayer compatibility] diff --git a/Dependencies/Components/imports/compat/Layers/ItemLayer.qml b/Dependencies/Components/imports/compat/Layers/ItemLayer.qml new file mode 100644 index 0000000..231c3d3 --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/ItemLayer.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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 + +//! [ItemLayer compatibility] +Item { + enum ColorDepth { + Bpp16, Bpp16Alpha, Bpp24, Bpp32, Bpp32Alpha + } + + enum RenderingHints { + OptimizeForSpeed, + OptimizeForSize, + StaticContents + } + + property int depth: ColorDepth.Bpp32 + property int refreshInterval: 1 + property int platformId: 0 + property int renderingHints: RenderingHints.OptimizeForSpeed +} +//! [ItemLayer compatibility] diff --git a/Dependencies/Components/imports/compat/Layers/Screen.qml b/Dependencies/Components/imports/compat/Layers/Screen.qml new file mode 100644 index 0000000..3cbc021 --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/Screen.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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.Window 2.2 + +//! [Screen compatibility] +Item { + id: root + + property string outputDevice: "device" + property alias backgroundColor: wnd.color + + property real defaultApplicationWidth: 0 + property real defaultApplicationHeight: 0 + + onChildrenChanged: { + if (wnd.isAvailable) + wnd.reparenting() + } + + Window { + id: wnd + visible: true + + width: root.width + height: root.height + + property bool reparentingBlock: false + property bool isAvailable: false + + Component.onCompleted: { + reparenting() + isAvailable = true + } + + function reparenting() { + if (reparentingBlock) + return; + + reparentingBlock = true; + + var result = []; + var rootChildren = root.children; + for (var i = 0; i < rootChildren.length; i++) { + if (rootChildren[i] !== wnd) { + result.push(rootChildren[i]); + } + } + wnd.data = result; + + reparentingBlock = false; + } + } +} +//! [Screen compatibility] diff --git a/Dependencies/Components/imports/compat/Layers/SpriteLayer.qml b/Dependencies/Components/imports/compat/Layers/SpriteLayer.qml new file mode 100644 index 0000000..29f3db9 --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/SpriteLayer.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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 + +//! [SpriteLayer compatibility] +Item { + enum ColorDepth { + Bpp8, Bpp16, Bpp16Alpha, Bpp24, Bpp32, Bpp32Alpha + } + + property int depth: ColorDepth.Bpp32 + property int platformId: 0 +} +//! [SpriteLayer compatibility] diff --git a/Dependencies/Components/imports/compat/Layers/plugins.qmltypes b/Dependencies/Components/imports/compat/Layers/plugins.qmltypes new file mode 100644 index 0000000..05873fb --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/plugins.qmltypes @@ -0,0 +1,10 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. + +Module { + dependencies: [ + "QtQuick 2.15" + ] +} diff --git a/Dependencies/Components/imports/compat/Layers/qmldir b/Dependencies/Components/imports/compat/Layers/qmldir new file mode 100644 index 0000000..4257ae6 --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/qmldir @@ -0,0 +1,22 @@ +module QtQuickUltralite.Layers +designersupported +linktarget studioqtquickultralitelayersplugin +optional plugin studioqtquickultralitelayersplugin +classname QtQuickUltralite_LayersPlugin +typeinfo studioqtquickultralitelayers.qmltypes +prefer :/QtQuickUltralite/Layers/ +ApplicationScreens 1.0 ApplicationScreens.qml +ApplicationScreens 2.0 ApplicationScreens.qml +ApplicationScreens 6.0 ApplicationScreens.qml +ImageLayer 1.0 ImageLayer.qml +ImageLayer 2.0 ImageLayer.qml +ImageLayer 6.0 ImageLayer.qml +ItemLayer 1.0 ItemLayer.qml +ItemLayer 2.0 ItemLayer.qml +ItemLayer 6.0 ItemLayer.qml +Screen 1.0 Screen.qml +Screen 2.0 Screen.qml +Screen 6.0 Screen.qml +SpriteLayer 1.0 SpriteLayer.qml +SpriteLayer 2.0 SpriteLayer.qml +SpriteLayer 6.0 SpriteLayer.qml diff --git a/Dependencies/Components/imports/compat/Layers/studiocompatibilityqullayers.cpp b/Dependencies/Components/imports/compat/Layers/studiocompatibilityqullayers.cpp new file mode 100644 index 0000000..762371a --- /dev/null +++ b/Dependencies/Components/imports/compat/Layers/studiocompatibilityqullayers.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2021 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 + +QT_BEGIN_NAMESPACE + +class StudioCompatibilityQULLayers: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + StudioCompatibilityQULLayers(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +StudioCompatibilityQULLayers::StudioCompatibilityQULLayers(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void StudioCompatibilityQULLayers::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "studiocompatibilityqullayers.moc" diff --git a/Dependencies/Components/imports/compat/Profiling/CMakeLists.txt b/Dependencies/Components/imports/compat/Profiling/CMakeLists.txt new file mode 100644 index 0000000..fd7629b --- /dev/null +++ b/Dependencies/Components/imports/compat/Profiling/CMakeLists.txt @@ -0,0 +1,14 @@ +qt_add_library(QuickUltraLiteStudioProfiling STATIC) +qt6_add_qml_module(QuickUltraLiteStudioProfiling + URI "QtQuickUltralite.Profiling" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 2 + QML_FILES + QulPerfOverlay.qml +) + +target_link_libraries(QuickUltraLiteStudioProfiling PRIVATE Qt6::Gui) + +register_plugin(QuickUltraLiteStudioProfiling) diff --git a/Dependencies/Components/imports/compat/Profiling/QulPerfOverlay.qml b/Dependencies/Components/imports/compat/Profiling/QulPerfOverlay.qml new file mode 100644 index 0000000..84907a6 --- /dev/null +++ b/Dependencies/Components/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/Dependencies/Components/imports/compat/Profiling/plugins.qmltypes b/Dependencies/Components/imports/compat/Profiling/plugins.qmltypes new file mode 100644 index 0000000..c058e79 --- /dev/null +++ b/Dependencies/Components/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/Dependencies/Components/imports/compat/Profiling/qmldir b/Dependencies/Components/imports/compat/Profiling/qmldir new file mode 100644 index 0000000..ff33cc0 --- /dev/null +++ b/Dependencies/Components/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/Dependencies/Components/imports/compat/Profiling/studiocompatibilityqulprofiling.cpp b/Dependencies/Components/imports/compat/Profiling/studiocompatibilityqulprofiling.cpp new file mode 100644 index 0000000..ba8396f --- /dev/null +++ b/Dependencies/Components/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 +#include +#include + +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" diff --git a/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/ActivityView.qml b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/ActivityView.qml new file mode 100644 index 0000000..d02fd13 --- /dev/null +++ b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/ActivityView.qml @@ -0,0 +1,212 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Android Automotive 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.Controls + +Item { + id: root + + width: 480 + height: 640 + + property alias radius: rect.radius + property string packageName: "some.package.name" + property string className + readonly property alias status: internal.status + property alias placeholder: placeholderItem.children + property bool usePlaceholder: false + + onUsePlaceholderChanged: { + if (placeholder) { + placeholder.visible = usePlaceholder + avMock.visible = !usePlaceholder + } else { + avMock.visible = true + } + } + + onPlaceholderChanged: { + if (!placeholder) + avMock.visible = true + } + + enum Status { + NotInitialized, + Ready, + Starting, + Started + } + + QtObject { + id: internal + + property var status: ActivityView.NotInitialized + property real fontPointSize: 20 + + function enumToString(val) { + switch (val) { + case ActivityView.NotInitialized: return "NotInitialized" + case ActivityView.Ready: return "Ready" + case ActivityView.Starting: return "Starting" + case ActivityView.Started: return "Started" + } + return "Unknown" + } + } + + component StatusButton: Rectangle { + id: button + + color: highlighted ? "lightGray" : "gray" + radius: 5 + clip: true + width: btnText.width + height: btnText.height + + property int statusId: 0 + property bool highlighted: false + signal clicked(int value) + + Label { + id: btnText + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pointSize: internal.fontPointSize + + text: " " + internal.enumToString(statusId) + " " + } + + MouseArea { + anchors.fill: parent + onClicked: button.clicked(statusId) + } + } + + Item { + id: placeholderItem + anchors.fill: parent + } + + Item { + id: avMock + + anchors.fill: parent + + Rectangle { + id: rect + + anchors.fill: parent + color: "#AAAAAA" + radius: 0 + border.color: "#888888" + border.width: 2 + clip: true + + Image { + id: icon + + anchors.centerIn: parent + anchors.verticalCenterOffset: - statusArea.height / 2 + + source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABlBMV + EUAAAA+Pj4LNneDAAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEwAACxMBAJqcGAAAASNJREFUSMft1 + TFuwzAMBVApAqIlgNZu6hF6A/UovYm99VjV1mu46AUyelDNilJgftkx0gbtZg4C/BCFNETRSnE88 + 3JQEi+8HAEel/DEywngYV624DTv24KjMrHmvsRBEfUIxhGdI4B+I/rqESgHgmHALZbhDOAZRoDAM + AF0DARQniGNrhDbrERDmxXBpZwmBSnEj7mQ0Y9LSFLXBkipXf3TaVE51E5b0Lev8hOI7cveBcP9s + Aw4U1c2JNkSYjkDO0PHv3b0OkPpAC/wcYF3gXQNgsDnDjv8AdxuuqZP07VOdtDrZdrZCZqfr5BOA + j7ikJIr9i9w+2avJsxqBq3nWKjPE871wTZzfYffQ2zBUTTNx3MFlnrdjGiTz6j5AOvcsF09yG/q3 + /z/4fD/YgAAAABJRU5ErkJggg==" + } + + Label { + id: packageLabel + + anchors.top: icon.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 5 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pointSize: internal.fontPointSize + text: root.packageName + } + } + + Rectangle { + id: statusArea + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: statusFlow.top + anchors.bottom: statusFlow.bottom + anchors.topMargin: -5 + anchors.bottomMargin: -5 + color: "black" + opacity: 0.5 + radius: rect.radius + } + + Label { + id: statusLabel + + anchors.top: statusFlow.top + anchors.left: parent.left + + text: " " + "status:" + " " + color: "lightGray" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pointSize: internal.fontPointSize + } + + Flow { + id: statusFlow + + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 5 + anchors.leftMargin: statusLabel.width + spacing: 5 + + Repeater { + model: [ActivityView.NotInitialized, ActivityView.Ready, ActivityView.Starting, + ActivityView.Started] + + delegate: StatusButton { + statusId: modelData + onClicked: (value) => internal.status = value + highlighted: modelData === internal.status + } + } + } + } +} diff --git a/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/CMakeLists.txt b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/CMakeLists.txt new file mode 100644 index 0000000..2a6ae31 --- /dev/null +++ b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/CMakeLists.txt @@ -0,0 +1,14 @@ +qt_add_library(AndroidAutomotiveActivityView STATIC) +qt6_add_qml_module(AndroidAutomotiveActivityView + URI "QtAndroidAutomotive.ActivityView" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + QML_FILES + ActivityView.qml +) + +target_link_libraries(AndroidAutomotiveActivityView PRIVATE Qt6::Gui) + +register_plugin(AndroidAutomotiveActivityView) diff --git a/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/plugins.qmltypes b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/plugins.qmltypes new file mode 100644 index 0000000..6a6c815 --- /dev/null +++ b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/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.12" + ] +} diff --git a/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/qmldir b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/qmldir new file mode 100644 index 0000000..02c4a9d --- /dev/null +++ b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/qmldir @@ -0,0 +1,9 @@ +module QtAndroidAutomotive.ActivityView +linktarget Qt6::AndroidAutomotiveActivityViewplugin +optional plugin androidautomotiveactivityviewplugin +classname QtAndroidAutomotive_ActivityViewPlugin +designersupported +typeinfo AndroidAutomotiveActivityView.qmltypes +prefer :/qt-project.org/imports/QtAndroidAutomotive/ActivityView/ +ActivityView 6.0 ActivityView.qml +ActivityView 1.0 ActivityView.qml diff --git a/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/studiocompatibilityqaaactivityview.cpp b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/studiocompatibilityqaaactivityview.cpp new file mode 100644 index 0000000..233b397 --- /dev/null +++ b/Dependencies/Components/imports/compat/QtAndroidAutomotive/ActivityView/studiocompatibilityqaaactivityview.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Android Automotive 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 + +QT_BEGIN_NAMESPACE + +class StudioCompatibilityQtAaActivityView: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + StudioCompatibilityQtAaActivityView(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +StudioCompatibilityQtAaActivityView::StudioCompatibilityQtAaActivityView(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void StudioCompatibilityQtAaActivityView::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "studiocompatibilityqaaactivityview.moc" diff --git a/Dependencies/Components/imports/compat/QtAndroidAutomotive/CMakeLists.txt b/Dependencies/Components/imports/compat/QtAndroidAutomotive/CMakeLists.txt new file mode 100644 index 0000000..98e8433 --- /dev/null +++ b/Dependencies/Components/imports/compat/QtAndroidAutomotive/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(ActivityView) diff --git a/Dependencies/Components/imports/components/ArcArrow.qml b/Dependencies/Components/imports/components/ArcArrow.qml new file mode 100644 index 0000000..dbf41d7 --- /dev/null +++ b/Dependencies/Components/imports/components/ArcArrow.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +GroupItem { + id: root + + property int thickness: 45 + + property int arrowSize: 80 + + property int radius: 5 + property color color: "#b6b3b3" + + property alias begin: arc.begin + property alias end: arc.end + + property bool flip: false + + transform: Scale { + xScale: root.flip ? -1 : 1 + origin.x: root.width / 2 + origin.y: root.height / 2 + } + + ArcItem { + id: arc + x: 0 + y: 16 + width: 300 + height: 300 + capStyle: root.radius > 2 ? 32 : 0 + end: 180 + strokeWidth: root.thickness + strokeColor: root.color + fillColor: "#00000000" + + Item { + anchors.fill: parent + rotation: arc.end + TriangleItem { + id: triangle3 + x: root.width / 2 + + y: -root.thickness / 2 + width: root.arrowSize + height: root.arrowSize + strokeWidth: -1 + rotation: 90 + radius: root.radius + + fillColor: root.color + } + } + } +} diff --git a/Dependencies/Components/imports/components/ArcItem.qml b/Dependencies/Components/imports/components/ArcItem.qml new file mode 100644 index 0000000..d7cbc28 --- /dev/null +++ b/Dependencies/Components/imports/components/ArcItem.qml @@ -0,0 +1,446 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype ArcItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + + \brief An arc that ends at the specified position and uses the specified radius. + + An arc is specified by setting values in degrees for the \l begin and \l end properties. The arc + can be just a line or a filled outline. The \l strokeColor, \l strokeWidth, and \l strokeStyle + properties specify the appearance of the line or outline. The \l dashPattern and \l dashOffset + properties specify the appearance of dashed lines. + + The area between the arc's start and end points or the area inside the outline are painted using + either a solid fill color, specified using the \l fillColor property, or a gradient, defined + using one of the \l ShapeGradient subtypes and set using the \l gradient property. If both a + color and a gradient are specified, the gradient is used. + + To create an arc with an outline, set the \l outlineArc property to \c true. The \l arcWidth + property specifies the width of the arc outline, including the stroke. The width of the outline + between the start and end points is calculated automatically. + + The \l round, \l roundBegin, and \l roundEnd properties specify whether the end points of the + arc outline have rounded caps. For an arc that does not have an outline, the \l capStyle + property specifies whether the line ends are square or rounded. + + Because an arc has curves, it may be appropriate to set the \c antialiasing property that is + inherited from \l Item to improve its appearance. + + \section2 Example Usage + + You can use the Arc component in \QDS to create different kinds of arcs. + + \image studio-arc.webp + + The QML code looks as follows: + + \code + + ArcItem { + id: arc + x: 667 + y: 490 + fillColor: "#00ffffff" + capStyle: 32 + end: 180 + strokeWidth: 6 + strokeColor: "#000000" + } + + ArcItem { + id: arcOutline + x: 910 + y: 490 + strokeColor: "gray" + arcWidth: 13 + end: 180 + fillColor: "light gray" + antialiasing: true + round: true + outlineArc: true + } + + ArcItem { + id: circle + x: 811 + y: 490 + fillColor: "#02ffffff" + end: 360 + strokeWidth: 5 + strokeColor: "#000000" + } + + ArcItem { + id: circleOutline + x: 1046 + y: 490 + antialiasing: false + outlineArc: true + round: true + strokeColor: "gray" + fillColor: "light gray" + strokeWidth: 1 + end: 360 + } + \endcode +*/ + +Shape { + id: root + + width: 100 + height: 100 + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {arc} +*/ + property alias gradient: path.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {arc} + + The total width of an arc that has an outline (that is, the outline and the fill) is specified + by \l arcWidth. +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {arc} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {arc} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.BevelJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.FlatCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {arc} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {arc} + + If the arc is just a line, the area between its \l begin and \l end points is filled. If the arc + has an outline, the area within the outline is filled. +*/ + property alias fillColor: path.fillColor + +/*! + The starting point of the dash pattern for the arc or arc outline. + + The offset is measured in terms of the units used to specify the dash pattern. For example, a + pattern where each stroke is four units long, followed by a gap of two units, will begin with + the stroke when drawn as a line. However, if the dash offset is set to 4.0, any line drawn will + begin with the gap. Values of the offset up to 4.0 will cause part of the stroke to be drawn + first, and values of the offset between 4.0 and 6.0 will cause the line to begin with part of + the gap. + + The default value is 0. + + \sa QPen::setDashOffset() +*/ + property alias dashOffset: path.dashOffset + +/*! + The position in degrees where the arc begins. + + The default value is 0. + + To create a circle, set the value of \c begin to 0 and the value of the \c end to 360. +*/ + property real begin: 0 + +/*! + The position in degrees where the arc ends. + + The default value is 90. + + To create a circle, set the value of \c end to 360 and the value of the \c begin to 0. +*/ + property real end: 90 + +/*! + The total width of an arc that has an outline, including the outline and fill. + + The default value is 10. + + \sa strokeWidth +*/ + property real arcWidth: 10 + +/*! + The area between the \l begin and \l end points of the arc. +*/ + property real alpha: root.clamp(root.sortedEnd() - root.sortedBegin(), 0, 359.9) + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== undefined + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + +/*! + Whether the arc has an outline. + + \sa arcWidth, round, roundBegin, roundEnd +*/ + property bool outlineArc: false + +/*! + Whether the arc outline end points have round caps. + + The \l roundBegin and \l roundEnd properties can be used to specify the caps separately for the + end points. +*/ + property bool round: false + +/*! + Whether the arc outline ends with a round cap. + + \sa Qt::PenCapStyle, round, roundBegin +*/ + property bool roundEnd: root.round + +/*! + Whether the arc outline begins with a round cap. + + \sa Qt::PenCapStyle, round, roundEnd +*/ + property bool roundBegin: root.round + + function clamp(num, min, max) { + return Math.max(min, Math.min(num, max)) + } + + function toRadians(degrees) { + return degrees * (Math.PI / 180.0) + } + + function myCos(angleInDegrees) { + return Math.cos(root.toRadians(angleInDegrees)) + } + + function mySin(angleInDegrees) { + return Math.sin(root.toRadians(angleInDegrees)) + } + + function polarToCartesianX(centerX, centerY, radius, angleInDegrees) { + return centerX + radius * Math.cos(root.toRadians(angleInDegrees)) + } + + function polarToCartesianY(centerX, centerY, radius, angleInDegrees) { + return centerY + radius * Math.sin(root.toRadians(angleInDegrees)) + } + + function sortedBegin() { + return Math.min(root.begin, root.end) + } + + function sortedEnd() { + return Math.min(Math.max(root.begin, root.end), root.sortedBegin() + 359.9) + } + + function isArcFull() { + return root.alpha > 359.5 + } + + onAlphaChanged: { + if (root.__wasFull !== root.isArcFull()) + root.constructArcItem() + + root.__wasFull = root.isArcFull() + } + onOutlineArcChanged: root.constructArcItem() + onRoundChanged: root.constructArcItem() + onRoundBeginChanged: root.constructArcItem() + onRoundEndChanged: root.constructArcItem() + + property bool __wasFull: false + + property real maxArcWidth: Math.min(path.__xRadius, path.__yRadius) + + ShapePath { + id: path + + property real __xRadius: root.width / 2 - root.strokeWidth / 2 + property real __yRadius: root.height / 2 - root.strokeWidth / 2 + + property real __arcWidth: Math.min(Math.min(path.__xRadius, path.__yRadius), root.arcWidth) + + property real __xCenter: root.width / 2 + property real __yCenter: root.height / 2 + + strokeColor: "red" + strokeWidth: 4 + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + startX: root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.sortedBegin() - 90) + startY: root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.sortedBegin() - 90) + } + + function constructArcItem() { + root.clearPathElements() + + // Outer arc + let outerArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + outerArc.x = Qt.binding(function() { + return root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.sortedEnd() - 90) + }) + outerArc.y = Qt.binding(function() { + return root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.sortedEnd() - 90) + }) + outerArc.radiusX = Qt.binding(function() { return path.__xRadius }) + outerArc.radiusY = Qt.binding(function() { return path.__yRadius }) + outerArc.useLargeArc = Qt.binding(function() { return root.alpha > 180 }) + path.pathElements.push(outerArc) + + // Straight end + if (!root.roundEnd && root.outlineArc && !root.isArcFull()) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.relativeX = Qt.binding(function() { + return -path.__arcWidth * root.myCos(root.sortedEnd() - 90) + }) + pathLine.relativeY = Qt.binding(function() { + return -path.__arcWidth * root.mySin(root.sortedEnd() - 90) + }) + path.pathElements.push(pathLine) + } + + // Round end + if (root.roundEnd && root.outlineArc && !root.isArcFull()) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.relativeX = Qt.binding(function() { + return -path.__arcWidth * root.myCos(root.sortedEnd() - 90) + }) + pathArc.relativeY = Qt.binding(function() { + return -path.__arcWidth * root.mySin(root.sortedEnd() - 90) + }) + pathArc.radiusX = Qt.binding(function() { return path.__arcWidth / 2 }) + pathArc.radiusY = Qt.binding(function() { return path.__arcWidth / 2 }) + path.pathElements.push(pathArc) + } + + // Open end + if (root.outlineArc && root.isArcFull()) { + let pathMove = Qt.createQmlObject('import QtQuick 2.15; PathMove {}', path) + pathMove.relativeX = Qt.binding(function() { + return -path.__arcWidth * root.myCos(root.sortedEnd() - 90) + }) + pathMove.relativeY = Qt.binding(function() { + return -path.__arcWidth * root.mySin(root.sortedEnd() - 90) + }) + path.pathElements.push(pathMove) + } + + // Inner arc + if (root.outlineArc) { + let innerArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + innerArc.x = Qt.binding(function() { + return path.startX - path.__arcWidth * root.myCos(root.sortedBegin() - 90) + }) + innerArc.y = Qt.binding(function() { + return path.startY - path.__arcWidth * root.mySin(root.sortedBegin() - 90) + }) + innerArc.radiusX = Qt.binding(function() { return path.__xRadius - path.__arcWidth }) + innerArc.radiusY = Qt.binding(function() { return path.__yRadius - path.__arcWidth }) + innerArc.useLargeArc = Qt.binding(function() { return root.alpha > 180 }) + innerArc.direction = PathArc.Counterclockwise + path.pathElements.push(innerArc) + } + + // Straight begin + if (!root.roundBegin && root.outlineArc && !root.isArcFull()) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.x = Qt.binding(function() { return path.startX }) + pathLine.y = Qt.binding(function() { return path.startY }) + path.pathElements.push(pathLine) + } + + // Round begin + if (root.roundBegin && root.outlineArc && !root.isArcFull()) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.x = Qt.binding(function() { return path.startX }) + pathArc.y = Qt.binding(function() { return path.startY }) + pathArc.radiusX = Qt.binding(function() { return path.__arcWidth / 2 }) + pathArc.radiusY = Qt.binding(function() { return path.__arcWidth / 2 }) + path.pathElements.push(pathArc) + } + + // Open begin + if (root.outlineArc && root.isArcFull()) { + let pathMove = Qt.createQmlObject('import QtQuick 2.15; PathMove {}', path) + pathMove.x = Qt.binding(function() { return path.startX }) + pathMove.y = Qt.binding(function() { return path.startY }) + path.pathElements.push(pathMove) + } + } + + function clearPathElements() { + for (var i = 0; i !== path.pathElements.length; ++i) + path.pathElements[i].destroy() + + path.pathElements = [] + } + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + + root.__wasFull = root.isArcFull() + root.constructArcItem() + } +} diff --git a/Dependencies/Components/imports/components/BorderItem.qml b/Dependencies/Components/imports/components/BorderItem.qml new file mode 100644 index 0000000..9a364c9 --- /dev/null +++ b/Dependencies/Components/imports/components/BorderItem.qml @@ -0,0 +1,544 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype BorderItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A border drawn in four segments: left, top, right, and bottom. + + The Border type is used to create borders out of four segments: left, top, right, and bottom. + The \l drawLeft, \l drawTop, \l drawRight, and \l drawBottom properties can be used to determine + whether each of the segments is visible. + + The \l borderMode property determines whether the border is drawn along the inside or outside + edge of the item, or on top of the edge. + + The \l radius property specifies whether the border corners are rounded. The radius can also be + specified separately for each corner. Because this introduces curved edges to the corners, it + may be appropriate to set the \c antialiasing property that is inherited from \l Item to improve + the appearance of the border. + + The \l joinStyle property specifies how to connect two border line segments. + + The \l strokeColor, \l strokeWidth, and \l strokeStyle properties specify the appearance of the + border line. The \l dashPattern and \l dashOffset properties specify the appearance of dashed + lines. + + The \l capStyle property specifies whether line ends are square or rounded. + + \section2 Example Usage + + You can use the Border component in \QDS to create different kinds of borders. + + \image studio-border.webp + + The QML code looks as follows: + + \code + BorderItem { + id: openLeft + width: 99 + height: 99 + antialiasing: true + drawLeft: false + strokeColor: "gray" + } + + BorderItem { + id: openTop + width: 99 + height: 99 + antialiasing: true + strokeColor: "#808080" + drawTop: false + } + + BorderItem { + id: asymmetricalCorners + width: 99 + height: 99 + antialiasing: true + bottomLeftRadius: 0 + topRightRadius: 0 + strokeColor: "#808080" + } + + BorderItem { + id: dashedBorder + width: 99 + height: 99 + antialiasing: true + strokeStyle: 4 + strokeColor: "#808080" + } + \endcode +*/ + +Shape { + id: root + width: 200 + height: 150 +/*! + \include CommonItemDescriptions.qdocinc {component-radius} {10} + + If radius is non-zero, the corners will be rounded, otherwise they will be sharp. The radius can + also be specified separately for each corner by using the \l bottomLeftRadius, + \l bottomRightRadius, \l topLeftRadius, and \l topRightRadius properties. +*/ + property int radius: 10 + +/*! + The radius of the top left border corner. + + \sa radius +*/ + property int topLeftRadius: root.radius + +/*! + The radius of the bottom left border corner. + + \sa radius +*/ + property int bottomLeftRadius: root.radius + +/*! + The radius of the top right border corner. + + \sa radius +*/ + property int topRightRadius: root.radius + +/*! + The radius of the bottom right border corner. + + \sa radius +*/ + property int bottomRightRadius: root.radius + +/*! + Whether the border corner is beveled. +*/ + property bool bevel: false + +/*! + The bevel of the top left border corner. + + \sa bevel +*/ + property bool topLeftBevel: root.bevel + +/*! + The bevel of the top right border corner. + + \sa bevel +*/ + property bool topRightBevel: root.bevel + +/*! + The bevel of the bottom right border corner. + + \sa bevel +*/ + property bool bottomRightBevel: root.bevel + +/*! + The bevel of the bottom left border corner. + + \sa bevel +*/ + property bool bottomLeftBevel: root.bevel + +/*! + The width of the border line. + The default value is 4. + A width of 1 creates a thin line. For no line, use a negative value or a transparent color. + + \note The width of the border does not affect its position relative to other items if + anchors are used. +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {border} +*/ + property alias strokeColor: path.strokeColor + +/*! + The dash pattern of the border line specified as the dashes and the gaps + between them. + + The dash pattern is specified in units of the pen's width. That is, a dash with the length 5 + and width 10 is 50 pixels long. + + Each dash is also subject to cap styles, and therefore a dash of 1 with square cap set will + extend 0.5 pixels out in each direction resulting in a total width of 2. + + The default \l capStyle is \c {ShapePath.SquareCap}, meaning that a square line end covers the + end point and extends beyond it by half the line width. + + The default value is (4, 2), meaning a dash of 4 * \l strokeWidth pixels followed by a space + of 2 * \l strokeWidth pixels. + + \sa QPen::setDashPattern() +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.MiterJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.SquareCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {border} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + The starting point of the dash pattern for the border line. + + The offset is measured in terms of the units used to specify the dash pattern. For example, a + pattern where each stroke is four units long, followed by a gap of two units, will begin with + the stroke when drawn as a line. However, if the dash offset is set to 4.0, any line drawn will + begin with the gap. Values of the offset up to 4.0 will cause part of the stroke to be drawn + first, and values of the offset between 4.0 and 6.0 will cause the line to begin with part of + the gap. + + The default value is 0. + + \sa QPen::setDashOffset() +*/ + property alias dashOffset: path.dashOffset + + //property alias fillColor: path.fillColor + +/*! + Whether the top border is visible. + + The border segment is drawn if this property is set to \c true. +*/ + property bool drawTop: true + +/*! + Whether the bottom border is visible. + + The border segment is drawn if this property is set to \c true. +*/ + property bool drawBottom: true + +/*! + Whether the right border is visible. + + The border segment is drawn if this property is set to \c true. +*/ + property bool drawRight: true + +/*! + Whether the left border is visible. + + The border segment is drawn if this property is set to \c true. +*/ + property bool drawLeft: true + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== undefined + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + +/*! + \include CommonItemDescriptions.qdocinc component-borderMode +*/ + property int borderMode: 0 + + property real borderOffset: { + if (root.borderMode === 0) + return root.strokeWidth * 0.5 + if (root.borderMode === 1) + return 0 + + return -root.strokeWidth * 0.5 + } + +/*! + \include CommonItemDescriptions.qdocinc component-adjustBorderRadius +*/ + property bool adjustBorderRadius: false + + Item { + anchors.fill: parent + anchors.margins: { + if (root.borderMode === 0) + return 0 + if (root.borderMode === 1) + return -root.strokeWidth * 0.5 + + return -root.strokeWidth + } + } + + onRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onTopLeftRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onTopRightRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onBottomLeftRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onBottomRightRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onWidthChanged: Qt.callLater(root.calculateIndependentRadii) + onHeightChanged: Qt.callLater(root.calculateIndependentRadii) + + function calculateIndependentRadii() { + let minDimension = Math.min(root.width, root.height) + let maxRadius = Math.floor(minDimension / 2) + let mixed = !(root.radius === root.topLeftRadius + && root.radius === root.topRightRadius + && root.radius === root.bottomLeftRadius + && root.radius === root.bottomRightRadius) + + // Uniform radii + if (!mixed) { + path.__topLeftRadius = Math.min(root.topLeftRadius, maxRadius) + path.__topRightRadius = Math.min(root.topRightRadius, maxRadius) + path.__bottomRightRadius = Math.min(root.bottomRightRadius, maxRadius) + path.__bottomLeftRadius = Math.min(root.bottomLeftRadius, maxRadius) + return + } + + // Mixed radii + let topLeftRadiusMin = Math.min(minDimension, root.topLeftRadius) + let topRightRadiusMin = Math.min(minDimension, root.topRightRadius) + let bottomLeftRadiusMin = Math.min(minDimension, root.bottomLeftRadius) + let bottomRightRadiusMin = Math.min(minDimension, root.bottomRightRadius) + + // Top radii + let topRadii = root.topLeftRadius + root.topRightRadius + + if (topRadii > root.width) { + let topLeftRadiusFactor = root.topLeftRadius / topRadii + let tlr = Math.round(root.width * topLeftRadiusFactor) + + topLeftRadiusMin = Math.min(topLeftRadiusMin, tlr) + topRightRadiusMin = Math.min(topRightRadiusMin, root.width - tlr) + } + + // Right radii + let rightRadii = root.topRightRadius + root.bottomRightRadius + + if (rightRadii > root.height) { + let topRightRadiusFactor = root.topRightRadius / rightRadii + let trr = Math.round(root.height * topRightRadiusFactor) + + topRightRadiusMin = Math.min(topRightRadiusMin, trr) + bottomRightRadiusMin = Math.min(bottomRightRadiusMin, root.height - trr) + } + + // Bottom radii + let bottomRadii = root.bottomRightRadius + root.bottomLeftRadius + + if (bottomRadii > root.width) { + let bottomRightRadiusFactor = root.bottomRightRadius / bottomRadii + let brr = Math.round(root.width * bottomRightRadiusFactor) + + bottomRightRadiusMin = Math.min(bottomRightRadiusMin, brr) + bottomLeftRadiusMin = Math.min(bottomLeftRadiusMin, root.width - brr) + } + + // Left radii + let leftRadii = root.bottomLeftRadius + root.topLeftRadius + + if (leftRadii > root.height) { + let bottomLeftRadiusFactor = root.bottomLeftRadius / leftRadii + let blr = Math.round(root.height * bottomLeftRadiusFactor) + + bottomLeftRadiusMin = Math.min(bottomLeftRadiusMin, blr) + topLeftRadiusMin = Math.min(topLeftRadiusMin, root.height - blr) + } + + path.__topLeftRadius = topLeftRadiusMin + path.__topRightRadius = topRightRadiusMin + path.__bottomLeftRadius = bottomLeftRadiusMin + path.__bottomRightRadius = bottomRightRadiusMin + } + + ShapePath { + id: path + + property int __topLeftRadius: 0 + property int __topRightRadius: 0 + property int __bottomRightRadius: 0 + property int __bottomLeftRadius: 0 + + readonly property real __borderRadiusAdjustment: { + if (root.adjustBorderRadius) { + if (root.borderMode === 1) + return (root.strokeWidth * 0.5) + if (root.borderMode === 2) + return root.strokeWidth + } + return 0 + } + + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + strokeWidth: 4 + strokeColor: "red" + fillColor: "transparent" + + startX: path.__topLeftRadius + root.borderOffset + path.__borderRadiusAdjustment + startY: root.borderOffset + } + + onDrawTopChanged: root.constructBorderItem() + onDrawRightChanged: root.constructBorderItem() + onDrawBottomChanged: root.constructBorderItem() + onDrawLeftChanged: root.constructBorderItem() + + function constructBorderItem() { + root.clearPathElements() + + // Top line + if (root.drawTop) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.x = Qt.binding(function() { return root.width - path.__topRightRadius - root.borderOffset - path.__borderRadiusAdjustment }) + pathLine.y = Qt.binding(function() { return root.borderOffset }) + path.pathElements.push(pathLine) + } else { + let pathMove = Qt.createQmlObject('import QtQuick 2.15; PathMove {}', path) + pathMove.x = Qt.binding(function() { return root.width - root.borderOffset }) + pathMove.y = Qt.binding(function() { return path.__topRightRadius + root.borderOffset + path.__borderRadiusAdjustment }) + path.pathElements.push(pathMove) + } + + // Top right corner + if (root.drawTop && root.drawRight) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.x = Qt.binding(function() { return root.width - root.borderOffset }) + pathArc.y = Qt.binding(function() { return path.__topRightRadius + root.borderOffset + path.__borderRadiusAdjustment }) + pathArc.radiusX = Qt.binding(function() { return root.topRightBevel ? 50000 : path.__topRightRadius + path.__borderRadiusAdjustment }) + pathArc.radiusY = Qt.binding(function() { return root.topRightBevel ? 50000 : path.__topRightRadius + path.__borderRadiusAdjustment }) + path.pathElements.push(pathArc) + } + + // Right line + if (root.drawRight) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.x = Qt.binding(function() { return root.width - root.borderOffset }) + pathLine.y = Qt.binding(function() { return root.height - path.__bottomRightRadius - root.borderOffset - path.__borderRadiusAdjustment }) + path.pathElements.push(pathLine) + } else { + let pathMove = Qt.createQmlObject('import QtQuick 2.15; PathMove {}', path) + pathMove.x = Qt.binding(function() { return root.width - path.__bottomRightRadius - root.borderOffset - path.__borderRadiusAdjustment }) + pathMove.y = Qt.binding(function() { return root.height - root.borderOffset }) + path.pathElements.push(pathMove) + } + + // Bottom right corner + if (root.drawBottom && root.drawRight) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.x = Qt.binding(function() { return root.width - path.__bottomRightRadius - root.borderOffset - path.__borderRadiusAdjustment }) + pathArc.y = Qt.binding(function() { return root.height - root.borderOffset }) + pathArc.radiusX = Qt.binding(function() { return root.bottomRightBevel ? 50000 : path.__bottomRightRadius + path.__borderRadiusAdjustment }) + pathArc.radiusY = Qt.binding(function() { return root.bottomRightBevel ? 50000 : path.__bottomRightRadius + path.__borderRadiusAdjustment }) + path.pathElements.push(pathArc) + } + + // Bottom line + if (root.drawBottom) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.x = Qt.binding(function() { return path.__bottomLeftRadius + root.borderOffset + path.__borderRadiusAdjustment }) + pathLine.y = Qt.binding(function() { return root.height - root.borderOffset }) + path.pathElements.push(pathLine) + } else { + let pathMove = Qt.createQmlObject('import QtQuick 2.15; PathMove {}', path) + pathMove.x = Qt.binding(function() { return root.borderOffset }) + pathMove.y = Qt.binding(function() { return root.height - path.__bottomLeftRadius - root.borderOffset - path.__borderRadiusAdjustment }) + path.pathElements.push(pathMove) + } + + // Bottom left corner + if (root.drawBottom && root.drawLeft) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.x = Qt.binding(function() { return root.borderOffset }) + pathArc.y = Qt.binding(function() { return root.height - path.__bottomLeftRadius - root.borderOffset - path.__borderRadiusAdjustment }) + pathArc.radiusX = Qt.binding(function() { return root.bottomLeftBevel ? 50000 : path.__bottomLeftRadius + path.__borderRadiusAdjustment }) + pathArc.radiusY = Qt.binding(function() { return root.bottomLeftBevel ? 50000 : path.__bottomLeftRadius + path.__borderRadiusAdjustment }) + path.pathElements.push(pathArc) + } + + // Left line + if (root.drawLeft) { + let pathLine = Qt.createQmlObject('import QtQuick 2.15; PathLine {}', path) + pathLine.x = Qt.binding(function() { return root.borderOffset }) + pathLine.y = Qt.binding(function() { return path.__topLeftRadius + root.borderOffset + path.__borderRadiusAdjustment }) + path.pathElements.push(pathLine) + } + // No need to use PathMove, if left line shouldn't be drawn we just leave the shape open. + + // Top left corner + if (root.drawTop && root.drawLeft) { + let pathArc = Qt.createQmlObject('import QtQuick 2.15; PathArc {}', path) + pathArc.x = Qt.binding(function() { return path.__topLeftRadius + root.borderOffset + path.__borderRadiusAdjustment }) + pathArc.y = Qt.binding(function() { return root.borderOffset }) + pathArc.radiusX = Qt.binding(function() { return root.topLeftBevel ? 50000 : path.__topLeftRadius + path.__borderRadiusAdjustment }) + pathArc.radiusY = Qt.binding(function() { return root.topLeftBevel ? 50000 : path.__topLeftRadius + path.__borderRadiusAdjustment }) + path.pathElements.push(pathArc) + } + } + + function clearPathElements() { + for (var i = 0; i !== path.pathElements.length; ++i) + path.pathElements[i].destroy() + + path.pathElements = [] + } + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + + root.calculateIndependentRadii() + root.constructBorderItem() + } +} diff --git a/Dependencies/Components/imports/components/CMakeLists.txt b/Dependencies/Components/imports/components/CMakeLists.txt new file mode 100644 index 0000000..543dab0 --- /dev/null +++ b/Dependencies/Components/imports/components/CMakeLists.txt @@ -0,0 +1,30 @@ +qt_add_library(QuickStudioComponents STATIC) +qt6_add_qml_module(QuickStudioComponents + URI "QtQuick.Studio.Components" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + ${qds_qml_extra_args} + QML_FILES + ArcArrow.qml + ArcItem.qml + BorderItem.qml + EllipseItem.qml + FlipableItem.qml + GroupItem.qml + PieItem.qml + RectangleItem.qml + RegularPolygonItem.qml + StarItem.qml + StraightArrow.qml + SvgPathItem.qml + TextItem.qml + TriangleItem.qml +) + +set_target_properties(QuickStudioComponents PROPERTIES + QT_QMLCACHEGEN_EXECUTABLE qmlcachegen +) + +register_plugin(QuickStudioComponents) diff --git a/Dependencies/Components/imports/components/CommonItemDescriptions.qdocinc b/Dependencies/Components/imports/components/CommonItemDescriptions.qdocinc new file mode 100644 index 0000000..372bb0a --- /dev/null +++ b/Dependencies/Components/imports/components/CommonItemDescriptions.qdocinc @@ -0,0 +1,162 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + +//! [component-radius] + + The radius used to draw rounded corners. + The default value is \1. + If radius is non-zero, the corners will be rounded, otherwise they will be sharp. + +//! [component-radius] + +//! [component-fillColor] + + The \1 fill color. + + A \1 can be filled with a \c solid color or with any of the \c linear, \c radial, or + \c conical gradients. + + When set to \c transparent, no filling occurs. + + The default value is \c white. +//! [component-fillColor] + +//! [component-gradient] + + The gradient of the \1 fill color. + + By default, no gradient is enabled and the value is null. In this case, the fill uses a solid + color based on the value of \l fillColor. + + When set, \l fillColor is ignored and filling is done using one of the \l ShapeGradient + subtypes. +//! [component-gradient] + +//! [component-joinStyle] + + The join style is used to connect two border line segments. + + \value ShapePath.MiterJoin + The outer edges of the lines are extended to meet at an angle, and + this area is filled. + \value ShapePath.BevelJoin + The triangular notch between the two lines is filled. + This is the default value. + \value ShapePath.RoundJoin + A circular arc between the two lines is filled. + + \sa Qt::PenJoinStyle +//! [component-joinStyle] + +//! [component-capStyle] + + The cap style defines how the end points of lines are drawn using QPainter. The cap style + only applies to lines with width 1 or greater. The cap style can be \c square, \c flat, or + \c round. + + The default is \l Qt::SquareCap + + \sa QPen::capStyle() + +//! [component-capStyle] + +//! [component-strokeStyle] + + The style of the \1 stroke. + + When set to \c None, no stroke is drawn. + + The stroke can be set to have a \c Solid, \c Dash, \c Dot, \c {Dash Dot}, or \c {Dash Dot Dot} + pattern. + + The default value is \c Solid. + +//! [component-strokeStyle] + +//! [component-strokeWidth] + + The width of the border of the \1. + The default value is 4. + A width of 1 creates a thin line. For no line, use a negative value or a transparent color. + + \note The width of the \1's border does not affect the geometry of the \1 itself or its + position relative to other items if anchors are used. + + The border is rendered within the \1's boundaries. + +//! [component-strokeWidth] + +//! [component-strokeColor] + + The color used to draw the border of the \1. + When set to \c transparent, no line is drawn. + The default value is \c red. + + \sa QColor + +//! [component-strokeColor] + +//! [component-dashPattern] + + The dash pattern of the \1 border specified as the dashes and the gaps between them. + + The dash pattern is specified in units of the pen's width. That is, a dash with the length 5 + and width 10 is 50 pixels long. + + Each dash is also subject to cap styles, and therefore a dash of 1 with square cap set will + extend 0.5 pixels out in each direction resulting in a total width of 2. + + The default value is (4, 2), meaning a dash of 4 * \l strokeWidth pixels followed by a space + of 2 * \l strokeWidth pixels. + + \sa QPen::setDashPattern() + +//! [component-dashPattern] + +//! [component-dashOffset] + + The starting point of the dash pattern for the \1 border. + + The offset is measured in terms of the units used to specify the dash pattern. For example, a + pattern where each stroke is four units long, followed by a gap of two units, will begin with + the stroke when drawn as a line. However, if the dash offset is set to 4.0, any line drawn will + begin with the gap. Values of the offset up to 4.0 will cause part of the stroke to be drawn + first, and values of the offset between 4.0 and 6.0 will cause the line to begin with part of + the gap. + + The default value is 0. + + \sa QPen::setDashOffset() + +//! [component-dashOffset] + +//! [component-borderMode] + + It defines where the border is drawn. + + \value Border.Inside + The border is drawn along the inside edge of the item and does not + affect the item width. + This is the default value. + \value Border.Middle + The border is drawn over the edge of the item and does not + affect the item width. + \value Border.Outside + The border is drawn along the outside edge of the item and increases + the item width by the value of \l strokeWidth. + + The default value is 0, which sets the border along the inside edge of the \l Item. + + \sa strokeWidth + +//! [component-borderMode] + +//! [component-adjustBorderRadius] + + It defines how the border radius is calculated for the corners. + +//! [component-adjustBorderRadius] + +*/ diff --git a/Dependencies/Components/imports/components/EllipseItem.qml b/Dependencies/Components/imports/components/EllipseItem.qml new file mode 100644 index 0000000..e953742 --- /dev/null +++ b/Dependencies/Components/imports/components/EllipseItem.qml @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype EllipseItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A filled ellipse with an optional border. + + An ellipse can be just an ellipse shaped stroke, a filling, or a stroke with filling. The + \l strokeColor, \l strokeWidth, and \l strokeStyle properties specify the appearance of the + outline. The \l dashPattern and \l dashOffset properties specify the appearance of a dashed + stroke. + + The area inside the stroke is painted using either a solid fill color, specified using the + \l fillColor property, or a gradient, defined using one of the \l ShapeGradient subtypes and set + using the \l gradient property. If both a color and a gradient are specified, the gradient is + used. + + To create an ellipse with a stroke, set a \l strokeWidth property that is greater than 0. The + \l strokeWidth property specifies the width of the ellipse stroke. The default \l strokeWidth + value is 4. Setting the \l strokeWidth value to -1 hides the border. To set the border outside, + inside, or on top of the ellipse's boundary, use \l borderMode. The default value 0 sets the + border inside the ellipse's boundary. + + \section2 Example Usage + + \image studio-ellipse.webp + + The QML code looks as follows: + + \code + EllipseItem { + id: ellipse + x: 571 + y: 199 + width: 167 + height: 125 + strokeColor: "#808080" + strokeStyle: 1 + borderMode: 0 + strokeWidth: 4 + } + + EllipseItem { + id: ellipseStroke + x: 773 + y: 199 + width: 167 + height: 125 + fillColor: "#00ffffff" + strokeWidth: 4 + strokeStyle: 1 + strokeColor: "#808080" + borderMode: 0 + } + + EllipseItem { + id: ellipseFilling + x: 571 + y: 350 + width: 167 + height: 125 + strokeWidth: -1 + strokeStyle: 1 + strokeColor: "#808080" + borderMode: 0 + } + + EllipseItem { + id: ellipseDashDotStroke + x: 773 + y: 350 + width: 167 + height: 125 + strokeWidth: 4 + strokeStyle: 4 + strokeColor: "#808080" + fillColor: "#00ffffff" + borderMode: 0 + } + \endcode +*/ + +Shape { + id: root + width: 200 + height: 150 +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {ellipse} +*/ + property alias gradient: path.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {ellipse} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {ellipse} +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {ellipse} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {ellipse} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {ellipse} +*/ + property alias fillColor: path.fillColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {ellipse} +*/ + property alias dashOffset: path.dashOffset + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== undefined + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + +/*! + \include CommonItemDescriptions.qdocinc component-borderMode +*/ + property int borderMode: 0 + + property real borderOffset: { + if (root.borderMode === 0) + return root.strokeWidth * 0.5 + if (root.borderMode === 1) + return 0 + + return -root.strokeWidth * 0.5 + } + + Item { + anchors.fill: parent + anchors.margins: { + if (root.borderMode === 0) + return 0 + if (root.borderMode === 1) + return -root.strokeWidth * 0.5 + + return -root.strokeWidth + } + } + + ShapePath { + id: path + + joinStyle: ShapePath.MiterJoin + strokeWidth: 4 + strokeColor: "red" + startX: root.width * 0.5 + startY: root.borderOffset + + strokeStyle: root.strokeStyle + + PathArc { + x: path.startX + y: root.height - root.borderOffset + radiusX: root.width * 0.5 - root.borderOffset + radiusY: root.height * 0.5 - root.borderOffset + useLargeArc: true + } + + PathArc { + x: path.startX + y: path.startY + radiusX: root.width * 0.5 - root.borderOffset + radiusY: root.height * 0.5 - root.borderOffset + useLargeArc: true + } + } + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + } +} diff --git a/Dependencies/Components/imports/components/FlipableItem.qml b/Dependencies/Components/imports/components/FlipableItem.qml new file mode 100644 index 0000000..f4725bb --- /dev/null +++ b/Dependencies/Components/imports/components/FlipableItem.qml @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +/*! + \qmltype FlipableItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + + \brief Provides a surface that can be flipped. + + A Flipable type can be visibly flipped between its front and back sides, like a card. The front + and back sides are specified by using any two types inside the Flipable type. The type with the + higher z-order is the front side. The \l opacityFront and \l opacityBack properties are used to + hide and show either the front or back side of the item at a time. + + The \l flipAngle property is used to animate the angle of the type to produce the flipping + effect. The value of the \l rotationalAxis property determines which axis the type is rotated + around. + + \section2 Example Usage + + You can use the Flipable component in \QDS to create an item that can be flipped. + + \image studio-flipable.webp + + The QML code looks as follows: + + \code + FlipableItem { + id: flipable + x: 595 + y: 277 + width: 493 + height: 493 + opacityFront: 1 + opacityBack: 0.09412 + flipAngle: 45 + rotationalAxis: 1 + + TriangleItem { + id: triangle + x: 122 + y: 122 + width: 250 + height: 250 + opacity: 1 + z: 0 + strokeWidth: 10 + fillColor: "#6cff9f" + rotation: -270 + } + + TriangleItem { + id: triangle1 + x: 16 + y: 122 + width: 250 + height: 250 + strokeWidth: 10 + rotation: 270 + fillColor: "#6cff9f" + } + } + \endcode +*/ + +Flipable { + id: flipable + width: 240 + height: 240 + +/*! + The flip angle in degrees. + + The minimum value is -360 and the maximum value is 360 degrees. +*/ + property alias flipAngle: rotation.angle + +/*! + The opacity of the front side of the type. + + The opacity can be set between 0 and 1 to hide or show the items on the + front side of the type. +*/ + property real opacityFront: 1 + +/*! + The opacity of the back side of the type. + + The opacity can be set between 0 and 1 to hide or show the items on the + back side of the type. +*/ + property real opacityBack: 1 + +/*! + Whether the type is rotated around the x-axis or y-axis. + + This property is set to 0 to rotate the type around the x-axis or to + 1 to rotate around the y-axis. +*/ + property int rotationalAxis: 1 // 0: x-axis, 1: y-axis + + Binding { + target: flipable.front + value: opacityFront + property: "opacity" + when: flipable.front !== undefined + } + + Binding { + target: flipable.back + value: opacityBack + property: "opacity" + when: flipable.back !== undefined + } + +/*! + Whether the type has been flipped. + + This property is set to \c true when the type is flipped. +*/ + property bool flipped: false + + onChildrenChanged: { + if (flipable.children[0] !== undefined && !flipable.front) { + flipable.front = flipable.children[0] + } + + if (flipable.children[1] !== undefined && !flipable.back){ + flipable.back = flipable.children[1] + } + } + + transform: Rotation { + id: rotation + origin.x: flipable.width/2 + origin.y: flipable.height/2 + axis.x: flipable.rotationalAxis === 0 ? 1 : 0 + axis.y: flipable.rotationalAxis === 1 ? 1 : 0 + axis.z: 0 + angle: 0 // the default angle + } +} diff --git a/Dependencies/Components/imports/components/GroupItem.qml b/Dependencies/Components/imports/components/GroupItem.qml new file mode 100644 index 0000000..50f168a --- /dev/null +++ b/Dependencies/Components/imports/components/GroupItem.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +/*! + \qmltype GroupItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Item + + \brief A group item that gets its size from its children. + + The Group type is an \l Item type extended with the size property. The value of size is + automatically calculated to fit the children of the group. + + \section2 Example Usage + + You can use the Group type to specify the size of one or several items. + + \image studio-group.webp + + The QML code looks as follows: + + \code + GroupItem { + id: group + x: 820 + y: 437 + + Rectangle { + id: rectangle1 + width: 200 + height: 200 + color: "#c2c2c2" + } + + Rectangle { + id: rectangle2 + x: 140 + y: 140 + width: 200 + height: 200 + color: "#000000" + } + } + \endcode +*/ + +Item { + implicitWidth: Math.max(16, childrenRect.width + childrenRect.x) + implicitHeight: Math.max(16, childrenRect.height + childrenRect.y) +} diff --git a/Dependencies/Components/imports/components/PieItem.qml b/Dependencies/Components/imports/components/PieItem.qml new file mode 100644 index 0000000..c476b6f --- /dev/null +++ b/Dependencies/Components/imports/components/PieItem.qml @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype PieItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A pie. + + The Pie type is used to create a pie slice, a pie that is missing slices, or just the pie stroke + (similar to an \l ArcItem), depending on the \l begin and \l end property values and the + \l hideLine value. + + The filling of the pie is painted using either a solid fill color, specified using the + \l fillColor property, or a gradient, defined using one of the \l ShapeGradient subtypes and set + using the \l gradient property. If both a color and a gradient are specified, the gradient is + used. + + The \l strokeColor, \l strokeWidth, and \l strokeStyle properties specify the appearance of the + pie outline. The \l dashPattern and \l dashOffset properties specify the appearance of dashed + lines. + + The \l capStyle property specifies whether line ends are square or rounded. + + \section2 Example Usage + + You can use the Pie component in \QDS to create different kinds of pies. + + \image studio-pie.webp + + The QML code looks as follows: + + \code + PieItem { + id: pieSlice + x: 920 + y: 416 + strokeWidth: -1 + antialiasing: true + strokeColor: "gray" + fillColor: "light gray" + } + + PieItem { + id: pie + x: 1118 + y: 407 + end: 300 + fillColor: "#d3d3d3" + strokeColor: "#808080" + antialiasing: true + } + + PieItem { + id: pieStroke + x: 1022 + y: 548 + fillColor: "#00ffffff" + strokeWidth: 4 + capStyle: 32 + hideLine: true + end: 300 + strokeColor: "#808080" + antialiasing: true + } + \endcode +*/ + +Shape { + id: root + + width: 100 + height: 100 + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {pie} +*/ + property alias gradient: path.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.BevelJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.FlatCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {pie} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {pie} +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {pie} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {pie} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {pie} + + If \l hideLine is \c false, a pie slice is drawn using the values of the \l begin and \l end + properties and filled with this color. + + If \l hideLine is \c true, just the pie stroke is drawn and the area between the \l begin and + \l end points is filled. +*/ + property alias fillColor: path.fillColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {pie} +*/ + property alias dashOffset: path.dashOffset + +/*! + The position in degrees where the pie begins. + + The default value is 0. + + To create a circle, set the value of this property to 0 and the value of the \l end property to + 360. +*/ + property real begin: 0 + +/*! + The position in degrees where the pie ends. + + The default value is 90. + + To create a circle, set the value of this property to 360 and the value of the \l begin property + to 0. +*/ + property real end: 90 + +/*! + The area between \l begin and \l end. +*/ + property real alpha: root.clamp(root.end - root.begin, 0, 359.9) + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== undefined + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + + function clamp(num, min, max) { + return Math.max(min, Math.min(num, max)) + } + +/*! + Whether to draw a pie slice or just the pie stroke (similar to an \l ArcItem). +*/ + property bool hideLine: { + if (root.alpha <= 0) + return true + if (root.alpha >= 359) + return true + return false + } + + function toRadians(degrees) { + return degrees * (Math.PI / 180.0) + } + + function polarToCartesianX(centerX, centerY, radius, angleInDegrees) { + return centerX + radius * Math.cos(root.toRadians(angleInDegrees)) + } + + function polarToCartesianY(centerX, centerY, radius, angleInDegrees) { + return centerY + radius * Math.sin(root.toRadians(angleInDegrees)) + } + + ShapePath { + id: path + + property real __xRadius: root.width / 2 - root.strokeWidth / 2 + property real __yRadius: root.height / 2 - root.strokeWidth / 2 + + property real __xCenter: root.width / 2 + property real __yCenter: root.height / 2 + + strokeColor: "red" + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + strokeWidth: 4 + + startX: root.hideLine ? root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.begin - 90) + : path.__xCenter + startY: root.hideLine ? root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.begin - 90) + : path.__yCenter + + PathLine { + x: root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.begin - 90) + y: root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.begin - 90) + } + + PathArc { + id: arc + + x: root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.begin + root.alpha - 90) + y: root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.begin + root.alpha - 90) + + radiusY: path.__yRadius; + radiusX: path.__xRadius; + + useLargeArc: root.alpha > 180 + } + + PathLine { + x: root.hideLine ? root.polarToCartesianX(path.__xCenter, path.__yCenter, path.__xRadius, root.begin + root.alpha - 90) + : path.__xCenter + y: root.hideLine ? root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.begin + root.alpha - 90) + : path.__yCenter + } + } + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + } +} + diff --git a/Dependencies/Components/imports/components/RectangleItem.qml b/Dependencies/Components/imports/components/RectangleItem.qml new file mode 100644 index 0000000..7982fb1 --- /dev/null +++ b/Dependencies/Components/imports/components/RectangleItem.qml @@ -0,0 +1,491 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype RectangleItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A filled rectangle with an optional border. + + Rectangle items are used to fill areas with solid color or gradients and to provide a + rectangular border. + + Each Rectangle item is painted using either a solid fill color, specified using the \l fillColor + property, or a gradient, defined using one of the \l ShapeGradient subtypes and set using the + \l gradient property. If both a color and a gradient are specified, the gradient is used. + + An optional border can be added to a rectangle with its own color and thickness by setting the + \l strokeColor and \l strokeWidth properties. Setting the color to \c transparent creates a + border without a fill color. + + Rounded rectangles can be drawn using the \l radius property. The radius can also be specified + separately for each corner. Because this introduces curved edges to the corners of a rectangle. + Additionally, \l bevel can be applied on any corner to cut it off sharply. + + \section2 Example Usage + + You can use the Rectangle component in \QDS to create different kinds of rectangles. + + \image studio-rectangle.webp + + The QML code looks as follows: + + \code + RectangleItem { + id: rectangle1 + x: 480 + y: 164 + width: 409 + height: 307 + radius: 0 + gradient: RadialGradient { + GradientStop { + position: 0 + color: "#cea1f9fc" + } + + GradientStop { + position: 1 + color: "#ec7d7d" + } + focalY: rectangle1.height * 0.5 + focalX: rectangle1.width * 0.5 + focalRadius: Math.min(rectangle1.width, rectangle1.height) * 0 + centerY: rectangle1.height * 0.5 + centerX: rectangle1.width * 0.5 + centerRadius: Math.min(rectangle1.width, rectangle1.height) * 0.5 + } + strokeWidth: 6 + strokeColor: "#ff0000" + bottomLeftRadius: 30 + topRightRadius: 30 + adjustBorderRadius: true + } + + RectangleItem { + id: rectangle2 + x: 954 + y: 164 + width: 409 + height: 307 + radius: 0 + fillColor: "#c062606a" + strokeWidth: -1 + topRightRadius: 30 + strokeColor: "#8b8a8a" + bottomLeftRadius: 30 + adjustBorderRadius: true + } + + RectangleItem { + id: rectangle3 + x: 480 + y: 533 + width: 409 + height: 307 + radius: 0 + gradient: LinearGradient { + y2: rectangle3.height * 1 + y1: rectangle3.height * 0 + x2: rectangle3.width * 1 + x1: rectangle3.width * 0 + GradientStop { + position: 0.10526 + color: "#e77979" + } + GradientStop { + position: 0.67105 + color: "#716767" + } + } + topRightBevel: true + topRightRadius: 30 + strokeWidth: 6 + strokeColor: "#ff0000" + bottomLeftRadius: 0 + adjustBorderRadius: true + } + + RectangleItem { + id: rectangle4 + x: 954 + y: 533 + width: 409 + height: 307 + radius: 30 + fillColor: "#d87c7c" + borderMode: 2 + dashOffset: 3 + joinStyle: 2 + strokeStyle: 5 + topRightBevel: false + strokeWidth: 6 + strokeColor: "#ff0000" + adjustBorderRadius: true + } + \endcode +*/ + +Shape { + id: root + width: 200 + height: 150 +/*! + \include CommonItemDescriptions.qdocinc {component-radius} {10} + + If radius is non-zero, the corners will be rounded, otherwise they will be sharp. The radius can + also be specified separately for each corner by using the \l bottomLeftRadius, + \l bottomRightRadius, \l topLeftRadius, and \l topRightRadius properties. +*/ + property int radius: 10 + +/*! + The radius of the top left rectangle corner. +*/ + property int topLeftRadius: root.radius + +/*! + The radius of the bottom left rectangle corner. +*/ + property int bottomLeftRadius: root.radius + +/*! + The radius of the top right rectangle corner. +*/ + property int topRightRadius: root.radius + +/*! + The radius of the bottom right rectangle corner. +*/ + property int bottomRightRadius: root.radius + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {rectangle} +*/ + property ShapeGradient gradient: null + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.MiterJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.SquareCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {rectangle} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {rectangle} +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {rectangle} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {rectangle} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {rectangle} +*/ + property alias fillColor: path.fillColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {rectangle} +*/ + property alias dashOffset: path.dashOffset + +/*! + Whether the rectangle corner is beveled. +*/ + property bool bevel: false + +/*! + The bevel of the top left rectangle corner. + + \sa bevel +*/ + property bool topLeftBevel: root.bevel + +/*! + The bevel of the top right rectangle corner. + + \sa bevel +*/ + property bool topRightBevel: root.bevel + +/*! + The bevel of the bottom right rectangle corner. + + \sa bevel +*/ + property bool bottomRightBevel: root.bevel + +/*! + The bevel of the bottom left rectangle corner. + + \sa bevel +*/ + property bool bottomLeftBevel: root.bevel + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== undefined + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + +/*! + \include CommonItemDescriptions.qdocinc component-borderMode +*/ + property int borderMode: 0 + + property real borderOffset: { + if (root.borderMode === 0) + return root.strokeWidth * 0.5 + if (root.borderMode === 1) + return 0 + + return -root.strokeWidth * 0.5 + } + +/*! + \include CommonItemDescriptions.qdocinc component-adjustBorderRadius +*/ + property bool adjustBorderRadius: false + + Item { + anchors.fill: parent + anchors.margins: { + if (root.borderMode === 0) + return 0 + if (root.borderMode === 1) + return -root.strokeWidth * 0.5 + + return -root.strokeWidth + } + } + + onRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onTopLeftRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onTopRightRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onBottomLeftRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onBottomRightRadiusChanged: Qt.callLater(root.calculateIndependentRadii) + onWidthChanged: Qt.callLater(root.calculateIndependentRadii) + onHeightChanged: Qt.callLater(root.calculateIndependentRadii) + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + + root.calculateIndependentRadii() + } + + function calculateIndependentRadii() { + let minDimension = Math.min(root.width, root.height) + let maxRadius = Math.floor(minDimension / 2) + let mixed = !(root.radius === root.topLeftRadius + && root.radius === root.topRightRadius + && root.radius === root.bottomLeftRadius + && root.radius === root.bottomRightRadius) + + // Uniform radii + if (!mixed) { + path.__topLeftRadius = Math.min(root.topLeftRadius, maxRadius) + path.__topRightRadius = Math.min(root.topRightRadius, maxRadius) + path.__bottomRightRadius = Math.min(root.bottomRightRadius, maxRadius) + path.__bottomLeftRadius = Math.min(root.bottomLeftRadius, maxRadius) + return + } + + // Mixed radii + let topLeftRadiusMin = Math.min(minDimension, root.topLeftRadius) + let topRightRadiusMin = Math.min(minDimension, root.topRightRadius) + let bottomLeftRadiusMin = Math.min(minDimension, root.bottomLeftRadius) + let bottomRightRadiusMin = Math.min(minDimension, root.bottomRightRadius) + + // Top radii + let topRadii = root.topLeftRadius + root.topRightRadius + + if (topRadii > root.width) { + let topLeftRadiusFactor = root.topLeftRadius / topRadii + let tlr = Math.round(root.width * topLeftRadiusFactor) + + topLeftRadiusMin = Math.min(topLeftRadiusMin, tlr) + topRightRadiusMin = Math.min(topRightRadiusMin, root.width - tlr) + } + + // Right radii + let rightRadii = root.topRightRadius + root.bottomRightRadius + + if (rightRadii > root.height) { + let topRightRadiusFactor = root.topRightRadius / rightRadii + let trr = Math.round(root.height * topRightRadiusFactor) + + topRightRadiusMin = Math.min(topRightRadiusMin, trr) + bottomRightRadiusMin = Math.min(bottomRightRadiusMin, root.height - trr) + } + + // Bottom radii + let bottomRadii = root.bottomRightRadius + root.bottomLeftRadius + + if (bottomRadii > root.width) { + let bottomRightRadiusFactor = root.bottomRightRadius / bottomRadii + let brr = Math.round(root.width * bottomRightRadiusFactor) + + bottomRightRadiusMin = Math.min(bottomRightRadiusMin, brr) + bottomLeftRadiusMin = Math.min(bottomLeftRadiusMin, root.width - brr) + } + + // Left radii + let leftRadii = root.bottomLeftRadius + root.topLeftRadius + + if (leftRadii > root.height) { + let bottomLeftRadiusFactor = root.bottomLeftRadius / leftRadii + let blr = Math.round(root.height * bottomLeftRadiusFactor) + + bottomLeftRadiusMin = Math.min(bottomLeftRadiusMin, blr) + topLeftRadiusMin = Math.min(topLeftRadiusMin, root.height - blr) + } + + path.__topLeftRadius = topLeftRadiusMin + path.__topRightRadius = topRightRadiusMin + path.__bottomLeftRadius = bottomLeftRadiusMin + path.__bottomRightRadius = bottomRightRadiusMin + } + + ShapePath { + id: path + + property int __topLeftRadius: 0 + property int __topRightRadius: 0 + property int __bottomRightRadius: 0 + property int __bottomLeftRadius: 0 + + readonly property real __borderRadiusAdjustment: { + if (root.adjustBorderRadius) { + if (root.borderMode === 1) + return (root.strokeWidth * 0.5) + if (root.borderMode === 2) + return root.strokeWidth + } + return 0 + } + + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + strokeWidth: 4 + strokeColor: "red" + fillGradient: root.gradient + + startX: path.__topLeftRadius + root.borderOffset + path.__borderRadiusAdjustment + startY: root.borderOffset + + // Top. + PathLine { + x: root.width - path.__topRightRadius - root.borderOffset - path.__borderRadiusAdjustment + y: root.borderOffset + } + + // Top-right. + PathArc { + x: root.width - root.borderOffset + y: path.__topRightRadius + root.borderOffset + path.__borderRadiusAdjustment + + radiusX: root.topRightBevel ? 50000 : path.__topRightRadius + path.__borderRadiusAdjustment + radiusY: root.topRightBevel ? 50000 : path.__topRightRadius + path.__borderRadiusAdjustment + } + + // Right. + PathLine { + x: root.width - root.borderOffset + y: root.height - path.__bottomRightRadius - root.borderOffset - path.__borderRadiusAdjustment + } + + // Bottom-right. + PathArc { + x: root.width - path.__bottomRightRadius - root.borderOffset - path.__borderRadiusAdjustment + y: root.height - root.borderOffset + + radiusX: root.bottomRightBevel ? 50000 : path.__bottomRightRadius + path.__borderRadiusAdjustment + radiusY: root.bottomRightBevel ? 50000 : path.__bottomRightRadius + path.__borderRadiusAdjustment + } + + // Bottom. + PathLine { + x: path.__bottomLeftRadius + root.borderOffset + path.__borderRadiusAdjustment + y: root.height - root.borderOffset + } + + // Bottom-left. + PathArc { + x: root.borderOffset + y: root.height - path.__bottomLeftRadius - root.borderOffset - path.__borderRadiusAdjustment + + radiusX: root.bottomLeftBevel ? 50000 : path.__bottomLeftRadius + path.__borderRadiusAdjustment + radiusY: root.bottomLeftBevel ? 50000 : path.__bottomLeftRadius + path.__borderRadiusAdjustment + } + + // Left. + PathLine { + x: root.borderOffset + y: path.__topLeftRadius + root.borderOffset + path.__borderRadiusAdjustment + } + + // Top-left. + PathArc { + x: path.__topLeftRadius + root.borderOffset + path.__borderRadiusAdjustment + y: root.borderOffset + + radiusX: root.topLeftBevel ? 50000 : path.__topLeftRadius + path.__borderRadiusAdjustment + radiusY: root.topLeftBevel ? 50000 : path.__topLeftRadius + path.__borderRadiusAdjustment + } + } +} diff --git a/Dependencies/Components/imports/components/RegularPolygonItem.qml b/Dependencies/Components/imports/components/RegularPolygonItem.qml new file mode 100644 index 0000000..c8fa420 --- /dev/null +++ b/Dependencies/Components/imports/components/RegularPolygonItem.qml @@ -0,0 +1,452 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype RegularPolygon + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A filled regular polygon with an optional border. + + A regular polygon can be just a 2D polygon shaped stroke, a filling, or a stroke with filling. + The \l strokeColor, \l strokeWidth, and \l strokeStyle properties specify the appearance of the + outline. The \l dashPattern and \l dashOffset properties specify the appearance of dashed stroke. + + The area inside the stroke is painted using either a solid fill color, specified using the + \l fillColor property, or a gradient, defined using one of the \l ShapeGradient subtypes and set + using the \l gradient property. If both a color and a gradient are specified, the gradient is + used. + + To create a polygon with a stroke, set the \sideCount property between 3 to 100 and the + \l strokeWidth property greater than 0. The \l strokeWidth property specifies the width of the + polygon stroke.The default \l sideCount value is 6 and the default \l strokeWidth value is 4. + Setting the \l strokeWidth value to a negetive value hides the border. + + The \l radius property specifies whether the polygon corners are rounded. Because this + introduces curved edges to the corners, it may be appropriate to set the \c antialiasing + property that is inherited from \l Item to improve the appearance of the stroke. + + \section2 Example Usage + + \image studio-regularpolygon.webp + + The QML code looks as follows: + + \code + RegularPolygonItem { + id: regularPolygon + x: 817 + y: 404 + width: 133 + height: 133 + radius: 10 + strokeColor: "#262525" + fillColor: "#766e6e" + } + + RegularPolygonItem { + id: regularPolygon1 + x: 973 + y: 404 + width: 133 + height: 133 + sideCount: 15 + gradient: RadialGradient { + GradientStop { + position: 0 + color: "#c56060" + } + + GradientStop { + position: 1 + color: "#665e5e" + } + focalY: regularPolygon1.height * 0.5 + focalX: regularPolygon1.width * 0.5 + focalRadius: Math.min(regularPolygon1.width, regularPolygon1.height) * 0 + centerY: regularPolygon1.height * 0.5 + centerX: regularPolygon1.width * 0.5 + centerRadius: Math.min(regularPolygon1.width, regularPolygon1.height) * 0.5 + } + strokeColor: "#262525" + } + + RegularPolygonItem { + id: regularPolygon2 + x: 817 + y: 567 + width: 133 + height: 133 + gradient: ConicalGradient { + centerY: regularPolygon2.height * 0.5 + centerX: regularPolygon2.width * 0.5 + angle: 0 + + GradientStop { + position: 0 + color: "#fc8e8e" + } + + GradientStop { + position: 1 + color: "#f0b9b9" + } + } + joinStyle: 1 + strokeStyle: 4 + strokeColor: "#262525" + sideCount: 10 + } + + RegularPolygonItem { + id: regularPolygon3 + x: 973 + y: 567 + width: 133 + height: 133 + strokeWidth: -1 + strokeColor: "#262525" + sideCount: 7 + gradient: RadialGradient { + GradientStop { + position: 0.21053 + color: "#60c2c5" + } + + GradientStop { + position: 1 + color: "#deb2b2" + } + focalY: regularPolygon3.height * 0.5 + focalX: regularPolygon3.width * 0.5 + focalRadius: Math.min(regularPolygon3.width, regularPolygon3.height) * 0 + centerY: regularPolygon3.height * 0.5 + centerX: regularPolygon3.width * 0.5 + centerRadius: Math.min(regularPolygon3.width, regularPolygon3.height) * 0.5 + } + } + \endcode + +*/ + +Shape { + id: root + width: 200 + height: 200 + +/*! + \include CommonItemDescriptions.qdocinc {component-radius} {10} +*/ + property int radius: 10 + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {regular polygon} +*/ + property alias gradient: path.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.MiterJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.SquareCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {regular polygon} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {regular polygon} +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {regular polygon} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {regular polygon} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {regular polygon} +*/ + property alias fillColor: path.fillColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {regular polygon} +*/ + property alias dashOffset: path.dashOffset + +/*! + The number of edges on the regular polygon. + The minimum number of edges can be 3. + The default value is 6. +*/ + property int sideCount: 6 + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== "undefined" + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + + // This is used to make the bounding box of the item a bit bigger so it will draw sharp edges + // in case of large stroke width instead of cutting it off. + Item { + anchors.fill: parent + anchors.margins: -root.strokeWidth + } + + ShapePath { + id: path + + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + strokeWidth: 4 + strokeColor: "red" + startX: 0 + startY: 0 + } + + onWidthChanged: root.constructPolygon() + onHeightChanged: root.constructPolygon() + onSideCountChanged: root.constructPolygon() + onRadiusChanged: root.constructPolygon() + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + + root.constructPolygon() + } + + property real __centerX: root.width / 2 + property real __centerY: root.height / 2 + + function constructPolygon() { + root.clearPathElements() + + if (root.radius === 0) + root.constructPolygonPath() + else + root.constructRoundedPolygonPath() + } + + function toRadians(degrees) { + return degrees * (Math.PI / 180.0) + } + + function toDegrees(radians) { + return radians * (180.0 / Math.PI) + } + + function getPoints() { + let sliceAngle = (360.0 / root.sideCount) + // The Draftsman's Method + let a = root.width / 2 // x-radius + let b = root.height / 2 // y-radius + let points = [] + + // Go clockwise from top center + for (var corner = 0; corner < root.sideCount; corner++) { + let angleToCorner = root.toRadians(corner * sliceAngle) + // Start at top center + let x = root.__centerX + a * Math.sin(angleToCorner) + let y = root.__centerY - b * Math.cos(angleToCorner) + + points.push(Qt.point(x ,y)) + } + + return points + } + + Component { + id: myPathLine + PathLine {} + } + + Component { + id: myPathArc + PathArc {} + } + + function constructPolygonPath() { + let angle = (360.0 / root.sideCount) + let points = root.getPoints() + + for (var i = 0; i < points.length; i++) { + if (i === 0) { + path.startX = points[i].x + path.startY = points[i].y + } else { + let pathLine = myPathLine.createObject(path) + pathLine.x = points[i].x + pathLine.y = points[i].y + path.pathElements.push(pathLine) + } + } + + // Close the polygon + var pathLineClose = myPathLine.createObject(path) + pathLineClose.x = points[0].x + pathLineClose.y = points[0].y + path.pathElements.push(pathLineClose) + } + + // https://stackoverflow.com/questions/58541430/find-intersection-point-of-two-vectors-independent-from-direction + // This function returns the length of the vector from p to the intersection point of the two lines + // both defined by a point and a vector. + function intersect(p: point, dir1: vector2d, q: point, dir2: vector2d) : real { + let r = dir1.normalized() + let s = dir2.normalized() + + let pq = Qt.vector2d(q.x - p.x, q.y - p.y) + let snv = Qt.vector2d(s.y, -s.x); + + return pq.dotProduct(snv) / r.dotProduct(snv) + } + + function wrapIndex(index, size) { + return (index + size) % size + } + + function constructRoundedPolygonPath() { + let angle = (360.0 / root.sideCount) + let points = root.getPoints() + + // A list of vectors that are the bisectors of the inner angles of the polygon. + // This is used to calculate the intersection point of neighboring bisectors for a corner. + // The minimum length of the two neighboring corner bisectors intersection point is the + // maximum for the center of the circle that make up the corner radius. + let bisectors = [] + + // Create angle bisectors by using the parallelolgram rule. + for (var i = 0; i < points.length; i++) { + let a = points[root.wrapIndex(i, points.length)] + let b = points[root.wrapIndex(i - 1, points.length)] + let c = points[root.wrapIndex(i + 1, points.length)] + + let vAB = Qt.vector2d(b.x - a.x, b.y - a.y).normalized() + let vAC = Qt.vector2d(c.x - a.x, c.y - a.y).normalized() + let bisector = vAB.plus(vAC).normalized() + + bisectors.push(bisector) + } + + for (var i = 0; i < points.length; i++) { + let a = points[root.wrapIndex(i, points.length)] + let b = points[root.wrapIndex(i - 1, points.length)] + let c = points[root.wrapIndex(i + 1, points.length)] + let r = root.radius + + let vAB = Qt.vector2d(b.x - a.x, b.y - a.y) + let vAC = Qt.vector2d(c.x - a.x, c.y - a.y) + + // Calculate the intersection points of the two neighboring bisectors + let tAB = root.intersect(a, bisectors[root.wrapIndex(i, bisectors.length)], + b, bisectors[root.wrapIndex(i - 1, bisectors.length)]) + let tAC = root.intersect(a, bisectors[root.wrapIndex(i, bisectors.length)], + c, bisectors[root.wrapIndex(i + 1, bisectors.length)]) + let tMax = Math.min(tAB, tAC) + + // Angle between the two vectors AB and AC as radians + let alpha = Math.acos(vAB.dotProduct(vAC) / (vAB.length() * vAC.length())) + + // The maximum radius of the circle that can be drawn at the corner. This is another + // constraint that Figma uses to calculate the corner radius. The corner radius shouldn't + // be bigger than half of the distance between the two neighboring corners. + let maxRadius = Math.round(Qt.vector2d(c.x - b.x, c.y - b.y).length() / 2) + r = Math.min(r, maxRadius) + + // The optimal length of the corner bisector to place the center of the circle. + let cLength = r / (Math.sin(alpha / 2)) + + // Clamp c to the maximum value found from the intersection points of the bisectors. + let realC = Math.min(cLength, tMax) + + if (realC < cLength) + r = realC * Math.sin(alpha / 2) + + let t = Math.sqrt(Math.pow(realC, 2) - Math.pow(r, 2)) + + let p1 = vAB.normalized().times(t).plus(Qt.vector2d(a.x, a.y)) + let p2 = vAC.normalized().times(t).plus(Qt.vector2d(a.x, a.y)) + + if (i === 0) { + path.startX = p1.x + path.startY = p1.y + } else { + let pathLine = myPathLine.createObject(path) + pathLine.x = p1.x + pathLine.y = p1.y + path.pathElements.push(pathLine) + } + + let pathArc = myPathArc.createObject(path) + pathArc.x = p2.x + pathArc.y = p2.y + pathArc.radiusX = r + pathArc.radiusY = r + + path.pathElements.push(pathArc) + } + + // Close the polygon + var pathLineClose = myPathLine.createObject(path) + pathLineClose.x = path.startX + pathLineClose.y = path.startY + path.pathElements.push(pathLineClose) + } + + function clearPathElements() { + for (var i = 0; i !== path.pathElements.length; ++i) + path.pathElements[i].destroy() + + path.pathElements = [] + } +} diff --git a/Dependencies/Components/imports/components/StarItem.qml b/Dependencies/Components/imports/components/StarItem.qml new file mode 100644 index 0000000..1608936 --- /dev/null +++ b/Dependencies/Components/imports/components/StarItem.qml @@ -0,0 +1,410 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype Star + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A filled star-shaped polygon with an optional border. + + A star can be a star shaped stroke, a filling, or a stroke with filling. The \l strokeColor, + \l strokeWidth, and \l strokeStyle properties specify the appearance of the outline. The + \l dashPattern and \l dashOffset properties specify the appearance of dashed stroke. + + Set the \l count property between 3 and 60 to specify the number of points of the star. Set the + \l ratio between 0.1 and 1 to specify the distance of the inner points of the star from the + center. + + The area inside the stroke is painted using either a solid fill color, specified using the + \l fillColor property, or a gradient, defined using one of the \l ShapeGradient subtypes and set + using the \l gradient property. If both a color and a gradient are specified, the gradient is + used. + + To create a star with a stroke, set the \l strokeWidth property to a value greater than 0. The + \l strokeWidth property specifies the width of the polygon stroke.The default \l count value is + 6 and the default \l strokeWidth value is 4. Setting the \l strokeWidth value to a negative + value hides the border. + + The \l radius property specifies whether the star corners are rounded. Because this introduces + curved edges to the corners, it may be appropriate to set the \c antialiasing property that is + inherited from \l Item to improve the appearance of the stroke. + + \section2 Example Usage + + \image studio-star.webp + + The QML code looks as follows: + + \code + + StarItem { + id: star + x: 621 + y: 433 + width: 142 + height: 142 + radius: 10 + } + + StarItem { + id: star1 + x: 786 + y: 433 + width: 142 + height: 142 + radius: 1 + gradient: RadialGradient { + GradientStop { + position: 0 + color: "#ce9d9d" + } + + GradientStop { + position: 1 + color: "#000000" + } + focalY: star1.height * 0.5 + focalX: star1.width * 0.5 + focalRadius: Math.min(star1.width, star1.height) * 0 + centerY: star1.height * 0.5 + centerX: star1.width * 0.5 + centerRadius: Math.min(star1.width, star1.height) * 0.5 + } + count: 7 + } + + StarItem { + id: star2 + x: 786 + y: 603 + width: 142 + height: 142 + radius: 1 + fillColor: "#00ffffff" + strokeColor: "#000000" + ratio: 0.2 + count: 3 + } + + StarItem { + id: star3 + x: 621 + y: 603 + width: 142 + height: 142 + radius: 1 + gradient: LinearGradient { + y2: star3.height * 1 + y1: star3.height * 0 + x2: star3.width * 1 + x1: star3.width * 0 + + GradientStop { + position: 0 + color: "#ff8686" + } + + GradientStop { + position: 1 + color: "#5c5e5d" + } + } + strokeColor: "#00ff0000" + ratio: 0.6 + count: 25 + } + + \endcode +*/ + +Shape { + id: root + width: 200 + height: 200 + +/*! + \include CommonItemDescriptions.qdocinc {component-radius} {10} +*/ + property int radius: 10 + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {star} +*/ + property alias gradient: path.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.MiterJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.SquareCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {star} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {star} +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {star} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {star} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {star} +*/ + property alias fillColor: path.fillColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {star} +*/ + property alias dashOffset: path.dashOffset + +/*! + The number of points in the star. It supports a minimum of 3 and a maximum of 60 points. Set the + count to 3 and the \l ratio to 0.5 to create a triangle. + + The default value is 6. +*/ + property int count: 6 + +/*! + The distance of the inner points of the star from the center. This + is represented as percentage of the star's diameter. + + The default value is 0.5. +*/ + property real ratio: 0.5 + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== "undefined" + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + + // This is used to make the bounding box of the item a bit bigger so it will draw sharp edges + // in case of large stroke width instead of cutting it off. + Item { + anchors.fill: parent + anchors.margins: -root.strokeWidth + } + + ShapePath { + id: path + + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + strokeWidth: 4 + strokeColor: "red" + startX: 0 + startY: 0 + } + + onWidthChanged: root.constructPolygon() + onHeightChanged: root.constructPolygon() + onCountChanged: root.constructPolygon() + onRadiusChanged: root.constructPolygon() + onRatioChanged: root.constructPolygon() + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + + root.constructPolygon() + } + + property real __centerX: root.width / 2 + property real __centerY: root.height / 2 + + Component { + id: myPathLine + PathLine {} + } + + Component { + id: myPathArc + PathArc {} + } + + function constructPolygon() { + root.clearPathElements() + + if (root.radius === 0) + root.constructPolygonPath() + else + root.constructRoundedPolygonPath() + } + + function toRadians(degrees) { + return degrees * (Math.PI / 180.0) + } + + function toDegrees(radians) { + return radians * (180.0 / Math.PI) + } + + function getPoints() { + let numPoints = root.count * 2 + let sliceAngle = (360.0 / numPoints) + // The Draftsman's Method + let a = root.width / 2 // x-radius + let b = root.height / 2 // y-radius + let points = [] + let r = Math.min(Math.max(root.ratio, 0.001), 1.0) + + for (var corner = 0; corner < numPoints; corner++) { + let angleToCorner = root.toRadians(corner * sliceAngle) + // Start at top center + let x = root.__centerX + a * Math.sin(angleToCorner) + let y = root.__centerY - b * Math.cos(angleToCorner) + + // If the corner is an odd number, move the point towards the center by the ratio (0.001 - 1.0) + if (corner % 2 === 1) { + let vec = Qt.vector2d(x - root.__centerX, y - root.__centerY) + let vecLength = vec.length() + vec = vec.normalized().times(vecLength * r) + + x = root.__centerX + vec.x + y = root.__centerY + vec.y + } + + points.push(Qt.point(x ,y)) + } + + return points + } + + function constructPolygonPath() { + let angle = (360.0 / root.sideCount) + let points = root.getPoints() + + for (var i = 0; i < points.length; i++) { + if (i === 0) { + path.startX = points[i].x + path.startY = points[i].y + } else { + let pathLine = myPathLine.createObject(path) + pathLine.x = points[i].x + pathLine.y = points[i].y + path.pathElements.push(pathLine) + } + } + + // Close the polygon + var pathLineClose = myPathLine.createObject(path) + pathLineClose.x = points[0].x + pathLineClose.y = points[0].y + path.pathElements.push(pathLineClose) + } + + function wrapIndex(index, size) { + return (index + size) % size + } + + function constructRoundedPolygonPath() { + let angle = (360.0 / root.sideCount) + let points = root.getPoints() + + for (var i = 0; i < points.length; i++) { + let a = points[root.wrapIndex(i, points.length)] + let b = points[root.wrapIndex(i - 1, points.length)] + let c = points[root.wrapIndex(i + 1, points.length)] + + let vAB = Qt.vector2d(b.x - a.x, b.y - a.y) + let vAC = Qt.vector2d(c.x - a.x, c.y - a.y) + + let alpha = Math.acos(vAB.dotProduct(vAC) / (vAB.length() * vAC.length())) // as radians + + let t = root.radius * (1 / Math.tan(alpha / 2)) + + let p1 = vAB.normalized().times(t).plus(Qt.vector2d(a.x, a.y)) + let p2 = vAC.normalized().times(t).plus(Qt.vector2d(a.x, a.y)) + + + if (i === 0) { + path.startX = p1.x + path.startY = p1.y + } else { + let pathLine = myPathLine.createObject(path) + pathLine.x = p1.x + pathLine.y = p1.y + path.pathElements.push(pathLine) + } + + let pathArc = myPathArc.createObject(path) + pathArc.x = p2.x + pathArc.y = p2.y + pathArc.radiusX = root.radius + pathArc.radiusY = root.radius + + if (i % 2 === 1) + pathArc.direction = PathArc.Counterclockwise + + path.pathElements.push(pathArc) + } + + // Close the polygon + var pathLineClose = myPathLine.createObject(path) + pathLineClose.x = path.startX + pathLineClose.y = path.startY + path.pathElements.push(pathLineClose) + } + + function clearPathElements() { + for (var i = 0; i !== path.pathElements.length; ++i) + path.pathElements[i].destroy() + + path.pathElements = [] + } +} diff --git a/Dependencies/Components/imports/components/StraightArrow.qml b/Dependencies/Components/imports/components/StraightArrow.qml new file mode 100644 index 0000000..e949435 --- /dev/null +++ b/Dependencies/Components/imports/components/StraightArrow.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +Item { + + width: 200 + height: 200 + id: root + property bool flip: false + property bool rotate: false + + property int thickness: 45 + + property int arrowSize: 80 + + property int radius: 5 + property color color: "#b6b3b3" + + property bool corner: false + + property bool flipCorner: false + + Item { + id: content + implicitWidth: Math.max(16, childrenRect.width + childrenRect.x) + implicitHeight: Math.max(16, childrenRect.height + childrenRect.y) + anchors.centerIn: parent + + scale: root.flip ? -1 : 1 + rotation: root.rotate ? 90 : 0 + + TriangleItem { + id: triangle + x: 0 + y: 0 + anchors.verticalCenter: rectangle.verticalCenter + rotation: -90 + strokeWidth: -1 + width: root.arrowSize + height: root.arrowSize + radius: root.radius + fillColor: root.color + } + + RectangleItem { + id: rectangle + x: root.arrowSize - root.radius * 2 + //y: ((root.rotate ? root.width : root.height) - root.thickness) / 2 + width: (root.rotate ? root.height : root.width) - (root.arrowSize - root.radius * 2) + height: root.thickness + strokeWidth: -1 + radius: root.radius + fillColor: root.color + } + RectangleItem { + id: rectangle1 + x: 260 + y: 202 + width: root.corner ? root.thickness : 0 + strokeWidth: -1 + height: root.corner ? (root.rotate ? root.width : root.height) / 2 : 0 + anchors.bottom: root.flipCorner ? undefined : rectangle.verticalCenter + anchors.top: root.flipCorner ? rectangle.verticalCenter : undefined + anchors.right: rectangle.right + fillColor: root.color + visible: root.corner + } + } +} diff --git a/Dependencies/Components/imports/components/SvgPathItem.qml b/Dependencies/Components/imports/components/SvgPathItem.qml new file mode 100644 index 0000000..7654712 --- /dev/null +++ b/Dependencies/Components/imports/components/SvgPathItem.qml @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype SvgPathItem + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A path defined using an SVG path data string. + + The SvgPathItem type uses an SVG path data string to draw a path as a line. + + The \l strokeColor, \l strokeWidth, and \l strokeStyle, properties specify the appearance of the + path. The \l dashPattern and \l dashOffset properties specify the appearance of dashed lines. + + The \l capStyle property specifies whether line ends are square or rounded. + + The \l joinStyle property specifies how to connect two path segments. If the path segments + enclose areas, they can be painted using either a solid fill color, specified using the + \l fillColor property, or a gradient, defined using one of the \l ShapeGradient subtypes and set + using the \l gradient property. If both a color and a gradient are specified, the gradient is + used. + + If the path has curves, it may be appropriate to set the \c antialiasing property that is + inherited from \l Item to improve its appearance. + + \section2 Example Usage + + \image studio-svgpathitem.webp + + The QML code looks as follows: + + \code + SvgPathItem { + id: sVGPathItem + x: 2 + y: 3 + width: 152 + height: 154 + strokeWidth: 4 + strokeColor: "black" + path: "M127.99,0 L150.061,124.052 L22.0704,146.823 L0,22.7711 L127.99,0" + fillColor: "transparent" + } + + SvgPathItem { + id: sVGPathItem1 + x: 56.32 + y: 44.32 + width: 150.06 + height: 146.82 + strokeWidth: 4 + strokeColor: "black" + path: "M127.99,0 L150.061,124.052 L22.0704,146.823 L0,22.7711 L127.99,0" + fillColor: "transparent" + } + + SvgPathItem { + id: sVGPathItem2 + x: 3.18 + y: 27.38 + width: 55 + height: 40 + strokeWidth: 4 + strokeColor: "black" + path: "M0,0 L55,40" + fillColor: "transparent" + } + + SvgPathItem { + id: sVGPathItem3 + x: 130.21 + y: 2.41 + width: 55 + height: 42 + strokeWidth: 4 + strokeColor: "black" + path: "M0,0 L55,42" + fillColor: "transparent" + } + + SvgPathItem { + id: sVGPathItem4 + x: 22 + y: 148 + width: 56 + height: 43 + strokeWidth: 4 + strokeColor: "black" + path: "M0,0 L54,40" + fillColor: "transparent" + } + + SvgPathItem { + id: sVGPathItem5 + x: 151.21 + y: 126.41 + width: 55 + height: 42 + strokeWidth: 4 + strokeColor: "black" + path: "M0,0 L55,42" + fillColor: "transparent" + } + clip: false + \endcode + +*/ + +Shape { + id: root + width: 200 + height: 200 + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {SVG Path Item} +*/ + property alias gradient: shape.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.MiterJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.SquareCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {SVG Path Item} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {SVG Path Item} +*/ + property alias strokeWidth: shape.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {SVG Path Item} +*/ + property alias strokeColor: shape.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {SVG Path Item} +*/ + property alias dashPattern: shape.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {SVG Path Item} +*/ + property alias fillColor: shape.fillColor + +/*! + \qmlproperty string SvgPathItem::path + + The SVG path data string specifying the path. + + For more information, see \l{https://www.w3.org/TR/SVG/paths.html#PathData} {W3C SVG Path Data}. +*/ + property alias path: pathSvg.path + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {SVG Path Item} +*/ + property alias dashOffset: shape.dashOffset + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== undefined + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + + ShapePath { + id: shape + strokeWidth: 4 + strokeColor: "red" + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + + PathSvg { + id: pathSvg + + path: "M91,70.6c4.6,0,8.6,2.4,10.9,6.3l19.8,34.2c2.3,3.9,2.3,8.7,0,12.6c-2.3,3.9-6.4,6.3-10.9,6.3H71.2 c-4.6,0-8.6-2.4-10.9-6.3c-2.3-3.9-2.3-8.7,0-12.6l19.8-34.2C82.4,72.9,86.4,70.6,91,70.6z" + } + } + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + } +} diff --git a/Dependencies/Components/imports/components/TextItem.qml b/Dependencies/Components/imports/components/TextItem.qml new file mode 100644 index 0000000..843a96c --- /dev/null +++ b/Dependencies/Components/imports/components/TextItem.qml @@ -0,0 +1,270 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype Text + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + \inherits Text + + \brief A filled text with an optional border. + + A text can be a text shaped stroke, a filling, or a stroke with filling. The + \l strokeColor, \l strokeWidth, and \l strokeStyle properties specify the appearance of the + outline. The \l dashPattern and \l dashOffset properties specify the appearance of a dashed + stroke. + + The area inside the text is painted using either a solid fill color, specified using the + \l fillColor property, or a gradient, defined using one of the \l ShapeGradient subtypes and set + using the \l gradient property. If both a color and a gradient are specified, the gradient is + used. + + To create a text with a stroke, set a \l strokeWidth property that is greater than 0. The + \l strokeWidth property specifies the width of the text stroke. The default \l strokeWidth + value is 4. Setting the \l strokeWidth value to -1 hides the border. + + Text supports only plain strings. The \l font properties are applied to the \l text. + + \section2 Example Usage + + \image studio-text.webp + + The QML code looks as follows: + + \code + TextItem { + id: _text + x: 874 + y: 213 + text: qsTr("Qt") + font.pixelSize: 120 + fillColor: "#00ffffff" + strokeColor: "#1e8f00" + font.bold: true + strokeWidth: 2 + } + + TextItem { + id: _text1 + x: 1033 + y: 213 + text: qsTr("Qt") + font.pixelSize: 120 + gradient: LinearGradient { + y2: _text1.height * 1 + y1: _text1.height * 0 + x2: _text1.width * 1 + x1: _text1.width * 0 + GradientStop { + position: 0 + color: "#00d158" + } + + GradientStop { + position: 0.55263 + color: "#ffffff" + } + } + strokeWidth: 2 + strokeColor: "#ff0000" + font.bold: true + } + + TextItem { + id: _text2 + x: 874 + y: 402 + text: qsTr("Qt") + font.pixelSize: 120 + strokeStyle: 3 + strokeWidth: 2 + strokeColor: "#474747" + font.bold: true + } + + TextItem { + id: _text3 + x: 1033 + y: 402 + text: qsTr("Qt") + font.pixelSize: 120 + gradient: RadialGradient { + focalY: _text3.height * 0.5 + focalX: _text3.width * 0.5 + focalRadius: Math.min(_text3.width, _text3.height) * 0 + centerY: _text3.height * 0.5 + centerX: _text3.width * 0.5 + centerRadius: Math.min(_text3.width, _text3.height) * 0.5 + + GradientStop { + position: 0.10526 + color: "#00ffab" + } + + GradientStop { + position: 1 + color: "#ff000000" + } + } + strokeWidth: -1 + strokeColor: "#1e8f00" + font.bold: true + } + \endcode +*/ + +Shape { + id: root + width: textMetrics.advanceWidth + height: Math.ceil(textMetrics.height) // TODO + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {text} +*/ + property alias gradient: path.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.MiterJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.SquareCap //workaround for regression in Qt 6.6.1 (QDS-11845) + + /*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {text} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {text} +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {text} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {text} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {text} +*/ + property alias fillColor: path.fillColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {text} +*/ + property alias dashOffset: path.dashOffset + +/*! + The font properties for the \l text. Change the \l {QFont::family} {family}, + \l {QFont::letterSpacing} {letterSpacing}, \l {QFont::pixelSize} {pixelSize}, + \l {QFont::wordSpacing} {wordSpacing}, \l {QFont::weight} {weight} of the \l text using these + properties.You can also set wheather the \l text has auto \l {QFont::kerning} {kerning} or if it + follows the \l {QtQuick::Text::font.preferShaping} {preferShaping} using the font specific + features. Also sets your preferred font \l {QFont::capitalization} {capitalization} method and + \l {QFont::styleName} {styleName} for the \l text. + + \sa QFont Text +*/ + property alias font: pathText.font + +/*! + The text to display. Text supports only plain strings. + + \sa QFont Text +*/ + property alias text: pathText.text + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== "undefined" + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + + // This is used to make the bounding box of the item a bit bigger so it will draw sharp edges + // in case of large stroke width instead of cutting it off. + Item { + anchors.fill: parent + anchors.margins: -root.strokeWidth + } + + ShapePath { + id: path + + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + strokeWidth: 4 + strokeColor: "red" + startX: 0 + startY: 0 + + PathText { + id: pathText + x: 0 + y: fontMetrics.height + textMetrics.tightBoundingRect.y - fontMetrics.descent + font.family: "Arial" + } + } + + TextMetrics { + id: textMetrics + font: pathText.font + text: pathText.text + } + + FontMetrics { + id: fontMetrics + font: pathText.font + } + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + } +} diff --git a/Dependencies/Components/imports/components/TriangleItem.qml b/Dependencies/Components/imports/components/TriangleItem.qml new file mode 100644 index 0000000..3009efb --- /dev/null +++ b/Dependencies/Components/imports/components/TriangleItem.qml @@ -0,0 +1,428 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Shapes + +/*! + \qmltype Triangle + \inqmlmodule QtQuick.Studio.Components + \since QtQuick.Studio.Components 1.0 + \inherits Shape + + \brief A triangle. + + The Triangle type can be used to draw triangles with different dimensions and shapes. The type + is enclosed in an invisible \l Rectangle type. The size of the triangle is determined by the + size of the bounding rectangle. The dimensions of the triangle can be changed to make it + elongated or squat with space around it by using the \l leftMargin, \l topMargin, \l rightMargin, + and \l bottomMargin properties. The margins are set between the triangle and the edges of the + parent rectangle. + + Each Triangle item is painted using either a solid fill color, specified using the \l fillColor + property, or a gradient, defined using one of the \l ShapeGradient subtypes and set using the + \l gradient property. If both a color and a gradient are specified, the gradient is used. + + An optional border can be added to a triangle with its own color and thickness by setting the + \l strokeColor and \l strokeWidth properties. Setting the color to \c transparent creates a + border without a fill color. + + \section2 Example Usage + + You can use the Triangle component in \QDS to create triangles in different shapes and colors. + + \image studio-triangle.webp + + The QML code looks as follows: + + \code + TriangleItem { + id: triangle + x: 845 + y: 265 + strokeColor: "gray" + fillColor: "light gray" + } + + TriangleItem { + id: squatTriangle + x: 1009 + y: 265 + bottomMargin: 10 + topMargin: 30 + fillColor: "#d3d3d3" + strokeColor: "#808080" + } + + TriangleItem { + id: elongatedTriangle + x: 845 + y: 394 + rightMargin: 10 + leftMargin: 10 + fillColor: "#d3d3d3" + strokeColor: "#808080" + } + + TriangleItem { + id: pear + x: 1009 + y: 394 + radius: 20 + fillColor: "light gray" + bottomMargin: 10 + arcRadius: 20 + strokeColor: "#808080" + } + \endcode +*/ + +Shape { + id: root + + width: 100 + height: 100 + +/*! + \include CommonItemDescriptions.qdocinc {component-gradient} {triangle} +*/ + property alias gradient: path.fillGradient + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeWidth} {triangle} +*/ + property alias strokeWidth: path.strokeWidth + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeColor} {triangle} +*/ + property alias strokeColor: path.strokeColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashPattern} {triangle} +*/ + property alias dashPattern: path.dashPattern + +/*! + \include CommonItemDescriptions.qdocinc component-joinStyle +*/ + //property alias joinStyle: path.joinStyle + property int joinStyle: ShapePath.MiterJoin //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc component-capStyle +*/ + //property alias capStyle: path.capStyle + property int capStyle: ShapePath.FlatCap //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-strokeStyle} {triangle} +*/ + //property alias strokeStyle: path.strokeStyle + property int strokeStyle: ShapePath.SolidLine //workaround for regression in Qt 6.6.1 (QDS-11845) + +/*! + \include CommonItemDescriptions.qdocinc {component-fillColor} {triangle} +*/ + property alias fillColor: path.fillColor + +/*! + \include CommonItemDescriptions.qdocinc {component-dashOffset} {triangle} +*/ + property alias dashOffset: path.dashOffset + + property int pLineXStart + property int pLineXEnd + property int pLineYStart + property int pLineYEnd + + property point topIntersection1 + property point topIntersection2 + property point leftIntersection1 + property point leftIntersection2 + property point rightIntersection1 + property point rightIntersection2 + +/*! + \include CommonItemDescriptions.qdocinc {component-radius} {5} + + This property can be used together with the \l arcRadius property to determine the shape of the + triangle. + + \sa arcRadius +*/ + property int radius: 5 + +/*! + \include CommonItemDescriptions.qdocinc {component-radius} {5} + + This property can be used together with the \l radius property to + determine the shape of the triangle. +*/ + property real arcRadius: root.radius + +/*! + The left margin between the triangle and the bounding rectangle. + Setting the left and right margins makes the triangle thinner and moves it away from the edge. + + \sa rightMargin, topMargin, bottomMargin +*/ + property real leftMargin: 0 + +/*! + The top margin between the triangle and the bounding rectangle. + Setting the top and bottom margins makes the triangle lower and moves it away from the edge. + + \sa bottomMargin, leftMargin, rightMargin +*/ + property real topMargin: 0 + +/*! + The right margin between the triangle and the bounding rectangle. + Setting the left and right margins makes the triangle thinner and moves it away from the edge. + + \sa leftMargin, topMargin, bottomMargin +*/ + property real rightMargin: 0 + +/*! + \qmlproperty real Triangle::bottomMargin + + The top margin between the triangle and the bounding rectangle. + Setting the top and bottom margins makes the triangle shorter and moves it away from the edge. + + \sa topMargin, leftMargin, rightMargin +*/ + property real bottomMargin: 0 + + property int maxRadius: 0 + + property bool __preferredRendererTypeAvailable: root.preferredRendererType !== undefined + property bool __curveRendererActive: root.__preferredRendererTypeAvailable + && root.rendererType === Shape.CurveRenderer + + layer.enabled: root.antialiasing && !root.__curveRendererActive + layer.smooth: root.antialiasing && !root.__curveRendererActive + layer.samples: root.antialiasing && !root.__curveRendererActive ? 4 : 0 + + // This is used to make the bounding box of the item a bit bigger so it will draw sharp edges + // in case of large stroke width instead of cutting it off. + Item { + anchors.fill: parent + anchors.margins: -root.strokeWidth + } + + ShapePath { + id: path + + //property real __width: root.width - root.strokeWidth - root.leftMargin - root.rightMargin + //property real __height: root.height - root.strokeWidth - root.topMargin - root.bottomMargin + //property real xOffset: root.strokeWidth / 2 + root.leftMargin + //property real yOffset: root.strokeWidth / 2 + root.topMargin + + property real __width: root.width - root.leftMargin - root.rightMargin + property real __height: root.height - root.topMargin - root.bottomMargin + property real xOffset: root.leftMargin + property real yOffset: root.topMargin + + strokeWidth: 4 + strokeColor: "red" + capStyle: root.capStyle + strokeStyle: root.strokeStyle + joinStyle: root.joinStyle + + startX: root.topIntersection1.x + path.xOffset + startY: root.topIntersection1.y + path.yOffset + + PathArc { + radiusX: Math.max(root.arcRadius, 1) + radiusY: Math.max(root.arcRadius, 1) + + x: root.topIntersection2.x + path.xOffset + y: root.topIntersection2.y + path.yOffset + } + + PathLine { + x: root.rightIntersection1.x + path.xOffset + y: root.rightIntersection1.y + path.yOffset + } + + PathArc { + radiusX: Math.max(root.arcRadius, 1) + radiusY: Math.max(root.arcRadius, 1) + + x: root.rightIntersection2.x + path.xOffset + y: root.rightIntersection2.y + path.yOffset + } + + PathLine { + x: root.leftIntersection1.x + path.xOffset + y: root.leftIntersection1.y + path.yOffset + } + + PathArc { + radiusX: Math.max(root.arcRadius, 1) + radiusY: Math.max(root.arcRadius, 1) + + x: root.leftIntersection2.x + path.xOffset + y: root.leftIntersection2.y + path.yOffset + } + + PathLine { + x: root.topIntersection1.x + path.xOffset + y: root.topIntersection1.y + path.yOffset + } + } + + onWidthChanged: root.calc() + onHeightChanged: root.calc() + + onRadiusChanged: root.calc() + onArcRadiusChanged: root.calc() + + onTopMarginChanged: root.calc() + onBottomMarginChanged: root.calc() + onLeftMarginChanged: root.calc() + onRightMarginChanged: root.calc() + + Component.onCompleted: { + // If preferredRendererType wasn't set initially make CurveRenderer the default + if (root.__preferredRendererTypeAvailable && root.preferredRendererType === Shape.UnknownRenderer) + root.preferredRendererType = Shape.CurveRenderer + + root.calc() + } + + function length(x, y) { + return Math.sqrt(x * x + y * y) + } + + function normalize(x, y) { + var l = length(x, y) + + return { + x: x / l, + y: y / l + } + } + + function dotProduct(x1, y1, x2, y2) { + return x1 * x2 + y1 * y2; + } + + function project(x1, y1, x2, y2) { + var normalized = normalize(x1, y1) + + var dot = dotProduct(normalized.x, normalized.y, x2, y2) + + return { + x: normalized.x * dot, + y: normalized.y * dot + } + } + + function intersect(x1, y1, x2, y2, x3, y3, x4, y4) { + var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1) + + var ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom + var ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom + return { + x: x1 + ua * (x2 - x1), + y: y1 + ua * (y2 - y1) + }; + } + + function moveLine(startX, startY, endX, endY) { + var angle = Math.atan2(endY - startY, endX - startX) + var xOffset = Math.sin(angle) * Math.min(root.radius, root.maxRadius) + var yOffset = -Math.cos(angle) * Math.min(root.radius, root.maxRadius) + + return { + startX: startX + xOffset, + startY: startY + yOffset, + endX: endX + xOffset, + endY: endY + yOffset + }; + } + + function calc() { + var movedLine1 = moveLine(path.__width / 2, 0, 0, path.__height) + var movedLine2 = moveLine(path.__width, path.__height, path.__width / 2, 0) + var movedLine3 = moveLine(0, path.__height, path.__width, path.__height) + + var lengthLine1 = Math.floor(root.length(movedLine1.endX - movedLine1.startX, + movedLine1.endY - movedLine1.startY)) + var lengthLine2 = Math.floor(root.length(movedLine2.endX - movedLine2.startX, + movedLine2.endY - movedLine2.startY)) + var lengthLine3 = Math.floor(root.length(movedLine3.endX - movedLine3.startX, + movedLine3.endY - movedLine3.startY)) + + var perimeter = lengthLine1 + lengthLine2 + lengthLine3 + var area = (path.__height) * (path.__width) * 0.5 + + root.maxRadius = area * 2 / perimeter + + var intersectionTop = root.intersect(movedLine1.startX, movedLine1.startY, + movedLine1.endX, movedLine1.endY, + movedLine2.startX, movedLine2.startY, + movedLine2.endX, movedLine2.endY) + var intersectionLeft = root.intersect(movedLine1.startX, movedLine1.startY, + movedLine1.endX, movedLine1.endY, + movedLine3.startX, movedLine3.startY, + movedLine3.endX, movedLine3.endY) + var intersectionRight = root.intersect(movedLine2.startX, movedLine2.startY, + movedLine2.endX, movedLine2.endY, + movedLine3.startX, movedLine3.startY, + movedLine3.endX, movedLine3.endY) + + var leftBottom = root.project(1, 0, intersectionLeft.x, intersectionLeft.y) + var rightBottom = root.project(1, 0, intersectionRight.x, intersectionRight.y) + + root.leftIntersection1 = Qt.point(leftBottom.x, leftBottom.y + path.__height) + root.rightIntersection2 = Qt.point(rightBottom.x, rightBottom.y + path.__height) + + var leftTop = root.project(-path.__width / 2 , path.__height, + intersectionTop.x - path.__width / 2, intersectionTop.y) + + leftBottom = root.project(-path.__width / 2 , path.__height, + intersectionLeft.x - path.__width / 2, intersectionLeft.y) + + root.leftIntersection2 = Qt.point(leftBottom.x + path.__width / 2, leftBottom.y) + root.topIntersection1 = Qt.point(leftTop.x + path.__width / 2, leftTop.y) + + var rightTop = root.project(path.__width / 2 , path.__height, + intersectionTop.x - path.__width / 2, intersectionTop.y) + + rightBottom = root.project(path.__width / 2 , path.__height, + intersectionRight.x - path.__width / 2, intersectionRight.y) + + root.topIntersection2 = Qt.point(rightTop.x + path.__width / 2, rightTop.y) + root.rightIntersection1 = Qt.point(rightBottom.x + path.__width / 2, rightBottom.y) + } +} diff --git a/Dependencies/Components/imports/components/plugins.qmltypes b/Dependencies/Components/imports/components/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/components/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.11" + ] +} diff --git a/Dependencies/Components/imports/components/qmldir b/Dependencies/Components/imports/components/qmldir new file mode 100644 index 0000000..d791569 --- /dev/null +++ b/Dependencies/Components/imports/components/qmldir @@ -0,0 +1,15 @@ +ArcArrow 1.0 ArcArrow.qml +ArcItem 1.0 ArcItem.qml +BorderItem 1.0 BorderItem.qml +EllipseItem 1.0 EllipseItem.qml +FlipableItem 1.0 FlipableItem.qml +GroupItem 1.0 GroupItem.qml +IsoItem 1.0 IsoItem.qml +PieItem 1.0 PieItem.qml +RectangleItem 1.0 RectangleItem.qml +RegularPolygonItem 1.0 RegularPolygonItem.qml +StarItem 1.0 StarItem.qml +StraightArrow 1.0 StraightArrow.qml +SvgPathItem 1.0 SvgPathItem.qml +TextItem 1.0 TextItem.qml +TriangleItem 1.0 TriangleItem.qml diff --git a/Dependencies/Components/imports/components/qtstudiocomponentsplugin.cpp b/Dependencies/Components/imports/components/qtstudiocomponentsplugin.cpp new file mode 100644 index 0000000..43c4ddb --- /dev/null +++ b/Dependencies/Components/imports/components/qtstudiocomponentsplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class QtStudioComponentsPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtStudioComponentsPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +QtStudioComponentsPlugin::QtStudioComponentsPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void QtStudioComponentsPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "qtstudiocomponentsplugin.moc" diff --git a/Dependencies/Components/imports/designeffects/CMakeLists.txt b/Dependencies/Components/imports/designeffects/CMakeLists.txt new file mode 100644 index 0000000..f66ad7b --- /dev/null +++ b/Dependencies/Components/imports/designeffects/CMakeLists.txt @@ -0,0 +1,40 @@ +qt_add_library(QuickStudioDesignEffects STATIC) +qt6_add_qml_module(QuickStudioDesignEffects + URI "QtQuick.Studio.DesignEffects" + VERSION "${PROJECT_VERSION}" + DESIGNER_SUPPORTED + RESOURCE_PREFIX "/qt-project.org/imports" + PAST_MAJOR_VERSIONS 1 + ${qds_qml_extra_args} + PAST_MAJOR_VERSIONS 1 + QML_FILES + DesignBackgroundBlurPrivate.qml + DesignDropShadow.qml + DesignDropShadowPrivate.qml + DesignEffect.qml + DesignEffectPrivate.qml + DesignInnerShadow.qml + DesignInnerShadowPrivate.qml + DesignLayerBlurPrivate.qml +) + +set_target_properties(QuickStudioDesignEffects PROPERTIES + QT_QMLCACHEGEN_EXECUTABLE qmlcachegen +) + +qt6_add_shaders(QuickStudioDesignEffects "designeffectsshaders" + BATCHABLE + PRECOMPILE + OPTIMIZED + PREFIX + "/qt-project.org/imports/QtQuick/Studio/DesignEffects" + FILES + "shaders/dropShadow.frag" + "shaders/dropShadowClip.frag" + "shaders/gaussianBlur.frag" + "shaders/innerShadow.frag" + "shaders/innerShadowClip.frag" + "shaders/opacityMask.frag" +) + +register_plugin(QuickStudioDesignEffects) diff --git a/Dependencies/Components/imports/designeffects/DesignBackgroundBlurPrivate.qml b/Dependencies/Components/imports/designeffects/DesignBackgroundBlurPrivate.qml new file mode 100644 index 0000000..2c13187 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignBackgroundBlurPrivate.qml @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +Item { + id: root + + property real radius: 10 + + /*required*/ property Item source + /*required*/ property Item background + + readonly property real sourceRotation: root.source.rotation + + readonly property size textureSize: Qt.size(root.targetRect.width, + root.targetRect.height) + readonly property vector2d pixelSize: Qt.vector2d(1.0 / root.textureSize.width, + 1.0 / root.textureSize.height) + readonly property real sigma: root.radius / 2.7 + + visible: true + + width: root.source.width + height: root.source.height + + rotation: -root.sourceRotation + + property rect targetRect: Qt.rect(0, 0, 0, 0) + + Connections { + target: root.background + function onXChanged() { root.sizeStuff() } + function onYChanged() { root.sizeStuff() } + function onWidthChanged() { root.sizeStuff() } + function onHeightChanged() { root.sizeStuff() } + } + + Connections { + target: root.source + + function onXChanged() { root.sizeStuff() } + function onYChanged() { root.sizeStuff() } + function onWidthChanged() { root.sizeStuff() } + function onHeightChanged() { root.sizeStuff() } + function onRotationChanged() { root.sizeStuff() } + } + + onSourceChanged: root.sizeStuff() + onBackgroundChanged: root.sizeStuff() + + function sizeStuff() { + if (root.background === null) + return + + let tRect = Qt.rect(0, 0, root.source.width, root.source.height) + root.targetRect = root.background.mapFromItem(root.source, tRect) + } + + //Component.onCompleted: console.log("Background Blur created!") + + // TODO + // Check if target and background overlap + // Check if target is actually transparent + + ShaderEffectSource { + id: shaderEffectSource + visible: false + width: root.width + height: root.height + sourceItem: root.background + sourceRect: root.targetRect + } + + ShaderEffect { + id: blurHorizontal + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: shaderEffectSource + property vector2d pixelSize: root.pixelSize.times(Qt.vector2d(1, 0)) + property bool useOffscreenColor: false + property color offscreenColor: "transparent" + + visible: false + + width: root.textureSize.width + height: root.textureSize.height + anchors.centerIn: parent + + layer.enabled: true + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } + + ShaderEffect { + id: blurVertical + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: blurHorizontal + property vector2d pixelSize: root.pixelSize.times(Qt.vector2d(0, 1)) + property bool useOffscreenColor: false + property color offscreenColor: "transparent" + + visible: false + + width: root.textureSize.width + height: root.textureSize.height + anchors.centerIn: parent + + layer.enabled: true + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } + + Item { + id: wrapper + anchors.centerIn: parent + + width: root.textureSize.width + height: root.textureSize.height + + visible: false + layer.enabled: true + + ShaderEffectSource { + id: shaderEffectSource2 + visible: true + anchors.centerIn: parent + rotation: root.sourceRotation + + width: root.source.width + height: root.source.height + sourceItem: root.source + } + } + + ShaderEffect { + id: mask + + property var source: blurVertical + property var maskSource: wrapper + + visible: true + + width: root.textureSize.width + height: root.textureSize.height + + anchors.centerIn: parent + fragmentShader: "shaders/opacityMask.frag.qsb" + } +} diff --git a/Dependencies/Components/imports/designeffects/DesignDropShadow.qml b/Dependencies/Components/imports/designeffects/DesignDropShadow.qml new file mode 100644 index 0000000..b5907ba --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignDropShadow.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Controls + +QtObject { + property real blur: 4 + property int offsetX: 0 + property int offsetY: 4 + property int spread: 0 + property color color: "#3f000000" // black 25% + property bool showBehind: false + property bool visible: true + + property string type: "DropShadow" +} diff --git a/Dependencies/Components/imports/designeffects/DesignDropShadowPrivate.qml b/Dependencies/Components/imports/designeffects/DesignDropShadowPrivate.qml new file mode 100644 index 0000000..43c786a --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignDropShadowPrivate.qml @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +Item { + id: root + + property int horizontalOffset: 10 + property int verticalOffset: 30 + property int spread: 0 + property color color: "black" + property real radius: 10 + + property bool showBehind: false + + required property Item source + + readonly property real sourceRotation: root.source.rotation + readonly property real radiusCeiled: Math.ceil(root.radius) + + readonly property size orginialTextureSize: Qt.size(root.width + root.spread * 2, + root.height + root.spread * 2) + readonly property real sigma: root.radius / 2.7 + + visible: true + + width: root.source.width + height: root.source.height + + //Component.onCompleted: console.log("Drop Shadow created!") + + onSourceRotationChanged: root.calculateOffset() + onRadiusCeiledChanged: root.calculateOffset() + onSpreadChanged: root.calculateOffset() + onHorizontalOffsetChanged: root.calculateOffset() + onVerticalOffsetChanged: root.calculateOffset() + + signal geometryChanged() + + property point __offset: Qt.point(0, 0) + + function calculateOffset() { + let mat = Qt.matrix4x4() + mat.translate(Qt.vector3d(-root.spread, -root.spread, 0)) + mat.translate(Qt.vector3d(-root.radiusCeiled, -root.radiusCeiled, 0)) + mat.rotate(-root.sourceRotation, Qt.vector3d(0, 0, 1)) + root.__offset = mat.map(Qt.point(root.horizontalOffset, root.verticalOffset)) + root.__offset = Qt.point(Math.round(root.__offset.x), Math.round(root.__offset.y)) + + root.geometryChanged() + } + + readonly property bool copyActive: root.source instanceof Rectangle && root.spread !== 0 + + Rectangle { + id: sourceCopy + visible: false + width: Math.max(0, root.source.width + root.spread * 2) + height: Math.max(0, root.source.height + root.spread * 2) + radius: Math.max(0, root.source.radius !== 0 ? root.source.radius + root.spread : 0) + color: "black" + } + + ShaderEffectSource { + id: shaderEffectSource + visible: false + width: root.orginialTextureSize.width + height: root.orginialTextureSize.height + sourceItem: root.copyActive ? sourceCopy : root.source + } + + ShaderEffect { + id: shadow + + property color color: root.color + property var src: shaderEffectSource + + visible: false + + width: root.orginialTextureSize.width + height: root.orginialTextureSize.height + + layer.enabled: true + layer.sourceRect: Qt.rect(-root.radiusCeiled, -root.radiusCeiled, + root.bluredTextureSize.width, root.bluredTextureSize.height) + + fragmentShader: "shaders/dropShadow.frag.qsb" + } + + readonly property size bluredTextureSize: Qt.size(root.orginialTextureSize.width + root.radiusCeiled * 2, + root.orginialTextureSize.height + root.radiusCeiled * 2) + + readonly property vector2d bluredPixelSize: Qt.vector2d(1.0 / root.bluredTextureSize.width, + 1.0 / root.bluredTextureSize.height) + + ShaderEffect { + id: blurHorizontal + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: shadow + property vector2d pixelSize: root.bluredPixelSize.times(Qt.vector2d(1, 0)) + property bool useOffscreenColor: false + property color offscreenColor: "transparent" + + visible: false + + width: root.bluredTextureSize.width + height: root.bluredTextureSize.height + + layer.enabled: true + layer.smooth: true // Otherwise bluring artifacts + + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } + + ShaderEffect { + id: blurVertical + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: blurHorizontal + property vector2d pixelSize: root.bluredPixelSize.times(Qt.vector2d(0, 1)) + property bool useOffscreenColor: false + property color offscreenColor: "transparent" + + visible: root.showBehind + + x: root.showBehind ? root.__offset.x : 0 + y: root.showBehind ? root.__offset.y : 0 + + width: root.bluredTextureSize.width + height: root.bluredTextureSize.height + + layer.enabled: !root.showBehind + layer.sourceRect: Qt.rect(Math.min(0, -root.__offset.x), + Math.min(0, -root.__offset.y), + root.offsetTextureSize.width, + root.offsetTextureSize.height) + + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } + + readonly property size offsetTextureSize: Qt.size(root.bluredTextureSize.width + Math.abs(root.__offset.x), + root.bluredTextureSize.height + Math.abs(root.__offset.y)) + + ShaderEffectSource { + id: originalSource + visible: false + width: root.offsetTextureSize.width + height: root.offsetTextureSize.height + sourceItem: root.source + sourceRect: Qt.rect(Math.min(0, root.__offset.x), + Math.min(0, root.__offset.y), + root.offsetTextureSize.width, + root.offsetTextureSize.height) + } + + ShaderEffect { + id: result + property var shadow: blurVertical + property var original: originalSource + + visible: !root.showBehind + + x: -Math.max(0, -root.__offset.x) + y: -Math.max(0, -root.__offset.y) + width: root.offsetTextureSize.width + height: root.offsetTextureSize.height + + fragmentShader: "shaders/dropShadowClip.frag.qsb" + } + + readonly property rect boundingBox: Qt.rect(result.x, result.y, result.width, result.height) + + onBoundingBoxChanged: root.geometryChanged() +} diff --git a/Dependencies/Components/imports/designeffects/DesignEffect.qml b/Dependencies/Components/imports/designeffects/DesignEffect.qml new file mode 100644 index 0000000..d0c5e2c --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignEffect.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +Item { + id: root + + // Use visible property to show and hide the effect. + visible: true + + // This is an internal property used to manage the effect. Do not modify. + property Item __oldParent: null + + // This is the main source for the effect. Set internally to the current parent item. Do not modify. + property Item source: null + + property list effects + + property bool layerBlurVisible: true + property real layerBlurRadius: 0 + property bool backgroundBlurVisible: true + property real backgroundBlurRadius: 0 + + property Item backgroundLayer: null + + property bool _isEffectItem: true + + onParentChanged: { + if (root.__oldParent && root.__oldParent !== root.parent) { + root.__oldParent.layer.enabled = false + root.__oldParent.layer.effect = null + root.source = null + root.__oldParent.update() + root.__oldParent = null + } + + if (root.parent) { + root.__oldParent = root.parent + if (root.visible) { + root.parent.layer.enabled = true + root.parent.layer.effect = effectComponent + } + root.source = root.parent + } + } + + onVisibleChanged: { + if (root.parent == null) + return + + if (root.visible) { + root.source = root.parent + root.parent.layer.enabled = true + root.parent.layer.effect = effectComponent + } else { + root.parent.layer.enabled = false + root.parent.layer.effect = null + root.source = null + } + root.parent.update() + } + + Component { + id: effectComponent + + DesignEffectPrivate { + id: effect + property bool __effect: true + source: root.source + + effects: root.effects + layerBlurVisible: root.layerBlurVisible + layerBlurRadius: root.layerBlurRadius + backgroundBlurVisible: root.backgroundBlurVisible + backgroundBlurRadius: root.backgroundBlurRadius + background: root.backgroundLayer + } + } +} + diff --git a/Dependencies/Components/imports/designeffects/DesignEffectPrivate.qml b/Dependencies/Components/imports/designeffects/DesignEffectPrivate.qml new file mode 100644 index 0000000..62d6b82 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignEffectPrivate.qml @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 Qt.labs.qmlmodels + +Item { + id: root + + required property Item source + + property list effects + + property Item background: null + + property bool layerBlurVisible: true + property real layerBlurRadius: 0 + property bool backgroundBlurVisible: true + property real backgroundBlurRadius: 0 + + onSourceChanged: root.source.antialiasing = false // Workaround + + width: root.source.width + height: root.source.height + + Component.onCompleted: root.calculateBoundingBox() + + function clamp(input: real, min: real, max: real): real { + + if (isNaN(input)) + return 0 + + return Math.max(min, Math.min(input, max)) + } + + property rect effectBoundingBox: Qt.rect(0, 0, 0, 0) + + function calculateBoundingBox() { + let x = 0 + let y = 0 + let width = root.width + let height = root.height + + for (let i = 0; i < repeater.count; ++i) { + let item = repeater.itemAt(i) + if (item === null || !(item instanceof DesignDropShadowPrivate)) + continue + + let childRect = item.boundingBox + + x = Math.min(x, childRect.x) + y = Math.min(y, childRect.y) + width = Math.max(width, childRect.width) + height = Math.max(height, childRect.height) + + width += Math.max(0, -x) // TODO Understand + height += Math.max(0, -y) + } + + root.effectBoundingBox = Qt.rect(x, y, width, height) + } + + DesignLayerBlurPrivate { + id: layerBlur + visible: root.layerBlurVisible + radius: root.clamp(root.layerBlurRadius, 0, 250) + + source: layerBlurSource + + x: root.effectBoundingBox.x - Math.ceil(layerBlur.radius) + y: root.effectBoundingBox.y - Math.ceil(layerBlur.radius) + } + + ShaderEffectSource { + id: layerBlurSource + visible: false + width: root.effectBoundingBox.width + height: root.effectBoundingBox.height + sourceItem: wrapper + sourceRect: root.effectBoundingBox + hideSource: root.layerBlurVisible + + //samples: 4 // Workaround + //smooth: true + } + + Item { + id: wrapper + anchors.fill: parent + + DesignBackgroundBlurPrivate { + visible: root.backgroundBlurVisible + && root.background !== null + && root.backgroundBlurRadius !== 0 + + source: root.source + + background: root.background + radius: root.clamp(root.backgroundBlurRadius, 0, 250) + } + + ShaderEffectSource { + id: shaderEffectSource + visible: true + width: root.width + height: root.height + sourceItem: root.source + hideSource: true + z: 1 + //samples: 4 // Workaround + } + + Repeater { + id: repeater + model: root.effects + + delegate: DelegateChooser { + role: "type" + + DelegateChoice { + roleValue: "DropShadow" + DesignDropShadowPrivate { + required property var modelData + + source: root.source + + horizontalOffset: root.clamp(modelData.offsetX, -0xffff, 0xffff) + verticalOffset: root.clamp(modelData.offsetY, -0xffff, 0xffff) + spread: root.clamp(modelData.spread, -2048, 2048) + color: modelData.color + radius: root.clamp(modelData.blur, 0, 250) + showBehind: modelData.showBehind + visible: modelData.visible + + onGeometryChanged: root.calculateBoundingBox() + } + } + + DelegateChoice { + roleValue: "InnerShadow" + DesignInnerShadowPrivate { + required property var modelData + + source: root.source + + horizontalOffset: root.clamp(modelData.offsetX, -0xffff, 0xffff) + verticalOffset: root.clamp(modelData.offsetY, -0xffff, 0xffff) + spread: root.clamp(modelData.spread, -2048, 2048) + color: modelData.color + radius: root.clamp(modelData.blur, 0, 250) + visible: modelData.visible + + z: 10 + } + } + } + } + } +} diff --git a/Dependencies/Components/imports/designeffects/DesignInnerShadow.qml b/Dependencies/Components/imports/designeffects/DesignInnerShadow.qml new file mode 100644 index 0000000..10ecc34 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignInnerShadow.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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.Controls + +QtObject { + property real blur: 4 + property int offsetX: 0 + property int offsetY: 4 + property int spread: 0 + property color color: "#3f000000" // black 25% + property bool showBehind: false // This is a dummy property mirroring DropShadow + property bool visible: true + + property string type: "InnerShadow" +} diff --git a/Dependencies/Components/imports/designeffects/DesignInnerShadowPrivate.qml b/Dependencies/Components/imports/designeffects/DesignInnerShadowPrivate.qml new file mode 100644 index 0000000..f753a54 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignInnerShadowPrivate.qml @@ -0,0 +1,179 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +Item { + id: root + + property int horizontalOffset: 10 + property int verticalOffset: 30 + property int spread: 0 + property color color: "black" + property real radius: 10 + + required property Item source + + readonly property real sourceRotation: root.source.rotation + + readonly property size textureSize: Qt.size(Math.max(root.width, root.width - root.spread * 2) + Math.abs(root.__offset.x), + Math.max(root.height, root.height - root.spread * 2) + Math.abs(root.__offset.y)) + readonly property vector2d pixelSize: Qt.vector2d(1.0 / root.textureSize.width, + 1.0 / root.textureSize.height) + readonly property real sigma: root.radius / 2.7 + + visible: true + + width: root.source.width + height: root.source.height + + //Component.onCompleted: console.log("Inner Shadow created!") + + onSourceRotationChanged: root.calculateOffset() + onSpreadChanged: root.calculateOffset() + onHorizontalOffsetChanged: root.calculateOffset() + onVerticalOffsetChanged: root.calculateOffset() + + property point __offset: Qt.point(0, 0) + + function calculateOffset() { + let mat = Qt.matrix4x4() + mat.rotate(-root.sourceRotation, Qt.vector3d(0, 0, 1)) + root.__offset = mat.map(Qt.point(root.horizontalOffset, root.verticalOffset)) + root.__offset = Qt.point(Math.round(root.__offset.x), Math.round(root.__offset.y)) + } + + readonly property bool copyActive: root.source instanceof Rectangle && root.spread !== 0 + + Rectangle { + id: sourceCopy + visible: false + width: Math.max(0, root.source.width - root.spread * 2) + height: Math.max(0, root.source.height - root.spread * 2) + radius: Math.max(0, root.source.radius !== 0 ? root.source.radius - root.spread : 0) + color: "black" + } + + ShaderEffectSource { + id: shaderEffectSource + visible: false + width: root.textureSize.width + height: root.textureSize.height + sourceItem: root.copyActive ? sourceCopy : root.source + sourceRect: Qt.rect(Math.min(0, -root.__offset.x) - Math.max(0, root.spread), + Math.min(0, -root.__offset.y) - Math.max(0, root.spread), + root.textureSize.width, + root.textureSize.height) + } + + ShaderEffect { + id: shadow + + property color color: root.color + property var src: shaderEffectSource + + visible: false + + width: root.textureSize.width + height: root.textureSize.height + + layer.enabled: true + + fragmentShader: "shaders/innerShadow.frag.qsb" + } + + ShaderEffect { + id: blurHorizontal + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: shadow + property vector2d pixelSize: root.pixelSize.times(Qt.vector2d(1, 0)) + property bool useOffscreenColor: true + property color offscreenColor: root.color + + visible: false + + width: root.textureSize.width + height: root.textureSize.height + + layer.enabled: true + layer.smooth: true // Otherwise bluring artifacts + + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } + + ShaderEffect { + id: blurVertical + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: blurHorizontal + property vector2d pixelSize: root.pixelSize.times(Qt.vector2d(0, 1)) + property bool useOffscreenColor: true + property color offscreenColor: root.color + + visible: false + + width: root.textureSize.width + height: root.textureSize.height + + layer.enabled: true + layer.smooth: true // Otherwise bluring artifacts + + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } + + ShaderEffectSource { + id: originalSource + visible: false + hideSource: true + width: root.textureSize.width + height: root.textureSize.height + sourceItem: root.source + sourceRect: Qt.rect(Math.min(0, root.__offset.x) + Math.min(0, root.spread), + Math.min(0, root.__offset.y) + Math.min(0, root.spread), + root.textureSize.width, + root.textureSize.height) + } + + ShaderEffect { + property var shadow: blurVertical + property var original: originalSource + + visible: true + + x: -Math.max(0, -root.__offset.x) + Math.min(0, root.spread) + y: -Math.max(0, -root.__offset.y) + Math.min(0, root.spread) + width: root.textureSize.width + height: root.textureSize.height + + fragmentShader: "shaders/innerShadowClip.frag.qsb" + } +} diff --git a/Dependencies/Components/imports/designeffects/DesignLayerBlurPrivate.qml b/Dependencies/Components/imports/designeffects/DesignLayerBlurPrivate.qml new file mode 100644 index 0000000..addbfb6 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/DesignLayerBlurPrivate.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Studio Components. +** +** $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 + +Item { + id: root + + property real radius: 10 + + required property Item source + + readonly property real radiusCeiled: Math.ceil(root.radius) + + readonly property size textureSize: Qt.size(root.width + root.radiusCeiled * 2, + root.height + root.radiusCeiled * 2) + readonly property vector2d pixelSize: Qt.vector2d(1.0 / root.textureSize.width, + 1.0 / root.textureSize.height) + readonly property real sigma: root.radius / 2.7 + + visible: true + + width: root.source?.width + height: root.source?.height + + //Component.onCompleted: console.log("Layer Blur created!") + + ShaderEffectSource { + id: shaderEffectSource + visible: false + width: root.width + height: root.height + sourceItem: root.source + sourceRect: Qt.rect(-root.radiusCeiled, -root.radiusCeiled, + root.textureSize.width, root.textureSize.height) + } + + ShaderEffect { + id: blurHorizontal + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: shaderEffectSource + property vector2d pixelSize: root.pixelSize.times(Qt.vector2d(1, 0)) + property bool useOffscreenColor: false + property color offscreenColor: "transparent" + + visible: false + + width: root.textureSize.width + height: root.textureSize.height + + layer.enabled: true + layer.smooth: true // Otherwise bluring artifacts + + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } + + ShaderEffect { + id: blurVertical + + property real blurKernel: root.radius + property real sigma: root.sigma + property var src: blurHorizontal + property vector2d pixelSize: root.pixelSize.times(Qt.vector2d(0, 1)) + property bool useOffscreenColor: false + property color offscreenColor: "transparent" + + width: root.textureSize.width + height: root.textureSize.height + + visible: true + + fragmentShader: "shaders/gaussianBlur.frag.qsb" + } +} diff --git a/Dependencies/Components/imports/designeffects/plugins.qmltypes b/Dependencies/Components/imports/designeffects/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/designeffects/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.11" + ] +} diff --git a/Dependencies/Components/imports/designeffects/qmldir b/Dependencies/Components/imports/designeffects/qmldir new file mode 100644 index 0000000..101ad7c --- /dev/null +++ b/Dependencies/Components/imports/designeffects/qmldir @@ -0,0 +1,9 @@ +DesignBackgroundBlurPrivate 1.0 DesignBackgroundBlurPrivate.qml +DesignDropShadow 1.0 DesignDropShadow.qml +DesignDropShadowPrivate 1.0 DesignDropShadowPrivate.qml +DesignEffect 1.0 DesignEffect.qml +DesignEffectPrivate 1.0 DesignEffectPrivate.qml +DesignInnerShadow 1.0 DesignInnerShadow.qml +DesignInnerShadowPrivate 1.0 DesignInnerShadowPrivate.qml +DesignLayerBlurPrivate 1.0 DesignLayerBlurPrivate.qml + diff --git a/Dependencies/Components/imports/designeffects/qtstudiocomponentsplugin.cpp b/Dependencies/Components/imports/designeffects/qtstudiocomponentsplugin.cpp new file mode 100644 index 0000000..b9ddd62 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/qtstudiocomponentsplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2024 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class QtStudioDesignEffectsPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtStudioDesignEffectsPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +QtStudioDesignEffectsPlugin::QtStudioDesignEffectsPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void QtStudioDesignEffectsPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "qtstudiodesigneffectsplugin.moc" diff --git a/Dependencies/Components/imports/designeffects/shaders/dropShadow.frag b/Dependencies/Components/imports/designeffects/shaders/dropShadow.frag new file mode 100644 index 0000000..a675e22 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/shaders/dropShadow.frag @@ -0,0 +1,19 @@ +#version 440 +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; + + vec4 color; +}; +layout(binding = 1) uniform sampler2D src; + +void main() { + vec4 p = texture(src, qt_TexCoord0); + + if (p.a == 0) // Otherwise background is affected + discard; + + fragColor = color * qt_Opacity; +} diff --git a/Dependencies/Components/imports/designeffects/shaders/dropShadowClip.frag b/Dependencies/Components/imports/designeffects/shaders/dropShadowClip.frag new file mode 100644 index 0000000..7efce6f --- /dev/null +++ b/Dependencies/Components/imports/designeffects/shaders/dropShadowClip.frag @@ -0,0 +1,19 @@ +#version 440 +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; +}; +layout(binding = 1) uniform sampler2D shadow; +layout(binding = 2) uniform sampler2D original; + +void main() { + vec4 o = texture(original, qt_TexCoord0); // original + + if (o.a != 0.0) + discard; + + vec4 s = texture(shadow, qt_TexCoord0); // shadow + fragColor = s; +} diff --git a/Dependencies/Components/imports/designeffects/shaders/gaussianBlur.frag b/Dependencies/Components/imports/designeffects/shaders/gaussianBlur.frag new file mode 100644 index 0000000..0926676 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/shaders/gaussianBlur.frag @@ -0,0 +1,52 @@ +#version 440 +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; + + float blurKernel; + float sigma; + vec2 pixelSize; + int useOffscreenColor; // bool + vec4 offscreenColor; +}; +layout(binding = 1) uniform sampler2D src; + +const float PI = 3.14159265359; +const float sqrtDoublePI = sqrt(2.0 * PI); + +vec4 gaussianBlur(sampler2D tex, int miplevel) { + vec4 col = vec4(0.0); + + float sum = 0; + + float k = ceil(blurKernel); + + // Normalize kernel weights + for (float i = -k; i <= k; ++i) { + sum += exp(-0.5 * pow(i / sigma, 2.0)) / (sqrtDoublePI * sigma); + } + + for (float i = -k; i <= k; ++i) { + vec2 coord = qt_TexCoord0 + (pixelSize * float(i)); + float weight = exp(-0.5 * pow(i / sigma, 2.0)) / (sqrtDoublePI * sigma); + + if (useOffscreenColor != 0 + && (coord.x > 1.0 || coord.y > 1.0 + || coord.x < 0.0 || coord.y < 0.0)) { + col += offscreenColor * weight / sum; + } else { + col += texture(tex, coord) * weight / sum; + } + } + + return col; +} + +void main() { + vec4 p = (blurKernel > 0) ? gaussianBlur(src, 0) + : texture(src, qt_TexCoord0); + + fragColor = p * qt_Opacity; +} diff --git a/Dependencies/Components/imports/designeffects/shaders/innerShadow.frag b/Dependencies/Components/imports/designeffects/shaders/innerShadow.frag new file mode 100644 index 0000000..22c8f06 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/shaders/innerShadow.frag @@ -0,0 +1,19 @@ +#version 440 +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; + + vec4 color; +}; +layout(binding = 1) uniform sampler2D src; + +void main() { + vec4 p = texture(src, qt_TexCoord0); + + if (p.a != 0) + discard; + + fragColor = color * qt_Opacity; +} diff --git a/Dependencies/Components/imports/designeffects/shaders/innerShadowClip.frag b/Dependencies/Components/imports/designeffects/shaders/innerShadowClip.frag new file mode 100644 index 0000000..8f97a11 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/shaders/innerShadowClip.frag @@ -0,0 +1,27 @@ +#version 440 +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; +}; +layout(binding = 1) uniform sampler2D shadow; +layout(binding = 2) uniform sampler2D original; + +void main() { + vec4 o = texture(original, qt_TexCoord0); // original + + if (o.a == 0) + discard; + + vec4 s = texture(shadow, qt_TexCoord0); // shadow + + if (s.a == 0) + discard; + + fragColor = s; + //} else { + // fragColor.rgb = mix(s.rgb, o.rgb, (1.0 - s.a)); + // fragColor.a = s.a + (o.a * (1.0 - s.a)); + //} +} diff --git a/Dependencies/Components/imports/designeffects/shaders/opacityMask.frag b/Dependencies/Components/imports/designeffects/shaders/opacityMask.frag new file mode 100644 index 0000000..f453666 --- /dev/null +++ b/Dependencies/Components/imports/designeffects/shaders/opacityMask.frag @@ -0,0 +1,27 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + // qt_Matrix and qt_Opacity must always be both present + // if the built-in vertex shader is used. + mat4 qt_Matrix; + float qt_Opacity; +}; + +layout(binding = 1) uniform sampler2D source; +layout(binding = 2) uniform sampler2D maskSource; + +void main() +{ + if (texture(maskSource, qt_TexCoord0.st).a == 0.0) { + fragColor = vec4(0); + } else { + fragColor = texture(source, qt_TexCoord0.st); + } + + //fragColor = texture(source, qt_TexCoord0.st) + // * (texture(maskSource, qt_TexCoord0.st).a) + // * qt_Opacity; +} diff --git a/Dependencies/Components/imports/effects_qt6/BlendEffect.qml b/Dependencies/Components/imports/effects_qt6/BlendEffect.qml new file mode 100644 index 0000000..bfefcd6 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/BlendEffect.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +FastBlur { + id: blend + property string mode: "subtract" + Component.onCompleted: console.log("Blend is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/BlendItem.qml b/Dependencies/Components/imports/effects_qt6/BlendItem.qml new file mode 100644 index 0000000..e4cf658 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/BlendItem.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property string mode + property alias cached: blend.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + z: -1 + id: stack + visible: false + } + + FastBlur { + id: blend + anchors.fill: parent + } + + property Item background + property Item foreground + + property Item foo: Item {} + + Component.onCompleted: { + root.background = stack.children[0] + root.foreground = stack.children[1] + console.log("Blend is not supported with Qt 6") + } +} + diff --git a/Dependencies/Components/imports/effects_qt6/BrightnessContrastEffect.qml b/Dependencies/Components/imports/effects_qt6/BrightnessContrastEffect.qml new file mode 100644 index 0000000..16be284 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/BrightnessContrastEffect.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +BrightnessContrast { + id: brightCont +} diff --git a/Dependencies/Components/imports/effects_qt6/BrightnessContrastItem.qml b/Dependencies/Components/imports/effects_qt6/BrightnessContrastItem.qml new file mode 100644 index 0000000..76c4215 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/BrightnessContrastItem.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + + property alias brightness: brightCont.brightness + property alias contrast: brightCont.contrast + property alias cached: brightCont.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + visible: false + } + + BrightnessContrast { + id: brightCont + anchors.fill: stack + source: stack + } +} diff --git a/Dependencies/Components/imports/effects_qt6/CMakeLists.txt b/Dependencies/Components/imports/effects_qt6/CMakeLists.txt new file mode 100644 index 0000000..fd724ec --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/CMakeLists.txt @@ -0,0 +1,63 @@ +qt_add_library(QuickStudioEffects STATIC) +qt6_add_qml_module(QuickStudioEffects + URI "QtQuick.Studio.Effects" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + ${qds_qml_extra_args} + NO_LINT + NO_CACHEGEN + QML_FILES + FastBlurItem.qml + GlowItem.qml + ZoomBlurItem.qml + RadialBlurItem.qml + DesaturationItem.qml + SaturationItem.qml + DirectionalBlurItem.qml + ColorOverlayItem.qml + DropShadowItem.qml + ColorizeItem.qml + BrightnessContrastItem.qml + HueSaturationItem.qml + MaskedBlurItem.qml + BlendItem.qml + OpacityMaskItem.qml + MaskItem.qml + RotationItem.qml + GaussianBlurItem.qml + GammaAdjustItem.qml + RecursiveBlurItem.qml + ThresholdMaskItem.qml + LevelAdjustItem.qml + InnerShadowItem.qml + DisplaceItem.qml + BlendEffect.qml + BrightnessContrastEffect.qml + ColorizeEffect.qml + ColorOverlayEffect.qml + DesaturationEffect.qml + DirectionalBlurEffect.qml + DisplaceEffect.qml + DropShadowEffect.qml + FastBlurEffect.qml + GammaAdjustEffect.qml + GaussianBlurEffect.qml + GlowEffect.qml + HueSaturationEffect.qml + InnerShadowEffect.qml + LevelAdjustEffect.qml + MaskedBlurEffect.qml + OpacityMaskEffect.qml + RadialBlurEffect.qml + RecursiveBlurEffect.qml + ThresholdMaskEffect.qml + ZoomBlurEffect.qml +) + +set_target_properties(QuickStudioEffects PROPERTIES + QT_QMLCACHEGEN_EXECUTABLE qmlcachegen +) + +register_plugin(QuickStudioEffects) diff --git a/Dependencies/Components/imports/effects_qt6/ColorOverlayEffect.qml b/Dependencies/Components/imports/effects_qt6/ColorOverlayEffect.qml new file mode 100644 index 0000000..6b67005 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ColorOverlayEffect.qml @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +ColorOverlay { + id: colorOverlay + color: "#80fff000" +} diff --git a/Dependencies/Components/imports/effects_qt6/ColorOverlayItem.qml b/Dependencies/Components/imports/effects_qt6/ColorOverlayItem.qml new file mode 100644 index 0000000..7ae14f8 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ColorOverlayItem.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias content: stack.children + + property alias overlayColor: colorOverlay.color + property alias cached: colorOverlay.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + visible: false + } + + ColorOverlay { + id: colorOverlay + anchors.fill: stack + source: stack + color: "#80fff000" + } +} diff --git a/Dependencies/Components/imports/effects_qt6/ColorizeEffect.qml b/Dependencies/Components/imports/effects_qt6/ColorizeEffect.qml new file mode 100644 index 0000000..35dedf5 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ColorizeEffect.qml @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Colorize { + id: colorize + hue: 0.5 + saturation: 0.5 + lightness: 0.5 +} diff --git a/Dependencies/Components/imports/effects_qt6/ColorizeItem.qml b/Dependencies/Components/imports/effects_qt6/ColorizeItem.qml new file mode 100644 index 0000000..f61dddc --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ColorizeItem.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias colorizeHue: colorize.hue + property alias colorizeSaturation: colorize.saturation + property alias colorizeLightness: colorize.lightness + property alias cached: colorize.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + visible: false + } + + Colorize { + id: colorize + anchors.fill: stack + source: stack + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + } +} diff --git a/Dependencies/Components/imports/effects_qt6/DesaturationEffect.qml b/Dependencies/Components/imports/effects_qt6/DesaturationEffect.qml new file mode 100644 index 0000000..ad66dfe --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DesaturationEffect.qml @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Desaturate { + id: desaturate + desaturation: 0.5 +} diff --git a/Dependencies/Components/imports/effects_qt6/DesaturationItem.qml b/Dependencies/Components/imports/effects_qt6/DesaturationItem.qml new file mode 100644 index 0000000..c994ba3 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DesaturationItem.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias desaturation: desaturate.desaturation + property alias cached: desaturate.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + visible: false + } + + Desaturate { + id: desaturate + source: stack + anchors.fill: stack + desaturation: 0.5 + } +} diff --git a/Dependencies/Components/imports/effects_qt6/DirectionalBlurEffect.qml b/Dependencies/Components/imports/effects_qt6/DirectionalBlurEffect.qml new file mode 100644 index 0000000..9dd691e --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DirectionalBlurEffect.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +FastBlur { + property real directionalBlurAngle: 0 + property real directionalBlurLength: 0 + property int directionalBlurSamples: 10 + property int length: 0 + + id: directionalBlur + transparentBorder: true + Component.onCompleted: console.log("DirectionalBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/DirectionalBlurItem.qml b/Dependencies/Components/imports/effects_qt6/DirectionalBlurItem.qml new file mode 100644 index 0000000..8cbb98a --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DirectionalBlurItem.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + + property real directionalBlurAngle: 0 + property real directionalBlurLength: 0 + property int directionalBlurSamples: 10 + property alias directionalBlurBorder: directionalBlur.transparentBorder + property alias cached: directionalBlur.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + visible: false + } + + FastBlur { + id: directionalBlur + anchors.fill: stack + source: stack + transparentBorder: true + } + Component.onCompleted: console.log("DirectionalBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/DisplaceEffect.qml b/Dependencies/Components/imports/effects_qt6/DisplaceEffect.qml new file mode 100644 index 0000000..5d27a35 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DisplaceEffect.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Displace { + id: displace +} diff --git a/Dependencies/Components/imports/effects_qt6/DisplaceItem.qml b/Dependencies/Components/imports/effects_qt6/DisplaceItem.qml new file mode 100644 index 0000000..8d1ebdd --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DisplaceItem.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias displacement: displace.displacement + property alias cached: displace.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + z: -1 + id: stack + implicitWidth: displace.source.width + displace.source.x + implicitHeight: displace.source.height + displace.source.y + visible: false + } + + Displace { + id: displace + anchors.fill: parent + source: root.background + displacementSource: root.foreground + } + + property Item background + property Item foreground + + Component.onCompleted: { + root.background = stack.children[0] + root.foreground = stack.children[1] + } +} + diff --git a/Dependencies/Components/imports/effects_qt6/DropShadowEffect.qml b/Dependencies/Components/imports/effects_qt6/DropShadowEffect.qml new file mode 100644 index 0000000..51e4778 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DropShadowEffect.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +DropShadow { + id: dropShadow + horizontalOffset: 3 + verticalOffset: 3 + radius: 8.0 + spread: 0.5 + transparentBorder: true + color: "#80000000" +} diff --git a/Dependencies/Components/imports/effects_qt6/DropShadowItem.qml b/Dependencies/Components/imports/effects_qt6/DropShadowItem.qml new file mode 100644 index 0000000..e49f283 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/DropShadowItem.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias horizontalOffset: dropShadow.horizontalOffset + property alias verticalOffset: dropShadow.verticalOffset + property alias radius: dropShadow.radius + property alias samples: dropShadow.samples + property alias spread: dropShadow.spread + property alias transparentBorder: dropShadow.transparentBorder + property alias color: dropShadow.color + property alias cached: dropShadow.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + visible: false + } + + DropShadow { + id: dropShadow + anchors.fill: stack + source: stack + horizontalOffset: 3 + verticalOffset: 3 + radius: 8.0 + samples: 17 + spread: 0.5 + transparentBorder: true + color: "#80000000" + } +} diff --git a/Dependencies/Components/imports/effects_qt6/FastBlurEffect.qml b/Dependencies/Components/imports/effects_qt6/FastBlurEffect.qml new file mode 100644 index 0000000..353fd1d --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/FastBlurEffect.qml @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.8 +import Qt5Compat.GraphicalEffects + +FastBlur { + id: fastBlur + radius: 20 +} diff --git a/Dependencies/Components/imports/effects_qt6/FastBlurItem.qml b/Dependencies/Components/imports/effects_qt6/FastBlurItem.qml new file mode 100644 index 0000000..f8048cb --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/FastBlurItem.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.8 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + layer.enabled: true + + default property alias contentStack: stack.children + property alias radius: blur.radius + property alias transparentBorder: blur.transparentBorder + property alias cached: blur.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + } + + FastBlur { + id: blur + + transparentBorder: true + anchors.fill: stack + source: stack + radius: 12 + } +} diff --git a/Dependencies/Components/imports/effects_qt6/GammaAdjustEffect.qml b/Dependencies/Components/imports/effects_qt6/GammaAdjustEffect.qml new file mode 100644 index 0000000..dfa0680 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/GammaAdjustEffect.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +GammaAdjust { + id: gammaAdjust + anchors.fill: stack + gamma: 0.5 +} diff --git a/Dependencies/Components/imports/effects_qt6/GammaAdjustItem.qml b/Dependencies/Components/imports/effects_qt6/GammaAdjustItem.qml new file mode 100644 index 0000000..e8d0e67 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/GammaAdjustItem.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias gamma: gammaAdjust.gamma + property alias cached: gammaAdjust.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + visible: false + } + + GammaAdjust { + id: gammaAdjust + anchors.fill: stack + source: stack + gamma: 0.5 + } +} diff --git a/Dependencies/Components/imports/effects_qt6/GaussianBlurEffect.qml b/Dependencies/Components/imports/effects_qt6/GaussianBlurEffect.qml new file mode 100644 index 0000000..7180065 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/GaussianBlurEffect.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +FastBlur { + id: gaussianBlur + transparentBorder: true + radius: 8.0 + + property alias radius: gaussianBlur.radius + property int samples: 0 + Component.onCompleted: console.log("GaussianBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/GaussianBlurItem.qml b/Dependencies/Components/imports/effects_qt6/GaussianBlurItem.qml new file mode 100644 index 0000000..ee95182 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/GaussianBlurItem.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property real deviation: gaussianBlur.deviation + property alias radius: gaussianBlur.radius + property int samples: 0 + property alias transparentBorder: gaussianBlur.transparentBorder + property alias cached: gaussianBlur.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + visible: false + } + + FastBlur { + id: gaussianBlur + transparentBorder: true + anchors.fill: stack + source: stack + radius: 8.0 + } + Component.onCompleted: console.log("GaussianBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/GlowEffect.qml b/Dependencies/Components/imports/effects_qt6/GlowEffect.qml new file mode 100644 index 0000000..6a4d56d --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/GlowEffect.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Glow { + property real samples: 0 + id: glow + radius: 5 + spread: 0.5 + color: "#ffffffff" + transparentBorder: true +} diff --git a/Dependencies/Components/imports/effects_qt6/GlowItem.qml b/Dependencies/Components/imports/effects_qt6/GlowItem.qml new file mode 100644 index 0000000..201a3b1 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/GlowItem.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias radius: glow.radius + property real samples: 0 + property alias spread: glow.spread + property alias color: glow.color + property alias transparentBorder: glow.transparentBorder + property alias cached: glow.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + visible: false + } + + Glow { + id: glow + anchors.fill: stack + radius: 5 + spread: 0.5 + color: "#ffffffff" + transparentBorder: true + source: stack + } +} diff --git a/Dependencies/Components/imports/effects_qt6/HueSaturationEffect.qml b/Dependencies/Components/imports/effects_qt6/HueSaturationEffect.qml new file mode 100644 index 0000000..d35f33f --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/HueSaturationEffect.qml @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +HueSaturation { + id: hueSat + hue: 0.5 + saturation: 0.5 + lightness: 0.5 +} diff --git a/Dependencies/Components/imports/effects_qt6/HueSaturationItem.qml b/Dependencies/Components/imports/effects_qt6/HueSaturationItem.qml new file mode 100644 index 0000000..39ab8ec --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/HueSaturationItem.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias adjustHue: hueSat.hue + property alias adjustSaturation: hueSat.saturation + property alias adjustLightness: hueSat.lightness + property alias cached: hueSat.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + visible: false + } + + HueSaturation { + id: hueSat + anchors.fill: stack + source: stack + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + } +} diff --git a/Dependencies/Components/imports/effects_qt6/InnerShadowEffect.qml b/Dependencies/Components/imports/effects_qt6/InnerShadowEffect.qml new file mode 100644 index 0000000..ec182aa --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/InnerShadowEffect.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +FastBlur { + id: innerShadow + + property color color: "#000000" + property bool fast: false + property real horizontalOffset: 0 + property real radius: 0 + property real samples: 0 + property real spread: 0 + property real verticalOffset: 0 + + Component.onCompleted: console.log("InnerShadow is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/InnerShadowItem.qml b/Dependencies/Components/imports/effects_qt6/InnerShadowItem.qml new file mode 100644 index 0000000..de8405b --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/InnerShadowItem.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.0 +import Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias cached: innerShadow.cached + + property color color: "#000000" + property bool fast: false + property real horizontalOffset: 0 + property real radius: 0 + property real samples: 0 + property real spread: 0 + property real verticalOffset: 0 + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + visible: false + } + + FastBlur { + id: innerShadow + anchors.fill: stack + source: stack + } + Component.onCompleted: console.log("InnerShadow is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/LevelAdjustEffect.qml b/Dependencies/Components/imports/effects_qt6/LevelAdjustEffect.qml new file mode 100644 index 0000000..9ca5ca6 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/LevelAdjustEffect.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.12 +import Qt5Compat.GraphicalEffects + +LevelAdjust { + id: levelAdjust + + property real gammaR: 1.0 + property real gammaG: 1.0 + property real gammaB: 1.0 + + gamma: Qt.vector3d(levelAdjust.gammaR, levelAdjust.gammaG, levelAdjust.gammaG) +} diff --git a/Dependencies/Components/imports/effects_qt6/LevelAdjustItem.qml b/Dependencies/Components/imports/effects_qt6/LevelAdjustItem.qml new file mode 100644 index 0000000..6415e5c --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/LevelAdjustItem.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property real gammaR: 1.0 + property real gammaG: 1.0 + property real gammaB: 1.0 + property alias maximumInput: levelAdjust.maximumInput + property alias maximumOutput: levelAdjust.maximumOutput + property alias minimumInput: levelAdjust.minimumInput + property alias minimumOutput: levelAdjust.minimumOutput + property alias cached: levelAdjust.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + visible: true + } + + LevelAdjust { + id: levelAdjust + anchors.fill: stack + source: stack + gamma: Qt.vector3d(root.gammaR, root.gammaG, root.gammaG) + } +} diff --git a/Dependencies/Components/imports/effects_qt6/MaskItem.qml b/Dependencies/Components/imports/effects_qt6/MaskItem.qml new file mode 100644 index 0000000..1ef8202 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/MaskItem.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias invert: blend.invert + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + z: -1 + id: stack + implicitWidth: blend.source.width + blend.source.x + implicitHeight: blend.source.height + blend.source.y + + visible: false + } + + OpacityMask { + id: blend + anchors.fill: parent + source: root.background + maskSource: root.foreground + + } + + property Item background + property Item foreground + + property Item foo: Item {} + + Component.onCompleted: { + root.background = stack.children[0] + root.foreground = stack.children[1] + } +} + diff --git a/Dependencies/Components/imports/effects_qt6/MaskedBlurEffect.qml b/Dependencies/Components/imports/effects_qt6/MaskedBlurEffect.qml new file mode 100644 index 0000000..ac6125b --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/MaskedBlurEffect.qml @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +FastBlur { + id: maskedBlur + radius: 32 + property int samples: 0 + Component.onCompleted: console.log("MaskedBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/MaskedBlurItem.qml b/Dependencies/Components/imports/effects_qt6/MaskedBlurItem.qml new file mode 100644 index 0000000..03e80ab --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/MaskedBlurItem.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias radius: maskedBlur.radius + property int samples: 0 + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + z: -1 + id: stack + implicitWidth: maskedBlur.source.width + maskedBlur.source.x + implicitHeight: maskedBlur.source.height + maskedBlur.source.y + visible: false + } + + FastBlur { + id: maskedBlur + anchors.fill: parent + source: root.background + maskSource: root.foreground + radius: 32 + samples: 16 + } + + property Item background + property Item foreground + + Component.onCompleted: { + root.background = stack.children[0] + root.foreground = stack.children[1] + console.log("MaskedBlur is not supported with Qt 6") + } +} diff --git a/Dependencies/Components/imports/effects_qt6/OpacityMaskEffect.qml b/Dependencies/Components/imports/effects_qt6/OpacityMaskEffect.qml new file mode 100644 index 0000000..71e4afb --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/OpacityMaskEffect.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +OpacityMask { + id: mask +} diff --git a/Dependencies/Components/imports/effects_qt6/OpacityMaskItem.qml b/Dependencies/Components/imports/effects_qt6/OpacityMaskItem.qml new file mode 100644 index 0000000..e523d9d --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/OpacityMaskItem.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias invert: mask.invert + property alias cached: mask.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + z: -1 + id: stack + implicitWidth: mask.source.width + mask.source.x + implicitHeight: mask.source.height + mask.source.y + visible: false + } + + OpacityMask { + id: mask + anchors.fill: parent + source: root.background + maskSource: root.foreground + } + + property Item background + property Item foreground + + Component.onCompleted: { + root.background = stack.children[0] + root.foreground = stack.children[1] + } +} diff --git a/Dependencies/Components/imports/effects_qt6/RadialBlurEffect.qml b/Dependencies/Components/imports/effects_qt6/RadialBlurEffect.qml new file mode 100644 index 0000000..c4bd45b --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/RadialBlurEffect.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +FastBlur { + + property int samples: 0 + property real verticalOffset: 0 + property real horizontalOffset: 0 + property real angle: 0 + + id: radialBlur + + transparentBorder: true + + Component.onCompleted: console.log("RadiallBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/RadialBlurItem.qml b/Dependencies/Components/imports/effects_qt6/RadialBlurItem.qml new file mode 100644 index 0000000..92712d8 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/RadialBlurItem.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias cached: radialBlur.cached + property int samples: 0 + property real verticalOffset: 0 + property real horizontalOffset: 0 + property real transparentBorder: 0 + property real angle: 0 + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + } + + FastBlur { + id: radialBlur + anchors.fill: stack + source: stack + transparentBorder: true + } + + Component.onCompleted: console.log("RadiallBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/RecursiveBlurEffect.qml b/Dependencies/Components/imports/effects_qt6/RecursiveBlurEffect.qml new file mode 100644 index 0000000..eb0cc7c --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/RecursiveBlurEffect.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +FastBlur { + id: recursiveBlur + transparentBorder: true + radius: 8.0 + property int loops: 0 + property int progress: 0 + Component.onCompleted: console.log("RecursiveBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/RecursiveBlurItem.qml b/Dependencies/Components/imports/effects_qt6/RecursiveBlurItem.qml new file mode 100644 index 0000000..5d966d1 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/RecursiveBlurItem.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property int loops: 0 + property int progress: 0 + property alias radius: recursiveBlur.radius + property alias transparentBorder: recursiveBlur.transparentBorder + property alias cached: recursiveBlur.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + visible: false + } + + FastBlur { + id: recursiveBlur + transparentBorder: true + anchors.fill: stack + source: stack + radius: 8.0 + } + Component.onCompleted: console.log("RecursiveBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/RotationItem.qml b/Dependencies/Components/imports/effects_qt6/RotationItem.qml new file mode 100644 index 0000000..76da4d4 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/RotationItem.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + property alias originX: rotation.origin.x + property alias originY: rotation.origin.y + property alias axisX: rotation.axis.x + property alias axisY: rotation.axis.y + property alias axisZ: rotation.axis.z + property alias angle: rotation.angle + + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + transform: Rotation { + id: rotation + origin.x: root.width / 2 + origin.y: root.height / 2 + angle: 45 + } +} diff --git a/Dependencies/Components/imports/effects_qt6/SaturationItem.qml b/Dependencies/Components/imports/effects_qt6/SaturationItem.qml new file mode 100644 index 0000000..cc26a91 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/SaturationItem.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias desaturation: desaturate.desaturation + property alias cached: desaturate.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + + Item { + id: stack + + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + + visible: false + } + + Desaturate { + id: desaturate + source: stack + anchors.fill: stack + + desaturation: 0.5 + } +} + diff --git a/Dependencies/Components/imports/effects_qt6/ThresholdMaskEffect.qml b/Dependencies/Components/imports/effects_qt6/ThresholdMaskEffect.qml new file mode 100644 index 0000000..7092998 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ThresholdMaskEffect.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +ThresholdMask { + id: thresholdMask + spread: 0.2 + threshold: 0.5 +} diff --git a/Dependencies/Components/imports/effects_qt6/ThresholdMaskItem.qml b/Dependencies/Components/imports/effects_qt6/ThresholdMaskItem.qml new file mode 100644 index 0000000..3302f38 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ThresholdMaskItem.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property alias spread: thresholdMask.spread + property alias threshold: thresholdMask.threshold + property alias cached: thresholdMask.cached + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + z: -1 + id: stack + implicitWidth: thresholdMask.source.width + thresholdMask.source.x + implicitHeight: thresholdMask.source.height + thresholdMask.source.y + visible: false + } + + ThresholdMask { + id: thresholdMask + anchors.fill: parent + source: root.background + maskSource: root.foreground + spread: 0.2 + threshold: 0.5 + } + + property Item background + property Item foreground + + Component.onCompleted: { + root.background = stack.children[0] + root.foreground = stack.children[1] + } +} diff --git a/Dependencies/Components/imports/effects_qt6/ZoomBlurEffect.qml b/Dependencies/Components/imports/effects_qt6/ZoomBlurEffect.qml new file mode 100644 index 0000000..7742a46 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ZoomBlurEffect.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +FastBlur { + id: zoomBlur + property int zoomBlurLength: 0 + property int zoomBlurSamples: 0 + property real zoomBlurHoffset: 0 + property real zoomBlurVoffset: 0 + transparentBorder: true + Component.onCompleted: console.log("ZoomBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/ZoomBlurItem.qml b/Dependencies/Components/imports/effects_qt6/ZoomBlurItem.qml new file mode 100644 index 0000000..ff3f5a3 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/ZoomBlurItem.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 Qt5Compat.GraphicalEffects + +Item { + id: root + + default property alias contentStack: stack.children + property int zoomBlurLength: 0 + property int zoomBlurSamples: 0 + property real zoomBlurHoffset: 0 + property real zoomBlurVoffset: 0 + property alias cached: zoomBlur.cached + property alias transparentBorder: zoomBlur.transparentBorder + + implicitWidth: Math.max(32, stack.implicitWidth) + implicitHeight: Math.max(32, stack.implicitHeight) + + Item { + id: stack + + implicitWidth: childrenRect.width + childrenRect.x + implicitHeight: childrenRect.height + childrenRect.y + } + + FastBlur { + id: zoomBlur + anchors.fill: stack + source: stack + transparentBorder: true + } + Component.onCompleted: console.log("ZoomBlur is not supported with Qt 6") +} diff --git a/Dependencies/Components/imports/effects_qt6/plugins.qmltypes b/Dependencies/Components/imports/effects_qt6/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/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.11" + ] +} diff --git a/Dependencies/Components/imports/effects_qt6/qmldir b/Dependencies/Components/imports/effects_qt6/qmldir new file mode 100644 index 0000000..dd4a053 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/qmldir @@ -0,0 +1,52 @@ +module QtQuick.Studio.Effects +linktarget QtQuickStudioEffectsplugin +optional plugin QtQuickStudioEffectsplugin +classname QtQuick_Studio_EffectsPlugin +typeinfo QtQuickStudioEffects.qmltypes +prefer :/QtQuick/Studio/Effects/ +FastBlurItem 1.0 FastBlurItem.qml +GlowItem 1.0 GlowItem.qml +ZoomBlurItem 1.0 ZoomBlurItem.qml +RadialBlurItem 1.0 RadialBlurItem.qml +DesaturationItem 1.0 DesaturationItem.qml +SaturationItem 1.0 SaturationItem.qml +DirectionalBlurItem 1.0 DirectionalBlurItem.qml +ColorOverlayItem 1.0 ColorOverlayItem.qml +DropShadowItem 1.0 DropShadowItem.qml +ColorizeItem 1.0 ColorizeItem.qml +BrightnessContrastItem 1.0 BrightnessContrastItem.qml +HueSaturationItem 1.0 HueSaturationItem.qml +MaskedBlurItem 1.0 MaskedBlurItem.qml +BlendItem 1.0 BlendItem.qml +OpacityMaskItem 1.0 OpacityMaskItem.qml +MaskItem 1.0 MaskItem.qml +RotationItem 1.0 RotationItem.qml +GaussianBlurItem 1.0 GaussianBlurItem.qml +GammaAdjustItem 1.0 GammaAdjustItem.qml +RecursiveBlurItem 1.0 RecursiveBlurItem.qml +ThresholdMaskItem 1.0 ThresholdMaskItem.qml +LevelAdjustItem 1.0 LevelAdjustItem.qml +InnerShadowItem 1.0 InnerShadowItem.qml +DisplaceItem 1.0 DisplaceItem.qml +BlendEffect 1.0 BlendEffect.qml +BrightnessContrastEffect 1.0 BrightnessContrastEffect.qml +ColorizeEffect 1.0 ColorizeEffect.qml +ColorOverlayEffect 1.0 ColorOverlayEffect.qml +DesaturationEffect 1.0 DesaturationEffect.qml +DirectionalBlurEffect 1.0 DirectionalBlurEffect.qml +DisplaceEffect 1.0 DisplaceEffect.qml +DropShadowEffect 1.0 DropShadowEffect.qml +FastBlurEffect 1.0 FastBlurEffect.qml +GammaAdjustEffect 1.0 GammaAdjustEffect.qml +GaussianBlurEffect 1.0 GaussianBlurEffect.qml +GlowEffect 1.0 GlowEffect.qml +HueSaturationEffect 1.0 HueSaturationEffect.qml +InnerShadowEffect 1.0 InnerShadowEffect.qml +LevelAdjustEffect 1.0 LevelAdjustEffect.qml +MaskedBlurEffect 1.0 MaskedBlurEffect.qml +OpacityMaskEffect 1.0 OpacityMaskEffect.qml +RadialBlurEffect 1.0 RadialBlurEffect.qml +RecursiveBlurEffect 1.0 RecursiveBlurEffect.qml +ThresholdMaskEffect 1.0 ThresholdMaskEffect.qml +ZoomBlurEffect 1.0 ZoomBlurEffect.qml + diff --git a/Dependencies/Components/imports/effects_qt6/qtstudioeffectsplugin.cpp b/Dependencies/Components/imports/effects_qt6/qtstudioeffectsplugin.cpp new file mode 100644 index 0000000..eea2e29 --- /dev/null +++ b/Dependencies/Components/imports/effects_qt6/qtstudioeffectsplugin.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class QtStudioEffectsPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtStudioEffectsPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +QtStudioEffectsPlugin::QtStudioEffectsPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ + +} + +void QtStudioEffectsPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "qtstudioeffectsplugin.moc" diff --git a/Dependencies/Components/imports/flowview/+DesignMode/FlowItem.qml b/Dependencies/Components/imports/flowview/+DesignMode/FlowItem.qml new file mode 100644 index 0000000..b988b02 --- /dev/null +++ b/Dependencies/Components/imports/flowview/+DesignMode/FlowItem.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.12 +import FlowView 1.0 + +Item { + id: flowItem + + width: 400 + height: 400 + + property var flowView: Item {} + + property string __designer_url__ + + property alias loaderSource: loader.source + + property var stateChangeTarget + + property string defaultState + + clip: true + + function setState(state) { + + } + + onStateChangeTargetChanged: { + loader.source = stateChangeTarget['__designer_url__'] + loader.item.state = flowItem.targetState + flowItem.width = flowItem.stateChangeTarget.width + flowItem.height = flowItem.stateChangeTarget.height + } + + + property string targetState + + onTargetStateChanged: { + loader.active = false + loader.active = true + loader.item.state = flowItem.targetState + } + + Text { + text: flowItem.targetState + } + + property bool active: false + + + function init() { + flowItem.defaultState = flowItem.state + if (FlowState.loading) + return + + if (loader.source == "") + return + + FlowState.loading = true + flowItem.active = true + } + + Loader { + id: loader + active: flowItem.active + onLoaded: { + flowItem.width = loader.item.childrenRect.width + flowItem.height = loader.item.childrenRect.height + FlowState.loading = false + } + } +} diff --git a/Dependencies/Components/imports/flowview/+DesignMode/FlowView.qml b/Dependencies/Components/imports/flowview/+DesignMode/FlowView.qml new file mode 100644 index 0000000..cfd2720 --- /dev/null +++ b/Dependencies/Components/imports/flowview/+DesignMode/FlowView.qml @@ -0,0 +1,311 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +Item { + id: root + width: 200 + height: 200 + + property FlowTransition defaultTransition + + property FlowTransition currentTransition + + property FlowTransition __forceTransition + + property list flowTransitions + property list flowDecisions + property list flowWildcards + + property Item interaction: Item { + } + + enum EffectEnum { + Instant, + Dissolve, + Fade, + Pop + } + + property bool __blockHistory: false + + property bool __isFlowView: true + + function goBack() { + if (root.__history.length === 0) + return + + var poppedItem = root.__history.pop() + + root.__blockHistory = true + root.activatedItem = poppedItem + root.__activateItem() + root.__blockHistory = false + + + if (root.__history.length > 0) + root.lastItem = root.__history.slice(-1)[0] + else + root.lastItem = null + } + + function __activateItem() { + if (!__isCompleted) + return + + if (root.activatedItem === root.currentItem) + return; + + if (root.activatedItem === root.nextItem) + return; + + root.nextItem = root.activatedItem + + for (var i = 0; i < root.allChildren.length; ++i) { + if (root.allChildren[i] === root.activatedItem) + root.currentIndex = i + } + + } + + default property alias item: stack.data + + property Item nextItem + + property Item currentItem + property Item activatedItem + property Item lastItem + property int currentIndex: 0 + + //property list __history + property var __history: [] + + property int maxIndex: 0 + + signal transitionFinished + + property alias __stack: stack + + Item { + id: stack + visible: true + } + + property bool __isCompleted: false + + property real progress: 0 + + property bool __blockSchedule: false + + onActivatedItemChanged: { + root.__activateItem() + } + + function resetCurrentIndex() { + root.__blockSchedule = true + root.lastItem = root.currentItem + root.__history.push(root.lastItem) + + for (var i = 0; i < root.allChildren.length; ++i) { + if (root.allChildren[i] === root.currentItem) + root.currentIndex = i + } + root.__blockSchedule = false + } + + Component.onCompleted: { + root.maxIndex = stack.children.length - 1 + + root.allChildren = [] + + for (var i = 0; i < stack.children.length; ++i) { + root.allChildren.push(stack.children[i]) + if (stack.children[i].flowView !== undefined) { + stack.children[i].flowView = root + stack.children[i].init() + } + } + + /* Assign view to all flowTransitions */ + if (defaultTransition) { + defaultTransition.transitionView = root + } + + for (i = 0; i < root.flowWildcards.length; ++i) { + var w = root.flowWildcards[i] + w.transitionView = root + } + + var t + + for (i = 0; i < root.flowTransitions.length; ++i) { + t = root.flowTransitions[i] + t.transitionView = root + } + + for (i = 0; i < root.flowTransitions.length; ++i) { + t = root.flowTransitions[i] + if (root.checkInclude(t.from, root)) { + root.currentItem = t.to[0] + if (root.currentItem.stateChangeTarget !== undefined) { + root.currentItem.stateChangeTarget.setState(root.currentItem.targetState) + root.currentItem = root.currentItem.stateChangeTarget + } + } + } + + root.resetCurrentIndex() + + __setupCurrentItem() + __isCompleted = true + } + + function checkInclude(list, item) + { + for (var i = 0; i < list.length; ++i) { + if (list[i] === item) + return true + } + return false + } + + function scheduleTransition() + { + root.progress = 0 + + var pageTransition = null + + /* find correct transition */ + for (var i = 0; i < root.flowTransitions.length; ++i) { + var t = root.flowTransitions[i] + if (checkInclude(t.from, root.currentItem) && checkInclude(t.to, root.nextItem)) { + pageTransition = t + } + } + + if (pageTransition !== null) { + + } else { + pageTransition = root.defaultTransition + } + + if (root.currentTransition) + root.currentTransition.__stop() + + /* If a specific transition is forced then use this one. */ + if (__forceTransition) + pageTransition = __forceTransition + __forceTransition = null + + root.currentTransition = pageTransition + if (root.currentTransition) + root.currentTransition.__reset(root.currentItem, root.nextItem) + + root.progress = Qt.binding(function () { + if (root.currentTransition) + return root.currentTransition.progress + return 0 + }) + } + + onCurrentIndexChanged: { + root.nextItem = root.allChildren[root.currentIndex] + + if (root.nextItem === root.currentItem) + return + + if (root.__blockSchedule) + return + + if (root.nextItem.stateChangeTarget !== undefined) { + var itemVar = root.nextItem.stateChangeTarget + var stateVar = root.nextItem.targetState + itemVar.state = stateVar + for (var i = 0; i < root.allChildren.length; ++i) { + if (root.allChildren[i] === itemVar) + root.currentIndex = i + } + } + + scheduleTransition() + + if (!root.__blockHistory) { + root.lastItem = root.currentItem + if (!Array.isArray(root.__history)) + root.__history = [] + + root.__history.push(root.lastItem) + } + + root.currentTransition.__start() + } + + function __setupCurrentItem() { + if (root.currentItem) + root.currentItem.parent = stack + + if (root.nextItem) + root.currentItem = root.nextItem + else + root.currentItem = root.allChildren[root.currentIndex] + + + root.currentItem.parent = root + root.currentTransition = null + transitionFinished() + } + + function gotoPage(transition) { + var page = transition.to[0] + /* There might be another transition that fits. We are forcing this one. */ + __forceTransition = transition + for (var i = 0; i < root.allChildren.length; ++i) { + if (page === root.allChildren[i]) { + root.currentIndex = i + } + } + } + + property var allChildren + + property Item __fromContentItem: Item { + width: root.width + height: root.height + parent: root + } + + property Item __toContentItem: Item { + width: root.width + height: root.height + parent: root + } +} + + diff --git a/Dependencies/Components/imports/flowview/CMakeLists.txt b/Dependencies/Components/imports/flowview/CMakeLists.txt new file mode 100644 index 0000000..20783da --- /dev/null +++ b/Dependencies/Components/imports/flowview/CMakeLists.txt @@ -0,0 +1,45 @@ +set_source_files_properties(FlowState.qml + PROPERTIES + QT_QML_SINGLETON_TYPE true +) + +qt_add_library(FlowView STATIC) +qt6_add_qml_module(FlowView + URI "FlowView" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + ${qds_qml_extra_args} + NO_GENERATE_QMLDIR + NO_LINT + NO_CACHEGEN + QML_FILES + DefaultFlowEffect.qml + SwipeInteraction.qml + FlowEffect.qml + FlowFadeEffect.qml + FlowPushLeftEffect.qml + FlowPushRightEffect.qml + FlowSlideDownEffect.qml + FlowSlideLeftEffect.qml + FlowSlideRightEffect.qml + FlowSlideUpEffect.qml + FlowMoveEffect.qml + FlowPushEffect.qml + FlowTransition.qml + FlowTransitionList.qml + FlowView.qml + FlowPushUpEffect.qml + FlowItem.qml + FlowDecision.qml + FlowWildcard.qml + FlowActionArea.qml + FlowState.qml + +DesignMode/FlowItem.qml + +DesignMode/FlowView.qml + RESOURCES + qmldir +) + +register_plugin(FlowView) diff --git a/Dependencies/Components/imports/flowview/DefaultFlowEffect.qml b/Dependencies/Components/imports/flowview/DefaultFlowEffect.qml new file mode 100644 index 0000000..bd7e030 --- /dev/null +++ b/Dependencies/Components/imports/flowview/DefaultFlowEffect.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +FlowEffect { + //No Effect + duration: 0 +} diff --git a/Dependencies/Components/imports/flowview/FlowActionArea.qml b/Dependencies/Components/imports/flowview/FlowActionArea.qml new file mode 100644 index 0000000..6852d83 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowActionArea.qml @@ -0,0 +1,213 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.12 +import QtQuick.Studio.EventSystem 1.0 + +Item { + width: 80 + height: 40 + + id: root + + enum ActionType{ + LeftPress = 0, + LeftDoublePress = 1, + LeftLongPress = 2, + RightPress = 3, + RightDoublePress = 4, + RightLongPress = 5, + FlickUp = 6, + FlickDown = 7, + FlickLeft = 8, + FlickRight = 9, + PinchIn = 10, + PinchOut = 11 + } + + Item { + id: priv + + property double dragStartTime; + property point dragStartPoint; + } + + signal triggered + + property real maxDragTime: 500 + property real minDragDistance: 50 + property real minPinchFactor: 2.0 + + property int eventType: FlowActionArea.LeftPress + + TapHandler { + enabled: (root.eventType >= FlowActionArea.LeftPress && root.eventType <= FlowActionArea.LeftLongPress) + acceptedButtons: Qt.LeftButton + onTapped: if (root.eventType === FlowActionArea.LeftPress) { root.trigger(); } + onDoubleTapped: if (root.eventType === FlowActionArea.LeftDoublePress) { root.trigger(); } + onLongPressed: if (root.eventType === FlowActionArea.LeftLongPress) { root.trigger(); } + } + + TapHandler { + enabled: (root.eventType >= FlowActionArea.RightPress && root.eventType <= FlowActionArea.RightLongPress) + acceptedButtons: Qt.RightButton + onTapped: if (root.eventType === FlowActionArea.RightPress) { root.trigger(); } + onDoubleTapped: if (root.eventType === FlowActionArea.RightDoublePress) { root.trigger(); } + onLongPressed: if (root.eventType === FlowActionArea.RightLongPress) { root.trigger(); } + } + + PointHandler { + enabled: (root.eventType >= FlowActionArea.FlickUp && root.eventType <= FlowActionArea.FlickRight) + target: null + + onActiveChanged: { + if (active) { + priv.dragStartTime = Date.now(); + priv.dragStartPoint = point.position; + } else { + var time = Date.now() - priv.dragStartTime; + var distance = root.moveDistance(priv.dragStartPoint, point.position); + if (time < root.maxDragTime && distance > root.minDragDistance){ + var angle = root.moveAngle(priv.dragStartPoint, point.position); + + switch (root.eventType){ + case FlowActionArea.FlickUp: + if (angle > 2.618 || angle < -2.618) { + root.trigger(); + } + break; + case FlowActionArea.FlickDown: + if (angle < 0.524 && angle > -0.524) { + root.trigger(); + } + break; + case FlowActionArea.FlickLeft: + if (angle < -1.047 && angle > -2.094) { + root.trigger(); + } + break; + case FlowActionArea.FlickRight: + if (angle < 2.094 && angle > 1.047) { + root.trigger(); + } + break; + } + } + } + } + } + + PinchHandler { + enabled: (root.eventType === FlowActionArea.PinchIn || root.eventType === FlowActionArea.PinchOut) + target: null + + onActiveChanged: { + if (active) { + priv.dragStartTime = Date.now(); + } else { + var time = Date.now() - priv.dragStartTime; + if (time < root.maxDragTime) { + if (root.eventType === FlowActionArea.PinchIn && activeScale < (1.0 / root.minPinchFactor)) { + root.trigger(); + } else if (root.eventType === FlowActionArea.PinchOut && activeScale > root.minPinchFactor) { + root.trigger(); + } + } + } + } + } + + function moveDistance(start, end){ + var x = end.x - start.x; + var y = end.y - start.y; + return Math.sqrt(x*x+y*y); + } + + function moveAngle(start, end){ + var x = end.x - start.x; + var y = end.y - start.y; + return Math.atan2(x,y); + } + + function trigger() { + + var one = root.activeState + var two = root.parent.state + + if (one !== two) + return + + if (root.goBack) { + var par = root.parent + while (par) { + if (par.__isFlowView) { + par.goBack() + return + } + par = par.parent + } + } else { + target.trigger() + } + + root.triggered() + } + + property Connections connections : Connections { + id: connections + } + + property QtObject target + + readonly property bool isActionArea: true + property bool fromStateChange: false + + property string activeState: "" + + enabled: (target !== null || root.goBack) && (root.activeState === root.parent.state) + + property bool goBack: false + + property alias eventIds: eventListener.eventIds + + function __receiveEvent(parameters) { + var flowItem = root.parent + var flow = flowItem.parent + + if (flow.currentItem !== flowItem) + return; + + root.trigger() + } + + EventListener { + id: eventListener + onTriggered: root.__receiveEvent(parameters) + } +} diff --git a/Dependencies/Components/imports/flowview/FlowDecision.qml b/Dependencies/Components/imports/flowview/FlowDecision.qml new file mode 100644 index 0000000..bec7a92 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowDecision.qml @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.Window 2.14 +import QtQuick.Controls 2.15 + +QtObject { + id: root + + property list targets + + readonly property bool isFlowDecision: true + + property string dialogTitle: qsTr("Title") + + function trigger() { + var hasDialog = false + for (var i = 0; i < root.targets.length; ++i) { + if (root.targets[i].question !== "") + hasDialog = true + } + + if (hasDialog) { + loader.show() + } + } + + property Loader loader: Loader { + active: false + function show() { + active = true + item.show() + item.raise() + item.requestActivate() + } + + sourceComponent: windowComponent + } + + property Component windowComponent: Component { + + Window { + + id: dialog + + title: root.dialogTitle + modality: Qt.WindowModal + transientParent: root.Window.window + + width: 400 + height: column.height + + minimumWidth: 400 + minimumHeight: 100 + flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.WindowTitleHint + + Rectangle { + id: background + anchors.fill: parent + + ScrollView { + anchors.fill: parent + + + Column { + id: column + Repeater { + model: targets + Rectangle { + visible: root.targets[index].question !== "" + width: background.width + height: 20 + opacity: mouseArea.containsMouse ? 1 : 0.8 + color: index / 2 ? "#ebecf0" : "white" + MouseArea { + id: mouseArea + hoverEnabled: true + onClicked: { + root.targets[index].__decisionTrigger() + loader.item.close() + loader.active = false + } + anchors.fill: parent + } + + Text { + height: 20 + text: root.targets[index].question + verticalAlignment: Text.AlignVCenter + } + } + } + } + } + } + } + + } +} diff --git a/Dependencies/Components/imports/flowview/FlowEffect.qml b/Dependencies/Components/imports/flowview/FlowEffect.qml new file mode 100644 index 0000000..2cff184 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowEffect.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.Timeline 1.0 + +QtObject { + id: root + signal finished + signal started + signal reseted + function reset() { + /* + if (root.duration === 0) { + root.transitionView.__setupCurrentItem() + return + }*/ + + /* We set the parents to the content items to apply effects */ + + resetProperties() + + from.parent = transitionView.__fromContentItem + to.parent = transitionView.__toContentItem + root.progress = root.backwards ? 100 : 0 + + enable() + root.progress = -1 + root.progress = 0 + } + + property bool __aborted: false + + function enable() { + timeline.enabled = true + root.started() + } + + function start() { + anim.from = Math.min(root.progress, 100) + anim.to = root.backwards ? 0 : 100 + anim.duration = root.duration * Math.abs(anim.to - anim.from) / 100 + + root.__aborted = false + + anim.start() + } + + function abort() { + + anim.from = root.progress + anim.to = root.backwards ? 100 : 0 + + anim.duration = root.duration * Math.abs(anim.from - anim.to) / 100 + + root.__aborted = true + anim.restart() + + } + + function stop() { + anim.stop() + } + + property Item from + property Item to + + property Item transitionView + + property real duration: 250 + property alias easing: anim.easing + + property Timeline timeline: Timeline { + + } + + property real progress: 0 + + property bool backwards: false + + property Binding timelineBinding: Binding { + target: timeline + property: "currentFrame" + value: root.progress * 10 + } + + function resetProperties() { + transitionView.__fromContentItem.opacity = 1 + transitionView.__fromContentItem.x = 0 + transitionView.__fromContentItem.y = 0 + transitionView.__fromContentItem.z = 0 + transitionView.__fromContentItem.scale = 1 + + transitionView.__toContentItem.opacity = 1 + transitionView.__toContentItem.x = 0 + transitionView.__toContentItem.y = 0 + transitionView.__toContentItem.z = 0 + transitionView.__toContentItem.scale = 1 + } + + property PropertyAnimation __anim: PropertyAnimation { + id: anim + duration: 250 + loops: 1 + target: root + property: "progress" + onStopped: { + timeline.enabled = false + /* reset all typical properties */ + + resetProperties() + + root.finished() + + if (!root.__aborted) { + root.transitionView.__setupCurrentItem() + } else { + if (root.transitionView.nextItem) { + root.transitionView.nextItem.parent = transitionView.__stack + root.transitionView.nextItem = root.transitionView.currentItem + } + root.transitionView.__setupCurrentItem() + root.transitionView.nextItem = null + } + + root.progress = 0 + } + } + +} diff --git a/Dependencies/Components/imports/flowview/FlowFadeEffect.qml b/Dependencies/Components/imports/flowview/FlowFadeEffect.qml new file mode 100644 index 0000000..6797b1f --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowFadeEffect.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + //Fade Effect + duration: 250 + onStarted: { + group01.target = transitionView.__fromContentItem + group02.target = transitionView.__toContentItem + } + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "opacity" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + KeyframeGroup { + id: group02 + + property: "opacity" + + Keyframe { + frame: 0 + value: 0 + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowItem.qml b/Dependencies/Components/imports/flowview/FlowItem.qml new file mode 100644 index 0000000..b87007a --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowItem.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.12 + +Item { + id: flowItem + + width: 400 + height: 400 + + property var flowView: Item {} + + property alias loaderSource: loader.source + + property var stateChangeTarget + + property string targetState + + property string defaultState: undefined + + property bool forceActive: false + + property bool __isFlowItem: true + + function setState(newState) { + flowItem.state = newState + } + + property bool active: { + if (flowItem.forceActive) + return true; + if (flowItem.flowView !== null + && flowItem.flowView.currentItem !== undefined + && flowItem.flowView.currentItem === flowItem) + return true + + if (flowItem.flowView !== null + && flowItem.flowView.nextItem !== undefined + && flowItem.flowView.nextItem === flowItem) + return true + + return false + } + + Loader { + id: loader + active: flowItem.active + } + + + function init() { + + flowItem.x = 0 + flowItem.y = 0 + + flowItem.defaultState = flowItem.state + var itemVar + var i + + if (flowItem.stateChangeTarget === undefined) { + + for (i = 0; i < flowItem.children.length; ++i) { + itemVar = flowItem.children[i] + if (itemVar.isActionArea === true + && !itemVar.fromStateChange) { + itemVar.activeState = flowItem.state + } + + } + } else { + var childNum = flowItem.children.length + var childArray = [] + + for (i = 0; i < flowItem.children.length; ++i) { + childArray.push(flowItem.children[i]) + } + + for (i = 0; i < childNum; ++i) { + itemVar = childArray[i] + + if (itemVar.isActionArea === true) { + itemVar.fromStateChange = true + itemVar.activeState = flowItem.targetState + itemVar.parent = flowItem.stateChangeTarget + } + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowMoveEffect.qml b/Dependencies/Components/imports/flowview/FlowMoveEffect.qml new file mode 100644 index 0000000..de3ecda --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowMoveEffect.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + property real itemHeight: transitionView.height + property int direction: 0 + //left, right, up, down + + duration: 250 + onStarted: { + group01.target = effect.transitionView.__toContentItem + group02.target = effect.transitionView.__toContentItem + } + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "x" + + Keyframe { + frame: 0 + + value: { + if (effect.direction === 0) + return -effect.transitionView.width + if (effect.direction === 1) + return effect.transitionView.width + return 0 + } + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + + KeyframeGroup { + id: group02 + + property: "y" + + Keyframe { + frame: 0 + + value: { + if (effect.direction === 2) + return -effect.itemHeight + if (effect.direction === 3) + return effect.itemHeight + return 0 + } + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + + + } +} diff --git a/Dependencies/Components/imports/flowview/FlowPushEffect.qml b/Dependencies/Components/imports/flowview/FlowPushEffect.qml new file mode 100644 index 0000000..3fb911a --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowPushEffect.qml @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + property real scale: 1 + property real inOpacity: 1 + property real outOpacity: 1 + + property int direction: 0 + //left, right, up, down + + property bool revealCurrent: false + property int itemHeight: effect.transitionView.height + + duration: 250 + onStarted: { + group01.target = transitionView.__fromContentItem + group02.target = transitionView.__toContentItem + group03.target = transitionView.__fromContentItem + group04.target = transitionView.__toContentItem + group05.target = transitionView.__fromContentItem + group06.target = transitionView.__toContentItem + group07.target = transitionView.__fromContentItem + group08.target = transitionView.__toContentItem + if (effect.revealCurrent) + group01.target.z = 1 + } + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "x" + + Keyframe { + frame: 0 + value: 0 + } + + Keyframe { + frame: 1000 + value: { + if (effect.direction === 0) + return effect.transitionView.width + if (effect.direction === 1) + return -effect.transitionView.width + return 0 + } + easing: effect.easing + } + } + + KeyframeGroup { + id: group02 + + property: "x" + + Keyframe { + frame: 0 + value: { + if (effect.revealCurrent) + return 0 + if (effect.direction === 0) + return -effect.transitionView.width + if (effect.direction === 1) + return effect.transitionView.width + return 0 + } + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + KeyframeGroup { + id: group03 + + property: "scale" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.scale + easing: effect.easing + } + } + + KeyframeGroup { + id: group04 + + property: "scale" + + Keyframe { + frame: 0 + value: effect.scale + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + + KeyframeGroup { + id: group05 + + property: "opacity" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.outOpacity + easing: effect.easing + } + } + + KeyframeGroup { + id: group06 + + property: "opacity" + + Keyframe { + frame: 0 + value: effect.inOpacity + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + + KeyframeGroup { + id: group07 + + property: "y" + + Keyframe { + frame: 0 + value: 0 + } + + Keyframe { + frame: 1000 + + value: { + if (effect.direction === 2) + return -effect.itemHeight + if (effect.direction === 3) + return effect.itemHeight + return 0 + } + + easing: effect.easing + } + } + + KeyframeGroup { + id: group08 + + property: "y" + + Keyframe { + frame: 0 + + value: { + if (effect.revealCurrent) + return 0 + if (effect.direction === 2) + return effect.itemHeight + if (effect.direction === 3) + return -effect.itemHeight + return 0 + } + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowPushLeftEffect.qml b/Dependencies/Components/imports/flowview/FlowPushLeftEffect.qml new file mode 100644 index 0000000..886228c --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowPushLeftEffect.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + property real scale: 1 + property real opacity: 1 + + duration: 250 + onStarted: { + group01.target = transitionView.__fromContentItem + group02.target = transitionView.__toContentItem + group03.target = transitionView.__fromContentItem + group04.target = transitionView.__toContentItem + group05.target = transitionView.__fromContentItem + group06.target = transitionView.__toContentItem + } + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "x" + + Keyframe { + frame: 0 + value: 0 + } + + Keyframe { + frame: 1000 + value: effect.transitionView.width + easing: effect.easing + } + } + + KeyframeGroup { + id: group02 + + property: "x" + + Keyframe { + frame: 0 + value: -effect.transitionView.width + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + KeyframeGroup { + id: group03 + + property: "scale" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.scale + easing: effect.easing + } + } + + KeyframeGroup { + id: group04 + + property: "scale" + + Keyframe { + frame: 0 + value: effect.scale + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + + KeyframeGroup { + id: group05 + + property: "opacity" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.opacity + easing: effect.easing + } + } + + KeyframeGroup { + id: group06 + + property: "opacity" + + Keyframe { + frame: 0 + value: effect.opacity + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowPushRightEffect.qml b/Dependencies/Components/imports/flowview/FlowPushRightEffect.qml new file mode 100644 index 0000000..cb169d4 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowPushRightEffect.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + property real scale: 1 + property real opacity: 1 + + duration: 250 + onStarted: { + group01.target = transitionView.__fromContentItem + group02.target = transitionView.__toContentItem + group03.target = transitionView.__fromContentItem + group04.target = transitionView.__toContentItem + group05.target = transitionView.__fromContentItem + group06.target = transitionView.__toContentItem + } + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "x" + + Keyframe { + frame: 0 + value: 0 + } + + Keyframe { + frame: 1000 + value: -effect.transitionView.width + easing: effect.easing + } + } + + KeyframeGroup { + id: group02 + + property: "x" + + Keyframe { + frame: 0 + value: effect.transitionView.width + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + KeyframeGroup { + id: group03 + + property: "scale" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.scale + easing: effect.easing + } + } + + KeyframeGroup { + id: group04 + + property: "scale" + + Keyframe { + frame: 0 + value: effect.scale + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + + KeyframeGroup { + id: group05 + + property: "opacity" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.opacity + easing: effect.easing + } + } + + KeyframeGroup { + id: group06 + + property: "opacity" + + Keyframe { + frame: 0 + value: effect.opacity + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowPushUpEffect.qml b/Dependencies/Components/imports/flowview/FlowPushUpEffect.qml new file mode 100644 index 0000000..888d72c --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowPushUpEffect.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + property real scale: 1 + property real inOpacity: 1 + property real outOpacity: 1 + + property int fromItemHeight: effect.transitionView.height + + property bool revealCurrent: false + + duration: 250 + onStarted: { + group01.target = transitionView.__fromContentItem + group02.target = transitionView.__toContentItem + group03.target = transitionView.__fromContentItem + group04.target = transitionView.__toContentItem + group05.target = transitionView.__fromContentItem + group06.target = transitionView.__toContentItem + if (effect.revealCurrent) + group01.target.z = 1 + } + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "y" + + Keyframe { + frame: 0 + value: 0 + } + + Keyframe { + frame: 1000 + value: -fromItemHeight + easing: effect.easing + } + } + + KeyframeGroup { + id: group02 + + property: "y" + + Keyframe { + frame: 0 + value: effect.revealCurrent ? 0 : effect.transitionView.height + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + KeyframeGroup { + id: group03 + + property: "scale" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.scale + easing: effect.easing + } + } + + KeyframeGroup { + id: group04 + + property: "scale" + + Keyframe { + frame: 0 + value: effect.scale + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + + KeyframeGroup { + id: group05 + + property: "opacity" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.outOpacity + easing: effect.easing + } + } + + KeyframeGroup { + id: group06 + + property: "opacity" + + Keyframe { + frame: 0 + value: effect.inOpacity + } + + Keyframe { + frame: 1000 + value: 1 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowSlideDownEffect.qml b/Dependencies/Components/imports/flowview/FlowSlideDownEffect.qml new file mode 100644 index 0000000..aba3fb8 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowSlideDownEffect.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + property real itemHeight: transitionView.height + property real outOpacity: 1 + + duration: 250 + onStarted: { + group01.target = transitionView.__toContentItem + group02.target = transitionView.__fromContentItem + group01.target.z = 1 + } + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "y" + + Keyframe { + frame: 0 + value: -effect.itemHeight + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + + KeyframeGroup { + id: group02 + + property: "opacity" + + Keyframe { + frame: 0 + value: 1 + } + + Keyframe { + frame: 1000 + value: effect.outOpacity + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowSlideLeftEffect.qml b/Dependencies/Components/imports/flowview/FlowSlideLeftEffect.qml new file mode 100644 index 0000000..a56ffc5 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowSlideLeftEffect.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + duration: 250 + onStarted: group01.target = transitionView.__toContentItem + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "x" + + Keyframe { + frame: 0 + value: -transitionView.width + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowSlideRightEffect.qml b/Dependencies/Components/imports/flowview/FlowSlideRightEffect.qml new file mode 100644 index 0000000..b1f9353 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowSlideRightEffect.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + duration: 250 + onStarted: group01.target = transitionView.__toContentItem + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "x" + + Keyframe { + frame: 0 + value:transitionView.width + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowSlideUpEffect.qml b/Dependencies/Components/imports/flowview/FlowSlideUpEffect.qml new file mode 100644 index 0000000..5dbddd8 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowSlideUpEffect.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Timeline 1.0 + +FlowEffect { + id: effect + + duration: 250 + onStarted: group01.target = transitionView.__toContentItem + + timeline: Timeline { + startFrame: 0 + endFrame: 1000 + + KeyframeGroup { + id: group01 + + property: "y" + + Keyframe { + frame: 0 + value: transitionView.height + } + + Keyframe { + frame: 1000 + value: 0 + easing: effect.easing + } + } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowState.qml b/Dependencies/Components/imports/flowview/FlowState.qml new file mode 100644 index 0000000..6f16db7 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowState.qml @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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$ +** +****************************************************************************/ +pragma Singleton +import QtQuick 2.15 + +QtObject { + id: object + + property bool loading: false +} diff --git a/Dependencies/Components/imports/flowview/FlowTransition.qml b/Dependencies/Components/imports/flowview/FlowTransition.qml new file mode 100644 index 0000000..5ff1d27 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowTransition.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.Studio.EventSystem 1.0 + +QtObject { + id: root + + signal finished + + /* Those should be lists that allow a n*n mappings. */ + //property Item from: null + //property Item to: null + property list from + property list to + property int duration + + property var transitionView: Item {} + + property real progress: effect.progress + + property bool condition: true + + property string question + + function __start() { + root.effect.start() + } + + function __enable() { + effect.enable() + } + + function __reset(current, next) { + root.effect.from = current + root.effect.to = next + root.effect.transitionView = root.transitionView + + root.effect.reset() + } + + function __stop(current, next) { + root.effect.stop() + } + + function __checkInclude(list, item) { + for (var i = 0; i < list.length; ++i) { + if (list[i] === item) + return true + } + return false + } + + property alias eventIds: eventListener.eventIds + + function __receiveEvent(parameters) { + var flowItem = root.from[0] + var flow = root.transitionView + + if (flowItem.stateChangeTarget !== undefined + && flowItem.stateChangeTarget === flow.currentItem) { + if (flowItem.targetState === flow.currentItem.state) + flowItem = flowItem.stateChangeTarget + } + + if (flow.currentItem !== flowItem) + return; + + root.trigger() + } + + property EventListener eventListener: EventListener { + id: eventListener + onTriggered: root.__receiveEvent(parameters) + } + + function trigger() { + var fromEmpty = root.from.length === 0 + + if (to[0].isFlowDecision === true) + to[0].trigger(); + + var stateChanger = false + + if (root.from[0] !== undefined) + stateChanger = root.from[0].stateChangeTarget !== undefined + + var toStateChanger = false + + if (root.to[0] !== undefined) + toStateChanger = root.to[0].stateChangeTarget !== undefined + + if (!toStateChanger && root.to[0].defaultState !== undefined) + root.to[0].state = root.to[0].defaultState + + if (stateChanger || fromEmpty || __checkInclude(root.from, transitionView.currentItem)) + timer.restart() + } + + function __decisionTrigger() { + /* Workaround for flowDecisions with multiple sources */ + if (!__checkInclude(root.from, transitionView.currentItem) && root.from.length !== 0) + root.from = [] + root.trigger() + } + + property Timer timer: Timer { + interval: 1 + running: false + repeat: false + onTriggered: transitionView.gotoPage(root) + } + + property FlowEffect effect: DefaultFlowEffect { + transitionView: transitionView + + } + + onEffectChanged: { + root.effect.transitionView = root.transitionView + } + + property Connections effectConnection: Connections { + target: root.effect + function onFinished() { root.finished() } + } +} diff --git a/Dependencies/Components/imports/flowview/FlowTransitionList.qml b/Dependencies/Components/imports/flowview/FlowTransitionList.qml new file mode 100644 index 0000000..e2aa4ae --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowTransitionList.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.12 + +QtObject { + id: list + property Item intialItem + //has next prev and most likely currentIndex, count + property var items + + property Item nextItem + property Item prevItem + + property Item currentItem + + onCurrentItemChanged: { + + var currentIndex = list.__indexForCurrentItem() + + if (currentIndex < (list.items.length - 1)) + list.nextItem = list.items[currentIndex + 1] + if (currentIndex > 0) + list.prevItem = list.items[currentIndex - 1] + + } + + function __indexForCurrentItem() { + var currentIndex = -1 + for (var i = 0; i < list.items.length; ++i) { + var item = list.items[i] + if (item === list.currentItem) + currentIndex = i + } + return currentIndex + } + + property int length: items.length + + function next() { + var currentIndex = list.__indexForCurrentItem() + + list.nextItem = null + + if (currentIndex > -1 && (currentIndex < list.items.length - 1)) { + list.prevItem = list.items[currentIndex] + list.currentItem = list.items[currentIndex + 1] + if (currentIndex + 2 < list.items.length) + list.nextItem = list.items[currentIndex + 2] + } + } + + function prev() { + var currentIndex = list.__indexForCurrentItem() + + list.prevItem = null + + if (currentIndex > 0 && currentIndex < (list.items.length)) { + if (currentIndex - 2 >= 0) + list.prevItem = list.items[currentIndex - 2] + list.currentItem = list.items[currentIndex - 1] + + list.nextItem = list.items[currentIndex] + } + } + + Component.onCompleted: { + list.currentItem = list.intialItem + var currentIndex = list.__indexForCurrentItem() + if (currentIndex < (list.items.length - 1)) + list.nextItem = list.items[currentIndex + 1] + if (currentIndex > 0) + list.prevItem = list.items[currentIndex - 1] + } +} diff --git a/Dependencies/Components/imports/flowview/FlowView.qml b/Dependencies/Components/imports/flowview/FlowView.qml new file mode 100644 index 0000000..ab4002f --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowView.qml @@ -0,0 +1,348 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +Item { + id: root + width: 200 + height: 200 + + property FlowTransition defaultTransition + + property FlowTransition currentTransition + + property FlowTransition __forceTransition + + property list flowTransitions + property list flowDecisions + property list flowWildcards + + property Item interaction: Item { + } + + property bool __parentFlowChanged: false + + enum EffectEnum { + Instant, + Dissolve, + Fade, + Pop + } + + property bool __blockHistory: false + + property bool __isFlowView: true + + function goBack() { + if (root.__history.length === 0) + return + + if (root.__parentFlowChanged) { + root.__parentFlowChanged = false + parentFlowView().goBack() + } + + var poppedItem = root.__history.pop() + + root.__blockHistory = true + root.activatedItem = poppedItem + root.__activateItem() + root.__blockHistory = false + + + if (root.__history.length > 0) + root.lastItem = root.__history.slice(-1)[0] + else + root.lastItem = null + } + + function __activateItem() { + if (!__isCompleted) + return + + if (root.activatedItem === root.currentItem) + return; + + if (root.activatedItem === root.nextItem) + return; + + root.nextItem = root.activatedItem + + for (var i = 0; i < root.allChildren.length; ++i) { + if (root.allChildren[i] === root.activatedItem) + root.currentIndex = i + } + + } + + function parentFlowView() { + var par = root.parent + while (par) { + if (par.__isFlowView) + return par + par = par.parent + } + return null + } + + function parentFlowItem() { + var par = root.parent + while (par) { + if (par.__isFlowItem) + return par + par = par.parent + } + return null + + } + + default property alias item: stack.data + + property Item nextItem + + property Item currentItem + property Item activatedItem + property Item lastItem + property int currentIndex: 0 + + //property list __history + property var __history: [] + + property int maxIndex: 0 + + signal transitionFinished + + property alias __stack: stack + + Item { + id: stack + visible: false + } + + property bool __isCompleted: false + + property real progress: 0 + + property bool __blockSchedule: false + + onActivatedItemChanged: { + root.__activateItem() + } + + function resetCurrentIndex() { + root.__blockSchedule = true + root.lastItem = root.currentItem + root.__history.push(root.lastItem) + + for (var i = 0; i < root.allChildren.length; ++i) { + if (root.allChildren[i] === root.currentItem) + root.currentIndex = i + } + root.__blockSchedule = false + } + + Component.onCompleted: { + root.maxIndex = stack.children.length - 1 + + root.allChildren = [] + + for (var i = 0; i < stack.children.length; ++i) { + root.allChildren.push(stack.children[i]) + if (stack.children[i].flowView !== undefined) { + stack.children[i].flowView = root + stack.children[i].init() + } + } + + /* Assign view to all flowTransitions */ + if (defaultTransition) { + defaultTransition.transitionView = root + } + + for (i = 0; i < root.flowWildcards.length; ++i) { + var w = root.flowWildcards[i] + w.transitionView = root + } + + var t + + for (i = 0; i < root.flowTransitions.length; ++i) { + t = root.flowTransitions[i] + t.transitionView = root + } + + for (i = 0; i < root.flowTransitions.length; ++i) { + t = root.flowTransitions[i] + if (root.checkInclude(t.from, root)) { + root.currentItem = t.to[0] + if (root.currentItem.stateChangeTarget !== undefined) { + root.currentItem.stateChangeTarget.setState(root.currentItem.targetState) + root.currentItem = root.currentItem.stateChangeTarget + } + } + } + + root.resetCurrentIndex() + + __setupCurrentItem() + __isCompleted = true + } + + function checkInclude(list, item) + { + for (var i = 0; i < list.length; ++i) { + if (list[i] === item) + return true + } + return false + } + + function scheduleTransition() + { + root.progress = 0 + + var pageTransition = null + + /* find correct transition */ + for (var i = 0; i < root.flowTransitions.length; ++i) { + var t = root.flowTransitions[i] + if (checkInclude(t.from, root.currentItem) && checkInclude(t.to, root.nextItem)) { + pageTransition = t + } + } + + if (pageTransition !== null) { + + } else { + pageTransition = root.defaultTransition + } + + if (root.currentTransition) + root.currentTransition.__stop() + + /* If a specific transition is forced then use this one. */ + if (__forceTransition) + pageTransition = __forceTransition + __forceTransition = null + + root.currentTransition = pageTransition + if (root.currentTransition) + root.currentTransition.__reset(root.currentItem, root.nextItem) + + root.progress = Qt.binding(function () { + if (root.currentTransition) + return root.currentTransition.progress + return 0 + }) + } + + onCurrentIndexChanged: { + root.nextItem = root.allChildren[root.currentIndex] + + if (root.nextItem === root.currentItem) + return + + if (root.__blockSchedule) + return + + if (root.nextItem.stateChangeTarget !== undefined) { + var itemVar = root.nextItem.stateChangeTarget + var stateVar = root.nextItem.targetState + itemVar.state = stateVar + for (var i = 0; i < root.allChildren.length; ++i) { + if (root.allChildren[i] === itemVar) + root.currentIndex = i + } + } + + scheduleTransition() + + if (!root.__blockHistory) { + root.lastItem = root.currentItem + if (!Array.isArray(root.__history)) + root.__history = [] + + root.__history.push(root.lastItem) + } + + root.currentTransition.__start() + } + + function __setupCurrentItem() { + if (root.currentItem) + root.currentItem.parent = stack + + if (root.nextItem) + root.currentItem = root.nextItem + else + root.currentItem = root.allChildren[root.currentIndex] + + + root.currentItem.parent = root + root.currentTransition = null + transitionFinished() + } + + function gotoPage(transition) { + var page = transition.to[0] + /* There might be another transition that fits. We are forcing this one. */ + __forceTransition = transition + for (var i = 0; i < root.allChildren.length; ++i) { + if (page === root.allChildren[i]) { + root.currentIndex = i + } + } + } + + function gotoItem(item) { + for (var i = 0; i < root.allChildren.length; ++i) { + if (item === root.allChildren[i]) { + root.currentIndex = i + print("index " + i ) + } + } + } + + property var allChildren + + property Item __fromContentItem: Item { + width: root.width + height: root.height + parent: root + } + + property Item __toContentItem: Item { + width: root.width + height: root.height + parent: root + } +} + + diff --git a/Dependencies/Components/imports/flowview/FlowWildcard.qml b/Dependencies/Components/imports/flowview/FlowWildcard.qml new file mode 100644 index 0000000..b814c52 --- /dev/null +++ b/Dependencies/Components/imports/flowview/FlowWildcard.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.Studio.EventSystem 1.0 + +QtObject { + id: root + + property list positivelist + property list negativelist + + default property list data + + property FlowTransition target + + property var transitionView: Item {} + + property bool globalWildcard: false + + function trigger() { + var cItem = root.transitionView.currentItem + + if (root.globalWildcard && root.transitionView.parentFlowView()) { + root.transitionView.__parentFlowChanged = true + root.transitionView.parentFlowView().gotoItem(root.transitionView.parentFlowItem()) + } + + if (cItem === undefined) + return + + if (root.transitionView.checkInclude(root.negativelist, cItem)) + return; + + if (root.positivelist.length !== 0) { + if (!root.transitionView.checkInclude(root.positivelist, cItem)) + return; + } + + root.target.trigger() + } + + property EventListener eventListener: EventListener { + id: eventListener + onTriggered: root.trigger() + } + + property alias eventIds: eventListener.eventIds +} + + diff --git a/Dependencies/Components/imports/flowview/SwipeInteraction.qml b/Dependencies/Components/imports/flowview/SwipeInteraction.qml new file mode 100644 index 0000000..7c7472e --- /dev/null +++ b/Dependencies/Components/imports/flowview/SwipeInteraction.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.12 +import TransitionItem 1.0 +import QtQuick.Controls 2.3 +import QtQuick.Timeline 1.0 + +Item { + id: root + property var transitionView + property var list + parent: transitionView + anchors.fill: parent + z: -1 + + property real threshold: 35 + property bool horizontal: true + property Item __activeItem + property bool __reactToTransition: false + + Timer { + id: blocker + running: false + interval: 200 + repeat: false + onTriggered: handler.enabled = true + } + + Connections { + target: transitionView + function onTransitionFinished() { + if (!root.__reactToTransition) + return + /* This is a tricky one. We have to also update the list. + The connection could be also done the other way around */ + list.currentItem = root.__activeItem + root.__reactToTransition = false + } + } + + DragHandler { + id: handler + xAxis.enabled: root.horizontal + yAxis.enabled: !root.horizontal + target: null + enabled: true + + function distance() { + if (root.horizontal) + return (centroid.position.x - centroid.pressPosition.x) / transitionView.width + return -(centroid.position.y - centroid.pressPosition.y) / transitionView.height + } + + onActiveChanged: { + if (handler.active) { + if (distance() < 0) + transitionView.nextItem = list.nextItem + else + transitionView.nextItem = list.prevItem + + transitionView.scheduleTransition() + if (transitionView.currentTransition) + transitionView.currentTransition.effect.enable() + } else { + var p = Math.abs(distance()) * 100 + if (transitionView.currentTransition && transitionView.currentTransition.effect.progress > root.threshold) { + root.__activeItem = transitionView.nextItem + root.__reactToTransition = true + transitionView.currentTransition.__start() + } else { /* Drag was released, but threshold was not passed */ + if (transitionView.currentTransition) + transitionView.currentTransition.effect.abort() + } + /* Block for 100ms */ + handler.enabled = false + blocker.start() + } + } + + onCentroidChanged: { + if (!handler.enabled) + return + + var p = Math.abs(distance()) * 100 + + if (transitionView.currentTransition) + transitionView.currentTransition.effect.progress = p * 2 + } + } +} diff --git a/Dependencies/Components/imports/flowview/plugins.qmltypes b/Dependencies/Components/imports/flowview/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/flowview/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.11" + ] +} diff --git a/Dependencies/Components/imports/flowview/qmldir b/Dependencies/Components/imports/flowview/qmldir new file mode 100644 index 0000000..d46e216 --- /dev/null +++ b/Dependencies/Components/imports/flowview/qmldir @@ -0,0 +1,46 @@ +module FlowView +designersupported +typeinfo FlowView.qmltypes +DefaultFlowEffect 6.0 DefaultFlowEffect.qml +DefaultFlowEffect 1.0 DefaultFlowEffect.qml +SwipeInteraction 6.0 SwipeInteraction.qml +SwipeInteraction 1.0 SwipeInteraction.qml +FlowEffect 6.0 FlowEffect.qml +FlowEffect 1.0 FlowEffect.qml +FlowFadeEffect 6.0 FlowFadeEffect.qml +FlowFadeEffect 1.0 FlowFadeEffect.qml +FlowPushLeftEffect 6.0 FlowPushLeftEffect.qml +FlowPushLeftEffect 1.0 FlowPushLeftEffect.qml +FlowPushRightEffect 6.0 FlowPushRightEffect.qml +FlowPushRightEffect 1.0 FlowPushRightEffect.qml +FlowSlideDownEffect 6.0 FlowSlideDownEffect.qml +FlowSlideDownEffect 1.0 FlowSlideDownEffect.qml +FlowSlideLeftEffect 6.0 FlowSlideLeftEffect.qml +FlowSlideLeftEffect 1.0 FlowSlideLeftEffect.qml +FlowSlideRightEffect 6.0 FlowSlideRightEffect.qml +FlowSlideRightEffect 1.0 FlowSlideRightEffect.qml +FlowSlideUpEffect 6.0 FlowSlideUpEffect.qml +FlowSlideUpEffect 1.0 FlowSlideUpEffect.qml +FlowMoveEffect 6.0 FlowMoveEffect.qml +FlowMoveEffect 1.0 FlowMoveEffect.qml +FlowPushEffect 6.0 FlowPushEffect.qml +FlowPushEffect 1.0 FlowPushEffect.qml +FlowTransition 6.0 FlowTransition.qml +FlowTransition 1.0 FlowTransition.qml +FlowTransitionList 6.0 FlowTransitionList.qml +FlowTransitionList 1.0 FlowTransitionList.qml +FlowView 6.0 FlowView.qml +FlowView 1.0 FlowView.qml +FlowPushUpEffect 6.0 FlowPushUpEffect.qml +FlowPushUpEffect 1.0 FlowPushUpEffect.qml +FlowItem 6.0 FlowItem.qml +FlowItem 1.0 FlowItem.qml +FlowDecision 6.0 FlowDecision.qml +FlowDecision 1.0 FlowDecision.qml +FlowWildcard 6.0 FlowWildcard.qml +FlowWildcard 1.0 FlowWildcard.qml +FlowActionArea 6.0 FlowActionArea.qml +FlowActionArea 1.0 FlowActionArea.qml +singleton FlowState 6.0 FlowState.qml +singleton FlowState 1.0 FlowState.qml + diff --git a/Dependencies/Components/imports/flowview/qtstudioflowviewplugin.cpp b/Dependencies/Components/imports/flowview/qtstudioflowviewplugin.cpp new file mode 100644 index 0000000..790aaf9 --- /dev/null +++ b/Dependencies/Components/imports/flowview/qtstudioflowviewplugin.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class QtStudioFlowViewPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtStudioFlowViewPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +QtStudioFlowViewPlugin::QtStudioFlowViewPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ + +} + +void QtStudioFlowViewPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "qtstudioflowviewplugin.moc" diff --git a/Dependencies/Components/imports/logichelper/AndOperator.qml b/Dependencies/Components/imports/logichelper/AndOperator.qml new file mode 100644 index 0000000..2be3b41 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/AndOperator.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +/*! + \qmltype AndOperator + \inqmlmodule QtQuick.Studio.LogicHelper + \since QtQuick.Studio.LogicHelper 1.0 + \inherits QtObject + + \brief Evaluates two boolean input values and provides the result as output. + + The AndOperator type evaluates two boolean inputs, \l input01 and + \l input02. The \l output is evaluated as \c true if both \l input01 + and \l input02 are evaluated as \c true. + + Designers can use the And Operator type in \QDS instead of writing + JavaScript expressions. + + \section1 Example Usage + + In the following example, we use the checked state of two \l CheckBox + types to determine the checked state of a third one: + + \code + Rectangle { + CheckBox { + id: checkBox1 + text: qsTr("Check Box 1") + checked: false + } + CheckBox { + id: checkBox2 + text: qsTr("Check Box 2") + } + CheckBox { + id: checkBox3 + text: qsTr("Check Box 3") + checked: andOperator.output + } + AndOperator { + id: andOperator + input02: checkBox2.checked + input01: checkBox1.checked + } + } + \endcode + + \sa OrOperator, NotOperator +*/ + +QtObject { + id: object + +/*! + The first value to evaluate. +*/ + property bool input01: false + +/*! + The second value to evaluate. +*/ + property bool input02: false + +/*! + The result of the evaluation. +*/ + property bool output: object.input01 && object.input02 + +} diff --git a/Dependencies/Components/imports/logichelper/BidirectionalBinding.qml b/Dependencies/Components/imports/logichelper/BidirectionalBinding.qml new file mode 100644 index 0000000..fb33504 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/BidirectionalBinding.qml @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +/*! + \qmltype BidirectionalBinding + \inqmlmodule QtQuick.Studio.LogicHelper + \since QtQuick.Studio.LogicHelper 1.0 + \inherits QtObject + + \brief Binds the values of two controls bi-directionally. + + The BidirectionalBinding type binds the values of two controls + together, so that when one value is changed, the other one follows it. + For example, this type could be used to synchronize two sliders or a + slider and checkbox. Typically, it is used to bind a backend value to + a control, such as a slider. + + The \l target01 and \l target02 properties specify the ids of the components + to bind together. The \l property01 and \l property02 properties specify the + names the properties to synchronize. + + Designers can use the BidirectionalBinding type in \QDS instead of writing + JavaScript expressions. + + A \l StringMapper type can be used to add a text property that displays the + value. + + \section1 Example Usage + + In the following example, we bind the values of two \l Slider types + together bidirectionally: + + \code + Rectangle { + Slider { + id: slider + value: 0.5 + } + Slider { + id: slider1 + value: 0.5 + } + + BidrectionalBinding { + id: biDirectBinding + property02: "value" + property01: "value" + target02: slider1 + target01: slider + } + } + \endcode +*/ + +QtObject { + id: object + +/*! + The id of the component to bind to \l target02. +*/ + property QtObject target01 + +/*! + The id of the component to bind to \l target01. +*/ + property QtObject target02 + +/*! + The name of the property to synchronize with \l property02. +*/ + property string property01 + +/*! + The name of the property to synchronize with \l property01. +*/ + property string property02 + + property QtObject __internal: QtObject { + property variant value01 + property variant value02 + + property bool block: false + + onValue01Changed: { + if (__internal.block) + return; + + __internal.block = true; + try { + object.target02[property02] = __internal.value01 + } catch(error) { + } + __internal.block = false; + } + + onValue02Changed: { + if (__internal.block) + return; + + __internal.block = true; + try { + object.target01[property01] = __internal.value02 + } catch(error) { + } + __internal.block = false; + } + } + + property Binding __b01: Binding { + target: __internal + property: "value01" + value: target01 ? target01[property01] : null + } + + property Binding __b02: Binding { + target: __internal + property: "value02" + value: target02 ? target02[property02] : null + } + + +} diff --git a/Dependencies/Components/imports/logichelper/CMakeLists.txt b/Dependencies/Components/imports/logichelper/CMakeLists.txt new file mode 100644 index 0000000..59120f2 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/CMakeLists.txt @@ -0,0 +1,19 @@ +qt_add_library(QuickStudioLogicHelper STATIC) +qt6_add_qml_module(QuickStudioLogicHelper + URI "QtQuick.Studio.LogicHelper" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + ${qds_qml_extra_args} + QML_FILES + BidirectionalBinding.qml + RangeMapper.qml + MinMaxMapper.qml + StringMapper.qml + OrOperator.qml + AndOperator.qml + NotOperator.qml +) + +register_plugin(QuickStudioLogicHelper) diff --git a/Dependencies/Components/imports/logichelper/MinMaxMapper.qml b/Dependencies/Components/imports/logichelper/MinMaxMapper.qml new file mode 100644 index 0000000..512c414 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/MinMaxMapper.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +/*! + \qmltype MinMaxMapper + \inqmlmodule QtQuick.Studio.LogicHelper + \since QtQuick.Studio.LogicHelper 1.0 + \inherits QtObject + + \brief Provides access to values that are out or range. + + The MinMaxMapper type has output values even if the input value is out + of range or too small or big. This enables applying actions to values + even if they are out of range, such as changing a color in a state. + + To access the values of a control, the \l input property of the + minimum-maximum mapper is bound to that of the \c value property + of the control. + + For example, to restrict the maximum value of a slider to 0.60, + regardless of the maximum value set in the slider properties, + we bind the value of the \l input property of the mapper to + the value of the \c value property of the slider and set the value + of the \l maximum property to 0.60. + + The \l outOfRange, \l aboveMaximum and \l belowMinimum properties are set to + \c true if the value of the \l input property is out of range. + For example, in the context of speed, \l aboveMaximum being \c true + would mean \e {too fast}, whereas \l belowMinimum being \c true would + mean \e {too slow}, and \l outOfRange being \c true would mean + \e {either too fast or too slow}. + + Designers can use the Min Max Mapper type in \QDS instead of writing + JavaScript expressions. + + \section1 Example Usage + + In the following example, we use the MinMaxMapper type to restrict the + maximum value of a \l Slider type to 0.60, regardless of the maximum + value set in the Slider properties: + + \code + Rectangle { + Slider { + id: slider + value: 0.5 + } + MinMaxMapper { + id: minMaxMapper + input: slider.value + maximum: 0.6 + } + } + \endcode +*/ + +QtObject { + id: object + +/*! + The input value. +*/ + property real input: 0 + +/*! + Whether \l input is less than \l minimum. +*/ + property bool belowMinimum: object.input < object.minimum + +/*! + Whether \l input is larger than \l maximum. +*/ + property bool aboveMaximum: object.input > object.maximum + +/*! + Whether \l input is out of range. Returns \c true if \l belowMinimum or + \l aboveMaximum is \c true. +*/ + property bool outOfRange: object.aboveMaximum ||object.belowMinimum + +/*! + The value of \l input. If \l aboveMaximum is \c true, returns the value of + \l maximum. If \l belowMinimum is \c true, returns the value of \l minimum. +*/ + property real output: { + if (object.aboveMaximum) + return object.maximum + + if (object.belowMinimum) + return object.minimum + + return object.input + } + +/*! + The minimum value of \l input. +*/ + property real minimum: 0 + +/*! + The maximum value of \l input. +*/ + property real maximum: 100 +} diff --git a/Dependencies/Components/imports/logichelper/NotOperator.qml b/Dependencies/Components/imports/logichelper/NotOperator.qml new file mode 100644 index 0000000..01277eb --- /dev/null +++ b/Dependencies/Components/imports/logichelper/NotOperator.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +/*! + \qmltype NotOperator + \inqmlmodule QtQuick.Studio.LogicHelper + \since QtQuick.Studio.LogicHelper 1.0 + \inherits QtObject + + \brief Evaluates a boolean input value and provides the result as output. + + The NotOperator type evaluates the boolean input \l input. The \l output + value is evaluated as \c true if \l input is evaluated as \c false. + + Designers can use the Not Operator type in \QDS instead of writing + JavaScript expressions. + + \section1 Example Usage + + In the following example, we use the checked state of a \l CheckBox to + determine the checked state of another one: + + \code + Rectangle { + CheckBox { + id: checkBox1 + text: qsTr("Check Box 1") + checked: false + } + CheckBox { + id: checkBox2 + text: qsTr("Check Box 2") + checked: notOperator.output + } + NotOperator { + id: notOperator + input: checkBox1.checked + } + } + \endcode + + \sa AndOperator, OrOperator +*/ + +QtObject { + id: object + +/*! + The value to evaluate. +*/ + property bool input: false + +/*! + The result of the evaluation. +*/ + property bool output: !object.input +} diff --git a/Dependencies/Components/imports/logichelper/OrOperator.qml b/Dependencies/Components/imports/logichelper/OrOperator.qml new file mode 100644 index 0000000..b4f3c5a --- /dev/null +++ b/Dependencies/Components/imports/logichelper/OrOperator.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +/*! + \qmltype OrOperator + \inqmlmodule QtQuick.Studio.LogicHelper + \since QtQuick.Studio.LogicHelper 1.0 + \inherits QtObject + + \brief Evaluates two boolean input values and provides the result as output. + + The OrOperator type evaluates two boolean inputs, \l input01 and \l input02. + The \l output is evaluated as \c true if either \l input01 or \l input02 is + evaluated as \c true. + + Designers can use the Or Operator type in \QDS instead of writing + JavaScript expressions. + + \section1 Example Usage + + In the following example, we use the checked state of two \l CheckBox + types to determine the checked state of a third one: + + \code + Rectangle { + CheckBox { + id: checkBox1 + text: qsTr("Check Box 1") + checked: false + } + CheckBox { + id: checkBox2 + text: qsTr("Check Box 2") + } + + CheckBox { + id: checkBox3 + text: qsTr("Check Box 3") + checked: orOperator.output + } + + OrOperator { + id: orOperator + input02: checkBox2.checked + input01: checkBox1.checked + } + } + \endcode + + \sa AndOperator, NotOperator +*/ + +QtObject { + id: object + +/*! + The first value to evaluate. +*/ + property bool input01: false + +/*! + The second value to evaluate. +*/ + property bool input02: false + +/*! + The result of the evaluation. +*/ + property bool output: object.input01 || object.input02 +} diff --git a/Dependencies/Components/imports/logichelper/RangeMapper.qml b/Dependencies/Components/imports/logichelper/RangeMapper.qml new file mode 100644 index 0000000..cd9a712 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/RangeMapper.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +/*! + \qmltype RangeMapper + \inqmlmodule QtQuick.Studio.LogicHelper + \since QtQuick.Studio.LogicHelper 1.0 + \inherits QtObject + + \brief Maps a numerical range to another range, so that the output value + of the second range follows that of the original range. + + The minimum and maximum input and output values are specified as values of + the \l inputMinimum, \l inputMaximum, \l outputMinimum, and \l outputMaximum properties. + The original value is specified as the value of the \l output property. + + For example, if you map input in the range of \c {-1,1} to output in the + range of \c {0,1000}, and the original value changes from -1 to 1, the + output value will change from 0 to 1000. This is useful when remapping + the current frame on the timeline, for example. + + Designers can use the Range Mapper type in \QDS instead of writing + JavaScript expressions. + + \section1 Example Usage + + In the following example, we use a RangeMapper type to map the value range + from -1 to 1 that is specified for a \l Slider type to a range from 10 to + 1000: + + \code + Rectangle { + Slider { + id: slider + from: -1 + to: 1 + value: -1 + } + RangeMapper { + id: rangeMapper + outputMinimum: 10 + outputMaximum: 1000 + inputMinimum: slider.from + inputMaximum: slider.to + input: slider.value + } + } + \endcode +*/ + +QtObject { + id: object + +/*! + The input value. +*/ + property real input: 0 + +/*! + The output value. +*/ + property real output: { + var slope = (object.outputMaximum - object.outputMinimum) / (object.inputMaximum - object.inputMinimum) + return object.outputMinimum + slope * (object.input - object.inputMinimum) + } + +/*! + The minimum input value. +*/ + property real inputMinimum: 0 + +/*! + The maximum input value. +*/ + property real inputMaximum: 100 + +/*! + The minimum output value. +*/ + property real outputMinimum: 0 + +/*! + The maximum output value. +*/ + property real outputMaximum: 100 + +} diff --git a/Dependencies/Components/imports/logichelper/StringMapper.qml b/Dependencies/Components/imports/logichelper/StringMapper.qml new file mode 100644 index 0000000..59c5958 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/StringMapper.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 + +/*! + \qmltype StringMapper + \inqmlmodule QtQuick.Studio.LogicHelper + \since QtQuick.Studio.LogicHelper 1.0 + \inherits QtObject + + \brief Converts numbers to strings with the defined precision. + + The StringMapper type maps numbers to strings. The string mapper + \l input property is bound to the \c value property of a control that + provides the number and the \l text property of the string mapper is + mapped to the \c text property of type that displays the string. + + Designers can use the String Mapper type in \QDS instead of writing + JavaScript expressions. + + \section1 Example Usage + + In the following example, we use \l Text type to display the numerical + value of a \l Slider type as a string: + + \code + Rectangle { + Slider { + id: slider + value: 0.5 + } + Text { + id: text1 + text: stringMapper.text + } + StringMapper { + id: stringMapper + input: slider.value + } + } + \endcode +*/ + +QtObject { + id: object + +/*! + The value to convert to a string. +*/ + property real input: 0 + +/*! + The number of digits after the decimal separator. +*/ + property int decimals: 2 + +/*! + The \l input value as a string. +*/ + property string text: object.input.toFixed(object.decimals) +} diff --git a/Dependencies/Components/imports/logichelper/logichelperplugin.cpp b/Dependencies/Components/imports/logichelper/logichelperplugin.cpp new file mode 100644 index 0000000..87a3ac5 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/logichelperplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class LogicHelperPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + LogicHelperPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +LogicHelperPlugin::LogicHelperPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void LogicHelperPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "logichelperplugin.moc" diff --git a/Dependencies/Components/imports/logichelper/plugins.qmltypes b/Dependencies/Components/imports/logichelper/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/logichelper/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.11" + ] +} diff --git a/Dependencies/Components/imports/logichelper/qmldir b/Dependencies/Components/imports/logichelper/qmldir new file mode 100644 index 0000000..dd5e986 --- /dev/null +++ b/Dependencies/Components/imports/logichelper/qmldir @@ -0,0 +1,14 @@ +module QtQuick.Studio.LogicHelper +linktarget QtQuickStudioLogicHelperplugin +optional plugin QtQuickStudioLogicHelperplugin +classname QtQuick_Studio_LogicHelperPlugin +typeinfo QtQuickStudioLogicHelper.qmltypes +prefer :/QtQuick/Studio/LogicHelper/ +BidirectionalBinding 1.0 BidirectionalBinding.qml +RangeMapper 1.0 RangeMapper.qml +MinMaxMapper 1.0 MinMaxMapper.qml +StringMapper 1.0 StringMapper.qml +OrOperator 1.0 OrOperator.qml +AndOperator 1.0 AndOperator.qml +NotOperator 1.0 NotOperator.qml + diff --git a/Dependencies/Components/imports/multitext/CMakeLists.txt b/Dependencies/Components/imports/multitext/CMakeLists.txt new file mode 100644 index 0000000..4fb9fe4 --- /dev/null +++ b/Dependencies/Components/imports/multitext/CMakeLists.txt @@ -0,0 +1,16 @@ +qt_add_library(QuickStudioMultiText STATIC) +qt6_add_qml_module(QuickStudioMultiText + URI "QtQuick.Studio.MultiText" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + NO_LINT + NO_CACHEGEN + QML_FILES + MultiTextElement.qml + MultiTextItem.qml + MultiTextException.qml +) + +register_plugin(QuickStudioMultiText) diff --git a/Dependencies/Components/imports/multitext/MultiTextElement.qml b/Dependencies/Components/imports/multitext/MultiTextElement.qml new file mode 100644 index 0000000..785d51c --- /dev/null +++ b/Dependencies/Components/imports/multitext/MultiTextElement.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 QtQml 2.15 +import QtQuick 2.15 + +Text { + id: root + + property real descent: fontMetrics.descent + property real leading: fontMetrics.leading + property real fontHeight: fontMetrics.height + + property real baselineOffset: -999 + + //lineHeight: root.fontHeight - root.descent + root.baselineOffset - root.leading + + Binding on lineHeight { + when: root.baselineOffset !== -999 + value: root.fontHeight - root.descent + root.baselineOffset - root.leading + } + + onLineHeightChanged: { + print("lh") + print(root.baseLineOffset) + } + + FontMetrics { + id: fontMetrics + font: root.font + } + + lineHeightMode: root.baselineOffset !== -999 ? Text.FixedHeight : Text.ProportionalHeight + + width: visible ? implicitWidth : 0 + height: visible ? implicitHeight : 0 + + + property Text __backupText: Text { + id: backupText + visible: false + } + + property Text languageExceptionItem: backupText + onLanguageExceptionItemChanged: { + if (root.__completed) + root.assignException() + } + + property bool __completed: false + + Component.onCompleted: { + root.__backupText.font = root.font + root.__backupText.text = root.text + root.__backupText.color = root.color + root.__backupText.lineHeight = root.lineHeight + root.__backupText.lineHeightMode = root.lineHeightMode + + root.__completed = true + print("start " + root.languageExceptionItem) + root.assignException() + } + + function assignException() { + print("assign") + print(root.languageExceptionItem) + root.font = root.languageExceptionItem.font + root.text = root.languageExceptionItem.text + root.color = root.languageExceptionItem.color + root.lineHeight = root.languageExceptionItem.lineHeight + root.lineHeightMode = root.languageExceptionItem.lineHeightMode + } + +} diff --git a/Dependencies/Components/imports/multitext/MultiTextException.qml b/Dependencies/Components/imports/multitext/MultiTextException.qml new file mode 100644 index 0000000..e465950 --- /dev/null +++ b/Dependencies/Components/imports/multitext/MultiTextException.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 QtQml 2.15 +import QtQuick 2.15 + +Text { + id: root + visible: false + + property bool exceptionAcive: Qt.uiLanguage === root.languageCode + + + property string languageCode + onExceptionAciveChanged: { + root.__setup() + } + + Component.onCompleted: root.__setup() + + function __setup() { + var p = parent + if (parent.languageExceptionItem !== undefined) { + if (root.exceptionAcive) { + parent.languageExceptionItem = root + } else { + if (parent.languageExceptionItem === root) + parent.languageExceptionItem = parent.__backupText + } + } + } + +} diff --git a/Dependencies/Components/imports/multitext/MultiTextItem.qml b/Dependencies/Components/imports/multitext/MultiTextItem.qml new file mode 100644 index 0000000..444870f --- /dev/null +++ b/Dependencies/Components/imports/multitext/MultiTextItem.qml @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.12 +import QtQuick.Layouts 1.3 + +StackLayout { + id: root + width: childrenRect.width + height: childrenRect.height + + + property int maxIndex: { + var ret = 0 + for (var i = 0; i < root.data.length; i++) + { + if (root.data[i].text !== undefined) + ret++ + } + + return ret + + } + + property int stringIndex: 0 + + onStringIndexChanged: { + setupText() + } + + Component.onCompleted: setupText() + + function setupText() { + var textArray = [] + + for (var i = 0; i < root.data.length; i++) + { + if (root.data[i].text !== undefined) + textArray.push(root.data[i].text) + } + + } + + property string textModel: { + var textArray = "" + + for (var i = 0; i < root.data.length; i++) + { + if (root.data[i].text !== undefined) { + if (textArray === "") + textArray = textArray + root.data[i].text + else + textArray = textArray + 'e\u001f' + 'e\u001d' + root.data[i].text + } + } + + return textArray + } + + property string testString: { + + var textArray = "" + + for (var i = 0; i < root.data.length; i++) + { + if (root.data[i].text !== undefined) + textArray = textArray + (root.data[i].text) + } + + return textArray + } + + + + +} + diff --git a/Dependencies/Components/imports/multitext/multitextplugin.cpp b/Dependencies/Components/imports/multitext/multitextplugin.cpp new file mode 100644 index 0000000..f8be6ad --- /dev/null +++ b/Dependencies/Components/imports/multitext/multitextplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class MultiTextPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + MultiTextPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +MultiTextPlugin::MultiTextPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ +} + +void MultiTextPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "multitextplugin.moc" diff --git a/Dependencies/Components/imports/multitext/plugins.qmltypes b/Dependencies/Components/imports/multitext/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/multitext/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.11" + ] +} diff --git a/Dependencies/Components/imports/multitext/qmldir b/Dependencies/Components/imports/multitext/qmldir new file mode 100644 index 0000000..48a7d68 --- /dev/null +++ b/Dependencies/Components/imports/multitext/qmldir @@ -0,0 +1,10 @@ +module QtQuick.Studio.MultiText +linktarget QtQuickStudioMultiTextplugin +optional plugin QtQuickStudioMultiTextplugin +classname QtQuick_Studio_MultiTextPlugin +typeinfo QtQuickStudioMultiText.qmltypes +prefer :/QtQuick/Studio/MultiText/ +MultiTextElement 1.0 MultiTextElement.qml +MultiTextItem 1.0 MultiTextItem.qml +MultiTextException 1.0 MultiTextException.qml + diff --git a/Dependencies/Components/imports/tools/CMakeLists.txt b/Dependencies/Components/imports/tools/CMakeLists.txt new file mode 100644 index 0000000..e432fa5 --- /dev/null +++ b/Dependencies/Components/imports/tools/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(eventsimulator) +add_subdirectory(eventsystem) diff --git a/Dependencies/Components/imports/tools/eventsimulator/CMakeLists.txt b/Dependencies/Components/imports/tools/eventsimulator/CMakeLists.txt new file mode 100644 index 0000000..9ed7030 --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsimulator/CMakeLists.txt @@ -0,0 +1,20 @@ +set_source_files_properties(EventSimulator.qml + PROPERTIES + QT_QML_SINGLETON_TYPE true +) + +qt_add_library(QuickStudioEventSimulator STATIC) +qt6_add_qml_module(QuickStudioEventSimulator + URI "QtQuick.Studio.EventSimulator" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + NO_LINT + NO_CACHEGEN + QML_FILES + EventSimulator.qml + EventSimulatorDelegate.qml +) + +register_plugin(QuickStudioEventSimulator) diff --git a/Dependencies/Components/imports/tools/eventsimulator/EventSimulator.qml b/Dependencies/Components/imports/tools/eventsimulator/EventSimulator.qml new file mode 100644 index 0000000..c9a1638 --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsimulator/EventSimulator.qml @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick 2.10 +import QtQuick.Window 2.2 +import QtQuick.Studio.EventSystem 1.0 + +QtObject { + id: root + + property ListModel __filteredModel: ListModel{} + property font font: { + family: "Verdana" + bold: true + } + + property alias cellColor: simulatorWindow.cellColor + property alias borderColor: simulatorWindow.borderColor + property alias textColor: simulatorWindow.textColor + property alias backgroundColor: simulatorWindow.backgroundColor + property alias listView: list + + property alias x: simulatorWindow.x + property alias y: simulatorWindow.y + + property alias width: simulatorWindow.width + property alias height: simulatorWindow.height + + + function show() + { + simulatorWindow.show() + simulatorWindow.raise() + } + + function hide() + { + simulatorWindow.hide() + simulatorWindow.lower() + } + + function __filterModel(idFilter) { + __filteredModel.clear() + + // reset the model when the filter is empty + var alwaysAdd = idFilter === "" + + for (var i = 0; i < EventSystem.model.count; i++) { + if (alwaysAdd || EventSystem.model.get(i).eventId.startsWith(idFilter)) { + __filteredModel.append(EventSystem.model.get(i)) + } + } + } + + property Window eventDialog: Window { + id: simulatorWindow + width: 200 + height: 1280 + color: backgroundColor + + property color cellColor: defaultPalette.mid + property color borderColor: defaultPalette.light + property color textColor: defaultPalette.text + property color backgroundColor: defaultPalette.window + + SystemPalette { + id: defaultPalette + colorGroup: SystemPalette.Active + } + + Component.onCompleted: { + // call the filter with an empty string to populate the list after component is created + root.__filterModel("") + } + Rectangle { + id: inputContainer + color: defaultPalette.shadow + height: 25 + width: 190 + x: 5 + + border { + color: simulatorWindow.borderColor + width: 1 + } + anchors.horizontalCenter: simulatorWindow.horizontalCenter + + TextInput { + id: filterInput + text: qsTr("Filter...") + color: root.textColor + + leftPadding: 5 + verticalAlignment: Text.AlignVCenter + anchors.fill: inputContainer + + selectByMouse: true + KeyNavigation.tab: list + + onTextEdited: { + root.__filterModel(this.text); + } + + onEditingFinished: { + list.focus = true + } + + onActiveFocusChanged: { + if (focus == true) { + if (text === "Filter...") { + filterInput.clear() + } + } else { + if (text === "") { + text = qsTr("Filter...") + } + } + } + } + } + ListView { + id: list + width: inputContainer.width + anchors { + top: inputContainer.bottom + left: inputContainer.left + bottom: parent.bottom + } + clip: true + focus: true + spacing: 2 + + model: root.__filteredModel + delegate: EventSimulatorDelegate { } + + } + } +} diff --git a/Dependencies/Components/imports/tools/eventsimulator/EventSimulatorDelegate.qml b/Dependencies/Components/imports/tools/eventsimulator/EventSimulatorDelegate.qml new file mode 100644 index 0000000..e592cbd --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsimulator/EventSimulatorDelegate.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Studio.EventSystem 1.0 + +Rectangle { + id: delegateItem + width: 190 + height: 60 + color: simulatorWindow.cellColor + border { + color: simulatorWindow.borderColor + width: 1 + } + + MouseArea { + anchors.fill: parent + onDoubleClicked: { + EventSystem.triggerEvent(eventId) + } + } + + Column { + anchors.centerIn: parent + spacing: 5 + Text { + width: 190 + color: root.textColor + text: eventId + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.family: root.font.family + } + + Text { + width: 190 + color: root.textColor + text: "[" + shortcut +"]" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.family: root.font.family + } + } + + Shortcut { + sequence: shortcut + enabled: list.focus + onActivated : { + EventSystem.triggerEvent(eventId) + } + } +} diff --git a/Dependencies/Components/imports/tools/eventsimulator/plugins.qmltypes b/Dependencies/Components/imports/tools/eventsimulator/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsimulator/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.11" + ] +} diff --git a/Dependencies/Components/imports/tools/eventsimulator/qmldir b/Dependencies/Components/imports/tools/eventsimulator/qmldir new file mode 100644 index 0000000..25e2a51 --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsimulator/qmldir @@ -0,0 +1,8 @@ +module QtQuick.Studio.EventSimulator +linktarget QtQuickStudioEventSimulatorplugin +optional plugin QtQuickStudioEventSimulatorplugin +classname QtQuick_Studio_EventSimulatorPlugin +typeinfo QtQuickStudioEventSimulator.qmltypes +prefer :/QtQuick/Studio/EventSimulator/ +singleton EventSimulator 1.0 EventSimulator.qml + diff --git a/Dependencies/Components/imports/tools/eventsimulator/qtstudioeventsimulatorplugin.cpp b/Dependencies/Components/imports/tools/eventsimulator/qtstudioeventsimulatorplugin.cpp new file mode 100644 index 0000000..44f331f --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsimulator/qtstudioeventsimulatorplugin.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class QtStudioEventSimulatorPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtStudioEventSimulatorPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +QtStudioEventSimulatorPlugin::QtStudioEventSimulatorPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ + +} + +void QtStudioEventSimulatorPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "qtstudioeventsimulatorplugin.moc" diff --git a/Dependencies/Components/imports/tools/eventsystem/CMakeLists.txt b/Dependencies/Components/imports/tools/eventsystem/CMakeLists.txt new file mode 100644 index 0000000..8a404fa --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsystem/CMakeLists.txt @@ -0,0 +1,20 @@ +set_source_files_properties(EventSystem.qml + PROPERTIES + QT_QML_SINGLETON_TYPE true +) + +qt_add_library(QuickStudioEventSystem STATIC) +qt6_add_qml_module(QuickStudioEventSystem + URI "QtQuick.Studio.EventSystem" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + NO_LINT + NO_CACHEGEN + QML_FILES + EventSystem.qml + EventListener.qml +) + +register_plugin(QuickStudioEventSystem) diff --git a/Dependencies/Components/imports/tools/eventsystem/EventListener.qml b/Dependencies/Components/imports/tools/eventsystem/EventListener.qml new file mode 100644 index 0000000..14aa0a8 --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsystem/EventListener.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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.10 +import QtQuick.Studio.EventSystem 1.0 + +QtObject { + id: root + signal triggered(var eventId, var parameters) + property string eventIds + property var __eventIdList + function __receiveEvent(eventId, parameters) { + if (root.eventIds === eventId || __eventIdList.indexOf(eventId) > -1) + root.triggered(eventId, parameters) + } + + onEventIdsChanged:{ + var split = root.eventIds.split(',').map(item=>item.trim()); + if (split.length > 0) { + __eventIdList = split + } + } + + Component.onCompleted: { + EventSystem.eventTriggered.connect(__receiveEvent) + } +} diff --git a/Dependencies/Components/imports/tools/eventsystem/EventSystem.qml b/Dependencies/Components/imports/tools/eventsystem/EventSystem.qml new file mode 100644 index 0000000..d2e3d83 --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsystem/EventSystem.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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$ +** +****************************************************************************/ +pragma Singleton +import QtQuick 2.10 +import QtQuick.Window 2.2 + +Item { + signal eventTriggered(string eventID, string parameters) + property ListModel model + + function __modelLoaded() + { + model = eventListLoader.item + } + + function init(modelURI) { + eventListLoader.loaded.connect(__modelLoaded) + eventListLoader.source = modelURI + } + + function triggerEvent(eventId) { + for (var i = 0; i < model.count; i++) { + if (model.get(i).eventId === eventId) { + eventTriggered(eventId, model.get(i).parameters) + } + } + } + + Loader { + id: eventListLoader + } +} diff --git a/Dependencies/Components/imports/tools/eventsystem/plugins.qmltypes b/Dependencies/Components/imports/tools/eventsystem/plugins.qmltypes new file mode 100644 index 0000000..aac3a1a --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsystem/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.11" + ] +} diff --git a/Dependencies/Components/imports/tools/eventsystem/qmldir b/Dependencies/Components/imports/tools/eventsystem/qmldir new file mode 100644 index 0000000..2bdeee4 --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsystem/qmldir @@ -0,0 +1,9 @@ +module QtQuick.Studio.EventSystem +linktarget QtQuickStudioEventSystemplugin +optional plugin QtQuickStudioEventSystemplugin +classname QtQuick_Studio_EventSystemPlugin +typeinfo QtQuickStudioEventSystem.qmltypes +prefer :/QtQuick/Studio/EventSystem/ +singleton EventSystem 1.0 EventSystem.qml +EventListener 1.0 EventListener.qml + diff --git a/Dependencies/Components/imports/tools/eventsystem/qtstudioeventsystemplugin.cpp b/Dependencies/Components/imports/tools/eventsystem/qtstudioeventsystemplugin.cpp new file mode 100644 index 0000000..4d7b7fa --- /dev/null +++ b/Dependencies/Components/imports/tools/eventsystem/qtstudioeventsystemplugin.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Quick Designer Components. +** +** $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 + +QT_BEGIN_NAMESPACE + +class QtStudioEventSystemPlugin: public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + QtStudioEventSystemPlugin(QObject *parent = nullptr); + void registerTypes(const char *uri) override; +}; + +QtStudioEventSystemPlugin::QtStudioEventSystemPlugin(QObject *parent) + : QQmlExtensionPlugin(parent) +{ + +} + +void QtStudioEventSystemPlugin::registerTypes(const char *) +{ +} + +QT_END_NAMESPACE + +#include "qtstudioeventsystemplugin.moc" diff --git a/Dependencies/Components/imports/utils/CMakeLists.txt b/Dependencies/Components/imports/utils/CMakeLists.txt new file mode 100644 index 0000000..857f4a8 --- /dev/null +++ b/Dependencies/Components/imports/utils/CMakeLists.txt @@ -0,0 +1,21 @@ +qt_add_library(QuickStudioUtils STATIC) +qt6_add_qml_module(QuickStudioUtils + URI "QtQuick.Studio.Utils" + VERSION "${PROJECT_VERSION}" + RESOURCE_PREFIX "/qt-project.org/imports" + DESIGNER_SUPPORTED + PAST_MAJOR_VERSIONS 1 + SOURCES + quickstudiocsvtablemodel.cpp + quickstudiocsvtablemodel.h + quickstudiofilereader.cpp + quickstudiofilereader.h + QML_FILES + JsonListModel.qml + JsonBackend.qml + ChildListModel.qml +) + +target_link_libraries(QuickStudioUtils PRIVATE Qt6::Gui) + +register_plugin(QuickStudioUtils) diff --git a/Dependencies/Components/imports/utils/ChildListModel.qml b/Dependencies/Components/imports/utils/ChildListModel.qml new file mode 100644 index 0000000..2e9c146 --- /dev/null +++ b/Dependencies/Components/imports/utils/ChildListModel.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQml.Models as M +import QtQuick.Studio.Utils + +M.ListModel { + id: listModel + + property string modelName + property var jsonObject: null + + dynamicRoles: true + +// qmllint disable compiler + + onJsonObjectChanged: { + listModel.clear() + var objectArray = listModel.jsonObject + if (modelName.modelName !== "") + objectArray = objectArray[listModel.modelName] + for (var key in objectArray) { + var jo = objectArray[key] + listModel.append(jo) + } + } +// qmllint enable compiler +} diff --git a/Dependencies/Components/imports/utils/JsonBackend.qml b/Dependencies/Components/imports/utils/JsonBackend.qml new file mode 100644 index 0000000..2a724b7 --- /dev/null +++ b/Dependencies/Components/imports/utils/JsonBackend.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Studio.Utils + +QtObject { + id: server + property url source + + property FileReader fileReader: FileReader { + id: fileReader + filePath: server.source + onContentChanged: server.updateJSON() + } + +// qmllint disable compiler + function updateJSON() { + + if (fileReader.content === "") + return + + var objectArray = parseJSONString(fileReader.content) + for (var key in objectArray) { + var jo = objectArray[key] + if (server[key] !== undefined) + server[key] = jo + else + console.warn(key, "undefined") + + } + } + + function parseJSONString(jsonString) { + var objectArray = JSON.parse(jsonString) + if (!objectArray) + console.error("JSON parsing failed") + + return objectArray + } +// qmllint enable compiler +} diff --git a/Dependencies/Components/imports/utils/JsonListModel.qml b/Dependencies/Components/imports/utils/JsonListModel.qml new file mode 100644 index 0000000..685b8c1 --- /dev/null +++ b/Dependencies/Components/imports/utils/JsonListModel.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQml +import QtQml.Models as M +import QtQuick.Studio.Utils as U + +M.ListModel { + id: listModel + + property url source + property var jsonObject + dynamicRoles: true + + property U.FileReader fileReader: U.FileReader { + id: fileReader + filePath: listModel.source + onContentChanged: listModel.updateJSON() + } + +// qmllint disable compiler + onJsonObjectChanged: { + listModel.clear() + var objectArray = listModel.jsonObject + + for (var key in objectArray) { + var jo = objectArray[key] + listModel.append(jo) + } + } + + function updateJSON() { + var objectArray = JSON.parse(fileReader.content) + listModel.jsonObject = fromLocalJson(objectArray) + invalidateChildModels() + } + + function isObject(obj) { + return obj && obj.constructor === Object + } + + function fromLocalJson(localJson) { + if (!isObject(localJson)) + return {} + + var parsedModel = {} + for (let collectionName in localJson) { + let collection = localJson[collectionName] + if (isObject(collection)) { + if (Array.isArray(collection.columns) && Array.isArray(collection.data)) { + let propertyNames = [] + let extractedCollection = [] + + for (let columnId in collection.columns) { + let column = collection.columns[columnId] + propertyNames.push(isObject(column) ? column.name : null) + } + + for (let rowId in collection.data) { + let extractedElement = {} + let row = collection.data[rowId] + if (Array.isArray(row)) { + let maxIdx = Math.min(row.length, propertyNames.length) + for (let idx = 0; idx < maxIdx; ++idx) { + let propertyName = propertyNames[idx] + if (propertyName !== "") { + let value = row[idx] + if (value !== undefined && value !== null) + extractedElement[propertyName] = value + } + } + } + extractedCollection.push(extractedElement) + } + parsedModel[collectionName] = extractedCollection + } + } + } + return parsedModel + } + + function invalidateChildModels() { + for (let property in listModel) { + let propertyValue = listModel[property] + let propertyValueIsObject = propertyValue && typeof(propertyValue) === "object" + + if (propertyValueIsObject && propertyValue.jsonObject !== undefined) + propertyValue.jsonObject = listModel.jsonObject + } + } + + Component.onCompleted: { + updateJSON() + } + +// qmllint enable compiler +} diff --git a/Dependencies/Components/imports/utils/quickstudiocsvtablemodel.cpp b/Dependencies/Components/imports/utils/quickstudiocsvtablemodel.cpp new file mode 100644 index 0000000..6089bb3 --- /dev/null +++ b/Dependencies/Components/imports/utils/quickstudiocsvtablemodel.cpp @@ -0,0 +1,307 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quickstudiocsvtablemodel.h" + +#include +#include +#include +#include +#include +#include +#include + +static inline QColor fromString(const QString &colorName) +{ +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) + return QColor::fromString(colorName); +#else + return colorName; +#endif // >= Qt 6.4 +} + +static inline bool isValidColorName(const QString &colorName) +{ +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) + return QColor::isValidColorName(colorName); +#else + constexpr QStringView colorPattern( + u"(?^(?:#(?:(?:[0-9a-fA-F]{2}){3,4}|(?:[0-9a-fA-F]){3,4}))$)"); + static QRegularExpression colorRegex(colorPattern.toString()); + return colorRegex.match(colorName).hasMatch(); +#endif // >= Qt 6.4 +} + +static QVariant stringToVariant(const QString &value) +{ + constexpr QStringView typesPattern{u"(?^(?:true|false)$)|" + u"(?^(?:-?(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?<=\\d|\\.)" + u"(?:e-?(?:0|[1-9]\\d*))?|0x[0-9a-f]+)$)|" + u"(?^(?:#(?:(?:[0-9a-fA-F]{2}){3,4}|" + u"(?:[0-9a-fA-F]){3,4}))$)"}; + + static QRegularExpression validator(typesPattern.toString()); + const QString trimmedValue = value.trimmed(); + QRegularExpressionMatch match = validator.match(trimmedValue); + + if (!match.hasMatch()) + return value; + + if (!match.captured(u"boolean").isEmpty()) + return QVariant::fromValue(trimmedValue.at(0).toLower() == u't'); + + if (!match.captured(u"number").isEmpty()) + return trimmedValue.toDouble(); + + if (!match.captured(u"color").isEmpty()) + return ::fromString(trimmedValue); + + return value; +} + +static QVariant stringToVariant(const QString &value, QMetaType::Type type, bool *ok = nullptr) +{ + if (type == QMetaType::Bool) { + const QString lowerValue = value.toLower().trimmed(); + bool conversionOk = true; + bool booleanValue = false; + + if (lowerValue == u"true") + booleanValue = true; + else if (lowerValue == u"false") + booleanValue = false; + else + conversionOk = false; + + if (ok) + *ok = conversionOk; + + if (conversionOk) + return booleanValue; + } + + if (type == QMetaType::Double) { + bool conversionOk = false; + double numericValue = value.toDouble(&conversionOk); + if (ok) + *ok = conversionOk; + + if (conversionOk) + return numericValue; + } + + if (type == QMetaType::QColor) { + bool conversionOk = ::isValidColorName(value); + if (ok) + *ok = conversionOk; + + if (conversionOk) + return ::fromString(value); + } + + if (type == QMetaType::QString) { + if (ok) + *ok = !value.isEmpty(); + } + + return value; +} + +static QString urlToLocalPath(const QUrl &url) +{ + QString localPath; + + if (url.isLocalFile()) + localPath = url.toLocalFile(); + + if (url.scheme() == QLatin1String("qrc")) { + const QString &path = url.path(); + localPath = QStringLiteral(":") + path; + } + + return localPath; +} + +#ifndef Q_STATIC_LOGGING_CATEGORY // introduced with Qt 6.9 +static Q_LOGGING_CATEGORY(quickStudioCsvTableModelDebug, "qt.StudioCsvTableModel.debug", QtDebugMsg) +#else +Q_STATIC_LOGGING_CATEGORY(quickStudioCsvTableModelDebug, "qt.StudioCsvTableModel.debug", QtDebugMsg) +#endif + + +QuickStudioCsvTableModel::QuickStudioCsvTableModel(QObject *parent) + : QAbstractTableModel(parent) + , m_fileWatcher(new QFileSystemWatcher(this)) +{ + connect(m_fileWatcher, + &QFileSystemWatcher::fileChanged, + this, + &QuickStudioCsvTableModel::checkPathAndReload); +} + +int QuickStudioCsvTableModel::rowCount([[maybe_unused]] const QModelIndex &parent) const +{ + return m_rows.size(); +} + +int QuickStudioCsvTableModel::columnCount([[maybe_unused]] const QModelIndex &parent) const +{ + return m_headers.size(); +} + +QVariant QuickStudioCsvTableModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return {}; + + const QHash &recordData = m_rows.at(index.row()); + + if (role == Qt::DisplayRole) + return recordData.value(index.column()).toString(); + + return recordData.value(index.column()); +} + +QVariant QuickStudioCsvTableModel::headerData(int section, + Qt::Orientation orientation, + [[maybe_unused]] int role) const +{ + if (orientation == Qt::Horizontal) { + if (section > -1 && section < m_headers.size()) + return m_headers.at(section); + } else if (orientation == Qt::Vertical) { + if (section > -1 && section < m_rows.size()) + return section; + } + + return {}; +} + +QUrl QuickStudioCsvTableModel::source() const +{ + return m_source; +} + +void QuickStudioCsvTableModel::setSource(const QUrl &newSource) +{ + if (m_source == newSource) + return; + + m_source = newSource; + emit this->sourceChanged(m_source); + + startWatchingSource(); + reloadModel(); +} + +void QuickStudioCsvTableModel::reloadModel() +{ + beginResetModel(); + m_headers.clear(); + m_rows.clear(); + m_types.clear(); + m_columnIsClean.clear(); + + QString filePath = ::urlToLocalPath(source()); + QFile sourceFile(filePath); + + if (!sourceFile.open(QFile::ReadOnly)) { + qWarning() << "File cannot be opened:" << sourceFile.errorString(); + endResetModel(); + return; + } + + QTextStream stream(&sourceFile); + + if (!stream.atEnd()) + m_headers = stream.readLine().split(u',', Qt::KeepEmptyParts); + + m_types.insert(0, m_headers.size(), QMetaType::UnknownType); + m_columnIsClean.insert(0, m_headers.size(), true); + + if (!m_headers.isEmpty()) { + while (!stream.atEnd()) { + const QStringList recordDataList = stream.readLine().split(u',', Qt::KeepEmptyParts); + int column = -1; + QHash recordData; + for (const QString &cellString : recordDataList) { + if (++column == m_headers.size()) + break; + + if (!cellString.size()) + continue; + + const QMetaType::Type &type = m_types.at(column); + + QVariant cellData; + if (type == QMetaType::UnknownType) { + cellData = stringToVariant(cellString); + m_types.replace(column, QMetaType::Type(cellData.typeId())); + } else { + bool columnIsClean = m_columnIsClean.at(column); + bool *ok = columnIsClean ? &columnIsClean : nullptr; + cellData = stringToVariant(cellString, type, ok); + if (ok) + m_columnIsClean.replace(column, *ok); + } + recordData.insert(column, cellData); + } + m_rows.append(recordData); + } + } + + endResetModel(); +} + +void QuickStudioCsvTableModel::checkPathAndReload(const QString &path) +{ + QString sourceLocalPath = ::urlToLocalPath(source()); + if (path == sourceLocalPath) + reloadModel(); +} + +void QuickStudioCsvTableModel::startWatchingSource() +{ + qCDebug(quickStudioCsvTableModelDebug) << Q_FUNC_INFO << "Load file: " << source(); + + const QStringList oldWatchingFiles = m_fileWatcher->files(); + if (oldWatchingFiles.size()) + m_fileWatcher->removePaths(oldWatchingFiles); + + QString localPath = ::urlToLocalPath(source()); + if (QFileInfo(localPath).isFile()) + m_fileWatcher->addPath(localPath); +} diff --git a/Dependencies/Components/imports/utils/quickstudiocsvtablemodel.h b/Dependencies/Components/imports/utils/quickstudiocsvtablemodel.h new file mode 100644 index 0000000..edaf4e3 --- /dev/null +++ b/Dependencies/Components/imports/utils/quickstudiocsvtablemodel.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUICKSTUDIOCSVTABLEMODEL_P_H +#define QUICKSTUDIOCSVTABLEMODEL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QFileSystemWatcher; +class QuickStudioCsvTableModel : public QAbstractTableModel +{ + Q_OBJECT + + QML_NAMED_ELEMENT(CsvTableModel) + QML_ADDED_IN_VERSION(6, 2) + + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + +public: + explicit QuickStudioCsvTableModel(QObject *parent = nullptr); + + int rowCount(const QModelIndex &parent = {}) const override; + int columnCount(const QModelIndex &parent = {}) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, + Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + + QUrl source() const; + void setSource(const QUrl &newSource); + +signals: + void sourceChanged(const QUrl &url); + +private slots: + void reloadModel(); + void checkPathAndReload(const QString &path); + +private: + void startWatchingSource(); + + QFileSystemWatcher *m_fileWatcher = nullptr; + QUrl m_source; + + QStringList m_headers; + QList> m_rows; + QList m_types; + QList m_columnIsClean; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QuickStudioCsvTableModel) + +#endif // QUICKSTUDIOCSVTABLEMODEL_P_H diff --git a/Dependencies/Components/imports/utils/quickstudiofilereader.cpp b/Dependencies/Components/imports/utils/quickstudiofilereader.cpp new file mode 100644 index 0000000..4c01a28 --- /dev/null +++ b/Dependencies/Components/imports/utils/quickstudiofilereader.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quickstudiofilereader.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef Q_STATIC_LOGGING_CATEGORY // introduced with Qt 6.9 +static Q_LOGGING_CATEGORY(quickStudioFileReaderDebug, "qt.Studioapplication.debug", QtDebugMsg) +#else +Q_STATIC_LOGGING_CATEGORY(quickStudioFileReaderDebug, "qt.Studiofilereader.debug", QtDebugMsg) +#endif + +QuickStudioFileReader::QuickStudioFileReader(QObject *parent) + : QObject(parent) +{} + +QString QuickStudioFileReader::loadFile(const QString &path) +{ + qCDebug(quickStudioFileReaderDebug) << Q_FUNC_INFO << "Load file: " << path; + + QFile file(path); + bool ok = file.open(QIODevice::ReadOnly); + + if (!ok) { + qWarning() << "File cannot be opened:" << file.errorString(); + return {}; + } + + if (m_watcher) + m_watcher->deleteLater(); + + m_watcher = new QFileSystemWatcher({path}, this); + + connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &QuickStudioFileReader::reload); + + return QString::fromUtf8(file.readAll()); +} + +void QuickStudioFileReader::reload() +{ + qCDebug(quickStudioFileReaderDebug) << Q_FUNC_INFO << "Load file: " << m_filePath; + + QString localPath; + + if (m_filePath.isLocalFile()) + localPath = m_filePath.toLocalFile(); + + if (m_filePath.scheme() == QStringLiteral("qrc")) { + const QString &path = m_filePath.path(); + localPath = QStringLiteral(":") + path; + } + + QString newContent = loadFile(localPath); + + if (newContent != m_content) { + m_content = newContent; + emit contentChanged(); + } +} + +void QuickStudioFileReader::setFilePath(const QUrl &url) +{ + if (url == filePath()) + return; + + m_filePath = url; + + reload(); + + emit filePathChanged(); +} + +QT_END_NAMESPACE diff --git a/Dependencies/Components/imports/utils/quickstudiofilereader.h b/Dependencies/Components/imports/utils/quickstudiofilereader.h new file mode 100644 index 0000000..0c197b2 --- /dev/null +++ b/Dependencies/Components/imports/utils/quickstudiofilereader.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2023 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUICKSTUDIOUTILS_P_H +#define QUICKSTUDIOUTILS_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QFileSystemWatcher; + +class QuickStudioFileReader : public QObject +{ + Q_OBJECT + + QML_NAMED_ELEMENT(FileReader) + QML_ADDED_IN_VERSION(6, 2) + + Q_PROPERTY(QUrl filePath READ filePath WRITE setFilePath NOTIFY filePathChanged) + Q_PROPERTY(QString content READ content NOTIFY contentChanged) + +public: + explicit QuickStudioFileReader(QObject *parent = nullptr); + + const QUrl filePath() { return m_filePath; } + void setFilePath(const QUrl &file); + + const QString content() { return m_content; } + +signals: + void filePathChanged(); + void contentChanged(); + +private: + QString loadFile(const QString &path); + void reload(); + + QUrl m_filePath; + QString m_content; + QFileSystemWatcher *m_watcher = nullptr; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QuickStudioFileReader) + +#endif // QUICKSTUDIOUTILS_P_H diff --git a/Generated/Quick3DAssets.txt b/Generated/Quick3DAssets.txt new file mode 100644 index 0000000..84c843f --- /dev/null +++ b/Generated/Quick3DAssets.txt @@ -0,0 +1 @@ +Imported 3D assets and components imported from bundles will be created in this folder. diff --git a/KomplexHub.qmlproject b/KomplexHub.qmlproject new file mode 100644 index 0000000..091d5f8 --- /dev/null +++ b/KomplexHub.qmlproject @@ -0,0 +1,124 @@ +import QmlProject + +Project { + mainFile: "KomplexHubContent/App.qml" + mainUiFile: "KomplexHubContent/MainScreen.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "KomplexHub" + } + + QmlFiles { + directory: "KomplexHubContent" + } + + QmlFiles { + directory: "Generated" + } + + JavaScriptFiles { + directory: "KomplexHub" + } + + JavaScriptFiles { + directory: "KomplexHubContent" + } + + ImageFiles { + directory: "KomplexHubContent" + } + + ImageFiles { + directory: "Generated" + } + + Files { + filter: "*.conf" + files: ["qtquickcontrols2.conf"] + } + + Files { + filter: "qmldir" + directory: "." + } + + FontFiles { + filter: "*.ttf;*.otf" + } + + Files { + filter: "*.wav;*.mp3" + } + + Files { + filter: "*.mp4" + } + + Files { + filter: "*.glsl;*.glslv;*.glslf;*.vsh;*.fsh;*.vert;*.frag" + } + + Files { + filter: "*.qsb" + } + + Files { + filter: "*.json" + } + + Files { + filter: "*.mesh" + directory: "Generated" + } + + Files { + filter: "*.qad" + directory: "Generated" + } + + Environment { + QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf" + QML_COMPAT_RESOLVE_URLS_ON_ASSIGNMENT: "1" + QT_LOGGING_RULES: "qt.qml.connections=false" + QT_ENABLE_HIGHDPI_SCALING: "0" + /* Useful for debugging + QSG_VISUALIZE=batches + QSG_VISUALIZE=clip + QSG_VISUALIZE=changes + QSG_VISUALIZE=overdraw + */ + } + + qt6Project: true + + /* List of plugin directories passed to QML runtime */ + importPaths: [ ".", "KomplexHub/Kero", "KomplexHub/Controls" ] + + /* Required for deployment */ + targetDirectory: "/opt/KomplexHub" + + enableCMakeGeneration: true + standaloneApp: true + + qdsVersion: "4.8" + + quickVersion: "6.8" + + /* If any modules the project imports require widgets (e.g. QtCharts), widgetApp must be true */ + widgetApp: true + + /* args: Specifies command line arguments for qsb tool to generate shaders. + files: Specifies target files for qsb tool. If path is included, it must be relative to this file. + Wildcard '*' can be used in the file name part of the path. + e.g. files: [ "KomplexHubContent/shaders/*.vert", "*.frag" ] */ + ShaderTool { + args: "-s --glsl \"100 es,120,150\" --hlsl 50 --msl 12" + files: [ "KomplexHubContent/shaders/*" ] + } + + multilanguageSupport: true + supportedLanguages: ["en"] + primaryLanguage: "en" + +} diff --git a/KomplexHub.qmlproject.qtds b/KomplexHub.qmlproject.qtds new file mode 100644 index 0000000..fe24ed7 --- /dev/null +++ b/KomplexHub.qmlproject.qtds @@ -0,0 +1,172 @@ + + + + + + EnvironmentId + {a170a1f3-4818-428b-b40d-6feb29bcd6f7} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + true + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 0 + 80 + true + true + 1 + 0 + false + true + false + 2 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.Target.0 + + Desktop + true + Desktop Qt 6.8.5 + Desktop Qt 6.8.5 + {63f87550-2541-4163-9631-08b7fea781da} + 0 + 0 + 0 + + /home/parametheus/Projects/QtDesigner/KomplexHub/KomplexHub.qmlproject + + 0 + Build + Build + ProjectExplorer.BuildSteps.Build + + + 0 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Default + QmlBuildConfiguration + 0 + 0 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + 0 + + false + QML Runtime + QmlProjectManager.QmlRunConfiguration.Qml + + false + en + CurrentFile + true + true + true + :1 + + 1 + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + 0 + + false + QML Runtime + QmlProjectManager.QmlRunConfiguration.Qml + + false + en + CurrentFile + true + true + true + :1 + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/KomplexHubContent/App.qml b/KomplexHubContent/App.qml new file mode 100644 index 0000000..5454171 --- /dev/null +++ b/KomplexHubContent/App.qml @@ -0,0 +1,21 @@ +import QtQuick +import QtQuick.Controls 2.15 +import KomplexHub +import org.kde.kirigami as Kirigami + +ApplicationWindow { + + visible: true + flags: Qt.Window + title: "KomplexHub" + color: "transparent" + minimumWidth: 720 + + MainScreen { + antialiasing: true + id: mainScreen + + anchors.fill: parent + } +} + diff --git a/KomplexHubContent/CMakeLists.txt b/KomplexHubContent/CMakeLists.txt new file mode 100644 index 0000000..ae86ebf --- /dev/null +++ b/KomplexHubContent/CMakeLists.txt @@ -0,0 +1,22 @@ +### This file is automatically generated by Qt Design Studio. +### Do not change + +qt_add_library(KomplexHubContent STATIC) +qt6_add_qml_module(KomplexHubContent + URI "KomplexHubContent" + VERSION 1.0 + RESOURCE_PREFIX "/qt/qml" + QML_FILES + "App.qml" + "MainScreen.qml" + "pages/HomePage.qml" + "pages/ImageSearchPage.qml" + "pages/InstalledWallpaperPage.qml" + "pages/LiveSearchPage.qml" + "pages/LoginPage.qml" + "pages/SettingsPage.qml" + "pages/UserProfilePage.qml" + "pages/WallpaperSettingsPage.qml" +) + + diff --git a/KomplexHubContent/MainScreen.qml b/KomplexHubContent/MainScreen.qml new file mode 100644 index 0000000..5f318d4 --- /dev/null +++ b/KomplexHubContent/MainScreen.qml @@ -0,0 +1,297 @@ +/* +This is a UI file (.ui.qml) that is intended to be edited in Qt Design Studio only. +It is supposed to be strictly declarative and only uses a subset of QML. If you edit +this file manually, you might introduce QML code that is not supported by Qt Design Studio. +Check out https://doc.qt.io/qtcreator/creator-quick-ui-forms.html for details on .ui.qml files. +*/ +import QtQuick +import QtQuick.Controls 2.0 +import QtQuick.Layouts +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero + +Rectangle { + property MenuButton currentMenuButton + + id: windowRoot + + color: palette.window + + RowLayout { + id: windowRootLayout + anchors.fill: parent + spacing: 0 + + Rectangle { + id: windowMenu + + Layout.fillWidth: false + Layout.fillHeight: true + Layout.preferredWidth: 100 + Layout.minimumWidth: 100 + Layout.maximumWidth: 100 + + color: palette.base.lighter() + + ColumnLayout { + id: windowMenuLayout + anchors.fill: parent + + MenuButton { + id: homeMenubutton + Layout.alignment: Qt.AlignTop + + height: 64 + width: 100 + text: "Home" + + icon.height: 32 + icon.width: 32 + icon.url: "qrc:/images/icons/icons8-famous.svg" + + onTriggered: () => { + pageLoader.page = "pages/HomePage.qml" + + currentMenuButton.selected = false + currentMenuButton = this + + searchContainer.preferredHeight = 0 + } + } + + MenuButton { + Layout.alignment: Qt.AlignTop + + height: 64 + width: 100 + text: "Images" + + icon.height: 32 + icon.width: 32 + icon.url: "qrc:/images/icons/icons8-image.svg" + + onTriggered: () => { + pageLoader.page = "pages/ImageSearchPage.qml" + + currentMenuButton.selected = false + currentMenuButton = this + + searchContainer.preferredHeight = 50 + } + } + + MenuButton { + Layout.alignment: Qt.AlignTop + + height: 64 + width: 100 + text: "Live" + + icon.height: 32 + icon.width: 32 + icon.url: "qrc:/images/icons/icons8-biotech.svg" + + onTriggered: () => { + pageLoader.page = "pages/LiveSearchPage.qml" + + currentMenuButton.selected = false + currentMenuButton = this + + searchContainer.preferredHeight = 50 + } + } + + MenuButton { + Layout.alignment: Qt.AlignTop + + height: 64 + width: 100 + text: "Installed" + + icon.height: 32 + icon.width: 32 + icon.url: "qrc:/images/icons/icons8-hdd.svg" + + onTriggered: () => { + pageLoader.page = "pages/InstalledWallpaperPage.qml" + + currentMenuButton.selected = false + currentMenuButton = this + + searchContainer.preferredHeight = 0 + } + } + + Item { + Layout.fillHeight: true + } + + MenuButton { + Layout.alignment: Qt.AlignBottom + + height: 64 + width: 100 + text: "Settings" + + icon.height: 32 + icon.width: 32 + icon.url: "qrc:/images/icons/icons8-settings.svg" + + onTriggered: () => { + pageLoader.page = "pages/SettingsPage.qml" + + currentMenuButton.selected = false + currentMenuButton = this + + searchContainer.preferredHeight = 0 + } + } + } + } + + Rectangle { + + //Kirigami.Theme.colorSet: Kirigami.Theme.View + id: windowContainer + + Layout.fillHeight: true + Layout.fillWidth: true + + color: "transparent" + + ColumnLayout { + id: windowContainerLayout + anchors.fill: parent + spacing: 0 + + SearchBar { + property int preferredHeight: 50 + id: searchContainer + color: palette.base.lighter() + + Layout.fillHeight: false + Layout.fillWidth: true + Layout.preferredHeight: preferredHeight + + icon: "qrc:/images/icons/icons8-search.svg" + + Behavior on preferredHeight { + NumberAnimation { duration: Constants.normalAnimationDuration } + } + } + + Rectangle { + id: windowContent + + Layout.fillHeight: true + Layout.fillWidth: true + Layout.leftMargin: 0 + Layout.topMargin: 0 + + color: palette.base.darker() + + Loader { + property bool loading: false + property string page + + anchors.fill: parent + + onPageChanged: () => { + loading = true + fadeOutPage() + } + + id: pageLoader + + OpacityAnimator on opacity { + id: pageLoaderAnimation + + target: pageLoader + duration: 150 + + onFinished: () => { + if(pageLoader.loading && pageLoader.opacity === 0) + pageLoader.loadPage() + else if(pageLoader.loading && pageLoader.opacity === 1) + pageLoader.loading = false + } + } + + function fadeOutPage() { + pageLoaderAnimation.from = 1 + pageLoaderAnimation.to = 0 + pageLoaderAnimation.start() + } + + function fadeInPage() { + if(pageLoader.sourceComponent.status != Component.Ready) + return + + pageLoaderAnimation.from = 0 + pageLoaderAnimation.to = 1 + pageLoaderAnimation.start() + } + + function loadPage() { + sourceComponent = Qt.createComponent(page) + + if(pageLoader.sourceComponent.status == Component.Ready) + fadeInPage() + else + statusChanged.connect(fadeInPage) + } + } + } + } + } + } + + KeroBuildingAnimation { + id: buildingOverlay + + anchors.fill: parent + visible: false + } + + KeroLoadingAnimation { + id: loadingAnimation + anchors.fill: parent + + // OpacityAnimator on opacity { + // duration: 150 + // } + + visible: opacity > 0 + opacity: 0 + } + + Component.onCompleted: () => { + homeMenubutton.selected = true + currentMenuButton = homeMenubutton + pageLoader.page = "pages/HomePage.qml" + searchContainer.preferredHeight = 0 + loadingAnimation.opacity = 0 + } + + states: [ + State { + name: "build_error" + PropertyChanges { + target: windowOverlay + visible: true + } + }, + State { + name: "building" + PropertyChanges { + target: buildingOverlay + visible: true + } + }, + State { + name: "build_complete" + } + + ] +} diff --git a/KomplexHubContent/pages/HomePage.qml b/KomplexHubContent/pages/HomePage.qml new file mode 100644 index 0000000..04f6242 --- /dev/null +++ b/KomplexHubContent/pages/HomePage.qml @@ -0,0 +1,141 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero + +Item { + readonly property bool searchable: false + property int resultsPerRow: (homePageRoot.width - (64 + Constants.largeMargin)) / (256 + Constants.largeMargin) + + id: homePageRoot + + Rectangle { + anchors.fill: parent + color: palette.base + + ScrollView { + anchors.fill: parent + anchors.margins: Constants.largeMargin + + ColumnLayout { + width: homePageRoot.width + + // Featured Results + ColumnLayout { + width: parent.width + height: 420 + + Text { + color: palette.text + font.pixelSize: Constants.largeFont.pixelSize + text: "Featured" + } + + RowLayout { + + Layout.fillWidth: true + Layout.preferredHeight: 256 + Layout.alignment: Qt.AlignHCenter + + Repeater { + model: resultsPerRow + + delegate: SearchResultItem { + + } + } + + SquareButton { + Layout.fillHeight: true + Layout.preferredWidth: 64 + + icon.source: "qrc:/images/icons/icons8-forward.svg" + icon.height: 24 + icon.width: 24 + } + } + } + + Item { + height: Constants.largeMargin + } + + ColumnLayout { + width: parent.width + height: 420 + + Text { + color: palette.text + font.pixelSize: Constants.largeFont.pixelSize + text: "Newest" + } + + RowLayout { + + Layout.fillWidth: true + Layout.preferredHeight: 256 + Layout.alignment: Qt.AlignHCenter + + Repeater { + model: resultsPerRow + + delegate: SearchResultItem { + + } + } + + SquareButton { + Layout.fillHeight: true + Layout.preferredWidth: 64 + + icon.source: "qrc:/images/icons/icons8-forward.svg" + icon.height: 24 + icon.width: 24 + } + } + } + + Item { + height: Constants.largeMargin + } + + ColumnLayout { + width: parent.width + height: 420 + + Text { + color: palette.text + font.pixelSize: Constants.largeFont.pixelSize + text: "Popular" + } + + RowLayout { + + Layout.fillWidth: true + Layout.preferredHeight: 256 + Layout.alignment: Qt.AlignHCenter + + Repeater { + model: resultsPerRow + + delegate: SearchResultItem { + + } + } + + SquareButton { + Layout.fillHeight: true + Layout.preferredWidth: 64 + + icon.source: "qrc:/images/icons/icons8-forward.svg" + icon.height: 24 + icon.width: 24 + } + } + } + } + } + } +} diff --git a/KomplexHubContent/pages/ImageSearchPage.qml b/KomplexHubContent/pages/ImageSearchPage.qml new file mode 100644 index 0000000..b5ac138 --- /dev/null +++ b/KomplexHubContent/pages/ImageSearchPage.qml @@ -0,0 +1,78 @@ +import QtQuick +import QtQuick.Controls +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero + +Item { + id: imageSearchPageRoot + + SearchResultList { + id: searchResultList + anchors.fill: parent + color: palette.base + } + + KeroErrorAvatar { + id: errorOverlay + + anchors.fill: parent + opacity: 0 + } + + KeroNoResultsAvatar { + id: noResultsOverlay + + anchors.fill: parent + opacity: 0 + } + + KeroLoadingAnimation { + id: loadingOverlay + + anchors.fill: parent + opacity: 0 + } + + states: [ + State { + name: "loading" + when: searchResultList.state === "loading" + + PropertyChanges { + target: loadingOverlay + opacity: 1 + } + PropertyChanges { + target: resultsView + opacity: 0 + } + }, + State { + name: "empty" + when: searchResultList.state === "empty" + + PropertyChanges { + target: noResultsOverlay + opacity: 1 + } + PropertyChanges { + target: resultsView + opacity: 0 + } + }, + State { + name: "error" + when: searchResultList.state === "error" + + PropertyChanges { + target: errorOverlay + opacity: 1 + } + PropertyChanges { + target: resultsView + opacity: 0 + } + } + ] +} diff --git a/KomplexHubContent/pages/InstalledWallpaperPage.qml b/KomplexHubContent/pages/InstalledWallpaperPage.qml new file mode 100644 index 0000000..b67049e --- /dev/null +++ b/KomplexHubContent/pages/InstalledWallpaperPage.qml @@ -0,0 +1,138 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Dialogs +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero +import KomplexHubPlugin + +Rectangle { + id: root + + color: palette.base + + ListView { + id: view + anchors.fill: parent + + InstalledPackManager { + id: manager + } + + model: manager + delegate: Rectangle { + required property string name + required property string author + required property string description + required property string thumbnail + required property string uri + + width: view.width + height: 50 + + border.color: palette.base.lighter() + + color: "transparent" + + RowLayout { + anchors.fill: parent + + Rectangle { + color: palette.base.darker() + border.color: palette.base.lighter() + Layout.preferredHeight: 35 + Layout.preferredWidth: 35 + Layout.leftMargin: 12 + + Image { + anchors.fill: parent + source: thumbnail + } + } + + ColumnLayout { + Layout.fillWidth: true + + Text { + Layout.fillWidth: true + text: name + color: palette.text + } + Text { + Layout.fillWidth: true + text: author + color: palette.text + } + } + + SquareButton { + Layout.preferredHeight: 35 + Layout.preferredWidth: 35 + Layout.alignment: Qt.AlignRight + Layout.rightMargin: 12 + icon.source: "qrc:/images/icons/icons8-trash.svg" + + onTriggered: () => { + askToUninstall(uri) + } + } + } + } + } + + function askToUninstall(uri) { + uninstallMessageDialog.uri = uri + uninstallMessageDialog.visible = true + } + + function uninstall(uri) { + if(!manager.uninstall(uri)); + } + + MessageDialog { + property string uri: "" + + id: uninstallMessageDialog + text: qsTr("Wallpaper Pack Will Be Uninstalled") + informativeText: qsTr("This action cannot be undone. Proceed?") + buttons: MessageDialog.Ok | MessageDialog.Cancel + onButtonClicked: (button, role) => { + switch (button) { + case MessageDialog.Ok: + if(!uninstall(uri)) + uninstallErrorDialog.visible = true + else + manager.rescan() + break; + } + } + } + + MessageDialog { + id: uninstallErrorDialog + text: qsTr("Wallpaper Failed To Uninstall") + informativeText: manager.errorString + buttons: MessageDialog.Ok + } + + KeroLoadingAnimation { + id: loadingAnimation + + anchors.fill: parent + visible: false + color: palette.base.alpha(1) + } + + states:[ + State { + name: "loading" + when: manager.state == InstalledPackManager.Loading + PropertyChanges { + target: loadingAnimation + visible: true + } + } + + ] +} \ No newline at end of file diff --git a/KomplexHubContent/pages/LiveSearchPage.qml b/KomplexHubContent/pages/LiveSearchPage.qml new file mode 100644 index 0000000..b5ac138 --- /dev/null +++ b/KomplexHubContent/pages/LiveSearchPage.qml @@ -0,0 +1,78 @@ +import QtQuick +import QtQuick.Controls +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero + +Item { + id: imageSearchPageRoot + + SearchResultList { + id: searchResultList + anchors.fill: parent + color: palette.base + } + + KeroErrorAvatar { + id: errorOverlay + + anchors.fill: parent + opacity: 0 + } + + KeroNoResultsAvatar { + id: noResultsOverlay + + anchors.fill: parent + opacity: 0 + } + + KeroLoadingAnimation { + id: loadingOverlay + + anchors.fill: parent + opacity: 0 + } + + states: [ + State { + name: "loading" + when: searchResultList.state === "loading" + + PropertyChanges { + target: loadingOverlay + opacity: 1 + } + PropertyChanges { + target: resultsView + opacity: 0 + } + }, + State { + name: "empty" + when: searchResultList.state === "empty" + + PropertyChanges { + target: noResultsOverlay + opacity: 1 + } + PropertyChanges { + target: resultsView + opacity: 0 + } + }, + State { + name: "error" + when: searchResultList.state === "error" + + PropertyChanges { + target: errorOverlay + opacity: 1 + } + PropertyChanges { + target: resultsView + opacity: 0 + } + } + ] +} diff --git a/KomplexHubContent/pages/LoginPage.qml b/KomplexHubContent/pages/LoginPage.qml new file mode 100644 index 0000000..098a40c --- /dev/null +++ b/KomplexHubContent/pages/LoginPage.qml @@ -0,0 +1,88 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub +import KomplexHub.Controls + +Item { + id: loginFormRoot + + ColumnLayout { + anchors.centerIn: parent + + Image { + source: "qrc:/images/icons/icons8-user-account.svg" + Layout.preferredHeight: 64 + Layout.preferredWidth: 64 + Layout.alignment: Qt.AlignCenter + } + + // KeroLoginAvatar { + // Layout.preferredWidth: 380 + // Layout.preferredHeight: 380 + // description: "" + // Layout.alignment: Qt.AlignCenter + // } + + // Image { + // source: "images/kero/kero_choice.png" + // Layout.preferredWidth: 380 + // Layout.preferredHeight: 380 + // Layout.alignment: Qt.AlignCenter + // } + + ColumnLayout { + Layout.fillWidth: true + Layout.alignment: Qt.AlignCenter + + ColumnLayout { + Layout.fillWidth: true + + Text { + Layout.fillWidth: false + text: "Username" + + font.pixelSize: Constants.largeFont.pixelSize + } + LineEdit { + Layout.preferredHeight: 32 + Layout.preferredWidth: 256 + } + } + + ColumnLayout { + Layout.fillWidth: true + + Text { + Layout.fillWidth: false + text: "Password" + + font.pixelSize: Constants.largeFont.pixelSize + } + LineEdit { + Layout.preferredHeight: 32 + Layout.preferredWidth: 256 + } + } + + RowLayout { + clip: true + Layout.maximumWidth: 250 + Layout.leftMargin: 3 + + SquareButton { + Layout.preferredHeight: 36 + Layout.preferredWidth: 36 + + icon.source: "qrc:/images/icons/icons8-cancel.svg" + } + + SquareButton { + Layout.fillWidth: true + icon.source: "qrc:/images/icons/icons8-login.svg" + text: qsTr("Login") + } + } + } + } +} diff --git a/KomplexHubContent/pages/SettingsPage.qml b/KomplexHubContent/pages/SettingsPage.qml new file mode 100644 index 0000000..4712282 --- /dev/null +++ b/KomplexHubContent/pages/SettingsPage.qml @@ -0,0 +1,187 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub +import KomplexHub.Kero + +Item { + readonly property bool searchable: false + + id: settingsPageRoot + + Rectangle { + anchors.fill: parent + color: palette.base + + ColumnLayout { + anchors.fill: parent + + TabBar { + id: bar + + Layout.fillHeight: false + Layout.fillWidth: true + TabButton { + text: qsTr("Wallpaper") + } + TabButton { + text: qsTr("Account") + } + TabButton { + text: qsTr("About") + } + } + + StackLayout { + + Layout.fillHeight: true + Layout.fillWidth: true + currentIndex: bar.currentIndex + + Item { + id: wallpaperTab + + Layout.fillHeight: true + Layout.fillWidth: true + + WallpaperSettingsPage { + anchors.fill: parent + } + } + Item { + id: accountTab + + Layout.fillHeight: true + Layout.fillWidth: true + + UserProfilePage { + anchors.fill: parent + } + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + property string title: qsTr("Hello!") + property string contributors: qsTr("DigitalArtifex + +fridje") + property string thanks: qsTr("Icons8 + +ShaderToy + +Pexels") + + id: keroHelloAvatarRoot + + Rectangle { + anchors.fill: parent + color: "transparent" + + ColumnLayout { + anchors.fill: parent + + KeroHelloAvatar { + Layout.fillHeight: true + Layout.fillWidth: true + antialiasing: true + } + + Item { Layout.preferredHeight: 36 } + + Text { + Layout.fillHeight: false + Layout.fillWidth: true + Layout.margins: Constants.largeMargin + text: qsTr("Meet Kero, the small but tireless spirit behind Komplex, a curious little dragon whose name echoes the cheerful sound of a frog’s call. Hailing from the realm of **Kairoku**, Kero honed his skill in a place where unfinished ideas drift like clouds and raw creativity hums in the air.") + color: palette.text + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + wrapMode: Text.WordWrap + textFormat: Text.MarkdownText + } + + Text { + Layout.fillHeight: false + Layout.fillWidth: true + Layout.margins: Constants.largeMargin + text: qsTr("In Kairoku, landscapes aren’t painted...they’re assembled, animated, and brought to life through careful craftsmanship. Kero was once an apprentice there, learning how to shape reactive skies, breathing forests, and shimmering cityscapes. With his trusty tools and a builder’s instinct, he became known for turning even the simplest concept into something that felt alive.") + color: palette.text + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + wrapMode: Text.WordWrap + textFormat: Text.MarkdownText + } + + Item { Layout.fillHeight: true } + + RowLayout { + Layout.fillWidth: true + Layout.alignment: Qt.AlignTop | Qt.AlignRight + + ColumnLayout { + Layout.alignment: Qt.AlignTop | Qt.AlignRight + Layout.margins: Constants.largeMargin + Layout.fillHeight: true + + Text { + text: qsTr("Contributors") + color: palette.text.darker() + font: Constants.h5Font + + Layout.alignment: Qt.AlignTop + Layout.bottomMargin: Constants.largeMargin + wrapMode: Text.WordWrap + textFormat: Text.MarkdownText + } + + Text { + id: contributorText + text: keroHelloAvatarRoot.contributors + color: palette.text.darker() + + Layout.alignment: Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + wrapMode: Text.WordWrap + textFormat: Text.MarkdownText + } + } + + ColumnLayout { + Layout.alignment: Qt.AlignTop | Qt.AlignRight + Layout.margins: Constants.largeMargin + Layout.fillHeight: true + + Text { + text: qsTr("Special Thanks") + color: palette.text.darker() + font: Constants.h5Font + + Layout.alignment: Qt.AlignTop + Layout.bottomMargin: Constants.largeMargin + wrapMode: Text.WordWrap + textFormat: Text.MarkdownText + } + + Text { + id: thanksText + text: keroHelloAvatarRoot.thanks + color: palette.text.darker() + + Layout.alignment: Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + wrapMode: Text.WordWrap + textFormat: Text.MarkdownText + } + } + } + } + } + + } + } + } + + } +} diff --git a/KomplexHubContent/pages/UserProfilePage.qml b/KomplexHubContent/pages/UserProfilePage.qml new file mode 100644 index 0000000..cc69395 --- /dev/null +++ b/KomplexHubContent/pages/UserProfilePage.qml @@ -0,0 +1,60 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + id: root + + ColumnLayout { + anchors.fill: parent + + RowLayout { + Layout.fillWidth: true + + Image { + Layout.preferredHeight: 128 + Layout.preferredWidth: 128 + id: userAccountImage + source: "qrc:/images/icons/icons8-user-account.svg" + } + + ColumnLayout { + Layout.alignment: Qt.AlignTop + Layout.topMargin: Constants.largeMargin + Layout.leftMargin: Constants.largeMargin + Layout.bottomMargin: Constants.largeMargin + Layout.rightMargin: Constants.largeMargin + Layout.fillWidth: true + Layout.fillHeight: true + + Text { + text: qsTr("Username") + font.pixelSize: Constants.largeFont.pixelSize + font.bold: true + color: palette.text + } + + Text { + text: qsTr("Thursday, April 30th 2026") + font.pixelSize: Constants.mediumMargin.pixelSize + color: palette.text + } + + RowLayout { + Text { + text: qsTr("Wallpapers Submitted:") + font.pixelSize: Constants.largeFont.pixelSize + color: palette.text + } + Text { + text: qsTr("12") + font.pixelSize: Constants.largeFont.pixelSize + font.bold: true + color: palette.text + } + } + } + } + } +} diff --git a/KomplexHubContent/pages/WallpaperSettingsPage.qml b/KomplexHubContent/pages/WallpaperSettingsPage.qml new file mode 100644 index 0000000..13d3499 --- /dev/null +++ b/KomplexHubContent/pages/WallpaperSettingsPage.qml @@ -0,0 +1,649 @@ +/* + * Komplex Wallpaper Engine + * Copyright (C) 2025 @DigitalArtifex | github.com/DigitalArtifex + * + * config.qml + * + * This component provides a configuration interface for the Komplex Wallpaper Engine, + * allowing users to customize shader settings, channel configurations, and other + * parameters related to the wallpaper engine. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ +// pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Layouts +//import org.kde.kirigami as Kirigami +//import org.kde.plasma.core as PlasmaCore +import QtCore +import Qt.labs.folderlistmodel 2.15 +import KomplexHub +import KomplexHub.Controls +import KomplexHubPlugin + +//import com.github.digitalartifex.komplex 1.0 as Komplex + +Item +{ + SettingsManager { + id: manager + + onError: (title, message) => { + console.log(title + ": " + message) + } + } + + id: root + property alias cfg_pauseMode: pauseModeCombo.currentIndex + property alias cfg_isPaused: runningCombo.checked + property alias cfg_shaderSpeed: speedSlider.value + property alias cfg_mouseSpeedBias: mouseBiasSlider.value + property bool cfg_infoPlasma6Preview_dismissed + property bool cfg_warningResources_dismissed + property bool cfg_emergencyHelp_dismissed + property bool cfg_infoiChannelSettings_dismissed + property alias cfg_checkActiveScreen: activeScreenOnlyCheckbox.checked + property alias cfg_excludeWindows: excludeWindows.windows + property alias cfg_running: runningCombo.checked + + property alias cfg_resolution_x: resolutionXField.value + property alias cfg_resolution_y: resolutionYField.value + + property alias cfg_framerate_limit: frameRateField.value + property bool cfg_shader_updated + + property string shaderPackage: "" + property int shaderPackageIndex: 0 + property real shaderSpeed: 1.0 + property int resolutionX: 1080 + property int resolution: 1920 + property bool enableMouseTracking: true + property real mouseTrackingBias: 0.5 + + Rectangle { + anchors.fill: parent + color: "transparent" + clip: true + + ScrollView { + id: wallpaperSettingsScrollView + anchors.fill: parent + anchors.margins: Constants.largeMargin + + ColumnLayout { + width: wallpaperSettingsScrollView.width + + Text { + text: qsTr("Wallpaper Options") + font: Constants.h2Font + color: palette.text + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + ComboBox + { + property string shader + Layout.fillWidth: true + Layout.preferredHeight: 36 + Layout.margins: Constants.smallMargin + + id: selectedShaderPack + model: manager.availableShaderPacks + + delegate: Component + { + id: packListDelegate + + ItemDelegate + { + width: parent ? parent.width : 0 + text: modelData + } + } + + textRole: "modelData" + currentIndex: manager.shaderPackIndex + displayText: currentIndex === -1 ? "Custom File" : currentText.replace("_", " ").charAt(0).toUpperCase() + currentText.replace("_", " ").slice(1) + + // onCurrentTextChanged: + // { + // root.cfg_shader_package_index = currentIndex; + + // if (root.cfg_shader_package_index === -1) + // return; + + // var source = currentText + // shaderPackModel.loadMetadata(source) + // root.cfg_shader_package = "file://" + shaderPackModel.path(source) + // } + + + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + RowLayout { + Layout.fillWidth: true + Layout.margins: Constants.smallMargin + + Text { + text: qsTr("Render Resolution") + font: Constants.h3Font + color: palette.text + Layout.preferredHeight: 36 + verticalAlignment: Text.AlignVCenter + } + + Text { + text: qsTr("X") + font: Constants.h3Font + color: palette.text + Layout.preferredHeight: 36 + Layout.preferredWidth: 64 + verticalAlignment: Text.AlignVCenter + } + + TextField { + property int value: manager.resolutionX + + Layout.preferredHeight: 36 + Layout.preferredWidth: 36 * 3 + + id: resolutionXField + inputMethodHints: Qt.ImhFormattedNumbersOnly + horizontalAlignment: Text.AlignRight + text: value + onEditingFinished: () => + { + value = parseInt(text) + } + + Keys.onPressed: (event) => + { + if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) + { + resolutionXField.focus = false; // Unfocus the TextField + event.accepted = true; // Prevent further propagation of the key event + } + } + + background: Rectangle + { + color: resolutionXField.activeFocus ? palette.base : "transparent" + border.color: resolutionXField.activeFocus ? palette.highlight : "transparent" + border.width: 1 + radius: 4 + anchors.fill: resolutionXField + anchors.margins: -2 + } + } + + Text { + text: qsTr("Y") + font: Constants.h3Font + color: palette.text + Layout.preferredHeight: 36 + Layout.preferredWidth: 64 + verticalAlignment: Text.AlignVCenter + } + + TextField { + property int value: manager.resolutionY + + Layout.preferredHeight: 36 + Layout.preferredWidth: 36 * 3 + + id: resolutionYField + inputMethodHints: Qt.ImhFormattedNumbersOnly + horizontalAlignment: Text.AlignRight + text: value + + onEditingFinished: () => + { + value = parseInt(text) + } + + Keys.onPressed: (event) => + { + if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) + { + resolutionYField.focus = false; // Unfocus the TextField + event.accepted = true; // Prevent further propagation of the key event + } + } + + background: Rectangle + { + color: resolutionYField.activeFocus ? palette.base : "transparent" + border.color: resolutionYField.activeFocus ? palette.highlight : "transparent" + border.width: 1 + radius: 4 + anchors.fill: resolutionYField + anchors.margins: -2 + } + } + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + RowLayout + { + Layout.fillWidth: true + + Text { + text: qsTr("Frame Rate") + font: Constants.h3Font + color: palette.text + Layout.preferredHeight: 36 + } + + Slider + { + id: frameRateSlider + Layout.fillWidth: true + Layout.preferredHeight: 36 + from: 1 + to: 60 + stepSize: 0.01 + onValueChanged: frameRateField.text = String(value.toFixed(2)); + + Component.onCompleted: () => { + value = manager.targetFramerate + } + } + + TextField + { + property int value + + id: frameRateField + inputMethodHints: Qt.ImhFormattedNumbersOnly + horizontalAlignment: Text.AlignRight + Layout.preferredWidth: 36 * 3 + Layout.preferredHeight: 36 + + onEditingFinished: () => + { + value = parseInt(text) + } + + Keys.onPressed: (event) => + { + if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) + { + frameRateField.focus = false; // Unfocus the TextField + event.accepted = true; // Prevent further propagation of the key event + } + } + + background: Rectangle + { + color: frameRateField.activeFocus ? palette.base : "transparent" + border.color: frameRateField.activeFocus ? palette.highlight : "transparent" + border.width: 1 + radius: 4 + anchors.fill: frameRateField + anchors.margins: -2 + } + } + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + RowLayout + { + id: speedLayout + Layout.fillWidth: true + + Text { + text: qsTr("Shader Speed") + font: Constants.h3Font + color: palette.text + verticalAlignment: Text.AlignVCenter + Layout.preferredHeight: 36 + } + + Slider + { + id: speedSlider + Layout.preferredHeight: 36 + Layout.fillWidth: true + from: -4.0 + to: 4.0 + stepSize: 0.01 + onValueChanged: shaderSpeedField.text = String(value.toFixed(2)); + + Component.onCompleted: () => { + value = manager.shaderSpeed + } + } + + TextField + { + id: shaderSpeedField + inputMethodHints: Qt.ImhFormattedNumbersOnly + horizontalAlignment: Text.AlignRight + Layout.preferredWidth: 36 * 3 + Layout.preferredHeight: 36 + + onEditingFinished: () => + { + let inputValue = parseFloat(text); + + if (isNaN(inputValue) || inputValue < speedSlider.from) + inputValue = speedSlider.from; + else if (inputValue > speedSlider.to) + inputValue = speedSlider.to; + + text = inputValue.toFixed(2); + speedSlider.value = inputValue; + } + + Keys.onPressed: (event) => + { + if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) + { + shaderSpeedField.focus = false; // Unfocus the TextField + event.accepted = true; // Prevent further propagation of the key event + } + } + + background: Rectangle + { + color: shaderSpeedField.activeFocus ? palette.base : "transparent" + border.color: shaderSpeedField.activeFocus ? palette.highlight : "transparent" + border.width: 1 + radius: 4 + anchors.fill: shaderSpeedField + anchors.margins: -2 + } + } + + } + + Item { Layout.preferredHeight: Constants.largeMargin } + + Text { + text: qsTr("Run Options") + font: Constants.h2Font + color: palette.text + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + RowLayout { + Layout.fillWidth: true + + Text { + text: qsTr("Pause Mode") + font: Constants.h3Font + color: palette.text + verticalAlignment: Text.AlignVCenter + } + + ComboBox + { + Layout.fillWidth: true + Layout.preferredHeight: 36 + + id: pauseModeCombo + + model: [ + qsTr("Maximized or full-screen windows"), + qsTr("Active window is present"), + qsTr("At least one window is shown"), + qsTr("Never") + ] + + textRole: modelData + //onCurrentIndexChanged: root.cfg_pauseMode = currentIndex + currentIndex: manager.pauseMode + } + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + CheckBox + { + id: activeScreenOnlyCheckbox + checked: manager.onlyCheckActiveScreen + text: qsTr("Only check for windows in active screen") + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + RowLayout + { + Layout.fillWidth: true + + Text { + text: qsTr("Excluded Windows") + font: Constants.h3Font + color: palette.text + } + + TextField + { + id: excludeWindows + property var windows: manager.excludedWindows + Layout.fillWidth: true + Layout.preferredHeight: 36 + + text: windows.join(",") + onEditingFinished: () => + { + windows = excludeWindows.text.trim().replace(/\s+/g, "").split(","); + } + + ToolTip.visible: hovered + ToolTip.text: qsTr("A comma-separated list of fully-qualified App-IDs to exclude their windows from triggering pause mode.") + } + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + CheckBox + { + //Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", cfg_isPaused ? "Playing" : "Paused") + + id: runningCombo + checked: manager.running + text: qsTr("Shader Is Running") + } + + Item { Layout.preferredHeight: Constants.largeMargin } + + Text { + text: qsTr("Mouse Tracking") + font: Constants.h2Font + color: palette.text + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + RowLayout + { + Layout.fillWidth: true + + Text { + text: qsTr("Mouse Tracking Bias") + font: Constants.h3Font + color: palette.text + verticalAlignment: Text.AlignVCenter + Layout.preferredHeight: 36 + } + //Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Mouse bias:") + Slider + { + id: mouseBiasSlider + Layout.preferredHeight: 36 + Layout.fillWidth: true + from: 0.0 + to: 4.0 + stepSize: 0.01 + value: manager.mouseTrackingBias + onValueChanged: () => + { + mouseBiasField.text = String(value.toFixed(2)); + } + } + TextField + { + id: mouseBiasField + text: manager.mouseTrackingBias + inputMethodHints: Qt.ImhFormattedNumbersOnly + horizontalAlignment: Text.AlignRight + Layout.preferredWidth: 36 * 3 + Layout.preferredHeight: 36 + onEditingFinished: () => + { + let inputValue = parseFloat(text); + + if (isNaN(inputValue) || inputValue < mouseBiasSlider.from) + inputValue = mouseBiasSlider.from; + else if (inputValue > mouseBiasSlider.to) + inputValue = mouseBiasSlider.to; + + text = inputValue.toFixed(2); + mouseBiasSlider.value = inputValue; + } + Keys.onPressed: (event) => + { + if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) + { + mouseBiasField.focus = false; // Unfocus the TextField + event.accepted = true; // Prevent further propagation of the key event + } + } + background: Rectangle + { + color: mouseBiasField.activeFocus ? palette.base : "transparent" + border.color: mouseBiasField.activeFocus ? palette.highlight : "transparent" + border.width: 1 + radius: 4 + anchors.fill: mouseBiasField + anchors.margins: -2 + } + } + } + + Item { Layout.preferredHeight: Constants.smallMargin } + + CheckBox + { + //Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", cfg_isPaused ? "Playing" : "Paused") + + id: mouseTrackingCheckbox + checked: manager.mouseTrackingEnabled + text: qsTr("Mouse Tracking Enabled") + } + + // Button + // { + // visible: navBar.currentIndex === 2 + // id: kofiButton + // Layout.preferredWidth: Kirigami.Units.gridUnit * 5 + // Layout.preferredHeight: Kirigami.Units.gridUnit * 3 + + // contentItem: RowLayout + // { + // AnimatedImage + // { + // source: "icons/kofi.gif" + // sourceSize.width: 36 + // sourceSize.height: 36 + // fillMode: Image.Pad + // horizontalAlignment: Image.AlignLeft + // transform: Translate + // { + // x: 8 + // } + // } + // Text + // { + // text: i18nd("@button:kofi", "Kofi") + // horizontalAlignment: Text.AlignHCenter + // color: palette.text + // transform: Translate + // { + // x: -8 + // } + // } + // } + // onClicked: () => + // { + // Qt.openUrlExternally("https://ko-fi.com/digitalartifex"); + // } + // } + + Item { Layout.preferredHeight: Constants.smallMargin } + + RowLayout + { + //Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Author:") + Text + { + Layout.preferredWidth: Kirigami.Units.gridUnit * 11 + text: shaderPackModel.metadata.author + horizontalAlignment: Text.AlignLeft + color: palette.text + } + } + + RowLayout + { + //Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Description:") + Text + { + Layout.preferredWidth: Kirigami.Units.gridUnit * 16 + text: shaderPackModel.metadata.description + horizontalAlignment: Text.AlignLeft + color: palette.text + wrapMode: Text.WordWrap + maximumLineCount: 2 + elide: Text.ElideRight + } + } + + RowLayout + { + //Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "License:") + Text + { + Layout.preferredWidth: Kirigami.Units.gridUnit * 11 + text: shaderPackModel.metadata.license + horizontalAlignment: Text.AlignLeft + color: palette.text + } + } + + RowLayout + { + //Kirigami.FormData.label: i18nd("com.github.digitalartifex.komplex", "Version:") + Text + { + Layout.preferredWidth: Kirigami.Units.gridUnit * 11 + text: shaderPackModel.metadata.version + horizontalAlignment: Text.AlignLeft + color: palette.text + } + } + } + } + } +} diff --git a/KomplexHubModule/CMakeLists.txt b/KomplexHubModule/CMakeLists.txt new file mode 100644 index 0000000..89d84d1 --- /dev/null +++ b/KomplexHubModule/CMakeLists.txt @@ -0,0 +1,22 @@ +### This file is automatically generated by Qt Design Studio. +### Do not change + +set_source_files_properties(Constants.qml + PROPERTIES + QT_QML_SINGLETON_TYPE true +) + +qt_add_library(KomplexHubModule STATIC) +qt6_add_qml_module(KomplexHubModule + URI "KomplexHub" + VERSION 1.0 + RESOURCE_PREFIX "/qt/qml" + QML_FILES + "Constants.qml" + "EventListModel.qml" + "EventListSimulator.qml" + "WallpaperModelData.qml" +) + +add_subdirectory("Controls") +add_subdirectory("Kero") diff --git a/KomplexHubModule/Constants.qml b/KomplexHubModule/Constants.qml new file mode 100644 index 0000000..ab25c90 --- /dev/null +++ b/KomplexHubModule/Constants.qml @@ -0,0 +1,69 @@ +pragma Singleton +import QtQuick +import QtQuick.Studio.Application + +QtObject { + readonly property int width: 1920 + readonly property int height: 1080 + + property string relativeFontDirectory: "fonts" + + readonly property font largeFont: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 1.6, + }) + readonly property font mediumFont: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 1.3 + }) + readonly property font font: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize + }) + readonly property font smallFont: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 0.8 + }) + readonly property font h1Font: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 1.8, + bold: true + }) + readonly property font h2Font: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 1.6, + bold: true + }) + readonly property font h3Font: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 1.4, + bold: true + }) + readonly property font h4Font: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 1.3, + bold: true + }) + readonly property font h5Font: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 1, + bold: true + }) + readonly property font h6Font: Qt.font({ + family: Qt.application.font.family, + pixelSize: Qt.application.font.pixelSize * 0.8, + bold: true + }) + + readonly property int largeMargin: 12 + readonly property int mediumMargin: 6 + readonly property int smallMargin: 3 + + readonly property int slowAnimationDuration: 750 + readonly property int normalAnimationDuration: 250 + readonly property int fastAnimationDuration: 125 + + property StudioApplication application: StudioApplication { + fontPath: Qt.resolvedUrl("../KomplexHubContent/" + relativeFontDirectory) + } +} diff --git a/KomplexHubModule/Controls/CMakeLists.txt b/KomplexHubModule/Controls/CMakeLists.txt new file mode 100644 index 0000000..951c286 --- /dev/null +++ b/KomplexHubModule/Controls/CMakeLists.txt @@ -0,0 +1,18 @@ +### This file is automatically generated by Qt Design Studio. +### Do not change + +qt_add_library(KomplexHubModule_Controls STATIC) +qt6_add_qml_module(KomplexHubModule_Controls + URI "KomplexHub.Controls" + VERSION 1.0 + RESOURCE_PREFIX "/qt/qml" + QML_FILES + "LineEdit.qml" + "MenuButton.qml" + "SearchBar.qml" + "SquareButton.qml" + "Throbber.qml" + "SearchResultItem.qml" + "SearchResultList.qml" +) + diff --git a/KomplexHubModule/Controls/LineEdit.qml b/KomplexHubModule/Controls/LineEdit.qml new file mode 100644 index 0000000..99cd9b3 --- /dev/null +++ b/KomplexHubModule/Controls/LineEdit.qml @@ -0,0 +1,119 @@ +/* + * QML LineEdit Control + * Copyright (C) 2026 @DigitalArtifex | github.com/DigitalArtifex | digitalartifex.dev + * + * This control provides a wrapped TextInput that looks and acts more like the + * LineEdit control from QtWidgets + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + + /* Grouped Settings */ + component BorderSettings: QtObject { + property color color: palette.alternateBase.lighter() + property int width: 1 + property bool pixelAligned: true + } + + component Corners: QtObject { + property int bottom: 0 + property int left: 0 + property int right: 0 + property int top: 0 + } + + component Radius: QtObject { + property int topLeft: 0 + property int topRight: 0 + property int bottomLeft: 0 + property int bottomRight: 0 + } + /* End Grouped Settings */ + + property var background: palette.alternateBase.darker() + property BorderSettings border: BorderSettings {} + + property Corners margins: Corners {bottom: 3; top: 3; left: 3; right: 3} + property Radius radius: Radius {} + property font font + property color color: palette.text + property Corners padding: Corners {bottom: 6; top: 6; left: 6; right: 6} + property alias text: lineEditInput.text + + signal accepted + signal editingFinished + + id: lineEditRoot + + ColumnLayout { + anchors.fill: parent + + Rectangle { + id: lineEditBackground + + border.color: lineEditRoot.border.color + border.width: lineEditRoot.border.width + border.pixelAligned: lineEditRoot.border.pixelAligned + + color: lineEditRoot.background + + Layout.fillHeight: true + Layout.fillWidth: true + + Layout.topMargin: lineEditRoot.margins.top + Layout.bottomMargin: lineEditRoot.margins.bottom + Layout.leftMargin: lineEditRoot.margins.left + Layout.rightMargin: lineEditRoot.margins.right + + bottomLeftRadius: lineEditRoot.radius.bottomLeft + bottomRightRadius: lineEditRoot.radius.bottomRight + topLeftRadius: lineEditRoot.radius.topLeft + topRightRadius: lineEditRoot.radius.topRight + + TextInput { + id: lineEditInput + anchors.fill: parent + color: lineEditRoot.color + font: lineEditRoot.font + + anchors.leftMargin: lineEditRoot.padding.left + anchors.topMargin: lineEditRoot.padding.top + anchors.bottomMargin: lineEditRoot.padding.bottom + anchors.rightMargin: lineEditRoot.padding.right + + onAccepted: () => lineEditRoot.accepted() + onTextChanged: () => lineEditRoot.text = lineEditInput.text + onEditingFinished: () => lineEditRoot.editingFinished() + } + + states: [ + State { + name: "focused" + when: lineEditInput.focus + PropertyChanges { + target: lineEditBackground + border.color: palette.accent + } + } + + ] + } + } +} diff --git a/KomplexHubModule/Controls/MenuButton.qml b/KomplexHubModule/Controls/MenuButton.qml new file mode 100644 index 0000000..eedf899 --- /dev/null +++ b/KomplexHubModule/Controls/MenuButton.qml @@ -0,0 +1,134 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + id: menuButtonRoot + property string text: "Button Text" + property IconSettings icon: IconSettings {} + property var page: null + property bool selected: false + + signal triggered + + component IconSettings: QtObject { + property int width: 16 + property int height: 16 + property string url: "" + } + + Rectangle { + id: menuButtonBackground + + anchors.fill: parent + color: "transparent" + + ColumnLayout { + spacing: 0 + anchors.fill: parent + layoutDirection: Qt.LeftToRight + + Image { + id: menuButtonIcon + source: icon.url + + Layout.preferredWidth: icon.height + Layout.preferredHeight: icon.width + Layout.topMargin: Constants.mediumMargin + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + } + + Text { + color: palette.text + text: menuButtonRoot.text + + elide: Text.ElideMiddle + horizontalAlignment: Qt.AlignHCenter + font.pixelSize: 12 + + Layout.fillWidth: true + Layout.topMargin: Constants.mediumMargin + Layout.bottomMargin: Constants.mediumMargin + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + } + } + + Behavior on color { + ColorAnimation { duration: Constants.fastAnimationDuration } + } + } + + MouseArea { + property string lastState + id: mouseArea + + anchors.fill: parent + hoverEnabled: true + + onEntered: () => { + menuButtonRoot.state = "hovered" + } + + onExited: () => { + lastState = "" + + if(selected) + menuButtonRoot.state = "selected" + else + menuButtonRoot.state = "" + } + + onPressed: () => { + lastState = menuButtonRoot.state + menuButtonRoot.state = "clicked" + } + + onReleased: () => { + if(!mouseArea.containsMouse) + return; + + if(!selected) + selected = true + } + } + + onSelectedChanged: () => { + if(selected) { + triggered() + state = "selected" + } + else { + state = "" + } + } + + states: [ + State { + name: "selected" + + PropertyChanges { + target: menuButtonBackground + color: palette.accent.darker(1.5) + } + }, + State { + name: "hovered" + //when: mouseArea.containsMouse + + PropertyChanges { + target: menuButtonBackground + color: palette.button + } + }, + State { + name: "clicked" + //when: mouseArea.containsPress + + PropertyChanges { + target: menuButtonBackground + color: palette.button.darker(1.5) + } + } + ] +} diff --git a/KomplexHubModule/Controls/SearchBar.qml b/KomplexHubModule/Controls/SearchBar.qml new file mode 100644 index 0000000..6ed8a20 --- /dev/null +++ b/KomplexHubModule/Controls/SearchBar.qml @@ -0,0 +1,68 @@ +/* +This is a UI file (.ui.qml) that is intended to be edited in Qt Design Studio only. +It is supposed to be strictly declarative and only uses a subset of QML. If you edit +this file manually, you might introduce QML code that is not supported by Qt Design Studio. +Check out https://doc.qt.io/qtcreator/creator-quick-ui-forms.html for details on .ui.qml files. +*/ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string searchTerm: "" + property string icon: "" + property color color: "transparent" + + id: searchBarRootItem + clip: true + + Rectangle { + color: searchBarRootItem.color + anchors.fill: parent + + RowLayout { + id: searchContainerLayout + anchors.fill: parent + + LineEdit { + id: searchEdit + Layout.fillHeight: true + Layout.fillWidth: true + Layout.leftMargin: Constants.mediumMargin + Layout.rightMargin: Constants.mediumMargin + Layout.topMargin: Constants.smallMargin + Layout.bottomMargin: Constants.smallMargin + padding.top: 12 + + font.pixelSize: 12 + + onAccepted: () => searchBarRootItem.searchTerm = text + } + + SquareButton { + id: searchButton + + Layout.fillHeight: searchEdit.height + Layout.preferredWidth: searchEdit.height + Layout.rightMargin: Constants.mediumMargin + Layout.topMargin: Constants.mediumMargin + Layout.bottomMargin: Constants.mediumMargin + + icon.source: searchBarRootItem.icon + icon.width: 16 + icon.height: 16 + } + } + } + + states: [ + State { + name: "hidden" + PropertyChanges { + target: searchBarRootItem + visible: false + } + } + ] +} diff --git a/KomplexHubModule/Controls/SearchResultItem.qml b/KomplexHubModule/Controls/SearchResultItem.qml new file mode 100644 index 0000000..d3065b0 --- /dev/null +++ b/KomplexHubModule/Controls/SearchResultItem.qml @@ -0,0 +1,151 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + property string author: "Author" + property string description: "This is a description of the search result item" + property string title: "Wallpaper Title" + property string thumbnail: "" + property string url: "" + property string uuid: "" + property bool selected: false + + signal triggered + + id: searchResultItemRoot + width: 256 + height: 256 + clip: true + + Rectangle { + id: searchResultItemContainer + anchors.fill: parent + + border.color: palette.alternateBase.lighter(1.75) + + color: palette.alternateBase.lighter(1.25) + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.preferredWidth: 250 + Layout.preferredHeight: 141 + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + Layout.topMargin: 3 + + border.color: palette.alternateBase.lighter(1.75) + + color: palette.base.lighter(1.25) + } + + Text { + color: palette.text + text: searchResultItemRoot.title + + font.pixelSize: 16 + font.bold: true + elide: Text.ElideRight + + Layout.preferredWidth: 246 + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + } + + Text { + color: palette.text + font.pixelSize: 12 + text: "By: " + searchResultItemRoot.author + leftPadding: 12 + + Layout.alignment: Qt.AlignLeft | Qt.AlignBottom + Layout.preferredWidth: 250 + } + + Text { + color: palette.text + font.pixelSize: 12 + text: searchResultItemRoot.description + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.preferredWidth: 236 + Layout.bottomMargin: 3 + } + } + + Behavior on color { + ColorAnimation { duration: 200 } + } + } + + MouseArea { + property string lastState + id: mouseArea + + anchors.fill: parent + hoverEnabled: true + + onEntered: () => { + if(!selected) + searchResultItemRoot.state = "hovered" + } + + onExited: () => { + lastState = "" + + if(selected) + searchResultItemRoot.state = "selected" + else + searchResultItemRoot.state = "" + } + + onPressed: () => { + if(!selected) { + lastState = searchResultItemRoot.state + searchResultItemRoot.state = "clicked" + } + } + + onReleased: () => { + if(!mouseArea.containsMouse) + return; + + selected = !selected + } + } + + onSelectedChanged: () => { + if(selected) { + searchResultItemRoot.triggered() + searchResultItemRoot.state = "selected" + } + else { + searchResultItemRoot.state = "" + } + } + + states: [ + State { + name: "hovered" + + PropertyChanges { + target: searchResultItemContainer + color: palette.alternateBase.lighter(1.5) + border.color: Qt.hsva(palette.accent.hslHue, + palette.accent.hslSaturation, + 0.5, // Set custom lightness + 1.0) + } + }, + State { + name: "selected" + + PropertyChanges { + target: searchResultItemContainer + color: palette.accent + } + } + ] +} diff --git a/KomplexHubModule/Controls/SearchResultList.qml b/KomplexHubModule/Controls/SearchResultList.qml new file mode 100644 index 0000000..dfcc4a4 --- /dev/null +++ b/KomplexHubModule/Controls/SearchResultList.qml @@ -0,0 +1,206 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + readonly property bool searchable: true + property int resultsPerPage: resultsPerRow * resultsPerColumn + property int resultsPerRow: width / (256 + Constants.largeMargin) + property int resultsPerColumn: height / (256 + Constants.largeMargin) + property int totalResults: 7 + property int currentPage: 1 + property color color: "transparent" + + id: searchResultsPageRoot + + Rectangle { + anchors.fill: parent + color: searchResultsPageRoot.color + + ColumnLayout { + anchors.fill: parent + anchors.margins: Constants.largeMargin + + Component { + id: highlight + + Rectangle { + width: view.cellWidth; height: view.cellHeight + color: "lightsteelblue"; + radius: 5 + x: view.currentItem.x + y: view.currentItem.y + Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } } + Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } } + } + } + + //So the idea here is that the real query would request X number of results + // (say 50), but then the cache aggregator will paginate on the cache + // in a way that it would also account for the total number of results for + // the search term + + //this is dummy data for the cache + WallpaperModelData { + property int totalResults: 17 + property string term: "" + + onTermChanged: () => { + //clear() + + //this will be in the plugin + //query(0, 100, term) + } + + id: wallpaperDataCache + + //use the current search term to get the next chunk of data from the server + function extendCache() { + //this will be in the plugin + //query(count, 100, term) + } + } + + ListModel { + property int index: 0 + + id: wallpaperCacheAggregator + + //get the previous page data + function previous() { + searchResultsPageRoot.state = "loading" + index -= searchResultsPageRoot.resultsPerPage + + if(index < 0) + index = 0 + + searchResultsPageRoot.currentPage -= 1 + + if(searchResultsPageRoot.currentPage < 1) + searchResultsPageRoot.currentPage = 1 + + searchResultsPageRoot.state = "" + aggregateCache() + } + + //get the next page data + function next() { + searchResultsPageRoot.state = "loading" + + index += searchResultsPageRoot.resultsPerPage + + if(index >= searchResultsPageRoot.totalResults) + index = searchResultsPageRoot.totalResults - searchResultsPageRoot.resultsPerPage + + searchResultsPageRoot.currentPage += 1 + + if(searchResultsPageRoot.currentPage > Math.ceil(searchResultsPageRoot.totalResults / searchResultsPageRoot.resultsPerPage)) + searchResultsPageRoot.currentPage = Math.ceil(searchResultsPageRoot.totalResults / searchResultsPageRoot.resultsPerPage) + + //download next chunk of data if we're at the end + if(index >= wallpaperDataCache.count) + wallpaperDataCache.extendCache() + + searchResultsPageRoot.state = "" + aggregateCache() + } + + //re-aggregate the current cache + function aggregateCache() { + clear() + + for(var i = 0; i < searchResultsPageRoot.resultsPerPage && (index + i) < wallpaperDataCache.count; i++) + insert(i, wallpaperDataCache.get(index + i)) + } + } + + GridView { + id: resultsView + Layout.fillHeight: true + Layout.fillWidth: true + cellWidth: 256 + Constants.mediumMargin + cellHeight: 256 + Constants.mediumMargin + clip: true + model: wallpaperCacheAggregator + + delegate: Rectangle { + required property string author + required property string description + required property string name + required property string thumbnail + required property string url + required property string uuid + + SearchResultItem { + author: parent.author + description: parent.description + title: parent.name + thumbnail: parent.thumbnail + url: parent.url + uuid: parent.uuid + } + } + } + + RowLayout { + Layout.fillWidth: true + Layout.fillHeight: false + Layout.preferredHeight: 36 + Layout.margins: Constants.largeMargin + + SquareButton { + Layout.fillHeight: true + Layout.preferredWidth: 160 + + icon.source: "qrc:/images/icons/icons8-back.svg" + icon.height: 16 + icon.width: 16 + text: qsTr("Previous") + + enabled: searchResultsPageRoot.currentPage > 1 + + onTriggered: () => { + wallpaperCacheAggregator.previous() + } + } + + Item { + Layout.fillWidth: true + } + + SquareButton { + Layout.fillHeight: true + Layout.preferredWidth: 160 + + icon.source: "qrc:/images/icons/icons8-next.svg" + icon.height: 16 + icon.width: 16 + text: qsTr("Next") + + enabled: searchResultsPageRoot.currentPage < Math.ceil(searchResultsPageRoot.totalResults / searchResultsPageRoot.resultsPerPage) + + onTriggered: () => { + wallpaperCacheAggregator.next() + } + } + } + } + } + + states: [ + State { + name: "loading" + }, + State { + name: "empty" + }, + State { + name: "error" + } + ] + + onResultsPerPageChanged: () => wallpaperCacheAggregator.aggregateCache(); + Component.onCompleted: () => wallpaperCacheAggregator.aggregateCache() + +} diff --git a/KomplexHubModule/Controls/SquareButton.qml b/KomplexHubModule/Controls/SquareButton.qml new file mode 100644 index 0000000..f82c1ef --- /dev/null +++ b/KomplexHubModule/Controls/SquareButton.qml @@ -0,0 +1,222 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + property string text: qsTr("") + property IconSettings icon: IconSettings {} + property alias spacing: squareButtonLayout.spacing + property int margins: 4 + property bool checkable: false + property bool checked: false + property color color: palette.button + property Gradient gradient: defaultGradient + property BorderSettings border: BorderSettings {} + + signal triggered + + height: 36 + width: 180 + + id: squareButtonRoot + + //icon properties. access them after Component.onLoad() + component IconSettings: QtObject { + property int width: 16 + property int height: 16 + property string source: "images/icons/icons8-next.svg" + } + + component BorderSettings: QtObject { + } + + Gradient { + id: clickedGradient + GradientStop { position: 0.0; color: palette.button.darker(1.25) } + GradientStop { position: 1.0; color: palette.button } + } + + Gradient { + id: defaultGradient + GradientStop { position: 0.0; color: palette.button.lighter(1.25) } + GradientStop { position: 1.0; color: palette.button } + } + + Gradient { + id: hoveredGradient + GradientStop { position: 0.0; color: palette.button.lighter(1.5) } + GradientStop { position: 1.0; color: palette.button.lighter(1.25) } + } + + Rectangle { + id: squareButtonBackground + anchors.fill: parent + gradient: squareButtonRoot.gradient + border.color: palette.button.lighter() + + RowLayout { + id: squareButtonLayout + + anchors.fill: parent + + Rectangle { + Layout.preferredHeight: squareButtonRoot.height < squareButtonRoot.width ? squareButtonRoot.height : squareButtonRoot.width + Layout.preferredWidth: squareButtonRoot.height < squareButtonRoot.width ? squareButtonRoot.height : squareButtonRoot.width + + id: iconContainer + + color: "transparent" + + ColumnLayout { + anchors.fill: parent + + Image { + id: squareButtonIcon + + Layout.preferredWidth: icon.width + Layout.preferredHeight: icon.height + Layout.maximumHeight: icon.height + Layout.maximumWidth: icon.width + + source: icon.source + fillMode: Image.PreserveAspectFit + Layout.alignment: Qt.AlignCenter + } + } + } + + Text { + id: squareButtonText + color: palette.text + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideMiddle + text: squareButtonRoot.text + + font.pixelSize: 14 + + visible: text.length > 0 + + Layout.fillHeight: true + Layout.fillWidth: true + Layout.leftMargin: iconContainer.width * -1 + } + } + + Behavior on color { + ColorAnimation { duration: 250 } + } + + // Behavior on gradient { + // PropertyAnimation { duration: 250 } + // } + } + + MouseArea { + property string lastState + id: mouseArea + + anchors.fill: parent + hoverEnabled: true + + onEntered: () => { + squareButtonRoot.state = "hovered" + } + + onExited: () => { + lastState = "" + + if(checked) + squareButtonRoot.state = "checked" + else + squareButtonRoot.state = "" + } + + onPressed: () => { + lastState = squareButtonRoot.state + squareButtonRoot.state = "clicked" + } + + onReleased: () => { + if(!mouseArea.containsMouse) + return; + + squareButtonRoot.state = lastState + + if(checkable) + checked = !checked + + triggered() + } + } + + onCheckedChanged: () => { + if(checked) { + squareButtonRoot.triggered() + squareButtonRoot.state = "checked" + } + else { + squareButtonRoot.state = "" + } + } + + states:[ + State { + name: "hovered" + PropertyChanges { + target: squareButtonBackground + border.color: palette.accent + gradient: hoveredGradient + } + + PropertyChanges { + target: squareButtonText + color: palette.text + } + }, + + State { + name: "clicked" + PropertyChanges { + target: squareButtonBackground + border.color: palette.accent.darker(1.5) + gradient: clickedGradient + } + + PropertyChanges { + target: squareButtonText + color: palette.text + } + }, + + State { + name: "checked" + PropertyChanges { + target: squareButtonBackground + border.color: palette.accent.darker(1.5) + gradient: clickedGradient + } + + PropertyChanges { + target: squareButtonText + color: palette.text + } + }, + + State { + name: "disabled" + PropertyChanges { + target: squareButtonBackground + color: palette.button.darker() + gradient: null + } + + PropertyChanges { + target: squareButtonText + color: palette.text.darker() + } + } + + ] + +} diff --git a/KomplexHubModule/Controls/Throbber.qml b/KomplexHubModule/Controls/Throbber.qml new file mode 100644 index 0000000..7973eab --- /dev/null +++ b/KomplexHubModule/Controls/Throbber.qml @@ -0,0 +1,126 @@ +import QtQuick +import QtQuick.Shapes +import QtQuick.Effects + +Item { + id: throbberRoot + + Rectangle { + anchors.fill: parent + color: "transparent" + + Item + { + id: outerRing + anchors.fill: parent + + Shape + { + anchors.fill: parent + asynchronous: true + + ShapePath + { + property double progress: 0 + property int dashSpaceLength: 15 + property int dashLength: 1 + + id: outerRingPath + strokeColor: palette.accent.darker(1 + (progress - 0.25)) + fillColor: "transparent" + strokeWidth: 3 + strokeStyle: ShapePath.DashLine + + startX: 0 + startY: outerRing.height * 0.5 + + dashPattern: [ + dashSpaceLength - (dashSpaceLength * progress), + dashSpaceLength * progress + ] + + PathArc + { + x: outerRing.width + y: outerRing.height * 0.5 + + radiusX: outerRing.width / 2 + radiusY: outerRing.height / 2 + + useLargeArc: false + } + + PathArc + { + x: 0 + y: outerRing.height * 0.5 + + radiusX: outerRing.width / 2 + radiusY: outerRing.height / 2 + + useLargeArc: false + } + } + } + + transform: Rotation { + id: outerRingRotation + origin.x: outerRing.width / 2 + origin.y: outerRing.height / 2 + } + + NumberAnimation { + property bool reverse: false + + target: outerRingPath + property: "progress" + duration: 1600 + //easing.type: Easing.InOutQuad + + from: 0 + to: 1 + loops: 1 + running: true + + onFinished: () => { + if(reverse) + { + from = 0 + to = 1 + start() + } + else + { + from = 1 + to = 0 + start() + } + + reverse = !reverse + } + } + + NumberAnimation { + target: outerRingRotation + property: "angle" + duration: 16000 + easing.type: Easing.InOutQuad + + from: 0 + to: (360 * 4) + loops: NumberAnimation.Infinite + running: true + } + } + + MultiEffect { + source: outerRing + anchors.fill: outerRing + brightness: 0.4 + saturation: 0.2 + blurEnabled: true + blurMax: 64 + blur: 1.0 + } + } +} diff --git a/KomplexHubModule/Controls/qmldir b/KomplexHubModule/Controls/qmldir new file mode 100644 index 0000000..bb426f3 --- /dev/null +++ b/KomplexHubModule/Controls/qmldir @@ -0,0 +1,8 @@ +module KomplexHub.Controls +LineEdit 1.0 LineEdit.qml +MenuButton 1.0 MenuButton.qml +SquareButton 1.0 SquareButton.qml +SearchResultItem 1.0 SearchResultItem.qml +SearchResultList 1.0 SearchResultList.qml +SearchBar 1.0 SearchBar.qml +Throbber 1.0 Throbber.qml diff --git a/KomplexHubModule/EventListModel.qml b/KomplexHubModule/EventListModel.qml new file mode 100644 index 0000000..00c7065 --- /dev/null +++ b/KomplexHubModule/EventListModel.qml @@ -0,0 +1,12 @@ +import QtQuick + +ListModel { + id: eventListModel + + ListElement { + eventId: "enterPressed" + eventDescription: "Emitted when pressing the enter button" + shortcut: "Return" + parameters: "Enter" + } +} diff --git a/KomplexHubModule/EventListSimulator.qml b/KomplexHubModule/EventListSimulator.qml new file mode 100644 index 0000000..d26ae6d --- /dev/null +++ b/KomplexHubModule/EventListSimulator.qml @@ -0,0 +1,22 @@ +import QtQuick +import QtQuick.Studio.EventSimulator +import QtQuick.Studio.EventSystem + +QtObject { + id: simulator + property bool active: true + + property Timer __timer: Timer { + id: timer + interval: 100 + onTriggered: { + EventSimulator.show() + } + } + + Component.onCompleted: { + EventSystem.init(Qt.resolvedUrl("EventListModel.qml")) + if (simulator.active) + timer.start() + } +} diff --git a/KomplexHubModule/Kero/CMakeLists.txt b/KomplexHubModule/Kero/CMakeLists.txt new file mode 100644 index 0000000..76c0489 --- /dev/null +++ b/KomplexHubModule/Kero/CMakeLists.txt @@ -0,0 +1,14 @@ +qt_add_library(KomplexHubModule_Kero STATIC) +qt6_add_qml_module(KomplexHubModule_Kero + URI "KomplexHub.Kero" + VERSION 1.0 + RESOURCE_PREFIX "/qt/qml" + QML_FILES + "KeroBuildingAnimation.qml" + "KeroChoiceAvatar.qml" + "KeroErrorAvatar.qml" + "KeroHelloAvatar.qml" + "KeroLoadingAnimation.qml" + "KeroNoResultsAvatar.qml" + "KeroWarningAvatar.qml" +) \ No newline at end of file diff --git a/KomplexHubModule/Kero/KeroBuildingAnimation.qml b/KomplexHubModule/Kero/KeroBuildingAnimation.qml new file mode 100644 index 0000000..d5c7761 --- /dev/null +++ b/KomplexHubModule/Kero/KeroBuildingAnimation.qml @@ -0,0 +1,82 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string title: qsTr("Loading") + property string description: qsTr("Kero is busy looking for wallpapers..we promise") + property color color: palette.window + + id: keroLoadingOverlayRoot + + Rectangle { + anchors.fill: parent + color: keroLoadingOverlayRoot.color + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 64 + Layout.minimumHeight: 64 + Layout.maximumWidth: 512 + Layout.maximumHeight: 512 + Layout.alignment: Qt.AlignCenter + + color: "transparent" + + Image { + id: keroLoadingImage + anchors.fill: parent + + source: "qrc:/images/kero/kero_build_1.png" + antialiasing: true + fillMode: Image.PreserveAspectFit + + Timer { + property int frame: 1 + id: animationTimer + interval: 175 + running: parent.visible + repeat: true + + onTriggered: () => { + frame += 1; + + if(frame >= 4) + frame = 1 + + keroLoadingImage.source = "qrc:/images/kero/kero_build_" + frame + ".png" + } + } + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Text { + color: palette.text + text: keroLoadingOverlayRoot.title + font: Constants.h1Font + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + } + + Text { + id: errorText + text: keroLoadingOverlayRoot.description + color: palette.text.darker() + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + } + } + } + } + } +} diff --git a/KomplexHubModule/Kero/KeroChoiceAvatar.qml b/KomplexHubModule/Kero/KeroChoiceAvatar.qml new file mode 100644 index 0000000..c3839a3 --- /dev/null +++ b/KomplexHubModule/Kero/KeroChoiceAvatar.qml @@ -0,0 +1,65 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string title: qsTr("Please make a choice") + property string description: qsTr("") + property color color: palette.window + + id: keroWarningAvatarRoot + + Rectangle { + id: keroWarningAvatarBackground + anchors.fill: parent + color: keroWarningAvatarRoot.color + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 64 + Layout.minimumHeight: 64 + Layout.maximumWidth: 512 + Layout.maximumHeight: 512 + Layout.alignment: Qt.AlignCenter + + color: "transparent" + + Image { + anchors.fill: parent + + source: "qrc:/images/kero/kero_choice.png" + antialiasing: true + fillMode: Image.PreserveAspectFit + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Text { + color: palette.text + text: keroWarningAvatarRoot.title + font.pixelSize: Constants.largeFont.pixelSize * 1.5 + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + } + + Text { + id: errorText + text: keroWarningAvatarRoot.description + color: palette.text.darker() + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + } + } + } + } + } +} diff --git a/KomplexHubModule/Kero/KeroErrorAvatar.qml b/KomplexHubModule/Kero/KeroErrorAvatar.qml new file mode 100644 index 0000000..4cd57db --- /dev/null +++ b/KomplexHubModule/Kero/KeroErrorAvatar.qml @@ -0,0 +1,66 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string title: qsTr("Error") + property string description: qsTr("A description of the error") + property color color: palette.window + + id: errorOverlayRoot + + Rectangle { + id: errorOverlayBackground + anchors.fill: parent + color: errorOverlayRoot.color + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 64 + Layout.minimumHeight: 64 + Layout.maximumWidth: 512 + Layout.maximumHeight: 512 + Layout.alignment: Qt.AlignCenter + + color: "transparent" + + + Image { + + anchors.fill: parent + + source: "qrc:/images/kero/kero_error.png" + antialiasing: true + fillMode: Image.PreserveAspectFit + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Text { + color: palette.text + text: errorOverlayRoot.title + font: Constants.h1Font + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + } + Text { + id: errorText + text: errorOverlayRoot.description + color: palette.text.darker() + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + } + } + } + } + } +} diff --git a/KomplexHubModule/Kero/KeroHelloAvatar.qml b/KomplexHubModule/Kero/KeroHelloAvatar.qml new file mode 100644 index 0000000..320a940 --- /dev/null +++ b/KomplexHubModule/Kero/KeroHelloAvatar.qml @@ -0,0 +1,65 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string title: qsTr("Hello!") + property string description: qsTr("") + property color color: "transparent" + + id: keroHelloAvatarRoot + + Rectangle { + id: keroHelloAvatarBackground + anchors.fill: parent + color: keroHelloAvatarRoot.color + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 64 + Layout.minimumHeight: 64 + Layout.maximumWidth: 512 + Layout.maximumHeight: 512 + Layout.alignment: Qt.AlignCenter + + color: "transparent" + + Image { + anchors.fill: parent + + source: "qrc:/images/kero/kero_hello.png" + antialiasing: true + fillMode: Image.PreserveAspectFit + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Text { + color: palette.text + text: keroHelloAvatarRoot.title + font: Constants.h1Font + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + } + + Text { + id: errorText + text: keroHelloAvatarRoot.description + color: palette.text.darker() + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + } + } + } + } + } +} diff --git a/KomplexHubModule/Kero/KeroLoadingAnimation.qml b/KomplexHubModule/Kero/KeroLoadingAnimation.qml new file mode 100644 index 0000000..8d0aae0 --- /dev/null +++ b/KomplexHubModule/Kero/KeroLoadingAnimation.qml @@ -0,0 +1,82 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string title: qsTr("Loading") + property string description: qsTr("Kero is busy looking for wallpapers..we promise") + property color color: palette.window + + id: keroLoadingOverlayRoot + + Rectangle { + anchors.fill: parent + color: keroLoadingOverlayRoot.color + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 64 + Layout.minimumHeight: 64 + Layout.maximumWidth: 512 + Layout.maximumHeight: 512 + Layout.alignment: Qt.AlignCenter + + color: "transparent" + + Image { + id: keroLoadingImage + anchors.fill: parent + + source: "qrc:/images/kero/kero_run_1.png" + antialiasing: true + fillMode: Image.PreserveAspectFit + + Timer { + property int frame: 1 + id: animationTimer + interval: 175 + running: parent.visible + repeat: true + + onTriggered: () => { + frame += 1; + + if(frame >= 4) + frame = 1 + + keroLoadingImage.source = "qrc:/images/kero/kero_run_" + frame + ".png" + } + } + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Text { + color: palette.text + text: keroLoadingOverlayRoot.title + font.pixelSize: Constants.largeFont.pixelSize * 1.5 + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + } + + Text { + id: errorText + text: keroLoadingOverlayRoot.description + color: palette.text.darker() + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + } + } + } + } + } +} diff --git a/KomplexHubModule/Kero/KeroNoResultsAvatar.qml b/KomplexHubModule/Kero/KeroNoResultsAvatar.qml new file mode 100644 index 0000000..9e22e2b --- /dev/null +++ b/KomplexHubModule/Kero/KeroNoResultsAvatar.qml @@ -0,0 +1,64 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string title: qsTr("No Results") + property string description: qsTr("Kero couldn't find any wallpapers with that search term") + property color color: palette.window + + id: noResultsOverlayRoot + + Rectangle { + id: noResultsOverlayBackground + anchors.fill: parent + color: noResultsOverlayRoot.color + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 64 + Layout.minimumHeight: 64 + Layout.maximumWidth: 512 + Layout.maximumHeight: 512 + Layout.alignment: Qt.AlignCenter + + color: "transparent" + + Image { + anchors.fill: parent + + source: "qrc:/images/kero/kero_no_results.png" + antialiasing: true + fillMode: Image.PreserveAspectFit + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Text { + color: palette.text + text: noResultsOverlayRoot.title + font.pixelSize: Constants.largeFont.pixelSize * 1.5 + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + } + Text { + id: errorText + text: noResultsOverlayRoot.description + color: palette.text.darker() + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + } + } + } + } + } +} diff --git a/KomplexHubModule/Kero/KeroWarningAvatar.qml b/KomplexHubModule/Kero/KeroWarningAvatar.qml new file mode 100644 index 0000000..38502be --- /dev/null +++ b/KomplexHubModule/Kero/KeroWarningAvatar.qml @@ -0,0 +1,65 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import KomplexHub + +Item { + property string title: qsTr("Warning") + property string description: qsTr("Kero noticed there might be an issue") + property color color: palette.window + + id: keroWarningAvatarRoot + + Rectangle { + id: keroWarningAvatarBackground + anchors.fill: parent + color: keroWarningAvatarRoot.color + + ColumnLayout { + anchors.fill: parent + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 64 + Layout.minimumHeight: 64 + Layout.maximumWidth: 512 + Layout.maximumHeight: 512 + Layout.alignment: Qt.AlignCenter + + color: "transparent" + + Image { + anchors.fill: parent + + source: "qrc:/images/kero/kero_warning.png" + antialiasing: true + fillMode: Image.PreserveAspectFit + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + + Text { + color: palette.text + text: keroWarningAvatarRoot.title + font.pixelSize: Constants.largeFont.pixelSize * 1.5 + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + } + + Text { + id: errorText + text: keroWarningAvatarRoot.description + color: palette.text.darker() + + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.bottomMargin: Constants.largeMargin + } + } + } + } + } +} diff --git a/KomplexHubModule/Kero/qmldir b/KomplexHubModule/Kero/qmldir new file mode 100644 index 0000000..a060933 --- /dev/null +++ b/KomplexHubModule/Kero/qmldir @@ -0,0 +1,8 @@ +module KomplexHub.Kero +KeroBuildingAnimation 1.0 KeroBuildingAnimation.qml +KeroChoiceAvatar 1.0 KeroChoiceAvatar.qml +KeroErrorAvatar 1.0 KeroErrorAvatar.qml +KeroHelloAvatar 1.0 KeroHelloAvatar.qml +KeroLoadingAnimation 1.0 KeroLoadingAnimation.qml +KeroNoResultsAvatar 1.0 KeroNoResultsAvatar.qml +KeroWarningAvatar 1.0 KeroWarningAvatar.qml \ No newline at end of file diff --git a/KomplexHubModule/WallpaperModelData.qml b/KomplexHubModule/WallpaperModelData.qml new file mode 100644 index 0000000..435c388 --- /dev/null +++ b/KomplexHubModule/WallpaperModelData.qml @@ -0,0 +1,67 @@ +import QtQuick +import QtQuick.Controls + +ListModel { + ListElement { + author: "Wizmart" + name: "Some cool name 1" + description: "This is not a real wallpaper or person" + thumbnail: "" + uuid: "{aafd-311-afaa}" + url: "" + } + + ListElement { + author: "Wizmart" + name: "Some cool name 2" + description: "This is not a real wallpaper or person" + thumbnail: "" + uuid: "{aafd-311-afaa}" + url: "" + } + + ListElement { + author: "Wizmart" + name: "Some cool name 3" + description: "This is not a real wallpaper or person" + thumbnail: "" + uuid: "{aafd-311-afaa}" + url: "" + } + + ListElement { + author: "Wizmart" + name: "Some cool name 4" + description: "This is not a real wallpaper or person" + thumbnail: "" + uuid: "{aafd-311-afaa}" + url: "" + } + + ListElement { + author: "Wizmart" + name: "Some cool name 5" + description: "This is not a real wallpaper or person" + thumbnail: "" + uuid: "{aafd-311-afaa}" + url: "" + } + + ListElement { + author: "Wizmart" + name: "Some cool name 6" + description: "This is not a real wallpaper or person" + thumbnail: "" + uuid: "{aafd-311-afaa}" + url: "" + } + + ListElement { + author: "Wizmart" + name: "Some cool name 7" + description: "This is not a real wallpaper or person" + thumbnail: "" + uuid: "{aafd-311-afaa}" + url: "" + } +} diff --git a/KomplexHubModule/designer/plugin.metainfo b/KomplexHubModule/designer/plugin.metainfo new file mode 100644 index 0000000..b8221af --- /dev/null +++ b/KomplexHubModule/designer/plugin.metainfo @@ -0,0 +1,13 @@ +MetaInfo { + Type { + name: "KomplexHub.EventListSimulator" + icon: ":/qtquickplugin/images/item-icon16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + } +} diff --git a/KomplexHubModule/qmldir b/KomplexHubModule/qmldir new file mode 100644 index 0000000..209ec10 --- /dev/null +++ b/KomplexHubModule/qmldir @@ -0,0 +1,7 @@ +module KomplexHub +singleton Constants 1.0 Constants.qml +EventListSimulator 1.0 EventListSimulator.qml +EventListModel 1.0 EventListModel.qml +WallpaperModelData 1.0 WallpaperModelData.qml +Controls 1.0 Controls/ +Kero 1.0 Kero/ diff --git a/KomplexHubPlugin/CMakeLists.txt b/KomplexHubPlugin/CMakeLists.txt new file mode 100644 index 0000000..0cb2168 --- /dev/null +++ b/KomplexHubPlugin/CMakeLists.txt @@ -0,0 +1,24 @@ +add_library( + KomplexHubPlugin + STATIC +) + +qt_add_qml_module( + KomplexHubPlugin + URI + KomplexHubPlugin + VERSION + 1.0 + SOURCES + SettingsManager.h + SettingsManager.cpp + InstalledPackManager.h + InstalledPackManager.cpp + SOURCES WallpaperMetaData.h +) + +target_compile_definitions( + KomplexHubPlugin + PUBLIC + KOMPLEX_PLUGIN +) \ No newline at end of file diff --git a/KomplexHubPlugin/InstalledPackManager.cpp b/KomplexHubPlugin/InstalledPackManager.cpp new file mode 100644 index 0000000..28fe06e --- /dev/null +++ b/KomplexHubPlugin/InstalledPackManager.cpp @@ -0,0 +1,275 @@ +#include "InstalledPackManager.h" + +InstalledPackManager::InstalledPackManager(QObject *parent) + : QAbstractListModel{parent} +{ + m_installDirectoryUri = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); + m_installDirectoryUri += QString("/.local/share/komplex/packs"); + + // load in wallpapers on init + rescan(); +} + +auto InstalledPackManager::rowCount(const QModelIndex &parent) const -> int +{ + Q_UNUSED(parent) + return m_installedWallpapers.size(); +} + +auto InstalledPackManager::data(const QModelIndex &index, int role) const -> QVariant +{ + if(index.row() < 0 || index.row() >= m_installedWallpapers.count()) + { + return QVariant(); + } + + QVariant data; + + switch(static_cast(role)) + { + case UriRole: + data = m_installedWallpapers[index.row()].uri; + break; + case AuthorRole: + data = m_installedWallpapers[index.row()].author; + break; + case DescriptionRole: + data = m_installedWallpapers[index.row()].description; + break; + case NameRole: + data = m_installedWallpapers[index.row()].name; + break; + case ThumbnailRole: + data = m_installedWallpapers[index.row()].thumbnail; + break; + case DateRole: + data = m_installedWallpapers[index.row()].installDate; + break; + } + + return data; +} + +auto InstalledPackManager::index(int row, int column, const QModelIndex &parent) const -> QModelIndex +{ + Q_UNUSED(parent) + return createIndex(row, column, &m_installedWallpapers.at(row)); +} + +auto InstalledPackManager::columnCount(const QModelIndex &parent) const -> int +{ + Q_UNUSED(parent) + return 0; +} + +auto InstalledPackManager::parent(const QModelIndex &index) const -> QModelIndex +{ + Q_UNUSED(index) + return QModelIndex(); +} + +auto InstalledPackManager::setData(const QModelIndex &index, const QVariant &value, int role) -> bool +{ + if(index.row() < 0 || index.row() >= m_installedWallpapers.count()) + { + return false; + } + + switch(static_cast(role)) + { + case UriRole: + m_installedWallpapers[index.row()].uri = value.toString(); + break; + case AuthorRole: + m_installedWallpapers[index.row()].author = value.toString(); + break; + case DescriptionRole: + m_installedWallpapers[index.row()].description = value.toString(); + break; + case NameRole: + m_installedWallpapers[index.row()].name = value.toString(); + break; + case ThumbnailRole: + m_installedWallpapers[index.row()].thumbnail = value.toString(); + break; + case DateRole: + return false; + break; + } + + return true; +} + +auto InstalledPackManager::installedWallpapers() const -> QList +{ + return m_installedWallpapers; +} + +auto InstalledPackManager::resetInstalledWallpapers() -> void +{ + m_installedWallpapers.clear(); + Q_EMIT installedWallpapersChanged(); +} + +auto InstalledPackManager::rescan() -> void +{ + setState(Loading); + m_installedWallpapers.clear(); + + QDir installDirectory(m_installDirectoryUri); + QStringList packLocations = installDirectory.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + + for(const QString &packLocation : std::as_const(packLocations)) + { + QDir packDirectory(installDirectory.absoluteFilePath(packLocation)); + + if(!packDirectory.exists() || !packDirectory.exists(QString("pack.json"))) + { + continue; + } + + QString packFileLocation = packDirectory.absoluteFilePath(QString("pack.json")); + QFile packFile(packFileLocation); + + if(!packFile.open(QFile::ReadOnly)) + { + continue; + } + + QByteArray packFileData = packFile.readAll(); + + packFile.close(); + + QJsonParseError documentError; + QJsonDocument document = QJsonDocument::fromJson(packFileData, &documentError); + + if(documentError.error != QJsonParseError::NoError) + { + continue; + } + + QJsonObject rootObject = document.object(); + + if(!rootObject.contains(QString("author")) || + !rootObject.contains(QString("description")) || + !rootObject.contains(QString("name"))) + { + continue; + } + + QFileInfo packFileInfo(packFile); + + WallpaperMetaData data + { + packDirectory.absoluteFilePath(QString("pack.json")), + rootObject["name"].toString(), + rootObject["author"].toString(), + rootObject["description"].toString(), + QString("file://") + packDirectory.absoluteFilePath(QString("thumbnail.jpg")), + packFileInfo.birthTime() + }; + + m_installedWallpapers.append(data); + } + + Q_EMIT installedWallpapersChanged(); + setState(Idle); +} + +auto InstalledPackManager::uninstall(QString uri) -> bool +{ + QUrl url(uri); + url.setScheme(QString("file")); + + QFileInfo info(url.toLocalFile()); + QDir installDirectory = info.absoluteDir(); + + QFileInfo directoryInfo(installDirectory.absolutePath()); + + if(!directoryInfo.exists()) + { + setErrorString(QString("Install directory does not exist")); + return false; + } + + // could not get QDir::rmdir to rm a symlink dir + if(directoryInfo.isSymbolicLink()) + { + QProcess process; + QString command("unlink \""); + command += url.toLocalFile() + QString("\""); + + process.startCommand(command); + + if(!process.waitForStarted()) + { + setErrorString(QString("Process Failed To Start")); + return false; + } + + if(!process.waitForFinished()) + { + setErrorString(QString("Process Timeout")); + return false; + } + + if(process.exitCode() != 0 || process.exitStatus() != QProcess::NormalExit) + { + setErrorString(process.readAllStandardError()); + return false; + } + + return true; + } + + if(!installDirectory.rmdir(installDirectory.absolutePath())) + { + setErrorString(QString("Install directory could not be removed")); + return false; + } + + return true; +} + +auto InstalledPackManager::state() const -> InstalledPackManager::State +{ + return m_state; +} + +auto InstalledPackManager::setState(State state) -> void +{ + if (m_state == state) + { + return; + } + + m_state = state; + emit stateChanged(); +} + +auto InstalledPackManager::resetState() -> void +{ + setState(Idle); // TODO: Adapt to use your actual default value +} + +auto InstalledPackManager::roleNames() const -> QHash +{ + return m_dataRoles; +} + +auto InstalledPackManager::errorString() const -> QString +{ + return m_errorString; +} + +auto InstalledPackManager::setErrorString(const QString &errorString) -> void +{ + if (m_errorString == errorString) + { + return; + } + + m_errorString = errorString; + emit errorStringChanged(); +} + diff --git a/KomplexHubPlugin/InstalledPackManager.h b/KomplexHubPlugin/InstalledPackManager.h new file mode 100644 index 0000000..2caac55 --- /dev/null +++ b/KomplexHubPlugin/InstalledPackManager.h @@ -0,0 +1,129 @@ +#ifndef INSTALLEDPACKMANAGER_H +#define INSTALLEDPACKMANAGER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "WallpaperMetaData.h" + +class InstalledPackManager : public QAbstractListModel +{ + Q_OBJECT + QML_ELEMENT + +public: + enum State + { + Idle, + Loading, + Error + }; + Q_ENUM(State) + + enum DataRole { + UriRole = Qt::UserRole + 1, + AuthorRole, + DescriptionRole, + NameRole, + ThumbnailRole, + DateRole + }; + Q_ENUM(DataRole) + + explicit InstalledPackManager(QObject *parent = nullptr); + + auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override; + auto data(const QModelIndex &index, int role = Qt::DisplayRole) const -> QVariant override; + + auto index( + int row, + int column, + const QModelIndex &parent = QModelIndex() + ) const -> QModelIndex override; + + auto columnCount( + const QModelIndex &parent = QModelIndex() + ) const -> int override; + + auto parent(const QModelIndex &index) const -> QModelIndex override; + + auto setData( + const QModelIndex &index, + const QVariant &value, + int role = Qt::EditRole + ) -> bool override; + + auto installedWallpapers() const -> QList; + + auto resetInstalledWallpapers() -> void; + Q_INVOKABLE auto rescan() -> void; + Q_INVOKABLE auto uninstall(QString uri) -> bool; + + auto state() const -> State; + auto setState(State state) -> void; + auto resetState() -> void; + auto roleNames() const -> QHash override; + + auto errorString() const -> QString; + auto setErrorString(const QString &errorString) -> void; + +signals: + auto installedWallpapersChanged() -> void; + + auto stateChanged() -> void; + + auto errorStringChanged() -> void; + +private: + static inline const QHash m_dataRoles = + { + { + static_cast(UriRole), + QByteArray("uri") + }, + { + static_cast(AuthorRole), + QByteArray("author") + }, + { + static_cast(DescriptionRole), + QByteArray("description") + }, + { + static_cast(NameRole), + QByteArray("name") + }, + { + static_cast(ThumbnailRole), + QByteArray("thumbnail") + }, + { + static_cast(DateRole), + QByteArray("installDate") + } + }; + State m_state = Idle; + + QString m_errorString = QString(); + + QString m_installDirectoryUri; + QList m_installedWallpapers; + + Q_PROPERTY(QList installedWallpapers READ installedWallpapers RESET resetInstalledWallpapers NOTIFY installedWallpapersChanged FINAL) + Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL) + Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL) +}; +Q_DECLARE_METATYPE(InstalledPackManager) + +#endif // INSTALLEDPACKMANAGER_H diff --git a/KomplexHubPlugin/Komplex_global.h b/KomplexHubPlugin/Komplex_global.h new file mode 100644 index 0000000..86c539e --- /dev/null +++ b/KomplexHubPlugin/Komplex_global.h @@ -0,0 +1,10 @@ +#ifndef KOMPLEX_GLOBAL_H +#define KOMPLEX_GLOBAL_H + +#ifdef KOMPLEX_PLUGIN +#define KOMPLEX_EXPORT Q_DECL_EXPORT +#else +#define KOMPLEX_EXPORT Q_DECL_IMPORT +#endif + +#endif // KOMPLEX_GLOBAL_H \ No newline at end of file diff --git a/KomplexHubPlugin/SettingsManager.cpp b/KomplexHubPlugin/SettingsManager.cpp new file mode 100644 index 0000000..de39812 --- /dev/null +++ b/KomplexHubPlugin/SettingsManager.cpp @@ -0,0 +1,749 @@ +#include "SettingsManager.h" +#include +#include +#include +#include +#include +#include +#include + +SettingsManager::SettingsManager(QObject *parent) : QObject(parent) +{ + m_homeLocation = QStandardPaths::writableLocation(QStandardPaths::HomeLocation).at(0); + + m_shaderPackLocation = m_homeLocation + QString("/.local/share/komplex/packs"); + m_configLocation = m_homeLocation + QString("/.config/plasma-org.kde.plasma.desktop-appletsrc"); + + // load available shader packs + QDir shaderPackDirectory(m_shaderPackLocation); + + if(shaderPackDirectory.exists()) + { + QStringList shaderPackDirectoryList = shaderPackDirectory.entryList( + QDir::Dirs | QDir::NoDotAndDotDot + ); + + for(const QString &shaderPackDirectoryListing : std::as_const(shaderPackDirectoryList)) + { + QDir installedShaderPackDirectory(shaderPackDirectory.absoluteFilePath(shaderPackDirectoryListing)); + + if(!installedShaderPackDirectory.exists("pack.json")) + { + continue; + } + + QString uri = installedShaderPackDirectory.absoluteFilePath(QString("pack.json")); + QString name = packNameFromUri(uri); + + if(name.isNull() || name.isEmpty()) + { + continue; + } + + WallpaperLocationData metadata { + .name = name, + .uri = installedShaderPackDirectory.absoluteFilePath("pack.json") + }; + + m_availableShaderPacksMetadata.append(metadata); + } + } + + m_shaderPackIndex = indexOfShaderPack(); +} + +SettingsManager::~SettingsManager() +{ + +} + +auto SettingsManager::get(const QString &key) -> QString +{ + QProcess process; + QString command("kreadconfig6"); + QString result = QString(); + + command = QString("kreadconfig6 --file "); + command += homeLocation() + QString("/.config/plasma-org.kde.plasma.desktop-appletsrc"); + command += QString(" --group \"Containments\" --group \"25\" --group \"Wallpaper\""); + command += QString(" --group \"com.github.digitalartifex.komplex\" --group \"General\" --key"); + command += QString(" \"") + key + QString("\""); + + process.startCommand(command); + + if(!process.waitForStarted()) + { + Q_EMIT error(QString("Process Failed To Start"), process.errorString()); + } + + if(!process.waitForFinished()) + { + Q_EMIT error(QString("Process Timeout"), process.errorString()); + } + + if(process.exitCode() == 0 && process.exitStatus() == QProcess::NormalExit) + { + result = process.readAllStandardOutput(); + + if(result.endsWith(QString("\n"))) + { + result.removeLast(); + } + } + else + { + QString error(process.readAll()); + Q_EMIT this->error(QString("Read Error"), error); + } + + return result; +} + +auto SettingsManager::set(const QString &key, const QVariant &value) -> bool +{ + // construct the command to kwriteconfig6 + QString command = QString("kwriteconfig6 --file "); + command += homeLocation() + QString("/.config/plasma-org.kde.plasma.desktop-appletsrc"); + command += QString(" --group \"Containments\" --group \"25\" --group \"Wallpaper\""); + command += QString(" --group \"com.github.digitalartifex.komplex\" --group \"General\" --key"); + command += QString(" \"") + key + QString("\" ") + value.toString(); + + // start the process + QProcess process; + process.startCommand(command); + + // throw error if failed to start + if(!process.waitForStarted()) + { + Q_EMIT error(QString("Process Failed To Start"), process.errorString()); + return false; + } + + // throw error if there was a timeout + if(!process.waitForFinished()) + { + Q_EMIT error(QString("Process Timeout"), process.errorString()); + return false; + } + + // throw error if there was an ERRNO or issue running the process + if(process.exitCode() != 0 || process.exitStatus() != QProcess::NormalExit) + { + Q_EMIT this->error(QString("Write Error"), process.readAllStandardError()); + return false; + } + + // success + return true; +} + +auto SettingsManager::shaderPack() -> QString +{ + m_shaderPack = get(QString("shader_package")); + + //update pack name + QString packName = packNameFromUri(m_shaderPack); + setShaderPackName(packName); + + return m_shaderPack; +} + +auto SettingsManager::setShaderPack(const QString &uri) -> void +{ + QString packName = packNameFromUri(uri); + + if(uri != m_shaderPack) + { + if(!set(QString("shader_package"), uri)) + { + return; + } + + m_shaderPack = uri; + Q_EMIT shaderPackChanged(); + } + + setShaderPackName(packName); +} + +auto SettingsManager::shaderPackName() const -> QString +{ + return m_shaderPackName; +} + +auto SettingsManager::availableShaderPacks() -> QStringList +{ + QStringList availableShaderPacks; + + for(const WallpaperLocationData &data : std::as_const(m_availableShaderPacksMetadata)) + { + availableShaderPacks.append(data.name); + } + + return availableShaderPacks; +} + +auto SettingsManager::homeLocation() const -> QString +{ + return m_homeLocation; +} + +auto SettingsManager::configLocation() const -> QString +{ + return m_configLocation; +} + +auto SettingsManager::shaderPackLocation() const -> QString +{ + return m_shaderPackLocation; +} + +auto SettingsManager::shaderPackIndex() const -> qint64 +{ + return m_shaderPackIndex; +} + +auto SettingsManager::setShaderPackIndex(qint64 shaderPackIndex) -> void +{ + if (m_shaderPackIndex == shaderPackIndex) + { + return; + } + + m_shaderPackIndex = shaderPackIndex; + emit shaderPackIndexChanged(); +} + +auto SettingsManager::setShaderPackName(const QString &shaderPackName) -> void +{ + if (m_shaderPackName == shaderPackName) + { + return; + } + + m_shaderPackName = shaderPackName; + emit shaderPackNameChanged(); +} + +auto SettingsManager::resolutionX() -> quint64 +{ + QString value = get(QString("resolution_x")); + + if(value.isNull() || value.isEmpty()) + { + setResolutionX(1920); + } + else + { + quint64 convertedValue = value.toULongLong(); + + if(convertedValue != m_resolutionX) + { + m_resolutionX = convertedValue; + Q_EMIT resolutionXChanged(); + } + } + + return m_resolutionX; +} + +auto SettingsManager::setResolutionX(quint64 resolutionX) -> void +{ + if (m_resolutionX == resolutionX) + { + return; + } + + if(!set(QString("resolution_x"), resolutionX)) + { + return; + } + + m_resolutionX = resolutionX; + emit resolutionXChanged(); +} + +auto SettingsManager::resolutionY() -> quint64 +{ + QString value = get(QString("resolution_y")); + + if(value.isNull() || value.isEmpty()) + { + setResolutionY(1080); + } + else + { + quint64 convertedValue = value.toULongLong(); + + if(convertedValue != m_resolutionY) + { + m_resolutionY = convertedValue; + Q_EMIT resolutionYChanged(); + } + } + + return m_resolutionY; +} + +auto SettingsManager::setResolutionY(quint64 resolutionY) -> void +{ + if (m_resolutionY == resolutionY) + { + return; + } + + if(!set(QString("resolution_y"), resolutionY)) + { + return; + } + + m_resolutionY = resolutionY; + emit resolutionYChanged(); +} + +auto SettingsManager::targetFramerate() -> quint64 +{ + QString value = get(QString("framerate")); + + if(value.isNull() || value.isEmpty()) + { + setTargetFramerate(60); + } + else + { + bool okay = false; + quint64 convertedValue = value.toULongLong(&okay); + + if(!okay) + { + setTargetFramerate(60); + } + + if(convertedValue != m_targetFramerate) + { + m_targetFramerate = convertedValue; + Q_EMIT targetFramerateChanged(); + } + } + + return m_targetFramerate; +} + +auto SettingsManager::setTargetFramerate(quint64 targetFramerate) -> void +{ + if (m_targetFramerate == targetFramerate) + return; + + if(!set(QString("framerate"), targetFramerate)) + return; + + m_targetFramerate = targetFramerate; + emit targetFramerateChanged(); +} + +auto SettingsManager::shaderSpeed() -> qreal +{ + QString value = get(QString("shaderSpeed")); + + if(value.isNull() || value.isEmpty()) + { + setShaderSpeed(1.0); + } + else + { + bool okay = false; + qreal convertedValue = value.toFloat(&okay); + + if(!okay) + setShaderSpeed(1.0); + + if(convertedValue != m_shaderSpeed) + { + m_shaderSpeed = convertedValue; + Q_EMIT shaderSpeedChanged(); + } + } + + return m_shaderSpeed; +} + +auto SettingsManager::setShaderSpeed(qreal shaderSpeed) -> void +{ + if (qFuzzyCompare(m_shaderSpeed, shaderSpeed)) + { + return; + } + + if(!set(QString("shaderSpeed"), shaderSpeed)) + { + return; + } + + m_shaderSpeed = shaderSpeed; + emit shaderSpeedChanged(); +} + +auto SettingsManager::mouseTrackingEnabled() -> bool +{ + QString value = get(QString("mouseAllowed")); + + if(value.isNull() || value.isEmpty()) + { + setTargetFramerate(60); + } + else + { + bool convertedValue = value.trimmed().compare("true", Qt::CaseInsensitive); + + if(convertedValue != m_mouseTrackingEnabled) + { + m_mouseTrackingEnabled = convertedValue; + Q_EMIT targetFramerateChanged(); + } + } + + return m_mouseTrackingEnabled; +} + +auto SettingsManager::setMouseTrackingEnabled(bool mouseTrackingEnabled) -> void +{ + if (m_mouseTrackingEnabled == mouseTrackingEnabled) + { + return; + } + + if(!set(QString("mouseAllowed"), mouseTrackingEnabled ? QString("true") : QString("false"))) + { + return; + } + + m_mouseTrackingEnabled = mouseTrackingEnabled; + emit mouseTrackingEnabledChanged(); +} + +auto SettingsManager::mouseTrackingBias() -> qreal +{ + QString value = get(QString("mouseSpeedBias")); + + if(value.isNull() || value.isEmpty()) + { + setMouseTrackingBias(1.0); + } + else + { + bool okay = false; + qreal convertedValue = value.toFloat(&okay); + + if(!okay) + { + setMouseTrackingBias(1.0); + } + + if(convertedValue != m_mouseTrackingBias) + { + m_mouseTrackingBias = convertedValue; + Q_EMIT mouseTrackingBiasChanged(); + } + } + + return m_mouseTrackingBias; +} + +auto SettingsManager::setMouseTrackingBias(qreal mouseTrackingBias) -> void +{ + if (qFuzzyCompare(m_mouseTrackingBias, mouseTrackingBias)) + { + return; + } + + if(!set(QString("mouseSpeedBias"), mouseTrackingBias)) + { + return; + } + + m_mouseTrackingBias = mouseTrackingBias; + emit mouseTrackingBiasChanged(); +} + +auto SettingsManager::pauseMode() -> quint8 +{ + QString value = get(QString("pauseMode")); + + if(value.isNull() || value.isEmpty()) + { + setPauseMode(1); + } + else + { + bool okay = false; + quint64 convertedValue = value.toULongLong(&okay); + + if(!okay) + { + setPauseMode(60); + } + + if(convertedValue != m_pauseMode) + { + m_pauseMode = convertedValue; + Q_EMIT pauseModeChanged(); + } + } + + return m_pauseMode; +} + +auto SettingsManager::setPauseMode(quint8 pauseMode) -> void +{ + if (m_pauseMode == pauseMode) + { + return; + } + + if(!set(QString("pauseMode"), pauseMode)) + { + return; + } + + m_pauseMode = pauseMode; + emit pauseModeChanged(); +} + +auto SettingsManager::resetPauseMode() -> void +{ + setPauseMode(1); +} + +auto SettingsManager::onlyCheckActiveScreen() -> bool +{ + QString value = get(QString("checkActiveScreen")); + + if(value.isNull() || value.isEmpty()) + { + setOnlyCheckActiveScreen(false); + } + else + { + bool convertedValue = value.trimmed().compare("true", Qt::CaseInsensitive); + + if(convertedValue != m_onlyCheckActiveScreen) + { + m_onlyCheckActiveScreen = convertedValue; + Q_EMIT onlyCheckActiveScreenChanged(); + } + } + + return m_onlyCheckActiveScreen; +} + +auto SettingsManager::setOnlyCheckActiveScreen(bool onlyCheckActiveScreen) -> void +{ + if (m_onlyCheckActiveScreen == onlyCheckActiveScreen) + { + return; + } + + if(!set(QString("checkActiveScreen"), onlyCheckActiveScreen ? QString("true") : QString("false"))) + { + return; + } + + m_onlyCheckActiveScreen = onlyCheckActiveScreen; + emit onlyCheckActiveScreenChanged(); +} + +auto SettingsManager::resetOnlyCheckActiveScreen() -> void +{ + setOnlyCheckActiveScreen(false); // TODO: Adapt to use your actual default value +} + +auto SettingsManager::excludedWindows() -> QStringList +{ + QString value = get(QString("excludeWindows")); + + QStringList convertedValue = value.split(QChar(','), Qt::SkipEmptyParts); + + if(convertedValue != m_excludedWindows) + { + m_excludedWindows = convertedValue; + Q_EMIT excludedWindowsChanged(); + } + + return m_excludedWindows; +} + +auto SettingsManager::setExcludedWindows(const QStringList &excludedWindows) -> void +{ + if (m_excludedWindows == excludedWindows) + { + return; + } + + if(!set(QString("excludeWindows"), excludedWindows.join(QChar(',')))) + { + return; + } + + m_excludedWindows = excludedWindows; + emit excludedWindowsChanged(); +} + +auto SettingsManager::resetExcludedWindows() -> void +{ + setExcludedWindows(QStringList{}); // TODO: Adapt to use your actual default value +} + +auto SettingsManager::running() -> bool +{ + QString value = get(QString("running")); + + if(value.isNull() || value.isEmpty()) + { + setRunning(true); + } + else + { + bool convertedValue = value.trimmed().compare("true", Qt::CaseInsensitive); + + if(convertedValue != m_running) + { + m_running = convertedValue; + Q_EMIT runningChanged(); + } + } + + return m_running; +} + +auto SettingsManager::setRunning(bool running) -> void +{ + if (m_running == running) + { + return; + } + + if(!set(QString("running"), running)) + { + return; + } + + m_running = running; + emit runningChanged(); +} + +auto SettingsManager::resetRunning() -> void +{ + setRunning(true); // TODO: Adapt to use your actual default value +} + +auto SettingsManager::jsonFromFile(const QString &uri) -> QJsonDocument +{ + QUrl url = QUrl(uri); + url.setScheme(QString("file")); + + QFile file(url.toLocalFile()); + + if(!file.exists()) + { + return {}; + } + + if(!file.open(QFile::ReadOnly)) + { + Q_EMIT error(QString("File Error"), file.errorString()); + + return {}; + } + + QByteArray fileData = file.readAll(); + + if(fileData.length() != file.size()) + { + Q_EMIT error(QString("File Read Error"), file.errorString()); + + return {}; + } + + QJsonParseError documentError; + QJsonDocument document = QJsonDocument::fromJson(fileData, &documentError); + + if(documentError.error != QJsonParseError::NoError) + { + switch (documentError.error) { + + case QJsonParseError::NoError: + case QJsonParseError::UnterminatedObject: + case QJsonParseError::MissingNameSeparator: + case QJsonParseError::UnterminatedArray: + case QJsonParseError::MissingValueSeparator: + case QJsonParseError::IllegalValue: + case QJsonParseError::TerminationByNumber: + case QJsonParseError::IllegalNumber: + case QJsonParseError::IllegalEscapeSequence: + case QJsonParseError::IllegalUTF8String: + case QJsonParseError::UnterminatedString: + case QJsonParseError::MissingObject: + case QJsonParseError::DeepNesting: + case QJsonParseError::DocumentTooLarge: + case QJsonParseError::GarbageAtEnd: + //eventually we'll have a different message for each fail state + Q_EMIT error(QString("Json Error"), documentError.errorString()); + break; + } + + return {}; + } + + return document; +} + +auto SettingsManager::packNameFromUri(const QString &uri) -> QString +{ + QJsonDocument document = jsonFromFile(uri); + + if(document.isNull()) + { + Q_EMIT error(QString("File Error"), QString("File contains no json data")); + + return {}; + } + + QJsonObject rootObject = document.object(); + + if(!rootObject.contains(QString("name"))) + { + Q_EMIT error(QString("Json Error"), QString("Json is not a Komplex Pack")); + + return {}; + } + + return rootObject["name"].toString(); +} + +auto SettingsManager::uriFromPackName(const QString &name) -> QString +{ + Q_ASSERT_X(false,"SettingsManager","uriFromPackName not implemented"); +} + +auto SettingsManager::indexOfShaderPack(QString uri) -> qint64 +{ + if(uri.isNull() || uri.isEmpty()) + uri = shaderPack(); + + QUrl url = QUrl(uri); + url.setScheme(QString("file")); + + // determine current shader pack index + qint64 index = -1; + + for(int i = 0; i < m_availableShaderPacksMetadata.count(); ++i) + { + if(m_availableShaderPacksMetadata[i].uri == url.toLocalFile()) + { + index = i; + break; + } + } + + return index; +} \ No newline at end of file diff --git a/KomplexHubPlugin/SettingsManager.h b/KomplexHubPlugin/SettingsManager.h new file mode 100644 index 0000000..13f9a87 --- /dev/null +++ b/KomplexHubPlugin/SettingsManager.h @@ -0,0 +1,227 @@ +/* + * Komplex Wallpaper Engine + * Copyright (C) 2026 @DigitalArtifex | github.com/DigitalArtifex + * + * SettingsManager.h + * + * This class provides access to Komplex Wallpaper settings via kwrite/ + * kreadconfig + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +#ifndef SETTINGSMANAGER_H +#define SETTINGSMANAGER_H +#include "Komplex_global.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SettingsManager; + +struct KOMPLEX_EXPORT WallpaperLocationData +{ + QString name; + QString uri; +}; + +Q_DECLARE_METATYPE(WallpaperLocationData) + +class KOMPLEX_EXPORT SettingsManager : public QObject +{ + Q_OBJECT + QML_ELEMENT + +public: + + explicit SettingsManager(QObject *parent = nullptr); + ~SettingsManager(); + + /**! + * @brief get + * This function gets the current setting for the supplied key. + * The value will need to be converted from a string to the type + * needed in code + * + * @param key The key of the setting to retrieve + * @returns The value of the supplied key, as a string + */ + [[nodiscard]] + Q_INVOKABLE auto get(const QString &key) -> QString; + + /**! + * @brief set + * This function sets the given value for the supplied key + * + * @param key The key of the setting + * @param value The value to set for the key + */ + [[nodiscard]] + Q_INVOKABLE auto set(const QString &key, const QVariant &value) -> bool; + + [[nodiscard]] + auto shaderPack() -> QString; + + auto setShaderPack(const QString &uri) -> void; + + [[nodiscard]] + auto shaderPackName() const -> QString; + + [[nodiscard]] + auto availableShaderPacks() -> QStringList; + + [[nodiscard]] + auto homeLocation() const -> QString; + + [[nodiscard]] + auto configLocation() const -> QString; + + [[nodiscard]] + auto shaderPackLocation() const -> QString; + + [[nodiscard]] + auto shaderPackIndex() const -> qint64; + auto setShaderPackIndex(qint64 shaderPackIndex) -> void; + + auto setShaderPackName(const QString &shaderPackName) -> void; + + [[nodiscard]] + auto resolutionX() -> quint64; + auto setResolutionX(quint64 resolutionX) -> void; + + [[nodiscard]] + auto resolutionY() -> quint64; + auto setResolutionY(quint64 resolutionY) -> void; + + [[nodiscard]] + auto targetFramerate() -> quint64; + auto setTargetFramerate(quint64 targetFramerate) -> void; + + [[nodiscard]] + auto shaderSpeed() -> qreal; + auto setShaderSpeed(qreal shaderSpeed) -> void; + + [[nodiscard]] + auto mouseTrackingEnabled() -> bool; + auto setMouseTrackingEnabled(bool mouseTrackingEnabled) -> void; + + [[nodiscard]] + auto mouseTrackingBias() -> qreal; + auto setMouseTrackingBias(qreal mouseTrackingBias) -> void; + + [[nodiscard]] + auto pauseMode() -> quint8; + auto setPauseMode(quint8 pauseMode) -> void; + auto resetPauseMode() -> void; + + [[nodiscard]] + auto onlyCheckActiveScreen() -> bool; + auto setOnlyCheckActiveScreen(bool onlyCheckActiveScreen) -> void; + auto resetOnlyCheckActiveScreen() -> void; + + [[nodiscard]] + auto excludedWindows() -> QStringList; + auto setExcludedWindows(const QStringList &excludedWindows) -> void; + auto resetExcludedWindows() -> void; + + [[nodiscard]] + auto running() -> bool; + auto setRunning(bool running) -> void; + auto resetRunning() -> void; + +signals: + auto shaderPackChanged() -> void; + auto shaderPackNameChanged() -> void; + auto availableShaderPacksChanged() -> void; + auto error(const QString&, const QString&) -> void; + auto shaderPackIndexChanged() -> void; + auto resolutionXChanged() -> void; + auto resolutionYChanged() -> void; + auto targetFramerateChanged() -> void; + auto shaderSpeedChanged() -> void; + auto mouseTrackingEnabledChanged() -> void; + auto mouseTrackingBiasChanged() -> void; + auto pauseModeChanged() -> void; + auto onlyCheckActiveScreenChanged() -> void; + auto excludedWindowsChanged() -> void; + auto runningChanged() -> void; + +private: + QString m_homeLocation; + QString m_configLocation; + QString m_shaderPackLocation; + + QString m_shaderPack = QString(); + QString m_shaderPackName = QString(); + qint64 m_shaderPackIndex = -1; + qreal m_shaderSpeed = 1.0; + QStringList m_availableShaderPacks = QStringList(); + QList m_availableShaderPacksMetadata; + + quint64 m_resolutionX = 0; + quint64 m_resolutionY = 0; + + quint64 m_targetFramerate = 60; + + bool m_mouseTrackingEnabled = false; + qreal m_mouseTrackingBias = 1.0; + + quint8 m_pauseMode = 1; + + bool m_onlyCheckActiveScreen = false; + + QStringList m_excludedWindows; + + bool m_running = true; + + QJsonDocument jsonFromFile(const QString &uri); + + QString packNameFromUri(const QString &uri); + QString uriFromPackName(const QString &name); + + qint64 indexOfShaderPack(QString uri = QString()); + + Q_PROPERTY(QString shaderPack READ shaderPack WRITE setShaderPack NOTIFY shaderPackChanged); + Q_PROPERTY(QString shaderPackName READ shaderPackName NOTIFY shaderPackNameChanged); + Q_PROPERTY(QStringList availableShaderPacks READ availableShaderPacks NOTIFY availableShaderPacksChanged); + Q_PROPERTY(qint64 shaderPackIndex READ shaderPackIndex WRITE setShaderPackIndex NOTIFY shaderPackIndexChanged FINAL) + Q_PROPERTY(quint64 resolutionX READ resolutionX WRITE setResolutionX NOTIFY resolutionXChanged FINAL) + Q_PROPERTY(quint64 resolutionY READ resolutionY WRITE setResolutionY NOTIFY resolutionYChanged FINAL) + Q_PROPERTY(quint64 targetFramerate READ targetFramerate WRITE setTargetFramerate NOTIFY targetFramerateChanged FINAL) + Q_PROPERTY(qreal shaderSpeed READ shaderSpeed WRITE setShaderSpeed NOTIFY shaderSpeedChanged FINAL) + Q_PROPERTY(bool mouseTrackingEnabled READ mouseTrackingEnabled WRITE setMouseTrackingEnabled NOTIFY mouseTrackingEnabledChanged FINAL) + Q_PROPERTY(qreal mouseTrackingBias READ mouseTrackingBias WRITE setMouseTrackingBias NOTIFY mouseTrackingBiasChanged FINAL) + Q_PROPERTY(quint8 pauseMode READ pauseMode WRITE setPauseMode RESET resetPauseMode NOTIFY pauseModeChanged FINAL) + Q_PROPERTY(bool onlyCheckActiveScreen READ onlyCheckActiveScreen WRITE setOnlyCheckActiveScreen RESET resetOnlyCheckActiveScreen NOTIFY onlyCheckActiveScreenChanged FINAL) + Q_PROPERTY(QStringList excludedWindows READ excludedWindows WRITE setExcludedWindows RESET resetExcludedWindows NOTIFY excludedWindowsChanged FINAL) + Q_PROPERTY(bool running READ running WRITE setRunning RESET resetRunning NOTIFY runningChanged FINAL) +}; + +Q_DECLARE_METATYPE(SettingsManager) +#endif \ No newline at end of file diff --git a/KomplexHubPlugin/WallpaperMetaData.h b/KomplexHubPlugin/WallpaperMetaData.h new file mode 100644 index 0000000..917c903 --- /dev/null +++ b/KomplexHubPlugin/WallpaperMetaData.h @@ -0,0 +1,21 @@ +#ifndef WALLPAPERMETADATA_H +#define WALLPAPERMETADATA_H + +#include "Komplex_global.h" + +#include +#include +#include +#include + +struct KOMPLEX_EXPORT WallpaperMetaData { + QString uri; + QString name; + QString author; + QString description; + QString thumbnail; + QDateTime installDate; +}; +Q_DECLARE_METATYPE(WallpaperMetaData) + +#endif // WALLPAPERMETADATA_H diff --git a/cmake/insight.cmake b/cmake/insight.cmake new file mode 100644 index 0000000..8245e31 --- /dev/null +++ b/cmake/insight.cmake @@ -0,0 +1,19 @@ +### This file is automatically generated by Qt Design Studio. +### Do not change + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/qtinsight.conf) + if (QT_VERSION GREATER_EQUAL 6.5.0) + find_package(Qt6 REQUIRED COMPONENTS InsightTracker) + + qt_add_resources(${CMAKE_PROJECT_NAME} "configuration" + PREFIX "/" + FILES + qtinsight.conf + ) + target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE + Qt6::InsightTracker + ) + else() + message(WARNING "You need Qt 6.5.0 or newer to build the application.") + endif() +endif() diff --git a/fonts/fonts.txt b/fonts/fonts.txt new file mode 100644 index 0000000..ab96122 --- /dev/null +++ b/fonts/fonts.txt @@ -0,0 +1 @@ +Fonts in this folder are loaded automatically. diff --git a/images/icons/icons8-back.svg b/images/icons/icons8-back.svg new file mode 100644 index 0000000..893f976 --- /dev/null +++ b/images/icons/icons8-back.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-bill.svg b/images/icons/icons8-bill.svg new file mode 100644 index 0000000..a5a7a54 --- /dev/null +++ b/images/icons/icons8-bill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-biotech.svg b/images/icons/icons8-biotech.svg new file mode 100644 index 0000000..93d2744 --- /dev/null +++ b/images/icons/icons8-biotech.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-cancel.svg b/images/icons/icons8-cancel.svg new file mode 100644 index 0000000..de73aeb --- /dev/null +++ b/images/icons/icons8-cancel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-check-mark.svg b/images/icons/icons8-check-mark.svg new file mode 100644 index 0000000..2e655c2 --- /dev/null +++ b/images/icons/icons8-check-mark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-close-window.svg b/images/icons/icons8-close-window.svg new file mode 100644 index 0000000..884d0d9 --- /dev/null +++ b/images/icons/icons8-close-window.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-famous.svg b/images/icons/icons8-famous.svg new file mode 100644 index 0000000..dc7e5b2 --- /dev/null +++ b/images/icons/icons8-famous.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-filter.svg b/images/icons/icons8-filter.svg new file mode 100644 index 0000000..b5209ee --- /dev/null +++ b/images/icons/icons8-filter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-forward.svg b/images/icons/icons8-forward.svg new file mode 100644 index 0000000..55c83b9 --- /dev/null +++ b/images/icons/icons8-forward.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-hdd.svg b/images/icons/icons8-hdd.svg new file mode 100644 index 0000000..29fadf6 --- /dev/null +++ b/images/icons/icons8-hdd.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-image.svg b/images/icons/icons8-image.svg new file mode 100644 index 0000000..39a9111 --- /dev/null +++ b/images/icons/icons8-image.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-login.svg b/images/icons/icons8-login.svg new file mode 100644 index 0000000..8cbb985 --- /dev/null +++ b/images/icons/icons8-login.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-logout-rounded-left.svg b/images/icons/icons8-logout-rounded-left.svg new file mode 100644 index 0000000..132251b --- /dev/null +++ b/images/icons/icons8-logout-rounded-left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-next.svg b/images/icons/icons8-next.svg new file mode 100644 index 0000000..83ee1e1 --- /dev/null +++ b/images/icons/icons8-next.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-reply-arrow.svg b/images/icons/icons8-reply-arrow.svg new file mode 100644 index 0000000..eff03a1 --- /dev/null +++ b/images/icons/icons8-reply-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-search.svg b/images/icons/icons8-search.svg new file mode 100644 index 0000000..ae612d6 --- /dev/null +++ b/images/icons/icons8-search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-settings.svg b/images/icons/icons8-settings.svg new file mode 100644 index 0000000..ab5dce6 --- /dev/null +++ b/images/icons/icons8-settings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-shopping-cart.svg b/images/icons/icons8-shopping-cart.svg new file mode 100644 index 0000000..b5fdfe1 --- /dev/null +++ b/images/icons/icons8-shopping-cart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-star-filled.svg b/images/icons/icons8-star-filled.svg new file mode 100644 index 0000000..2fb2a1b --- /dev/null +++ b/images/icons/icons8-star-filled.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-store.svg b/images/icons/icons8-store.svg new file mode 100644 index 0000000..c4c70aa --- /dev/null +++ b/images/icons/icons8-store.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-trash.svg b/images/icons/icons8-trash.svg new file mode 100644 index 0000000..c353987 --- /dev/null +++ b/images/icons/icons8-trash.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-user-account.svg b/images/icons/icons8-user-account.svg new file mode 100644 index 0000000..2725497 --- /dev/null +++ b/images/icons/icons8-user-account.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/icons/icons8-view-more.svg b/images/icons/icons8-view-more.svg new file mode 100644 index 0000000..7113a79 --- /dev/null +++ b/images/icons/icons8-view-more.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/images.txt b/images/images.txt new file mode 100644 index 0000000..f8b9996 --- /dev/null +++ b/images/images.txt @@ -0,0 +1 @@ +Default folder for image assets. diff --git a/images/kero/kero_build_1.png b/images/kero/kero_build_1.png new file mode 100644 index 0000000..b0f74f3 Binary files /dev/null and b/images/kero/kero_build_1.png differ diff --git a/images/kero/kero_build_2.png b/images/kero/kero_build_2.png new file mode 100644 index 0000000..0efa4f5 Binary files /dev/null and b/images/kero/kero_build_2.png differ diff --git a/images/kero/kero_build_3.png b/images/kero/kero_build_3.png new file mode 100644 index 0000000..29f6036 Binary files /dev/null and b/images/kero/kero_build_3.png differ diff --git a/images/kero/kero_build_4.png b/images/kero/kero_build_4.png new file mode 100644 index 0000000..ce7b028 Binary files /dev/null and b/images/kero/kero_build_4.png differ diff --git a/images/kero/kero_build_error.png b/images/kero/kero_build_error.png new file mode 100644 index 0000000..57a3bed Binary files /dev/null and b/images/kero/kero_build_error.png differ diff --git a/images/kero/kero_choice.png b/images/kero/kero_choice.png new file mode 100644 index 0000000..23bfa65 Binary files /dev/null and b/images/kero/kero_choice.png differ diff --git a/images/kero/kero_error.png b/images/kero/kero_error.png new file mode 100644 index 0000000..18fd063 Binary files /dev/null and b/images/kero/kero_error.png differ diff --git a/images/kero/kero_hello.png b/images/kero/kero_hello.png new file mode 100644 index 0000000..547bbb4 Binary files /dev/null and b/images/kero/kero_hello.png differ diff --git a/images/kero/kero_login.png b/images/kero/kero_login.png new file mode 100644 index 0000000..180a1ea Binary files /dev/null and b/images/kero/kero_login.png differ diff --git a/images/kero/kero_no_results.png b/images/kero/kero_no_results.png new file mode 100644 index 0000000..369fabe Binary files /dev/null and b/images/kero/kero_no_results.png differ diff --git a/images/kero/kero_run_1.png b/images/kero/kero_run_1.png new file mode 100644 index 0000000..bcefbfb Binary files /dev/null and b/images/kero/kero_run_1.png differ diff --git a/images/kero/kero_run_2.png b/images/kero/kero_run_2.png new file mode 100644 index 0000000..15f75f7 Binary files /dev/null and b/images/kero/kero_run_2.png differ diff --git a/images/kero/kero_run_3.png b/images/kero/kero_run_3.png new file mode 100644 index 0000000..8a15e7b Binary files /dev/null and b/images/kero/kero_run_3.png differ diff --git a/images/kero/kero_run_4.png b/images/kero/kero_run_4.png new file mode 100644 index 0000000..8e94485 Binary files /dev/null and b/images/kero/kero_run_4.png differ diff --git a/images/kero/kero_success.png b/images/kero/kero_success.png new file mode 100644 index 0000000..84b85f6 Binary files /dev/null and b/images/kero/kero_success.png differ diff --git a/images/kero/kero_warning.png b/images/kero/kero_warning.png new file mode 100644 index 0000000..91bae9c Binary files /dev/null and b/images/kero/kero_warning.png differ diff --git a/qds.cmake b/qds.cmake new file mode 100644 index 0000000..8b816b6 --- /dev/null +++ b/qds.cmake @@ -0,0 +1,21 @@ +### This file is automatically generated by Qt Design Studio. +### Do not change + +add_subdirectory(KomplexHubModule) +add_subdirectory(KomplexHubContent) +add_subdirectory(KomplexHubPlugin) +add_subdirectory(App) +add_subdirectory(Dependencies) + +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE + KomplexHubModuleplugin + KomplexHubContentplugin + KomplexHubPluginplugin + KomplexHubModule_Controlsplugin + KomplexHubModule_Keroplugin + Qt6::Quick + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::QuickControls2 +) \ No newline at end of file diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf new file mode 100644 index 0000000..207aadd --- /dev/null +++ b/qtquickcontrols2.conf @@ -0,0 +1,13 @@ +; This file can be edited to change the style of the application +; Read "Qt Quick Controls 2 Configuration File" for details: +; https://doc.qt.io/qt-6/qtquickcontrols-configuration.html + +[Controls] +Style=Material + +[Material] +Theme=System +;Accent=BlueGrey +;Primary=BlueGray +;Foreground=Brown +;Background=Grey