mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00

We created a new set of icons for Cura. These icons had to be reverted though because they weren't working out in the interface for the last release yet. This unreverts them, basically adding them back hoping that we'll get them fixed in time for the next release. Contributes to issue CURA-8342. Revert "Revert "Fix merge conflict"" This reverts commitbb20e3307f
. Revert "Revert "Merge pull request #9716 from Ultimaker/CURA-8010_new_icons"" This reverts commit70e4e9640e
. Revert "Revert "Fix typo in icon name"" This reverts commit38ce22ba7c
. Revert "Revert "Add list for deprecated icons"" This reverts commit119a957e7f
. Revert "Revert "Add Function icon"" This reverts commit760726cf0b
. Revert "Revert "Switch out inherit icon"" This reverts commit26afff6093
. Revert "Revert "Merge branch 'CURA-8205_Introduce_new_icons_in_Cura' of github.com:Ultimaker/Cura"" This reverts commit6483db3d47
. Revert "Fix incorrect icons" This reverts commit02a4ade2a5
.
161 lines
4.7 KiB
QML
161 lines
4.7 KiB
QML
// Copyright (c) 2018 Ultimaker B.V.
|
|
// Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.7
|
|
import QtQuick.Controls 2.1
|
|
import QtQuick.Layouts 1.3
|
|
import QtQuick.Controls 1.4 as Controls1
|
|
|
|
import UM 1.3 as UM
|
|
import Cura 1.0 as Cura
|
|
|
|
|
|
// This element contains all the elements the user needs to create a printjob from the
|
|
// model(s) that is(are) on the buildplate. Mainly the button to start/stop the slicing
|
|
// process and a progress bar to see the progress of the process.
|
|
Column
|
|
{
|
|
id: widget
|
|
|
|
spacing: UM.Theme.getSize("thin_margin").height
|
|
|
|
UM.I18nCatalog
|
|
{
|
|
id: catalog
|
|
name: "cura"
|
|
}
|
|
|
|
property real progress: UM.Backend.progress
|
|
property int backendState: UM.Backend.state
|
|
// As the collection of settings to send to the engine might take some time, we have an extra value to indicate
|
|
// That the user pressed the button but it's still waiting for the backend to acknowledge that it got it.
|
|
property bool waitingForSliceToStart: false
|
|
onBackendStateChanged: waitingForSliceToStart = false
|
|
|
|
function sliceOrStopSlicing()
|
|
{
|
|
if (widget.backendState == UM.Backend.NotStarted)
|
|
{
|
|
widget.waitingForSliceToStart = true
|
|
CuraApplication.backend.forceSlice()
|
|
}
|
|
else
|
|
{
|
|
widget.waitingForSliceToStart = false
|
|
CuraApplication.backend.stopSlicing()
|
|
}
|
|
}
|
|
|
|
Label
|
|
{
|
|
id: autoSlicingLabel
|
|
width: parent.width
|
|
visible: progressBar.visible
|
|
|
|
text: catalog.i18nc("@label:PrintjobStatus", "Slicing...")
|
|
color: UM.Theme.getColor("text")
|
|
font: UM.Theme.getFont("default")
|
|
renderType: Text.NativeRendering
|
|
}
|
|
|
|
Cura.IconWithText
|
|
{
|
|
id: unableToSliceMessage
|
|
width: parent.width
|
|
visible: widget.backendState == UM.Backend.Error
|
|
|
|
text: catalog.i18nc("@label:PrintjobStatus", "Unable to slice")
|
|
source: UM.Theme.getIcon("Warning")
|
|
iconColor: UM.Theme.getColor("warning")
|
|
}
|
|
|
|
// Progress bar, only visible when the backend is in the process of slice the printjob
|
|
UM.ProgressBar
|
|
{
|
|
id: progressBar
|
|
width: parent.width
|
|
height: UM.Theme.getSize("progressbar").height
|
|
value: progress
|
|
indeterminate: widget.backendState == UM.Backend.NotStarted
|
|
visible: (widget.backendState == UM.Backend.Processing || (prepareButtons.autoSlice && widget.backendState == UM.Backend.NotStarted))
|
|
}
|
|
|
|
Item
|
|
{
|
|
id: prepareButtons
|
|
// Get the current value from the preferences
|
|
property bool autoSlice: UM.Preferences.getValue("general/auto_slice")
|
|
// Disable the slice process when
|
|
|
|
width: parent.width
|
|
height: UM.Theme.getSize("action_button").height
|
|
visible: !autoSlice
|
|
Cura.PrimaryButton
|
|
{
|
|
id: sliceButton
|
|
fixedWidthMode: true
|
|
|
|
height: parent.height
|
|
|
|
anchors.right: parent.right
|
|
anchors.left: parent.left
|
|
|
|
text: widget.waitingForSliceToStart ? catalog.i18nc("@button", "Processing"): catalog.i18nc("@button", "Slice")
|
|
tooltip: catalog.i18nc("@label", "Start the slicing process")
|
|
enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart
|
|
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
|
|
onClicked: sliceOrStopSlicing()
|
|
}
|
|
|
|
Cura.SecondaryButton
|
|
{
|
|
id: cancelButton
|
|
fixedWidthMode: true
|
|
height: parent.height
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
text: catalog.i18nc("@button", "Cancel")
|
|
enabled: sliceButton.enabled
|
|
visible: !sliceButton.visible
|
|
onClicked: sliceOrStopSlicing()
|
|
}
|
|
}
|
|
|
|
|
|
// React when the user changes the preference of having the auto slice enabled
|
|
Connections
|
|
{
|
|
target: UM.Preferences
|
|
function onPreferenceChanged(preference)
|
|
{
|
|
if (preference !== "general/auto_slice")
|
|
{
|
|
return;
|
|
}
|
|
|
|
var autoSlice = UM.Preferences.getValue("general/auto_slice")
|
|
if(prepareButtons.autoSlice != autoSlice)
|
|
{
|
|
prepareButtons.autoSlice = autoSlice
|
|
if(autoSlice)
|
|
{
|
|
CuraApplication.backend.forceSlice()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Shortcut for "slice/stop"
|
|
Controls1.Action
|
|
{
|
|
shortcut: "Ctrl+P"
|
|
onTriggered:
|
|
{
|
|
if (sliceButton.enabled)
|
|
{
|
|
sliceOrStopSlicing()
|
|
}
|
|
}
|
|
}
|
|
}
|