From 2c75ad63c983e02d423b6d1265055abe531ab928 Mon Sep 17 00:00:00 2001 From: Digital Artifex <7929434+DigitalArtifex@users.noreply.github.com> Date: Tue, 23 Sep 2025 06:21:08 -0400 Subject: [PATCH] Bugfixes for displaying media hubs --- package/contents/ui/PexelsImageHub.qml | 30 ++-- package/contents/ui/PexelsVideoHub.qml | 20 ++- .../ui/ShaderChannelConfiguration.qml | 104 +++++++++++-- package/contents/ui/ShaderToyHub.qml | 142 +++++++++++++----- package/contents/ui/config.qml | 52 ++++++- 5 files changed, 287 insertions(+), 61 deletions(-) diff --git a/package/contents/ui/PexelsImageHub.qml b/package/contents/ui/PexelsImageHub.qml index f0af06e..721ae55 100644 --- a/package/contents/ui/PexelsImageHub.qml +++ b/package/contents/ui/PexelsImageHub.qml @@ -3,21 +3,24 @@ import QtQuick.Controls import QtQuick.Dialogs import QtQuick.Layouts -import Komplex.Pexels.Image as Pexels +import com.github.digitalartifex.komplex as Komplex Item { + property alias selectedFile: searchModel.lastSavedFile + id: mainItem anchors.fill: parent - Pexels.SearchModel + Komplex.PexelsImageSearchModel { id: searchModel } ColumnLayout { - anchors.fill: parent + width: mainItem.width + height: mainItem.height RowLayout { @@ -193,10 +196,14 @@ Item Button { Layout.topMargin: 4 - Layout.alignment: Qt.AlignRight + Layout.alignment: Qt.AlignHCenter Layout.preferredHeight: 32 - Layout.preferredWidth: 32 - icon.name: "emblem-downloads" + Layout.fillWidth: true + text: "Download & Preview" + + icon.source: "./icons/download.svg" + icon.name: "download-symbolic" + onClicked: { downloadDialog.imageHeight = entry.originalHeight downloadDialog.imageWidth = entry.originalWidth @@ -272,8 +279,9 @@ Item Rectangle { color: palette.base - anchors.fill: parent - visible: searchModel.status === Pexels.SearchModel.Searching + width: mainItem.width + height: mainItem.height + visible: searchModel.status === Komplex.PexelsImageSearchModel.Searching RowLayout { @@ -360,7 +368,11 @@ Item { Layout.fillWidth: true text: "Download (" + downloadDialog.imageWidth + "x" + downloadDialog.imageHeight + ")" - icon.name: "image-symbolic" + icon.source: "./icons/download.svg" + icon.name: "download-symbolic" + hoverEnabled: true + ToolTip.text: "Download" + ToolTip.visible: hovered onClicked: () => { diff --git a/package/contents/ui/PexelsVideoHub.qml b/package/contents/ui/PexelsVideoHub.qml index 0399037..4882a40 100644 --- a/package/contents/ui/PexelsVideoHub.qml +++ b/package/contents/ui/PexelsVideoHub.qml @@ -1,10 +1,11 @@ + import QtQuick import QtQuick.Controls import QtQuick.Dialogs import QtQuick.Layouts import QtMultimedia -import Komplex.Pexels.Video as Pexels +import com.github.digitalartifex.komplex as Komplex Item { @@ -13,7 +14,7 @@ Item id: mainItem anchors.fill: parent - Pexels.SearchModel + Komplex.PexelsVideoSearchModel { id: searchModel } @@ -191,7 +192,8 @@ Item Layout.alignment: Qt.AlignRight Layout.preferredHeight: 32 Layout.fillWidth: true - icon.name: "emblem-downloads" + icon.name: "download-symbolic" + icon.source: "./icons/download.svg" text: qsTr("Preview & Download") onClicked: () => @@ -277,7 +279,7 @@ Item { color: palette.base anchors.fill: parent - visible: searchModel.status === Pexels.SearchModel.Searching + visible: searchModel.status === Komplex.PexelsVideoSearchModel.Searching RowLayout { @@ -434,6 +436,10 @@ Item Layout.preferredHeight: 18 Layout.preferredWidth: 18 icon.name: mediaPlayer.playing ? "stop-symbolic" : "play-symbolic" + hoverEnabled: true + ToolTip.text: mediaPlayer.playing ? "Play" : "Stop" + ToolTip.visible: hovered + icon.source: mediaPlayer.playing ? "./icons/stop.svg" : "./icons/play.svg" icon.height: 16 icon.width: 16 onClicked: () => @@ -476,7 +482,11 @@ Item enabled: downloadSelector.currentIndex >= 0 Layout.preferredHeight: downloadSelector.height Layout.preferredWidth: downloadSelector.height - icon.name: "image-symbolic" + icon.source: "./icons/download.svg" + icon.name: "download-symbolic" + hoverEnabled: true + ToolTip.text: "Download" + ToolTip.visible: hovered id: downloadButton diff --git a/package/contents/ui/ShaderChannelConfiguration.qml b/package/contents/ui/ShaderChannelConfiguration.qml index aa840cf..d69d65c 100644 --- a/package/contents/ui/ShaderChannelConfiguration.qml +++ b/package/contents/ui/ShaderChannelConfiguration.qml @@ -55,6 +55,7 @@ Item property string imageFolder: shaderPackModel.imagesPath property string videoFolder: shaderPackModel.videosPath property string cubemapFolder: shaderPackModel.cubeMapsPath + property string sceneFolder: shaderPackModel.scenesPath property alias tmp_source: sourceEdit.text property int tmp_type: 1 @@ -111,7 +112,7 @@ Item { file: true name: "Image" - icon: "./icons/image.svg" + icon: "./icons/camera.svg" title: "Select an Image File" filter: "Image Files (*.jpg *.jpeg *.png *.svg *.gif *.tiff *.webp)" type: ShaderChannel.Type.ImageChannel @@ -123,7 +124,7 @@ Item name: "Scene" icon: "./icons/image.svg" title: "Select a scene file" - filter: "Image Files (*.qml)" + filter: "QML Scene Files (*.qml)" type: ShaderChannel.Type.SceneChannel } @@ -213,29 +214,36 @@ Item window.selectionTitle = parent.title window.file = parent.file + var source = "" + + if(parent.type === window.type) + source = window.source + switch(parent.type) { - // case ShaderChannel.Type.AudioChannel: - // break; case ShaderChannel.Type.CubeMapChannel: window.currentFolder = window.cubemapFolder - window.tmp_source = "" + window.tmp_source = source break; case ShaderChannel.Type.ImageChannel: window.currentFolder = window.imageFolder - window.tmp_source = "" + window.tmp_source = source break; case ShaderChannel.Type.ShaderChannel: window.currentFolder = window.shaderFolder - window.tmp_source = "" + window.tmp_source = source break; case ShaderChannel.Type.VideoChannel: window.currentFolder = window.videoFolder - window.tmp_source = "" + window.tmp_source = source + break; + case ShaderChannel.Type.SceneChannel: + window.currentFolder = window.sceneFolder + window.tmp_source = source break; case ShaderChannel.Type.AudioChannel: window.currentFolder = window.videoFolder - window.tmp_source = "Audio Channel" + window.tmp_source = "Desktop Audio Channel" break; } } @@ -321,6 +329,32 @@ Item folderDialog.open() } } + + Button + { + visible: window.tmp_type === ShaderChannel.ImageChannel + icon.name: "network-symbolic" + Layout.preferredWidth: Kirigami.Units.gridUnit * 2 + Layout.preferredHeight: Kirigami.Units.gridUnit * 2 + + onClicked: + { + pexelsImageDialog.open() + } + } + + Button + { + visible: window.tmp_type === ShaderChannel.VideoChannel + icon.name: "network-symbolic" + Layout.preferredWidth: Kirigami.Units.gridUnit * 2 + Layout.preferredHeight: Kirigami.Units.gridUnit * 2 + + onClicked: + { + pexelsVideoDialog.open() + } + } } CheckBox @@ -582,6 +616,58 @@ Item onAccepted: window.tmp_source = selectedFolder } + Kirigami.OverlaySheet + { + title: "Pexels Image Import" + id: pexelsImageDialog + implicitWidth: 960 + implicitHeight: 480 + parent: applicationWindow().overlay + + PexelsImageHub + { + id: pexelsImageHub + width: pexelsVideoDialog.width - 10 + height: pexelsVideoDialog.height - 40 + + onSelectedFileChanged: + { + window.tmp_source = pexelsImageHub.selectedFile + + if(selectedFile === "" || selectedFile === undefined) + return; + + pexelsImageDialog.close() + } + } + } + + Kirigami.OverlaySheet + { + title: "Pexels Video Import" + id: pexelsVideoDialog + implicitWidth: 960 + implicitHeight: 480 + parent: applicationWindow().overlay + + PexelsVideoHub + { + id: pexelsVideoHub + width: pexelsVideoDialog.width - 10 + height: pexelsVideoDialog.height - 40 + + onSelectedFileChanged: + { + window.tmp_source = pexelsVideoHub.selectedFile + + if(selectedFile === "" || selectedFile === undefined) + return; + + pexelsVideoDialog.close() + } + } + } + function accept() { // copy over temp values diff --git a/package/contents/ui/ShaderToyHub.qml b/package/contents/ui/ShaderToyHub.qml index cbc4700..9e14c35 100644 --- a/package/contents/ui/ShaderToyHub.qml +++ b/package/contents/ui/ShaderToyHub.qml @@ -5,22 +5,26 @@ import QtQuick.Dialogs import QtQuick.Layouts import QtMultimedia import QtWebView +import org.kde.kirigami as Kirigami -import Komplex.ShaderToy as ShaderToy +import com.github.digitalartifex.komplex as Komplex Item { id: mainItem - anchors.fill: parent + //anchors.fill: parent - ShaderToy.SearchModel + signal accepted + + Komplex.ShaderToySearchModel { id: searchModel } ColumnLayout { - anchors.fill: parent + width: mainItem.width + height: mainItem.height RowLayout { @@ -180,7 +184,8 @@ Item Layout.alignment: Qt.AlignRight Layout.preferredHeight: 32 Layout.fillWidth: true - icon.name: "emblem-downloads" + icon.source: "./icons/download.svg" + icon.name: "download-symbolic" text: qsTr("Preview & Download") onClicked: () => { @@ -231,7 +236,8 @@ Item Button { Layout.fillWidth: true - icon.name: "image-symbolic" + icon.source: "./icons/download.svg" + icon.name: "download-symbolic" id: downloadButton text: qsTr("Convert to Komplex Pack") @@ -324,8 +330,10 @@ Item Rectangle { color: palette.base - anchors.fill: parent - visible: searchModel.status === ShaderToy.SearchModel.Searching || searchModel.status === ShaderToy.SearchModel.Compiling + + width: mainItem.width + height: mainItem.height + visible: searchModel.status === Komplex.ShaderToySearchModel.Searching || searchModel.status === Komplex.ShaderToySearchModel.Compiling RowLayout { @@ -333,7 +341,7 @@ Item Image { - visible: searchModel.status === ShaderToy.SearchModel.Compiling + visible: searchModel.status === Komplex.ShaderToySearchModel.Compiling Layout.fillHeight: true Layout.fillWidth: true @@ -347,7 +355,7 @@ Item text: searchModel.statusMessage color: palette.text elide: Text.ElideRight - visible: searchModel.status === ShaderToy.SearchModel.Compiling + visible: searchModel.status === Komplex.ShaderToySearchModel.Compiling } ProgressBar @@ -355,7 +363,7 @@ Item id: totalProgress Layout.fillWidth: true Layout.preferredHeight: 6 - visible: searchModel.status === ShaderToy.SearchModel.Compiling + visible: searchModel.status === Komplex.ShaderToySearchModel.Compiling } Text @@ -364,7 +372,7 @@ Item text: qsTr(searchModel.downloadText) color: palette.text elide: Text.ElideRight - visible: searchModel.totalDownloads > 0 && searchModel.status === ShaderToy.SearchModel.Compiling + visible: searchModel.totalDownloads > 0 && searchModel.status === Komplex.ShaderToySearchModel.Compiling } ProgressBar @@ -375,7 +383,7 @@ Item from: 0 to: searchModel.totalDownloads value: searchModel.completedDownloads - visible: searchModel.totalDownloads > 0 && searchModel.status === ShaderToy.SearchModel.Compiling + visible: searchModel.totalDownloads > 0 && searchModel.status === Komplex.ShaderToySearchModel.Compiling } } @@ -389,32 +397,36 @@ Item } } - Rectangle + Kirigami.OverlaySheet { property int totalVideos: searchModel.videoSelections.length property int selectedVideos: 0 + title: "Select Media" + + + implicitWidth: mainItem.width + implicitHeight: mainItem.height - anchors.fill: parent - color: palette.base - visible: searchModel.status === ShaderToy.SearchModel.Compiled enabled: visible id: mediaSelectionItem signal accepted + Connections + { + target: searchModel + + function onStatusChanged() + { + if(searchModel.status === Komplex.ShaderToySearchModel.Compiled) + mediaSelectionItem.open() + } + } + ColumnLayout { anchors.fill: parent - Text - { - Layout.margins: 6 - Layout.alignment: Qt.AlignTop - Layout.fillWidth: true - Layout.preferredHeight: 50 - color: palette.text - text: "