2023-08-22 17:05:28 +03:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import HelperWidgets as HelperWidgets
|
2024-01-16 12:30:29 +01:00
|
|
|
import StudioTheme as StudioTheme
|
2024-01-26 14:55:50 +02:00
|
|
|
import EffectComposerBackend
|
2023-08-22 17:05:28 +03:00
|
|
|
|
|
|
|
|
Row {
|
2023-08-25 16:27:01 +03:00
|
|
|
id: itemPane
|
|
|
|
|
|
2023-08-22 17:05:28 +03:00
|
|
|
spacing: 5
|
|
|
|
|
|
2023-08-25 16:27:01 +03:00
|
|
|
HelperWidgets.UrlChooser {
|
|
|
|
|
backendValue: uniformBackendValue
|
2024-03-07 11:43:13 +02:00
|
|
|
resourcesPath: EffectComposerBackend.rootView.imagesPath()
|
2023-08-25 16:27:01 +03:00
|
|
|
|
2023-08-28 14:15:49 +03:00
|
|
|
actionIndicatorVisible: false
|
2024-01-24 16:04:51 +02:00
|
|
|
comboBox.width: Math.min(parent.width - 70, 300)
|
2023-08-28 14:15:49 +03:00
|
|
|
|
2023-10-31 18:07:19 +02:00
|
|
|
onAbsoluteFilePathChanged: uniformValue = absoluteFilePath
|
2023-11-14 12:43:46 +02:00
|
|
|
|
2024-02-05 14:59:46 +02:00
|
|
|
function defaultAsString(defaultPath) {
|
|
|
|
|
if (!defaultPath)
|
|
|
|
|
return undefined
|
|
|
|
|
let urlStr = defaultPath.toString()
|
2023-11-14 12:43:46 +02:00
|
|
|
urlStr = urlStr.replace(/^(file:\/{3})/, "")
|
|
|
|
|
|
|
|
|
|
// Prepend slash if there is no drive letter
|
|
|
|
|
if (urlStr.length > 1 && urlStr[1] !== ':')
|
|
|
|
|
urlStr = '/' + urlStr;
|
|
|
|
|
|
|
|
|
|
return urlStr
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-05 14:59:46 +02:00
|
|
|
Component.onCompleted: {
|
|
|
|
|
let originalPath = defaultAsString(
|
|
|
|
|
EffectComposerBackend.rootView.uniformDefaultImage(nodeName, uniformName))
|
|
|
|
|
let originalName = originalPath ? originalPath.split('/').pop() : undefined
|
|
|
|
|
if (originalName) {
|
|
|
|
|
defaultItems = [originalName]
|
|
|
|
|
defaultPaths = [originalPath]
|
|
|
|
|
} else {
|
|
|
|
|
let currentPath = uniformDefaultValue ? defaultAsString(uniformDefaultValue) : undefined
|
|
|
|
|
let currentName = currentPath ? currentPath.split('/').pop() : undefined
|
|
|
|
|
if (currentName) {
|
|
|
|
|
defaultItems = [currentName]
|
|
|
|
|
defaultPaths = [currentPath]
|
|
|
|
|
} else {
|
|
|
|
|
defaultItems = []
|
|
|
|
|
defaultPaths = []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-25 16:27:01 +03:00
|
|
|
}
|
2023-08-22 17:05:28 +03:00
|
|
|
}
|