mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-05 16:51:12 -07:00
Merge branch 'master' of github.com:Ultimaker/Cura into network_rewrite
This commit is contained in:
commit
c28c20dbd7
24 changed files with 326 additions and 222 deletions
|
|
@ -20,14 +20,16 @@ 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
|
||||
onShowPrintMonitor: {
|
||||
if (show) {
|
||||
topbar.startMonitoringPrint()
|
||||
UM.Controller.setActiveStage("MonitorStage")
|
||||
} else {
|
||||
topbar.stopMonitoringPrint()
|
||||
UM.Controller.setActiveStage("PrepareStage")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -331,7 +333,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;
|
||||
|
|
@ -358,62 +360,49 @@ 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
|
||||
{
|
||||
id: sidebar;
|
||||
|
||||
anchors
|
||||
{
|
||||
top: topbar.bottom;
|
||||
bottom: parent.bottom;
|
||||
right: parent.right;
|
||||
}
|
||||
z: 1
|
||||
width: UM.Theme.getSize("sidebar").width;
|
||||
monitoringPrint: base.showPrintMonitor
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: viewportOverlay
|
||||
|
||||
color: UM.Theme.getColor("viewport_overlay")
|
||||
anchors
|
||||
{
|
||||
top: topbar.bottom
|
||||
bottom: parent.bottom
|
||||
left:parent.left
|
||||
right: sidebar.left
|
||||
}
|
||||
visible: opacity > 0
|
||||
opacity: base.showPrintMonitor ? 1 : 0
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.AllButtons
|
||||
|
||||
onWheel: wheel.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
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: sidebar
|
||||
|
||||
anchors
|
||||
{
|
||||
top: topbar.bottom
|
||||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
width: UM.Theme.getSize("sidebar").width
|
||||
z: 1
|
||||
|
||||
source: UM.Controller.activeStage.sidebarComponent
|
||||
}
|
||||
|
||||
Loader
|
||||
{
|
||||
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
|
||||
|
|
|
|||
|
|
@ -12,21 +12,23 @@ 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; }
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ Item {
|
|||
}
|
||||
|
||||
function sliceOrStopSlicing() {
|
||||
if ([1, 5].indexOf(UM.Backend.state) != -1) {
|
||||
if (backend != "undefined" && [1, 5].indexOf(UM.Backend.state) != -1) {
|
||||
backend.forceSlice();
|
||||
} else {
|
||||
backend.stopSlicing();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Rectangle
|
|||
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
|
||||
|
|
@ -263,7 +263,7 @@ Rectangle
|
|||
{
|
||||
id: controlItem
|
||||
anchors.bottom: footerSeparator.top
|
||||
anchors.top: headerSeparator.bottom
|
||||
anchors.top: monitoringPrint ? base.top : headerSeparator.bottom
|
||||
anchors.left: base.left
|
||||
anchors.right: base.right
|
||||
sourceComponent:
|
||||
|
|
@ -282,7 +282,7 @@ Rectangle
|
|||
Loader
|
||||
{
|
||||
anchors.bottom: footerSeparator.top
|
||||
anchors.top: headerSeparator.bottom
|
||||
anchors.top: monitoringPrint ? base.top : headerSeparator.bottom
|
||||
anchors.left: base.left
|
||||
anchors.right: base.right
|
||||
source:
|
||||
|
|
|
|||
|
|
@ -403,8 +403,6 @@ Item
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Infill
|
||||
//
|
||||
|
|
@ -568,18 +566,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
|
||||
}
|
||||
|
|
@ -587,7 +587,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")
|
||||
|
|
|
|||
|
|
@ -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,27 +16,10 @@ 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()
|
||||
|
||||
// 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()
|
||||
})
|
||||
}
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
|
|
@ -67,101 +50,30 @@ Rectangle
|
|||
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");
|
||||
}
|
||||
if (Cura.MachineManager.printerOutputDevices[0].state == "maintenance")
|
||||
{
|
||||
return UM.Theme.getIcon("tab_status_busy");
|
||||
}
|
||||
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].activePrinter == null)
|
||||
{
|
||||
return UM.Theme.getIcon("tab_status_connected")
|
||||
}
|
||||
|
||||
if(Cura.MachineManager.printerOutputDevices[0].activePrinter.activePrintJob == null)
|
||||
{
|
||||
return UM.Theme.getIcon("tab_status_connected")
|
||||
}
|
||||
|
||||
switch (Cura.MachineManager.printerOutputDevices[0].activePrinter.activePrintJob.state)
|
||||
{
|
||||
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
|
||||
|
|
@ -229,17 +141,17 @@ Rectangle
|
|||
menu: PrinterMenu { }
|
||||
}
|
||||
|
||||
//View orientation Item
|
||||
// View orientation Item
|
||||
Row
|
||||
{
|
||||
id: viewOrientationControl
|
||||
height: 30
|
||||
|
||||
spacing: 2
|
||||
visible: UM.Controller.activeStage.stageId != "MonitorStage"
|
||||
|
||||
visible: !base.monitoringPrint
|
||||
|
||||
anchors {
|
||||
anchors
|
||||
{
|
||||
verticalCenter: base.verticalCenter
|
||||
right: viewModeButton.right
|
||||
rightMargin: UM.Theme.getSize("default_margin").width + viewModeButton.width
|
||||
|
|
@ -317,7 +229,7 @@ Rectangle
|
|||
}
|
||||
|
||||
style: UM.Theme.styles.combobox
|
||||
visible: !base.monitoringPrint
|
||||
visible: UM.Controller.activeStage.stageId != "MonitorStage"
|
||||
|
||||
model: UM.ViewModel { }
|
||||
textRole: "name"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue