Merge branch 'master' of github.com:Ultimaker/Cura

This commit is contained in:
Jack Ha 2018-01-04 14:23:31 +01:00
commit 0d7f139cd5
10 changed files with 473 additions and 314 deletions

View File

@ -1,18 +1,58 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2017 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.2 import QtQuick 2.8
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Button { Button
id: base; {
id: base
style: UM.Theme.styles.sidebar_category; anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
background: Rectangle
{
implicitHeight: UM.Theme.getSize("section").height
color: {
if (base.color) {
return base.color;
} else if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled");
} else if (base.hovered && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active");
} else if (base.hovered) {
return UM.Theme.getColor("setting_category_hover");
} else {
return UM.Theme.getColor("setting_category");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
Rectangle
{
height: UM.Theme.getSize("default_lining").height
width: parent.width
anchors.bottom: parent.bottom
color: {
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_border");
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_border");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_border");
} else if (base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_border");
} else {
return UM.Theme.getColor("setting_category_border");
}
}
}
}
signal showTooltip(string text) signal showTooltip(string text)
signal hideTooltip() signal hideTooltip()
@ -23,20 +63,102 @@ Button {
property var focusItem: base property var focusItem: base
text: definition.label //text: definition.label
iconSource: UM.Theme.getIcon(definition.icon)
contentItem: Item {
anchors.fill: parent
anchors.left: parent.left
Label {
anchors
{
left: parent.left
leftMargin: 2 * UM.Theme.getSize("default_margin").width + UM.Theme.getSize("section_icon").width
right: parent.right;
verticalCenter: parent.verticalCenter;
}
text: definition.label
font: UM.Theme.getFont("setting_category")
color:
{
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_text");
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_text");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_text");
} else if (base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_text");
} else {
return UM.Theme.getColor("setting_category_text");
}
}
fontSizeMode: Text.HorizontalFit
minimumPointSize: 8
}
UM.RecolorImage
{
id: category_arrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width
sourceSize.height: width
color:
{
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_text");
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_text");
} else if (base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_text");
} else if (base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_text");
} else {
return UM.Theme.getColor("setting_category_text");
}
}
source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
}
}
UM.RecolorImage
{
id: icon
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
color:
{
if (!base.enabled) {
return UM.Theme.getColor("setting_category_disabled_text");
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked) {
return UM.Theme.getColor("setting_category_active_hover_text");
} else if(base.pressed || (base.checkable && base.checked)) {
return UM.Theme.getColor("setting_category_active_text");
} else if(base.hovered || base.activeFocus) {
return UM.Theme.getColor("setting_category_hover_text");
} else {
return UM.Theme.getColor("setting_category_text");
}
}
source: UM.Theme.getIcon(definition.icon)
width: UM.Theme.getSize("section_icon").width;
height: UM.Theme.getSize("section_icon").height;
sourceSize.width: width + 15 * screenScaleFactor
sourceSize.height: width + 15 * screenScaleFactor
}
checkable: true checkable: true
checked: definition.expanded checked: definition.expanded
onClicked: onClicked:
{ {
if(definition.expanded) if (definition.expanded) {
{
settingDefinitionsModel.collapse(definition.key); settingDefinitionsModel.collapse(definition.key);
} } else {
else
{
settingDefinitionsModel.expandAll(definition.key); settingDefinitionsModel.expandAll(definition.key);
} }
//Set focus so that tab navigation continues from this point on. //Set focus so that tab navigation continues from this point on.
@ -70,13 +192,14 @@ Button {
anchors { anchors {
right: inheritButton.visible ? inheritButton.left : parent.right right: inheritButton.visible ? inheritButton.left : parent.right
rightMargin: inheritButton.visible? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("setting_preferences_button_margin").width // use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
verticalCenter: parent.verticalCenter; rightMargin: inheritButton.visible ? UM.Theme.getSize("default_margin").width / 2 : category_arrow.width + UM.Theme.getSize("default_margin").width * 1.9
verticalCenter: parent.verticalCenter
} }
color: UM.Theme.getColor("setting_control_button"); color: UM.Theme.getColor("setting_control_button")
hoverColor: UM.Theme.getColor("setting_control_button_hover") hoverColor: UM.Theme.getColor("setting_control_button_hover")
iconSource: UM.Theme.getIcon("settings"); iconSource: UM.Theme.getIcon("settings")
onClicked: { onClicked: {
Cura.Actions.configureSettingVisibility.trigger(definition) Cura.Actions.configureSettingVisibility.trigger(definition)
@ -85,20 +208,20 @@ Button {
UM.SimpleButton UM.SimpleButton
{ {
id: inheritButton; id: inheritButton
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("setting_preferences_button_margin").width anchors.rightMargin: category_arrow.width + UM.Theme.getSize("default_margin").width * 2
visible: visible:
{ {
if(Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0) if (Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0)
{ {
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(definition.key) var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(definition.key)
for(var i = 0; i < children_with_override.length; i++) for (var i = 0; i < children_with_override.length; i++)
{ {
if(!settingDefinitionsModel.getVisible(children_with_override[i])) if (!settingDefinitionsModel.getVisible(children_with_override[i]))
{ {
return true return true
} }

View File

@ -1,10 +1,9 @@
// Copyright (c) 2015 Ultimaker B.V. // Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.8
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import UM 1.2 as UM import UM 1.2 as UM

View File

@ -1,9 +1,8 @@
// Copyright (c) 2015 Ultimaker B.V. // Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.8
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import UM 1.1 as UM import UM 1.1 as UM
@ -17,95 +16,103 @@ SettingItem
id: control id: control
model: definition.options model: definition.options
textRole: "value"; textRole: "value"
anchors.fill: parent anchors.fill: parent
MouseArea MouseArea
{ {
anchors.fill: parent; anchors.fill: parent
acceptedButtons: Qt.NoButton; acceptedButtons: Qt.NoButton
onWheel: wheel.accepted = true; onWheel: wheel.accepted = true
} }
style: ComboBoxStyle background: Rectangle
{ {
background: Rectangle color:
{ {
color: if (!enabled) {
{ return UM.Theme.getColor("setting_control_disabled")
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled")
}
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight")
}
return UM.Theme.getColor("setting_control")
} }
border.width: UM.Theme.getSize("default_lining").width
border.color: if (control.hovered || control.activeFocus) {
{ return UM.Theme.getColor("setting_control_highlight")
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border")
}
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
} }
return UM.Theme.getColor("setting_control")
} }
label: Item
border.width: UM.Theme.getSize("default_lining").width
border.color:
{ {
Label if (!enabled) {
{ return UM.Theme.getColor("setting_control_disabled_border")
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.right: downArrow.left;
anchors.rightMargin: UM.Theme.getSize("default_lining").width;
anchors.verticalCenter: parent.verticalCenter;
text: control.currentText;
font: UM.Theme.getFont("default");
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
elide: Text.ElideRight;
verticalAlignment: Text.AlignVCenter;
} }
UM.RecolorImage if (control.hovered || control.activeFocus) {
{ return UM.Theme.getColor("setting_control_border_highlight")
id: downArrow
anchors.right: parent.right;
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2;
anchors.verticalCenter: parent.verticalCenter;
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text");
} }
return UM.Theme.getColor("setting_control_border")
}
}
indicator: UM.RecolorImage
{
id: downArrow
x: control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text")
}
contentItem: Label
{
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.verticalCenter: parent.verticalCenter
anchors.right: downArrow.left
text: control.currentText
font: UM.Theme.getFont("default")
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
delegate: ItemDelegate
{
width: control.width
height: control.height
highlighted: control.highlightedIndex == index
contentItem: Text
{
text: modelData.value
color: control.contentItem.color
font: UM.Theme.getFont("default")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
} }
} }
onActivated: onActivated:
{ {
forceActiveFocus(); forceActiveFocus()
propertyProvider.setPropertyValue("value", definition.options[index].key); propertyProvider.setPropertyValue("value", definition.options[index].key)
} }
onActiveFocusChanged: onActiveFocusChanged:
{ {
if(activeFocus) if(activeFocus)
{ {
base.focusReceived(); base.focusReceived()
} }
} }
@ -113,6 +120,7 @@ SettingItem
{ {
base.setActiveFocusToNextSetting(true) base.setActiveFocusToNextSetting(true)
} }
Keys.onBacktabPressed: Keys.onBacktabPressed:
{ {
base.setActiveFocusToNextSetting(false) base.setActiveFocusToNextSetting(false)
@ -126,16 +134,14 @@ SettingItem
{ {
// FIXME this needs to go away once 'resolve' is combined with 'value' in our data model. // FIXME this needs to go away once 'resolve' is combined with 'value' in our data model.
var value = undefined; var value = undefined;
if ((base.resolve != "None") && (base.stackLevel != 0) && (base.stackLevel != 1)) if ((base.resolve != "None") && (base.stackLevel != 0) && (base.stackLevel != 1)) {
{
// We have a resolve function. Indicates that the setting is not settable per extruder and that // We have a resolve function. Indicates that the setting is not settable per extruder and that
// we have to choose between the resolved value (default) and the global value // we have to choose between the resolved value (default) and the global value
// (if user has explicitly set this). // (if user has explicitly set this).
value = base.resolve; value = base.resolve;
} }
if (value == undefined) if (value == undefined) {
{
value = propertyProvider.properties.value; value = propertyProvider.properties.value;
} }

View File

@ -1,9 +1,8 @@
// Copyright (c) 2016 Ultimaker B.V. // Copyright (c) 2016 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.8
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -65,83 +64,101 @@ SettingItem
value: control.currentText != "" ? control.model.getItem(control.currentIndex).color : "" value: control.currentText != "" ? control.model.getItem(control.currentIndex).color : ""
} }
style: ComboBoxStyle indicator: UM.RecolorImage
{ {
background: Rectangle id: downArrow
x: control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text");
}
background: Rectangle
{
color:
{ {
color: if (!enabled)
{ {
if(!enabled) return UM.Theme.getColor("setting_control_disabled");
{
return UM.Theme.getColor("setting_control_disabled");
}
if(control.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight");
}
return UM.Theme.getColor("setting_control");
} }
border.width: UM.Theme.getSize("default_lining").width if (control.hovered || base.activeFocus)
border.color:
{ {
if(!enabled) return UM.Theme.getColor("setting_control_highlight");
{
return UM.Theme.getColor("setting_control_disabled_border")
}
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
} }
return UM.Theme.getColor("setting_control");
} }
label: Item border.width: UM.Theme.getSize("default_lining").width
border.color:
{ {
Label if (!enabled)
{ {
id: extruderText return UM.Theme.getColor("setting_control_disabled_border")
anchors.verticalCenter: parent.verticalCenter
text: control.currentText
font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
elide: Text.ElideLeft
verticalAlignment: Text.AlignVCenter
} }
Rectangle if (control.hovered || control.activeFocus)
{ {
id: swatch return UM.Theme.getColor("setting_control_border_highlight")
height: UM.Theme.getSize("setting_control").height / 2
width: height
anchors
{
right: arrow.left
verticalCenter: parent.verticalCenter
margins: UM.Theme.getSize("default_margin").width / 4
}
border.width: UM.Theme.getSize("default_lining").width * 2
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: width / 2
color: control.color
} }
UM.RecolorImage return UM.Theme.getColor("setting_control_border")
{ }
id: arrow }
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
source: UM.Theme.getIcon("arrow_bottom") contentItem: Item
width: UM.Theme.getSize("standard_arrow").width {
height: UM.Theme.getSize("standard_arrow").height Label
sourceSize.width: width + 5 * screenScaleFactor {
sourceSize.height: width + 5 * screenScaleFactor id: extruderText
color: UM.Theme.getColor("setting_control_text") anchors.verticalCenter: parent.verticalCenter
} anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.right: swatch.left
text: control.currentText
font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
elide: Text.ElideLeft
verticalAlignment: Text.AlignVCenter
}
Rectangle
{
id: swatch
height: UM.Theme.getSize("setting_control").height / 2
width: height
anchors.right: parent.right
anchors.rightMargin: downArrow.width + UM.Theme.getSize("setting_unit_margin").width
anchors.verticalCenter: parent.verticalCenter
anchors.margins: UM.Theme.getSize("default_margin").width / 4
border.width: UM.Theme.getSize("default_lining").width
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: width / 2
color: control.color
}
}
delegate: ItemDelegate
{
width: control.width
height: control.height
highlighted: control.highlightedIndex == index
contentItem: Text
{
text: model.name
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
} }
} }
} }

View File

@ -1,10 +1,9 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2017 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.1 import QtQuick 2.8
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View File

@ -1,9 +1,8 @@
// Copyright (c) 2016 Ultimaker B.V. // Copyright (c) 2016 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.8
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -84,83 +83,101 @@ SettingItem
value: control.currentText != "" ? control.model.getItem(control.currentIndex).color : "" value: control.currentText != "" ? control.model.getItem(control.currentIndex).color : ""
} }
style: ComboBoxStyle indicator: UM.RecolorImage
{ {
background: Rectangle id: downArrow
x: control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text");
}
background: Rectangle
{
color:
{ {
color: if (!enabled)
{ {
if(!enabled) return UM.Theme.getColor("setting_control_disabled");
{
return UM.Theme.getColor("setting_control_disabled");
}
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight");
}
return UM.Theme.getColor("setting_control");
} }
border.width: UM.Theme.getSize("default_lining").width if (control.hovered || control.activeFocus)
border.color:
{ {
if(!enabled) return UM.Theme.getColor("setting_control_highlight");
{
return UM.Theme.getColor("setting_control_disabled_border")
}
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
} }
return UM.Theme.getColor("setting_control");
} }
label: Item border.width: UM.Theme.getSize("default_lining").width
border.color:
{ {
Label if (!enabled)
{ {
anchors.verticalCenter: parent.verticalCenter return UM.Theme.getColor("setting_control_disabled_border")
width: parent.width - swatch.width - arrow.width;
text: control.currentText
font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
} }
Rectangle if (control.hovered || control.activeFocus)
{ {
id: swatch return UM.Theme.getColor("setting_control_border_highlight")
height: UM.Theme.getSize("setting_control").height / 2
width: height
anchors
{
right: arrow.left;
verticalCenter: parent.verticalCenter
margins: UM.Theme.getSize("default_margin").width / 4
}
border.width: UM.Theme.getSize("default_lining").width * 2
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: width / 2
color: control.color
} }
UM.RecolorImage return UM.Theme.getColor("setting_control_border")
{ }
id: arrow }
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
source: UM.Theme.getIcon("arrow_bottom") contentItem: Item
width: UM.Theme.getSize("standard_arrow").width {
height: UM.Theme.getSize("standard_arrow").height Label
sourceSize.width: width + 5 * screenScaleFactor {
sourceSize.height: width + 5 * screenScaleFactor id: extruderText
color: UM.Theme.getColor("setting_control_text") anchors.verticalCenter: parent.verticalCenter
} anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.right: swatch.left
text: control.currentText
font: UM.Theme.getFont("default")
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
Rectangle
{
id: swatch
height: UM.Theme.getSize("setting_control").height / 2
width: height
anchors.right: parent.right
anchors.rightMargin: downArrow.width + UM.Theme.getSize("setting_unit_margin").width
anchors.verticalCenter: parent.verticalCenter
anchors.margins: UM.Theme.getSize("default_margin").width / 4
border.width: UM.Theme.getSize("default_lining").width
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: width / 2
color: control.color
}
}
delegate: ItemDelegate
{
width: control.width
height: control.height
highlighted: control.highlightedIndex == index
contentItem: Text
{
text: model.name
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
} }
} }
} }

View File

@ -1,8 +1,8 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2017 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.2 import QtQuick 2.8
import QtQuick.Controls 1.2 import QtQuick.Controls 2.1
import UM 1.1 as UM import UM 1.1 as UM

View File

@ -1,8 +1,8 @@
// Copyright (c) 2015 Ultimaker B.V. // Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.8
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import UM 1.2 as UM import UM 1.2 as UM

View File

@ -1,7 +1,7 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2017 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.8
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1

View File

@ -1,9 +1,8 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2017 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.2 import QtQuick 2.8
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import UM 1.2 as UM import UM 1.2 as UM
@ -12,9 +11,9 @@ import "Menus"
Rectangle Rectangle
{ {
id: base; id: base
property int currentModeIndex; property int currentModeIndex
property bool hideSettings: PrintInformation.preSliced property bool hideSettings: PrintInformation.preSliced
property bool hideView: Cura.MachineManager.activeMachineName == "" property bool hideView: Cura.MachineManager.activeMachineName == ""
@ -78,7 +77,7 @@ Rectangle
MouseArea MouseArea
{ {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.AllButtons; acceptedButtons: Qt.AllButtons
onWheel: onWheel:
{ {
@ -119,13 +118,14 @@ Rectangle
UM.Preferences.setValue("cura/active_mode", currentModeIndex); UM.Preferences.setValue("cura/active_mode", currentModeIndex);
if(modesListModel.count > base.currentModeIndex) if(modesListModel.count > base.currentModeIndex)
{ {
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "replace": true }); sidebarContents.replace(modesListModel.get(base.currentModeIndex).item, { "replace": true })
} }
} }
Label { Label
{
id: settingsModeLabel id: settingsModeLabel
text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified"); text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox", "Print Setup disabled\nG-code files cannot be modified")
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.top: headerSeparator.bottom anchors.top: headerSeparator.bottom
@ -136,13 +136,18 @@ Rectangle
visible: !monitoringPrint && !hideView visible: !monitoringPrint && !hideView
} }
Rectangle { // Settings mode selection toggle
Rectangle
{
id: settingsModeSelection id: settingsModeSelection
color: "transparent" color: "transparent"
width: Math.floor(parent.width * 0.55) width: Math.floor(parent.width * 0.55)
height: UM.Theme.getSize("sidebar_header_mode_toggle").height height: UM.Theme.getSize("sidebar_header_mode_toggle").height
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
anchors.top: anchors.top:
{ {
if (settingsModeLabel.contentWidth >= parent.width - width - UM.Theme.getSize("sidebar_margin").width * 2) if (settingsModeLabel.contentWidth >= parent.width - width - UM.Theme.getSize("sidebar_margin").width * 2)
@ -154,66 +159,69 @@ Rectangle
return headerSeparator.bottom; return headerSeparator.bottom;
} }
} }
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
visible: !monitoringPrint && !hideSettings && !hideView visible: !monitoringPrint && !hideSettings && !hideView
Component{
Component
{
id: wizardDelegate id: wizardDelegate
Button {
Button
{
id: control
height: settingsModeSelection.height height: settingsModeSelection.height
width: Math.floor(0.5 * parent.width)
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: model.index * Math.floor(settingsModeSelection.width / 2) anchors.leftMargin: model.index * Math.floor(settingsModeSelection.width / 2)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: Math.floor(0.5 * parent.width)
text: model.text ButtonGroup.group: modeMenuGroup
exclusiveGroup: modeMenuGroup;
checkable: true; checkable: true
checked: base.currentModeIndex == index checked: base.currentModeIndex == index
onClicked: base.currentModeIndex = index onClicked: base.currentModeIndex = index
onHoveredChanged: { onHoveredChanged:
{
if (hovered) if (hovered)
{ {
tooltipDelayTimer.item = settingsModeSelection tooltipDelayTimer.item = settingsModeSelection
tooltipDelayTimer.text = model.tooltipText tooltipDelayTimer.text = model.tooltipText
tooltipDelayTimer.start(); tooltipDelayTimer.start()
} }
else else
{ {
tooltipDelayTimer.stop(); tooltipDelayTimer.stop()
base.hideTooltip(); base.hideTooltip()
} }
} }
style: ButtonStyle { background: Rectangle
background: Rectangle { {
border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border"): UM.Theme.getColor("action_button_border")
control.hovered ? UM.Theme.getColor("action_button_hovered_border") :
UM.Theme.getColor("action_button_border") // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is
color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
control.hovered ? UM.Theme.getColor("action_button_hovered") : }
UM.Theme.getColor("action_button")
Behavior on color { ColorAnimation { duration: 50; } } contentItem: Text
Label { {
anchors.left: parent.left text: model.text
anchors.right: parent.right font: UM.Theme.getFont("default")
anchors.verticalCenter: parent.verticalCenter horizontalAlignment: Text.AlignHCenter
anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 verticalAlignment: Text.AlignVCenter
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 elide: Text.ElideRight
color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") :
control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
UM.Theme.getColor("action_button_text")
font: UM.Theme.getFont("default")
text: control.text
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
}
}
label: Item { }
} }
} }
} }
ExclusiveGroup { id: modeMenuGroup; }
ButtonGroup
{
id: modeMenuGroup
}
ListView ListView
{ {
@ -238,31 +246,21 @@ Rectangle
anchors.right: base.right anchors.right: base.right
visible: !monitoringPrint && !hideSettings visible: !monitoringPrint && !hideSettings
delegate: StackViewDelegate replaceEnter: Transition {
{ PropertyAnimation {
function transitionFinished(properties) property: "opacity"
{ from: 0
properties.exitItem.opacity = 1 to:1
duration: 100
} }
}
pushTransition: StackViewTransition replaceExit: Transition {
{ PropertyAnimation {
PropertyAnimation property: "opacity"
{ from: 1
target: enterItem to:0
property: "opacity" duration: 100
from: 0
to: 1
duration: 100
}
PropertyAnimation
{
target: exitItem
property: "opacity"
from: 1
to: 0
duration: 100
}
} }
} }
} }
@ -559,19 +557,19 @@ Rectangle
SidebarTooltip SidebarTooltip
{ {
id: tooltip; id: tooltip
} }
// Setting mode: Recommended or Custom // Setting mode: Recommended or Custom
ListModel ListModel
{ {
id: modesListModel; id: modesListModel
} }
SidebarSimple SidebarSimple
{ {
id: sidebarSimple; id: sidebarSimple
visible: false; visible: false
onShowTooltip: base.showTooltip(item, location, text) onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip() onHideTooltip: base.hideTooltip()
@ -579,8 +577,8 @@ Rectangle
SidebarAdvanced SidebarAdvanced
{ {
id: sidebarAdvanced; id: sidebarAdvanced
visible: false; visible: false
onShowTooltip: base.showTooltip(item, location, text) onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip() onHideTooltip: base.hideTooltip()
@ -598,7 +596,7 @@ Rectangle
tooltipText: catalog.i18nc("@tooltip", "<b>Custom Print Setup</b><br/><br/>Print with finegrained control over every last bit of the slicing process."), tooltipText: catalog.i18nc("@tooltip", "<b>Custom Print Setup</b><br/><br/>Print with finegrained control over every last bit of the slicing process."),
item: sidebarAdvanced item: sidebarAdvanced
}) })
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true }); sidebarContents.replace(modesListModel.get(base.currentModeIndex).item, { "immediate": true })
var index = Math.floor(UM.Preferences.getValue("cura/active_mode")) var index = Math.floor(UM.Preferences.getValue("cura/active_mode"))
if(index) if(index)