From e1e054234f7a16d4237f0fb5fe5cca20cb26eb0b Mon Sep 17 00:00:00 2001 From: Digital Artifex <7929434+DigitalArtifex@users.noreply.github.com> Date: Sun, 21 Sep 2025 07:08:58 -0400 Subject: [PATCH] Added Pexels and ShaderToy API --- plugin/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++-- plugin/plugin.cpp | 18 ++++++++++++++++++ plugin/qmldir | 5 ++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt index c7cbf4d..7402bf3 100644 --- a/plugin/CMakeLists.txt +++ b/plugin/CMakeLists.txt @@ -13,9 +13,22 @@ add_library( ShaderPackModel.cpp AudioModel.cpp AudioImageProvider.cpp - AudioImageProvider.h - ShaderPackMetadata.h ShaderPackMetadata.cpp + GeometryProvider.cpp + GeometryProvider.h + PexelsImageMetadata.h + PexelsImageSearch.h + PexelsImageSearch.cpp + PexelsVideoMetadata.h + PexelsVideoModel.h + PexelsVideoModel.cpp + PexelsVideoSearch.h + PexelsVideoSearch.cpp + ShaderToyMetadata.h + ShaderToySearchModel.h + ShaderToySearchModel.cpp + ShaderToyAPI.h + PexelsAPI.h ) qt_add_qml_module( @@ -34,6 +47,21 @@ qt_add_qml_module( AudioModel.cpp AudioImageProvider.cpp ShaderPackMetadata.cpp + GeometryProvider.cpp + GeometryProvider.h + PexelsImageMetadata.h + PexelsImageSearch.h + PexelsImageSearch.cpp + PexelsVideoMetadata.h + PexelsVideoModel.h + PexelsVideoModel.cpp + PexelsVideoSearch.h + PexelsVideoSearch.cpp + ShaderToyMetadata.h + ShaderToySearchModel.h + ShaderToySearchModel.cpp + ShaderToyAPI.h + PexelsAPI.h NO_GENERATE_PLUGIN_SOURCE ) diff --git a/plugin/plugin.cpp b/plugin/plugin.cpp index 258ca70..a8eaf1e 100644 --- a/plugin/plugin.cpp +++ b/plugin/plugin.cpp @@ -5,6 +5,10 @@ #include "AudioModel.h" #include "AudioImageProvider.h" #include "ShaderPackModel.h" +#include "PexelsVideoSearch.h" +#include "PexelsImageSearch.h" +#include "ShaderToySearchModel.h" +#include "GeometryProvider.h" #include "Komplex_global.h" AudioModel *komplexAudioSingletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine) @@ -27,13 +31,27 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("com.github.digitalartifex.komplex")); + + char *stUri = new char[std::strlen(uri) + std::strlen(".ShaderToy")]; + std::sprintf(stUri, "%s.ShaderToy", uri); + + char *pvUri = new char[std::strlen(uri) + std::strlen(".Pexels.Video")]; + std::sprintf(pvUri, "%s.Pexels.Video", uri); + + char *piUri = new char[std::strlen(uri) + std::strlen(".Pexels.Image")]; + std::sprintf(piUri, "%s.Pexels.Image", uri); qmlRegisterSingletonType(uri, 1, 0, "AudioModel", komplexAudioSingletonProvider); qmlRegisterType(uri, 1, 0, "ShaderPackModel"); + qmlRegisterType(uri, 1, 0, "GeometryProvider"); + qmlRegisterType(stUri, 1, 0, "SearchModel"); + qmlRegisterType(pvUri, 1, 0, "SearchModel"); + qmlRegisterType(piUri, 1, 0, "SearchModel"); } void unregisterTypes() override { + AudioModel::stopCapture(); } void initializeEngine(QQmlEngine *engine, const char *uri) override diff --git a/plugin/qmldir b/plugin/qmldir index c42d0e8..9b54180 100644 --- a/plugin/qmldir +++ b/plugin/qmldir @@ -1,4 +1,7 @@ module com.github.digitalartifex.komplex plugin komplex classname AudioModel -classname ShaderPackModel \ No newline at end of file +classname ShaderPackModel +classname PexelsImageSearchModel +classname PexelsVideoSearchModel +classname ShaderToySearchModel \ No newline at end of file