2023-02-09 09:17:00 +01:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
2022-10-26 19:57:41 +03:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuickDesignerTheme
|
2023-02-09 09:17:00 +01:00
|
|
|
import HelperWidgets 2.0 as HelperWidgets
|
|
|
|
|
import StudioControls 1.0 as StudioControls
|
|
|
|
|
import StudioTheme 1.0 as StudioTheme
|
2023-03-02 13:21:40 +01:00
|
|
|
import ContentLibraryBackend
|
2022-10-26 19:57:41 +03:00
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
// Called also from C++ to close context menu on focus out
|
|
|
|
|
function closeContextMenu()
|
|
|
|
|
{
|
|
|
|
|
materialsView.closeContextMenu()
|
|
|
|
|
texturesView.closeContextMenu()
|
|
|
|
|
environmentsView.closeContextMenu()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Called from C++
|
|
|
|
|
function clearSearchFilter()
|
|
|
|
|
{
|
|
|
|
|
searchBox.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
id: col
|
2023-02-22 13:34:17 +01:00
|
|
|
anchors.fill: parent
|
2022-10-26 19:57:41 +03:00
|
|
|
spacing: 5
|
|
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
Rectangle {
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: StudioTheme.Values.doubleToolbarHeight
|
|
|
|
|
color: StudioTheme.Values.themeToolbarBackground
|
|
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
anchors.fill: parent
|
2023-02-13 11:20:27 +01:00
|
|
|
anchors.topMargin: 6
|
|
|
|
|
anchors.bottomMargin: 6
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
anchors.rightMargin: 10
|
2023-02-09 09:17:00 +01:00
|
|
|
spacing: 12
|
|
|
|
|
|
|
|
|
|
StudioControls.SearchBox {
|
|
|
|
|
id: searchBox
|
2023-02-13 11:20:27 +01:00
|
|
|
width: parent.width
|
2023-02-09 09:17:00 +01:00
|
|
|
style: StudioTheme.Values.searchControlStyle
|
|
|
|
|
enabled: {
|
|
|
|
|
if (tabBar.currIndex === 0) { // Materials tab
|
2023-03-02 13:21:40 +01:00
|
|
|
ContentLibraryBackend.materialsModel.matBundleExists
|
|
|
|
|
&& ContentLibraryBackend.rootView.hasMaterialLibrary
|
|
|
|
|
&& ContentLibraryBackend.materialsModel.hasRequiredQuick3DImport
|
2023-02-09 09:17:00 +01:00
|
|
|
} else { // Textures / Environments tabs
|
2023-03-02 16:31:49 +02:00
|
|
|
ContentLibraryBackend.texturesModel.texBundleExists
|
2023-02-09 09:17:00 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSearchChanged: (searchText) => {
|
2023-03-02 13:21:40 +01:00
|
|
|
ContentLibraryBackend.rootView.handleSearchFilterChanged(searchText)
|
2023-02-09 09:17:00 +01:00
|
|
|
|
|
|
|
|
// make sure categories with matches are expanded
|
|
|
|
|
materialsView.expandVisibleSections()
|
|
|
|
|
texturesView.expandVisibleSections()
|
|
|
|
|
environmentsView.expandVisibleSections()
|
|
|
|
|
}
|
2022-11-29 16:56:08 +02:00
|
|
|
}
|
2022-10-26 19:57:41 +03:00
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
ContentLibraryTabBar {
|
|
|
|
|
id: tabBar
|
2023-02-13 11:20:27 +01:00
|
|
|
width: parent.width
|
2023-02-09 09:17:00 +01:00
|
|
|
height: StudioTheme.Values.toolbarHeight
|
|
|
|
|
tabsModel: [{name: qsTr("Materials"), icon: StudioTheme.Constants.material_medium},
|
|
|
|
|
{name: qsTr("Textures"), icon: StudioTheme.Constants.textures_medium},
|
|
|
|
|
{name: qsTr("Environments"), icon: StudioTheme.Constants.languageList_medium}]
|
|
|
|
|
}
|
2022-10-26 19:57:41 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnimportBundleMaterialDialog {
|
|
|
|
|
id: confirmUnimportDialog
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StackLayout {
|
|
|
|
|
width: root.width
|
|
|
|
|
height: root.height - y
|
|
|
|
|
currentIndex: tabBar.currIndex
|
|
|
|
|
|
|
|
|
|
ContentLibraryMaterialsView {
|
|
|
|
|
id: materialsView
|
|
|
|
|
|
|
|
|
|
width: root.width
|
|
|
|
|
|
|
|
|
|
searchBox: searchBox
|
|
|
|
|
|
|
|
|
|
onUnimport: (bundleMat) => {
|
2022-11-21 16:12:54 +02:00
|
|
|
confirmUnimportDialog.targetBundleMaterial = bundleMat
|
|
|
|
|
confirmUnimportDialog.open()
|
2022-10-26 19:57:41 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContentLibraryTexturesView {
|
|
|
|
|
id: texturesView
|
|
|
|
|
|
|
|
|
|
width: root.width
|
2023-03-02 16:31:49 +02:00
|
|
|
model: ContentLibraryBackend.texturesModel
|
2022-10-26 19:57:41 +03:00
|
|
|
|
|
|
|
|
searchBox: searchBox
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContentLibraryTexturesView {
|
|
|
|
|
id: environmentsView
|
|
|
|
|
|
|
|
|
|
width: root.width
|
2023-03-02 16:31:49 +02:00
|
|
|
model: ContentLibraryBackend.environmentsModel
|
2022-10-26 19:57:41 +03:00
|
|
|
|
|
|
|
|
searchBox: searchBox
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|