mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 22:35:03 -06:00
Merge remote-tracking branch 'origin/main' into CURA-7951_lock_rotation
# Conflicts: # resources/i18n/cs_CZ/cura.po # resources/i18n/cura.pot # resources/i18n/de_DE/cura.po # resources/i18n/es_ES/cura.po # resources/i18n/fi_FI/cura.po # resources/i18n/fr_FR/cura.po # resources/i18n/hu_HU/cura.po # resources/i18n/it_IT/cura.po # resources/i18n/ja_JP/cura.po # resources/i18n/ko_KR/cura.po # resources/i18n/nl_NL/cura.po # resources/i18n/pl_PL/cura.po # resources/i18n/pt_BR/cura.po # resources/i18n/pt_PT/cura.po # resources/i18n/ru_RU/cura.po # resources/i18n/tr_TR/cura.po # resources/i18n/zh_CN/cura.po # resources/i18n/zh_TW/cura.po
This commit is contained in:
commit
023dd3a9c5
399 changed files with 97363 additions and 146658 deletions
|
@ -117,7 +117,7 @@ Column
|
|||
property var printMaterialWeights: PrintInformation.materialWeights
|
||||
property var printMaterialCosts: PrintInformation.materialCosts
|
||||
property var printMaterialNames: PrintInformation.materialNames
|
||||
property var columnWidthMultipliers: [ 0.46, 0.18, 0.18, 0.18 ]
|
||||
property var columnWidthMultipliers: [ 0.26, 0.28, 0.18, 0.28 ]
|
||||
property var columnHorizontalAligns: [ Text.AlignLeft, Text.AlignHCenter, Text.AlignHCenter, Text.AlignRight ]
|
||||
|
||||
function getMaterialTable()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 UltiMaker
|
||||
// Copyright (c) 2023 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
pragma Singleton
|
||||
|
@ -6,7 +6,7 @@ pragma Singleton
|
|||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.4
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
import Cura 1.5 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
|
@ -62,6 +62,7 @@ Item
|
|||
property alias showProfileFolder: showProfileFolderAction
|
||||
property alias documentation: documentationAction
|
||||
property alias showTroubleshooting: showTroubleShootingAction
|
||||
property alias openSponsershipPage: openSponsershipPageAction
|
||||
property alias reportBug: reportBugAction
|
||||
property alias whatsNew: whatsNewAction
|
||||
property alias about: aboutAction
|
||||
|
@ -73,6 +74,15 @@ Item
|
|||
|
||||
property alias browsePackages: browsePackagesAction
|
||||
|
||||
property alias paste: pasteAction
|
||||
property alias copy: copyAction
|
||||
property alias cut: cutAction
|
||||
|
||||
readonly property bool copy_paste_enabled: {
|
||||
const all_enabled_packages = CuraApplication.getPackageManager().allEnabledPackages;
|
||||
return all_enabled_packages.includes("3MFReader") && all_enabled_packages.includes("3MFWriter");
|
||||
}
|
||||
|
||||
UM.I18nCatalog{id: catalog; name: "cura"}
|
||||
|
||||
|
||||
|
@ -83,6 +93,13 @@ Item
|
|||
text: catalog.i18nc("@action:inmenu", "Show Online Troubleshooting")
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: openSponsershipPageAction
|
||||
onTriggered: Qt.openUrlExternally("https://ultimaker.com/software/ultimaker-cura/sponsor/")
|
||||
text: catalog.i18nc("@action:inmenu", "Sponsor Cura")
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: toggleFullScreenAction
|
||||
|
@ -311,6 +328,33 @@ Item
|
|||
onTriggered: CuraActions.centerSelection()
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: copyAction
|
||||
text: catalog.i18nc("@action:inmenu menubar:edit", "Copy to clipboard")
|
||||
onTriggered: CuraActions.copy()
|
||||
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection && copy_paste_enabled
|
||||
shortcut: StandardKey.Copy
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: pasteAction
|
||||
text: catalog.i18nc("@action:inmenu menubar:edit", "Paste from clipboard")
|
||||
onTriggered: CuraActions.paste()
|
||||
enabled: UM.Controller.toolsEnabled && copy_paste_enabled
|
||||
shortcut: StandardKey.Paste
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: cutAction
|
||||
text: catalog.i18nc("@action:inmenu menubar:edit", "Cut")
|
||||
onTriggered: CuraActions.cut()
|
||||
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection && copy_paste_enabled
|
||||
shortcut: StandardKey.Cut
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: multiplySelectionAction
|
||||
|
|
|
@ -57,10 +57,10 @@ Popup
|
|||
permissionsRequired: []
|
||||
},
|
||||
{
|
||||
displayName: "UltiMaker Academy", //Not translated, since it's a brand name.
|
||||
thumbnail: UM.Theme.getIcon("Knowledge"),
|
||||
description: catalog.i18nc("@tooltip:button", "Become a 3D printing expert with UltiMaker e-learning."),
|
||||
link: "https://academy.ultimaker.com/?utm_source=cura&utm_medium=software&utm_campaign=switcher-academy",
|
||||
displayName: catalog.i18nc("@label:button", "Sponsor Cura"),
|
||||
thumbnail: UM.Theme.getIcon("Heart"),
|
||||
description: catalog.i18nc("@tooltip:button", "Show your support for Cura with a donation."),
|
||||
link: "https://ultimaker.com/software/ultimaker-cura/sponsor/",
|
||||
permissionsRequired: []
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
// Copyright (c) 2022 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.7 as UM
|
||||
import Cura 1.7 as Cura
|
||||
|
||||
|
||||
/*
|
||||
* A dialog that provides the option to pick a color. Currently it only asks for a hex code and shows the color
|
||||
* in a color swath
|
||||
*/
|
||||
UM.Dialog
|
||||
{
|
||||
id: base
|
||||
|
||||
property variant catalog: UM.I18nCatalog { name: "cura" }
|
||||
|
||||
margin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
property alias swatchGridColumns: colorSwatchGrid.columns
|
||||
|
||||
// In this case we would like to let the content of the dialog determine the size of the dialog
|
||||
// however with the current implementation of the dialog this is not possible, so instead we calculate
|
||||
// the size of the dialog ourselves.
|
||||
// Ugly workaround for windows having overlapping elements due to incorrect dialog width
|
||||
minimumWidth: content.width + (Qt.platform.os === "windows" ? 4 * margin : 2 * margin)
|
||||
minimumHeight: {
|
||||
const footerHeight = Math.max(okButton.height, cancelButton.height);
|
||||
return content.height + footerHeight + (Qt.platform.os === "windows" ? 5 * margin : 3 * margin);
|
||||
}
|
||||
|
||||
property alias color: colorInput.text
|
||||
property var swatchColors: [
|
||||
"#2161AF", "#57AFB2", "#F7B32D", "#E33D4A", "#C088AD",
|
||||
"#5D88BE", "#5ABD0E", "#E17239", "#F74E46", "#874AF9",
|
||||
"#50C2EC", "#8DC15A", "#C3977A", "#CD7776", "#9086BA",
|
||||
"#FFFFFF", "#D3D3D3", "#9E9E9E", "#5A5A5A", "#000000",
|
||||
]
|
||||
|
||||
Component.onCompleted: updateSwatches()
|
||||
onSwatchColorsChanged: updateSwatches()
|
||||
|
||||
function updateSwatches()
|
||||
{
|
||||
swatchColorsModel.clear();
|
||||
for (const swatchColor of base.swatchColors)
|
||||
{
|
||||
swatchColorsModel.append({ swatchColor });
|
||||
}
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
id: content
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
spacing: UM.Theme.getSize("wide_margin").height
|
||||
|
||||
GridLayout {
|
||||
id: colorSwatchGrid
|
||||
columns: 5
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
columnSpacing: UM.Theme.getSize("thick_margin").width
|
||||
rowSpacing: UM.Theme.getSize("thick_margin").height
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: ListModel
|
||||
{
|
||||
id: swatchColorsModel
|
||||
}
|
||||
|
||||
delegate: Rectangle
|
||||
{
|
||||
color: swatchColor
|
||||
implicitWidth: UM.Theme.getSize("medium_button_icon").width
|
||||
implicitHeight: UM.Theme.getSize("medium_button_icon").height
|
||||
radius: width / 2
|
||||
|
||||
UM.ColorImage
|
||||
{
|
||||
anchors.fill: parent
|
||||
visible: swatchColor == base.color
|
||||
source: UM.Theme.getIcon("Check", "low")
|
||||
color: UM.Theme.getColor("checkbox")
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: base.color = swatchColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout
|
||||
{
|
||||
width: parent.width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
UM.Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Hex")
|
||||
}
|
||||
|
||||
Cura.TextField
|
||||
{
|
||||
id: colorInput
|
||||
Layout.fillWidth: true
|
||||
text: "#FFFFFF"
|
||||
selectByMouse: true
|
||||
onTextChanged: {
|
||||
if (!text.startsWith("#"))
|
||||
{
|
||||
text = `#${text}`;
|
||||
}
|
||||
}
|
||||
validator: UM.HexColorValidator {}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
color: base.color
|
||||
Layout.preferredHeight: parent.height
|
||||
Layout.preferredWidth: height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buttonSpacing: UM.Theme.getSize("thin_margin").width
|
||||
|
||||
rightButtons:
|
||||
[
|
||||
Cura.TertiaryButton {
|
||||
id: cancelButton
|
||||
text: catalog.i18nc("@action:button", "Cancel")
|
||||
onClicked: base.close()
|
||||
},
|
||||
Cura.PrimaryButton {
|
||||
id: okButton
|
||||
text: catalog.i18nc("@action:button", "OK")
|
||||
onClicked: base.accept()
|
||||
}
|
||||
]
|
||||
}
|
|
@ -628,7 +628,7 @@ UM.MainWindow
|
|||
//: File open dialog title
|
||||
title: catalog.i18nc("@title:window","Open file(s)")
|
||||
modality: Qt.WindowModal
|
||||
fileMode: FileDialog.FileMode.ExistingFile
|
||||
fileMode: FileDialog.FileMode.OpenFiles
|
||||
nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
|
||||
currentFolder: CuraApplication.getDefaultPath("dialog_load_path")
|
||||
onAccepted:
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright (c) 2022 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 2.9
|
||||
|
||||
import UM 1.5 as UM
|
||||
import UM 1.6 as UM
|
||||
import Cura 1.5 as Cura
|
||||
|
||||
UM.Dialog
|
||||
|
@ -21,6 +21,7 @@ UM.Dialog
|
|||
|
||||
backgroundColor: UM.Theme.getColor("main_background")
|
||||
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: header
|
||||
|
@ -50,6 +51,15 @@ UM.Dialog
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
UM.I18nCatalog{id: catalog; name: "cura"}
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
projectsList.visible = !projectsList.visible;
|
||||
projectBuildInfoList.visible = !projectBuildInfoList.visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.Label
|
||||
|
@ -181,6 +191,18 @@ UM.Dialog
|
|||
}
|
||||
}
|
||||
|
||||
AboutDialogVersionsList{
|
||||
id: projectBuildInfoList
|
||||
|
||||
}
|
||||
|
||||
|
||||
onVisibleChanged:
|
||||
{
|
||||
projectsList.visible = true;
|
||||
projectBuildInfoList.visible = false;
|
||||
}
|
||||
|
||||
rightButtons: Cura.TertiaryButton
|
||||
{
|
||||
//: Close about dialog button
|
||||
|
|
|
@ -76,6 +76,11 @@ UM.TooltipArea
|
|||
anchors.left: fieldLabel.right
|
||||
anchors.leftMargin: spacing
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
// The control is set up for left to right. So we force it to that. If we don't, it will take the OS reading
|
||||
// direction, which might not be left to right. This will lead to the text overlapping with the unit
|
||||
horizontalAlignment: TextInput.AlignLeft
|
||||
|
||||
selectionColor: UM.Theme.getColor("text_selection")
|
||||
selectedTextColor: UM.Theme.getColor("setting_control_text")
|
||||
padding: 0
|
||||
|
|
|
@ -19,6 +19,8 @@ Cura.Menu
|
|||
// Selection-related actions.
|
||||
Cura.MenuItem { action: Cura.Actions.centerSelection; }
|
||||
Cura.MenuItem { action: Cura.Actions.deleteSelection; }
|
||||
Cura.MenuItem { action: Cura.Actions.copy; }
|
||||
Cura.MenuItem { action: Cura.Actions.paste; }
|
||||
Cura.MenuItem { action: Cura.Actions.multiplySelection; }
|
||||
|
||||
// Extruder selection - only visible if there is more than 1 extruder
|
||||
|
@ -44,8 +46,19 @@ Cura.Menu
|
|||
onTriggered: CuraActions.setExtruderForSelection(model.id)
|
||||
shortcut: "Ctrl+" + (model.index + 1)
|
||||
}
|
||||
// Add it to the fifth position (and above) as we want it to be added after the extruder header.
|
||||
onObjectAdded: function(index, object) { base.insertItem(index + 5, object) }
|
||||
|
||||
onObjectAdded: function(index, object) {
|
||||
var extruder_header_location = 5;
|
||||
// Find the location of the extruder header and insert it below that.
|
||||
for (var i = 0; i < base.count; i++)
|
||||
{
|
||||
if(base.itemAt(i) === extruderHeader)
|
||||
{
|
||||
extruder_header_location = i + 1;
|
||||
}
|
||||
}
|
||||
base.insertItem(extruder_header_location + index, object)
|
||||
}
|
||||
onObjectRemoved: function(index, object) { base.removeItem(object) }
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ Cura.Menu
|
|||
Cura.MenuItem { action: Cura.Actions.showTroubleshooting}
|
||||
Cura.MenuItem { action: Cura.Actions.documentation }
|
||||
Cura.MenuItem { action: Cura.Actions.reportBug }
|
||||
Cura.MenuItem { action: Cura.Actions.openSponsershipPage }
|
||||
Cura.MenuSeparator { }
|
||||
Cura.MenuItem { action: Cura.Actions.whatsNew }
|
||||
Cura.MenuItem { action: Cura.Actions.about }
|
||||
|
|
|
@ -430,11 +430,51 @@ UM.Window
|
|||
{
|
||||
id: refreshListButton
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
readonly property int _AccountSyncState_SYNCING: 0
|
||||
visible: Cura.API.account.syncState != _AccountSyncState_SYNCING
|
||||
enabled: visible
|
||||
text: catalog.i18nc("@button", "Refresh List")
|
||||
iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
|
||||
onClicked: Cura.API.account.sync(true)
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
width: childrenRect.width
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
height: refreshListButton.height
|
||||
visible: !refreshListButton.visible
|
||||
|
||||
UM.ColorImage
|
||||
{
|
||||
id: refreshingIcon
|
||||
height: UM.Theme.getSize("action_button_icon").height
|
||||
width: height
|
||||
anchors.verticalCenter: refreshingLabel.verticalCenter
|
||||
source: UM.Theme.getIcon("ArrowDoubleCircleRight")
|
||||
color: UM.Theme.getColor("primary")
|
||||
|
||||
RotationAnimator
|
||||
{
|
||||
target: refreshingIcon
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
running: true
|
||||
}
|
||||
}
|
||||
UM.Label
|
||||
{
|
||||
id: refreshingLabel
|
||||
anchors.left: refreshingIcon.right
|
||||
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
|
||||
text: catalog.i18nc("@button", "Refreshing...")
|
||||
color: UM.Theme.getColor("primary")
|
||||
font: UM.Theme.getFont("medium")
|
||||
}
|
||||
}
|
||||
|
||||
Cura.TertiaryButton
|
||||
{
|
||||
id: printerListTroubleshooting
|
||||
|
|
|
@ -256,12 +256,12 @@ Item
|
|||
|
||||
// popup dialog to select a new color
|
||||
// if successful it sets the properties.color_code value to the new color
|
||||
Cura.ColorDialog
|
||||
ColorDialog
|
||||
{
|
||||
id: colorDialog
|
||||
title: catalog.i18nc("@title", "Material color picker")
|
||||
color: properties.color_code
|
||||
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color)
|
||||
selectedColor: properties.color_code
|
||||
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, selectedColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ RecommendedSettingSection
|
|||
enableSectionSwitchVisible: platformAdhesionType.properties.enabled === "True"
|
||||
enableSectionSwitchChecked: platformAdhesionType.properties.value !== "skirt" && platformAdhesionType.properties.value !== "none"
|
||||
enableSectionSwitchEnabled: recommendedPrintSetup.settingsEnabled
|
||||
tooltipText: catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")
|
||||
tooltipText: catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards. Disabling it results in a skirt around object by default.")
|
||||
|
||||
property var curaRecommendedMode: Cura.RecommendedMode {}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 UltiMaker
|
||||
// Copyright (c) 2023 UltiMaker
|
||||
//Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
@ -9,16 +9,16 @@ import UM 1.6 as UM
|
|||
import Cura 1.6 as Cura
|
||||
import ".."
|
||||
|
||||
ScrollView
|
||||
Flickable
|
||||
{
|
||||
id: recommendedPrintSetup
|
||||
clip: true
|
||||
|
||||
implicitHeight: settingsColumn.height + 2 * padding
|
||||
contentHeight: settingsColumn.height
|
||||
implicitHeight: settingsColumn.height
|
||||
|
||||
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1
|
||||
|
||||
padding: UM.Theme.getSize("default_margin").width
|
||||
|
||||
function onModeChanged() {}
|
||||
|
||||
ScrollBar.vertical: UM.ScrollBar {
|
||||
|
@ -31,12 +31,15 @@ ScrollView
|
|||
}
|
||||
}
|
||||
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
Column
|
||||
{
|
||||
id: settingsColumn
|
||||
padding: UM.Theme.getSize("default_margin").width
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
width: recommendedPrintSetup.width - 2 * recommendedPrintSetup.padding - (scroll.visible ? scroll.width : 0)
|
||||
width: recommendedPrintSetup.width - 2 * padding - (scroll.visible ? scroll.width : 0)
|
||||
|
||||
// TODO
|
||||
property real firstColumnWidth: Math.round(width / 3)
|
||||
|
@ -97,7 +100,6 @@ ScrollView
|
|||
width: parent.width
|
||||
UM.Label
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
text: catalog.i18nc("@label", "Recommended print settings")
|
||||
font: UM.Theme.getFont("medium")
|
||||
|
@ -106,11 +108,9 @@ ScrollView
|
|||
Cura.SecondaryButton
|
||||
{
|
||||
id: customSettingsButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
text: catalog.i18nc("@button", "Show Custom")
|
||||
textFont: UM.Theme.getFont("medium_bold")
|
||||
outlineColor: "transparent"
|
||||
onClicked: onModeChanged()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Copyright (c) 2023 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
@ -31,7 +31,8 @@ Item
|
|||
RecommendedQualityProfileSelectorButton
|
||||
{
|
||||
profileName: model.name
|
||||
icon: model.icon
|
||||
icon: model.icon ? model.icon : ""
|
||||
custom_icon: model.custom_icon ? model.custom_icon : ""
|
||||
tooltipText: model.description ? model.description : ""
|
||||
|
||||
selected: Cura.MachineManager.activeIntentCategory == model.intent_category
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Copyright (c) 2023 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
@ -19,6 +19,7 @@ Rectangle
|
|||
property bool selected: false
|
||||
property string profileName: ""
|
||||
property string icon: ""
|
||||
property string custom_icon: ""
|
||||
property alias tooltipText: tooltip.text
|
||||
|
||||
signal clicked()
|
||||
|
@ -55,22 +56,32 @@ Rectangle
|
|||
id: intentIcon
|
||||
width: UM.Theme.getSize("recommended_button_icon").width
|
||||
height: UM.Theme.getSize("recommended_button_icon").height
|
||||
|
||||
UM.ColorImage
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
visible: icon != ""
|
||||
visible: icon !== ""
|
||||
source: UM.Theme.getIcon(icon)
|
||||
color: UM.Theme.getColor("icon")
|
||||
}
|
||||
|
||||
UM.ColorImage
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
visible: custom_icon !== ""
|
||||
source: custom_icon
|
||||
color: UM.Theme.getColor("icon")
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: circle
|
||||
anchors.fill: parent
|
||||
radius: width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: icon == ""
|
||||
visible: icon === "" && custom_icon === ""
|
||||
border.width: UM.Theme.getSize("thick_lining").width
|
||||
border.color: UM.Theme.getColor("text")
|
||||
|
||||
|
|
|
@ -54,9 +54,20 @@ Item
|
|||
from: Math.floor(base.from / base.stepSize)
|
||||
to: Math.floor(base.to / base.stepSize)
|
||||
|
||||
function clamp(value, min, max)
|
||||
{
|
||||
return Math.max((Math.min(value, max)), min);
|
||||
}
|
||||
|
||||
valueFromText: function(text)
|
||||
{
|
||||
return parseFloat(text.substring(prefix.length, text.length - suffix.length).replace(",", ".")) / base.stepSize;
|
||||
|
||||
var value = parseFloat(text.substring(prefix.length, text.length - suffix.length).replace(",", ".")) / base.stepSize;
|
||||
if (Number.isNaN(value))
|
||||
{
|
||||
value = from
|
||||
}
|
||||
return clamp(value, from, to);
|
||||
}
|
||||
|
||||
textFromValue: function(value)
|
||||
|
@ -69,6 +80,7 @@ Item
|
|||
onValueModified:
|
||||
{
|
||||
base.value = value * base.stepSize;
|
||||
spinBoxText.text = spinBox.textFromValue(value);
|
||||
}
|
||||
|
||||
// This forces TextField to commit typed values before incrementing with buttons.
|
||||
|
@ -87,6 +99,7 @@ Item
|
|||
|
||||
contentItem: Cura.TextField
|
||||
{
|
||||
id: spinBoxText
|
||||
text: spinBox.textFromValue(spinBox.value, spinBox.locale)
|
||||
validator: base.validator
|
||||
|
||||
|
@ -97,6 +110,13 @@ Item
|
|||
base.editingFinished();
|
||||
}
|
||||
}
|
||||
|
||||
onTextChanged:
|
||||
{
|
||||
var value = spinBox.valueFromText(text);
|
||||
text = spinBox.textFromValue(value);
|
||||
base.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
down.indicator: Rectangle
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Copyright (c) 2023 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.15
|
||||
|
@ -69,6 +69,8 @@ Item
|
|||
const initialSection = "Ultimaker B.V.";
|
||||
base.currentSections.add(initialSection);
|
||||
updateCurrentItemUponSectionChange(initialSection);
|
||||
// Trigger update on base.currentSections
|
||||
base.currentSections = base.currentSections;
|
||||
}
|
||||
|
||||
Row
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue