Merge branch 'master' of github.com:Ultimaker/Cura into qtquick-controls-2.0

This commit is contained in:
Jaime van Kessel 2017-11-16 16:48:22 +01:00
commit 7d28b26ff2
446 changed files with 4278 additions and 1340 deletions

View file

@ -132,6 +132,7 @@ UM.Dialog
projectsModel.append({ name:"PySerial", description: catalog.i18nc("@label", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" });
projectsModel.append({ name:"python-zeroconf", description: catalog.i18nc("@label", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" });
projectsModel.append({ name:"Clipper", description: catalog.i18nc("@label", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" });
projectsModel.append({ name:"Requests", description: catalog.i18nc("@Label", "Python HTTP library"), license: "GPL", url: "http://docs.python-requests.org" });
projectsModel.append({ name:"Open Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://fonts.google.com/specimen/Open+Sans" });
projectsModel.append({ name:"Font-Awesome-SVG-PNG", description: catalog.i18nc("@label", "SVG icons"), license: "SIL OFL 1.1", url: "https://github.com/encharm/Font-Awesome-SVG-PNG" });

0
resources/qml/Actions.qml Executable file → Normal file
View file

View file

@ -63,11 +63,12 @@ UM.Dialog
anchors.fill: parent
anchors.leftMargin: 20 * screenScaleFactor
anchors.rightMargin: 20 * screenScaleFactor
anchors.bottomMargin: 20 * screenScaleFactor
anchors.bottomMargin: 10 * screenScaleFactor
spacing: 10 * screenScaleFactor
Label
{
id: questionText
text: catalog.i18nc("@text:window", "This is a Cura project file. Would you like to open it as a project or import the models from it?")
anchors.left: parent.left
anchors.right: parent.right
@ -80,11 +81,18 @@ UM.Dialog
id: rememberChoiceCheckBox
text: catalog.i18nc("@text:window", "Remember my choice")
checked: UM.Preferences.getValue("cura/choice_on_open_project") != "always_ask"
style: CheckBoxStyle {
label: Label {
text: control.text
font: UM.Theme.getFont("default")
}
}
}
// Buttons
Item
{
id: buttonBar
anchors.right: parent.right
anchors.left: parent.left
height: childrenRect.height

7
resources/qml/Cura.qml Executable file → Normal file
View file

@ -16,7 +16,7 @@ UM.MainWindow
{
id: base
//: Cura application window title
title: catalog.i18nc("@title:window","Cura");
title: catalog.i18nc("@title:window","Ultimaker Cura");
viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0)
property bool showPrintMonitor: false
@ -894,6 +894,11 @@ UM.MainWindow
if(!base.visible)
{
base.visible = true;
}
// check later if the user agreement dialog has been closed
if (CuraApplication.needToShowUserAgreement)
{
restart();
}
else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "")

View file

@ -94,7 +94,7 @@ Item {
{
id: printJobTextfield
anchors.right: printJobPencilIcon.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width/2
anchors.rightMargin: Math.floor(UM.Theme.getSize("default_margin").width/2)
height: UM.Theme.getSize("jobspecs_line").height
width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
maximumLength: 120

0
resources/qml/Menus/ContextMenu.qml Executable file → Normal file
View file

View file

@ -14,6 +14,20 @@ Menu
property int extruderIndex: 0
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool isClusterPrinter:
{
if(Cura.MachineManager.printerOutputDevices.length == 0)
{
return false;
}
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
// This is not a cluster printer or the cluster it is just one printer
if(clusterSize == undefined || clusterSize == 1)
{
return false;
}
return true;
}
UM.SettingPropertyProvider
{
@ -29,14 +43,14 @@ Menu
id: automaticMaterial
text:
{
if(printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex)
if(printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex && !isClusterPrinter)
{
var materialName = Cura.MachineManager.printerOutputDevices[0].materialNames[extruderIndex];
return catalog.i18nc("@title:menuitem %1 is the automatically selected material", "Automatic: %1").arg(materialName);
}
return "";
}
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex && !isClusterPrinter
onTriggered:
{
var materialId = Cura.MachineManager.printerOutputDevices[0].materialIds[extruderIndex];

View file

@ -14,20 +14,34 @@ Menu
property int extruderIndex: 0
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool isClusterPrinter:
{
if(Cura.MachineManager.printerOutputDevices.length == 0)
{
return false;
}
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
// This is not a cluster printer or the cluster it is just one printer
if(clusterSize == undefined || clusterSize == 1)
{
return false;
}
return true;
}
MenuItem
{
id: automaticNozzle
text:
{
if(printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex)
if(printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter)
{
var nozzleName = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
return catalog.i18nc("@title:menuitem %1 is the nozzle currently loaded in the printer", "Automatic: %1").arg(nozzleName);
}
return "";
}
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter
onTriggered:
{
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;

View file

@ -17,9 +17,9 @@ Menu
MenuItem
{
text: model.name + " - " + model.layer_height
text: (model.layer_height != "") ? model.name + " - " + model.layer_height : model.name
checkable: true
checked: Cura.MachineManager.activeQualityChangesId == "" && Cura.MachineManager.activeQualityType == model.metadata.quality_type
checked: Cura.MachineManager.activeQualityId == model.id
exclusiveGroup: group
onTriggered: Cura.MachineManager.setActiveQuality(model.id)
visible: model.available

View file

@ -36,8 +36,6 @@ UM.Dialog
var meshName = backgroundItem.getMeshName(projectFile.toString());
backgroundItem.hasMesh(decodeURIComponent(meshName));
// always update the job name with the loaded project
PrintInformation.setBaseName(meshName);
}
function loadModelFiles(fileUrls)

0
resources/qml/Preferences/GeneralPage.qml Executable file → Normal file
View file

View file

@ -442,6 +442,7 @@ Column
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
renderType: Text.NativeRendering
Component.onCompleted:
{
@ -676,6 +677,341 @@ Column
watchedProperties: ["value"]
}
Column
{
visible: connectedPrinter != null ? connectedPrinter.canControlManually : false
enabled:
{
if (connectedPrinter == null)
{
return false; //Can't control the printer if not connected.
}
if (!connectedPrinter.acceptsCommands)
{
return false; //Not allowed to do anything.
}
if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline")
{
return false; //Printer is in a state where it can't react to manual control
}
return true;
}
Loader
{
sourceComponent: monitorSection
property string label: catalog.i18nc("@label", "Printer control")
}
Row
{
width: base.width - 2 * UM.Theme.getSize("default_margin").width
height: childrenRect.height + UM.Theme.getSize("default_margin").width
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
Label
{
text: catalog.i18nc("@label", "Jog Position")
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width
height: UM.Theme.getSize("setting_control").height
verticalAlignment: Text.AlignVCenter
}
GridLayout
{
columns: 3
rows: 4
rowSpacing: UM.Theme.getSize("default_lining").width
columnSpacing: UM.Theme.getSize("default_lining").height
Label
{
text: catalog.i18nc("@label", "X/Y")
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
width: height
height: UM.Theme.getSize("setting_control").height
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
Layout.row: 1
Layout.column: 2
Layout.preferredWidth: width
Layout.preferredHeight: height
}
Button
{
Layout.row: 2
Layout.column: 2
Layout.preferredWidth: width
Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("arrow_top");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.moveHead(0, distancesRow.currentDistance, 0)
}
}
Button
{
Layout.row: 3
Layout.column: 1
Layout.preferredWidth: width
Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("arrow_left");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.moveHead(-distancesRow.currentDistance, 0, 0)
}
}
Button
{
Layout.row: 3
Layout.column: 3
Layout.preferredWidth: width
Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("arrow_right");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.moveHead(distancesRow.currentDistance, 0, 0)
}
}
Button
{
Layout.row: 4
Layout.column: 2
Layout.preferredWidth: width
Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("arrow_bottom");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.moveHead(0, -distancesRow.currentDistance, 0)
}
}
Button
{
Layout.row: 3
Layout.column: 2
Layout.preferredWidth: width
Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("home");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.homeHead()
}
}
}
Column
{
spacing: UM.Theme.getSize("default_lining").height
Label
{
text: catalog.i18nc("@label", "Z")
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
width: UM.Theme.getSize("section").height
height: UM.Theme.getSize("setting_control").height
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
Button
{
iconSource: UM.Theme.getIcon("arrow_top");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.moveHead(0, 0, distancesRow.currentDistance)
}
}
Button
{
iconSource: UM.Theme.getIcon("home");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.homeBed()
}
}
Button
{
iconSource: UM.Theme.getIcon("arrow_bottom");
style: monitorButtonStyle
width: height
height: UM.Theme.getSize("setting_control").height
onClicked:
{
connectedPrinter.moveHead(0, 0, -distancesRow.currentDistance)
}
}
}
}
Row
{
id: distancesRow
width: base.width - 2 * UM.Theme.getSize("default_margin").width
height: childrenRect.height + UM.Theme.getSize("default_margin").width
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
property real currentDistance: 10
Label
{
text: catalog.i18nc("@label", "Jog Distance")
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width
height: UM.Theme.getSize("setting_control").height
verticalAlignment: Text.AlignVCenter
}
Row
{
Repeater
{
model: distancesModel
delegate: Button
{
height: UM.Theme.getSize("setting_control").height
width: height + UM.Theme.getSize("default_margin").width
text: model.label
exclusiveGroup: distanceGroup
checkable: true
checked: distancesRow.currentDistance == model.value
onClicked: distancesRow.currentDistance = model.value
style: ButtonStyle {
background: Rectangle {
border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if (control.checked || control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
return UM.Theme.getColor("action_button_border");
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if (control.checked || control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if (control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
return UM.Theme.getColor("action_button");
}
Behavior on color { ColorAnimation { duration: 50; } }
Label {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if (control.checked || control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if (control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
return UM.Theme.getColor("action_button_text");
}
font: UM.Theme.getFont("default")
text: control.text
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
}
}
label: Item { }
}
}
}
}
}
ListModel
{
id: distancesModel
ListElement { label: "0.1"; value: 0.1 }
ListElement { label: "1"; value: 1 }
ListElement { label: "10"; value: 10 }
ListElement { label: "100"; value: 100 }
}
ExclusiveGroup { id: distanceGroup }
}
Loader
{
sourceComponent: monitorSection
@ -753,4 +1089,86 @@ Column
}
}
}
Component
{
id: monitorButtonStyle
ButtonStyle
{
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
return UM.Theme.getColor("action_button_border");
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
return UM.Theme.getColor("action_button");
}
Behavior on color
{
ColorAnimation
{
duration: 50
}
}
}
label: Item
{
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: Math.floor(control.width / 2)
height: Math.floor(control.height / 2)
sourceSize.width: width
sourceSize.height: width
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
return UM.Theme.getColor("action_button_text");
}
source: control.iconSource
}
}
}
}
}

View file

@ -18,6 +18,8 @@ Item {
property var backend: CuraApplication.getBackend();
property bool activity: CuraApplication.platformActivity;
property alias buttonRowWidth: saveRow.width
property string fileBaseName
property string statusText:
{
@ -89,17 +91,30 @@ Item {
Item {
id: saveRow
width: base.width
width: {
// using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect
var children_width = UM.Theme.getSize("default_margin").width;
for (var index in children)
{
var child = children[index];
if(child.visible)
{
children_width += child.width + child.anchors.rightMargin;
}
}
return Math.min(children_width, base.width - UM.Theme.getSize("sidebar_margin").width);
}
height: saveToButton.height
anchors.top: progressBar.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height
anchors.right: parent.right
clip: true
Row {
id: additionalComponentsRow
anchors.top: parent.top
anchors.right: saveToButton.visible ? saveToButton.left : parent.right
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
anchors.rightMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
}

View file

@ -11,6 +11,14 @@ SettingItem
id: base
property var focusItem: input
property string textBeforeEdit
property bool textHasChanged
onFocusReceived:
{
textHasChanged = false;
textBeforeEdit = focusItem.text;
}
contents: Rectangle
{
id: control
@ -102,6 +110,7 @@ SettingItem
right: parent.right
verticalCenter: parent.verticalCenter
}
renderType: Text.NativeRendering
Keys.onTabPressed:
{
@ -114,12 +123,22 @@ SettingItem
Keys.onReleased:
{
propertyProvider.setPropertyValue("value", text)
if (text != textBeforeEdit)
{
textHasChanged = true;
}
if (textHasChanged)
{
propertyProvider.setPropertyValue("value", text)
}
}
onEditingFinished:
{
propertyProvider.setPropertyValue("value", text)
if (textHasChanged)
{
propertyProvider.setPropertyValue("value", text)
}
}
onActiveFocusChanged:

View file

@ -51,27 +51,34 @@ Item
{
id: globalProfileSelection
text: {
var result = Cura.MachineManager.activeQualityName;
if (Cura.MachineManager.activeQualityLayerHeight > 0) {
result += " <font color=\"" + UM.Theme.getColor("text_detail") + "\">";
result += " - ";
result += Cura.MachineManager.activeQualityLayerHeight + "mm";
result += "</font>";
}
return result;
}
text: generateActiveQualityText()
enabled: !header.currentExtruderVisible || header.currentExtruderIndex > -1
width: Math.floor(parent.width * 0.55)
height: UM.Theme.getSize("setting_control").height
anchors.left: globalProfileLabel.right
anchors.right: parent.right
tooltip: Cura.MachineManager.activeQualityName
style: UM.Theme.styles.sidebar_header_button
activeFocusOnPress: true;
activeFocusOnPress: true
menu: ProfileMenu { }
function generateActiveQualityText () {
var result = catalog.i18nc("@", "No Profile Available") // default text
if (Cura.MachineManager.isActiveQualitySupported ) {
result = Cura.MachineManager.activeQualityName
if (Cura.MachineManager.activeQualityLayerHeight > 0) {
result += " <font color=\"" + UM.Theme.getColor("text_detail") + "\">"
result += " - "
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
result += "</font>"
}
}
return result
}
UM.SimpleButton
{
id: customisedSettings

143
resources/qml/Sidebar.qml Executable file → Normal file
View file

@ -29,6 +29,7 @@ Rectangle
property variant printMaterialLengths: PrintInformation.materialLengths
property variant printMaterialWeights: PrintInformation.materialWeights
property variant printMaterialCosts: PrintInformation.materialCosts
property variant printMaterialNames: PrintInformation.materialNames
color: UM.Theme.getColor("sidebar")
UM.I18nCatalog { id: catalog; name:"cura"}
@ -151,7 +152,7 @@ Rectangle
Button {
height: settingsModeSelection.height
anchors.left: parent.left
anchors.leftMargin: model.index * (settingsModeSelection.width / 2)
anchors.leftMargin: model.index * Math.floor(settingsModeSelection.width / 2)
anchors.verticalCenter: parent.verticalCenter
width: Math.floor(0.5 * parent.width)
text: model.text
@ -275,31 +276,32 @@ Rectangle
anchors.bottomMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 2 + UM.Theme.getSize("progressbar").height + UM.Theme.getFont("default_bold").pixelSize)
}
Rectangle
Item
{
id: printSpecs
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height
height: timeDetails.height + timeSpecDescription.height + lengthSpec.height
height: timeDetails.height + costSpec.height
width: base.width - (saveButton.buttonRowWidth + UM.Theme.getSize("sidebar_margin").width)
visible: !monitoringPrint
clip: true
Label
{
id: timeDetails
anchors.left: parent.left
anchors.bottom: timeSpecDescription.top
anchors.bottom: costSpec.top
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text_subtext")
text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label Hours and minutes", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
MouseArea
{
id: infillMouseArea
id: timeDetailsMouseArea
anchors.fill: parent
hoverEnabled: true
//enabled: base.settingsEnabled
onEntered:
{
@ -307,19 +309,35 @@ Rectangle
if(base.printDuration.valid && !base.printDuration.isTotalDurationZero)
{
// All the time information for the different features is achieved
var print_time = PrintInformation.getFeaturePrintTimes()
var print_time = PrintInformation.getFeaturePrintTimes();
var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds))
// A message is created and displayed when the user hover the time label
var content = catalog.i18nc("@tooltip", "<b>Time information</b>")
var content = catalog.i18nc("@tooltip", "<b>Time specification</b><br/><table>");
for(var feature in print_time)
{
if(!print_time[feature].isTotalDurationZero)
{
content += "<br /><i>" + feature + "</i>: " + print_time[feature].getDisplayString(UM.DurationFormat.Short)
var feature_name = "";
if (feature.length <= 11)
{
feature_name = feature
}
else{
feature_name = feature.substring(0, 8) + "..."
}
content += "<tr><td>" + feature_name + ":" +
"&nbsp;&nbsp;</td><td>" + print_time[feature].getDisplayString(UM.DurationFormat.Short) +
"&nbsp;&nbsp;</td><td>" + Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds) + "%" +
"</td></tr>";
}
}
content += "</table>";
base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content)
base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content);
}
}
onExited:
@ -331,20 +349,84 @@ Rectangle
Label
{
id: timeSpecDescription
anchors.left: parent.left
anchors.bottom: lengthSpec.top
font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text_subtext")
text: catalog.i18nc("@description", "Print time")
}
Label
{
id: lengthSpec
function getSpecsData(){
var lengths = [];
var total_length = 0;
var weights = [];
var total_weight = 0;
var costs = [];
var total_cost = 0;
var some_costs_known = false;
var names = [];
if(base.printMaterialLengths) {
for(var index = 0; index < base.printMaterialLengths.length; index++)
{
if(base.printMaterialLengths[index] > 0)
{
names.push(base.printMaterialNames[index]);
lengths.push(base.printMaterialLengths[index].toFixed(2));
weights.push(String(Math.floor(base.printMaterialWeights[index])));
var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2);
costs.push(cost);
if(cost > 0)
{
some_costs_known = true;
}
total_length += base.printMaterialLengths[index];
total_weight += base.printMaterialWeights[index];
total_cost += base.printMaterialCosts[index];
}
}
}
if(lengths.length == 0)
{
lengths = ["0.00"];
weights = ["0"];
costs = ["0.00"];
}
var tooltip_html = "<b>%1</b><br/><table>".arg(catalog.i18nc("@label", "Cost specification"));
for(var index = 0; index < lengths.length; index++)
{
var item_strings = [
"%1:".arg(names[index]),
catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]),
catalog.i18nc("@label g for grams", "%1g").arg(weights[index]),
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
];
tooltip_html += "<tr>";
for(var item = 0; item < item_strings.length; item++) {
tooltip_html += "<td>%1&nbsp;&nbsp;</td>".arg(item_strings[item]);
}
}
var item_strings = [
catalog.i18nc("@label", "Total:"),
catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)),
catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)),
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)),
];
tooltip_html += "<tr>";
for(var item = 0; item < item_strings.length; item++) {
tooltip_html += "<td>%1&nbsp;&nbsp;</td>".arg(item_strings[item]);
}
tooltip_html += "</tr></table>";
tooltipText = tooltip_html;
return tooltipText
}
id: costSpec
anchors.left: parent.left
anchors.bottom: parent.bottom
font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text_subtext")
elide: Text.ElideMiddle
width: parent.width
property string tooltipText
text:
{
var lengths = [];
@ -383,6 +465,27 @@ Rectangle
return catalog.i18nc("@label Print estimates: m for meters, g for grams", "%1m / ~ %2g").arg(lengths.join(" + ")).arg(weights.join(" + "));
}
}
MouseArea
{
id: costSpecMouseArea
anchors.fill: parent
hoverEnabled: true
onEntered:
{
if(base.printDuration.valid && !base.printDuration.isTotalDurationZero)
{
var show_data = costSpec.getSpecsData()
base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), show_data);
}
}
onExited:
{
base.hideTooltip();
}
}
}
}

