boy scouting

CURA-8975
This commit is contained in:
casper 2022-03-09 15:59:21 +01:00
parent f9a5cb33fd
commit 418f88a4da
5 changed files with 75 additions and 87 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2019 Ultimaker B.V.
// Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -26,7 +26,7 @@ Item
id: brand_header_background
color:
{
if(!expanded && sectionName == materialList.currentBrand)
if (!expanded && sectionName == materialList.currentBrand)
{
return UM.Theme.getColor("favorites_row_selected")
}
@ -47,7 +47,7 @@ Item
text: sectionName
height: UM.Theme.getSize("favorites_row").height
width: parent.width - UM.Theme.getSize("favorites_button").width
leftPadding: (UM.Theme.getSize("default_margin").width / 2) | 0
leftPadding: Math.round(UM.Theme.getSize("default_margin").width / 2)
}
Item
{

View file

@ -1,12 +1,11 @@
// Copyright (c) 2018 Ultimaker B.V.
// Copyright (c) 2022 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.4
import UM 1.2 as UM
import Cura 1.0 as Cura
import UM 1.5 as UM
import Cura 1.5 as Cura
Item
{
@ -51,71 +50,62 @@ Item
materialProperties.approximate_diameter = currentItem.approximate_diameter || "0"
}
Item
{
anchors.fill: parent
// Material title Label
UM.Label {
id: profileName
Item // Material title Label
{
id: profileName
width: parent.width
height: childrenRect.height
Label {
width: parent.width
text: materialProperties.name
font: UM.Theme.getFont("large_bold")
elide: Text.ElideRight
}
}
MaterialsView // Material detailed information view below the title Label
{
id: materialDetailsView
anchors
{
left: parent.left
right: parent.right
top: profileName.bottom
topMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
}
editingEnabled: currentItem != null && !currentItem.is_read_only
onResetSelectedMaterial: base.resetExpandedActiveMaterial()
properties: materialProperties
containerId: currentItem != null ? currentItem.id : ""
currentMaterialNode: currentItem.container_node
}
QtObject
{
id: materialProperties
property string guid: "00000000-0000-0000-0000-000000000000"
property string container_id: "Unknown";
property string name: "Unknown";
property string profile_type: "Unknown";
property string brand: "Unknown";
property string material: "Unknown"; // This needs to be named as "material" to be consistent with
// the material container's metadata entry
property string color_name: "Yellow";
property color color_code: "yellow";
property real density: 0.0;
property real diameter: 0.0;
property string approximate_diameter: "0";
property real spool_cost: 0.0;
property real spool_weight: 0.0;
property real spool_length: 0.0;
property real cost_per_meter: 0.0;
property string description: "";
property string adhesion_info: "";
}
width: parent.width
text: materialProperties.name
font: UM.Theme.getFont("large_bold")
elide: Text.ElideRight
}
}
// Material detailed information view below the title Label
MaterialsView
{
id: materialDetailsView
anchors
{
left: parent.left
right: parent.right
top: profileName.bottom
topMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
}
editingEnabled: currentItem != null && !currentItem.is_read_only
onResetSelectedMaterial: base.resetExpandedActiveMaterial()
properties: materialProperties
containerId: currentItem != null ? currentItem.id : ""
currentMaterialNode: currentItem.container_node
}
QtObject
{
id: materialProperties
property string guid: "00000000-0000-0000-0000-000000000000"
property string container_id: "Unknown";
property string name: "Unknown";
property string profile_type: "Unknown";
property string brand: "Unknown";
property string material: "Unknown"; // This needs to be named as "material" to be consistent with
// the material container's metadata entry
property string color_name: "Yellow";
property color color_code: "yellow";
property real density: 0.0;
property real diameter: 0.0;
property string approximate_diameter: "0";
property real spool_cost: 0.0;
property real spool_weight: 0.0;
property real spool_length: 0.0;
property real cost_per_meter: 0.0;
property string description: "";
property string adhesion_info: "";
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2019 Ultimaker B.V.
// Copyright (c) 2022 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -14,7 +14,6 @@ Item
height: childrenRect.height
// Children
UM.I18nCatalog { id: catalog; name: "cura"; }
Cura.MaterialBrandsModel
{
id: materialsModel

View file

@ -5,8 +5,8 @@ import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.2 as UM
import Cura 1.0 as Cura
import UM 1.5 as UM
import Cura 1.5 as Cura
// A single material row, typically used in a MaterialsBrandSection
@ -19,17 +19,16 @@ Rectangle
height: UM.Theme.getSize("favorites_row").height
width: parent.width
//color: material != null ? (base.currentItem.root_material_id == material.root_material_id ? UM.Theme.getColor("favorites_row_selected") : "transparent") : "transparent"
color:
{
if(material !== null && base.currentItem !== null)
if (material !== null && base.currentItem !== null)
{
if(base.currentItem.root_material_id === material.root_material_id)
if (base.currentItem.root_material_id === material.root_material_id)
{
return UM.Theme.getColor("favorites_row_selected")
return UM.Theme.getColor("favorites_row_selected");
}
}
return "transparent"
return "transparent";
}
Rectangle
{
@ -42,7 +41,7 @@ Rectangle
anchors.left: materialSlot.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
}
Label
UM.Label
{
text: material != null ? material.brand + " " + material.name : ""
verticalAlignment: Text.AlignVCenter

View file

@ -1,4 +1,4 @@
// Copyright (c) 2018 Ultimaker B.V.
// Copyright (c) 2022 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
@ -18,14 +18,14 @@ Item
property var expanded: materialList.expandedTypes.indexOf(materialBrand + "_" + materialName) > -1
property var colorsModel: materialType != null ? materialType.colors: null
height: childrenRect.height
width: parent ? parent.width :undefined
width: parent ? parent.width : undefined
anchors.left: parent ? parent.left : undefined
Rectangle
{
id: material_type_header_background
color:
{
if(!expanded && materialBrand + "_" + materialName == materialList.currentType)
if (!expanded && `${materialBrand}_${materialName}` == materialList.currentType)
{
return UM.Theme.getColor("favorites_row_selected")
}