2023-04-18 14:09:48 +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
|
|
|
|
|
import StudioControls as StudioControls
|
|
|
|
|
import StudioTheme as StudioTheme
|
|
|
|
|
import ContentLibraryBackend
|
|
|
|
|
|
|
|
|
|
StudioControls.Menu {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property var targetItem: null
|
|
|
|
|
|
2024-04-30 12:56:02 +03:00
|
|
|
readonly property bool targetAvailable: targetItem && !ContentLibraryBackend.rootView.importerRunning
|
2023-04-18 14:09:48 +03:00
|
|
|
|
|
|
|
|
signal unimport(var bundleEff);
|
|
|
|
|
|
|
|
|
|
function popupMenu(targetItem = null)
|
|
|
|
|
{
|
|
|
|
|
this.targetItem = targetItem
|
|
|
|
|
popup()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closePolicy: StudioControls.Menu.CloseOnEscape | StudioControls.Menu.CloseOnPressOutside
|
|
|
|
|
|
|
|
|
|
StudioControls.MenuItem {
|
|
|
|
|
text: qsTr("Add an instance")
|
2023-07-31 13:58:43 +03:00
|
|
|
enabled: root.targetAvailable && ContentLibraryBackend.rootView.hasActive3DScene
|
2023-04-18 14:09:48 +03:00
|
|
|
onTriggered: ContentLibraryBackend.effectsModel.addInstance(root.targetItem)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StudioControls.MenuItem {
|
|
|
|
|
enabled: root.targetAvailable && root.targetItem.bundleItemImported
|
|
|
|
|
text: qsTr("Remove from project")
|
|
|
|
|
|
|
|
|
|
onTriggered: root.unimport(root.targetItem)
|
|
|
|
|
}
|
|
|
|
|
}
|