View file

@ -34,20 +34,6 @@ Column
width: height
}
Item
{
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("sidebar_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("sidebar_margin").width
}
visible: extruderSelectionRow.visible
height: UM.Theme.getSize("default_lining").hieght
width: height
}
Item
{
id: extruderSelectionRow
@ -259,42 +245,36 @@ Column
color: UM.Theme.getColor("text");
}
ToolButton {
ToolButton
{
id: materialSelection
text: Cura.MachineManager.activeMaterialName
tooltip: Cura.MachineManager.activeMaterialName
visible: Cura.MachineManager.hasMaterials
property var valueError:
{
var data = Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeMaterialId, "compatible")
if(data == "False")
{
return true
}
else
{
return false
}
}
property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported
enabled: !extrudersList.visible || base.currentExtruderIndex > -1
height: UM.Theme.getSize("setting_control").height
width: parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width
anchors.right: parent.right
style: UM.Theme.styles.sidebar_header_button
activeFocusOnPress: true;
menu: MaterialMenu {
extruderIndex: base.currentExtruderIndex
}
menu: MaterialMenu { extruderIndex: base.currentExtruderIndex }
property var valueError: !isMaterialSupported()
property var valueWarning: ! Cura.MachineManager.isActiveQualitySupported
function isMaterialSupported () {
return Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeMaterialId, "compatible") == "True"
}
}
}
// Print core row
//Variant row
Item
{
id: printCoreRow
id: variantRow
height: UM.Theme.getSize("sidebar_setup").height
visible: Cura.MachineManager.hasVariants && !sidebar.monitoringPrint && !sidebar.hideSettings
@ -308,7 +288,7 @@ Column
Label
{
id: printCoreLabel
id: variantLabel
text: Cura.MachineManager.activeDefinitionVariantsName;
width: Math.floor(parent.width * 0.45 - UM.Theme.getSize("default_margin").width)
font: UM.Theme.getFont("default");
@ -316,7 +296,7 @@ Column
}
ToolButton {
id: printCoreSelection
id: variantSelection
text: Cura.MachineManager.activeVariantName
tooltip: Cura.MachineManager.activeVariantName;
visible: Cura.MachineManager.hasVariants

View file

@ -7,7 +7,7 @@ import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.2 as UM
import Cura 1.0 as Cura
import Cura 1.2 as Cura
Item
{
@ -76,12 +76,13 @@ Item
property var totalTicks: 0
property var availableTotalTicks: 0
property var activeQualityIndex: 0
property var existingQualityProfile: 0
property var qualitySliderActiveIndex: 0
property var qualitySliderStepWidth: 0
property var qualitySliderAvailableMin : 0
property var qualitySliderAvailableMax : 0
property var qualitySliderMarginRight : 0
property var qualitySliderAvailableMin: 0
property var qualitySliderAvailableMax: 0
property var qualitySliderMarginRight: 0
function update () {
reset()
@ -89,15 +90,23 @@ Item
var availableMin = -1
var availableMax = -1
for (var i = 0; i <= Cura.ProfilesModel.rowCount(); i++) {
for (var i = 0; i < Cura.ProfilesModel.rowCount(); i++) {
var qualityItem = Cura.ProfilesModel.getItem(i)
// Add each quality item to the UI quality model
qualityModel.append(qualityItem)
// Set selected value
if (Cura.MachineManager.activeQualityId == qualityItem.id) {
qualityModel.activeQualityIndex = i
if (Cura.MachineManager.activeQualityType == qualityItem.metadata.quality_type) {
// set to -1 when switching to user created profile so all ticks are clickable
if (Cura.SimpleModeSettingsManager.isProfileUserCreated) {
qualityModel.qualitySliderActiveIndex = -1
} else {
qualityModel.qualitySliderActiveIndex = i
}
qualityModel.existingQualityProfile = 1
}
// Set min available
@ -141,16 +150,10 @@ Item
function reset () {
qualityModel.clear()
qualityModel.availableTotalTicks = -1
qualityModel.existingQualityProfile = 0
// check, the ticks count cannot be less than zero
if(Cura.ProfilesModel.rowCount() != 0)
{
qualityModel.totalTicks = Cura.ProfilesModel.rowCount() - 1 // minus one, because slider starts from 0
}
else
{
qualityModel.totalTicks = 0
}
qualityModel.totalTicks = Math.max(0, Cura.ProfilesModel.rowCount() - 1)
}
}
@ -175,7 +178,7 @@ Item
{
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 2)
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height / 2)
color: (Cura.MachineManager.activeMachine != null && Cura.ProfilesModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
text:
{
@ -194,13 +197,13 @@ Item
// Make sure the text aligns correctly with each tick
if (qualityModel.totalTicks == 0) {
// If there is only one tick, align it centrally
return Math.floor(((base.width * 0.55) - width) / 2)
return parseInt(((base.width * 0.55) - width) / 2)
} else if (index == 0) {
return (base.width * 0.55 / qualityModel.totalTicks) * index
} else if (index == qualityModel.totalTicks) {
return (base.width * 0.55 / qualityModel.totalTicks) * index - width
} else {
return Math.floor((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2))
return parseInt((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2))
}
}
}
@ -260,7 +263,7 @@ Item
id: qualitySlider
height: UM.Theme.getSize("sidebar_margin").height
anchors.bottom: speedSlider.bottom
enabled: qualityModel.availableTotalTicks > 0
enabled: qualityModel.availableTotalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized
visible: qualityModel.totalTicks > 0
updateValueWhileDragging : false
@ -268,7 +271,7 @@ Item
maximumValue: qualityModel.qualitySliderAvailableMax >= 0 ? qualityModel.qualitySliderAvailableMax : 0
stepSize: 1
value: qualityModel.activeQualityIndex
value: qualityModel.qualitySliderActiveIndex
width: qualityModel.qualitySliderStepWidth * qualityModel.availableTotalTicks
@ -291,23 +294,40 @@ Item
implicitWidth: 10 * screenScaleFactor
implicitHeight: implicitWidth
radius: implicitWidth / 2
visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile
}
}
}
onValueChanged: {
// Only change if an active machine is set and the slider is visible at all.
if(Cura.MachineManager.activeMachine != null && visible)
{
//Prevent updating during view initializing. Trigger only if the value changed by user
if(qualitySlider.value != qualityModel.activeQualityIndex)
{
//start updating with short delay
qualitySliderChangeTimer.start();
// only change if an active machine is set and the slider is visible at all.
if (Cura.MachineManager.activeMachine != null && visible) {
// prevent updating during view initializing. Trigger only if the value changed by user
if (qualitySlider.value != qualityModel.qualitySliderActiveIndex) {
// start updating with short delay
qualitySliderChangeTimer.start()
}
}
}
}
MouseArea
{
id: speedSliderMouseArea
anchors.fill: parent
hoverEnabled: true
enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated
onEntered:
{
var content = catalog.i18nc("@tooltip","A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab")
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content)
}
onExited:
{
base.hideTooltip();
}
}
}
Label
@ -316,13 +336,10 @@ Item
anchors.top: speedSlider.bottom
anchors.left: parent.left
anchors.right: speedSlider.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@label", "Print Speed")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
elide: Text.ElideRight
}
Label
@ -346,6 +363,33 @@ Item
color: (qualityModel.availableTotalTicks > 0) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
horizontalAlignment: Text.AlignRight
}
UM.SimpleButton
{
id: customisedSettings
visible: Cura.SimpleModeSettingsManager.isProfileCustomized
height: speedSlider.height * 0.8
width: speedSlider.height * 0.8
anchors.verticalCenter: speedSlider.verticalCenter
anchors.right: speedSlider.left
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width / 2
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
iconSource: UM.Theme.getIcon("reset");
onClicked:
{
discardOrKeepProfileChangesDialog.show()
}
onEntered:
{
var content = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.")
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content)
}
onExited: base.hideTooltip()
}
}
@ -361,7 +405,7 @@ Item
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: parent.left
width: Math.floor(UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width)
width: parseInt(UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width)
Label
{
@ -371,7 +415,7 @@ Item
color: UM.Theme.getColor("text")
anchors.top: parent.top
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 1.7)
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 1.7)
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
}
@ -382,7 +426,7 @@ Item
id: infillCellRight
height: infillSlider.height + UM.Theme.getSize("sidebar_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("sidebar_margin").height)
width: Math.floor(UM.Theme.getSize("sidebar").width * .55)
width: parseInt(UM.Theme.getSize("sidebar").width * .55)
anchors.left: infillCellLeft.right
anchors.top: infillCellLeft.top
@ -393,10 +437,10 @@ Item
//anchors.top: parent.top
anchors.left: infillSlider.left
anchors.leftMargin: Math.floor((infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor)
anchors.leftMargin: parseInt((infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor)
anchors.right: parent.right
text: Math.floor(infillDensity.properties.value) + "%"
text: parseInt(infillDensity.properties.value) + "%"
horizontalAlignment: Text.AlignLeft
color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
@ -406,7 +450,7 @@ Item
Binding {
target: infillSlider
property: "value"
value: Math.floor(infillDensity.properties.value)
value: parseInt(infillDensity.properties.value)
}
Slider
@ -419,7 +463,7 @@ Item
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
height: UM.Theme.getSize("sidebar_margin").height
width: Math.floor(infillCellRight.width - UM.Theme.getSize("sidebar_margin").width - style.handleWidth)
width: parseInt(infillCellRight.width - UM.Theme.getSize("sidebar_margin").width - style.handleWidth)
minimumValue: 0
maximumValue: 100
@ -427,15 +471,15 @@ Item
tickmarksEnabled: true
// disable slider when gradual support is enabled
enabled: Math.floor(infillSteps.properties.value) == 0
enabled: parseInt(infillSteps.properties.value) == 0
// set initial value from stack
value: Math.floor(infillDensity.properties.value)
value: parseInt(infillDensity.properties.value)
onValueChanged: {
// Don't round the value if it's already the same
if (Math.floor(infillDensity.properties.value) == infillSlider.value) {
if (parseInt(infillDensity.properties.value) == infillSlider.value) {
return
}
@ -504,7 +548,7 @@ Item
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 2)
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height / 2)
// we loop over all density icons and only show the one that has the current density and steps
Repeater
@ -515,8 +559,8 @@ Item
property int activeIndex: {
for (var i = 0; i < infillModel.count; i++) {
var density = Math.floor(infillDensity.properties.value)
var steps = Math.floor(infillSteps.properties.value)
var density = parseInt(infillDensity.properties.value)
var steps = parseInt(infillSteps.properties.value)
var infillModelItem = infillModel.get(i)
if (density >= infillModelItem.percentageMin
@ -555,13 +599,13 @@ Item
property alias _hovered: enableGradualInfillMouseArea.containsMouse
anchors.top: infillSlider.bottom
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 2) // closer to slider since it belongs to the same category
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height / 2) // closer to slider since it belongs to the same category
anchors.left: infillCellRight.left
style: UM.Theme.styles.checkbox
enabled: base.settingsEnabled
visible: infillSteps.properties.enabled == "True"
checked: Math.floor(infillSteps.properties.value) > 0
checked: parseInt(infillSteps.properties.value) > 0
MouseArea {
id: enableGradualInfillMouseArea
@ -570,18 +614,18 @@ Item
hoverEnabled: true
enabled: true
property var previousInfillDensity: Math.floor(infillDensity.properties.value)
property var previousInfillDensity: parseInt(infillDensity.properties.value)
onClicked: {
// Set to 90% only when enabling gradual infill
if (Math.floor(infillSteps.properties.value) == 0) {
previousInfillDensity = Math.floor(infillDensity.properties.value)
if (parseInt(infillSteps.properties.value) == 0) {
previousInfillDensity = parseInt(infillDensity.properties.value)
infillDensity.setPropertyValue("value", String(90))
} else {
infillDensity.setPropertyValue("value", String(previousInfillDensity))
}
infillSteps.setPropertyValue("value", (Math.floor(infillSteps.properties.value) == 0) ? 5 : 0)
infillSteps.setPropertyValue("value", (parseInt(infillSteps.properties.value) == 0) ? 5 : 0)
}
onEntered: {
@ -597,7 +641,7 @@ Item
Label {
id: gradualInfillLabel
anchors.left: enableGradualInfillCheckBox.right
anchors.leftMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width / 2)
anchors.leftMargin: parseInt(UM.Theme.getSize("sidebar_margin").width / 2)
text: catalog.i18nc("@label", "Enable gradual")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
@ -658,14 +702,17 @@ Item
visible: enableSupportCheckBox.visible
anchors.top: infillCellRight.bottom
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 1.5)
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 1.5)
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.right: infillCellLeft.right
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
anchors.verticalCenter: enableSupportCheckBox.verticalCenter
text: catalog.i18nc("@label", "Generate Support");
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text");
elide: Text.ElideRight
}
CheckBox
@ -711,10 +758,13 @@ Item
visible: supportExtruderCombobox.visible
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.right: infillCellLeft.right
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
anchors.verticalCenter: supportExtruderCombobox.verticalCenter
text: catalog.i18nc("@label", "Support Extruder");
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text");
elide: Text.ElideRight
}
ComboBox
@ -867,7 +917,7 @@ Item
{
id: tipsCell
anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom)
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 2)
anchors.topMargin: parseInt(UM.Theme.getSize("sidebar_margin").height * 2)
anchors.left: parent.left
width: parent.width
height: tipsText.contentHeight * tipsText.lineCount
@ -898,35 +948,6 @@ Item
storeIndex: 0
}
Binding
{
target: infillDensity
property: "containerStackId"
value: {
// not settable per extruder or there only is global, so we must pick global
if (machineExtruderCount.properties.value == 1) {
return Cura.MachineManager.activeStackId
}
// return the ID of the extruder when the infill is limited to an extruder
if (infillInheritStackProvider.properties.limit_to_extruder != null && infillInheritStackProvider.properties.limit_to_extruder >= 0) {
return ExtruderManager.extruderIds[String(infillInheritStackProvider.properties.limit_to_extruder)]
}
// default to the global stack
return Cura.MachineManager.activeStackId
}
}
UM.SettingPropertyProvider
{
id: infillInheritStackProvider
containerStackId: Cura.MachineManager.activeMachineId
key: "infill_sparse_density"
watchedProperties: [ "limit_to_extruder" ]
}
UM.SettingPropertyProvider
{
id: infillDensity

View file

@ -54,6 +54,7 @@ UM.PointingRectangle {
rightMargin: UM.Theme.getSize("tooltip_margins").width;
}
wrapMode: Text.Wrap;
textFormat: Text.RichText
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("tooltip_text");
}

View file

@ -30,7 +30,8 @@ Item
id: repeat
model: UM.ToolModel { }
width: childrenRect.width
height: childrenRect.height
Button
{
text: model.name
@ -72,6 +73,8 @@ Item
Repeater
{
id: extruders
width: childrenRect.width
height: childrenRect.height
property var _model: Cura.ExtrudersModel { id: extrudersModel }
model: _model.items.length > 1 ? _model : 0
ExtruderButton { extruder: model }

View file

@ -30,9 +30,11 @@ Rectangle
Component.onCompleted: {
startMonitoringPrint.connect(function () {
base.monitoringPrint = true
UM.Controller.disableModelRendering()
})
stopMonitoringPrint.connect(function () {
base.monitoringPrint = false
UM.Controller.enableModelRendering()
})
}
@ -279,7 +281,8 @@ Rectangle
property var buttonTarget: Qt.point(viewModeButton.x + viewModeButton.width / 2, viewModeButton.y + viewModeButton.height / 2)
height: childrenRect.height;
height: childrenRect.height
width: childrenRect.width
source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";
}