Merge branch 'master' into CURA-5595_add_custom_button_to_menu

This commit is contained in:
Aleksei S 2018-08-10 15:51:38 +02:00
commit a1bc2f3ebf
89 changed files with 1210 additions and 436 deletions

View file

@ -26,7 +26,6 @@ Column
OutputDeviceHeader
{
width: parent.width
outputDevice: connectedDevice
}

View file

@ -16,7 +16,7 @@ Item
Rectangle
{
anchors.fill: parent
height: childrenRect.height
color: UM.Theme.getColor("setting_category")
property var activePrinter: outputDevice != null ? outputDevice.activePrinter : null

View file

@ -48,14 +48,15 @@ Item {
}
function sliceOrStopSlicing() {
try {
if ([1, 5].indexOf(base.backendState) != -1) {
CuraApplication.backend.forceSlice();
} else {
CuraApplication.backend.stopSlicing();
}
} catch (e) {
console.log('Could not start or stop slicing', e)
if ([1, 5].indexOf(base.backendState) != -1)
{
prepareButton.preparingToSlice = true;
CuraApplication.backend.forceSlice();
}
else
{
prepareButton.preparingToSlice = false;
CuraApplication.backend.stopSlicing();
}
}
@ -167,12 +168,10 @@ Item {
// Prepare button, only shows if auto_slice is off
Button {
id: prepareButton
property bool showPrepare : false;
property bool preparingToSlice: false
tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process")
// 1 = not started, 2 = Processing
enabled: base.backendState != "undefined" && ([1, 2].indexOf(base.backendState) != -1) && base.activity
enabled: !preparingToSlice && base.backendState != "undefined" && ([1, 2].indexOf(base.backendState) != -1) && base.activity
visible: base.backendState != "undefined" && !autoSlice && ([1, 2, 4].indexOf(base.backendState) != -1) && base.activity
property bool autoSlice
height: UM.Theme.getSize("save_button_save_to_button").height
@ -183,18 +182,24 @@ Item {
// 1 = not started, 4 = error, 5 = disabled
text: {
if (base.backendState == 1 && showPrepare)
if (preparingToSlice)
{
showPrepare = false
return catalog.i18nc("@label:Printjob", "Preparing")
return catalog.i18nc("@label:Printjob", "Preparing");
}
else
{
if ([1, 4, 5].indexOf(base.backendState) != -1)
{
return catalog.i18nc("@label:Printjob", "Prepare");
}
else
{
return catalog.i18nc("@label:Printjob", "Cancel")
}
}
return [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
}
onClicked:
{
showPrepare = true
sliceOrStopSlicing();
}
@ -249,6 +254,17 @@ Item {
}
label: Item { }
}
Connections {
target: UM.Backend
onStateChanged:
{
if ([2, 3].indexOf(UM.Backend.state) != -1)
{
prepareButton.preparingToSlice = false;
}
}
}
}
Button {

View file

@ -20,13 +20,6 @@ SettingItem
anchors.fill: parent
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.NoButton
onWheel: wheel.accepted = true
}
background: Rectangle
{
color:

View file

@ -71,13 +71,6 @@ SettingItem
currentIndex: propertyProvider.properties.value
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.NoButton
onWheel: wheel.accepted = true;
}
property string color: "#fff"
Binding

View file

@ -76,13 +76,6 @@ SettingItem
when: control.model.items.length > 0
}
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.NoButton
onWheel: wheel.accepted = true;
}
property string color: "#fff"
Binding

View file

@ -1,4 +1,4 @@
// Copyright (c) 2015 Ultimaker B.V.
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -21,8 +21,8 @@ Item
{
id: buttons;
anchors.bottom: parent.bottom;
anchors.left: parent.left;
anchors.bottom: parent.bottom
anchors.left: parent.left
spacing: UM.Theme.getSize("button_lining").width
Repeater
@ -34,20 +34,22 @@ Item
height: childrenRect.height
Button
{
text: model.name
text: model.name + (model.shortcut ? (" (" + model.shortcut + ")") : "")
iconSource: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon
checkable: true
checked: model.active
enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled
style: UM.Theme.styles.tool_button
onCheckedChanged: {
if (checked) {
base.activeY = y
onCheckedChanged:
{
if (checked)
{
base.activeY = y;
}
}
//Workaround since using ToolButton"s onClicked would break the binding of the checked property, instead
//Workaround since using ToolButton's onClicked would break the binding of the checked property, instead
//just catch the click so we do not trigger that behaviour.
MouseArea
{
@ -57,7 +59,7 @@ Item
forceActiveFocus() //First grab focus, so all the text fields are updated
if(parent.checked)
{
UM.Controller.setActiveTool(null)
UM.Controller.setActiveTool(null);
}
else
{
@ -96,11 +98,13 @@ Item
width:
{
if (panel.item && panel.width > 0){
return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width)
if (panel.item && panel.width > 0)
{
return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width);
}
else {
return 0
else
{
return 0;
}
}
height: panel.item ? panel.height + 2 * UM.Theme.getSize("default_margin").height : 0;
@ -124,7 +128,7 @@ Item
x: UM.Theme.getSize("default_margin").width;
y: UM.Theme.getSize("default_margin").height;
source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : "";
source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : ""
enabled: UM.Controller.toolsEnabled;
}
}
@ -148,6 +152,6 @@ Item
anchors.horizontalCenter: parent.horizontalCenter
}
visible: toolHint.text != "";
visible: toolHint.text != ""
}
}

View file

@ -24,6 +24,10 @@ UM.Dialog
signal yes();
function accept() { // pressing enter will call this function
close();
yes();
}
onClosing:
{
@ -290,4 +294,4 @@ UM.Dialog
}
}
}
}
}