Merge branch 'feature_tab_navigation' of https://github.com/fieldOfView/Cura

This commit is contained in:
Jaime van Kessel 2017-06-26 14:39:12 +02:00
commit c36ab386fa
9 changed files with 239 additions and 44 deletions

View file

@ -14,10 +14,14 @@ Button {
style: UM.Theme.styles.sidebar_category;
signal showTooltip(string text);
signal hideTooltip();
signal showTooltip(string text)
signal hideTooltip()
signal contextMenuRequested()
signal showAllHiddenInheritedSettings(string category_id)
signal focusReceived()
signal setActiveFocusToNextSetting(bool forward)
property var focusItem: base
text: definition.label
iconSource: UM.Theme.getIcon(definition.icon)
@ -25,7 +29,33 @@ Button {
checkable: true
checked: definition.expanded
onClicked: { forceActiveFocus(); definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandAll(definition.key) }
onClicked:
{
forceActiveFocus();
if(definition.expanded)
{
settingDefinitionsModel.collapse(definition.key);
} else {
settingDefinitionsModel.expandAll(definition.key);
}
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Keys.onTabPressed:
{
base.setActiveFocusToNextSetting(true)
}
Keys.onBacktabPressed:
{
base.setActiveFocusToNextSetting(false)
}
UM.SimpleButton
{
id: settingsButton

View file

@ -11,6 +11,7 @@ import UM 1.2 as UM
SettingItem
{
id: base
property var focusItem: control
contents: MouseArea
{
@ -49,12 +50,35 @@ SettingItem
}
}
Keys.onSpacePressed:
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", !checked);
}
onClicked:
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", !checked);
}
Keys.onTabPressed:
{
base.setActiveFocusToNextSetting(true)
}
Keys.onBacktabPressed:
{
base.setActiveFocusToNextSetting(false)
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Rectangle
{
anchors
@ -67,7 +91,7 @@ SettingItem
color:
{
if (!enabled)
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled")
}
@ -75,14 +99,22 @@ SettingItem
{
return UM.Theme.getColor("setting_control_highlight")
}
else
{
return UM.Theme.getColor("setting_control")
}
return UM.Theme.getColor("setting_control")
}
border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
border.color:
{
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border")
}
if(control.containsMouse || control.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
}
UM.RecolorImage {
anchors.verticalCenter: parent.verticalCenter

View file

@ -10,6 +10,7 @@ import UM 1.1 as UM
SettingItem
{
id: base
property var focusItem: control
contents: ComboBox
{
@ -33,21 +34,29 @@ SettingItem
{
color:
{
if (!enabled)
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled")
}
if(control.hovered || base.activeFocus)
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight")
}
else
{
return UM.Theme.getColor("setting_control")
}
return UM.Theme.getColor("setting_control")
}
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")
}
border.width: UM.Theme.getSize("default_lining").width;
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
}
label: Item
{
@ -86,7 +95,28 @@ SettingItem
}
}
onActivated: { forceActiveFocus(); propertyProvider.setPropertyValue("value", definition.options[index].key) }
onActivated:
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", definition.options[index].key);
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Keys.onTabPressed:
{
base.setActiveFocusToNextSetting(true)
}
Keys.onBacktabPressed:
{
base.setActiveFocusToNextSetting(false)
}
Binding
{

View file

@ -11,6 +11,7 @@ import Cura 1.0 as Cura
SettingItem
{
id: base
property var focusItem: control
contents: ComboBox
{
@ -27,6 +28,23 @@ SettingItem
propertyProvider.setPropertyValue("value", model.getItem(index).index);
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Keys.onTabPressed:
{
base.setActiveFocusToNextSetting(true)
}
Keys.onBacktabPressed:
{
base.setActiveFocusToNextSetting(false)
}
currentIndex: propertyProvider.properties.value
MouseArea
@ -53,7 +71,7 @@ SettingItem
{
color:
{
if (!enabled)
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled");
}
@ -61,23 +79,19 @@ SettingItem
{
return UM.Theme.getColor("setting_control_highlight");
}
else
{
return UM.Theme.getColor("setting_control");
}
return UM.Theme.getColor("setting_control");
}
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border");
return UM.Theme.getColor("setting_control_disabled_border")
}
if(control.hovered || base.activeFocus)
if(control.hovered || control.activeFocus)
{
UM.Theme.getColor("setting_control_border_highlight")
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
}
}

View file

@ -32,9 +32,11 @@ Item {
property var stackLevels: propertyProvider.stackLevels
property var stackLevel: stackLevels[0]
signal focusReceived()
signal setActiveFocusToNextSetting(bool forward)
signal contextMenuRequested()
signal showTooltip(string text);
signal hideTooltip();
signal showTooltip(string text)
signal hideTooltip()
signal showAllHiddenInheritedSettings(string category_id)
property string tooltipText:
{

View file

@ -11,6 +11,7 @@ import Cura 1.0 as Cura
SettingItem
{
id: base
property var focusItem: control
contents: ComboBox
{
@ -31,6 +32,23 @@ SettingItem
propertyProvider.setPropertyValue("value", model.getItem(index).index);
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Keys.onTabPressed:
{
base.setActiveFocusToNextSetting(true)
}
Keys.onBacktabPressed:
{
base.setActiveFocusToNextSetting(false)
}
Binding
{
target: control
@ -72,31 +90,27 @@ SettingItem
{
color:
{
if (!enabled)
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled");
}
if(control.hovered || base.activeFocus)
if(control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight");
}
else
{
return UM.Theme.getColor("setting_control");
}
return UM.Theme.getColor("setting_control");
}
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border");
return UM.Theme.getColor("setting_control_disabled_border")
}
if(control.hovered || base.activeFocus)
if(control.hovered || control.activeFocus)
{
UM.Theme.getColor("setting_control_border_highlight")
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
}
}

View file

@ -9,6 +9,7 @@ import UM 1.1 as UM
SettingItem
{
id: base
property var focusItem: input
contents: Rectangle
{
@ -17,10 +18,21 @@ SettingItem
anchors.fill: parent
border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
border.color:
{
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border")
}
if(hovered || input.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
}
color: {
if (!enabled)
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled")
}
@ -83,6 +95,15 @@ SettingItem
verticalCenter: parent.verticalCenter
}
Keys.onTabPressed:
{
base.setActiveFocusToNextSetting(true)
}
Keys.onBacktabPressed:
{
base.setActiveFocusToNextSetting(false)
}
Keys.onReleased:
{
propertyProvider.setPropertyValue("value", text)
@ -93,6 +114,14 @@ SettingItem
propertyProvider.setPropertyValue("value", text)
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default");

View file

@ -168,6 +168,8 @@ Item
onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate()
}
property var indexWithFocus: -1
delegate: Loader
{
id: delegate
@ -298,11 +300,53 @@ Item
}
Cura.SettingInheritanceManager.manualRemoveOverride(category_id)
}
onFocusReceived:
{
contents.indexWithFocus = index;
animateContentY.from = contents.contentY;
contents.positionViewAtIndex(index, ListView.Contain);
animateContentY.to = contents.contentY;
animateContentY.running = true;
}
onSetActiveFocusToNextSetting:
{
if(forward == undefined || forward)
{
contents.currentIndex = contents.indexWithFocus + 1;
while(contents.currentItem && contents.currentItem.height <= 0)
{
contents.currentIndex++;
}
if(contents.currentItem)
{
contents.currentItem.item.focusItem.forceActiveFocus();
}
}
else
{
contents.currentIndex = contents.indexWithFocus - 1;
while(contents.currentItem && contents.currentItem.height <= 0)
{
contents.currentIndex--;
}
if(contents.currentItem)
{
contents.currentItem.item.focusItem.forceActiveFocus();
}
}
}
}
}
UM.I18nCatalog { id: catalog; name: "cura"; }
NumberAnimation {
id: animateContentY
target: contents
property: "contentY"
duration: 50
}
add: Transition {
SequentialAnimation {
NumberAnimation { properties: "height"; from: 0; duration: 100 }

View file

@ -368,11 +368,11 @@ QtObject {
color: {
if(!control.enabled) {
return Theme.getColor("setting_category_disabled_border");
} else if(control.hovered && control.checkable && control.checked) {
} else if((control.hovered || control.activeFocus) && control.checkable && control.checked) {
return Theme.getColor("setting_category_active_hover_border");
} else if(control.pressed || (control.checkable && control.checked)) {
return Theme.getColor("setting_category_active_border");
} else if(control.hovered) {
} else if(control.hovered || control.activeFocus) {
return Theme.getColor("setting_category_hover_border");
} else {
return Theme.getColor("setting_category_border");
@ -508,7 +508,7 @@ QtObject {
{
color:
{
if (!enabled)
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled");
}