mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Merge branch 'master' of github.com:Ultimaker/Cura into network_rewrite
This commit is contained in:
commit
ed9634ebe0
77 changed files with 2675 additions and 791 deletions
|
@ -1,9 +1,8 @@
|
|||
// Copyright (c) 2015 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
import UM 1.1 as UM
|
||||
|
||||
|
@ -17,95 +16,103 @@ SettingItem
|
|||
id: control
|
||||
|
||||
model: definition.options
|
||||
textRole: "value";
|
||||
textRole: "value"
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent;
|
||||
acceptedButtons: Qt.NoButton;
|
||||
onWheel: wheel.accepted = true;
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.NoButton
|
||||
onWheel: wheel.accepted = true
|
||||
}
|
||||
|
||||
style: ComboBoxStyle
|
||||
background: Rectangle
|
||||
{
|
||||
background: Rectangle
|
||||
color:
|
||||
{
|
||||
color:
|
||||
{
|
||||
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")
|
||||
if (!enabled) {
|
||||
return UM.Theme.getColor("setting_control_disabled")
|
||||
}
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
{
|
||||
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")
|
||||
|
||||
if (control.hovered || control.activeFocus) {
|
||||
return UM.Theme.getColor("setting_control_highlight")
|
||||
}
|
||||
|
||||
return UM.Theme.getColor("setting_control")
|
||||
}
|
||||
label: Item
|
||||
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
{
|
||||
Label
|
||||
{
|
||||
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;
|
||||
if (!enabled) {
|
||||
return UM.Theme.getColor("setting_control_disabled_border")
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
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");
|
||||
|
||||
if (control.hovered || control.activeFocus) {
|
||||
return UM.Theme.getColor("setting_control_border_highlight")
|
||||
}
|
||||
|
||||
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:
|
||||
{
|
||||
forceActiveFocus();
|
||||
propertyProvider.setPropertyValue("value", definition.options[index].key);
|
||||
forceActiveFocus()
|
||||
propertyProvider.setPropertyValue("value", definition.options[index].key)
|
||||
}
|
||||
|
||||
onActiveFocusChanged:
|
||||
{
|
||||
if(activeFocus)
|
||||
{
|
||||
base.focusReceived();
|
||||
base.focusReceived()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,6 +120,7 @@ SettingItem
|
|||
{
|
||||
base.setActiveFocusToNextSetting(true)
|
||||
}
|
||||
|
||||
Keys.onBacktabPressed:
|
||||
{
|
||||
base.setActiveFocusToNextSetting(false)
|
||||
|
@ -126,16 +134,14 @@ SettingItem
|
|||
{
|
||||
// FIXME this needs to go away once 'resolve' is combined with 'value' in our data model.
|
||||
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 to choose between the resolved value (default) and the global value
|
||||
// (if user has explicitly set this).
|
||||
value = base.resolve;
|
||||
}
|
||||
|
||||
if (value == undefined)
|
||||
{
|
||||
if (value == undefined) {
|
||||
value = propertyProvider.properties.value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue