diff options
author | Joey de l'Arago <joeydelarago@gmail.com> | 2022-11-02 20:25:05 +0300 |
---|---|---|
committer | Joey de l'Arago <joeydelarago@gmail.com> | 2022-11-02 20:25:05 +0300 |
commit | 8bb608348115cf6758ab4db8c9ef903bd1772919 (patch) | |
tree | c94590cf1c479b72199751414298e93354c82ae7 | |
parent | b1e559ff1a831ef3675628096bae335f641da74b (diff) |
Create custom component for rows in WorkplaceDialog.
CURA-9424
-rw-r--r-- | plugins/3MFReader/WorkspaceDialog.qml | 162 | ||||
-rw-r--r-- | plugins/3MFReader/WorkspaceRow.qml | 34 |
2 files changed, 64 insertions, 132 deletions
diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index 4a6ade7d08..b1428cd878 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -86,39 +86,16 @@ UM.Dialog spacing: UM.Theme.getSize("default_margin").height leftPadding: UM.Theme.getSize("medium_button_icon").width + UM.Theme.getSize("default_margin").width - Row + WorkspaceRow { - width: parent.width - height: childrenRect.height - - UM.Label - { - text: catalog.i18nc("@action:label", "Type") - width: (parent.width / 3) | 0 - } - UM.Label - { - text: manager.machineType - width: (parent.width / 3) | 0 - } + leftLabelText: catalog.i18nc("@action:label", "Type") + rightLabelText: manager.machineType } - Row + WorkspaceRow { - width: parent.width - height: childrenRect.height - - UM.Label - { - text: catalog.i18nc("@action:label", manager.isPrinterGroup ? "Printer Group" : "Printer Name") - width: (parent.width / 3) | 0 - } - UM.Label - { - text: manager.machineName - width: (parent.width / 3) | 0 - wrapMode: Text.WordWrap - } + leftLabelText: catalog.i18nc("@action:label", manager.isPrinterGroup ? "Printer Group" : "Printer Name") + rightLabelText: manager.machineName } } @@ -183,79 +160,30 @@ UM.Dialog spacing: UM.Theme.getSize("default_margin").height leftPadding: UM.Theme.getSize("medium_button_icon").width + UM.Theme.getSize("default_margin").width - Row + WorkspaceRow { - width: parent.width - height: childrenRect.height - - UM.Label - { - text: catalog.i18nc("@action:label", "Name") - width: (parent.width / 3) | 0 - } - UM.Label - { - text: manager.qualityName - width: (parent.width / 3) | 0 - wrapMode: Text.WordWrap - } + leftLabelText: catalog.i18nc("@action:label", "Name") + rightLabelText: manager.qualityName } - Row + WorkspaceRow { - width: parent.width - height: childrenRect.height - - UM.Label - { - text: catalog.i18nc("@action:label", "Intent") - width: (parent.width / 3) | 0 - } - UM.Label - { - text: manager.intentName - width: (parent.width / 3) | 0 - wrapMode: Text.WordWrap - } + leftLabelText: catalog.i18nc("@action:label", "Intent") + rightLabelText: manager.intentName } - Row + WorkspaceRow { - width: parent.width - height: childrenRect.height - - UM.Label - { - text: catalog.i18nc("@action:label", "Not in profile") - visible: manager.numUserSettings != 0 - width: (parent.width / 3) | 0 - } - UM.Label - { - text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings) - visible: manager.numUserSettings != 0 - width: (parent.width / 3) | 0 - } + leftLabelText: catalog.i18nc("@action:label", "Not in profile") + rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings) + visible: manager.numUserSettings != 0 } - Row + WorkspaceRow { - width: parent.width - height: childrenRect.height - - UM.Label - { - text: catalog.i18nc("@action:label", "Derivative from") - visible: manager.numSettingsOverridenByQualityChanges != 0 - width: (parent.width / 3) | 0 - } - UM.Label - { - text: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges) - width: (parent.width / 3) | 0 - visible: manager.numSettingsOverridenByQualityChanges != 0 - wrapMode: Text.WordWrap - } + leftLabelText: catalog.i18nc("@action:label", "Derivative from") + rightLabelText: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges) + visible: manager.numSettingsOverridenByQualityChanges != 0 } } @@ -294,21 +222,10 @@ UM.Dialog Repeater { model: manager.materialLabels - delegate: Row + delegate: WorkspaceRow { - width: parent.width - height: childrenRect.height - UM.Label - { - text: catalog.i18nc("@action:label", "Name") - width: (parent.width / 3) | 0 - } - UM.Label - { - text: modelData - width: (parent.width / 3) | 0 - wrapMode: Text.WordWrap - } + leftLabelText: catalog.i18nc("@action:label", "Name") + rightLabelText: modelData } } } @@ -346,36 +263,17 @@ UM.Dialog spacing: UM.Theme.getSize("default_margin").height leftPadding: UM.Theme.getSize("medium_button_icon").width + UM.Theme.getSize("default_margin").width - Row + WorkspaceRow { - width: parent.width - height: childrenRect.height - UM.Label - { - text: catalog.i18nc("@action:label", "Mode") - width: (parent.width / 3) | 0 - } - UM.Label - { - text: manager.activeMode - width: (parent.width / 3) | 0 - } + leftLabelText: catalog.i18nc("@action:label", "Mode") + rightLabelText: manager.activeMode } - Row + + WorkspaceRow { - width: parent.width - height: childrenRect.height + leftLabelText: catalog.i18nc("@action:label", "%1 out of %2" ).arg(manager.numVisibleSettings).arg(manager.totalNumberOfSettings) + rightLabelText: manager.activeMode visible: manager.hasVisibleSettingsField - UM.Label - { - text: catalog.i18nc("@action:label", "Visible settings:") - width: (parent.width / 3) | 0 - } - UM.Label - { - text: catalog.i18nc("@action:label", "%1 out of %2" ).arg(manager.numVisibleSettings).arg(manager.totalNumberOfSettings) - width: (parent.width / 3) | 0 - } } } } diff --git a/plugins/3MFReader/WorkspaceRow.qml b/plugins/3MFReader/WorkspaceRow.qml new file mode 100644 index 0000000000..72cea7b5bd --- /dev/null +++ b/plugins/3MFReader/WorkspaceRow.qml @@ -0,0 +1,34 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 +import QtQuick.Window 2.2 + +import UM 1.5 as UM +import Cura 1.1 as Cura + +Row +{ + property alias leftLabelText: leftLabel.text + property alias rightLabelText: rightLabel.text + + width: parent.width + height: visible ? childrenRect.height : 0 + + UM.Label + { + id: leftLabel + text: catalog.i18nc("@action:label", "Type") + width: (parent.width / 4) | 0 + wrapMode: Text.WordWrap + } + UM.Label + { + id: rightLabel + text: manager.machineType + width: (parent.width / 3) | 0 + wrapMode: Text.WordWrap + } +}
\ No newline at end of file |