mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Brackets on new line
As per our code style.
This commit is contained in:
parent
0d293ddced
commit
49e3c23d14
1 changed files with 161 additions and 79 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Ultimaker B.V.
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
|
@ -12,30 +12,43 @@ import Cura 1.0 as Cura
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
width: {
|
width:
|
||||||
if (UM.SimulationView.compatibilityMode) {
|
{
|
||||||
|
if (UM.SimulationView.compatibilityMode)
|
||||||
|
{
|
||||||
return UM.Theme.getSize("layerview_menu_size_compatibility").width;
|
return UM.Theme.getSize("layerview_menu_size_compatibility").width;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return UM.Theme.getSize("layerview_menu_size").width;
|
return UM.Theme.getSize("layerview_menu_size").width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
height: {
|
height: {
|
||||||
if (viewSettings.collapsed) {
|
if (viewSettings.collapsed)
|
||||||
if (UM.SimulationView.compatibilityMode) {
|
{
|
||||||
|
if (UM.SimulationView.compatibilityMode)
|
||||||
|
{
|
||||||
return UM.Theme.getSize("layerview_menu_size_compatibility_collapsed").height;
|
return UM.Theme.getSize("layerview_menu_size_compatibility_collapsed").height;
|
||||||
}
|
}
|
||||||
return UM.Theme.getSize("layerview_menu_size_collapsed").height;
|
return UM.Theme.getSize("layerview_menu_size_collapsed").height;
|
||||||
} else if (UM.SimulationView.compatibilityMode) {
|
}
|
||||||
|
else if (UM.SimulationView.compatibilityMode)
|
||||||
|
{
|
||||||
return UM.Theme.getSize("layerview_menu_size_compatibility").height;
|
return UM.Theme.getSize("layerview_menu_size_compatibility").height;
|
||||||
} else if (UM.Preferences.getValue("layerview/layer_view_type") == 0) {
|
}
|
||||||
|
else if (UM.Preferences.getValue("layerview/layer_view_type") == 0)
|
||||||
|
{
|
||||||
return UM.Theme.getSize("layerview_menu_size_material_color_mode").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
return UM.Theme.getSize("layerview_menu_size_material_color_mode").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return UM.Theme.getSize("layerview_menu_size").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
return UM.Theme.getSize("layerview_menu_size").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on height { NumberAnimation { duration: 100 } }
|
Behavior on height { NumberAnimation { duration: 100 } }
|
||||||
|
|
||||||
property var buttonTarget: {
|
property var buttonTarget:
|
||||||
|
{
|
||||||
if(parent != null)
|
if(parent != null)
|
||||||
{
|
{
|
||||||
var force_binding = parent.y; // ensure this gets reevaluated when the panel moves
|
var force_binding = parent.y; // ensure this gets reevaluated when the panel moves
|
||||||
|
@ -44,7 +57,8 @@ Item
|
||||||
return Qt.point(0,0)
|
return Qt.point(0,0)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: layerViewMenu
|
id: layerViewMenu
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -83,7 +97,8 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout
|
||||||
|
{
|
||||||
id: viewSettings
|
id: viewSettings
|
||||||
|
|
||||||
property bool collapsed: false
|
property bool collapsed: false
|
||||||
|
@ -195,7 +210,8 @@ Item
|
||||||
width: width
|
width: width
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections
|
||||||
|
{
|
||||||
target: UM.Preferences
|
target: UM.Preferences
|
||||||
onPreferenceChanged:
|
onPreferenceChanged:
|
||||||
{
|
{
|
||||||
|
@ -212,18 +228,22 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater
|
||||||
|
{
|
||||||
model: Cura.ExtrudersModel{}
|
model: Cura.ExtrudersModel{}
|
||||||
CheckBox {
|
CheckBox
|
||||||
|
{
|
||||||
id: extrudersModelCheckBox
|
id: extrudersModelCheckBox
|
||||||
checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == ""
|
checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == ""
|
||||||
onClicked: {
|
onClicked:
|
||||||
|
{
|
||||||
viewSettings.extruder_opacities[index] = checked ? 1.0 : 0.0
|
viewSettings.extruder_opacities[index] = checked ? 1.0 : 0.0
|
||||||
UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|"));
|
UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|"));
|
||||||
}
|
}
|
||||||
visible: !UM.SimulationView.compatibilityMode
|
visible: !UM.SimulationView.compatibilityMode
|
||||||
enabled: index + 1 <= 4
|
enabled: index + 1 <= 4
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: extrudersModelCheckBox.right
|
anchors.right: extrudersModelCheckBox.right
|
||||||
width: UM.Theme.getSize("layerview_legend_size").width
|
width: UM.Theme.getSize("layerview_legend_size").width
|
||||||
|
@ -253,8 +273,10 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater
|
||||||
model: ListModel {
|
{
|
||||||
|
model: ListModel
|
||||||
|
{
|
||||||
id: typesLegendModel
|
id: typesLegendModel
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
|
@ -285,13 +307,16 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox
|
||||||
|
{
|
||||||
id: legendModelCheckBox
|
id: legendModelCheckBox
|
||||||
checked: model.initialValue
|
checked: model.initialValue
|
||||||
onClicked: {
|
onClicked:
|
||||||
|
{
|
||||||
UM.Preferences.setValue(model.preference, checked);
|
UM.Preferences.setValue(model.preference, checked);
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: legendModelCheckBox.right
|
anchors.right: legendModelCheckBox.right
|
||||||
width: UM.Theme.getSize("layerview_legend_size").width
|
width: UM.Theme.getSize("layerview_legend_size").width
|
||||||
|
@ -320,18 +345,22 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox
|
||||||
|
{
|
||||||
checked: viewSettings.only_show_top_layers
|
checked: viewSettings.only_show_top_layers
|
||||||
onClicked: {
|
onClicked:
|
||||||
|
{
|
||||||
UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0);
|
UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0);
|
||||||
}
|
}
|
||||||
text: catalog.i18nc("@label", "Only Show Top Layers")
|
text: catalog.i18nc("@label", "Only Show Top Layers")
|
||||||
visible: UM.SimulationView.compatibilityMode
|
visible: UM.SimulationView.compatibilityMode
|
||||||
style: UM.Theme.styles.checkbox
|
style: UM.Theme.styles.checkbox
|
||||||
}
|
}
|
||||||
CheckBox {
|
CheckBox
|
||||||
|
{
|
||||||
checked: viewSettings.top_layer_count == 5
|
checked: viewSettings.top_layer_count == 5
|
||||||
onClicked: {
|
onClicked:
|
||||||
|
{
|
||||||
UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1);
|
UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1);
|
||||||
}
|
}
|
||||||
text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top")
|
text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top")
|
||||||
|
@ -339,8 +368,10 @@ Item
|
||||||
style: UM.Theme.styles.checkbox
|
style: UM.Theme.styles.checkbox
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater
|
||||||
model: ListModel {
|
{
|
||||||
|
model: ListModel
|
||||||
|
{
|
||||||
id: typesLegendModelNoCheck
|
id: typesLegendModelNoCheck
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
|
@ -355,11 +386,13 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label
|
||||||
|
{
|
||||||
text: label
|
text: label
|
||||||
visible: viewSettings.show_legend
|
visible: viewSettings.show_legend
|
||||||
id: typesLegendModelLabel
|
id: typesLegendModelLabel
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: typesLegendModelLabel.right
|
anchors.right: typesLegendModelLabel.right
|
||||||
width: UM.Theme.getSize("layerview_legend_size").width
|
width: UM.Theme.getSize("layerview_legend_size").width
|
||||||
|
@ -378,30 +411,37 @@ Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text for the minimum, maximum and units for the feedrates and layer thickness
|
// Text for the minimum, maximum and units for the feedrates and layer thickness
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
id: gradientLegend
|
id: gradientLegend
|
||||||
visible: viewSettings.show_gradient
|
visible: viewSettings.show_gradient
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("layerview_row").height
|
height: UM.Theme.getSize("layerview_row").height
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
topMargin: UM.Theme.getSize("slider_layerview_margin").height
|
topMargin: UM.Theme.getSize("slider_layerview_margin").height
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label
|
||||||
|
{
|
||||||
text: minText()
|
text: minText()
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
color: UM.Theme.getColor("setting_control_text")
|
color: UM.Theme.getColor("setting_control_text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
|
||||||
function minText() {
|
function minText()
|
||||||
if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) {
|
{
|
||||||
|
if (UM.SimulationView.layerActivity && CuraApplication.platformActivity)
|
||||||
|
{
|
||||||
// Feedrate selected
|
// Feedrate selected
|
||||||
if (UM.Preferences.getValue("layerview/layer_view_type") == 2) {
|
if (UM.Preferences.getValue("layerview/layer_view_type") == 2)
|
||||||
|
{
|
||||||
return parseFloat(UM.SimulationView.getMinFeedrate()).toFixed(2)
|
return parseFloat(UM.SimulationView.getMinFeedrate()).toFixed(2)
|
||||||
}
|
}
|
||||||
// Layer thickness selected
|
// Layer thickness selected
|
||||||
if (UM.Preferences.getValue("layerview/layer_view_type") == 3) {
|
if (UM.Preferences.getValue("layerview/layer_view_type") == 3)
|
||||||
|
{
|
||||||
return parseFloat(UM.SimulationView.getMinThickness()).toFixed(2)
|
return parseFloat(UM.SimulationView.getMinThickness()).toFixed(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -409,20 +449,25 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label
|
||||||
|
{
|
||||||
text: unitsText()
|
text: unitsText()
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
color: UM.Theme.getColor("setting_control_text")
|
color: UM.Theme.getColor("setting_control_text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
|
||||||
function unitsText() {
|
function unitsText()
|
||||||
if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) {
|
{
|
||||||
|
if (UM.SimulationView.layerActivity && CuraApplication.platformActivity)
|
||||||
|
{
|
||||||
// Feedrate selected
|
// Feedrate selected
|
||||||
if (UM.Preferences.getValue("layerview/layer_view_type") == 2) {
|
if (UM.Preferences.getValue("layerview/layer_view_type") == 2)
|
||||||
|
{
|
||||||
return "mm/s"
|
return "mm/s"
|
||||||
}
|
}
|
||||||
// Layer thickness selected
|
// Layer thickness selected
|
||||||
if (UM.Preferences.getValue("layerview/layer_view_type") == 3) {
|
if (UM.Preferences.getValue("layerview/layer_view_type") == 3)
|
||||||
|
{
|
||||||
return "mm"
|
return "mm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,20 +475,25 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label
|
||||||
|
{
|
||||||
text: maxText()
|
text: maxText()
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: UM.Theme.getColor("setting_control_text")
|
color: UM.Theme.getColor("setting_control_text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
|
||||||
function maxText() {
|
function maxText()
|
||||||
if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) {
|
{
|
||||||
|
if (UM.SimulationView.layerActivity && CuraApplication.platformActivity)
|
||||||
|
{
|
||||||
// Feedrate selected
|
// Feedrate selected
|
||||||
if (UM.Preferences.getValue("layerview/layer_view_type") == 2) {
|
if (UM.Preferences.getValue("layerview/layer_view_type") == 2)
|
||||||
|
{
|
||||||
return parseFloat(UM.SimulationView.getMaxFeedrate()).toFixed(2)
|
return parseFloat(UM.SimulationView.getMaxFeedrate()).toFixed(2)
|
||||||
}
|
}
|
||||||
// Layer thickness selected
|
// Layer thickness selected
|
||||||
if (UM.Preferences.getValue("layerview/layer_view_type") == 3) {
|
if (UM.Preferences.getValue("layerview/layer_view_type") == 3)
|
||||||
|
{
|
||||||
return parseFloat(UM.SimulationView.getMaxThickness()).toFixed(2)
|
return parseFloat(UM.SimulationView.getMaxThickness()).toFixed(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -453,7 +503,8 @@ Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gradient colors for feedrate
|
// Gradient colors for feedrate
|
||||||
Rectangle { // In QML 5.9 can be changed by LinearGradient
|
Rectangle
|
||||||
|
{ // In QML 5.9 can be changed by LinearGradient
|
||||||
// Invert values because then the bar is rotated 90 degrees
|
// Invert values because then the bar is rotated 90 degrees
|
||||||
id: feedrateGradient
|
id: feedrateGradient
|
||||||
visible: viewSettings.show_feedrate_gradient
|
visible: viewSettings.show_feedrate_gradient
|
||||||
|
@ -463,20 +514,25 @@ Item
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90}
|
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90}
|
||||||
gradient: Gradient {
|
gradient: Gradient
|
||||||
GradientStop {
|
{
|
||||||
|
GradientStop
|
||||||
|
{
|
||||||
position: 0.000
|
position: 0.000
|
||||||
color: Qt.rgba(1, 0.5, 0, 1)
|
color: Qt.rgba(1, 0.5, 0, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop
|
||||||
|
{
|
||||||
position: 0.625
|
position: 0.625
|
||||||
color: Qt.rgba(0.375, 0.5, 0, 1)
|
color: Qt.rgba(0.375, 0.5, 0, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop
|
||||||
|
{
|
||||||
position: 0.75
|
position: 0.75
|
||||||
color: Qt.rgba(0.25, 1, 0, 1)
|
color: Qt.rgba(0.25, 1, 0, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop
|
||||||
|
{
|
||||||
position: 1.0
|
position: 1.0
|
||||||
color: Qt.rgba(0, 0, 1, 1)
|
color: Qt.rgba(0, 0, 1, 1)
|
||||||
}
|
}
|
||||||
|
@ -484,7 +540,8 @@ Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gradient colors for layer thickness (similar to parula colormap)
|
// Gradient colors for layer thickness (similar to parula colormap)
|
||||||
Rectangle { // In QML 5.9 can be changed by LinearGradient
|
Rectangle // In QML 5.9 can be changed by LinearGradient
|
||||||
|
{
|
||||||
// Invert values because then the bar is rotated 90 degrees
|
// Invert values because then the bar is rotated 90 degrees
|
||||||
id: thicknessGradient
|
id: thicknessGradient
|
||||||
visible: viewSettings.show_thickness_gradient
|
visible: viewSettings.show_thickness_gradient
|
||||||
|
@ -494,24 +551,30 @@ Item
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90}
|
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90}
|
||||||
gradient: Gradient {
|
gradient: Gradient
|
||||||
GradientStop {
|
{
|
||||||
|
GradientStop
|
||||||
|
{
|
||||||
position: 0.000
|
position: 0.000
|
||||||
color: Qt.rgba(1, 1, 0, 1)
|
color: Qt.rgba(1, 1, 0, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop
|
||||||
|
{
|
||||||
position: 0.25
|
position: 0.25
|
||||||
color: Qt.rgba(1, 0.75, 0.25, 1)
|
color: Qt.rgba(1, 0.75, 0.25, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop
|
||||||
|
{
|
||||||
position: 0.5
|
position: 0.5
|
||||||
color: Qt.rgba(0, 0.75, 0.5, 1)
|
color: Qt.rgba(0, 0.75, 0.5, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop
|
||||||
|
{
|
||||||
position: 0.75
|
position: 0.75
|
||||||
color: Qt.rgba(0, 0.375, 0.75, 1)
|
color: Qt.rgba(0, 0.375, 0.75, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop
|
||||||
|
{
|
||||||
position: 1.0
|
position: 1.0
|
||||||
color: Qt.rgba(0, 0, 0.5, 1)
|
color: Qt.rgba(0, 0, 0.5, 1)
|
||||||
}
|
}
|
||||||
|
@ -520,19 +583,22 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
id: slidersBox
|
id: slidersBox
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
|
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
|
||||||
|
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
top: parent.bottom
|
top: parent.bottom
|
||||||
topMargin: UM.Theme.getSize("slider_layerview_margin").height
|
topMargin: UM.Theme.getSize("slider_layerview_margin").height
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
PathSlider {
|
PathSlider
|
||||||
|
{
|
||||||
id: pathSlider
|
id: pathSlider
|
||||||
|
|
||||||
height: UM.Theme.getSize("slider_handle").width
|
height: UM.Theme.getSize("slider_handle").width
|
||||||
|
@ -553,25 +619,29 @@ Item
|
||||||
rangeColor: UM.Theme.getColor("slider_groove_fill")
|
rangeColor: UM.Theme.getColor("slider_groove_fill")
|
||||||
|
|
||||||
// update values when layer data changes
|
// update values when layer data changes
|
||||||
Connections {
|
Connections
|
||||||
|
{
|
||||||
target: UM.SimulationView
|
target: UM.SimulationView
|
||||||
onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
onCurrentPathChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
onCurrentPathChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the slider handlers show the correct value after switching views
|
// make sure the slider handlers show the correct value after switching views
|
||||||
Component.onCompleted: {
|
Component.onCompleted:
|
||||||
|
{
|
||||||
pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerSlider {
|
LayerSlider
|
||||||
|
{
|
||||||
id: layerSlider
|
id: layerSlider
|
||||||
|
|
||||||
width: UM.Theme.getSize("slider_handle").width
|
width: UM.Theme.getSize("slider_handle").width
|
||||||
height: UM.Theme.getSize("layerview_menu_size").height
|
height: UM.Theme.getSize("layerview_menu_size").height
|
||||||
|
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
top: !UM.SimulationView.compatibilityMode ? pathSlider.bottom : parent.top
|
top: !UM.SimulationView.compatibilityMode ? pathSlider.bottom : parent.top
|
||||||
topMargin: !UM.SimulationView.compatibilityMode ? UM.Theme.getSize("default_margin").height : 0
|
topMargin: !UM.SimulationView.compatibilityMode ? UM.Theme.getSize("default_margin").height : 0
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
@ -593,7 +663,8 @@ Item
|
||||||
handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width
|
handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width
|
||||||
|
|
||||||
// update values when layer data changes
|
// update values when layer data changes
|
||||||
Connections {
|
Connections
|
||||||
|
{
|
||||||
target: UM.SimulationView
|
target: UM.SimulationView
|
||||||
onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
||||||
|
@ -601,45 +672,54 @@ Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the slider handlers show the correct value after switching views
|
// make sure the slider handlers show the correct value after switching views
|
||||||
Component.onCompleted: {
|
Component.onCompleted:
|
||||||
|
{
|
||||||
layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
||||||
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play simulation button
|
// Play simulation button
|
||||||
Button {
|
Button
|
||||||
|
{
|
||||||
id: playButton
|
id: playButton
|
||||||
iconSource: "./resources/simulation_resume.svg"
|
iconSource: "./resources/simulation_resume.svg"
|
||||||
style: UM.Theme.styles.small_tool_button
|
style: UM.Theme.styles.small_tool_button
|
||||||
visible: !UM.SimulationView.compatibilityMode
|
visible: !UM.SimulationView.compatibilityMode
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
verticalCenter: pathSlider.verticalCenter
|
verticalCenter: pathSlider.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
property var status: 0 // indicates if it's stopped (0) or playing (1)
|
property var status: 0 // indicates if it's stopped (0) or playing (1)
|
||||||
|
|
||||||
onClicked: {
|
onClicked:
|
||||||
switch(status) {
|
{
|
||||||
case 0: {
|
switch(status)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
resumeSimulation()
|
resumeSimulation()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1:
|
||||||
|
{
|
||||||
pauseSimulation()
|
pauseSimulation()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pauseSimulation() {
|
function pauseSimulation()
|
||||||
|
{
|
||||||
UM.SimulationView.setSimulationRunning(false)
|
UM.SimulationView.setSimulationRunning(false)
|
||||||
iconSource = "./resources/simulation_resume.svg"
|
iconSource = "./resources/simulation_resume.svg"
|
||||||
simulationTimer.stop()
|
simulationTimer.stop()
|
||||||
status = 0
|
status = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function resumeSimulation() {
|
function resumeSimulation()
|
||||||
|
{
|
||||||
UM.SimulationView.setSimulationRunning(true)
|
UM.SimulationView.setSimulationRunning(true)
|
||||||
iconSource = "./resources/simulation_pause.svg"
|
iconSource = "./resources/simulation_pause.svg"
|
||||||
simulationTimer.start()
|
simulationTimer.start()
|
||||||
|
@ -652,7 +732,8 @@ Item
|
||||||
interval: 100
|
interval: 100
|
||||||
running: false
|
running: false
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: {
|
onTriggered:
|
||||||
|
{
|
||||||
var currentPath = UM.SimulationView.currentPath
|
var currentPath = UM.SimulationView.currentPath
|
||||||
var numPaths = UM.SimulationView.numPaths
|
var numPaths = UM.SimulationView.numPaths
|
||||||
var currentLayer = UM.SimulationView.currentLayer
|
var currentLayer = UM.SimulationView.currentLayer
|
||||||
|
@ -697,7 +778,8 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FontMetrics {
|
FontMetrics
|
||||||
|
{
|
||||||
id: fontMetrics
|
id: fontMetrics
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue