mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 06:23:59 -06:00
Don't nest all content in background rect
This way we don't have an extra identation depth, makes it a bit easier to read CURA-8726
This commit is contained in:
parent
a05650f64c
commit
ac6375d17b
1 changed files with 151 additions and 152 deletions
|
@ -46,196 +46,195 @@ Window
|
|||
{
|
||||
anchors.fill: parent
|
||||
color: UM.Theme.getColor("main_background")
|
||||
}
|
||||
//The Marketplace can have a page in front of everything with package details. The stack view controls its visibility.
|
||||
StackView
|
||||
{
|
||||
id: contextStack
|
||||
anchors.fill: parent
|
||||
|
||||
//The Marketplace can have a page in front of everything with package details. The stack view controls its visibility.
|
||||
StackView
|
||||
initialItem: packageBrowse
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
id: contextStack
|
||||
anchors.fill: parent
|
||||
id: packageBrowse
|
||||
|
||||
initialItem: packageBrowse
|
||||
spacing: UM.Theme.getSize("narrow_margin").height
|
||||
|
||||
ColumnLayout
|
||||
// Page title.
|
||||
Item
|
||||
{
|
||||
id: packageBrowse
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
||||
|
||||
spacing: UM.Theme.getSize("narrow_margin").height
|
||||
|
||||
// Page title.
|
||||
Item
|
||||
Label
|
||||
{
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
||||
|
||||
Label
|
||||
id: pageTitle
|
||||
anchors
|
||||
{
|
||||
id: pageTitle
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
font: UM.Theme.getFont("large")
|
||||
color: UM.Theme.getColor("text")
|
||||
text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...")
|
||||
left: parent.left
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
right: parent.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
font: UM.Theme.getFont("large")
|
||||
color: UM.Theme.getColor("text")
|
||||
text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...")
|
||||
}
|
||||
}
|
||||
|
||||
OnboardBanner
|
||||
OnboardBanner
|
||||
{
|
||||
visible: content.item && content.item.bannerVisible
|
||||
text: content.item && content.item.bannerText
|
||||
icon: content.item && content.item.bannerIcon
|
||||
onRemove: content.item && content.item.onRemoveBanner
|
||||
readMoreUrl: content.item && content.item.bannerReadMoreUrl
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
Layout.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
// Search & Top-Level Tabs
|
||||
Item
|
||||
{
|
||||
Layout.preferredHeight: childrenRect.height
|
||||
Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
RowLayout
|
||||
{
|
||||
visible: content.item && content.item.bannerVisible
|
||||
text: content.item && content.item.bannerText
|
||||
icon: content.item && content.item.bannerIcon
|
||||
onRemove: content.item && content.item.onRemoveBanner
|
||||
readMoreUrl: content.item && content.item.bannerReadMoreUrl
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height
|
||||
spacing: UM.Theme.getSize("thin_margin").width
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
Layout.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
// Search & Top-Level Tabs
|
||||
Item
|
||||
{
|
||||
Layout.preferredHeight: childrenRect.height
|
||||
Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
RowLayout
|
||||
Cura.SearchBar
|
||||
{
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height
|
||||
spacing: UM.Theme.getSize("thin_margin").width
|
||||
id: searchBar
|
||||
Layout.preferredHeight: UM.Theme.getSize("button_icon").height
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: searchStringChanged(text)
|
||||
}
|
||||
|
||||
Cura.SearchBar
|
||||
// Page selection.
|
||||
TabBar
|
||||
{
|
||||
id: pageSelectionTabBar
|
||||
Layout.alignment: Qt.AlignRight
|
||||
height: UM.Theme.getSize("button_icon").height
|
||||
spacing: 0
|
||||
background: Rectangle { color: "transparent" }
|
||||
currentIndex: manager.tabShown
|
||||
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
id: searchBar
|
||||
Layout.preferredHeight: UM.Theme.getSize("button_icon").height
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: searchStringChanged(text)
|
||||
manager.tabShown = currentIndex
|
||||
searchBar.text = "";
|
||||
searchBar.visible = currentItem.hasSearch;
|
||||
content.source = currentItem.sourcePage;
|
||||
}
|
||||
|
||||
// Page selection.
|
||||
TabBar
|
||||
PackageTypeTab
|
||||
{
|
||||
id: pageSelectionTabBar
|
||||
Layout.alignment: Qt.AlignRight
|
||||
height: UM.Theme.getSize("button_icon").height
|
||||
spacing: 0
|
||||
background: Rectangle { color: "transparent" }
|
||||
currentIndex: manager.tabShown
|
||||
id: pluginTabText
|
||||
width: implicitWidth
|
||||
text: catalog.i18nc("@button", "Plugins")
|
||||
property string sourcePage: "Plugins.qml"
|
||||
property bool hasSearch: true
|
||||
}
|
||||
PackageTypeTab
|
||||
{
|
||||
id: materialsTabText
|
||||
width: implicitWidth
|
||||
text: catalog.i18nc("@button", "Materials")
|
||||
property string sourcePage: "Materials.qml"
|
||||
property bool hasSearch: true
|
||||
}
|
||||
ManagePackagesButton
|
||||
{
|
||||
property string sourcePage: "ManagedPackages.qml"
|
||||
property bool hasSearch: false
|
||||
|
||||
onCurrentIndexChanged:
|
||||
Cura.NotificationIcon
|
||||
{
|
||||
manager.tabShown = currentIndex
|
||||
searchBar.text = "";
|
||||
searchBar.visible = currentItem.hasSearch;
|
||||
content.source = currentItem.sourcePage;
|
||||
}
|
||||
|
||||
PackageTypeTab
|
||||
{
|
||||
id: pluginTabText
|
||||
width: implicitWidth
|
||||
text: catalog.i18nc("@button", "Plugins")
|
||||
property string sourcePage: "Plugins.qml"
|
||||
property bool hasSearch: true
|
||||
}
|
||||
PackageTypeTab
|
||||
{
|
||||
id: materialsTabText
|
||||
width: implicitWidth
|
||||
text: catalog.i18nc("@button", "Materials")
|
||||
property string sourcePage: "Materials.qml"
|
||||
property bool hasSearch: true
|
||||
}
|
||||
ManagePackagesButton
|
||||
{
|
||||
property string sourcePage: "ManagedPackages.qml"
|
||||
property bool hasSearch: false
|
||||
|
||||
Cura.NotificationIcon
|
||||
anchors
|
||||
{
|
||||
anchors
|
||||
{
|
||||
horizontalCenter: parent.right
|
||||
verticalCenter: parent.top
|
||||
}
|
||||
visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
|
||||
horizontalCenter: parent.right
|
||||
verticalCenter: parent.top
|
||||
}
|
||||
visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
|
||||
|
||||
labelText:
|
||||
{
|
||||
const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length
|
||||
return itemCount > 9 ? "9+" : itemCount
|
||||
}
|
||||
labelText:
|
||||
{
|
||||
const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length
|
||||
return itemCount > 9 ? "9+" : itemCount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextMetrics
|
||||
{
|
||||
id: pluginTabTextMetrics
|
||||
text: pluginTabText.text
|
||||
font: pluginTabText.font
|
||||
}
|
||||
TextMetrics
|
||||
{
|
||||
id: materialsTabTextMetrics
|
||||
text: materialsTabText.text
|
||||
font: materialsTabText.font
|
||||
}
|
||||
TextMetrics
|
||||
{
|
||||
id: pluginTabTextMetrics
|
||||
text: pluginTabText.text
|
||||
font: pluginTabText.font
|
||||
}
|
||||
TextMetrics
|
||||
{
|
||||
id: materialsTabTextMetrics
|
||||
text: materialsTabText.text
|
||||
font: materialsTabText.font
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FontMetrics
|
||||
{
|
||||
id: fontMetrics
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
FontMetrics
|
||||
{
|
||||
id: fontMetrics
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
|
||||
Cura.TertiaryButton
|
||||
{
|
||||
text: catalog.i18nc("@info", "Search in the browser")
|
||||
iconSource: UM.Theme.getIcon("LinkExternal")
|
||||
visible: pageSelectionTabBar.currentItem.hasSearch
|
||||
isIconOnRightSide: true
|
||||
height: fontMetrics.height
|
||||
textFont: fontMetrics.font
|
||||
textColor: UM.Theme.getColor("text")
|
||||
Cura.TertiaryButton
|
||||
{
|
||||
text: catalog.i18nc("@info", "Search in the browser")
|
||||
iconSource: UM.Theme.getIcon("LinkExternal")
|
||||
visible: pageSelectionTabBar.currentItem.hasSearch
|
||||
isIconOnRightSide: true
|
||||
height: fontMetrics.height
|
||||
textFont: fontMetrics.font
|
||||
textColor: UM.Theme.getColor("text")
|
||||
|
||||
onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl)
|
||||
}
|
||||
onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl)
|
||||
}
|
||||
|
||||
// Page contents.
|
||||
Rectangle
|
||||
{
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.fillHeight: true
|
||||
color: UM.Theme.getColor("detail_background")
|
||||
|
||||
// Page contents.
|
||||
Rectangle
|
||||
Loader
|
||||
{
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.fillHeight: true
|
||||
color: UM.Theme.getColor("detail_background")
|
||||
id: content
|
||||
anchors.fill: parent
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
source: "Plugins.qml"
|
||||
|
||||
// Page contents.
|
||||
Loader
|
||||
Connections
|
||||
{
|
||||
id: content
|
||||
anchors.fill: parent
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
source: "Plugins.qml"
|
||||
|
||||
Connections
|
||||
target: content
|
||||
function onLoaded()
|
||||
{
|
||||
target: content
|
||||
function onLoaded()
|
||||
{
|
||||
pageTitle.text = content.item.pageTitle
|
||||
searchStringChanged.connect(handleSearchStringChanged)
|
||||
}
|
||||
function handleSearchStringChanged(new_search)
|
||||
{
|
||||
content.item.model.searchString = new_search
|
||||
}
|
||||
pageTitle.text = content.item.pageTitle
|
||||
searchStringChanged.connect(handleSearchStringChanged)
|
||||
}
|
||||
function handleSearchStringChanged(new_search)
|
||||
{
|
||||
content.item.model.searchString = new_search
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue