Merge branch 'master' into qtquick-controls-2.0

This commit is contained in:
ChrisTerBeke 2018-01-03 11:03:17 +01:00
commit 27ca743e58
327 changed files with 57764 additions and 17968 deletions

View file

@ -18,6 +18,7 @@ Item
property alias redo: redoAction;
property alias homeCamera: homeCameraAction;
property alias expandSidebar: expandSidebarAction;
property alias deleteSelection: deleteSelectionAction;
property alias centerSelection: centerSelectionAction;
@ -244,6 +245,16 @@ Item
onTriggered: CuraApplication.groupSelected();
}
Action
{
id: reloadQmlAction
onTriggered:
{
CuraApplication.reloadQML()
}
shortcut: "Shift+F5"
}
Action
{
id: unGroupObjectsAction
@ -379,4 +390,11 @@ Item
text: catalog.i18nc("@action:menu", "Installed plugins...");
iconName: "plugins_configure"
}
Action
{
id: expandSidebarAction;
text: catalog.i18nc("@action:inmenu menubar:view","Expand/Collapse Sidebar");
shortcut: "Ctrl+E";
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2016 Ultimaker B.V.
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -25,6 +25,15 @@ UM.Dialog
width: minimumWidth
height: minimumHeight
flags: {
var window_flags = Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint;
if (Cura.MachineManager.activeDefinitionId !== "") //Disallow closing the window if we have no active printer yet. You MUST add a printer.
{
window_flags |= Qt.WindowCloseButtonHint;
}
return window_flags;
}
onVisibilityChanged:
{
// Reset selection and machine name

View file

@ -20,14 +20,34 @@ UM.MainWindow
viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0)
property bool showPrintMonitor: false
// This connection is here to support legacy printer output devices that use the showPrintMonitor signal on Application to switch to the monitor stage
// It should be phased out in newer plugin versions.
Connections
{
target: Printer
target: CuraApplication
onShowPrintMonitor: {
if (show) {
topbar.startMonitoringPrint()
UM.Controller.setActiveStage("MonitorStage")
} else {
topbar.stopMonitoringPrint()
UM.Controller.setActiveStage("PrepareStage")
}
}
}
onWidthChanged:
{
// If slidebar is collapsed then it should be invisible
// otherwise after the main_window resize the sidebar will be fully re-drawn
if (sidebar.collapsed){
if (sidebar.visible == true){
sidebar.visible = false
sidebar.initialWidth = 0
}
}
else{
if (sidebar.visible == false){
sidebar.visible = true
sidebar.initialWidth = UM.Theme.getSize("sidebar").width
}
}
}
@ -46,6 +66,7 @@ UM.MainWindow
//
// This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property.
Cura.Actions.parent = backgroundItem
CuraApplication.purgeWindows()
}
Item
@ -115,7 +136,7 @@ UM.MainWindow
MenuItem
{
id: saveWorkspaceMenu
text: catalog.i18nc("@title:menu menubar:file","Save project")
text: catalog.i18nc("@title:menu menubar:file","Save &Project...")
onTriggered:
{
if(UM.Preferences.getValue("cura/dialog_on_project_save"))
@ -177,7 +198,7 @@ UM.MainWindow
MenuSeparator { }
MenuItem { text: catalog.i18nc("@action:inmenu", "Set as Active Extruder"); onTriggered: ExtruderManager.setActiveExtruderIndex(model.index) }
MenuItem { text: catalog.i18nc("@action:inmenu", "Set as Active Extruder"); onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index) }
}
onObjectAdded: settingsMenu.insertItem(index, object)
onObjectRemoved: settingsMenu.removeItem(object)
@ -330,7 +351,7 @@ UM.MainWindow
text: catalog.i18nc("@action:button","Open File");
iconSource: UM.Theme.getIcon("load")
style: UM.Theme.styles.tool_button
tooltip: '';
tooltip: ""
anchors
{
top: topbar.bottom;
@ -357,62 +378,92 @@ UM.MainWindow
Topbar
{
id: topbar
anchors.left:parent.left
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
monitoringPrint: base.showPrintMonitor
onStartMonitoringPrint: base.showPrintMonitor = true
onStopMonitoringPrint: base.showPrintMonitor = false
}
Sidebar
Loader
{
id: sidebar;
id: sidebar
anchors
{
top: topbar.bottom;
bottom: parent.bottom;
right: parent.right;
property bool collapsed: false;
property var initialWidth: UM.Theme.getSize("sidebar").width;
function callExpandOrCollapse() {
if (collapsed) {
sidebar.visible = true;
sidebar.initialWidth = UM.Theme.getSize("sidebar").width;
viewportRect = Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0);
expandSidebarAnimation.start();
} else {
viewportRect = Qt.rect(0, 0, 1, 1.0);
collapseSidebarAnimation.start();
}
collapsed = !collapsed;
UM.Preferences.setValue("cura/sidebar_collapsed", collapsed);
}
z: 1
width: UM.Theme.getSize("sidebar").width;
monitoringPrint: base.showPrintMonitor
}
Rectangle
{
id: viewportOverlay
color: UM.Theme.getColor("viewport_overlay")
anchors
{
top: topbar.bottom
top: topbar.top
bottom: parent.bottom
left:parent.left
right: sidebar.left
}
visible: opacity > 0
opacity: base.showPrintMonitor ? 1 : 0
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.AllButtons
width: initialWidth
x: base.width - sidebar.width
source: UM.Controller.activeStage.sidebarComponent
onWheel: wheel.accepted = true
NumberAnimation {
id: collapseSidebarAnimation
target: sidebar
properties: "x"
to: base.width
duration: 100
}
NumberAnimation {
id: expandSidebarAnimation
target: sidebar
properties: "x"
to: base.width - sidebar.width
duration: 100
}
Component.onCompleted:
{
var sidebar_collapsed = UM.Preferences.getValue("cura/sidebar_collapsed");
if (sidebar_collapsed)
{
sidebar.collapsed = true;
viewportRect = Qt.rect(0, 0, 1, 1.0)
collapseSidebarAnimation.start();
}
}
}
Loader
{
sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null
visible: base.showPrintMonitor
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2
anchors.verticalCenterOffset: UM.Theme.getSize("sidebar_header").height / 2
property real maximumWidth: viewportOverlay.width
property real maximumHeight: viewportOverlay.height
id: main
anchors
{
top: topbar.bottom
bottom: parent.bottom
left: parent.left
right: sidebar.left
}
MouseArea
{
visible: UM.Controller.activeStage.mainComponent != ""
anchors.fill: parent
acceptedButtons: Qt.AllButtons
onWheel: wheel.accepted = true
}
source: UM.Controller.activeStage.mainComponent
}
UM.MessageStack
@ -428,6 +479,13 @@ UM.MainWindow
}
}
// Expand or collapse sidebar
Connections
{
target: Cura.Actions.expandSidebar
onTriggered: sidebar.callExpandOrCollapse()
}
UM.PreferencesDialog
{
id: preferences
@ -471,6 +529,12 @@ UM.MainWindow
onTriggered: preferences.visible = true
}
Connections
{
target: CuraApplication
onShowPreferencesWindow: preferences.visible = true
}
MessageDialog
{
id: newProjectDialog
@ -829,7 +893,7 @@ UM.MainWindow
Connections
{
target: Printer
target: CuraApplication
onShowMessageBox:
{
messageDialog.title = title
@ -875,7 +939,7 @@ UM.MainWindow
Connections
{
target: Printer
target: CuraApplication
onRequestAddPrinter:
{
addMachineDialog.visible = true

View file

@ -18,7 +18,7 @@ Button
style: UM.Theme.styles.tool_button;
iconSource: UM.Theme.getIcon("extruder_button")
checked: ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
enabled: UM.Selection.hasSelection
property color customColor: base.hovered ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("button");

View file

@ -0,0 +1,71 @@
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.2 as UM
import Cura 1.0 as Cura
import "Menus"
ToolButton
{
text: Cura.MachineManager.activeMachineName
tooltip: Cura.MachineManager.activeMachineName
style: ButtonStyle
{
background: Rectangle
{
color:
{
if(control.pressed)
{
return UM.Theme.getColor("sidebar_header_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("sidebar_header_hover");
}
else
{
return UM.Theme.getColor("sidebar_header_bar");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
UM.RecolorImage
{
id: downArrow
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: UM.Theme.getColor("text_emphasis")
source: UM.Theme.getIcon("arrow_bottom")
}
Label
{
id: sidebarComboBoxLabel
color: UM.Theme.getColor("sidebar_header_text_active")
text: control.text;
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("large")
}
}
label: Label {}
}
menu: PrinterMenu { }
}

View file

@ -31,7 +31,7 @@ Menu
visible: base.shouldShowExtruders
enabled: UM.Selection.hasSelection
checkable: true
checked: ExtruderManager.selectedObjectExtruders.indexOf(model.id) != -1
checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(model.id) != -1
onTriggered: CuraActions.setExtruderForSelection(model.id)
shortcut: "Ctrl+" + (model.index + 1)
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2016 Ultimaker B.V.
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -78,16 +78,16 @@ Menu
{
text: model.name
checkable: true
checked: model.id == Cura.MachineManager.allActiveMaterialIds[ExtruderManager.extruderIds[extruderIndex]]
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
exclusiveGroup: group
onTriggered:
{
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
ExtruderManager.setActiveExtruderIndex(extruderIndex);
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
Cura.MachineManager.setActiveMaterial(model.id);
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
}
}
onObjectAdded: menu.insertItem(index, object)
@ -121,16 +121,16 @@ Menu
{
text: model.name
checkable: true
checked: model.id == Cura.MachineManager.allActiveMaterialIds[ExtruderManager.extruderIds[extruderIndex]]
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
exclusiveGroup: group
onTriggered:
{
// This workaround is done because of the application menus for materials and variants for multiextrusion printers.
// The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
ExtruderManager.setActiveExtruderIndex(extruderIndex);
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
Cura.MachineManager.setActiveMaterial(model.id);
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
}
}
onObjectAdded: brandMaterialsMenu.insertItem(index, object)
@ -157,7 +157,7 @@ Menu
}
//: Model used to populate the brandModel
UM.InstanceContainersModel
Cura.MaterialsModel
{
id: materialsModel
filter: materialFilter()

View file

@ -44,15 +44,15 @@ Menu
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter
onTriggered:
{
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
ExtruderManager.setActiveExtruderIndex(extruderIndex);
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
var hotendId = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
var itemIndex = nozzleInstantiator.model.find("name", hotendId);
if(itemIndex > -1)
{
Cura.MachineManager.setActiveVariant(nozzleInstantiator.model.getItem(itemIndex).id);
}
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
}
}
@ -75,14 +75,14 @@ Menu
MenuItem {
text: model.name
checkable: true
checked: model.id == Cura.MachineManager.allActiveVariantIds[ExtruderManager.extruderIds[extruderIndex]]
checked: model.id == Cura.MachineManager.allActiveVariantIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
exclusiveGroup: group
onTriggered:
{
var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
ExtruderManager.setActiveExtruderIndex(extruderIndex);
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
Cura.ExtruderManager.setActiveExtruderIndex(extruderIndex);
Cura.MachineManager.setActiveVariant(model.id);
ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
Cura.ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
}
}
onObjectAdded: menu.insertItem(index, object)

View file

@ -41,7 +41,7 @@ Menu
MenuItem
{
text: model.name + " - " + model.layer_height
text: model.name
checkable: true
checked: Cura.MachineManager.activeQualityChangesId == model.id
exclusiveGroup: group

View file

@ -12,22 +12,25 @@ Menu
title: catalog.i18nc("@title:menu menubar:toplevel", "&View");
id: menu
enabled: !PrintInformation.preSliced
// main views
Instantiator
{
model: UM.ViewModel { }
model: UM.ViewModel{}
MenuItem
{
text: model.name;
checkable: true;
checked: model.active;
exclusiveGroup: group;
onTriggered: UM.Controller.setActiveView(model.id);
text: model.name
checkable: true
checked: model.active
exclusiveGroup: group
onTriggered: UM.Controller.setActiveView(model.id)
}
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
}
ExclusiveGroup { id: group; }
ExclusiveGroup { id: group }
MenuSeparator {}
MenuItem { action: Cura.Actions.homeCamera; }
MenuItem { action: Cura.Actions.expandSidebar; }
}

View file

@ -18,7 +18,6 @@ Item
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
property real progress: printerConnected ? Cura.MachineManager.printerOutputDevices[0].progress : 0
property int backendState: UM.Backend.state
property bool showProgress: {
// determine if we need to show the progress bar + percentage
@ -199,14 +198,19 @@ Item
spacing: UM.Theme.getSize("default_margin").width
}
Component.onCompleted: {
buttonsRow.updateAdditionalComponents("monitorButtons")
}
Connections {
target: Printer
onAdditionalComponentsChanged:
{
if(areaId == "monitorButtons") {
for (var component in CuraApplication.additionalComponents["monitorButtons"]) {
CuraApplication.additionalComponents["monitorButtons"][component].parent = additionalComponentsRow
}
target: CuraApplication
onAdditionalComponentsChanged: buttonsRow.updateAdditionalComponents("monitorButtons")
}
function updateAdditionalComponents (areaId) {
if(areaId == "monitorButtons") {
for (var component in CuraApplication.additionalComponents["monitorButtons"]) {
CuraApplication.additionalComponents["monitorButtons"][component].parent = additionalComponentsRow
}
}
}

View file

@ -151,7 +151,7 @@ UM.PreferencesPage
append({ text: "English", code: "en_US" })
append({ text: "Deutsch", code: "de_DE" })
append({ text: "Español", code: "es_ES" })
append({ text: "Suomi", code: "fi_FI" })
//Finnish is disabled for being incomplete: append({ text: "Suomi", code: "fi_FI" })
append({ text: "Français", code: "fr_FR" })
append({ text: "Italiano", code: "it_IT" })
append({ text: "日本語", code: "ja_JP" })
@ -159,9 +159,11 @@ UM.PreferencesPage
append({ text: "Nederlands", code: "nl_NL" })
append({ text: "Polski", code: "pl_PL" })
append({ text: "Português do Brasil", code: "pt_BR" })
append({ text: "Português", code: "pt_PT" })
append({ text: "Русский", code: "ru_RU" })
append({ text: "Türkçe", code: "tr_TR" })
append({ text: "简体中文", code: "zh_CN" })
append({ text: "正體字", code: "zh_TW" })
var date_object = new Date();
if (date_object.getUTCMonth() == 8 && date_object.getUTCDate() == 19) //Only add Pirate on the 19th of September.

View file

@ -222,14 +222,19 @@ UM.ManagementPage
}
}
Component.onCompleted: {
addAdditionalComponents("machinesDetailPane")
}
Connections {
target: Printer
onAdditionalComponentsChanged:
{
if(areaId == "machinesDetailPane") {
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
}
target: CuraApplication
onAdditionalComponentsChanged: addAdditionalComponents
}
function addAdditionalComponents (areaId) {
if(areaId == "machinesDetailPane") {
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
}
}
}

View file

@ -41,7 +41,7 @@ TabView
Tab
{
title: catalog.i18nc("@title","Information")
title: catalog.i18nc("@title", "Information")
anchors.margins: UM.Theme.getSize("default_margin").width

View file

@ -182,6 +182,7 @@ UM.ManagementPage
{
Cura.MachineManager.setActiveMaterial(material_id)
}
// TODO: this doesn't work because the source is a bit delayed
base.objectList.currentIndex = base.getIndexById(material_id);
}
},
@ -292,10 +293,16 @@ UM.ManagementPage
base_file = base.currentItem.id
}
var guid = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "GUID")
// remove base container first, it otherwise triggers loading the base file while removing other containers
var base_containers = Cura.ContainerManager.findInstanceContainers({"GUID": guid, "id": base_file, "base_file": base_file, "type": "material"})
for(var i in base_containers)
{
Cura.ContainerManager.removeContainer(base_containers[i]);
}
var containers = Cura.ContainerManager.findInstanceContainers({"GUID": guid, "base_file": base_file, "type": "material"})
for(var i in containers)
{
Cura.ContainerManager.removeContainer(containers[i])
Cura.ContainerManager.removeContainer(containers[i]);
}
if(base.objectList.currentIndex > 0)
{
@ -322,7 +329,6 @@ UM.ManagementPage
{
messageDialog.icon = StandardIcon.Information
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl)
currentItem = base.model.getItem(base.objectList.currentIndex)
}
else if(result.status == "duplicate")
{

View file

@ -208,7 +208,7 @@ UM.ManagementPage
anchors.right: parent.right
anchors.bottom: parent.bottom
currentIndex: ExtruderManager.extruderCount > 0 ? ExtruderManager.activeExtruderIndex + 1 : 0
currentIndex: Cura.ExtruderManager.extruderCount > 0 ? Cura.ExtruderManager.activeExtruderIndex + 1 : 0
ProfileTab
{

View file

@ -87,7 +87,7 @@ Column
Label //Extruder name.
{
text: ExtruderManager.getExtruderName(index) != "" ? ExtruderManager.getExtruderName(index) : catalog.i18nc("@label", "Extruder")
text: Cura.ExtruderManager.getExtruderName(index) != "" ? Cura.ExtruderManager.getExtruderName(index) : catalog.i18nc("@label", "Extruder")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
anchors.left: parent.left
@ -1171,4 +1171,4 @@ Column
}
}
}
}
}

View file

@ -12,11 +12,9 @@ Item {
id: base;
UM.I18nCatalog { id: catalog; name:"cura"}
property real progress: UM.Backend.progress;
property int backendState: UM.Backend.state;
property var backend: CuraApplication.getBackend();
property bool activity: CuraApplication.platformActivity;
property real progress: UM.Backend.progress
property int backendState: UM.Backend.state
property bool activity: CuraApplication.platformActivity
property alias buttonRowWidth: saveRow.width
@ -28,6 +26,10 @@ Item {
return catalog.i18nc("@label:PrintjobStatus", "Please load a 3D model");
}
if (base.backendState == "undefined") {
return ""
}
switch(base.backendState)
{
case 1:
@ -45,6 +47,18 @@ 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)
}
}
Label {
id: statusLabel
width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width
@ -73,7 +87,7 @@ Item {
height: parent.height
color: UM.Theme.getColor("progressbar_control")
radius: UM.Theme.getSize("progressbar_radius").width
visible: base.backendState == 2 ? true : false
visible: (base.backendState != "undefined" && base.backendState == 2) ? true : false
}
}
@ -86,6 +100,10 @@ Item {
if (saveToButton.enabled) {
saveToButton.clicked();
}
// prepare button
if (prepareButton.enabled) {
sliceOrStopSlicing();
}
}
}
@ -119,14 +137,19 @@ Item {
spacing: UM.Theme.getSize("default_margin").width
}
Component.onCompleted: {
saveRow.addAdditionalComponents("saveButton")
}
Connections {
target: Printer
onAdditionalComponentsChanged:
{
if(areaId == "saveButton") {
for (var component in CuraApplication.additionalComponents["saveButton"]) {
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
target: CuraApplication
onAdditionalComponentsChanged: saveRow.addAdditionalComponents("saveButton")
}
function addAdditionalComponents (areaId) {
if(areaId == "saveButton") {
for (var component in CuraApplication.additionalComponents["saveButton"]) {
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
}
}
@ -145,12 +168,10 @@ Item {
Button {
id: prepareButton
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
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 == 1 || base.backendState == 2) && base.activity == true
visible: {
return !autoSlice && (base.backendState == 1 || base.backendState == 2) && base.activity == true;
}
enabled: base.backendState != "undefined" && (base.backendState == 1 || base.backendState == 2) && base.activity == true
visible: base.backendState != "undefined" && !autoSlice && (base.backendState == 1 || base.backendState == 2) && base.activity == true
property bool autoSlice
height: UM.Theme.getSize("save_button_save_to_button").height
@ -159,14 +180,10 @@ Item {
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
// 1 = not started, 5 = disabled
text: [1, 5].indexOf(UM.Backend.state) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
text: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
onClicked:
{
if ([1, 5].indexOf(UM.Backend.state) != -1) {
backend.forceSlice();
} else {
backend.stopSlicing();
}
sliceOrStopSlicing();
}
style: ButtonStyle {
@ -227,10 +244,8 @@ Item {
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
// 3 = done, 5 = disabled
enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: {
return autoSlice || ((base.backendState == 3 || base.backendState == 5) && base.activity == true);
}
enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: base.backendState != "undefined" && autoSlice || ((base.backendState == 3 || base.backendState == 5) && base.activity == true)
property bool autoSlice
height: UM.Theme.getSize("save_button_save_to_button").height
@ -307,8 +322,8 @@ Item {
width: UM.Theme.getSize("save_button_save_to_button").height
height: UM.Theme.getSize("save_button_save_to_button").height
// 3 = Done, 5 = Disabled
enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true
enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: base.backendState != "undefined" && (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true
style: ButtonStyle {

View file

@ -1,5 +1,5 @@
// Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 2.0
@ -184,13 +184,17 @@ Button
onClicked:
{
forceActiveFocus();
if(definition.expanded)
{
settingDefinitionsModel.collapse(definition.key);
} else {
}
else
{
settingDefinitionsModel.expandAll(definition.key);
}
//Set focus so that tab navigation continues from this point on.
//NB: This must be set AFTER collapsing/expanding the category so that the scroll position is correct.
forceActiveFocus();
}
onActiveFocusChanged:
{

View file

@ -1,5 +1,5 @@
// Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Layouts 1.1
@ -13,9 +13,9 @@ import "."
Item {
id: base;
height: UM.Theme.getSize("section").height;
height: UM.Theme.getSize("section").height
property alias contents: controlContainer.children;
property alias contents: controlContainer.children
property alias hovered: mouse.containsMouse
property var showRevertButton: true
@ -153,10 +153,10 @@ Item {
onEntered: {
hoverTimer.stop();
var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders") + ".";
var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders.");
if ((resolve != "None") && (stackLevel != 0)) {
// We come here if a setting has a resolve and the setting is not manually edited.
tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + ExtruderManager.getInstanceExtruderValues(definition.key) + "].";
tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + Cura.ExtruderManager.getInstanceExtruderValues(definition.key) + "].";
}
base.showTooltip(tooltipText);
}
@ -178,8 +178,13 @@ Item {
iconSource: UM.Theme.getIcon("reset")
onClicked: {
revertButton.focus = true;
Cura.MachineManager.clearUserSettingAllCurrentStacks(propertyProvider.key);
revertButton.focus = true
if (externalResetHandler) {
externalResetHandler(propertyProvider.key)
} else {
Cura.MachineManager.clearUserSettingAllCurrentStacks(propertyProvider.key)
}
}
onEntered: { hoverTimer.stop(); base.showTooltip(catalog.i18nc("@label", "This setting has a value that is different from the profile.\n\nClick to restore the value of the profile.")) }

View file

@ -1,5 +1,5 @@
// Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 2.0
@ -108,6 +108,7 @@ SettingItem
left: parent.left
leftMargin: UM.Theme.getSize("setting_unit_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("setting_unit_margin").width
verticalCenter: parent.verticalCenter
}
renderType: Text.NativeRendering
@ -154,7 +155,8 @@ SettingItem
selectByMouse: true;
maximumLength: (definition.type == "[int]") ? 20 : (definition.type == "str") ? -1 : 10;
maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 10;
clip: true; //Hide any text that exceeds the width of the text box.
validator: RegExpValidator { regExp: (definition.type == "[int]") ? /^\[?(\s*-?[0-9]{0,9}\s*,)*(\s*-?[0-9]{0,9})\s*\]?$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : (definition.type == "float") ? /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ : /^.*$/ } // definition.type property from parent loader used to disallow fractional number entry

View file

@ -275,7 +275,7 @@ Item
Behavior on opacity { NumberAnimation { duration: 100 } }
enabled:
{
if(!ExtruderManager.activeExtruderStackId && machineExtruderCount.properties.value > 1)
if (!Cura.ExtruderManager.activeExtruderStackId && machineExtruderCount.properties.value > 1)
{
// disable all controls on the global tab, except categories
return model.type == "category"
@ -287,6 +287,7 @@ Item
property var settingDefinitionsModel: definitionsModel
property var propertyProvider: provider
property var globalPropertyProvider: inheritStackProvider
property var externalResetHandler: false
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
@ -337,7 +338,7 @@ Item
// machine gets changed.
var activeMachineId = Cura.MachineManager.activeMachineId;
if(!model.settable_per_extruder || machineExtruderCount.properties.value == 1)
if(!model.settable_per_extruder)
{
//Not settable per extruder or there only is global, so we must pick global.
return activeMachineId;
@ -345,12 +346,12 @@ Item
if(inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0)
{
//We have limit_to_extruder, so pick that stack.
return ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)];
return Cura.ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)];
}
if(ExtruderManager.activeExtruderStackId)
if(Cura.ExtruderManager.activeExtruderStackId)
{
//We're on an extruder tab. Pick the current extruder.
return ExtruderManager.activeExtruderStackId;
return Cura.ExtruderManager.activeExtruderStackId;
}
//No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab.
return activeMachineId;

View file

@ -21,9 +21,8 @@ Rectangle
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
property int backendState: UM.Backend.state
property bool monitoringPrint: false
property bool monitoringPrint: UM.Controller.activeStage.stageId == "MonitorStage"
property variant printDuration: PrintInformation.currentPrintTime
property variant printMaterialLengths: PrintInformation.materialLengths
@ -86,10 +85,19 @@ Rectangle
}
}
MachineSelection {
id: machineSelection
width: base.width
height: UM.Theme.getSize("sidebar_header").height
anchors.top: base.top
anchors.right: parent.right
}
SidebarHeader {
id: header
width: parent.width
visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants
anchors.top: machineSelection.bottom
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
@ -225,7 +233,7 @@ Rectangle
{
id: controlItem
anchors.bottom: footerSeparator.top
anchors.top: headerSeparator.bottom
anchors.top: monitoringPrint ? machineSelection.bottom : headerSeparator.bottom
anchors.left: base.left
anchors.right: base.right
sourceComponent:
@ -244,7 +252,7 @@ Rectangle
Loader
{
anchors.bottom: footerSeparator.top
anchors.top: headerSeparator.bottom
anchors.top: monitoringPrint ? machineSelection.bottom : headerSeparator.bottom
anchors.left: base.left
anchors.right: base.right
source:
@ -305,7 +313,6 @@ Rectangle
onEntered:
{
if(base.printDuration.valid && !base.printDuration.isTotalDurationZero)
{
// All the time information for the different features is achieved
@ -313,31 +320,20 @@ Rectangle
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 specification</b><br/><table>");
var tooltip_html = "<b>%1</b><br/><table width=\"100%\">".arg(catalog.i18nc("@tooltip", "Time specification"));
for(var feature in print_time)
{
if(!print_time[feature].isTotalDurationZero)
{
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) + "%" +
tooltip_html += "<tr><td>" + feature + ":</td>" +
"<td align=\"right\" valign=\"bottom\">&nbsp;&nbsp;%1</td>".arg(print_time[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) +
"<td align=\"right\" valign=\"bottom\">&nbsp;&nbsp;%1%</td>".arg(Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds)) +
"</td></tr>";
}
}
content += "</table>";
tooltip_html += "</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), tooltip_html);
}
}
onExited:
@ -349,9 +345,26 @@ Rectangle
Label
{
function formatRow(items)
{
var row_html = "<tr>";
for(var item = 0; item < items.length; item++)
{
if (item == 0)
{
row_html += "<td valign=\"bottom\">%1</td>".arg(items[item]);
}
else
{
row_html += "<td align=\"right\" valign=\"bottom\">&nbsp;&nbsp;%1</td>".arg(items[item]);
}
}
row_html += "</tr>";
return row_html;
}
function getSpecsData(){
function getSpecsData()
{
var lengths = [];
var total_length = 0;
var weights = [];
@ -360,7 +373,8 @@ Rectangle
var total_cost = 0;
var some_costs_known = false;
var names = [];
if(base.printMaterialLengths) {
if(base.printMaterialLengths)
{
for(var index = 0; index < base.printMaterialLengths.length; index++)
{
if(base.printMaterialLengths[index] > 0)
@ -388,34 +402,28 @@ Rectangle
costs = ["0.00"];
}
var tooltip_html = "<b>%1</b><br/><table>".arg(catalog.i18nc("@label", "Cost specification"));
var tooltip_html = "<b>%1</b><br/><table width=\"100%\">".arg(catalog.i18nc("@label", "Cost specification"));
for(var index = 0; index < lengths.length; index++)
{
var item_strings = [
tooltip_html += formatRow([
"%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]);
}
"%1&nbsp;%2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
]);
}
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]);
if(lengths.length > 1)
{
tooltip_html += formatRow([
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></table>";
tooltip_html += "</table>";
tooltipText = tooltip_html;
return tooltipText
}
@ -511,7 +519,6 @@ Rectangle
visible: monitoringPrint
}
SidebarTooltip
{
id: tooltip;

View file

@ -14,7 +14,7 @@ Column
{
id: base;
property int currentExtruderIndex: ExtruderManager.activeExtruderIndex;
property int currentExtruderIndex: Cura.ExtruderManager.activeExtruderIndex;
property bool currentExtruderVisible: extrudersList.visible;
spacing: Math.floor(UM.Theme.getSize("sidebar_margin").width * 0.9)
@ -34,6 +34,7 @@ Column
width: height
}
// Extruder Row
Item
{
id: extruderSelectionRow
@ -72,7 +73,7 @@ Column
orientation: ListView.Horizontal
model: Cura.ExtrudersModel { id: extrudersModel; addGlobal: false }
model: Cura.ExtrudersModel { id: extrudersModel; }
Connections
{
@ -93,7 +94,7 @@ Column
onClicked:
{
forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values.
ExtruderManager.setActiveExtruderIndex(index);
Cura.ExtruderManager.setActiveExtruderIndex(index);
}
style: ButtonStyle
@ -185,6 +186,8 @@ Column
// Only draw the filling colour of the material inside the SVG border.
Rectangle
{
id: materialColorCircle
anchors
{
right: parent.right
@ -346,7 +349,7 @@ Column
Label {
id: materialInfoLabel
wrapMode: Text.WordWrap
text: catalog.i18nc("@label", "<a href='%1'>Check material compatibility</a>")
text: catalog.i18nc("@label", "<a href='%1'>Check compatibility</a>")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
linkColor: UM.Theme.getColor("text_link")

View file

@ -19,7 +19,7 @@ Item
property Action configureSettings;
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
property bool settingsEnabled: ExtruderManager.activeExtruderStackId || machineExtruderCount.properties.value == 1
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || machineExtruderCount.properties.value == 1
Component.onCompleted: PrintInformation.enabled = true
Component.onDestruction: PrintInformation.enabled = false
@ -303,7 +303,7 @@ Item
// 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) {
if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) {
// start updating with short delay
qualitySliderChangeTimer.start()
}
@ -340,6 +340,8 @@ Item
text: catalog.i18nc("@label", "Print Speed")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
width: parseInt(UM.Theme.getSize("sidebar").width * 0.35)
elide: Text.ElideRight
}
Label
@ -368,7 +370,7 @@ Item
{
id: customisedSettings
visible: Cura.SimpleModeSettingsManager.isProfileCustomized
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated
height: speedSlider.height * 0.8
width: speedSlider.height * 0.8
@ -381,7 +383,18 @@ Item
onClicked:
{
discardOrKeepProfileChangesDialog.show()
// if the current profile is user-created, switch to a built-in quality
if (Cura.SimpleModeSettingsManager.isProfileUserCreated)
{
if (Cura.ProfilesModel.rowCount() > 0)
{
Cura.MachineManager.setActiveQuality(Cura.ProfilesModel.getItem(0).id)
}
}
if (Cura.SimpleModeSettingsManager.isProfileCustomized)
{
discardOrKeepProfileChangesDialog.show()
}
}
onEntered:
{
@ -392,8 +405,6 @@ Item
}
}
//
// Infill
//
@ -557,18 +568,20 @@ Item
model: infillModel
anchors.fill: parent
property int activeIndex: {
function activeIndex () {
for (var i = 0; i < infillModel.count; i++) {
var density = parseInt(infillDensity.properties.value)
var steps = parseInt(infillSteps.properties.value)
var infillModelItem = infillModel.get(i)
if (density >= infillModelItem.percentageMin
if (infillModelItem != "undefined"
&& density >= infillModelItem.percentageMin
&& density <= infillModelItem.percentageMax
&& steps >= infillModelItem.stepsMin
&& steps <= infillModelItem.stepsMax){
return i
}
&& steps <= infillModelItem.stepsMax
){
return i
}
}
return -1
}
@ -576,7 +589,7 @@ Item
Rectangle
{
anchors.fill: parent
visible: infillIconList.activeIndex == index
visible: infillIconList.activeIndex() == index
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("quality_slider_unavailable")

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.2 as UM
import UM 1.4 as UM
import Cura 1.0 as Cura
import "Menus"
@ -16,26 +16,28 @@ Rectangle
anchors.left: parent.left
anchors.right: parent.right
height: UM.Theme.getSize("sidebar_header").height
color: base.monitoringPrint ? UM.Theme.getColor("topbar_background_color_monitoring") : UM.Theme.getColor("topbar_background_color")
color: UM.Controller.activeStage.stageId == "MonitorStage" ? UM.Theme.getColor("topbar_background_color_monitoring") : UM.Theme.getColor("topbar_background_color")
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
property bool monitoringPrint: false
// outgoing signal
signal startMonitoringPrint()
signal stopMonitoringPrint()
property int rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
property int allItemsWidth: 0;
// update monitoring status when event was triggered outside topbar
Component.onCompleted: {
startMonitoringPrint.connect(function () {
base.monitoringPrint = true
UM.Controller.disableModelRendering()
})
stopMonitoringPrint.connect(function () {
base.monitoringPrint = false
UM.Controller.enableModelRendering()
})
function updateMarginsAndSizes() {
if (UM.Preferences.getValue("cura/sidebar_collapsed"))
{
rightMargin = UM.Theme.getSize("default_margin").width;
}
else
{
rightMargin = UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
}
allItemsWidth = (
logo.width + UM.Theme.getSize("topbar_logo_right_margin").width +
UM.Theme.getSize("topbar_logo_right_margin").width + stagesMenuContainer.width +
UM.Theme.getSize("default_margin").width + viewModeButton.width +
rightMargin);
}
UM.I18nCatalog
@ -61,163 +63,111 @@ Rectangle
Row
{
id: stagesMenuContainer
anchors.left: logo.right
anchors.leftMargin: UM.Theme.getSize("topbar_logo_right_margin").width
anchors.right: machineSelection.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
Button
// The topbar is dynamically filled with all available stages
Repeater
{
id: showSettings
height: UM.Theme.getSize("sidebar_header").height
text: catalog.i18nc("@title:tab", "Prepare")
checkable: true
checked: isChecked()
exclusiveGroup: sidebarHeaderBarGroup
style: UM.Theme.styles.topbar_header_tab
id: stagesMenu
// We use a Qt.binding to re-bind the checkbox state after manually setting it
// https://stackoverflow.com/questions/38798450/qt-5-7-qml-why-are-my-checkbox-property-bindings-disappearing
onClicked: {
base.stopMonitoringPrint()
checked = Qt.binding(isChecked)
}
model: UM.StageModel{}
function isChecked () {
return !base.monitoringPrint
}
property color overlayColor: "transparent"
property string overlayIconSource: ""
}
Button
{
id: showMonitor
width: UM.Theme.getSize("topbar_button").width
height: UM.Theme.getSize("sidebar_header").height
text: catalog.i18nc("@title:tab", "Monitor")
checkable: true
checked: isChecked()
exclusiveGroup: sidebarHeaderBarGroup
style: UM.Theme.styles.topbar_header_tab_no_overlay
// We use a Qt.binding to re-bind the checkbox state after manually setting it
// https://stackoverflow.com/questions/38798450/qt-5-7-qml-why-are-my-checkbox-property-bindings-disappearing
onClicked: {
base.startMonitoringPrint()
checked = Qt.binding(isChecked)
}
function isChecked () {
return base.monitoringPrint
}
property string iconSource:
delegate: Button
{
if (!printerConnected)
{
return UM.Theme.getIcon("tab_status_unknown");
}
else if (!printerAcceptsCommands)
{
return UM.Theme.getIcon("tab_status_unknown");
}
text: model.name
checkable: true
checked: model.active
exclusiveGroup: topbarMenuGroup
style: (model.stage.iconSource != "") ? UM.Theme.styles.topbar_header_tab_no_overlay : UM.Theme.styles.topbar_header_tab
height: UM.Theme.getSize("sidebar_header").height
onClicked: UM.Controller.setActiveStage(model.id)
iconSource: model.stage.iconSource
if (Cura.MachineManager.printerOutputDevices[0].printerState == "maintenance")
{
return UM.Theme.getIcon("tab_status_busy");
}
switch (Cura.MachineManager.printerOutputDevices[0].jobState)
{
case "printing":
case "pre_print":
case "pausing":
case "resuming":
return UM.Theme.getIcon("tab_status_busy");
case "wait_cleanup":
return UM.Theme.getIcon("tab_status_finished");
case "ready":
case "":
return UM.Theme.getIcon("tab_status_connected")
case "paused":
return UM.Theme.getIcon("tab_status_paused")
case "error":
return UM.Theme.getIcon("tab_status_stopped")
default:
return UM.Theme.getIcon("tab_status_unknown")
}
property color overlayColor: "transparent"
property string overlayIconSource: ""
}
}
ExclusiveGroup { id: sidebarHeaderBarGroup }
ExclusiveGroup { id: topbarMenuGroup }
}
ToolButton
// View orientation Item
Row
{
id: machineSelection
text: Cura.MachineManager.activeMachineName
id: viewOrientationControl
height: 30
spacing: 2
visible: UM.Controller.activeStage.stageId != "MonitorStage"
width: UM.Theme.getSize("sidebar").width
height: UM.Theme.getSize("sidebar_header").height
tooltip: Cura.MachineManager.activeMachineName
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
style: ButtonStyle
anchors
{
background: Rectangle
{
color:
{
if(control.pressed)
{
return UM.Theme.getColor("sidebar_header_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("sidebar_header_hover");
}
else
{
return UM.Theme.getColor("sidebar_header_bar");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
UM.RecolorImage
{
id: downArrow
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: UM.Theme.getColor("text_emphasis")
source: UM.Theme.getIcon("arrow_bottom")
}
Label
{
id: sidebarComboBoxLabel
color: UM.Theme.getColor("sidebar_header_text_active")
text: control.text;
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("large")
}
}
label: Label {}
verticalCenter: base.verticalCenter
right: viewModeButton.left
rightMargin: UM.Theme.getSize("default_margin").width
}
menu: PrinterMenu { }
// #1 3d view
Button
{
iconSource: UM.Theme.getIcon("view_3d")
style: UM.Theme.styles.small_tool_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("3d", 0);
}
visible: base.width - allItemsWidth - 4 * this.width > 0;
}
// #2 Front view
Button
{
iconSource: UM.Theme.getIcon("view_front")
style: UM.Theme.styles.small_tool_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("home", 0);
}
visible: base.width - allItemsWidth - 3 * this.width > 0;
}
// #3 Top view
Button
{
iconSource: UM.Theme.getIcon("view_top")
style: UM.Theme.styles.small_tool_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("y", 90);
}
visible: base.width - allItemsWidth - 2 * this.width > 0;
}
// #4 Left view
Button
{
iconSource: UM.Theme.getIcon("view_left")
style: UM.Theme.styles.small_tool_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("x", 90);
}
visible: base.width - allItemsWidth - 1 * this.width > 0;
}
// #5 Left view
Button
{
iconSource: UM.Theme.getIcon("view_right")
style: UM.Theme.styles.small_tool_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("x", -90);
}
visible: base.width - allItemsWidth > 0;
}
}
ComboBox
@ -227,11 +177,11 @@ Rectangle
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width
rightMargin: rightMargin
}
style: UM.Theme.styles.combobox
visible: !base.monitoringPrint
visible: UM.Controller.activeStage.stageId != "MonitorStage"
model: UM.ViewModel { }
textRole: "name"
@ -287,4 +237,16 @@ Rectangle
source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";
}
// Expand or collapse sidebar
Connections
{
target: Cura.Actions.expandSidebar
onTriggered: updateMarginsAndSizes()
}
Component.onCompleted:
{
updateMarginsAndSizes();
}
}