mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Sidebar stuff is now properly done in a loader (and in seperate files)
CURA-1036
This commit is contained in:
parent
c38797b4fe
commit
0477955974
3 changed files with 164 additions and 109 deletions
118
resources/qml/PrintMonitor.qml
Normal file
118
resources/qml/PrintMonitor.qml
Normal file
|
@ -0,0 +1,118 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 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
|
||||
|
||||
Column
|
||||
{
|
||||
id: printMonitor
|
||||
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorSection
|
||||
property string label: catalog.i18nc("@label", "Temperatures")
|
||||
}
|
||||
Repeater
|
||||
{
|
||||
model: machineExtruderCount.properties.value
|
||||
delegate: Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: machineExtruderCount.properties.value > 1 ? catalog.i18nc("@label", "Hotend Temperature %1").arg(index + 1) : catalog.i18nc("@label", "Hotend Temperature")
|
||||
property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[index]) + "°C" : ""
|
||||
}
|
||||
}
|
||||
Repeater
|
||||
{
|
||||
model: machineHeatedBed.properties.value == "True" ? 1 : 0
|
||||
delegate: Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Bed Temperature")
|
||||
property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C" : ""
|
||||
}
|
||||
}
|
||||
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorSection
|
||||
property string label: catalog.i18nc("@label", "Active print")
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Job Name")
|
||||
property string value: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobName : ""
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Printing Time")
|
||||
property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal) : ""
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Estimated time left")
|
||||
property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) : ""
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Current Layer")
|
||||
property string value: printerConnected ? "0" : ""
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: monitorItem
|
||||
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
Label
|
||||
{
|
||||
text: label
|
||||
color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
font: UM.Theme.getFont("default")
|
||||
width: base.width * 0.4
|
||||
elide: Text.ElideRight
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: value
|
||||
color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
font: UM.Theme.getFont("default")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
Component
|
||||
{
|
||||
id: monitorSection
|
||||
|
||||
Rectangle
|
||||
{
|
||||
color: UM.Theme.getColor("setting_category")
|
||||
width: base.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
height: UM.Theme.getSize("section").height
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
text: label
|
||||
font: UM.Theme.getFont("setting_category")
|
||||
color: UM.Theme.getColor("setting_category_text")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -285,122 +285,16 @@ Rectangle
|
|||
}
|
||||
}
|
||||
|
||||
// Item that shows the print monitor properties
|
||||
Column
|
||||
Loader
|
||||
{
|
||||
id: printMonitor
|
||||
|
||||
anchors.bottom: footerSeparator.top
|
||||
anchors.top: monitorLabel.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.left: base.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: base.right
|
||||
visible: monitoringPrint
|
||||
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorSection
|
||||
property string label: catalog.i18nc("@label", "Temperatures")
|
||||
}
|
||||
Repeater
|
||||
{
|
||||
model: machineExtruderCount.properties.value
|
||||
delegate: Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: machineExtruderCount.properties.value > 1 ? catalog.i18nc("@label", "Hotend Temperature %1").arg(index + 1) : catalog.i18nc("@label", "Hotend Temperature")
|
||||
property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[index]) + "°C" : ""
|
||||
}
|
||||
}
|
||||
Repeater
|
||||
{
|
||||
model: machineHeatedBed.properties.value == "True" ? 1 : 0
|
||||
delegate: Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Bed Temperature")
|
||||
property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C" : ""
|
||||
}
|
||||
}
|
||||
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorSection
|
||||
property string label: catalog.i18nc("@label", "Active print")
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Job Name")
|
||||
property string value: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobName : ""
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Printing Time")
|
||||
property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal) : ""
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Estimated time left")
|
||||
property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) : ""
|
||||
}
|
||||
Loader
|
||||
{
|
||||
sourceComponent: monitorItem
|
||||
property string label: catalog.i18nc("@label", "Current Layer")
|
||||
property string value: printerConnected ? "0" : ""
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: monitorItem
|
||||
|
||||
Row
|
||||
{
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
Label
|
||||
{
|
||||
text: label
|
||||
color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
font: UM.Theme.getFont("default")
|
||||
width: base.width * 0.4
|
||||
elide: Text.ElideRight
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: value
|
||||
color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
font: UM.Theme.getFont("default")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
Component
|
||||
{
|
||||
id: monitorSection
|
||||
|
||||
Rectangle
|
||||
{
|
||||
color: UM.Theme.getColor("setting_category")
|
||||
width: base.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
height: UM.Theme.getSize("section").height
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
text: label
|
||||
font: UM.Theme.getFont("setting_category")
|
||||
color: UM.Theme.getColor("setting_category_text")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
source: monitoringPrint ? "PrintMonitor.qml": "SidebarContents.qml"
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
|
|
43
resources/qml/SidebarContents.qml
Normal file
43
resources/qml/SidebarContents.qml
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 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
|
||||
|
||||
StackView
|
||||
{
|
||||
id: sidebarContents
|
||||
|
||||
delegate: StackViewDelegate
|
||||
{
|
||||
function transitionFinished(properties)
|
||||
{
|
||||
properties.exitItem.opacity = 1
|
||||
}
|
||||
|
||||
pushTransition: StackViewTransition
|
||||
{
|
||||
PropertyAnimation
|
||||
{
|
||||
target: enterItem
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: 100
|
||||
}
|
||||
PropertyAnimation
|
||||
{
|
||||
target: exitItem
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue