Merge remote-tracking branch 'origin/CURA-8688_qt6_cleanup' into CURA-8688_qt6_cleanup

This commit is contained in:
j.delarago 2022-02-28 14:56:27 +01:00
commit 97f1b75870
14 changed files with 270 additions and 187 deletions

View File

@ -5,7 +5,7 @@ import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import UM 1.3 as UM import UM 1.5 as UM
import Cura 1.1 as Cura import Cura 1.1 as Cura
@ -88,7 +88,7 @@ Cura.MachineAction
} }
} }
Label UM.Label
{ {
id: machineNameLabel id: machineNameLabel
anchors.top: parent.top anchors.top: parent.top
@ -97,7 +97,6 @@ Cura.MachineAction
text: Cura.MachineManager.activeMachine.name text: Cura.MachineManager.activeMachine.name
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
renderType: Text.NativeRendering
} }
UM.TabRow UM.TabRow

View File

@ -15,14 +15,15 @@ UM.Dialog
id: dialog id: dialog
title: catalog.i18nc("@title:window", "Post Processing Plugin") title: catalog.i18nc("@title:window", "Post Processing Plugin")
width: 700 * screenScaleFactor; width: 700 * screenScaleFactor
height: 500 * screenScaleFactor; height: 500 * screenScaleFactor
minimumWidth: 400 * screenScaleFactor; minimumWidth: 400 * screenScaleFactor
minimumHeight: 250 * screenScaleFactor; minimumHeight: 250 * screenScaleFactor
onVisibleChanged: onVisibleChanged:
{ {
if(!visible) //Whenever the window is closed (either via the "Close" button or the X on the window frame), we want to update it in the stack. // Whenever the window is closed (either via the "Close" button or the X on the window frame), we want to update it in the stack.
if (!visible)
{ {
manager.writeScriptsToStack() manager.writeScriptsToStack()
} }
@ -35,8 +36,7 @@ UM.Dialog
property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width) property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width)
property int textMargin: UM.Theme.getSize("narrow_margin").width property int textMargin: UM.Theme.getSize("narrow_margin").width
property string activeScriptName property string activeScriptName
SystemPalette{ id: palette }
SystemPalette{ id: disabledPalette; colorGroup: SystemPalette.Disabled }
anchors.fill: parent anchors.fill: parent
ButtonGroup ButtonGroup
@ -51,14 +51,12 @@ UM.Dialog
spacing: base.textMargin spacing: base.textMargin
Label UM.Label
{ {
id: activeScriptsHeader id: activeScriptsHeader
text: catalog.i18nc("@label", "Post Processing Scripts") text: catalog.i18nc("@label", "Post Processing Scripts")
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: base.textMargin
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: base.textMargin
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -79,17 +77,15 @@ UM.Dialog
id: activeScriptsScrollBar id: activeScriptsScrollBar
} }
model: manager.scriptList model: manager.scriptList
delegate: Item
{ delegate: Button
width: parent.width - activeScriptsScrollBar.width
height: activeScriptButton.height
Button
{ {
id: activeScriptButton id: activeScriptButton
text: manager.getScriptLabelByKey(modelData.toString())
width: parent.width - activeScriptsScrollBar.width
height: UM.Theme.getSize("standard_list_lineheight").height
ButtonGroup.group: selectedScriptGroup ButtonGroup.group: selectedScriptGroup
width: parent.width
height: UM.Theme.getSize("setting").height
checkable: true checkable: true
checked: checked:
@ -104,6 +100,12 @@ UM.Dialog
return false return false
} }
} }
background: Rectangle
{
color: activeScriptButton.checked ? UM.Theme.getColor("background_3") : "transparent"
}
onClicked: onClicked:
{ {
forceActiveFocus() forceActiveFocus()
@ -111,53 +113,27 @@ UM.Dialog
base.activeScriptName = manager.getScriptLabelByKey(modelData.toString()) base.activeScriptName = manager.getScriptLabelByKey(modelData.toString())
} }
background: Rectangle RowLayout
{ {
color: activeScriptButton.checked ? palette.highlight : "transparent" anchors.fill: parent
} height: childrenRect.height
contentItem: Label
UM.Label
{ {
wrapMode: Text.Wrap Layout.fillWidth: true
text: activeScriptButton.text text: manager.getScriptLabelByKey(modelData.toString())
elide: Text.ElideRight
color: activeScriptButton.checked ? palette.highlightedText : palette.text
} }
} Item
Button
{
id: removeButton
text: "x"
width: 20 * screenScaleFactor
height: 20 * screenScaleFactor
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
onClicked: manager.removeScriptByIndex(index)
contentItem: Item
{
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(removeButton.width / 2.7)
height: Math.round(removeButton.height / 2.7)
sourceSize.height: width
color: palette.text
source: UM.Theme.getIcon("Cancel")
}
}
}
Button
{ {
id: downButton id: downButton
text: "" Layout.preferredWidth: height
anchors.right: removeButton.left Layout.fillHeight: true
anchors.verticalCenter: parent.verticalCenter
enabled: index != manager.scriptList.length - 1 enabled: index != manager.scriptList.length - 1
width: 20 * screenScaleFactor
height: 20 * screenScaleFactor MouseArea
{
anchors.fill: parent
onClicked: onClicked:
{ {
if (manager.selectedScriptIndex == index) if (manager.selectedScriptIndex == index)
@ -166,29 +142,30 @@ UM.Dialog
} }
return manager.moveScript(index, index + 1) return manager.moveScript(index, index + 1)
} }
contentItem: Item }
{
UM.RecolorImage UM.RecolorImage
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(downButton.width / 2.5) width: UM.Theme.getSize("standard_arrow").width
height: Math.round(downButton.height / 2.5) height: UM.Theme.getSize("standard_arrow").height
sourceSize.height: width sourceSize.width: width
color: downButton.enabled ? palette.text : disabledPalette.text sourceSize.height: height
color: parent.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled")
source: UM.Theme.getIcon("ChevronSingleDown") source: UM.Theme.getIcon("ChevronSingleDown")
} }
} }
} Item
Button
{ {
id: upButton id: upButton
text: "" Layout.preferredWidth: height
Layout.fillHeight: true
enabled: index != 0 enabled: index != 0
width: 20 * screenScaleFactor
height: 20 * screenScaleFactor MouseArea
anchors.right: downButton.left {
anchors.verticalCenter: parent.verticalCenter anchors.fill: parent
onClicked: onClicked:
{ {
if (manager.selectedScriptIndex == index) if (manager.selectedScriptIndex == index)
@ -197,19 +174,45 @@ UM.Dialog
} }
return manager.moveScript(index, index - 1) return manager.moveScript(index, index - 1)
} }
contentItem: Item }
{
UM.RecolorImage UM.RecolorImage
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(upButton.width / 2.5) width: UM.Theme.getSize("standard_arrow").width
height: Math.round(upButton.height / 2.5) height: UM.Theme.getSize("standard_arrow").height
sourceSize.height: width sourceSize.width: width
color: upButton.enabled ? palette.text : disabledPalette.text sourceSize.height: height
color: upButton.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled")
source: UM.Theme.getIcon("ChevronSingleUp") source: UM.Theme.getIcon("ChevronSingleUp")
} }
} }
Item
{
id: removeButton
Layout.preferredWidth: height
Layout.fillHeight: true
MouseArea
{
anchors.fill: parent
onClicked: manager.removeScriptByIndex(index)
}
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width
sourceSize.height: height
color: UM.Theme.getColor("text")
source: UM.Theme.getIcon("Cancel")
}
}
} }
} }
} }
@ -217,20 +220,19 @@ UM.Dialog
{ {
id: addButton id: addButton
text: catalog.i18nc("@action", "Add a script") text: catalog.i18nc("@action", "Add a script")
anchors.left: parent.left
anchors.leftMargin: base.textMargin
onClicked: scriptsMenu.open() onClicked: scriptsMenu.open()
} }
Menu }
Cura.Menu
{ {
id: scriptsMenu id: scriptsMenu
width: parent.width
Models.Instantiator Models.Instantiator
{ {
model: manager.loadedScriptList model: manager.loadedScriptList
MenuItem Cura.MenuItem
{ {
text: manager.getScriptLabelByKey(modelData.toString()) text: manager.getScriptLabelByKey(modelData.toString())
onTriggered: manager.addScriptToList(modelData.toString()) onTriggered: manager.addScriptToList(modelData.toString())
@ -240,7 +242,6 @@ UM.Dialog
onObjectRemoved: scriptsMenu.removeItem(object) onObjectRemoved: scriptsMenu.removeItem(object)
} }
} }
}
Rectangle Rectangle
{ {
@ -303,16 +304,9 @@ UM.Dialog
width: listview.width width: listview.width
height: height:
{ {
if(provider.properties.enabled == "True") if (provider.properties.enabled == "True" && model.type != undefined)
{ {
if(model.type != undefined) return UM.Theme.getSize("section").height;
{
return UM.Theme.getSize("section").height
}
else
{
return 0
}
} }
else else
{ {
@ -392,10 +386,10 @@ UM.Dialog
function onShowTooltip(text) function onShowTooltip(text)
{ {
tooltip.text = text tooltip.text = text;
var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0) var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0);
tooltip.show(position) tooltip.show(position);
tooltip.target.x = position.x + 1 tooltip.target.x = position.x + 1;
} }
function onHideTooltip() { tooltip.hide() } function onHideTooltip() { tooltip.hide() }
@ -452,7 +446,7 @@ UM.Dialog
} }
} }
rightButtons: Cura.PrimaryButton rightButtons: Cura.TertiaryButton
{ {
text: catalog.i18nc("@action:button", "Close") text: catalog.i18nc("@action:button", "Close")
onClicked: dialog.accept() onClicked: dialog.accept()

View File

@ -35,8 +35,8 @@ Cura.MachineAction
id: discoverUM3Action id: discoverUM3Action
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
SystemPalette { id: palette }
UM.I18nCatalog { id: catalog; name:"cura" } UM.I18nCatalog { id: catalog; name:"cura" }
UM.Label UM.Label
{ {
id: pageTitle id: pageTitle
@ -53,9 +53,9 @@ Cura.MachineAction
Row Row
{ {
spacing: UM.Theme.getSize("default_lining").width spacing: UM.Theme.getSize("thin_margin").width
Button Cura.SecondaryButton
{ {
id: addButton id: addButton
text: catalog.i18nc("@action:button", "Add"); text: catalog.i18nc("@action:button", "Add");
@ -65,7 +65,7 @@ Cura.MachineAction
} }
} }
Button Cura.SecondaryButton
{ {
id: editButton id: editButton
text: catalog.i18nc("@action:button", "Edit") text: catalog.i18nc("@action:button", "Edit")
@ -76,7 +76,7 @@ Cura.MachineAction
} }
} }
Button Cura.SecondaryButton
{ {
id: removeButton id: removeButton
text: catalog.i18nc("@action:button", "Remove") text: catalog.i18nc("@action:button", "Remove")
@ -84,7 +84,7 @@ Cura.MachineAction
onClicked: manager.removeManualDevice(base.selectedDevice.key, base.selectedDevice.ipAddress) onClicked: manager.removeManualDevice(base.selectedDevice.key, base.selectedDevice.ipAddress)
} }
Button Cura.SecondaryButton
{ {
id: rediscoverButton id: rediscoverButton
text: catalog.i18nc("@action:button", "Refresh") text: catalog.i18nc("@action:button", "Refresh")
@ -122,23 +122,18 @@ Cura.MachineAction
base.completeProperties = base.selectedDevice != null && base.selectedDevice.getProperty("incomplete") != "true"; base.completeProperties = base.selectedDevice != null && base.selectedDevice.getProperty("incomplete") != "true";
} }
Component.onCompleted: manager.startDiscovery() Component.onCompleted: manager.startDiscovery()
delegate: Rectangle
{ delegate: UM.Label
height: printNameLabel.height
color: ListView.isCurrentItem ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
width: listview.width
Label
{ {
id: printNameLabel id: printNameLabel
width: listview.width
height: contentHeight height: contentHeight
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.right: parent.right anchors.right: parent.right
text: listview.model[index].name text: listview.model[index].name
color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text
elide: Text.ElideRight elide: Text.ElideRight
renderType: Text.NativeRendering
}
MouseArea MouseArea
{ {
@ -151,6 +146,11 @@ Cura.MachineAction
} }
} }
} }
background: Rectangle
{
color: parent.ListView.isCurrentItem ? UM.Theme.getColor("background_3") : "transparent"
}
} }
} }
UM.Label UM.Label
@ -175,20 +175,19 @@ Cura.MachineAction
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
elide: Text.ElideRight elide: Text.ElideRight
} }
Grid GridLayout
{ {
visible: base.completeProperties visible: base.completeProperties
width: parent.width width: parent.width
columns: 2 columns: 2
property real labelWidth: Math.round(width * 0.5)
UM.Label UM.Label
{ {
width: labelWidth Layout.fillWidth: true
text: catalog.i18nc("@label", "Type") text: catalog.i18nc("@label", "Type")
} }
UM.Label UM.Label
{ {
width: labelWidth Layout.fillWidth: true
text: text:
{ {
if (base.selectedDevice) { if (base.selectedDevice) {
@ -199,22 +198,22 @@ Cura.MachineAction
} }
UM.Label UM.Label
{ {
width: labelWidth Layout.fillWidth: true
text: catalog.i18nc("@label", "Firmware version") text: catalog.i18nc("@label", "Firmware version")
} }
UM.Label UM.Label
{ {
width: labelWidth Layout.fillWidth: true
text: base.selectedDevice ? base.selectedDevice.firmwareVersion : "" text: base.selectedDevice ? base.selectedDevice.firmwareVersion : ""
} }
UM.Label UM.Label
{ {
width: labelWidth Layout.fillWidth: true
text: catalog.i18nc("@label", "Address") text: catalog.i18nc("@label", "Address")
} }
UM.Label UM.Label
{ {
width: labelWidth Layout.fillWidth: true
text: base.selectedDevice ? base.selectedDevice.ipAddress : "" text: base.selectedDevice ? base.selectedDevice.ipAddress : ""
} }
} }
@ -246,7 +245,7 @@ Cura.MachineAction
text: catalog.i18nc("@label", "The printer at this address has not yet responded." ) text: catalog.i18nc("@label", "The printer at this address has not yet responded." )
} }
Button Cura.SecondaryButton
{ {
text: catalog.i18nc("@action:button", "Connect") text: catalog.i18nc("@action:button", "Connect")
enabled: (base.selectedDevice && base.completeProperties && base.selectedDevice.clusterSize > 0) ? true : false enabled: (base.selectedDevice && base.completeProperties && base.selectedDevice.clusterSize > 0) ? true : false
@ -264,7 +263,7 @@ Cura.MachineAction
standardButtons: Dialog.Ok standardButtons: Dialog.Ok
} }
Dialog Cura.MessageDialog
{ {
id: manualPrinterDialog id: manualPrinterDialog
property string printerKey property string printerKey
@ -273,6 +272,7 @@ Cura.MachineAction
title: catalog.i18nc("@title:window", "Printer Address") title: catalog.i18nc("@title:window", "Printer Address")
width: UM.Theme.getSize("small_popup_dialog").width width: UM.Theme.getSize("small_popup_dialog").width
height: UM.Theme.getSize("small_popup_dialog").height
anchors.centerIn: Overlay.overlay anchors.centerIn: Overlay.overlay

View File

@ -76,7 +76,7 @@ UM.Dialog
anchors.fill: parent anchors.fill: parent
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
Label UM.Label
{ {
id: questionText id: questionText
width: parent.width width: parent.width

View File

@ -272,7 +272,6 @@ UM.Dialog
UM.CheckBox UM.CheckBox
{ {
id: dontShowAgainCheckbox id: dontShowAgainCheckbox
anchors.left: parent.left
text: catalog.i18nc("@action:label", "Don't show project summary on save again") text: catalog.i18nc("@action:label", "Don't show project summary on save again")
checked: dontShowAgain checked: dontShowAgain
} }

View File

@ -78,7 +78,6 @@ Item
background: Rectangle background: Rectangle
{ {
radius: UM.Theme.getSize("action_button_radius").width radius: UM.Theme.getSize("action_button_radius").width
width: contents.width
color: color:
{ {
if (stageSelectorButton.checked) if (stageSelectorButton.checked)

View File

@ -14,7 +14,7 @@ UM.PreferencesPage
title: catalog.i18nc("@title:tab", "General") title: catalog.i18nc("@title:tab", "General")
id: generalPreferencesPage id: generalPreferencesPage
width: parent.width width: parent ? parent.width: 0
function setDefaultLanguage(languageCode) function setDefaultLanguage(languageCode)
{ {

View File

@ -144,7 +144,7 @@ UM.ManagementPage
} }
// Dialog to request a name when creating a new profile // Dialog to request a name when creating a new profile
UM.RenameDialog Cura.RenameDialog
{ {
id: createQualityDialog id: createQualityDialog
title: catalog.i18nc("@title:window", "Create Profile") title: catalog.i18nc("@title:window", "Create Profile")
@ -233,7 +233,7 @@ UM.ManagementPage
} }
// Dialog to request a name when duplicating a new profile // Dialog to request a name when duplicating a new profile
UM.RenameDialog Cura.RenameDialog
{ {
id: duplicateQualityDialog id: duplicateQualityDialog
title: catalog.i18nc("@title:window", "Duplicate Profile") title: catalog.i18nc("@title:window", "Duplicate Profile")
@ -263,7 +263,7 @@ UM.ManagementPage
} }
// Dialog to rename a quality profile // Dialog to rename a quality profile
UM.RenameDialog Cura.RenameDialog
{ {
id: renameQualityDialog id: renameQualityDialog
title: catalog.i18nc("@title:window", "Rename Profile") title: catalog.i18nc("@title:window", "Rename Profile")

View File

@ -0,0 +1,91 @@
// Copyright (c) 2022 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
import UM 1.5 as UM
import Cura 1.0 as Cura
UM.Dialog
{
id: base
property string object: ""
property alias newName: nameField.text
property bool validName: true
property string validationError
property string dialogTitle: catalog.i18nc("@title:window", "Rename")
property string explanation: catalog.i18nc("@info", "Please provide a new name.")
title: dialogTitle
minimumWidth: UM.Theme.getSize("small_popup_dialog").width
minimumHeight: UM.Theme.getSize("small_popup_dialog").height
width: minimumWidth
height: minimumHeight
property variant catalog: UM.I18nCatalog { name: "cura" }
signal textChanged(string text)
signal selectText()
onSelectText:
{
nameField.selectAll();
nameField.focus = true;
}
Column
{
anchors.fill: parent
UM.Label
{
text: base.explanation + "\n" //Newline to make some space using system theming.
width: parent.width
wrapMode: Text.WordWrap
}
Cura.TextField
{
id: nameField
width: parent.width
text: base.object
maximumLength: 40
selectByMouse: true
onTextChanged: base.textChanged(text)
}
UM.Label
{
visible: !base.validName
text: base.validationError
}
}
Item
{
ButtonGroup {
buttons: [cancelButton, okButton]
checkedButton: okButton
}
}
rightButtons: [
Cura.SecondaryButton
{
id: cancelButton
text: catalog.i18nc("@action:button","Cancel")
onClicked: base.reject()
},
Cura.PrimaryButton
{
id: okButton
text: catalog.i18nc("@action:button", "OK")
onClicked: base.accept()
enabled: base.validName
}
]
}

View File

@ -84,7 +84,7 @@ UM.PreferencesPage
} }
} }
TextField Cura.TextField
{ {
id: filter id: filter
@ -105,7 +105,7 @@ UM.PreferencesPage
Cura.ComboBox Cura.ComboBox
{ {
id: visibilityPreset id: visibilityPreset
width: 150 * screenScaleFactor width: UM.Theme.getSize("action_button").width
anchors anchors
{ {
top: parent.top top: parent.top

View File

@ -409,7 +409,7 @@ Item
} }
} }
Menu Cura.Menu
{ {
id: contextMenu id: contextMenu

View File

@ -24,6 +24,7 @@ TextField
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
renderType: Text.NativeRendering renderType: Text.NativeRendering
selectionColor: UM.Theme.getColor("text_selection")
leftPadding: iconLeft.visible ? iconLeft.width + UM.Theme.getSize("default_margin").width * 2 : UM.Theme.getSize("thin_margin").width leftPadding: iconLeft.visible ? iconLeft.width + UM.Theme.getSize("default_margin").width * 2 : UM.Theme.getSize("thin_margin").width
states: [ states: [

View File

@ -47,3 +47,4 @@ GcodeTextArea 1.0 GcodeTextArea.qml
NumericTextFieldWithUnit 1.0 NumericTextFieldWithUnit.qml NumericTextFieldWithUnit 1.0 NumericTextFieldWithUnit.qml
PrintHeadMinMaxTextField 1.0 PrintHeadMinMaxTextField.qml PrintHeadMinMaxTextField 1.0 PrintHeadMinMaxTextField.qml
SimpleCheckBox 1.0 SimpleCheckBox.qml SimpleCheckBox 1.0 SimpleCheckBox.qml
RenameDialog 1.0 RenameDialog.qml

View File

@ -206,7 +206,6 @@
"text_selection": [156, 195, 255, 127], "text_selection": [156, 195, 255, 127],
"border": [127, 127, 127, 255], "border": [127, 127, 127, 255],
"border_field": [180, 180, 180, 255], "border_field": [180, 180, 180, 255],
"text_selection": [156,195, 255, 127],
"secondary": [240, 240, 240, 255], "secondary": [240, 240, 240, 255],
"icon": [8, 7, 63, 255], "icon": [8, 7, 63, 255],