diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 1aebb9a2db..7645e88b7e 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -679,22 +679,6 @@ class CuraApplication(QtApplication): self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine...")) super().setGlobalContainerStack(stack) - showMessageBox = pyqtSignal(str,str, str, str, int, int, - arguments = ["title", "text", "informativeText", "detailedText","buttons", "icon"]) - """A reusable dialogbox""" - - def messageBox(self, title, text, - informativeText = "", - detailedText = "", - buttons = QMessageBox.Ok, - icon = QMessageBox.NoIcon, - callback = None, - callback_arguments = [] - ): - self._message_box_callback = callback - self._message_box_callback_arguments = callback_arguments - self.showMessageBox.emit(title, text, informativeText, detailedText, buttons, icon) - showDiscardOrKeepProfileChanges = pyqtSignal() def discardOrKeepProfileChanges(self) -> bool: diff --git a/cura/Machines/Models/QualitySettingsModel.py b/cura/Machines/Models/QualitySettingsModel.py index 89a996fba1..2051f1748d 100644 --- a/cura/Machines/Models/QualitySettingsModel.py +++ b/cura/Machines/Models/QualitySettingsModel.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Ultimaker B.V. +# Copyright (c) 2022 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import pyqtProperty, pyqtSignal, Qt @@ -9,6 +9,7 @@ from UM import i18nCatalog from UM.Logger import Logger from UM.Qt.ListModel import ListModel from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.SettingFunction import SettingFunction # To format setting functions differently. import os @@ -173,12 +174,22 @@ class QualitySettingsModel(ListModel): label = definition.label if self._i18n_catalog: label = self._i18n_catalog.i18nc(definition.key + " label", label) + if profile_value_source == "quality_changes": + label = f"{label}" # Make setting name italic if it's derived from the quality-changes profile. + + if isinstance(profile_value, SettingFunction): + if self._i18n_catalog: + profile_value_display = self._i18n_catalog.i18nc("@info:status", "Calculated") + else: + profile_value_display = "Calculated" + else: + profile_value_display = "" if profile_value is None else str(profile_value) items.append({ "key": definition.key, "label": label, "unit": definition.unit, - "profile_value": "" if profile_value is None else str(profile_value), # it is for display only + "profile_value": profile_value_display, "profile_value_source": profile_value_source, "user_value": "" if user_value is None else str(user_value), "category": current_category diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index 450f01fbd5..898b1ea993 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 import QtQuick.Window 2.2 -import UM 1.1 as UM +import UM 1.5 as UM import Cura 1.1 as Cura UM.Dialog @@ -19,9 +19,7 @@ UM.Dialog width: minimumWidth height: Math.max(dialogSummaryItem.height + 2 * buttonsItem.height, minimumHeight) // 2 * button height to also have some extra space around the button relative to the button size - property int comboboxHeight: 15 * screenScaleFactor - property int spacerHeight: 10 * screenScaleFactor - property int doubleSpacerHeight: 20 * screenScaleFactor + property int comboboxHeight: UM.Theme.getSize("default_margin").height onClosing: manager.notifyClosed() onVisibleChanged: @@ -46,10 +44,6 @@ UM.Dialog id: catalog name: "cura" } - SystemPalette - { - id: palette - } ListModel { @@ -68,45 +62,39 @@ UM.Dialog { width: parent.width height: childrenRect.height - spacing: 2 * screenScaleFactor - Label + spacing: UM.Theme.getSize("default_margin").height + + Column { - id: titleLabel - text: catalog.i18nc("@action:title", "Summary - Cura Project") - font.pointSize: 18 - } - Rectangle - { - id: separator - color: palette.text width: parent.width - height: 1 - } - Item // Spacer - { - height: doubleSpacerHeight - width: height + height: cildrenRect.height + + UM.Label + { + id: titleLabel + text: catalog.i18nc("@action:title", "Summary - Cura Project") + font: UM.Theme.getFont("large") + } + + Rectangle + { + id: separator + color: UM.Theme.getColor("text") + width: parent.width + height: UM.Theme.getSize("default_lining").height + } } - Row + Item { - height: childrenRect.height width: parent.width - Label - { - text: catalog.i18nc("@action:label", "Printer settings") - font.bold: true - width: (parent.width / 3) | 0 - } - Item - { - // spacer - height: spacerHeight - width: (parent.width / 3) | 0 - } + height: childrenRect.height + UM.TooltipArea { id: machineResolveStrategyTooltip + anchors.top: parent.top + anchors.right: parent.right width: (parent.width / 3) | 0 height: visible ? comboboxHeight : 0 visible: base.visible && machineResolveComboBox.model.count > 1 @@ -157,64 +145,65 @@ UM.Dialog } } } - } - Row - { - width: parent.width - height: childrenRect.height - Label + + Column { - text: catalog.i18nc("@action:label", "Type") - width: (parent.width / 3) | 0 - } - Label - { - text: manager.machineType - width: (parent.width / 3) | 0 + width: parent.width + height: cildrenRect.height + + UM.Label + { + id: printer_settings_label + text: catalog.i18nc("@action:label", "Printer settings") + font: UM.Theme.getFont("default_bold") + } + + Row + { + 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 + } + } + + Row + { + 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 + } + } } } - Row + Item { width: parent.width height: childrenRect.height - Label - { - text: catalog.i18nc("@action:label", manager.isPrinterGroup ? "Printer Group" : "Printer Name") - width: (parent.width / 3) | 0 - } - Label - { - text: manager.machineName - width: (parent.width / 3) | 0 - wrapMode: Text.WordWrap - } - } - Item // Spacer - { - height: doubleSpacerHeight - width: height - } - Row - { - height: childrenRect.height - width: parent.width - Label - { - text: catalog.i18nc("@action:label", "Profile settings") - font.bold: true - width: (parent.width / 3) | 0 - } - Item - { - // spacer - height: spacerHeight - width: (parent.width / 3) | 0 - } UM.TooltipArea { - id: qualityChangesResolveTooltip + anchors.right: parent.right + anchors.top: parent.top width: (parent.width / 3) | 0 height: visible ? comboboxHeight : 0 visible: manager.qualityChangesConflict @@ -232,96 +221,105 @@ UM.Dialog } } } + + Column + { + width: parent.width + height: cildrenRect.height + + UM.Label + { + text: catalog.i18nc("@action:label", "Profile settings") + font: UM.Theme.getFont("default_bold") + } + + Row + { + 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 + } + } + + Row + { + 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 + } + } + + Row + { + 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 + } + } + + Row + { + 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 + } + } + } } - Row + + Item { width: parent.width height: childrenRect.height - Label - { - text: catalog.i18nc("@action:label", "Name") - width: (parent.width / 3) | 0 - } - Label - { - text: manager.qualityName - width: (parent.width / 3) | 0 - wrapMode: Text.WordWrap - } - } - Row - { - width: parent.width - height: childrenRect.height - Label - { - text: catalog.i18nc("@action:label", "Intent") - width: (parent.width / 3) | 0 - } - Label - { - text: manager.intentName - width: (parent.width / 3) | 0 - wrapMode: Text.WordWrap - } - } - Row - { - width: parent.width - height: manager.numUserSettings != 0 ? childrenRect.height : 0 - Label - { - text: catalog.i18nc("@action:label", "Not in profile") - width: (parent.width / 3) | 0 - } - Label - { - text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings) - width: (parent.width / 3) | 0 - } - visible: manager.numUserSettings != 0 - } - Row - { - width: parent.width - height: manager.numSettingsOverridenByQualityChanges != 0 ? childrenRect.height : 0 - Label - { - text: catalog.i18nc("@action:label", "Derivative from") - width: (parent.width / 3) | 0 - } - 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 - wrapMode: Text.WordWrap - } - visible: manager.numSettingsOverridenByQualityChanges != 0 - } - Item // Spacer - { - height: doubleSpacerHeight - width: height - } - Row - { - height: childrenRect.height - width: parent.width - Label - { - text: catalog.i18nc("@action:label", "Material settings") - font.bold: true - width: (parent.width / 3) | 0 - } - Item - { - // spacer - height: spacerHeight - width: (parent.width / 3) | 0 - } + UM.TooltipArea { id: materialResolveTooltip + anchors.right: parent.right + anchors.top: parent.top width: (parent.width / 3) | 0 height: visible ? comboboxHeight : 0 visible: manager.materialConflict @@ -339,76 +337,91 @@ UM.Dialog } } } + + Column + { + width: parent.width + height: cildrenRect.height + Row + { + height: childrenRect.height + width: parent.width + spacing: UM.Theme.getSize("narrow_margin").width + + UM.Label + { + text: catalog.i18nc("@action:label", "Material settings") + font: UM.Theme.getFont("default_bold") + width: (parent.width / 3) | 0 + } + } + + Repeater + { + model: manager.materialLabels + delegate: Row + { + 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 + } + } + } + } } - Repeater + Column { - model: manager.materialLabels - delegate: Row + width: parent.width + height: cildrenRect.height + + UM.Label + { + text: catalog.i18nc("@action:label", "Setting visibility") + font: UM.Theme.getFont("default_bold") + } + Row { width: parent.width height: childrenRect.height - Label + UM.Label { - text: catalog.i18nc("@action:label", "Name") + text: catalog.i18nc("@action:label", "Mode") width: (parent.width / 3) | 0 } - Label + UM.Label { - text: modelData + text: manager.activeMode + width: (parent.width / 3) | 0 + } + } + Row + { + width: parent.width + height: childrenRect.height + 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 - wrapMode: Text.WordWrap } } } - Item // Spacer - { - height: doubleSpacerHeight - width: height - } - - Label - { - text: catalog.i18nc("@action:label", "Setting visibility") - font.bold: true - } - Row - { - width: parent.width - height: childrenRect.height - Label - { - text: catalog.i18nc("@action:label", "Mode") - width: (parent.width / 3) | 0 - } - Label - { - text: manager.activeMode - width: (parent.width / 3) | 0 - } - } - Row - { - width: parent.width - height: childrenRect.height - visible: manager.hasVisibleSettingsField - Label - { - text: catalog.i18nc("@action:label", "Visible settings:") - width: (parent.width / 3) | 0 - } - Label - { - text: catalog.i18nc("@action:label", "%1 out of %2" ).arg(manager.numVisibleSettings).arg(manager.totalNumberOfSettings) - width: (parent.width / 3) | 0 - } - } - Item // Spacer - { - height: spacerHeight - width: height - } Row { width: parent.width @@ -418,12 +431,10 @@ UM.Dialog { width: warningLabel.height height: width - source: UM.Theme.getIcon("Information") - color: palette.text - + color: UM.Theme.getColor("text") } - Label + UM.Label { id: warningLabel text: catalog.i18nc("@action:warning", "Loading a project will clear all models on the build plate.") @@ -432,44 +443,22 @@ UM.Dialog } } } - Item - { - id: buttonsItem - width: parent.width - height: childrenRect.height - anchors.bottom: parent.bottom - anchors.right: parent.right - Button + + buttonSpacing: UM.Theme.getSize("default_margin").width + + rightButtons: [ + Cura.TertiaryButton { - id: cancel_button - text: catalog.i18nc("@action:button","Cancel"); - onClicked: { manager.onCancelButtonClicked() } - enabled: true - anchors.bottom: parent.bottom - anchors.right: ok_button.left - anchors.rightMargin: 2 * screenScaleFactor - } - Button + text: catalog.i18nc("@action:button", "Cancel") + onClicked: reject() + }, + Cura.PrimaryButton { - id: ok_button - anchors.right: parent.right - anchors.bottom: parent.bottom - text: catalog.i18nc("@action:button","Open"); - onClicked: { manager.closeBackend(); manager.onOkButtonClicked() } + text: catalog.i18nc("@action:button", "Open") + onClicked: accept() } - } + ] - - function accept() { - manager.closeBackend(); - manager.onOkButtonClicked(); - base.visible = false; - base.accept(); - } - - function reject() { - manager.onCancelButtonClicked(); - base.visible = false; - base.rejected(); - } + onRejected: manager.onCancelButtonClicked() + onAccepted: manager.onOkButtonClicked() } diff --git a/plugins/CuraDrive/src/qml/components/BackupList.qml b/plugins/CuraDrive/src/qml/components/BackupList.qml index a4a460a885..8392792808 100644 --- a/plugins/CuraDrive/src/qml/components/BackupList.qml +++ b/plugins/CuraDrive/src/qml/components/BackupList.qml @@ -1,39 +1,34 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 -import UM 1.1 as UM +import UM 1.5 as UM -ScrollView +ListView { - property alias model: backupList.model - width: parent.width clip: true - ListView + ScrollBar.vertical: UM.ScrollBar {} + + delegate: Item { - id: backupList - width: parent.width - delegate: Item + // Add a margin, otherwise the scrollbar is on top of the right most component + width: parent.width - UM.Theme.getSize("scrollbar").width + height: childrenRect.height + + BackupListItem { - // Add a margin, otherwise the scrollbar is on top of the right most component - width: parent.width - UM.Theme.getSize("default_margin").width - height: childrenRect.height + id: backupListItem + width: parent.width + } - BackupListItem - { - id: backupListItem - width: parent.width - } - - Rectangle - { - id: divider - color: UM.Theme.getColor("lining") - height: UM.Theme.getSize("default_lining").height - } + Rectangle + { + id: divider + color: UM.Theme.getColor("lining") + height: UM.Theme.getSize("default_lining").height } } } diff --git a/plugins/CuraDrive/src/qml/components/BackupListItem.qml b/plugins/CuraDrive/src/qml/components/BackupListItem.qml index e35c8351b7..a3b9770718 100644 --- a/plugins/CuraDrive/src/qml/components/BackupListItem.qml +++ b/plugins/CuraDrive/src/qml/components/BackupListItem.qml @@ -1,12 +1,11 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 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.Dialogs 1.1 -import UM 1.1 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item @@ -42,28 +41,22 @@ Item onClicked: backupListItem.showDetails = !backupListItem.showDetails } - Label + UM.Label { text: new Date(modelData.generated_time).toLocaleString(UM.Preferences.getValue("general/language")) - color: UM.Theme.getColor("text") elide: Text.ElideRight Layout.minimumWidth: 100 * screenScaleFactor Layout.maximumWidth: 500 * screenScaleFactor Layout.fillWidth: true - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering } - Label + UM.Label { text: modelData.metadata.description - color: UM.Theme.getColor("text") elide: Text.ElideRight Layout.minimumWidth: 100 * screenScaleFactor Layout.maximumWidth: 500 * screenScaleFactor Layout.fillWidth: true - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering } Cura.SecondaryButton @@ -94,21 +87,21 @@ Item anchors.top: dataRow.bottom } - MessageDialog + Cura.MessageDialog { id: confirmDeleteDialog title: catalog.i18nc("@dialog:title", "Delete Backup") text: catalog.i18nc("@dialog:info", "Are you sure you want to delete this backup? This cannot be undone.") - standardButtons: StandardButton.Yes | StandardButton.No - onYes: CuraDrive.deleteBackup(modelData.backup_id) + standardButtons: Dialog.Yes | Dialog.No + onAccepted: CuraDrive.deleteBackup(modelData.backup_id) } - MessageDialog + Cura.MessageDialog { id: confirmRestoreDialog title: catalog.i18nc("@dialog:title", "Restore Backup") text: catalog.i18nc("@dialog:info", "You will need to restart Cura before your backup is restored. Do you want to close Cura now?") - standardButtons: StandardButton.Yes | StandardButton.No - onYes: CuraDrive.restoreBackup(modelData.backup_id) + standardButtons: Dialog.Yes | Dialog.No + onAccepted: CuraDrive.restoreBackup(modelData.backup_id) } } diff --git a/plugins/CuraDrive/src/qml/components/BackupListItemDetailsRow.qml b/plugins/CuraDrive/src/qml/components/BackupListItemDetailsRow.qml index 9e4612fcf8..8ddf8e9d42 100644 --- a/plugins/CuraDrive/src/qml/components/BackupListItemDetailsRow.qml +++ b/plugins/CuraDrive/src/qml/components/BackupListItemDetailsRow.qml @@ -5,7 +5,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 -import UM 1.3 as UM +import UM 1.5 as UM RowLayout { @@ -26,27 +26,21 @@ RowLayout color: UM.Theme.getColor("text") } - Label + UM.Label { id: detailName - color: UM.Theme.getColor("text") elide: Text.ElideRight Layout.minimumWidth: 50 * screenScaleFactor Layout.maximumWidth: 100 * screenScaleFactor Layout.fillWidth: true - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering } - Label + UM.Label { id: detailValue - color: UM.Theme.getColor("text") elide: Text.ElideRight Layout.minimumWidth: 50 * screenScaleFactor Layout.maximumWidth: 100 * screenScaleFactor Layout.fillWidth: true - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering } } diff --git a/plugins/CuraDrive/src/qml/pages/WelcomePage.qml b/plugins/CuraDrive/src/qml/pages/WelcomePage.qml index 418573d7e4..01fbca2229 100644 --- a/plugins/CuraDrive/src/qml/pages/WelcomePage.qml +++ b/plugins/CuraDrive/src/qml/pages/WelcomePage.qml @@ -5,7 +5,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 import QtQuick.Window 2.2 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura import "../components" @@ -28,18 +28,14 @@ Column width: Math.round(parent.width / 4) } - Label + UM.Label { id: welcomeTextLabel text: catalog.i18nc("@description", "Backup and synchronize your Cura settings.") width: Math.round(parent.width / 2) - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter anchors.horizontalCenter: parent.horizontalCenter wrapMode: Label.WordWrap - renderType: Text.NativeRendering } Cura.PrimaryButton diff --git a/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml b/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml index a7297c12fb..74bc52b69e 100644 --- a/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml +++ b/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml @@ -1,10 +1,9 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.6 as Cura diff --git a/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml b/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml index 58958e0069..11c5d687e8 100644 --- a/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml +++ b/plugins/DigitalLibrary/resources/qml/DigitalFactoryOpenDialog.qml @@ -1,10 +1,9 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.6 as Cura diff --git a/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml b/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml index 6d870d0c78..56109dbcbe 100644 --- a/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml +++ b/plugins/DigitalLibrary/resources/qml/DigitalFactorySaveDialog.qml @@ -1,10 +1,9 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.6 as Cura diff --git a/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml b/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml index 5b237a3e48..5f594cb79e 100644 --- a/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml +++ b/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml @@ -1,10 +1,10 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.10 +import Qt.labs.qmlmodels 1.0 +import QtQuick 2.15 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.6 as Cura @@ -57,52 +57,32 @@ Item border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - - Cura.TableView + //We can't use Cura's TableView here, since in Cura >= 5.0 this uses QtQuick.TableView, while in Cura < 5.0 this uses QtControls1.TableView. + //So we have to define our own. Once support for 4.13 and earlier is dropped, we can switch to Cura.TableView. + Table { id: filesTableView anchors.fill: parent - model: manager.digitalFactoryFileModel - visible: model.count != 0 && manager.retrievingFileStatus != DF.RetrievalStatus.InProgress - selectionMode: OldControls.SelectionMode.SingleSelection - onDoubleClicked: + anchors.margins: parent.border.width + + columnHeaders: ["Name", "Uploaded by", "Uploaded at"] + model: TableModel + { + TableModelColumn { display: "fileName" } + TableModelColumn { display: "username" } + TableModelColumn { display: "uploadedAt" } + rows: manager.digitalFactoryFileModel.items + } + + onCurrentRowChanged: + { + manager.setSelectedFileIndices([currentRow]); + } + onDoubleClicked: function(row) { manager.setSelectedFileIndices([row]); openFilesButton.clicked(); } - - OldControls.TableViewColumn - { - id: fileNameColumn - role: "fileName" - title: "Name" - width: Math.round(filesTableView.width / 3) - } - - OldControls.TableViewColumn - { - id: usernameColumn - role: "username" - title: "Uploaded by" - width: Math.round(filesTableView.width / 3) - } - - OldControls.TableViewColumn - { - role: "uploadedAt" - title: "Uploaded at" - } - - Connections - { - target: filesTableView.selection - function onSelectionChanged() - { - let newSelection = []; - filesTableView.selection.forEach(function(rowIndex) { newSelection.push(rowIndex); }); - manager.setSelectedFileIndices(newSelection); - } - } } Label @@ -161,7 +141,6 @@ Item { // Make sure no files are selected when the file model changes filesTableView.currentRow = -1 - filesTableView.selection.clear() } } } @@ -187,7 +166,7 @@ Item anchors.bottom: parent.bottom anchors.right: parent.right text: "Open" - enabled: filesTableView.selection.count > 0 + enabled: filesTableView.currentRow >= 0 onClicked: { manager.openSelectedFiles() diff --git a/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml b/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml index c66556071f..5cf0d571fe 100644 --- a/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml +++ b/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml @@ -1,10 +1,10 @@ -// Copyright (C) 2021 Ultimaker B.V. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. +import Qt.labs.qmlmodels 1.0 import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 import UM 1.5 as UM import Cura 1.6 as Cura @@ -86,35 +86,22 @@ Item border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - - Cura.TableView + //We can't use Cura's TableView here, since in Cura >= 5.0 this uses QtQuick.TableView, while in Cura < 5.0 this uses QtControls1.TableView. + //So we have to define our own. Once support for 4.13 and earlier is dropped, we can switch to Cura.TableView. + Table { id: filesTableView anchors.fill: parent - model: manager.digitalFactoryFileModel - visible: model.count != 0 && manager.retrievingFileStatus != DF.RetrievalStatus.InProgress - selectionMode: OldControls.SelectionMode.NoSelection + anchors.margins: parent.border.width - OldControls.TableViewColumn + allowSelection: false + columnHeaders: ["Name", "Uploaded by", "Uploaded at"] + model: TableModel { - id: fileNameColumn - role: "fileName" - title: "@tableViewColumn:title", "Name" - width: Math.round(filesTableView.width / 3) - } - - OldControls.TableViewColumn - { - id: usernameColumn - role: "username" - title: "Uploaded by" - width: Math.round(filesTableView.width / 3) - } - - OldControls.TableViewColumn - { - role: "uploadedAt" - title: "Uploaded at" + TableModelColumn { display: "fileName" } + TableModelColumn { display: "username" } + TableModelColumn { display: "uploadedAt" } + rows: manager.digitalFactoryFileModel.items } } @@ -173,8 +160,7 @@ Item function onItemsChanged() { // Make sure no files are selected when the file model changes - filesTableView.currentRow = -1 - filesTableView.selection.clear() + filesTableView.currentRow = -1; } } } diff --git a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml index 24d4cbfade..89ebd0f215 100644 --- a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml +++ b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml @@ -1,11 +1,9 @@ -// Copyright (C) 2022 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.1 import UM 1.2 as UM @@ -224,4 +222,4 @@ Item x: Math.round((parent.width - width) / 2) y: Math.round((parent.height - height) / 2) } -} \ No newline at end of file +} diff --git a/plugins/DigitalLibrary/resources/qml/Table.qml b/plugins/DigitalLibrary/resources/qml/Table.qml new file mode 100644 index 0000000000..c4aafc1ce4 --- /dev/null +++ b/plugins/DigitalLibrary/resources/qml/Table.qml @@ -0,0 +1,203 @@ +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. + +import Qt.labs.qmlmodels 1.0 +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +import UM 1.2 as UM + +/* + * A re-sizeable table of data. + * + * This table combines a list of headers with a TableView to show certain roles in a table. + * The columns of the table can be resized. + * When the table becomes too big, you can scroll through the table. When a column becomes too small, the contents of + * the table are elided. + * The table gets Cura's themeing. + */ +Item +{ + id: tableBase + + required property var columnHeaders //The text to show in the headers of each column. + property alias model: tableView.model //A TableModel to display in this table. To use a ListModel for the rows, use "rows: listModel.items" + property int currentRow: -1 //The selected row index. + property var onDoubleClicked: function(row) {} //Something to execute when double clicked. Accepts one argument: The index of the row that was clicked on. + property bool allowSelection: true //Whether to allow the user to select items. + + Row + { + id: headerBar + Repeater + { + id: headerRepeater + model: columnHeaders + Rectangle + { + //minimumWidth: Math.max(1, Math.round(tableBase.width / headerRepeater.count)) + width: 300 + height: UM.Theme.getSize("section").height + + color: UM.Theme.getColor("secondary") + + Label + { + id: contentText + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("narrow_margin").width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("narrow_margin").width + + text: modelData + font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + Rectangle //Resize handle. + { + anchors + { + right: parent.right + top: parent.top + bottom: parent.bottom + } + width: UM.Theme.getSize("thick_lining").width + + color: UM.Theme.getColor("thick_lining") + + MouseArea + { + anchors.fill: parent + + cursorShape: Qt.SizeHorCursor + drag + { + target: parent + axis: Drag.XAxis + } + onMouseXChanged: + { + if(drag.active) + { + let new_width = parent.parent.width + mouseX; + let sum_widths = mouseX; + for(let i = 0; i < headerBar.children.length; ++i) + { + sum_widths += headerBar.children[i].width; + } + if(sum_widths > tableBase.width) + { + new_width -= sum_widths - tableBase.width; //Limit the total width to not exceed the view. + } + let width_fraction = new_width / tableBase.width; //Scale with the same fraction along with the total width, if the table is resized. + parent.parent.width = Qt.binding(function() { return Math.max(10, Math.round(tableBase.width * width_fraction)) }); + } + } + } + } + + onWidthChanged: + { + tableView.forceLayout(); //Rescale table cells underneath as well. + } + } + } + } + + TableView + { + id: tableView + anchors + { + top: headerBar.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + + flickableDirection: Flickable.AutoFlickIfNeeded + clip: true + ScrollBar.vertical: ScrollBar + { + // Vertical ScrollBar, styled similarly to the scrollBar in the settings panel + id: verticalScrollBar + visible: tableView.contentHeight > tableView.height + + background: Rectangle + { + implicitWidth: UM.Theme.getSize("scrollbar").width + radius: Math.round(implicitWidth / 2) + color: UM.Theme.getColor("scrollbar_background") + } + + contentItem: Rectangle + { + id: scrollViewHandle + implicitWidth: UM.Theme.getSize("scrollbar").width + radius: Math.round(implicitWidth / 2) + + color: verticalScrollBar.pressed ? UM.Theme.getColor("scrollbar_handle_down") : verticalScrollBar.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.Theme.getColor("scrollbar_handle") + Behavior on color { ColorAnimation { duration: 50; } } + } + } + columnWidthProvider: function(column) + { + return headerBar.children[column].width; //Cells get the same width as their column header. + } + + delegate: Rectangle + { + implicitHeight: Math.max(1, cellContent.height) + + color: UM.Theme.getColor((tableBase.currentRow == row) ? "primary" : ((row % 2 == 0) ? "main_background" : "viewport_background")) + + Label + { + id: cellContent + width: parent.width + + text: display + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + TextMetrics + { + id: cellTextMetrics + text: cellContent.text + font: cellContent.font + elide: cellContent.elide + elideWidth: cellContent.width + } + UM.TooltipArea + { + anchors.fill: parent + + acceptedButtons: Qt.LeftButton + text: (cellTextMetrics.elidedText == cellContent.text) ? "" : cellContent.text //Show full text in tooltip if it was elided. + onClicked: + { + if(tableBase.allowSelection) + { + tableBase.currentRow = row; //Select this row. + } + } + onDoubleClicked: + { + tableBase.onDoubleClicked(row); + } + } + } + + Connections + { + target: model + function onRowCountChanged() + { + tableView.contentY = 0; //When the number of rows is reduced, make sure to scroll back to the start. + } + } + } +} \ No newline at end of file diff --git a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml index b5b6c15f50..c679c4328c 100644 --- a/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml +++ b/plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml @@ -1,19 +1,19 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import QtQuick.Dialogs 1.2 // For filedialog -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Cura.MachineAction { - anchors.fill: parent; + anchors.fill: parent property bool printerConnected: Cura.MachineManager.printerConnected property var activeOutputDevice: printerConnected ? Cura.MachineManager.printerOutputDevices[0] : null property bool canUpdateFirmware: activeOutputDevice ? activeOutputDevice.activePrinter.canUpdateFirmware : false @@ -25,25 +25,22 @@ Cura.MachineAction UM.I18nCatalog { id: catalog; name: "cura"} spacing: UM.Theme.getSize("default_margin").height - Label + UM.Label { width: parent.width text: catalog.i18nc("@title", "Update Firmware") - wrapMode: Text.WordWrap font.pointSize: 18 } - Label + UM.Label { width: parent.width - wrapMode: Text.WordWrap text: catalog.i18nc("@label", "Firmware is the piece of software running directly on your 3D printer. This firmware controls the step motors, regulates the temperature and ultimately makes your printer work.") } - Label + UM.Label { width: parent.width - wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "The firmware shipping with new printers works, but new versions tend to have more features and improvements."); + text: catalog.i18nc("@label", "The firmware shipping with new printers works, but new versions tend to have more features and improvements.") } Row @@ -52,10 +49,10 @@ Cura.MachineAction width: childrenRect.width spacing: UM.Theme.getSize("default_margin").width property string firmwareName: Cura.MachineManager.activeMachine.getDefaultFirmwareName() - Button + Cura.SecondaryButton { id: autoUpgradeButton - text: catalog.i18nc("@action:button", "Automatically upgrade Firmware"); + text: catalog.i18nc("@action:button", "Automatically upgrade Firmware") enabled: parent.firmwareName != "" && canUpdateFirmware onClicked: { @@ -63,10 +60,10 @@ Cura.MachineAction activeOutputDevice.updateFirmware(parent.firmwareName); } } - Button + Cura.SecondaryButton { id: manualUpgradeButton - text: catalog.i18nc("@action:button", "Upload custom Firmware"); + text: catalog.i18nc("@action:button", "Upload custom Firmware") enabled: canUpdateFirmware onClicked: { @@ -75,20 +72,18 @@ Cura.MachineAction } } - Label + UM.Label { width: parent.width - wrapMode: Text.WordWrap visible: !printerConnected && !updateProgressDialog.visible - text: catalog.i18nc("@label", "Firmware can not be updated because there is no connection with the printer."); + text: catalog.i18nc("@label", "Firmware can not be updated because there is no connection with the printer.") } Label { width: parent.width - wrapMode: Text.WordWrap visible: printerConnected && !canUpdateFirmware - text: catalog.i18nc("@label", "Firmware can not be updated because the connection with the printer does not support upgrading firmware."); + text: catalog.i18nc("@label", "Firmware can not be updated because the connection with the printer does not support upgrading firmware.") } } @@ -122,7 +117,7 @@ Cura.MachineAction { anchors.fill: parent - Label + UM.Label { anchors { @@ -157,12 +152,10 @@ Cura.MachineAction wrapMode: Text.Wrap } - ProgressBar + UM.ProgressBar { id: prog - value: (manager.firmwareUpdater != null) ? manager.firmwareUpdater.firmwareProgress : 0 - minimumValue: 0 - maximumValue: 100 + value: (manager.firmwareUpdater != null) ? manager.firmwareUpdater.firmwareProgress / 100 : 0 indeterminate: { if(manager.firmwareUpdater == null) @@ -173,18 +166,18 @@ Cura.MachineAction } anchors { - left: parent.left; - right: parent.right; + left: parent.left + right: parent.right } } } rightButtons: [ - Button + Cura.SecondaryButton { - text: catalog.i18nc("@action:button","Close"); - enabled: (manager.firmwareUpdater != null) ? manager.firmwareUpdater.firmwareUpdateState != 1 : true; - onClicked: updateProgressDialog.visible = false; + text: catalog.i18nc("@action:button", "Close") + enabled: manager.firmwareUpdater != null ? manager.firmwareUpdater.firmwareUpdateState != 1 : true + onClicked: updateProgressDialog.visible = false } ] } diff --git a/plugins/ImageReader/ConfigUI.qml b/plugins/ImageReader/ConfigUI.qml index a3dceed50d..ff79e4e31d 100644 --- a/plugins/ImageReader/ConfigUI.qml +++ b/plugins/ImageReader/ConfigUI.qml @@ -1,239 +1,333 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.3 import QtQuick.Window 2.1 -import UM 1.1 as UM +import UM 1.5 as UM +import Cura 1.0 as Cura UM.Dialog { - width: minimumWidth; - minimumWidth: 350 * screenScaleFactor; + title: catalog.i18nc("@title:window", "Convert Image") - height: minimumHeight; - minimumHeight: 250 * screenScaleFactor; - - title: catalog.i18nc("@title:window", "Convert Image...") + minimumWidth: grid.width + 2 * UM.Theme.getSize("default_margin").height + minimumHeight: UM.Theme.getSize("modal_window_minimum").height + width: minimumWidth + height: minimumHeight GridLayout { - UM.I18nCatalog{id: catalog; name: "cura"} - anchors.fill: parent; - Layout.fillWidth: true - columnSpacing: 16 * screenScaleFactor - rowSpacing: 4 * screenScaleFactor - columns: 1 + UM.I18nCatalog { id: catalog; name: "cura" } + id: grid + columnSpacing: UM.Theme.getSize("narrow_margin").width + rowSpacing: UM.Theme.getSize("narrow_margin").height + columns: 2 - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The maximum distance of each pixel from \"Base.\"") - Row { - width: parent.width + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: catalog.i18nc("@action:label", "Height (mm)") + Layout.alignment: Qt.AlignVCenter - Label { - text: catalog.i18nc("@action:label", "Height (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - - TextField { - id: peak_height - objectName: "Peak_Height" - validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onPeakHeightChanged(text) } - } + MouseArea { + id: peak_height_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The base height from the build plate in millimeters.") - Row { - width: parent.width + Cura.TextField + { + id: peak_height + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + selectByMouse: true + objectName: "Peak_Height" + validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ } + onTextChanged: manager.onPeakHeightChanged(text) + } - Label { - text: catalog.i18nc("@action:label", "Base (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The maximum distance of each pixel from \"Base.\"") + visible: peak_height.hovered || peak_height_label.containsMouse + targetPoint: Qt.point(peak_height.x + Math.round(peak_height.width / 2), 0) + y: peak_height.y + peak_height.height + UM.Theme.getSize("default_margin").height + } - TextField { - id: base_height - objectName: "Base_Height" - validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onBaseHeightChanged(text) } - } + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: catalog.i18nc("@action:label", "Base (mm)") + Layout.alignment: Qt.AlignVCenter + + MouseArea + { + id: base_height_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The width in millimeters on the build plate.") - Row { - width: parent.width + Cura.TextField + { + id: base_height + selectByMouse: true + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + objectName: "Base_Height" + validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ } + onTextChanged: manager.onBaseHeightChanged(text) + } - Label { - text: catalog.i18nc("@action:label", "Width (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The base height from the build plate in millimeters.") + visible: base_height.hovered || base_height_label.containsMouse + targetPoint: Qt.point(base_height.x + Math.round(base_height.width / 2), 0) + y: base_height.y + base_height.height + UM.Theme.getSize("default_margin").height + } - TextField { - id: width - objectName: "Width" - focus: true - validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onWidthChanged(text) } - } + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: catalog.i18nc("@action:label", "Width (mm)") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: width_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The depth in millimeters on the build plate") - Row { - width: parent.width + Cura.TextField + { + id: width + selectByMouse: true + objectName: "Width" + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + focus: true + validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } + onTextChanged: manager.onWidthChanged(text) + } - Label { - text: catalog.i18nc("@action:label", "Depth (mm)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - TextField { - id: depth - objectName: "Depth" - focus: true - validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onDepthChanged(text) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The width in millimeters on the build plate") + visible: width.hovered || width_label.containsMouse + targetPoint: Qt.point(width.x + Math.round(width.width / 2), 0) + y: width.y + width.height + UM.Theme.getSize("default_margin").height + } + + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: catalog.i18nc("@action:label", "Depth (mm)") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: depth_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.") - Row { - width: parent.width + Cura.TextField + { + id: depth + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + selectByMouse: true + objectName: "Depth" + focus: true + validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } + onTextChanged: manager.onDepthChanged(text) + } - //Empty label so 2 column layout works. - Label { - text: "" - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - ComboBox { - id: lighter_is_higher - objectName: "Lighter_Is_Higher" - model: [ catalog.i18nc("@item:inlistbox","Darker is higher"), catalog.i18nc("@item:inlistbox","Lighter is higher") ] - width: 180 * screenScaleFactor - onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The depth in millimeters on the build plate") + visible: depth.hovered || depth_label.containsMouse + targetPoint: Qt.point(depth.x + Math.round(depth.width / 2), 0) + y: depth.y + depth.height + UM.Theme.getSize("default_margin").height + } + + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: "" + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: lighter_is_higher_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.") - Row { - width: parent.width + Cura.ComboBox + { + id: lighter_is_higher + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + Layout.preferredHeight: UM.Theme.getSize("setting_control").height + objectName: "Lighter_Is_Higher" + textRole: "text" + model: [ + { text: catalog.i18nc("@item:inlistbox", "Darker is higher") }, + { text: catalog.i18nc("@item:inlistbox", "Lighter is higher") } + ] + onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } + } - Label { - text: "Color Model" - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - ComboBox { - id: color_model - objectName: "ColorModel" - model: [ catalog.i18nc("@item:inlistbox","Linear"), catalog.i18nc("@item:inlistbox","Translucency") ] - width: 180 * screenScaleFactor - onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.") + visible: lighter_is_higher.hovered || lighter_is_higher_label.containsMouse + targetPoint: Qt.point(lighter_is_higher.x + Math.round(lighter_is_higher.width / 2), 0) + y: lighter_is_higher.y + lighter_is_higher.height + UM.Theme.getSize("default_margin").height + } + + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: catalog.i18nc("@action:label", "Color Model") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: color_model_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.") - visible: color_model.currentText == catalog.i18nc("@item:inlistbox","Translucency") - Row { - width: parent.width + Cura.ComboBox + { + id: color_model + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + Layout.preferredHeight: UM.Theme.getSize("setting_control").height + objectName: "ColorModel" + textRole: "text" + model: [ + { text: catalog.i18nc("@item:inlistbox", "Linear") }, + { text: catalog.i18nc("@item:inlistbox", "Translucency") } + ] + onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) } + } - Label { - text: catalog.i18nc("@action:label", "1mm Transmittance (%)") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - TextField { - id: transmittance - objectName: "Transmittance" - focus: true - validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} - width: 180 * screenScaleFactor - onTextChanged: { manager.onTransmittanceChanged(text) } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.") + visible: color_model.hovered || color_model_label.containsMouse + targetPoint: Qt.point(color_model.x + Math.round(color_model.width / 2), 0) + y: color_model.y + color_model.height + UM.Theme.getSize("default_margin").height + } + + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: catalog.i18nc("@action:label", "1mm Transmittance (%)") + Layout.alignment: Qt.AlignVCenter + + MouseArea { + id: transmittance_label + anchors.fill: parent + hoverEnabled: true } } - UM.TooltipArea { - Layout.fillWidth:true - height: childrenRect.height - text: catalog.i18nc("@info:tooltip","The amount of smoothing to apply to the image.") - Row { - width: parent.width + Cura.TextField + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + selectByMouse: true + objectName: "Transmittance" + validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } + onTextChanged: manager.onTransmittanceChanged(text) - Label { - text: catalog.i18nc("@action:label", "Smoothing") - width: 150 * screenScaleFactor - anchors.verticalCenter: parent.verticalCenter - } - - Item { - width: 180 * screenScaleFactor - height: 20 * screenScaleFactor - Layout.fillWidth: true - - Slider { - id: smoothing - objectName: "Smoothing" - maximumValue: 100.0 - stepSize: 1.0 - width: 180 - onValueChanged: { manager.onSmoothingChanged(value) } - } - } + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.") + visible: parent.hovered || transmittance_label.containsMouse + targetPoint: Qt.point(parent.x + Math.round(parent.width / 2), 0) + y: parent.y + parent.height + UM.Theme.getSize("default_margin").height } } + + UM.Label + { + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + text: catalog.i18nc("@action:label", "Smoothing") + Layout.alignment: Qt.AlignVCenter + + MouseArea + { + id: smoothing_label + anchors.fill: parent + hoverEnabled: true + } + } + + Cura.SpinBox + { + id: smoothing + Layout.fillWidth: true + Layout.minimumWidth: UM.Theme.getSize("setting_control").width + objectName: "Smoothing" + to: 100.0 + stepSize: 1.0 + onValueChanged: manager.onSmoothingChanged(value) + } + + Cura.ToolTip + { + text: catalog.i18nc("@info:tooltip", "The amount of smoothing to apply to the image.") + visible: smoothing.hovered || smoothing_label.containsMouse + targetPoint: Qt.point(smoothing.x + Math.round(smoothing.width / 2), 0) + y: smoothing.y + smoothing.height + UM.Theme.getSize("default_margin").height + } } + Item + { + ButtonGroup + { + buttons: [ok_button, cancel_button] + checkedButton: ok_button + } + } + + onAccepted: manager.onOkButtonClicked() + onRejected: manager.onCancelButtonClicked() + + buttonSpacing: UM.Theme.getSize("default_margin").width + rightButtons: [ - Button + Cura.TertiaryButton { - id:ok_button - text: catalog.i18nc("@action:button","OK"); - onClicked: { manager.onOkButtonClicked() } - enabled: true + id: cancel_button + text: catalog.i18nc("@action:button", "Cancel") + onClicked: manager.onCancelButtonClicked() }, - Button + Cura.PrimaryButton { - id:cancel_button - text: catalog.i18nc("@action:button","Cancel"); - onClicked: { manager.onCancelButtonClicked() } - enabled: true + id: ok_button + text: catalog.i18nc("@action:button", "OK") + onClicked: manager.onOkButtonClicked() } ] } diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 8c4c00a3a5..7f72fea4c3 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -1,11 +1,11 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -88,7 +88,7 @@ Cura.MachineAction } } - Label + UM.Label { id: machineNameLabel anchors.top: parent.top @@ -97,7 +97,6 @@ Cura.MachineAction text: Cura.MachineManager.activeMachine.name horizontalAlignment: Text.AlignHCenter font: UM.Theme.getFont("large_bold") - renderType: Text.NativeRendering } UM.TabRow @@ -111,6 +110,7 @@ Cura.MachineAction model: tabNameModel delegate: UM.TabRowButton { + checked: model.index == 0 text: model.name } } diff --git a/plugins/Marketplace/resources/qml/LicenseDialog.qml b/plugins/Marketplace/resources/qml/LicenseDialog.qml index 1c99569793..09d7c5b59a 100644 --- a/plugins/Marketplace/resources/qml/LicenseDialog.qml +++ b/plugins/Marketplace/resources/qml/LicenseDialog.qml @@ -14,8 +14,8 @@ UM.Dialog { id: licenseDialog title: catalog.i18nc("@button", "Plugin license agreement") - minimumWidth: UM.Theme.getSize("license_window_minimum").width - minimumHeight: UM.Theme.getSize("license_window_minimum").height + minimumWidth: UM.Theme.getSize("modal_window_minimum").width + minimumHeight: UM.Theme.getSize("modal_window_minimum").height width: minimumWidth height: minimumHeight backgroundColor: UM.Theme.getColor("main_background") diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 5a30141b32..8fcba852bd 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -64,8 +64,8 @@ Window // Page title. Item { - implicitWidth: parent.width - implicitHeight: childrenRect.height + UM.Theme.getSize("default_margin").height + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height Label { diff --git a/plugins/ModelChecker/ModelChecker.qml b/plugins/ModelChecker/ModelChecker.qml index ddeed063b1..41c49c9a25 100644 --- a/plugins/ModelChecker/ModelChecker.qml +++ b/plugins/ModelChecker/ModelChecker.qml @@ -2,43 +2,20 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - import UM 1.2 as UM -Button +UM.SimpleButton { id: modelCheckerButton - UM.I18nCatalog - { - id: catalog - name: "cura" - } - visible: manager.hasWarnings - tooltip: catalog.i18nc("@info:tooltip", "Some things could be problematic in this print. Click to see tips for adjustment.") onClicked: manager.showWarnings() width: UM.Theme.getSize("save_button_specs_icons").width height: UM.Theme.getSize("save_button_specs_icons").height - + iconSource: "model_checker.svg" anchors.verticalCenter: parent ? parent.verticalCenter : undefined - - style: ButtonStyle - { - background: Item - { - UM.RecolorImage - { - width: UM.Theme.getSize("save_button_specs_icons").width; - height: UM.Theme.getSize("save_button_specs_icons").height; - sourceSize.height: width; - color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene"); - source: "model_checker.svg" - } - } - } + color: UM.Theme.getColor("text_scene") + hoverColor: UM.Theme.getColor("text_scene_hover") } diff --git a/plugins/MonitorStage/MonitorMain.qml b/plugins/MonitorStage/MonitorMain.qml index cfd33a70fe..aa717ce95c 100644 --- a/plugins/MonitorStage/MonitorMain.qml +++ b/plugins/MonitorStage/MonitorMain.qml @@ -3,7 +3,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.0 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.0 as Cura // We show a nice overlay on the 3D viewer when the current output device has no monitor view @@ -90,7 +90,7 @@ Rectangle visible: monitorViewComponent.sourceComponent == null // CASE 2: CAN MONITOR & NOT CONNECTED - Label + UM.Label { anchors { @@ -99,14 +99,10 @@ Rectangle visible: isNetworkConfigured && !isConnected text: catalog.i18nc("@info", "Please make sure your printer has a connection:\n- Check if the printer is turned on.\n- Check if the printer is connected to the network.\n- Check if you are signed in to discover cloud-connected printers.") font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - wrapMode: Text.WordWrap - lineHeight: UM.Theme.getSize("monitor_text_line_large").height - lineHeightMode: Text.FixedHeight width: contentWidth } - Label + UM.Label { id: noNetworkLabel anchors @@ -116,11 +112,7 @@ Rectangle visible: !isNetworkConfigured && isNetworkConfigurable text: catalog.i18nc("@info", "Please connect your printer to the network.") font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - wrapMode: Text.WordWrap width: contentWidth - lineHeight: UM.Theme.getSize("monitor_text_line_large").height - lineHeightMode: Text.FixedHeight } Item { @@ -129,7 +121,6 @@ Rectangle left: noNetworkLabel.left } visible: !isNetworkConfigured && isNetworkConfigurable - height: UM.Theme.getSize("monitor_text_line").height width: childrenRect.width UM.RecolorImage @@ -138,8 +129,8 @@ Rectangle anchors.verticalCenter: parent.verticalCenter color: UM.Theme.getColor("text_link") source: UM.Theme.getIcon("LinkExternal") - width: UM.Theme.getSize("monitor_external_link_icon").width - height: UM.Theme.getSize("monitor_external_link_icon").height + width: UM.Theme.getSize("icon_indicator").width + height: UM.Theme.getSize("icon_indicator").height } Label { diff --git a/plugins/PerObjectSettingsTool/PerObjectCategory.qml b/plugins/PerObjectSettingsTool/PerObjectCategory.qml index 58192f0acd..3d0b1d826e 100644 --- a/plugins/PerObjectSettingsTool/PerObjectCategory.qml +++ b/plugins/PerObjectSettingsTool/PerObjectCategory.qml @@ -1,59 +1,62 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Uranium is released under the terms of the LGPLv3 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.1 as UM +import QtQuick.Controls 2.1 +import UM 1.5 as UM +import Cura 1.0 as Cura import ".." Button { id: base; - style: ButtonStyle { - background: Item { } - label: Row + background: Rectangle { + color: UM.Theme.getColor("category_background") + } + + contentItem: Row + { + spacing: UM.Theme.getSize("default_lining").width + + Item //Wrapper to give space before icon with fixed width. This allows aligning checkbox with category icon. { - spacing: UM.Theme.getSize("default_lining").width + height: label.height + width: height + anchors.verticalCenter: parent.verticalCenter UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter height: (label.height / 2) | 0 width: height - source: control.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight"); - color: control.hovered ? palette.highlight : palette.buttonText + source: base.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight") + color: base.hovered ? UM.Theme.getColor("primary_button_hover"): UM.Theme.getColor("text") } - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - height: label.height - width: height - source: control.iconSource - color: control.hovered ? palette.highlight : palette.buttonText - } - Label - { - id: label - anchors.verticalCenter: parent.verticalCenter - text: control.text - color: control.hovered ? palette.highlight : palette.buttonText - font.bold: true - } - - SystemPalette { id: palette } + } + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + height: label.height + width: height + source: UM.Theme.getIcon(definition.icon) + color: base.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("text") + } + UM.Label + { + id: label + anchors.verticalCenter: parent.verticalCenter + text: base.text + color: base.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("text") + font.bold: true } } - signal showTooltip(string text); - signal hideTooltip(); + signal showTooltip(string text) + signal hideTooltip() signal contextMenuRequested() text: definition.label - iconSource: UM.Theme.getIcon(definition.icon) checkable: true checked: definition.expanded diff --git a/plugins/PerObjectSettingsTool/PerObjectItem.qml b/plugins/PerObjectSettingsTool/PerObjectItem.qml index 9700b2265b..0c8015541e 100644 --- a/plugins/PerObjectSettingsTool/PerObjectItem.qml +++ b/plugins/PerObjectSettingsTool/PerObjectItem.qml @@ -3,25 +3,32 @@ import QtQuick 2.1 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.1 import UM 1.5 as UM - import Cura 1.0 as Cura UM.TooltipArea { - x: model.depth * UM.Theme.getSize("default_margin").width; - text: model.description; + x: model.depth * UM.Theme.getSize("default_margin").width + text: model.description - width: childrenRect.width; - height: childrenRect.height; + width: childrenRect.width + height: childrenRect.height + + Item + { + id: spacer + // Align checkbox with PerObjectCategory icon + width: UM.Theme.getSize("default_margin").width + } UM.CheckBox { id: check + anchors.left: spacer.right + text: definition.label checked: addedSettingsModel.getVisible(model.key) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index 9957171379..03e1da7d35 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -1,11 +1,10 @@ -// Copyright (c) 2021 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 +import QtQuick.Controls 2.15 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura import ".." @@ -76,63 +75,72 @@ Item id: meshTypeButtons spacing: UM.Theme.getSize("default_margin").width - Button + Cura.ToolbarButton { id: normalButton text: catalog.i18nc("@label", "Normal model") - iconSource: UM.Theme.getIcon("Infill0"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("Infill0") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable: true onClicked: setMeshType(normalMeshType); - style: UM.Theme.styles.tool_button; z: 4 } - Button + Cura.ToolbarButton { id: supportMeshButton text: catalog.i18nc("@label", "Print as support") - iconSource: UM.Theme.getIcon("MeshTypeSupport"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("MeshTypeSupport") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable:true onClicked: setMeshType(supportMeshType) - style: UM.Theme.styles.tool_button; z: 3 } - Button + Cura.ToolbarButton { id: overlapMeshButton text: catalog.i18nc("@label", "Modify settings for overlaps") - iconSource: UM.Theme.getIcon("MeshTypeIntersect"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("MeshTypeIntersect") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable:true onClicked: setMeshType(infillMeshType) - style: UM.Theme.styles.tool_button; z: 2 } - Button + Cura.ToolbarButton { id: antiOverhangMeshButton text: catalog.i18nc("@label", "Don't support overlaps") - iconSource: UM.Theme.getIcon("BlockSupportOverlaps"); + toolItem: UM.RecolorImage + { + source: UM.Theme.getIcon("BlockSupportOverlaps") + color: UM.Theme.getColor("icon") + } property bool needBorder: true checkable: true onClicked: setMeshType(antiOverhangMeshType) - style: UM.Theme.styles.tool_button; z: 1 } } - Label + UM.Label { id: meshTypeLabel - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") height: UM.Theme.getSize("setting").height - verticalAlignment: Text.AlignVCenter } @@ -182,189 +190,184 @@ Item height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) visible: currentMeshType != "anti_overhang_mesh" - ScrollView + ListView { + id: contents height: parent.height width: UM.Theme.getSize("setting").width + UM.Theme.getSize("default_margin").width - style: UM.Theme.styles.scrollview - ListView + ScrollBar.vertical: UM.ScrollBar {} + clip: true + spacing: UM.Theme.getSize("default_lining").height + + model: UM.SettingDefinitionsModel { - id: contents - spacing: UM.Theme.getSize("default_lining").height - - model: UM.SettingDefinitionsModel + id: addedSettingsModel + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + expanded: [ "*" ] + filter: { - id: addedSettingsModel - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - expanded: [ "*" ] - filter: + if (printSequencePropertyProvider.properties.value == "one_at_a_time") { - if (printSequencePropertyProvider.properties.value == "one_at_a_time") + return {"settable_per_meshgroup": true} + } + return {"settable_per_mesh": true} + } + exclude: + { + var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] + + if (currentMeshType == "support_mesh") + { + excluded_settings = excluded_settings.concat(base.allCategoriesExceptSupport) + } + return excluded_settings + } + + visibilityHandler: Cura.PerObjectSettingVisibilityHandler + { + id: visibility_handler + selectedObjectId: UM.ActiveTool.properties.getValue("SelectedObjectId") + } + + // For some reason the model object is updated after removing him from the memory and + // it happens only on Windows. For this reason, set the destroyed value manually. + Component.onDestruction: + { + setDestroyed(true) + } + } + + delegate: Row + { + spacing: - UM.Theme.getSize("default_margin").width + Loader + { + id: settingLoader + width: UM.Theme.getSize("setting").width + height: UM.Theme.getSize("section").height + enabled: provider.properties.enabled === "True" + property var definition: model + property var settingDefinitionsModel: addedSettingsModel + property var propertyProvider: provider + property var globalPropertyProvider: inheritStackProvider + property var externalResetHandler: false + + //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 + //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, + //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. + asynchronous: model.type != "enum" && model.type != "extruder" + + onLoaded: + { + settingLoader.item.showRevertButton = false + settingLoader.item.showInheritButton = false + settingLoader.item.showLinkedSettingIcon = false + settingLoader.item.doDepthIndentation = false + settingLoader.item.doQualityUserSettingEmphasis = false + } + + sourceComponent: + { + switch(model.type) { - return {"settable_per_meshgroup": true} + case "int": + return settingTextField + case "[int]": + return settingTextField + case "float": + return settingTextField + case "enum": + return settingComboBox + case "extruder": + return settingExtruder + case "optional_extruder": + return settingOptionalExtruder + case "bool": + return settingCheckBox + case "str": + return settingTextField + case "category": + return settingCategory + default: + return settingUnknown } - return {"settable_per_mesh": true} - } - exclude: - { - var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] - - if (currentMeshType == "support_mesh") - { - excluded_settings = excluded_settings.concat(base.allCategoriesExceptSupport) - } - return excluded_settings - } - - visibilityHandler: Cura.PerObjectSettingVisibilityHandler - { - id: visibility_handler - selectedObjectId: UM.ActiveTool.properties.getValue("SelectedObjectId") - } - - // For some reason the model object is updated after removing him from the memory and - // it happens only on Windows. For this reason, set the destroyed value manually. - Component.onDestruction: - { - setDestroyed(true) } } - delegate: Row + Button { - spacing: - UM.Theme.getSize("default_margin").width - Loader + width: Math.round(UM.Theme.getSize("setting").height / 2) + height: UM.Theme.getSize("setting").height + + onClicked: addedSettingsModel.setVisible(model.key, false) + + background: Item { - id: settingLoader - width: UM.Theme.getSize("setting").width - height: UM.Theme.getSize("section").height - enabled: provider.properties.enabled === "True" - property var definition: model - property var settingDefinitionsModel: addedSettingsModel - property var propertyProvider: provider - property var globalPropertyProvider: inheritStackProvider - property var externalResetHandler: false - - //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 - //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, - //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type != "enum" && model.type != "extruder" - - onLoaded: + UM.RecolorImage { - settingLoader.item.showRevertButton = false - settingLoader.item.showInheritButton = false - settingLoader.item.showLinkedSettingIcon = false - settingLoader.item.doDepthIndentation = false - settingLoader.item.doQualityUserSettingEmphasis = false - } - - sourceComponent: - { - switch(model.type) - { - case "int": - return settingTextField - case "[int]": - return settingTextField - case "float": - return settingTextField - case "enum": - return settingComboBox - case "extruder": - return settingExtruder - case "optional_extruder": - return settingOptionalExtruder - case "bool": - return settingCheckBox - case "str": - return settingTextField - case "category": - return settingCategory - default: - return settingUnknown - } + anchors.verticalCenter: parent.verticalCenter + width: parent.width + height: width + sourceSize.height: width + color: parent.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") + source: UM.Theme.getIcon("Minus") } } + } - Button + // Specialty provider that only watches global_inherits (we can't filter on what property changed we get events + // so we bypass that to make a dedicated provider). + UM.SettingPropertyProvider + { + id: provider + + containerStackId: UM.ActiveTool.properties.getValue("ContainerID") + key: model.key + watchedProperties: [ "value", "enabled", "validationState" ] + storeIndex: 0 + removeUnusedValue: false + } + + UM.SettingPropertyProvider + { + id: inheritStackProvider + containerStackId: UM.ActiveTool.properties.getValue("ContainerID") + key: model.key + watchedProperties: [ "limit_to_extruder" ] + } + + Connections + { + target: inheritStackProvider + function onPropertiesChanged() { provider.forcePropertiesChanged() } + } + + Connections + { + target: UM.ActiveTool + function onPropertiesChanged() { - width: Math.round(UM.Theme.getSize("setting").height / 2) - height: UM.Theme.getSize("setting").height - - onClicked: addedSettingsModel.setVisible(model.key, false) - - style: ButtonStyle + // the values cannot be bound with UM.ActiveTool.properties.getValue() calls, + // so here we connect to the signal and update the those values. + if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined") { - background: Item + const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId") + if (addedSettingsModel.visibilityHandler.selectedObjectId != selectedObjectId) { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - height: width - sourceSize.height: width - color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") - source: UM.Theme.getIcon("Minus") - } + addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId } } - } - - // Specialty provider that only watches global_inherits (we can't filter on what property changed we get events - // so we bypass that to make a dedicated provider). - UM.SettingPropertyProvider - { - id: provider - - containerStackId: UM.ActiveTool.properties.getValue("ContainerID") - key: model.key - watchedProperties: [ "value", "enabled", "validationState" ] - storeIndex: 0 - removeUnusedValue: false - } - - UM.SettingPropertyProvider - { - id: inheritStackProvider - containerStackId: UM.ActiveTool.properties.getValue("ContainerID") - key: model.key - watchedProperties: [ "limit_to_extruder" ] - } - - Connections - { - target: inheritStackProvider - function onPropertiesChanged() { provider.forcePropertiesChanged() } - } - - Connections - { - target: UM.ActiveTool - function onPropertiesChanged() + if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined") { - // the values cannot be bound with UM.ActiveTool.properties.getValue() calls, - // so here we connect to the signal and update the those values. - if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined") + const containerId = UM.ActiveTool.properties.getValue("ContainerID") + if (provider.containerStackId != containerId) { - const selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId") - if (addedSettingsModel.visibilityHandler.selectedObjectId != selectedObjectId) - { - addedSettingsModel.visibilityHandler.selectedObjectId = selectedObjectId - } + provider.containerStackId = containerId } - if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined") + if (inheritStackProvider.containerStackId != containerId) { - const containerId = UM.ActiveTool.properties.getValue("ContainerID") - if (provider.containerStackId != containerId) - { - provider.containerStackId = containerId - } - if (inheritStackProvider.containerStackId != containerId) - { - inheritStackProvider.containerStackId = containerId - } + inheritStackProvider.containerStackId = containerId } } } @@ -422,8 +425,6 @@ Item storeIndex: 0 } - SystemPalette { id: palette } - Component { id: settingTextField diff --git a/plugins/PerObjectSettingsTool/SettingPickDialog.qml b/plugins/PerObjectSettingsTool/SettingPickDialog.qml index 0b03ef5008..d7d8091121 100644 --- a/plugins/PerObjectSettingsTool/SettingPickDialog.qml +++ b/plugins/PerObjectSettingsTool/SettingPickDialog.qml @@ -1,6 +1,8 @@ +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 +import QtQuick.Controls 2.2 import UM 1.5 as UM import Cura 1.0 as Cura @@ -11,7 +13,8 @@ UM.Dialog id: settingPickDialog title: catalog.i18nc("@title:window", "Select Settings to Customize for this model") - width: screenScaleFactor * 360 + width: UM.Theme.getSize("small_popup_dialog").width + backgroundColor: UM.Theme.getColor("background_1") property var additional_excluded_settings @@ -40,9 +43,10 @@ UM.Dialog listview.model.filter = new_filter } - TextField + Cura.TextField { id: filterInput + selectByMouse: true anchors { @@ -69,65 +73,65 @@ UM.Dialog text: catalog.i18nc("@label:checkbox", "Show all") } - ScrollView + ListView { - id: scrollView - + id: listview anchors { top: filterInput.bottom + topMargin: UM.Theme.getSize("default_margin").height left: parent.left right: parent.right bottom: parent.bottom } - ListView + + ScrollBar.vertical: UM.ScrollBar { id: scrollBar } + clip: true + + model: UM.SettingDefinitionsModel { - id: listview - model: UM.SettingDefinitionsModel + id: definitionsModel + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + visibilityHandler: UM.SettingPreferenceVisibilityHandler {} + expanded: [ "*" ] + exclude: { - id: definitionsModel - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - visibilityHandler: UM.SettingPreferenceVisibilityHandler {} - expanded: [ "*" ] - exclude: - { - var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] - excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings) - return excluded_settings - } - showAll: toggleShowAll.checked || filterInput.text !== "" + var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] + excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings) + return excluded_settings } - delegate: Loader - { - id: loader - - width: listview.width - height: model.type != undefined ? UM.Theme.getSize("section").height : 0 - - property var definition: model - property var settingDefinitionsModel: definitionsModel - - asynchronous: true - source: - { - switch(model.type) - { - case "category": - return "PerObjectCategory.qml" - default: - return "PerObjectItem.qml" - } - } - } - Component.onCompleted: settingPickDialog.updateFilter() + showAll: toggleShowAll.checked || filterInput.text !== "" } + delegate: Loader + { + id: loader + + width: listview.width - scrollBar.width + height: model.type != undefined ? UM.Theme.getSize("section").height : 0 + + property var definition: model + property var settingDefinitionsModel: definitionsModel + + asynchronous: true + source: + { + switch(model.type) + { + case "category": + return "PerObjectCategory.qml" + default: + return "PerObjectItem.qml" + } + } + } + Component.onCompleted: settingPickDialog.updateFilter() } rightButtons: [ - Button + Cura.TertiaryButton { text: catalog.i18nc("@action:button", "Close") - onClicked: settingPickDialog.visible = false + onClicked: reject() } ] } \ No newline at end of file diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index bd94d1fdfd..9c59f9e879 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -1,16 +1,13 @@ -// Copyright (c) 2015 Jaime van Kessel, Ultimaker B.V. +// Copyright (c) 2022 Jaime van Kessel, Ultimaker B.V. // The PostProcessingPlugin is released under the terms of the AGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls 2.15 as QQC2 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.15 import QtQml.Models 2.15 as Models import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 import QtQuick.Window 2.2 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura UM.Dialog @@ -18,14 +15,15 @@ UM.Dialog id: dialog title: catalog.i18nc("@title:window", "Post Processing Plugin") - width: 700 * screenScaleFactor; - height: 500 * screenScaleFactor; - minimumWidth: 400 * screenScaleFactor; - minimumHeight: 250 * screenScaleFactor; + width: 700 * screenScaleFactor + height: 500 * screenScaleFactor + minimumWidth: 400 * screenScaleFactor + minimumHeight: 250 * screenScaleFactor 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() } @@ -36,234 +34,211 @@ UM.Dialog UM.I18nCatalog{id: catalog; name: "cura"} id: base property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width) - property int textMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) + property int textMargin: UM.Theme.getSize("narrow_margin").width property string activeScriptName - SystemPalette{ id: palette } - SystemPalette{ id: disabledPalette; colorGroup: SystemPalette.Disabled } + anchors.fill: parent - ExclusiveGroup + ButtonGroup { id: selectedScriptGroup } - Item + Column { id: activeScripts - anchors.left: parent.left width: base.columnWidth height: parent.height - Label + spacing: base.textMargin + + UM.Label { id: activeScriptsHeader text: catalog.i18nc("@label", "Post Processing Scripts") - anchors.top: parent.top - anchors.topMargin: base.textMargin anchors.left: parent.left - anchors.leftMargin: base.textMargin anchors.right: parent.right - anchors.rightMargin: base.textMargin font: UM.Theme.getFont("large_bold") elide: Text.ElideRight } ListView { id: activeScriptsList - anchors { - top: activeScriptsHeader.bottom left: parent.left right: parent.right rightMargin: base.textMargin - topMargin: base.textMargin - leftMargin: UM.Theme.getSize("default_margin").width } + height: Math.min(contentHeight, parent.height - parent.spacing * 2 - activeScriptsHeader.height - addButton.height) //At the window height, start scrolling this one. - height: childrenRect.height - model: manager.scriptList - delegate: Item + clip: true + ScrollBar.vertical: UM.ScrollBar { - width: parent.width - height: activeScriptButton.height - Button - { - id: activeScriptButton - text: manager.getScriptLabelByKey(modelData.toString()) - exclusiveGroup: selectedScriptGroup - width: parent.width - height: UM.Theme.getSize("setting").height - checkable: true + id: activeScriptsScrollBar + } + model: manager.scriptList - checked: + delegate: Button + { + id: activeScriptButton + + width: parent.width - activeScriptsScrollBar.width + height: UM.Theme.getSize("standard_list_lineheight").height + + ButtonGroup.group: selectedScriptGroup + checkable: true + + checked: + { + if (manager.selectedScriptIndex == index) { - if (manager.selectedScriptIndex == index) - { - base.activeScriptName = manager.getScriptLabelByKey(modelData.toString()) - return true - } - else - { - return false - } - } - onClicked: - { - forceActiveFocus() - manager.setSelectedScriptIndex(index) base.activeScriptName = manager.getScriptLabelByKey(modelData.toString()) + return true } - - style: ButtonStyle + else { - background: Rectangle - { - color: activeScriptButton.checked ? palette.highlight : "transparent" - width: parent.width - height: parent.height - } - label: Label - { - wrapMode: Text.Wrap - text: control.text - elide: Text.ElideRight - color: activeScriptButton.checked ? palette.highlightedText : palette.text - } + return false } } - Button + background: Rectangle { - id: removeButton - text: "x" - width: 20 * screenScaleFactor - height: 20 * screenScaleFactor - anchors.right:parent.right - anchors.rightMargin: base.textMargin - anchors.verticalCenter: parent.verticalCenter - onClicked: manager.removeScriptByIndex(index) - style: ButtonStyle - { - label: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(control.width / 2.7) - height: Math.round(control.height / 2.7) - sourceSize.height: width - color: palette.text - source: UM.Theme.getIcon("Cancel") - } - } - } + color: activeScriptButton.checked ? UM.Theme.getColor("background_3") : "transparent" } - Button + + onClicked: { - id: downButton - text: "" - anchors.right: removeButton.left - anchors.verticalCenter: parent.verticalCenter - enabled: index != manager.scriptList.length - 1 - width: 20 * screenScaleFactor - height: 20 * screenScaleFactor - onClicked: - { - if (manager.selectedScriptIndex == index) - { - manager.setSelectedScriptIndex(index + 1) - } - return manager.moveScript(index, index + 1) - } - style: ButtonStyle - { - label: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(control.width / 2.5) - height: Math.round(control.height / 2.5) - sourceSize.height: width - color: control.enabled ? palette.text : disabledPalette.text - source: UM.Theme.getIcon("ChevronSingleDown") - } - } - } + forceActiveFocus() + manager.setSelectedScriptIndex(index) + base.activeScriptName = manager.getScriptLabelByKey(modelData.toString()) } - Button + + RowLayout { - id: upButton - text: "" - enabled: index != 0 - width: 20 * screenScaleFactor - height: 20 * screenScaleFactor - anchors.right: downButton.left - anchors.verticalCenter: parent.verticalCenter - onClicked: + anchors.fill: parent + + UM.Label { - if (manager.selectedScriptIndex == index) - { - manager.setSelectedScriptIndex(index - 1) - } - return manager.moveScript(index, index - 1) + Layout.fillWidth: true + text: manager.getScriptLabelByKey(modelData.toString()) } - style: ButtonStyle + + Item { - label: Item - { - UM.RecolorImage + id: downButton + Layout.preferredWidth: height + Layout.fillHeight: true + enabled: index != manager.scriptList.length - 1 + + MouseArea + { + anchors.fill: parent + onClicked: { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(control.width / 2.5) - height: Math.round(control.height / 2.5) - sourceSize.height: width - color: control.enabled ? palette.text : disabledPalette.text - source: UM.Theme.getIcon("ChevronSingleUp") + if (manager.selectedScriptIndex == index) + { + manager.setSelectedScriptIndex(index + 1) + } + return manager.moveScript(index, index + 1) } } + + 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: parent.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled") + source: UM.Theme.getIcon("ChevronSingleDown") + } + } + Item + { + id: upButton + Layout.preferredWidth: height + Layout.fillHeight: true + enabled: index != 0 + + MouseArea + { + anchors.fill: parent + onClicked: + { + if (manager.selectedScriptIndex == index) + { + manager.setSelectedScriptIndex(index - 1) + } + return manager.moveScript(index, index - 1) + } + } + + 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: upButton.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled") + 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") + } } } } } - Button + Cura.SecondaryButton { id: addButton text: catalog.i18nc("@action", "Add a script") - anchors.left: parent.left - anchors.leftMargin: base.textMargin - anchors.top: activeScriptsList.bottom - anchors.topMargin: base.textMargin onClicked: scriptsMenu.open() - style: ButtonStyle - { - label: Label - { - text: control.text - } - } } - QQC2.Menu + } + + Cura.Menu + { + id: scriptsMenu + + Models.Instantiator { - id: scriptsMenu - width: parent.width + model: manager.loadedScriptList - Models.Instantiator + Cura.MenuItem { - model: manager.loadedScriptList - - QQC2.MenuItem - { - text: manager.getScriptLabelByKey(modelData.toString()) - onTriggered: manager.addScriptToList(modelData.toString()) - } - - onObjectAdded: scriptsMenu.insertItem(index, object) - onObjectRemoved: scriptsMenu.removeItem(object) + text: manager.getScriptLabelByKey(modelData.toString()) + onTriggered: manager.addScriptToList(modelData.toString()) } + + onObjectAdded: scriptsMenu.insertItem(index, object) + onObjectRemoved: scriptsMenu.removeItem(object) } } @@ -296,9 +271,9 @@ UM.Dialog color: UM.Theme.getColor("text") } - ScrollView + ListView { - id: scrollView + id: listview anchors { top: scriptSpecsHeader.bottom @@ -309,124 +284,114 @@ UM.Dialog bottom: parent.bottom } + ScrollBar.vertical: UM.ScrollBar {} + clip: true visible: manager.selectedScriptDefinitionId != "" - style: UM.Theme.styles.scrollview; + spacing: UM.Theme.getSize("default_lining").height - ListView + model: UM.SettingDefinitionsModel { - id: listview - spacing: UM.Theme.getSize("default_lining").height - model: UM.SettingDefinitionsModel + id: definitionsModel + containerId: manager.selectedScriptDefinitionId + showAll: true + } + + delegate: Loader + { + id: settingLoader + + width: listview.width + height: { - id: definitionsModel - containerId: manager.selectedScriptDefinitionId - showAll: true + if (provider.properties.enabled == "True" && model.type != undefined) + { + return UM.Theme.getSize("section").height; + } + else + { + return 0 + } + } + Behavior on height { NumberAnimation { duration: 100 } } + opacity: provider.properties.enabled == "True" ? 1 : 0 + + Behavior on opacity { NumberAnimation { duration: 100 } } + enabled: opacity > 0 + + property var definition: model + property var settingDefinitionsModel: definitionsModel + property var propertyProvider: provider + property var globalPropertyProvider: inheritStackProvider + + //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 + //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, + //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. + asynchronous: model.type != "enum" && model.type != "extruder" + + onLoaded: + { + settingLoader.item.showRevertButton = false + settingLoader.item.showInheritButton = false + settingLoader.item.showLinkedSettingIcon = false + settingLoader.item.doDepthIndentation = false + settingLoader.item.doQualityUserSettingEmphasis = false } - delegate: Loader + sourceComponent: { - id: settingLoader - - width: parent.width - height: + switch(model.type) { - if(provider.properties.enabled == "True") - { - if(model.type != undefined) - { - return UM.Theme.getSize("section").height - } - else - { - return 0 - } - } - else - { - return 0 - } + case "int": + return settingTextField + case "float": + return settingTextField + case "enum": + return settingComboBox + case "extruder": + return settingExtruder + case "bool": + return settingCheckBox + case "str": + return settingTextField + case "category": + return settingCategory + default: + return settingUnknown } - Behavior on height { NumberAnimation { duration: 100 } } - opacity: provider.properties.enabled == "True" ? 1 : 0 + } - Behavior on opacity { NumberAnimation { duration: 100 } } - enabled: opacity > 0 + UM.SettingPropertyProvider + { + id: provider + containerStackId: manager.selectedScriptStackId + key: model.key ? model.key : "None" + watchedProperties: [ "value", "enabled", "state", "validationState" ] + storeIndex: 0 + } - property var definition: model - property var settingDefinitionsModel: definitionsModel - property var propertyProvider: provider - property var globalPropertyProvider: inheritStackProvider + // Specialty provider that only watches global_inherits (we can't filter on what property changed we get events + // so we bypass that to make a dedicated provider). + UM.SettingPropertyProvider + { + id: inheritStackProvider + containerStack: Cura.MachineManager.activeMachine + key: model.key ? model.key : "None" + watchedProperties: [ "limit_to_extruder" ] + } - //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 - //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, - //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type != "enum" && model.type != "extruder" + Connections + { + target: item - onLoaded: + function onShowTooltip(text) { - settingLoader.item.showRevertButton = false - settingLoader.item.showInheritButton = false - settingLoader.item.showLinkedSettingIcon = false - settingLoader.item.doDepthIndentation = false - settingLoader.item.doQualityUserSettingEmphasis = false + tooltip.text = text; + var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0); + tooltip.show(position); + tooltip.target.x = position.x + 1; } - sourceComponent: - { - switch(model.type) - { - case "int": - return settingTextField - case "float": - return settingTextField - case "enum": - return settingComboBox - case "extruder": - return settingExtruder - case "bool": - return settingCheckBox - case "str": - return settingTextField - case "category": - return settingCategory - default: - return settingUnknown - } - } - - UM.SettingPropertyProvider - { - id: provider - containerStackId: manager.selectedScriptStackId - key: model.key ? model.key : "None" - watchedProperties: [ "value", "enabled", "state", "validationState" ] - storeIndex: 0 - } - - // Specialty provider that only watches global_inherits (we can't filter on what property changed we get events - // so we bypass that to make a dedicated provider). - UM.SettingPropertyProvider - { - id: inheritStackProvider - containerStack: Cura.MachineManager.activeMachine - key: model.key ? model.key : "None" - watchedProperties: [ "limit_to_extruder" ] - } - - Connections - { - target: item - - function onShowTooltip(text) - { - tooltip.text = text - var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0) - tooltip.show(position) - tooltip.target.x = position.x + 1 - } - - function onHideTooltip() { tooltip.hide() } - } + function onHideTooltip() { tooltip.hide() } } } } @@ -480,10 +445,9 @@ UM.Dialog } } - rightButtons: Button + rightButtons: Cura.TertiaryButton { text: catalog.i18nc("@action:button", "Close") - iconName: "dialog-close" onClicked: dialog.accept() } diff --git a/plugins/PrepareStage/PrepareMain.qml b/plugins/PrepareStage/PrepareMain.qml index ab3cf0e07c..1347be674d 100644 --- a/plugins/PrepareStage/PrepareMain.qml +++ b/plugins/PrepareStage/PrepareMain.qml @@ -1,10 +1,7 @@ -//Copyright (c) 2020 Ultimaker B.V. +//Copyright (c) 2021 Ultimaker B.V. //Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.4 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import Cura 1.0 as Cura diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index cf7665bda6..f0779df98f 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -5,7 +5,7 @@ import QtQuick 2.9 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -131,14 +131,10 @@ Item height: UM.Theme.getSize("action_button").height hoverEnabled: true - contentItem: Label + contentItem: UM.Label { text: model.displayText - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter - width: contentWidth height: parent.height } diff --git a/plugins/PreviewStage/PreviewMain.qml b/plugins/PreviewStage/PreviewMain.qml index 2926f0d012..25e53318dc 100644 --- a/plugins/PreviewStage/PreviewMain.qml +++ b/plugins/PreviewStage/PreviewMain.qml @@ -1,11 +1,7 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.4 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 - import UM 1.0 as UM import Cura 1.0 as Cura diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index d2a22755ae..0a24ca9023 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -1,10 +1,8 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import Cura 1.0 as Cura diff --git a/plugins/SimulationView/PathSlider.qml b/plugins/SimulationView/PathSlider.qml index facdbb6a53..70e5acc4f1 100644 --- a/plugins/SimulationView/PathSlider.qml +++ b/plugins/SimulationView/PathSlider.qml @@ -1,10 +1,8 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import Cura 1.0 as Cura diff --git a/plugins/SimulationView/SimulationSliderLabel.qml b/plugins/SimulationView/SimulationSliderLabel.qml index afd02069eb..1c434ae935 100644 --- a/plugins/SimulationView/SimulationSliderLabel.qml +++ b/plugins/SimulationView/SimulationSliderLabel.qml @@ -1,14 +1,15 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.5 -import QtQuick.Controls 1.2 +import QtQuick.Controls 2.2 import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import Cura 1.0 as Cura -UM.PointingRectangle { +UM.PointingRectangle +{ id: sliderLabelRoot // custom properties @@ -28,47 +29,41 @@ UM.PointingRectangle { borderColor: UM.Theme.getColor("lining") borderWidth: UM.Theme.getSize("default_lining").width - Behavior on height { - NumberAnimation { - duration: 50 - } - } + Behavior on height { NumberAnimation { duration: 50 } } // catch all mouse events so they're not handled by underlying 3D scene - MouseArea { + MouseArea + { anchors.fill: parent } - TextMetrics { + TextMetrics + { id: maxValueMetrics font: valueLabel.font text: maximumValue + 1 // layers are 0 based, add 1 for display value - } - TextField { + TextField + { id: valueLabel - anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter - alignWhenCentered: false - } + anchors.centerIn: parent - width: maxValueMetrics.width + UM.Theme.getSize("default_margin").width + //width: maxValueMetrics.contentWidth + 2 * UM.Theme.getSize("default_margin").width text: sliderLabelRoot.value + startFrom // the current handle value, add 1 because layers is an array horizontalAlignment: TextInput.AlignHCenter + leftPadding: UM.Theme.getSize("narrow_margin").width + rightPadding: UM.Theme.getSize("narrow_margin").width // key bindings, work when label is currently focused (active handle in LayerSlider) Keys.onUpPressed: sliderLabelRoot.setValue(sliderLabelRoot.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1)) Keys.onDownPressed: sliderLabelRoot.setValue(sliderLabelRoot.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1)) - - style: TextFieldStyle { - textColor: UM.Theme.getColor("text") - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - background: Item { } - } + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("default") + renderType: Text.NativeRendering + background: Item {} + selectByMouse: true onEditingFinished: { @@ -84,16 +79,18 @@ UM.PointingRectangle { } } - validator: IntValidator { + validator: IntValidator + { bottom: startFrom top: sliderLabelRoot.maximumValue + startFrom // +startFrom because maybe we want to start in a different value rather than 0 } } - - BusyIndicator { + BusyIndicator + { id: busyIndicator - anchors { + anchors + { left: parent.right leftMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) verticalCenter: parent.verticalCenter diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index af60692273..4fb238f6da 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -2,9 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.4 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM import Cura 1.0 as Cura diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index 6dde44c8ae..ba13a75ea7 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -1,13 +1,12 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.4 -import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.1 import QtGraphicalEffects 1.0 -import UM 1.0 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -43,22 +42,19 @@ Cura.ExpandableComponent headerItem: Item { - Label + UM.Label { id: colorSchemeLabel text: catalog.i18nc("@label", "Color scheme") - verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text_medium") - renderType: Text.NativeRendering } - Label + UM.Label { text: layerTypeCombobox.currentText - verticalAlignment: Text.AlignVCenter anchors { left: colorSchemeLabel.right @@ -68,8 +64,6 @@ Cura.ExpandableComponent height: parent.height elide: Text.ElideRight font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } } @@ -99,7 +93,8 @@ Cura.ExpandableComponent spacing: UM.Theme.getSize("layerview_row_spacing").height - ListModel // matches SimulationView.py + // matches SimulationView.py + ListModel { id: layerViewTypes } @@ -132,18 +127,17 @@ Cura.ExpandableComponent }) } - ComboBox + Cura.ComboBox { id: layerTypeCombobox + textRole: "text" + valueRole: "type_id" width: parent.width + implicitHeight: UM.Theme.getSize("setting_control").height model: layerViewTypes visible: !UM.SimulationView.compatibilityMode - style: UM.Theme.styles.combobox - onActivated: - { - UM.Preferences.setValue("layerview/layer_view_type", index); - } + onActivated: UM.Preferences.setValue("layerview/layer_view_type", index) Component.onCompleted: { @@ -165,16 +159,13 @@ Cura.ExpandableComponent } } - Label + UM.Label { id: compatibilityModeLabel text: catalog.i18nc("@label", "Compatibility Mode") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") visible: UM.SimulationView.compatibilityMode height: UM.Theme.getSize("layerview_row").height width: parent.width - renderType: Text.NativeRendering } Item // Spacer @@ -187,7 +178,7 @@ Cura.ExpandableComponent { model: CuraApplication.getExtrudersModel() - CheckBox + UM.CheckBox { id: extrudersModelCheckBox checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == "" @@ -201,8 +192,6 @@ Cura.ExpandableComponent UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|")); } - style: UM.Theme.styles.checkbox - Rectangle { id: swatch @@ -215,12 +204,11 @@ Cura.ExpandableComponent border.color: UM.Theme.getColor("lining") } - Label + UM.Label { text: model.name elide: Text.ElideRight color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") anchors { verticalCenter: parent.verticalCenter @@ -229,7 +217,6 @@ Cura.ExpandableComponent leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2) rightMargin: UM.Theme.getSize("default_margin").width * 2 } - renderType: Text.NativeRendering } } } @@ -277,7 +264,7 @@ Cura.ExpandableComponent } } - CheckBox + UM.CheckBox { id: legendModelCheckBox checked: model.initialValue @@ -285,8 +272,6 @@ Cura.ExpandableComponent height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height width: parent.width - style: UM.Theme.styles.checkbox - Rectangle { anchors.verticalCenter: parent.verticalCenter @@ -299,7 +284,7 @@ Cura.ExpandableComponent visible: viewSettings.show_legend } - Label + UM.Label { text: label font: UM.Theme.getFont("default") @@ -315,24 +300,22 @@ Cura.ExpandableComponent } } - CheckBox + UM.CheckBox { checked: viewSettings.only_show_top_layers onClicked: UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0) text: catalog.i18nc("@label", "Only Show Top Layers") visible: UM.SimulationView.compatibilityMode - style: UM.Theme.styles.checkbox width: parent.width } - CheckBox + UM.CheckBox { checked: viewSettings.top_layer_count == 5 onClicked: UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1) text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top") width: parent.width visible: UM.SimulationView.compatibilityMode - style: UM.Theme.styles.checkbox } Repeater @@ -353,7 +336,7 @@ Cura.ExpandableComponent } } - Label + UM.Label { text: label visible: viewSettings.show_legend @@ -362,8 +345,6 @@ Cura.ExpandableComponent height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height width: parent.width color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering Rectangle { anchors.verticalCenter: parent.verticalCenter @@ -388,7 +369,7 @@ Cura.ExpandableComponent width: parent.width height: UM.Theme.getSize("layerview_row").height - Label //Minimum value. + UM.Label //Minimum value. { text: { @@ -419,12 +400,9 @@ Cura.ExpandableComponent return catalog.i18nc("@label","min") } anchors.left: parent.left - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering } - Label //Unit in the middle. + UM.Label //Unit in the middle. { text: { @@ -456,10 +434,9 @@ Cura.ExpandableComponent anchors.horizontalCenter: parent.horizontalCenter color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") } - Label //Maximum value. + UM.Label //Maximum value. { text: { if (UM.SimulationView.layerActivity && CuraApplication.platformActivity) @@ -490,7 +467,6 @@ Cura.ExpandableComponent anchors.right: parent.right color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml index fde4a5ea3d..4458b48996 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml @@ -3,7 +3,6 @@ import QtQuick 2.3 import QtQuick.Controls 2.4 -import QtQuick.Controls.Styles 1.3 import UM 1.3 as UM import Cura 1.0 as Cura @@ -19,7 +18,7 @@ Button { anchors.fill: parent radius: 0.5 * width - color: parent.enabled ? (parent.hovered ? UM.Theme.getColor("monitor_secondary_button_hover") : "transparent") : UM.Theme.getColor("monitor_icon_disabled") + color: parent.enabled ? (parent.hovered ? UM.Theme.getColor("monitor_card_hover") : "transparent") : UM.Theme.getColor("monitor_icon_disabled") } UM.RecolorImage diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 2843e32da4..e68f552f7b 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -1,14 +1,13 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.5 as Cura import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.9 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 -import QtQuick.Dialogs 1.2 Cura.MachineAction { @@ -36,32 +35,27 @@ Cura.MachineAction id: discoverUM3Action spacing: UM.Theme.getSize("default_margin").height - SystemPalette { id: palette } UM.I18nCatalog { id: catalog; name:"cura" } - Label + + UM.Label { id: pageTitle width: parent.width text: catalog.i18nc("@title:window", "Connect to Networked Printer") - wrapMode: Text.WordWrap - renderType: Text.NativeRendering - font.pointSize: 18 } - Label + UM.Label { id: pageDescription width: parent.width - wrapMode: Text.WordWrap - renderType: Text.NativeRendering text: catalog.i18nc("@label", "To print directly to your printer over the network, please make sure your printer is connected to the network using a network cable or by connecting your printer to your WIFI network. If you don't connect Cura with your printer, you can still use a USB drive to transfer g-code files to your printer.") + "\n\n" + catalog.i18nc("@label", "Select your printer from the list below:") } Row { - spacing: UM.Theme.getSize("default_lining").width + spacing: UM.Theme.getSize("thin_margin").width - Button + Cura.SecondaryButton { id: addButton text: catalog.i18nc("@action:button", "Add"); @@ -71,7 +65,7 @@ Cura.MachineAction } } - Button + Cura.SecondaryButton { id: editButton text: catalog.i18nc("@action:button", "Edit") @@ -82,7 +76,7 @@ Cura.MachineAction } } - Button + Cura.SecondaryButton { id: removeButton text: catalog.i18nc("@action:button", "Remove") @@ -90,7 +84,7 @@ Cura.MachineAction onClicked: manager.removeManualDevice(base.selectedDevice.key, base.selectedDevice.ipAddress) } - Button + Cura.SecondaryButton { id: rediscoverButton text: catalog.i18nc("@action:button", "Refresh") @@ -109,70 +103,61 @@ Cura.MachineAction width: Math.round(parent.width * 0.5) spacing: UM.Theme.getSize("default_margin").height - ScrollView + ListView { - id: objectListContainer - frameVisible: true + id: listview + width: parent.width height: base.height - contentRow.y - discoveryTip.height - Rectangle + ScrollBar.vertical: UM.ScrollBar {} + clip: true + + model: manager.foundDevices + currentIndex: -1 + onCurrentIndexChanged: { - parent: viewport - anchors.fill: parent - color: palette.light + base.selectedDevice = listview.model[currentIndex]; + // Only allow connecting if the printer has responded to API query since the last refresh + base.completeProperties = base.selectedDevice != null && base.selectedDevice.getProperty("incomplete") != "true"; } + Component.onCompleted: manager.startDiscovery() - ListView + delegate: UM.Label { - id: listview - model: manager.foundDevices - width: parent.width - currentIndex: -1 - onCurrentIndexChanged: - { - base.selectedDevice = listview.model[currentIndex]; - // Only allow connecting if the printer has responded to API query since the last refresh - base.completeProperties = base.selectedDevice != null && base.selectedDevice.getProperty("incomplete") != "true"; - } - Component.onCompleted: manager.startDiscovery() - delegate: Rectangle - { - height: childrenRect.height - color: ListView.isCurrentItem ? palette.highlight : index % 2 ? palette.base : palette.alternateBase - width: parent.width - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - text: listview.model[index].name - color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text - elide: Text.ElideRight - renderType: Text.NativeRendering - } + id: printNameLabel + width: listview.width + height: contentHeight + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width - MouseArea + anchors.right: parent.right + text: listview.model[index].name + elide: Text.ElideRight + + MouseArea + { + anchors.fill: parent; + onClicked: { - anchors.fill: parent; - onClicked: + if(!parent.ListView.isCurrentItem) { - if(!parent.ListView.isCurrentItem) - { - parent.ListView.view.currentIndex = index; - } + parent.ListView.view.currentIndex = index; } } } + + background: Rectangle + { + color: parent.ListView.isCurrentItem ? UM.Theme.getColor("background_3") : "transparent" + } } } - Label + UM.Label { id: discoveryTip anchors.left: parent.left anchors.right: parent.right - wrapMode: Text.WordWrap - renderType: Text.NativeRendering text: catalog.i18nc("@label", "If your printer is not listed, read the network printing troubleshooting guide").arg("https://ultimaker.com/en/cura/troubleshooting/network?utm_source=cura&utm_medium=software&utm_campaign=manage-network-printer"); onLinkActivated: Qt.openUrlExternally(link) } @@ -183,32 +168,26 @@ Cura.MachineAction width: Math.round(parent.width * 0.5) visible: base.selectedDevice ? true : false spacing: UM.Theme.getSize("default_margin").height - Label + UM.Label { width: parent.width - wrapMode: Text.WordWrap text: base.selectedDevice ? base.selectedDevice.name : "" font: UM.Theme.getFont("large_bold") elide: Text.ElideRight - renderType: Text.NativeRendering } - Grid + GridLayout { visible: base.completeProperties width: parent.width columns: 2 - Label + UM.Label { - width: Math.round(parent.width * 0.5) - wrapMode: Text.WordWrap - renderType: Text.NativeRendering + Layout.fillWidth: true text: catalog.i18nc("@label", "Type") } - Label + UM.Label { - width: Math.round(parent.width * 0.5) - wrapMode: Text.WordWrap - renderType: Text.NativeRendering + Layout.fillWidth: true text: { if (base.selectedDevice) { @@ -217,41 +196,31 @@ Cura.MachineAction return "" } } - Label + UM.Label { - width: Math.round(parent.width * 0.5) - wrapMode: Text.WordWrap - renderType: Text.NativeRendering + Layout.fillWidth: true text: catalog.i18nc("@label", "Firmware version") } - Label + UM.Label { - width: Math.round(parent.width * 0.5) - wrapMode: Text.WordWrap - renderType: Text.NativeRendering + Layout.fillWidth: true text: base.selectedDevice ? base.selectedDevice.firmwareVersion : "" } - Label + UM.Label { - width: Math.round(parent.width * 0.5) - wrapMode: Text.WordWrap - renderType: Text.NativeRendering + Layout.fillWidth: true text: catalog.i18nc("@label", "Address") } - Label + UM.Label { - width: Math.round(parent.width * 0.5) - wrapMode: Text.WordWrap - renderType: Text.NativeRendering + Layout.fillWidth: true text: base.selectedDevice ? base.selectedDevice.ipAddress : "" } } - Label + UM.Label { width: parent.width - wrapMode: Text.WordWrap - renderType: Text.NativeRendering text:{ // The property cluster size does not exist for older UM3 devices. if(!base.selectedDevice || base.selectedDevice.clusterSize == null || base.selectedDevice.clusterSize == 1) @@ -269,16 +238,14 @@ Cura.MachineAction } } - Label + UM.Label { width: parent.width - wrapMode: Text.WordWrap - renderType: Text.NativeRendering visible: base.selectedDevice != null && !base.completeProperties text: catalog.i18nc("@label", "The printer at this address has not yet responded." ) } - Button + Cura.SecondaryButton { text: catalog.i18nc("@action:button", "Connect") enabled: (base.selectedDevice && base.completeProperties && base.selectedDevice.clusterSize > 0) ? true : false @@ -288,18 +255,15 @@ Cura.MachineAction } } - MessageDialog + Cura.MessageDialog { id: invalidIPAddressMessageDialog - x: parent ? (parent.x + (parent.width) / 2) : 0 - y: parent ? (parent.y + (parent.height) / 2) : 0 title: catalog.i18nc("@title:window", "Invalid IP address") text: catalog.i18nc("@text", "Please enter a valid IP address.") - icon: StandardIcon.Warning - standardButtons: StandardButton.Ok + standardButtons: Dialog.Ok } - UM.Dialog + Cura.MessageDialog { id: manualPrinterDialog property string printerKey @@ -307,17 +271,19 @@ Cura.MachineAction title: catalog.i18nc("@title:window", "Printer Address") - minimumWidth: 400 * screenScaleFactor - minimumHeight: 130 * screenScaleFactor - width: minimumWidth - height: minimumHeight + width: UM.Theme.getSize("small_popup_dialog").width + height: UM.Theme.getSize("small_popup_dialog").height + + anchors.centerIn: Overlay.overlay + + standardButtons: Dialog.Yes | Dialog.No signal showDialog(string key, string address) onShowDialog: { printerKey = key; addressText = address; - manualPrinterDialog.show(); + manualPrinterDialog.open(); addressField.selectAll(); addressField.focus = true; } @@ -326,67 +292,45 @@ Cura.MachineAction anchors.fill: parent spacing: UM.Theme.getSize("default_margin").height - Label + UM.Label { text: catalog.i18nc("@label", "Enter the IP address of your printer on the network.") - width: parent.width - wrapMode: Text.WordWrap renderType: Text.NativeRendering } - TextField + Cura.TextField { id: addressField width: parent.width - validator: RegExpValidator - { - regExp: /[a-zA-Z0-9\.\-\_]*/ - } - - onAccepted: btnOk.clicked() + validator: RegExpValidator { regExp: /[a-zA-Z0-9\.\-\_]*/ } } } - rightButtons: [ - Button { - text: catalog.i18nc("@action:button","Cancel") - onClicked: - { - manualPrinterDialog.reject() - manualPrinterDialog.hide() - } - }, - Button { - id: btnOk - text: catalog.i18nc("@action:button", "OK") - onClicked: - { - // Validate the input first - if (!networkingUtil.isValidIP(manualPrinterDialog.addressText)) - { - invalidIPAddressMessageDialog.open() - return - } - - // if the entered IP address has already been discovered, switch the current item to that item - // and do nothing else. - for (var i = 0; i < manager.foundDevices.length; i++) - { - var device = manager.foundDevices[i] - if (device.address == manualPrinterDialog.addressText) - { - currentItemIndex = i - manualPrinterDialog.hide() - return - } - } - - manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) - manualPrinterDialog.hide() - } - enabled: manualPrinterDialog.addressText.trim() != "" - isDefault: true + onAccepted: + { + // Validate the input first + if (!networkingUtil.isValidIP(manualPrinterDialog.addressText)) + { + // prefent closing of element, as we want to keep the dialog active after a wrongly entered IP adress + manualPrinterDialog.open() + // show invalid ip warning + invalidIPAddressMessageDialog.open(); + return; } - ] + + // if the entered IP address has already been discovered, switch the current item to that item + // and do nothing else. + for (var i = 0; i < manager.foundDevices.length; i++) + { + var device = manager.foundDevices[i] + if (device.address == manualPrinterDialog.addressText) + { + currentItemIndex = i; + return; + } + } + + manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText); + } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml index 61981dab2c..580338ae0c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -3,8 +3,6 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Dialogs 1.1 import QtGraphicalEffects 1.0 import UM 1.3 as UM diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml index 598d0ec70a..60e3726a32 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml @@ -3,7 +3,7 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 -import UM 1.3 as UM +import UM 1.5 as UM /** * This component comprises a buildplate icon and the buildplate name. It is @@ -57,19 +57,15 @@ Item } } - Label + UM.Label { id: buildplateLabel - color: UM.Theme.getColor("text") elide: Text.ElideRight - font: UM.Theme.getFont("default") // 12pt, regular text: buildplate ? buildplate : "" visible: text !== "" // FIXED-LINE-HEIGHT: height: 18 * screenScaleFactor // TODO: Theme! - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index 1fe766d9f7..343e3f79e1 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -2,10 +2,9 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.3 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 -import UM 1.3 as UM +import UM 1.5 as UM UM.Dialog { @@ -63,7 +62,7 @@ UM.Dialog } ] - Label + UM.Label { anchors { @@ -72,7 +71,6 @@ UM.Dialog bottomMargin: 56 * screenScaleFactor // TODO: Theme! } wrapMode: Text.WordWrap - renderType: Text.NativeRendering text: { if (!printer || !printer.activePrintJob) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml index 34ca3c6df2..03e9477d08 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.3 -import QtQuick.Controls 2.0 -import QtQuick.Dialogs 1.1 -import UM 1.3 as UM +import QtQuick.Controls 2.15 +import UM 1.5 as UM +import Cura 1.6 as Cura /** * A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context @@ -134,32 +134,29 @@ Item } } - MessageDialog { + Cura.MessageDialog + { id: sendToTopConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: OutputDevice.sendJobToTop(printJob.key) - standardButtons: StandardButton.Yes | StandardButton.No + onAccepted: OutputDevice.sendJobToTop(printJob.key) + standardButtons: Dialog.Yes | Dialog.No text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "" title: catalog.i18nc("@window:title", "Move print job to top") } - MessageDialog { + Cura.MessageDialog + { id: deleteConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: OutputDevice.deleteJobFromQueue(printJob.key) - standardButtons: StandardButton.Yes | StandardButton.No + onAccepted: OutputDevice.deleteJobFromQueue(printJob.key) + standardButtons: Dialog.Yes | Dialog.No text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "" title: catalog.i18nc("@window:title", "Delete print job") } - MessageDialog { + Cura.MessageDialog + { id: abortConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: printJob.setState("abort") - standardButtons: StandardButton.Yes | StandardButton.No + onAccepted: printJob.setState("abort") + standardButtons: Dialog.Yes | Dialog.No text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "" title: catalog.i18nc("@window:title", "Abort print") } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml index 0be3732cef..1c6cfda121 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml @@ -3,7 +3,7 @@ import QtQuick 2.3 import QtQuick.Controls 2.0 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Button @@ -17,13 +17,12 @@ Button radius: Math.round(0.5 * width) width: base.width } - contentItem: Label { + contentItem: UM.Label + { color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled") font.pixelSize: 32 * screenScaleFactor horizontalAlignment: Text.AlignHCenter text: base.text - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering; } height: width hoverEnabled: enabled diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml index ad0e8a6777..f22ac53298 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml @@ -3,7 +3,7 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 -import UM 1.3 as UM +import UM 1.5 as UM /** * This component is a sort of "super icon" which includes a colored SVG image @@ -35,18 +35,16 @@ Item width: size } - Label + UM.Label { id: positionLabel anchors.centerIn: icon font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text") height: Math.round(size / 2) horizontalAlignment: Text.AlignHCenter text: position + 1 - verticalAlignment: Text.AlignVCenter + width: Math.round(size / 2) visible: position >= 0 - renderType: Text.NativeRendering } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index 65bf4e3a07..2974e5ce6b 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -2,7 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 import QtQuick.Controls 2.0 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.0 as Cura /** @@ -55,10 +55,9 @@ Item visible: !printJob radius: 2 * screenScaleFactor // TODO: Theme! } - Label + UM.Label { text: printJob && printJob.name ? printJob.name : "" - color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob @@ -66,8 +65,6 @@ Item // FIXED-LINE-HEIGHT: width: parent.width height: parent.height - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } @@ -86,18 +83,15 @@ Item radius: 2 * screenScaleFactor // TODO: Theme! } - Label + UM.Label { text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : "" - color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob // FIXED-LINE-HEIGHT: height: Math.round(18 * screenScaleFactor) // TODO: Theme! - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } @@ -116,11 +110,10 @@ Item radius: 2 * screenScaleFactor // TODO: Theme! } - Label + UM.Label { id: printerAssignmentLabel anchors.verticalCenter: parent.verticalCenter - color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular text: { @@ -143,8 +136,6 @@ Item // FIXED-LINE-HEIGHT: height: parent.height - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } Row @@ -186,17 +177,15 @@ Item height: Math.round(72 * screenScaleFactor) // TODO: Theme! } - Label { + UM.Label + { text: printJob && printJob.owner ? printJob.owner : "" - color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.top: printerConfiguration.top // FIXED-LINE-HEIGHT: height: Math.round(18 * screenScaleFactor) // TODO: Theme! - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index 23bcc589b1..65c37ffe16 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -2,9 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.3 -import QtQuick.Controls.Styles 1.3 -import QtQuick.Controls 1.4 -import UM 1.3 as UM +import UM 1.5 as UM /** * NOTE: For most labels, a fixed height with vertical alignment is used to make @@ -20,7 +18,7 @@ Item property var printJob: null width: childrenRect.width - height: UM.Theme.getSize("monitor_text_line").height + height: percentLabel.height UM.ProgressBar { @@ -34,36 +32,28 @@ Item width: UM.Theme.getSize("monitor_progress_bar").width } - Label + UM.Label { id: percentLabel anchors { left: progressBar.right - leftMargin: UM.Theme.getSize("monitor_margin").width - verticalCenter: parent.verticalCenter + leftMargin: UM.Theme.getSize("default_margin").width } text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%" color: printJob && printJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled") width: contentWidth - font: UM.Theme.getFont("default") // 12pt, regular - - // FIXED-LINE-HEIGHT: - height: UM.Theme.getSize("monitor_text_line").height - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering + wrapMode: Text.NoWrap } - Label + UM.Label { id: statusLabel anchors { left: percentLabel.right - leftMargin: UM.Theme.getSize("monitor_margin").width - verticalCenter: parent.verticalCenter + leftMargin: UM.Theme.getSize("default_margin").width } - color: UM.Theme.getColor("text") - font: UM.Theme.getFont("default") + wrapMode: Text.NoWrap text: { if (!printJob) @@ -117,10 +107,5 @@ Item } } width: contentWidth - - // FIXED-LINE-HEIGHT: - height: UM.Theme.getSize("monitor_text_line").height - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 5a4556f1f7..df701b1d1f 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -3,8 +3,7 @@ import QtQuick 2.3 import QtQuick.Controls 2.0 -import QtQuick.Dialogs 1.1 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.0 as Cura /** @@ -64,7 +63,7 @@ Item leftMargin: 36 * screenScaleFactor // TODO: Theme! verticalCenter: parent.verticalCenter } - spacing: 18 * screenScaleFactor // TODO: Theme! + spacing: UM.Theme.getSize("default_margin").width Rectangle { @@ -96,23 +95,18 @@ Item { id: printerNameLabel color: printer ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") - height: 18 * screenScaleFactor // TODO: Theme! + height: UM.Theme.getSize("default_margin").width width: parent.width - radius: 2 * screenScaleFactor // TODO: Theme! + radius: UM.Theme.getSize("default_radius").width - Label + UM.Label { text: printer && printer.name ? printer.name : "" - color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("large") // 16pt, bold width: parent.width visible: printer - - // FIXED-LINE-HEIGHT: height: parent.height - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } @@ -120,7 +114,7 @@ Item { color: UM.Theme.getColor("monitor_skeleton_loading") height: 18 * screenScaleFactor // TODO: Theme! - radius: 2 * screenScaleFactor // TODO: Theme! + radius: UM.Theme.getSize("default_radius").width visible: !printer width: 48 * screenScaleFactor // TODO: Theme! } @@ -138,21 +132,20 @@ Item Item { id: managePrinterLink - anchors { + anchors + { top: printerFamilyPill.bottom topMargin: UM.Theme.getSize("narrow_margin").height } height: 18 * screenScaleFactor // TODO: Theme! width: childrenRect.width - Label + UM.Label { id: managePrinterText anchors.verticalCenter: managePrinterLink.verticalCenter color: UM.Theme.getColor("text_link") - font: UM.Theme.getFont("default") text: catalog.i18nc("@label link to Connect and Cloud interfaces", "Manage printer") - renderType: Text.NativeRendering } UM.RecolorImage { @@ -165,22 +158,16 @@ Item } color: UM.Theme.getColor("text_link") source: UM.Theme.getIcon("LinkExternal") - width: 12 * screenScaleFactor - height: 12 * screenScaleFactor + width: UM.Theme.getSize("icon").width + height: UM.Theme.getSize("icon").height } } MouseArea { anchors.fill: managePrinterLink onClicked: OutputDevice.openPrinterControlPanel() - onEntered: - { - manageQueueText.font.underline = true - } - onExited: - { - manageQueueText.font.underline = false - } + onEntered: manageQueueText.font.underline = true + onExited: manageQueueText.font.underline = false } } @@ -332,9 +319,9 @@ Item leftMargin: 36 * screenScaleFactor // TODO: Theme! } height: childrenRect.height - spacing: 18 * screenScaleFactor // TODO: Theme! + spacing: UM.Theme.getSize("default_margin").width - Label + UM.Label { id: printerStatus anchors @@ -371,7 +358,6 @@ Item return "" } visible: text !== "" - renderType: Text.NativeRendering } Item @@ -401,22 +387,18 @@ Item height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme! visible: printer && printer.activePrintJob && !printerStatus.visible - Label + UM.Label { id: printerJobNameLabel color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled") elide: Text.ElideRight + wrapMode: Text.NoWrap font: UM.Theme.getFont("large") // 16pt, bold text: printer && printer.activePrintJob ? printer.activePrintJob.name : catalog.i18nc("@label", "Untitled") width: parent.width - - // FIXED-LINE-HEIGHT: - height: 18 * screenScaleFactor // TODO: Theme! - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } - Label + UM.Label { id: printerJobOwnerLabel anchors @@ -427,14 +409,8 @@ Item } color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled") elide: Text.ElideRight - font: UM.Theme.getFont("default") // 12pt, regular text: printer && printer.activePrintJob ? printer.activePrintJob.owner : catalog.i18nc("@label", "Anonymous") width: parent.width - - // FIXED-LINE-HEIGHT: - height: 18 * screenScaleFactor // TODO: Theme! - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } @@ -448,59 +424,27 @@ Item visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length === 0 && !printerStatus.visible } - Label + UM.Label { anchors { verticalCenter: parent.verticalCenter } - font: UM.Theme.getFont("default") text: catalog.i18nc("@label:status", "Requires configuration changes") visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible - color: UM.Theme.getColor("text") - - // FIXED-LINE-HEIGHT: - height: 18 * screenScaleFactor // TODO: Theme! - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } - Button + Cura.SecondaryButton { id: detailsButton anchors { verticalCenter: parent.verticalCenter right: parent.right - rightMargin: 18 * screenScaleFactor // TODO: Theme! + rightMargin: UM.Theme.getSize("default_margin").width } - background: Rectangle - { - color: UM.Theme.getColor("monitor_secondary_button_shadow") - radius: 2 * screenScaleFactor // Todo: Theme! - Rectangle - { - anchors.fill: parent - anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme! - color: detailsButton.hovered ? UM.Theme.getColor("monitor_secondary_button_hover") : UM.Theme.getColor("monitor_secondary_button") - radius: 2 * screenScaleFactor // Todo: Theme! - } - } - contentItem: Label - { - anchors.fill: parent - anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme! - color: UM.Theme.getColor("monitor_secondary_button_text") - font: UM.Theme.getFont("medium") // 14pt, regular - text: catalog.i18nc("@action:button", "Details"); - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - height: 18 * screenScaleFactor // TODO: Theme! - renderType: Text.NativeRendering - } - implicitHeight: 32 * screenScaleFactor // TODO: Theme! - implicitWidth: 96 * screenScaleFactor // TODO: Theme! + text: catalog.i18nc("@action:button", "Details") visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible onClicked: base.enabled ? overrideConfirmationDialog.open() : {} enabled: OutputDevice.supportsPrintJobActions diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml index 4cd9d58cae..d2c9251bec 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml @@ -2,8 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.4 -import UM 1.2 as UM +import UM 1.5 as UM /** * A MonitorPrinterPill is a blue-colored tag indicating which printers a print @@ -17,20 +16,19 @@ Item implicitHeight: 18 * screenScaleFactor // TODO: Theme! implicitWidth: Math.max(printerNameLabel.contentWidth + 12 * screenScaleFactor, 36 * screenScaleFactor) // TODO: Theme! - Rectangle { + Rectangle + { id: background anchors.fill: parent color: printerNameLabel.visible ? UM.Theme.getColor("monitor_printer_family_tag") : UM.Theme.getColor("monitor_skeleton_loading") radius: 2 * screenScaleFactor // TODO: Theme! } - Label { + UM.Label + { id: printerNameLabel anchors.centerIn: parent - color: UM.Theme.getColor("text") text: monitorPrinterPill.text - font.pointSize: 10 // TODO: Theme! visible: monitorPrinterPill.text !== "" - renderType: Text.NativeRendering } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml index 1b94625bf0..87b7cab83e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml @@ -1,10 +1,9 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import UM 1.3 as UM +import QtQuick.Controls 2.15 +import UM 1.5 as UM import Cura 1.0 as Cura /** @@ -18,18 +17,16 @@ Item // they might not need to though. property bool cloudConnection: Cura.MachineManager.activeMachineIsUsingCloudConnection - Label + UM.Label { id: queuedLabel anchors { - left: queuedPrintJobs.left + left: printJobList.left top: parent.top } - color: UM.Theme.getColor("text") font: UM.Theme.getFont("large") text: catalog.i18nc("@label", "Queued") - renderType: Text.NativeRendering } Item @@ -37,7 +34,7 @@ Item id: manageQueueLabel anchors { - right: queuedPrintJobs.right + right: printJobList.right verticalCenter: queuedLabel.verticalCenter } height: 18 * screenScaleFactor // TODO: Theme! @@ -52,7 +49,7 @@ Item width: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!) height: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!) } - Label + UM.Label { id: manageQueueText anchors @@ -64,7 +61,6 @@ Item color: UM.Theme.getColor("text_link") font: UM.Theme.getFont("medium") // 14pt, regular text: catalog.i18nc("@label link to connect manager", "Manage in browser") - renderType: Text.NativeRendering } } @@ -72,14 +68,9 @@ Item { anchors.fill: manageQueueLabel onClicked: OutputDevice.openPrintJobControlPanel() - onEntered: - { - manageQueueText.font.underline = true - } - onExited: - { - manageQueueText.font.underline = false - } + onEntered: manageQueueText.font.underline = true + + onExited: manageQueueText.font.underline = false } Row @@ -87,96 +78,85 @@ Item id: printJobQueueHeadings anchors { - left: queuedPrintJobs.left + left: printJobList.left leftMargin: UM.Theme.getSize("narrow_margin").width top: queuedLabel.bottom topMargin: 24 * screenScaleFactor // TODO: Theme! } spacing: 18 * screenScaleFactor // TODO: Theme! - Label + UM.Label { text: catalog.i18nc("@label", "There are no print jobs in the queue. Slice and send a job to add one.") - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") anchors.verticalCenter: parent.verticalCenter - - renderType: Text.NativeRendering visible: printJobList.count === 0 } - Label + UM.Label { text: catalog.i18nc("@label", "Print jobs") - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter width: 284 * screenScaleFactor // TODO: Theme! (Should match column size) - - renderType: Text.NativeRendering visible: printJobList.count > 0 } - Label + UM.Label { text: catalog.i18nc("@label", "Total print time") - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter width: UM.Theme.getSize("monitor_column").width - - renderType: Text.NativeRendering visible: printJobList.count > 0 } - Label + UM.Label { text: catalog.i18nc("@label", "Waiting for") - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter width: UM.Theme.getSize("monitor_column").width - - renderType: Text.NativeRendering visible: printJobList.count > 0 } } - ScrollView + ListView { - id: queuedPrintJobs + id: printJobList anchors { bottom: parent.bottom horizontalCenter: parent.horizontalCenter top: printJobQueueHeadings.bottom - topMargin: 12 * screenScaleFactor // TODO: Theme! + topMargin: UM.Theme.getSize("default_margin").width } - style: UM.Theme.styles.scrollview width: parent.width - ListView + ScrollBar.vertical: UM.ScrollBar { - id: printJobList - anchors.fill: parent - delegate: MonitorPrintJobCard + id: printJobScrollBar + } + spacing: UM.Theme.getSize("narrow_margin").width + clip: true + + delegate: MonitorPrintJobCard + { + anchors { - anchors - { - left: parent.left - right: parent.right - } - printJob: modelData + left: parent.left + right: parent.right + rightMargin: printJobScrollBar.width } - model: + printJob: modelData + } + model: + { + if (OutputDevice.receivedData) { - if (OutputDevice.receivedData) - { - return OutputDevice.queuedPrintJobs - } - return [null, null] + return OutputDevice.queuedPrintJobs } - spacing: 6 // TODO: Theme! + return [null, null] } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml index 5d5b3ceab4..9e73662e1d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml @@ -2,8 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import UM 1.3 as UM import Cura 1.0 as Cura diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml index 3288896572..c7ebf803d5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml @@ -1,24 +1,24 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.4 -import UM 1.3 as UM +import UM 1.5 as UM -Button { - background: Rectangle { - opacity: parent.down || parent.hovered ? 1 : 0; +Button +{ + background: Rectangle + { + opacity: parent.down || parent.hovered ? 1 : 0 color: UM.Theme.getColor("monitor_context_menu_hover") } - contentItem: Label { - color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled"); + contentItem: UM.Label + { + color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled") text: parent.text - horizontalAlignment: Text.AlignLeft; - verticalAlignment: Text.AlignVCenter; - renderType: Text.NativeRendering; + horizontalAlignment: Text.AlignLeft } - height: visible ? 39 * screenScaleFactor : 0; // TODO: Theme! - hoverEnabled: true; - width: parent.width; + height: visible ? 39 * screenScaleFactor : 0 // TODO: Theme! + hoverEnabled: true + width: parent.width } diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml index dcfed2f7b4..441766a8e7 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml @@ -2,8 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 import QtQuick.Window 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls 2.15 as NewControls +import QtQuick.Controls 2.15 import UM 1.1 as UM @@ -84,7 +83,7 @@ UM.Dialog { renderType: Text.NativeRendering; } - NewControls.ComboBox { + ComboBox { id: printerComboBox; currentIndex: 0; Behavior on height { NumberAnimation { duration: 100 } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml index 291e2a14f5..7fce1478a1 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml @@ -2,8 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import UM 1.3 as UM import Cura 1.0 as Cura diff --git a/plugins/USBPrinting/MonitorItem.qml b/plugins/USBPrinting/MonitorItem.qml index c86353f814..3ca8140107 100644 --- a/plugins/USBPrinting/MonitorItem.qml +++ b/plugins/USBPrinting/MonitorItem.qml @@ -3,7 +3,6 @@ import QtQuick 2.10 import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Account/AccountWidget.qml b/resources/qml/Account/AccountWidget.qml index b058ead22f..d738c5c474 100644 --- a/resources/qml/Account/AccountWidget.qml +++ b/resources/qml/Account/AccountWidget.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.1 as Cura Item @@ -46,15 +46,12 @@ Item } } - contentItem: Label + contentItem: UM.Label { id: label text: signInButton.text - font: UM.Theme.getFont("default") color: UM.Theme.getColor("primary_text") width: contentWidth - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering } } @@ -113,7 +110,7 @@ Item } } - Label + UM.Label { id: initialLabel anchors.verticalCenter: parent.verticalCenter @@ -121,9 +118,7 @@ Item text: accountWidget.text font: UM.Theme.getFont("large_bold") color: UM.Theme.getColor("primary_text") - verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - renderType: Text.NativeRendering } } diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml index 08a621d521..da62124f3f 100644 --- a/resources/qml/Account/GeneralOperations.qml +++ b/resources/qml/Account/GeneralOperations.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.1 as Cura Column @@ -12,14 +12,12 @@ Column spacing: UM.Theme.getSize("default_margin").width padding: UM.Theme.getSize("default_margin").width - Label + UM.Label { id: title anchors.horizontalCenter: parent.horizontalCenter - renderType: Text.NativeRendering - text: catalog.i18nc("@label", "Sign in to the Ultimaker platform") + text: catalog.i18nc("@label", "Sign in to the Ultimaker platform") font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") } Image @@ -33,16 +31,14 @@ Column verticalAlignment: Image.AlignVCenter } - Label + UM.Label { id: generalInformationPoints anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignLeft - renderType: Text.NativeRendering text: catalog.i18nc("@text", "- Add material profiles and plug-ins from the Marketplace\n- Back-up and sync your material profiles and plug-ins\n- Share ideas and get help from 48,000+ users in the Ultimaker community") lineHeight: 1.4 - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + wrapMode: Text.NoWrap } Cura.PrimaryButton diff --git a/resources/qml/Account/SyncState.qml b/resources/qml/Account/SyncState.qml index d5a9d392e2..e5731ff9d7 100644 --- a/resources/qml/Account/SyncState.qml +++ b/resources/qml/Account/SyncState.qml @@ -1,7 +1,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.1 as Cura Row // Sync state icon + message @@ -77,28 +77,26 @@ Row // Sync state icon + message width: childrenRect.width height: childrenRect.height - Label + UM.Label { id: stateLabel // text is determined by State - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - width: contentWidth + UM.Theme.getSize("default_margin").height + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.rightMargin: UM.Theme.getSize("default_margin").width + wrapMode: Text.NoWrap height: contentHeight - verticalAlignment: Text.AlignVCenter visible: !Cura.API.account.manualSyncEnabled && !Cura.API.account.updatePackagesEnabled } - Label + UM.Label { id: updatePackagesButton text: catalog.i18nc("@button", "Install pending updates") color: UM.Theme.getColor("text_link") font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter height: contentHeight + wrapMode: Text.NoWrap width: contentWidth + UM.Theme.getSize("default_margin").height visible: Cura.API.account.updatePackagesEnabled @@ -112,14 +110,13 @@ Row // Sync state icon + message } } - Label + UM.Label { id: accountSyncButton text: catalog.i18nc("@button", "Check for account updates") color: UM.Theme.getColor("text_link") font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter + wrapMode: Text.NoWrap height: contentHeight width: contentWidth + UM.Theme.getSize("default_margin").height visible: Cura.API.account.manualSyncEnabled diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index 75a81737f2..be858df993 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.1 as Cura Column @@ -41,16 +41,13 @@ Column anchors.verticalCenter: parent.verticalCenter color: UM.Theme.getColor("action_button_disabled") visible: !avatar.hasAvatar - Label + UM.Label { id: initialLabel anchors.centerIn: parent text: profile["username"].charAt(0).toUpperCase() font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - renderType: Text.NativeRendering } } @@ -62,25 +59,22 @@ Column spacing: UM.Theme.getSize("narrow_margin").height width: childrenRect.width height: childrenRect.height - Label + + UM.Label { id: username - renderType: Text.NativeRendering text: profile.username font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") } SyncState { id: syncRow } - Label + UM.Label { id: lastSyncLabel - renderType: Text.NativeRendering text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime) - font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_medium") } } diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 1c231e5ef3..e866260158 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -5,7 +5,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 import QtGraphicalEffects 1.0 // For the dropshadow -import UM 1.1 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -128,18 +128,16 @@ Button elideWidth: buttonText.width } - Label + UM.Label { id: buttonText text: button.text color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor font: UM.Theme.getFont("medium") visible: text != "" - renderType: Text.NativeRendering height: parent.height anchors.verticalCenter: parent.verticalCenter horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter elide: Text.ElideRight Binding diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 99d78537c3..868f23d242 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -1,10 +1,9 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 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.Controls 2.4 import QtQuick.Layouts 1.3 -import QtQuick.Controls 1.4 as Controls1 import UM 1.4 as UM import Cura 1.0 as Cura @@ -122,7 +121,9 @@ Column 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() + onClicked: { + sliceOrStopSlicing() + } } Cura.SecondaryButton @@ -136,7 +137,9 @@ Column text: catalog.i18nc("@button", "Cancel") enabled: sliceButton.enabled visible: !sliceButton.visible - onClicked: sliceOrStopSlicing() + onClicked: { + sliceOrStopSlicing() + } } } @@ -165,7 +168,7 @@ Column } // Shortcut for "slice/stop" - Controls1.Action + Action { shortcut: "Ctrl+P" onTriggered: diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index e3f3947bfe..4e2a05a6aa 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -4,75 +4,73 @@ pragma Singleton import QtQuick 2.10 -import QtQuick.Controls 1.1 -import QtQuick.Controls 2.3 as Controls2 +import QtQuick.Controls 2.4 import UM 1.1 as UM import Cura 1.0 as Cura Item { - property alias newProject: newProjectAction; - property alias open: openAction; - property alias quit: quitAction; + property alias newProject: newProjectAction + property alias open: openAction + property alias quit: quitAction - property alias undo: undoAction; - property alias redo: redoAction; + property alias undo: undoAction + property alias redo: redoAction - property alias view3DCamera: view3DCameraAction; - property alias viewFrontCamera: viewFrontCameraAction; - property alias viewTopCamera: viewTopCameraAction; - property alias viewBottomCamera: viewBottomCameraAction; - property alias viewLeftSideCamera: viewLeftSideCameraAction; - property alias viewRightSideCamera: viewRightSideCameraAction; + property alias view3DCamera: view3DCameraAction + property alias viewFrontCamera: viewFrontCameraAction + property alias viewTopCamera: viewTopCameraAction + property alias viewBottomCamera: viewBottomCameraAction + property alias viewLeftSideCamera: viewLeftSideCameraAction + property alias viewRightSideCamera: viewRightSideCameraAction - property alias deleteSelection: deleteSelectionAction; - property alias centerSelection: centerSelectionAction; - property alias multiplySelection: multiplySelectionAction; + property alias deleteSelection: deleteSelectionAction + property alias centerSelection: centerSelectionAction + property alias multiplySelection: multiplySelectionAction - property alias deleteObject: deleteObjectAction; - property alias centerObject: centerObjectAction; - property alias groupObjects: groupObjectsAction; - property alias unGroupObjects:unGroupObjectsAction; - property alias mergeObjects: mergeObjectsAction; - //property alias unMergeObjects: unMergeObjectsAction; + property alias deleteObject: deleteObjectAction + property alias centerObject: centerObjectAction + property alias groupObjects: groupObjectsAction + property alias unGroupObjects:unGroupObjectsAction + property alias mergeObjects: mergeObjectsAction + //property alias unMergeObjects: unMergeObjectsAction - property alias multiplyObject: multiplyObjectAction; + property alias multiplyObject: multiplyObjectAction - property alias selectAll: selectAllAction; - property alias deleteAll: deleteAllAction; - property alias reloadAll: reloadAllAction; - property alias arrangeAllBuildPlates: arrangeAllBuildPlatesAction; - property alias arrangeAll: arrangeAllAction; - property alias arrangeSelection: arrangeSelectionAction; - property alias resetAllTranslation: resetAllTranslationAction; - property alias resetAll: resetAllAction; + property alias selectAll: selectAllAction + property alias deleteAll: deleteAllAction + property alias reloadAll: reloadAllAction + property alias arrangeAllBuildPlates: arrangeAllBuildPlatesAction + property alias arrangeAll: arrangeAllAction + property alias arrangeSelection: arrangeSelectionAction + property alias resetAllTranslation: resetAllTranslationAction + property alias resetAll: resetAllAction - property alias addMachine: addMachineAction; - property alias configureMachines: settingsAction; - property alias addProfile: addProfileAction; - property alias updateProfile: updateProfileAction; - property alias resetProfile: resetProfileAction; - property alias manageProfiles: manageProfilesAction; + property alias addMachine: addMachineAction + property alias configureMachines: settingsAction + property alias addProfile: addProfileAction + property alias updateProfile: updateProfileAction + property alias resetProfile: resetProfileAction + property alias manageProfiles: manageProfilesAction - property alias manageMaterials: manageMaterialsAction; - property alias marketplaceMaterials: marketplaceMaterialsAction; + property alias manageMaterials: manageMaterialsAction + property alias marketplaceMaterials: marketplaceMaterialsAction - property alias preferences: preferencesAction; + property alias preferences: preferencesAction - property alias showProfileFolder: showProfileFolderAction; - property alias documentation: documentationAction; + property alias showProfileFolder: showProfileFolderAction + property alias documentation: documentationAction property alias showTroubleshooting: showTroubleShootingAction - property alias reportBug: reportBugAction; + property alias reportBug: reportBugAction property alias whatsNew: whatsNewAction - property alias about: aboutAction; + property alias about: aboutAction - property alias toggleFullScreen: toggleFullScreenAction; + property alias toggleFullScreen: toggleFullScreenAction property alias exitFullScreen: exitFullScreenAction property alias configureSettingVisibility: configureSettingVisibilityAction property alias browsePackages: browsePackagesAction - property alias openMarketplace: openMarketplaceAction UM.I18nCatalog{id: catalog; name: "cura"} @@ -81,7 +79,7 @@ Item { id: showTroubleShootingAction onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/troubleshooting?utm_source=cura&utm_medium=software&utm_campaign=dropdown-troubleshooting") - text: catalog.i18nc("@action:inmenu", "Show Online Troubleshooting Guide"); + text: catalog.i18nc("@action:inmenu", "Show Online Troubleshooting Guide") } Action @@ -89,7 +87,7 @@ Item id: toggleFullScreenAction shortcut: StandardKey.FullScreen text: catalog.i18nc("@action:inmenu", "Toggle Full Screen") - iconName: "view-fullscreen" + icon.name: "view-fullscreen" } Action @@ -97,27 +95,27 @@ Item id: exitFullScreenAction shortcut: StandardKey.Cancel text: catalog.i18nc("@action:inmenu", "Exit Full Screen") - iconName: "view-fullscreen" + icon.name: "view-fullscreen" } Action { - id: undoAction; - text: catalog.i18nc("@action:inmenu menubar:edit", "&Undo"); - iconName: "edit-undo"; - shortcut: StandardKey.Undo; - onTriggered: UM.OperationStack.undo(); - enabled: UM.OperationStack.canUndo; + id: undoAction + text: catalog.i18nc("@action:inmenu menubar:edit", "&Undo") + icon.name: "edit-undo" + shortcut: StandardKey.Undo + onTriggered: UM.OperationStack.undo() + enabled: UM.OperationStack.canUndo } Action { - id: redoAction; - text: catalog.i18nc("@action:inmenu menubar:edit", "&Redo"); - iconName: "edit-redo"; - shortcut: StandardKey.Redo; - onTriggered: UM.OperationStack.redo(); - enabled: UM.OperationStack.canRedo; + id: redoAction + text: catalog.i18nc("@action:inmenu menubar:edit", "&Redo") + icon.name: "edit-redo" + shortcut: StandardKey.Redo + onTriggered: UM.OperationStack.redo() + enabled: UM.OperationStack.canRedo } Action @@ -132,7 +130,7 @@ Item //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar text: (Qt.platform.os == "osx") ? "&Quit" : catalog.i18nc("@action:inmenu menubar:file", "&Quit") - iconName: "application-exit" + icon.name: "application-exit" shortcut: StandardKey.Quit } @@ -189,7 +187,7 @@ Item //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar text: (Qt.platform.os == "osx") ? "Configure Cura..." : catalog.i18nc("@action:inmenu", "Configure Cura...") - iconName: "configure" + icon.name: "configure" } Action @@ -202,14 +200,14 @@ Item { id: settingsAction text: catalog.i18nc("@action:inmenu menubar:printer", "Manage Pr&inters...") - iconName: "configure" + icon.name: "configure" } Action { id: manageMaterialsAction text: catalog.i18nc("@action:inmenu", "Manage Materials...") - iconName: "configure" + icon.name: "configure" shortcut: "Ctrl+K" } @@ -221,7 +219,7 @@ Item Action { - id: updateProfileAction; + id: updateProfileAction enabled: !Cura.MachineManager.stacksHaveErrors && Cura.MachineManager.hasUserSettings && Cura.MachineManager.activeQualityChangesGroup != null text: catalog.i18nc("@action:inmenu menubar:profile", "&Update profile with current settings/overrides"); onTriggered: Cura.ContainerManager.updateQualityChanges(); @@ -229,56 +227,56 @@ Item Action { - id: resetProfileAction; + id: resetProfileAction enabled: Cura.MachineManager.hasUserSettings - text: catalog.i18nc("@action:inmenu menubar:profile", "&Discard current changes"); + text: catalog.i18nc("@action:inmenu menubar:profile", "&Discard current changes") onTriggered: { - forceActiveFocus(); - Cura.ContainerManager.clearUserContainers(); + forceActiveFocus() + Cura.ContainerManager.clearUserContainers() } } Action { - id: addProfileAction; + id: addProfileAction enabled: !Cura.MachineManager.stacksHaveErrors && Cura.MachineManager.hasUserSettings - text: catalog.i18nc("@action:inmenu menubar:profile", "&Create profile from current settings/overrides..."); + text: catalog.i18nc("@action:inmenu menubar:profile", "&Create profile from current settings/overrides...") } Action { id: manageProfilesAction text: catalog.i18nc("@action:inmenu menubar:profile", "Manage Profiles...") - iconName: "configure" + icon.name: "configure" shortcut: "Ctrl+J" } Action { - id: documentationAction; - text: catalog.i18nc("@action:inmenu menubar:help", "Show Online &Documentation"); - iconName: "help-contents"; - shortcut: StandardKey.Help; - onTriggered: CuraActions.openDocumentation(); + id: documentationAction + text: catalog.i18nc("@action:inmenu menubar:help", "Show Online &Documentation") + icon.name: "help-contents" + shortcut: StandardKey.Help + onTriggered: CuraActions.openDocumentation() } Action { - id: reportBugAction; - text: catalog.i18nc("@action:inmenu menubar:help", "Report a &Bug"); - iconName: "tools-report-bug"; - onTriggered: CuraActions.openBugReportPage(); + id: reportBugAction + text: catalog.i18nc("@action:inmenu menubar:help", "Report a &Bug") + icon.name: "tools-report-bug" + onTriggered: CuraActions.openBugReportPage() } Action { - id: whatsNewAction; - text: catalog.i18nc("@action:inmenu menubar:help", "What's New"); + id: whatsNewAction + text: catalog.i18nc("@action:inmenu menubar:help", "What's New") } Action { - id: aboutAction; + id: aboutAction //On MacOS, don't translate the "About" word. //Qt moves the "about" entry to a different place, and if it got renamed can't find it again when it @@ -287,60 +285,60 @@ Item //For more information, see: //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar - text: (Qt.platform.os == "osx") ? "About..." : catalog.i18nc("@action:inmenu menubar:help", "About..."); - iconName: "help-about"; + text: (Qt.platform.os == "osx") ? "About..." : catalog.i18nc("@action:inmenu menubar:help", "About...") + icon.name: "help-about" } Action { - id: deleteSelectionAction; - text: catalog.i18nc("@action:inmenu menubar:edit", "Delete Selected"); - enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection; - iconName: "edit-delete"; + id: deleteSelectionAction + text: catalog.i18nc("@action:inmenu menubar:edit", "Delete Selected") + enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection + icon.name: "edit-delete" shortcut: StandardKey.Delete | "Backspace" - onTriggered: CuraActions.deleteSelection(); + onTriggered: CuraActions.deleteSelection() } Action { - id: centerSelectionAction; - text: catalog.i18nc("@action:inmenu menubar:edit", "Center Selected"); - enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection; - iconName: "align-vertical-center"; - onTriggered: CuraActions.centerSelection(); + id: centerSelectionAction + text: catalog.i18nc("@action:inmenu menubar:edit", "Center Selected") + enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection + icon.name: "align-vertical-center" + onTriggered: CuraActions.centerSelection() } Action { - id: multiplySelectionAction; - text: catalog.i18nc("@action:inmenu menubar:edit", "Multiply Selected"); - enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection; - iconName: "edit-duplicate"; + id: multiplySelectionAction + text: catalog.i18nc("@action:inmenu menubar:edit", "Multiply Selected") + enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection + icon.name: "edit-duplicate" shortcut: "Ctrl+M" } Action { - id: deleteObjectAction; - text: catalog.i18nc("@action:inmenu","Delete Model"); - enabled: UM.Controller.toolsEnabled; - iconName: "edit-delete"; + id: deleteObjectAction + text: catalog.i18nc("@action:inmenu","Delete Model") + enabled: UM.Controller.toolsEnabled + icon.name: "edit-delete" } Action { - id: centerObjectAction; - text: catalog.i18nc("@action:inmenu","Ce&nter Model on Platform"); + id: centerObjectAction + text: catalog.i18nc("@action:inmenu","Ce&nter Model on Platform") } Action { id: groupObjectsAction - text: catalog.i18nc("@action:inmenu menubar:edit","&Group Models"); + text: catalog.i18nc("@action:inmenu menubar:edit","&Group Models") enabled: UM.Selection.selectionCount > 1 ? true: false - iconName: "object-group" - shortcut: "Ctrl+G"; - onTriggered: CuraApplication.groupSelected(); + icon.name: "object-group" + shortcut: "Ctrl+G" + onTriggered: CuraApplication.groupSelected() } Action @@ -356,139 +354,132 @@ Item Action { id: unGroupObjectsAction - text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Models"); + text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Models") enabled: UM.Selection.isGroupSelected - iconName: "object-ungroup" - shortcut: "Ctrl+Shift+G"; - onTriggered: CuraApplication.ungroupSelected(); + icon.name: "object-ungroup" + shortcut: "Ctrl+Shift+G" + onTriggered: CuraApplication.ungroupSelected() } Action { id: mergeObjectsAction - text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Models"); + text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Models") enabled: UM.Selection.selectionCount > 1 ? true: false - iconName: "merge"; - shortcut: "Ctrl+Alt+G"; - onTriggered: CuraApplication.mergeSelected(); + icon.name: "merge" + shortcut: "Ctrl+Alt+G" + onTriggered: CuraApplication.mergeSelected() } Action { - id: multiplyObjectAction; - text: catalog.i18nc("@action:inmenu","&Multiply Model..."); - iconName: "edit-duplicate" + id: multiplyObjectAction + text: catalog.i18nc("@action:inmenu","&Multiply Model...") + icon.name: "edit-duplicate" } Action { - id: selectAllAction; - text: catalog.i18nc("@action:inmenu menubar:edit","Select All Models"); - enabled: UM.Controller.toolsEnabled; - iconName: "edit-select-all"; - shortcut: "Ctrl+A"; - onTriggered: CuraApplication.selectAll(); + id: selectAllAction + text: catalog.i18nc("@action:inmenu menubar:edit","Select All Models") + enabled: UM.Controller.toolsEnabled + icon.name: "edit-select-all" + shortcut: "Ctrl+A" + onTriggered: CuraApplication.selectAll() } Action { - id: deleteAllAction; - text: catalog.i18nc("@action:inmenu menubar:edit","Clear Build Plate"); - enabled: UM.Controller.toolsEnabled; - iconName: "edit-delete"; - shortcut: "Ctrl+D"; - onTriggered: CuraApplication.deleteAll(); + id: deleteAllAction + text: catalog.i18nc("@action:inmenu menubar:edit","Clear Build Plate") + enabled: UM.Controller.toolsEnabled + icon.name: "edit-delete" + shortcut: "Ctrl+D" + onTriggered: CuraApplication.deleteAll() } Action { - id: reloadAllAction; - text: catalog.i18nc("@action:inmenu menubar:file","Reload All Models"); - iconName: "document-revert"; + id: reloadAllAction + text: catalog.i18nc("@action:inmenu menubar:file","Reload All Models") + icon.name: "document-revert" shortcut: "F5" - onTriggered: CuraApplication.reloadAll(); + onTriggered: CuraApplication.reloadAll() } Action { - id: arrangeAllBuildPlatesAction; - text: catalog.i18nc("@action:inmenu menubar:edit","Arrange All Models To All Build Plates"); - onTriggered: Printer.arrangeObjectsToAllBuildPlates(); + id: arrangeAllBuildPlatesAction + text: catalog.i18nc("@action:inmenu menubar:edit","Arrange All Models To All Build Plates") + onTriggered: Printer.arrangeObjectsToAllBuildPlates() } Action { - id: arrangeAllAction; - text: catalog.i18nc("@action:inmenu menubar:edit","Arrange All Models"); - onTriggered: Printer.arrangeAll(); - shortcut: "Ctrl+R"; + id: arrangeAllAction + text: catalog.i18nc("@action:inmenu menubar:edit","Arrange All Models") + onTriggered: Printer.arrangeAll() + shortcut: "Ctrl+R" } Action { - id: arrangeSelectionAction; - text: catalog.i18nc("@action:inmenu menubar:edit","Arrange Selection"); - onTriggered: Printer.arrangeSelection(); + id: arrangeSelectionAction + text: catalog.i18nc("@action:inmenu menubar:edit","Arrange Selection") + onTriggered: Printer.arrangeSelection() } Action { - id: resetAllTranslationAction; - text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Positions"); - onTriggered: CuraApplication.resetAllTranslation(); + id: resetAllTranslationAction + text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Positions") + onTriggered: CuraApplication.resetAllTranslation() } Action { - id: resetAllAction; - text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Transformations"); - onTriggered: CuraApplication.resetAll(); + id: resetAllAction + text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Transformations") + onTriggered: CuraApplication.resetAll() } Action { - id: openAction; + id: openAction property var fileProviderModel: CuraApplication.getFileProviderModel() - text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)..."); - iconName: "document-open"; + text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)...") + icon.name: "document-open" // Unassign the shortcut when there are more than one file providers, since then the file provider's shortcut is // enabled instead, and Ctrl+O is assigned to the local file provider - shortcut: fileProviderModel.count == 1 ? StandardKey.Open : ""; + shortcut: fileProviderModel.count == 1 ? StandardKey.Open : "" } Action { id: newProjectAction - text: catalog.i18nc("@action:inmenu menubar:file","&New Project..."); + text: catalog.i18nc("@action:inmenu menubar:file","&New Project...") shortcut: StandardKey.New } Action { - id: showProfileFolderAction; - text: catalog.i18nc("@action:inmenu menubar:help","Show Configuration Folder"); + id: showProfileFolderAction + text: catalog.i18nc("@action:inmenu menubar:help","Show Configuration Folder") } Action { id: configureSettingVisibilityAction - text: catalog.i18nc("@action:menu", "Configure setting visibility..."); - iconName: "configure" + text: catalog.i18nc("@action:menu", "Configure setting visibility...") + icon.name: "configure" } Action { id: browsePackagesAction text: "&Marketplace" - iconName: "plugins_browse" - } - - Action - { - id: openMarketplaceAction - text: catalog.i18nc("@action:menu", "&Marketplace") - iconName: "plugins_browse" + icon.name: "plugins_browse" } } diff --git a/resources/qml/ApplicationSwitcher/ApplicationButton.qml b/resources/qml/ApplicationSwitcher/ApplicationButton.qml index bcf780753c..0384ca2ed5 100644 --- a/resources/qml/ApplicationSwitcher/ApplicationButton.qml +++ b/resources/qml/ApplicationSwitcher/ApplicationButton.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.1 as Cura Button @@ -73,7 +73,7 @@ Button } } - Label + UM.Label { id: applicationDisplayName @@ -82,10 +82,8 @@ Button height: base.height - applicationIcon.height - 2 * UM.Theme.getSize("default_margin").width // Account for the top and bottom margins horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter wrapMode: Text.Wrap elide: Text.ElideRight - color: UM.Theme.getColor("text") } } } diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml new file mode 100644 index 0000000000..3818ea5cb4 --- /dev/null +++ b/resources/qml/ColorDialog.qml @@ -0,0 +1,148 @@ +import QtQuick 2.10 +import QtQuick.Controls 2.2 +import QtQuick.Window 2.1 +import QtQuick.Layouts 1.1 + +import UM 1.5 as UM +import Cura 1.1 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. + minimumWidth: content.width + 4 * margin + minimumHeight: + content.height // content height + + buttonRow.height // button row height + + 5 * margin // top and bottom margin and margin between buttons and content + width: minimumWidth + height: minimumHeight + + 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.RecolorImage + { + 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") + } + + TextField + { + id: colorInput + Layout.fillWidth: true + text: "#FFFFFF" + selectByMouse: true + onTextChanged: { + if (!text.startsWith("#")) + { + text = `#${text}`; + } + } + validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{0,6})$/ } + } + + Rectangle + { + color: base.color + Layout.preferredHeight: parent.height + Layout.preferredWidth: height + } + } + } + + buttonSpacing: UM.Theme.getSize("thin_margin").width + + rightButtons: + [ + Cura.TertiaryButton { + text: catalog.i18nc("@action:button", "Cancel") + onClicked: base.close() + }, + Cura.PrimaryButton { + text: catalog.i18nc("@action:button", "OK") + onClicked: base.accept() + } + ] +} \ No newline at end of file diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index eb78240d64..371754e9e0 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -1,14 +1,11 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.15 import QtQuick.Dialogs 1.2 import QtGraphicalEffects 1.0 - -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura import "Dialogs" @@ -161,7 +158,6 @@ UM.MainWindow ApplicationMenu { id: applicationMenu - window: base } Item @@ -255,7 +251,6 @@ UM.MainWindow // Try to install plugin & close. CuraApplication.installPackageViaDragAndDrop(filename); packageInstallDialog.text = catalog.i18nc("@label", "This package will be installed after restarting."); - packageInstallDialog.icon = StandardIcon.Information; packageInstallDialog.open(); } else @@ -588,18 +583,15 @@ UM.MainWindow } } - MessageDialog + Cura.MessageDialog { id: exitConfirmationDialog title: catalog.i18nc("@title:window %1 is the application name", "Closing %1").arg(CuraApplication.applicationDisplayName) text: catalog.i18nc("@label %1 is the application name", "Are you sure you want to exit %1?").arg(CuraApplication.applicationDisplayName) - icon: StandardIcon.Question - modality: Qt.ApplicationModal - standardButtons: StandardButton.Yes | StandardButton.No - onYes: CuraApplication.callConfirmExitDialogCallback(true) - onNo: CuraApplication.callConfirmExitDialogCallback(false) + standardButtons: Dialog.Yes | Dialog.No + onAccepted: CuraApplication.callConfirmExitDialogCallback(true) onRejected: CuraApplication.callConfirmExitDialogCallback(false) - onVisibilityChanged: + onClosed: { if (!visible) { @@ -749,20 +741,18 @@ UM.MainWindow } } - MessageDialog + Cura.MessageDialog { id: packageInstallDialog - title: catalog.i18nc("@window:title", "Install Package"); + title: catalog.i18nc("@window:title", "Install Package") standardButtons: StandardButton.Ok - modality: Qt.ApplicationModal } - MessageDialog + Cura.MessageDialog { id: infoMultipleFilesWithGcodeDialog title: catalog.i18nc("@title:window", "Open File(s)") - icon: StandardIcon.Information - standardButtons: StandardButton.Ok + standardButtons: Dialog.Ok text: catalog.i18nc("@text:window", "We have found one or more G-Code files within the files you have selected. You can only open one G-Code file at a time. If you want to open a G-Code file, please just select only one.") property var selectedMultipleFiles @@ -821,35 +811,6 @@ UM.MainWindow } } - MessageDialog - { - id: messageDialog - modality: Qt.ApplicationModal - onAccepted: CuraApplication.messageBoxClosed(clickedButton) - onApply: CuraApplication.messageBoxClosed(clickedButton) - onDiscard: CuraApplication.messageBoxClosed(clickedButton) - onHelp: CuraApplication.messageBoxClosed(clickedButton) - onNo: CuraApplication.messageBoxClosed(clickedButton) - onRejected: CuraApplication.messageBoxClosed(clickedButton) - onReset: CuraApplication.messageBoxClosed(clickedButton) - onYes: CuraApplication.messageBoxClosed(clickedButton) - } - - Connections - { - target: CuraApplication - function onShowMessageBox(title, text, informativeText, detailedText, buttons, icon) - { - messageDialog.title = title - messageDialog.text = text - messageDialog.informativeText = informativeText - messageDialog.detailedText = detailedText - messageDialog.standardButtons = buttons - messageDialog.icon = icon - messageDialog.visible = true - } - } - Component { id: discardOrKeepProfileChangesDialogComponent diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index 121f5d40b4..e6d15af2d9 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -1,11 +1,11 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Window 2.1 +import QtQuick.Controls 2.9 -import UM 1.1 as UM +import UM 1.5 as UM +import Cura 1.5 as Cura UM.Dialog { @@ -50,7 +50,7 @@ UM.Dialog UM.I18nCatalog{id: catalog; name: "cura"} } - Label + UM.Label { id: version @@ -63,7 +63,7 @@ UM.Dialog } } - Label + UM.Label { id: description width: parent.width @@ -76,7 +76,7 @@ UM.Dialog anchors.topMargin: UM.Theme.getSize("default_margin").height } - Label + UM.Label { id: creditsNotes width: parent.width @@ -89,90 +89,87 @@ UM.Dialog anchors.topMargin: UM.Theme.getSize("default_margin").height } - ScrollView + ListView { - id: credits + id: projectsList anchors.top: creditsNotes.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - width: parent.width height: base.height - y - (2 * UM.Theme.getSize("default_margin").height + closeButton.height) - ListView + ScrollBar.vertical: UM.ScrollBar { - id: projectsList + id: projectsListScrollBar + } - width: parent.width + delegate: Row + { + spacing: UM.Theme.getSize("narrow_margin").width + UM.Label + { + text: "%2".arg(model.url).arg(model.name) + width: (projectsList.width * 0.25) | 0 + elide: Text.ElideRight + onLinkActivated: Qt.openUrlExternally(link) + } + UM.Label + { + text: model.description + elide: Text.ElideRight + width: ((projectsList.width * 0.6) | 0) - parent.spacing * 2 - projectsListScrollBar.width + } + UM.Label + { + text: model.license + elide: Text.ElideRight + width: (projectsList.width * 0.15) | 0 + } + } + model: ListModel + { + id: projectsModel + } + Component.onCompleted: + { + projectsModel.append({ name: "Cura", description: catalog.i18nc("@label", "Graphical user interface"), license: "LGPLv3", url: "https://github.com/Ultimaker/Cura" }); + projectsModel.append({ name: "Uranium", description: catalog.i18nc("@label", "Application framework"), license: "LGPLv3", url: "https://github.com/Ultimaker/Uranium" }); + projectsModel.append({ name: "CuraEngine", description: catalog.i18nc("@label", "G-code generator"), license: "AGPLv3", url: "https://github.com/Ultimaker/CuraEngine" }); + projectsModel.append({ name: "libArcus", description: catalog.i18nc("@label", "Interprocess communication library"), license: "LGPLv3", url: "https://github.com/Ultimaker/libArcus" }); - delegate: Row - { - Label - { - text: "%2".arg(model.url).arg(model.name) - width: (projectsList.width * 0.25) | 0 - elide: Text.ElideRight - onLinkActivated: Qt.openUrlExternally(link) - } - Label - { - text: model.description - elide: Text.ElideRight - width: (projectsList.width * 0.6) | 0 - } - Label - { - text: model.license - elide: Text.ElideRight - width: (projectsList.width * 0.15) | 0 - } - } - model: ListModel - { - id: projectsModel - } - Component.onCompleted: - { - projectsModel.append({ name: "Cura", description: catalog.i18nc("@label", "Graphical user interface"), license: "LGPLv3", url: "https://github.com/Ultimaker/Cura" }); - projectsModel.append({ name: "Uranium", description: catalog.i18nc("@label", "Application framework"), license: "LGPLv3", url: "https://github.com/Ultimaker/Uranium" }); - projectsModel.append({ name: "CuraEngine", description: catalog.i18nc("@label", "G-code generator"), license: "AGPLv3", url: "https://github.com/Ultimaker/CuraEngine" }); - projectsModel.append({ name: "libArcus", description: catalog.i18nc("@label", "Interprocess communication library"), license: "LGPLv3", url: "https://github.com/Ultimaker/libArcus" }); - - projectsModel.append({ name: "Python", description: catalog.i18nc("@label", "Programming language"), license: "Python", url: "http://python.org/" }); - projectsModel.append({ name: "Qt5", description: catalog.i18nc("@label", "GUI framework"), license: "LGPLv3", url: "https://www.qt.io/" }); - projectsModel.append({ name: "PyQt", description: catalog.i18nc("@label", "GUI framework bindings"), license: "GPL", url: "https://riverbankcomputing.com/software/pyqt" }); - projectsModel.append({ name: "SIP", description: catalog.i18nc("@label", "C/C++ Binding library"), license: "GPL", url: "https://riverbankcomputing.com/software/sip" }); - projectsModel.append({ name: "Protobuf", description: catalog.i18nc("@label", "Data interchange format"), license: "BSD", url: "https://developers.google.com/protocol-buffers" }); - projectsModel.append({ name: "SciPy", description: catalog.i18nc("@label", "Support library for scientific computing"), license: "BSD-new", url: "https://www.scipy.org/" }); - projectsModel.append({ name: "NumPy", description: catalog.i18nc("@label", "Support library for faster math"), license: "BSD", url: "http://www.numpy.org/" }); - projectsModel.append({ name: "NumPy-STL", description: catalog.i18nc("@label", "Support library for handling STL files"), license: "BSD", url: "https://github.com/WoLpH/numpy-stl" }); - projectsModel.append({ name: "Trimesh", description: catalog.i18nc("@label", "Support library for handling triangular meshes"), license: "MIT", url: "https://trimsh.org" }); - projectsModel.append({ name: "libSavitar", description: catalog.i18nc("@label", "Support library for handling 3MF files"), license: "LGPLv3", url: "https://github.com/ultimaker/libsavitar" }); - projectsModel.append({ name: "libCharon", description: catalog.i18nc("@label", "Support library for file metadata and streaming"), license: "LGPLv3", url: "https://github.com/ultimaker/libcharon" }); - projectsModel.append({ name: "PySerial", description: catalog.i18nc("@label", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" }); - projectsModel.append({ name: "python-zeroconf", description: catalog.i18nc("@label", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" }); - projectsModel.append({ name: "Clipper", description: catalog.i18nc("@label", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" }); - projectsModel.append({ name: "Pyclipper", description: catalog.i18nc("@label", "Python bindings for Clipper"), license: "MIT", url: "https://github.com/fonttools/pyclipper" }); - projectsModel.append({ name: "mypy", description: catalog.i18nc("@Label", "Static type checker for Python"), license: "MIT", url: "http://mypy-lang.org/" }); - projectsModel.append({ name: "certifi", description: catalog.i18nc("@Label", "Root Certificates for validating SSL trustworthiness"), license: "MPL", url: "https://github.com/certifi/python-certifi" }); - projectsModel.append({ name: "cryptography", description: catalog.i18nc("@Label", "Root Certificates for validating SSL trustworthiness"), license: "APACHE and BSD", url: "https://cryptography.io/" }); - projectsModel.append({ name: "Sentry", description: catalog.i18nc("@Label", "Python Error tracking library"), license: "BSD 2-Clause 'Simplified'", url: "https://sentry.io/for/python/" }); - projectsModel.append({ name: "libnest2d", description: catalog.i18nc("@label", "Polygon packing library, developed by Prusa Research"), license: "LGPL", url: "https://github.com/tamasmeszaros/libnest2d" }); - projectsModel.append({ name: "pynest2d", description: catalog.i18nc("@label", "Python bindings for libnest2d"), license: "LGPL", url: "https://github.com/Ultimaker/pynest2d" }); - projectsModel.append({ name: "keyring", description: catalog.i18nc("@label", "Support library for system keyring access"), license: "MIT", url: "https://github.com/jaraco/keyring" }); - projectsModel.append({ name: "pywin32", description: catalog.i18nc("@label", "Python extensions for Microsoft Windows"), license: "PSF", url: "https://github.com/mhammond/pywin32" }); - projectsModel.append({ name: "Noto Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://www.google.com/get/noto/" }); - projectsModel.append({ name: "Font-Awesome-SVG-PNG", description: catalog.i18nc("@label", "SVG icons"), license: "SIL OFL 1.1", url: "https://github.com/encharm/Font-Awesome-SVG-PNG" }); - projectsModel.append({ name: "AppImageKit", description: catalog.i18nc("@label", "Linux cross-distribution application deployment"), license: "MIT", url: "https://github.com/AppImage/AppImageKit" }); - } + projectsModel.append({ name: "Python", description: catalog.i18nc("@label", "Programming language"), license: "Python", url: "http://python.org/" }); + projectsModel.append({ name: "Qt5", description: catalog.i18nc("@label", "GUI framework"), license: "LGPLv3", url: "https://www.qt.io/" }); + projectsModel.append({ name: "PyQt", description: catalog.i18nc("@label", "GUI framework bindings"), license: "GPL", url: "https://riverbankcomputing.com/software/pyqt" }); + projectsModel.append({ name: "SIP", description: catalog.i18nc("@label", "C/C++ Binding library"), license: "GPL", url: "https://riverbankcomputing.com/software/sip" }); + projectsModel.append({ name: "Protobuf", description: catalog.i18nc("@label", "Data interchange format"), license: "BSD", url: "https://developers.google.com/protocol-buffers" }); + projectsModel.append({ name: "SciPy", description: catalog.i18nc("@label", "Support library for scientific computing"), license: "BSD-new", url: "https://www.scipy.org/" }); + projectsModel.append({ name: "NumPy", description: catalog.i18nc("@label", "Support library for faster math"), license: "BSD", url: "http://www.numpy.org/" }); + projectsModel.append({ name: "NumPy-STL", description: catalog.i18nc("@label", "Support library for handling STL files"), license: "BSD", url: "https://github.com/WoLpH/numpy-stl" }); + projectsModel.append({ name: "Trimesh", description: catalog.i18nc("@label", "Support library for handling triangular meshes"), license: "MIT", url: "https://trimsh.org" }); + projectsModel.append({ name: "libSavitar", description: catalog.i18nc("@label", "Support library for handling 3MF files"), license: "LGPLv3", url: "https://github.com/ultimaker/libsavitar" }); + projectsModel.append({ name: "libCharon", description: catalog.i18nc("@label", "Support library for file metadata and streaming"), license: "LGPLv3", url: "https://github.com/ultimaker/libcharon" }); + projectsModel.append({ name: "PySerial", description: catalog.i18nc("@label", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" }); + projectsModel.append({ name: "python-zeroconf", description: catalog.i18nc("@label", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" }); + projectsModel.append({ name: "Clipper", description: catalog.i18nc("@label", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" }); + projectsModel.append({ name: "Pyclipper", description: catalog.i18nc("@label", "Python bindings for Clipper"), license: "MIT", url: "https://github.com/fonttools/pyclipper" }); + projectsModel.append({ name: "mypy", description: catalog.i18nc("@Label", "Static type checker for Python"), license: "MIT", url: "http://mypy-lang.org/" }); + projectsModel.append({ name: "certifi", description: catalog.i18nc("@Label", "Root Certificates for validating SSL trustworthiness"), license: "MPL", url: "https://github.com/certifi/python-certifi" }); + projectsModel.append({ name: "cryptography", description: catalog.i18nc("@Label", "Root Certificates for validating SSL trustworthiness"), license: "APACHE and BSD", url: "https://cryptography.io/" }); + projectsModel.append({ name: "Sentry", description: catalog.i18nc("@Label", "Python Error tracking library"), license: "BSD 2-Clause 'Simplified'", url: "https://sentry.io/for/python/" }); + projectsModel.append({ name: "libnest2d", description: catalog.i18nc("@label", "Polygon packing library, developed by Prusa Research"), license: "LGPL", url: "https://github.com/tamasmeszaros/libnest2d" }); + projectsModel.append({ name: "pynest2d", description: catalog.i18nc("@label", "Python bindings for libnest2d"), license: "LGPL", url: "https://github.com/Ultimaker/pynest2d" }); + projectsModel.append({ name: "keyring", description: catalog.i18nc("@label", "Support library for system keyring access"), license: "MIT", url: "https://github.com/jaraco/keyring" }); + projectsModel.append({ name: "pywin32", description: catalog.i18nc("@label", "Python extensions for Microsoft Windows"), license: "PSF", url: "https://github.com/mhammond/pywin32" }); + projectsModel.append({ name: "Noto Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://www.google.com/get/noto/" }); + projectsModel.append({ name: "Font-Awesome-SVG-PNG", description: catalog.i18nc("@label", "SVG icons"), license: "SIL OFL 1.1", url: "https://github.com/encharm/Font-Awesome-SVG-PNG" }); + projectsModel.append({ name: "AppImageKit", description: catalog.i18nc("@label", "Linux cross-distribution application deployment"), license: "MIT", url: "https://github.com/AppImage/AppImageKit" }); } } - rightButtons: Button + rightButtons: Cura.TertiaryButton { //: Close about dialog button id: closeButton - text: catalog.i18nc("@action:button","Close"); - - onClicked: base.visible = false; + text: catalog.i18nc("@action:button", "Close") + onClicked: reject() } } diff --git a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml index 53596d39ec..23e01b5e46 100644 --- a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml +++ b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml @@ -1,12 +1,9 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Window 2.1 import UM 1.5 as UM import Cura 1.0 as Cura @@ -77,17 +74,13 @@ UM.Dialog Column { anchors.fill: parent - anchors.leftMargin: 20 * screenScaleFactor - anchors.rightMargin: 20 * screenScaleFactor - anchors.bottomMargin: 10 * screenScaleFactor - spacing: 10 * screenScaleFactor + spacing: UM.Theme.getSize("default_margin").height - Label + UM.Label { id: questionText + width: parent.width text: catalog.i18nc("@text:window", "This is a Cura project file. Would you like to open it as a project or import the models from it?") - anchors.left: parent.left - anchors.right: parent.right font: UM.Theme.getFont("default") wrapMode: Text.WordWrap } @@ -98,29 +91,24 @@ UM.Dialog text: catalog.i18nc("@text:window", "Remember my choice") checked: UM.Preferences.getValue("cura/choice_on_open_project") != "always_ask" } - - // Buttons - Item { - id: buttonBar - anchors.right: parent.right - anchors.left: parent.left - height: childrenRect.height - - Button { - id: openAsProjectButton - text: catalog.i18nc("@action:button", "Open as project") - anchors.right: importModelsButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - isDefault: true - onClicked: loadProjectFile() - } - - Button { - id: importModelsButton - text: catalog.i18nc("@action:button", "Import models") - anchors.right: parent.right - onClicked: loadModelFiles() - } - } } + + onAccepted: loadProjectFile() + onRejected: loadModelFiles() + + buttonSpacing: UM.Theme.getSize("thin_margin").width + + rightButtons: + [ + Cura.PrimaryButton + { + text: catalog.i18nc("@action:button", "Open as project") + onClicked: loadProjectFile() + }, + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Import models") + onClicked: loadModelFiles() + } + ] } diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index 0a9d317d2d..11aeac1722 100644 --- a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml @@ -1,23 +1,30 @@ -// Copyright (c) 2020 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. +import Qt.labs.qmlmodels 1.0 import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Controls 2.15 as NewControls -import QtQuick.Dialogs 1.2 -import QtQuick.Window 2.1 +import QtQuick.Controls 2.15 -import UM 1.2 as UM -import Cura 1.0 as Cura +import UM 1.5 as UM +import Cura 1.6 as Cura UM.Dialog { id: base title: catalog.i18nc("@title:window", "Discard or Keep changes") + onAccepted: CuraApplication.discardOrKeepProfileChangesClosed("discard") + onRejected: CuraApplication.discardOrKeepProfileChangesClosed("keep") + minimumWidth: UM.Theme.getSize("popup_dialog").width minimumHeight: UM.Theme.getSize("popup_dialog").height - property var changesModel: Cura.UserChangesModel{ id: userChangesModel} + width: minimumWidth + height: minimumHeight + + margin: UM.Theme.getSize("thick_margin").width + + property var changesModel: Cura.UserChangesModel { id: userChangesModel } + onVisibilityChanged: { if(visible) @@ -37,119 +44,59 @@ UM.Dialog } } - Row + UM.Label { - id: infoTextRow - height: childrenRect.height - anchors.margins: UM.Theme.getSize("default_margin").width + id: infoText + text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings. Would you like to Keep these changed settings after switching profiles? Alternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMap["main"]) anchors.left: parent.left anchors.right: parent.right - anchors.top: parent.top - spacing: UM.Theme.getSize("default_margin").width + wrapMode: Text.WordWrap UM.I18nCatalog { - id: catalog; + id: catalog name: "cura" } - - Label - { - text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings.\nWould you like to Keep these changed settings after switching profiles?\nAlternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMap["main"]) - anchors.margins: UM.Theme.getSize("default_margin").width - wrapMode: Text.WordWrap - } } Item { - anchors.margins: UM.Theme.getSize("default_margin").width - anchors.top: infoTextRow.bottom - anchors.bottom: optionRow.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.top: infoText.bottom + anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right - TableView + + Cura.TableView { - anchors.fill: parent - height: base.height - 150 id: tableView - Component - { - id: labelDelegate - Label - { - property var extruder_name: userChangesModel.getItem(styleData.row).extruder - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - elide: Text.ElideRight - font: UM.Theme.getFont("system") - text: - { - var result = styleData.value - if (extruder_name != "") - { - result += " (" + extruder_name + ")" - } - return result - } - } - } + anchors.fill: parent - Component + columnHeaders: [ + catalog.i18nc("@title:column", "Profile settings"), + Cura.MachineManager.activeQualityDisplayNameMap["main"], + catalog.i18nc("@title:column", "Current changes") + ] + model: TableModel { - id: defaultDelegate - Label - { - text: styleData.value - font: UM.Theme.getFont("system") - } + TableModelColumn { display: "label" } + TableModelColumn { display: "original_value" } + TableModelColumn { display: "user_value" } + rows: userChangesModel.items } - - TableViewColumn - { - role: "label" - title: catalog.i18nc("@title:column", "Profile settings") - delegate: labelDelegate - width: (tableView.width * 0.4) | 0 - } - TableViewColumn - { - role: "original_value" - title: Cura.MachineManager.activeQualityDisplayNameMap["main"] - width: (tableView.width * 0.3) | 0 - delegate: defaultDelegate - } - TableViewColumn - { - role: "user_value" - title: catalog.i18nc("@title:column", "Current changes") - width: (tableView.width * 0.3) | 0 - } - section.property: "category" - section.delegate: Label - { - text: section - font.bold: true - } - - model: userChangesModel + sectionRole: "category" } } - Item - { - id: optionRow - anchors.bottom: buttonsRow.top - anchors.right: parent.right - anchors.left: parent.left - anchors.margins: UM.Theme.getSize("default_margin").width - height: childrenRect.height + buttonSpacing: UM.Theme.getSize("thin_margin").width - NewControls.ComboBox + leftButtons: [ + Cura.ComboBox { + implicitHeight: UM.Theme.getSize("combobox_wide").height + implicitWidth: UM.Theme.getSize("combobox_wide").width + id: discardOrKeepProfileChangesDropDownButton - width: 300 textRole: "text" model: ListModel @@ -182,41 +129,21 @@ UM.Dialog } } } - } + ] - Item - { - id: buttonsRow - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.left: parent.left - anchors.margins: UM.Theme.getSize("default_margin").width - height: childrenRect.height - - Button + rightButtons: + [ + Cura.PrimaryButton { id: discardButton - text: catalog.i18nc("@action:button", "Discard changes"); - anchors.right: parent.right - onClicked: - { - CuraApplication.discardOrKeepProfileChangesClosed("discard") - base.hide() - } - isDefault: true - } - - Button + text: catalog.i18nc("@action:button", "Discard changes") + onClicked: base.accept() + }, + Cura.SecondaryButton { id: keepButton - text: catalog.i18nc("@action:button", "Keep changes"); - anchors.right: discardButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - onClicked: - { - CuraApplication.discardOrKeepProfileChangesClosed("keep") - base.hide() - } + text: catalog.i18nc("@action:button", "Keep changes") + onClicked: base.reject() } - } + ] } diff --git a/resources/qml/Dialogs/MessageDialog.qml b/resources/qml/Dialogs/MessageDialog.qml new file mode 100644 index 0000000000..0735064548 --- /dev/null +++ b/resources/qml/Dialogs/MessageDialog.qml @@ -0,0 +1,20 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import UM 1.5 as UM +import Cura 1.5 as Cura + +// Wrapper around the UM.MessageBox with the primary/secondarybuttons +// set to Cura.PrimaryButton and Cura.SecondaryButton respectively +UM.MessageDialog +{ + primaryButton: Cura.PrimaryButton + { + text: model.text + } + + secondaryButton: Cura.TertiaryButton + { + text: model.text + } +} \ No newline at end of file diff --git a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml index 3f1900c66b..8e4cea1bdd 100644 --- a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml +++ b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml @@ -1,15 +1,12 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Window 2.1 -import UM 1.3 as UM -import Cura 1.0 as Cura +import UM 1.5 as UM +import Cura 1.5 as Cura UM.Dialog { @@ -17,9 +14,9 @@ UM.Dialog id: base title: catalog.i18nc("@title:window", "Open file(s)") - width: 420 * screenScaleFactor - height: 170 * screenScaleFactor + width: UM.Theme.getSize("small_popup_dialog").width + height: UM.Theme.getSize("small_popup_dialog").height maximumHeight: height maximumWidth: width minimumHeight: height @@ -29,12 +26,6 @@ UM.Dialog property var fileUrls: [] property var addToRecent: true - property int spacerHeight: 10 * screenScaleFactor - - function loadProjectFile(projectFile) - { - UM.WorkspaceFileHandler.readLocalFile(projectFile, base.addToRecent); - } function loadModelFiles(fileUrls) { @@ -44,70 +35,29 @@ UM.Dialog } } - Column + onAccepted: loadModelFiles(base.fileUrls) + + UM.Label { - anchors.fill: parent - anchors.leftMargin: 20 * screenScaleFactor - anchors.rightMargin: 20 * screenScaleFactor - anchors.bottomMargin: 20 * screenScaleFactor + text: catalog.i18nc("@text:window", "We have found one or more project file(s) within the files you have selected. You can open only one project file at a time. We suggest to only import models from those files. Would you like to proceed?") anchors.left: parent.left anchors.right: parent.right - spacing: 10 * screenScaleFactor - - Label - { - text: catalog.i18nc("@text:window", "We have found one or more project file(s) within the files you have selected. You can open only one project file at a time. We suggest to only import models from those files. Would you like to proceed?") - anchors.left: parent.left - anchors.right: parent.right - font: UM.Theme.getFont("default") - wrapMode: Text.WordWrap - } - - Item // Spacer - { - height: base.spacerHeight - width: height - } - - // Buttons - Item - { - anchors.right: parent.right - anchors.left: parent.left - height: childrenRect.height - - Button - { - id: cancelButton - text: catalog.i18nc("@action:button", "Cancel"); - anchors.right: importAllAsModelsButton.left - onClicked: - { - // cancel - base.hide(); - } - } - - Button - { - id: importAllAsModelsButton - text: catalog.i18nc("@action:button", "Import all as models"); - anchors.right: parent.right - isDefault: true - onClicked: - { - // load models from all selected file - loadModelFiles(base.fileUrls); - - base.hide(); - } - } - } - - UM.I18nCatalog - { - id: catalog - name: "cura" - } } + + buttonSpacing: UM.Theme.getSize("thin_margin").width + + // Buttons + rightButtons: + [ + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Cancel"); + onClicked: base.reject() + }, + Cura.PrimaryButton + { + text: catalog.i18nc("@action:button", "Import all as models"); + onClicked: base.accept() + } + ] } \ No newline at end of file diff --git a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml index b426f03471..c5c7248a98 100644 --- a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml +++ b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml @@ -1,11 +1,9 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls 2.0 as Controls2 +import QtQuick.Controls 2.9 import QtQuick.Layouts 1.3 -import QtQuick.Window 2.2 import UM 1.5 as UM import Cura 1.0 as Cura @@ -15,26 +13,14 @@ UM.Dialog id: base title: catalog.i18nc("@title:window", "Save Project") - minimumWidth: 500 * screenScaleFactor - minimumHeight: 400 * screenScaleFactor + minimumWidth: UM.Theme.getSize("popup_dialog").width + minimumHeight: UM.Theme.getSize("popup_dialog").height width: minimumWidth height: minimumHeight - property int spacerHeight: 10 * screenScaleFactor - property bool dontShowAgain: true - signal yes(); - - function accept() { // pressing enter will call this function - close(); - yes(); - } - - onClosing: - { - UM.Preferences.setValue("cura/dialog_on_project_save", !dontShowAgainCheckbox.checked) - } + onClosing: UM.Preferences.setValue("cura/dialog_on_project_save", !dontShowAgainCheckbox.checked) onVisibleChanged: { @@ -59,11 +45,7 @@ UM.Dialog visibilityHandler: UM.SettingPreferenceVisibilityHandler { } } - SystemPalette - { - id: palette - } - Label + UM.Label { id: mainHeading width: parent.width @@ -79,16 +61,28 @@ UM.Dialog { top: mainHeading.bottom topMargin: UM.Theme.getSize("default_margin").height - bottom: controls.top + bottom: parent.bottom bottomMargin: UM.Theme.getSize("default_margin").height } - style: UM.Theme.styles.scrollview + + ScrollBar.vertical: UM.ScrollBar + { + parent: scroll + anchors + { + top: parent.top + right: parent.right + bottom: parent.bottom + } + } + clip: true + ColumnLayout { spacing: UM.Theme.getSize("default_margin").height Column { - Label + UM.Label { id: settingsHeading text: catalog.i18nc("@action:label", "Printer settings") @@ -98,14 +92,14 @@ UM.Dialog { width: parent.width height: childrenRect.height - Label + UM.Label { text: catalog.i18nc("@action:label", "Type") width: Math.floor(scroll.width / 3) | 0 } - Label + UM.Label { - text: (Cura.MachineManager.activeMachine == null) ? "" : Cura.MachineManager.activeMachine.definition.name + text: Cura.MachineManager.activeMachine == null ? "" : Cura.MachineManager.activeMachine.definition.name width: Math.floor(scroll.width / 3) | 0 } } @@ -113,12 +107,12 @@ UM.Dialog { width: parent.width height: childrenRect.height - Label + UM.Label { text: Cura.MachineManager.activeMachineNetworkGroupName != "" ? catalog.i18nc("@action:label", "Printer Group") : catalog.i18nc("@action:label", "Name") width: Math.floor(scroll.width / 3) | 0 } - Label + UM.Label { text: { @@ -157,7 +151,7 @@ UM.Dialog var material_name = extruder.material.name return (material_name !== undefined) ? material_name : "" } - Label + UM.Label { text: { var extruder = Number(modelData.position) @@ -181,7 +175,7 @@ UM.Dialog width: parent.width height: childrenRect.height - Label + UM.Label { text: { @@ -194,7 +188,7 @@ UM.Dialog width: Math.floor(scroll.width / 3) | 0 enabled: modelData.isEnabled } - Label + UM.Label { text: { @@ -214,7 +208,7 @@ UM.Dialog { width: parent.width height: childrenRect.height - Label + UM.Label { text: catalog.i18nc("@action:label", "Profile settings") font.bold: true @@ -222,12 +216,12 @@ UM.Dialog Row { width: parent.width - Label + UM.Label { text: catalog.i18nc("@action:label", "Not in profile") width: Math.floor(scroll.width / 3) | 0 } - Label + UM.Label { text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", Cura.MachineManager.numUserSettings).arg(Cura.MachineManager.numUserSettings) width: Math.floor(scroll.width / 3) | 0 @@ -238,12 +232,12 @@ UM.Dialog { width: parent.width height: childrenRect.height - Label + UM.Label { text: catalog.i18nc("@action:label", "Name") width: Math.floor(scroll.width / 3) | 0 } - Label + UM.Label { text: Cura.MachineManager.activeQualityOrQualityChangesName width: Math.floor(scroll.width / 3) | 0 @@ -255,12 +249,12 @@ UM.Dialog { width: parent.width height: childrenRect.height - Label + UM.Label { text: catalog.i18nc("@action:label", "Intent") width: Math.floor(scroll.width / 3) | 0 } - Label + UM.Label { text: Cura.MachineManager.activeIntentCategory width: Math.floor(scroll.width / 3) | 0 @@ -269,43 +263,31 @@ UM.Dialog } } } - Item - { - id: controls - width: parent.width - height: childrenRect.height - anchors.bottom: parent.bottom - UM.CheckBox - { - id: dontShowAgainCheckbox - anchors.left: parent.left - text: catalog.i18nc("@action:label", "Don't show project summary on save again") - checked: dontShowAgain - } - Controls2.Button - { - id: cancel_button - anchors - { - right: ok_button.left - rightMargin: UM.Theme.getSize("default_margin").width - } - text: catalog.i18nc("@action:button","Cancel"); - enabled: true - onClicked: close() - } - Controls2.Button - { - id: ok_button - anchors.right: parent.right - text: catalog.i18nc("@action:button","Save"); - enabled: true - onClicked: - { - close() - yes() - } - } - } } + + buttonSpacing: UM.Theme.getSize("thin_margin").width + + leftButtons: + [ + UM.CheckBox + { + id: dontShowAgainCheckbox + text: catalog.i18nc("@action:label", "Don't show project summary on save again") + checked: dontShowAgain + } + ] + + rightButtons: + [ + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Cancel") + onClicked: base.reject() + }, + Cura.PrimaryButton + { + text: catalog.i18nc("@action:button", "Save") + onClicked: base.accept() + } + ] } diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 694cfb9e2e..e5eab3bd93 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura // The expandable component has 2 major sub components: @@ -30,8 +30,8 @@ Item property color contentBackgroundColor: UM.Theme.getColor("action_button") property color headerBackgroundColor: UM.Theme.getColor("action_button") - property color headerActiveColor: UM.Theme.getColor("secondary") - property color headerHoverColor: UM.Theme.getColor("action_button_hovered") + property color headerActiveColor: UM.Theme.getColor("expandable_active") + property color headerHoverColor: UM.Theme.getColor("expandable_hover") property alias enabled: mouseArea.enabled @@ -126,7 +126,7 @@ Item color: base.enabled ? (base.expanded ? headerActiveColor : headerBackgroundColor) : UM.Theme.getColor("disabled") anchors.fill: parent - Label + UM.Label { id: disabledLabel visible: !base.enabled @@ -134,10 +134,6 @@ Item leftPadding: background.padding rightPadding: background.padding text: "" - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("text") wrapMode: Text.WordWrap } diff --git a/resources/qml/ExpandableComponentHeader.qml b/resources/qml/ExpandableComponentHeader.qml index 7dd1aa358a..7176f0978b 100644 --- a/resources/qml/ExpandableComponentHeader.qml +++ b/resources/qml/ExpandableComponentHeader.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura // Header of the popup @@ -16,20 +16,17 @@ Cura.RoundedRectangle property alias xPosCloseButton: closeButton.left height: UM.Theme.getSize("expandable_component_content_header").height - color: UM.Theme.getColor("secondary") + color: UM.Theme.getColor("background_1") cornerSide: Cura.RoundedRectangle.Direction.Up border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width - Label + UM.Label { id: headerLabel text: "" font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("small_button_text") height: parent.height anchors diff --git a/resources/qml/ExpandablePopup.qml b/resources/qml/ExpandablePopup.qml index 39f2ced8aa..219608a762 100644 --- a/resources/qml/ExpandablePopup.qml +++ b/resources/qml/ExpandablePopup.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura // The expandable component has 2 major sub components: @@ -30,8 +30,8 @@ Item property color contentBackgroundColor: UM.Theme.getColor("action_button") property color headerBackgroundColor: UM.Theme.getColor("action_button") - property color headerActiveColor: UM.Theme.getColor("secondary") - property color headerHoverColor: UM.Theme.getColor("action_button_hovered") + property color headerActiveColor: UM.Theme.getColor("expandable_active") + property color headerHoverColor: UM.Theme.getColor("expandable_hover") property alias mouseArea: headerMouseArea property alias enabled: headerMouseArea.enabled @@ -120,16 +120,12 @@ Item color: base.enabled ? headerBackgroundColor : UM.Theme.getColor("disabled") anchors.fill: parent - Label + UM.Label { id: disabledLabel visible: !base.enabled leftPadding: background.padding text: "" - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("text") height: parent.height } diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index 8d5852823d..b9141a449a 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -2,8 +2,7 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.11 -import QtQuick.Controls 1.1 -import UM 1.2 as UM +import UM 1.5 as UM Item { @@ -43,18 +42,15 @@ Item color: extruderNumberText.color } - Label + UM.Label { id: extruderNumberText anchors.centerIn: parent text: index + 1 font: UM.Theme.getFont("small_emphasis") - color: UM.Theme.getColor("text") width: contentWidth height: contentHeight - renderType: Text.NativeRendering horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter } } } diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml index e582aa5939..8a76481da9 100644 --- a/resources/qml/IconWithText.qml +++ b/resources/qml/IconWithText.qml @@ -5,7 +5,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura // Reusable component that holds an (re-colorable) icon on the left with some text on the right. @@ -49,15 +49,10 @@ Item } } - Label + UM.Label { id: label - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - anchors { left: icon.right diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 4aa5fa8bd5..03978cb69e 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -1,12 +1,11 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 -import UM 1.1 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item @@ -29,7 +28,8 @@ Item { if (!activity) { - //When there is no mesh in the buildplate; the printJobTextField is set to an empty string so it doesn't set an empty string as a jobName (which is later used for saving the file) + // When there is no mesh in the buildplate; the printJobTextField is set to an empty string so it doesn't + // set an empty string as a jobName (which is later used for saving the file) PrintInformation.baseName = "" } } @@ -41,35 +41,21 @@ Item anchors.left: parent.left height: UM.Theme.getSize("jobspecs_line").height - Button + UM.SimpleButton { id: printJobPencilIcon anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter width: UM.Theme.getSize("save_button_specs_icons").width height: UM.Theme.getSize("save_button_specs_icons").height - + iconSource: UM.Theme.getIcon("Pen") + hoverColor: UM.Theme.getColor("small_button_text_hover") + color: UM.Theme.getColor("small_button_text") onClicked: { printJobTextfield.selectAll() printJobTextfield.focus = true } - - style: ButtonStyle - { - background: Item - { - UM.RecolorImage - { - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: control.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") - source: UM.Theme.getIcon("Pen") - } - } - } } TextField @@ -78,9 +64,9 @@ Item anchors.left: printJobPencilIcon.right anchors.leftMargin: UM.Theme.getSize("narrow_margin").width height: UM.Theme.getSize("jobspecs_line").height - width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50) + width: Math.max(contentWidth + UM.Theme.getSize("default_margin").width, 50) maximumLength: 120 - text: (PrintInformation === null) ? "" : PrintInformation.jobName + text: PrintInformation === null ? "" : PrintInformation.jobName horizontalAlignment: TextInput.AlignLeft property string textBeforeEdit: "" @@ -105,29 +91,20 @@ Item validator: RegExpValidator { regExp: /^[^\\\/\*\?\|\[\]]*$/ } - - style: TextFieldStyle - { - textColor: UM.Theme.getColor("text_scene") - font: UM.Theme.getFont("default") - background: Rectangle - { - opacity: 0 - border.width: 0 - } - } + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text_scene") + background: Item {} + selectByMouse: true } } - Label + UM.Label { id: boundingSpec anchors.top: jobNameRow.bottom anchors.left: parent.left height: UM.Theme.getSize("jobspecs_line").height - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_scene") text: CuraApplication.getSceneBoundingBoxString } @@ -141,10 +118,7 @@ Item anchors.leftMargin: UM.Theme.getSize("default_margin").width } - Component.onCompleted: - { - base.addAdditionalComponents("jobSpecsButton") - } + Component.onCompleted: base.addAdditionalComponents("jobSpecsButton") Connections { diff --git a/resources/qml/LabelBar.qml b/resources/qml/LabelBar.qml index 007c5f1f54..1a4c891954 100644 --- a/resources/qml/LabelBar.qml +++ b/resources/qml/LabelBar.qml @@ -5,7 +5,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 -import UM 1.2 as UM +import UM 1.5 as UM // The labelBar shows a set of labels that are evenly spaced from one another. // The first item is aligned to the left, the last is aligned to the right. @@ -34,13 +34,10 @@ Item Layout.maximumWidth: Math.round(index + 1 === repeater.count || repeater.count <= 1 ? itemSize : base.width / (repeater.count - 1)) height: label.height - Label + UM.Label { id: label text: model[modelKey] - color: UM.Theme.getColor("text") - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering height: contentHeight anchors { diff --git a/resources/qml/MachineSettings/GcodeTextArea.qml b/resources/qml/MachineSettings/GcodeTextArea.qml index f8bd02de3b..5292b4f83a 100644 --- a/resources/qml/MachineSettings/GcodeTextArea.qml +++ b/resources/qml/MachineSettings/GcodeTextArea.qml @@ -1,11 +1,11 @@ -// Copyright (c) 2020 Ultimaker B.V. +// 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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -45,7 +45,7 @@ UM.TooltipArea renderType: Text.NativeRendering } - ScrollView + Flickable { anchors.top: titleLabel.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height @@ -53,26 +53,9 @@ UM.TooltipArea anchors.left: parent.left anchors.right: parent.right - background: Rectangle - { - color: UM.Theme.getColor("main_background") - anchors.fill: parent + ScrollBar.vertical: UM.ScrollBar {} - border.color: - { - if (!gcodeTextArea.enabled) - { - return UM.Theme.getColor("setting_control_disabled_border") - } - if (gcodeTextArea.hovered || gcodeTextArea.activeFocus) - { - return UM.Theme.getColor("setting_control_border_highlight") - } - return UM.Theme.getColor("setting_control_border") - } - } - - TextArea + TextArea.flickable: TextArea { id: gcodeTextArea @@ -92,6 +75,27 @@ UM.TooltipArea propertyProvider.setPropertyValue("value", text) } } + + background: Rectangle + { + color: UM.Theme.getColor("main_background") + anchors.fill: parent + anchors.margins: -border.width //Wrap the border around the parent. + + border.color: + { + if (!gcodeTextArea.enabled) + { + return UM.Theme.getColor("setting_control_disabled_border") + } + if (gcodeTextArea.hovered || gcodeTextArea.activeFocus) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") + } + border.width: UM.Theme.getSize("default_lining").width + } } } } diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index 32e0e6dcaa..0e1f296cfa 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -83,13 +83,12 @@ UM.TooltipArea height: numericTextFieldWithUnit.controlHeight // Background is a rounded-cornered box with filled color as state indication (normal, warning, error, etc.) - background: Rectangle + background: UM.UnderlineBackground { anchors.fill: parent anchors.margins: Math.round(UM.Theme.getSize("default_lining").width) - radius: UM.Theme.getSize("setting_control_radius").width - border.color: + liningColor: { if (!textFieldWithUnit.enabled) { @@ -108,9 +107,9 @@ UM.TooltipArea // Validation is OK. if (textFieldWithUnit.hovered || textFieldWithUnit.activeFocus) { - return UM.Theme.getColor("setting_control_border_highlight") + return UM.Theme.getColor("border_main_light") } - return UM.Theme.getColor("setting_control_border") + return UM.Theme.getColor("border_field_light") } color: @@ -222,7 +221,7 @@ UM.TooltipArea } } - Label + UM.Label { id: unitLabel anchors.right: parent.right @@ -230,10 +229,7 @@ UM.TooltipArea anchors.verticalCenter: parent.verticalCenter text: unitText textFormat: Text.PlainText - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering color: UM.Theme.getColor("setting_unit") - font: UM.Theme.getFont("default") } } } diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 497c5e1541..bf3781331a 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -1,13 +1,10 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.2 +import QtQuick.Controls 2.4 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura import "../Menus" @@ -16,38 +13,42 @@ import "../Dialogs" Item { id: menu - width: applicationMenu.width + width: parent.width height: applicationMenu.height - property alias window: applicationMenu.window - UM.ApplicationMenu + MenuBar { id: applicationMenu + width: parent.width + height: UM.Theme.getSize("context_menu").height - FileMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&File") } - - Menu - { - title: catalog.i18nc("@title:menu menubar:toplevel", "&Edit") - - MenuItem { action: Cura.Actions.undo } - MenuItem { action: Cura.Actions.redo } - MenuSeparator { } - MenuItem { action: Cura.Actions.selectAll } - MenuItem { action: Cura.Actions.arrangeAll } - MenuItem { action: Cura.Actions.multiplySelection } - MenuItem { action: Cura.Actions.deleteSelection } - MenuItem { action: Cura.Actions.deleteAll } - MenuItem { action: Cura.Actions.resetAllTranslation } - MenuItem { action: Cura.Actions.resetAll } - MenuSeparator { } - MenuItem { action: Cura.Actions.groupObjects } - MenuItem { action: Cura.Actions.mergeObjects } - MenuItem { action: Cura.Actions.unGroupObjects } + background: Rectangle { + color: UM.Theme.getColor("background_1") } - ViewMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&View") } + delegate: MenuBarItem + { + id: menuBarItem + contentItem: UM.Label + { + text: menuBarItem.text.replace(new RegExp("&([A-Za-z])"), function (match, character) + { + return `${character}`; + }) + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + background: Rectangle + { + color: menuBarItem.highlighted ? UM.Theme.getColor("background_2") : "transparent" + } + } + + FileMenu {} + EditMenu {} + ViewMenu {} SettingsMenu { //On MacOS, don't translate the "Settings" word. @@ -59,93 +60,11 @@ Item //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar title: (Qt.platform.os == "osx") ? "&Settings" : catalog.i18nc("@title:menu menubar:toplevel", "&Settings") } - - Menu - { - id: extensionMenu - title: catalog.i18nc("@title:menu menubar:toplevel", "E&xtensions") - - Instantiator - { - id: extensions - model: UM.ExtensionModel { } - - Menu - { - id: sub_menu - title: model.name; - visible: actions != null - enabled: actions != null - Instantiator - { - model: actions - Loader - { - property var extensionsModel: extensions.model - property var modelText: model.text - property var extensionName: name - - sourceComponent: modelText.trim() == "" ? extensionsMenuSeparator : extensionsMenuItem - } - - onObjectAdded: sub_menu.insertItem(index, object.item) - onObjectRemoved: sub_menu.removeItem(object.item) - } - } - - onObjectAdded: extensionMenu.insertItem(index, object) - onObjectRemoved: extensionMenu.removeItem(object) - } - } - - Menu - { - id: preferencesMenu - - //On MacOS, don't translate the "Preferences" word. - //Qt moves the "preferences" entry to a different place, and if it got renamed can't find it again when it - //attempts to delete the item upon closing the application, causing a crash. - //In the new location, these items are translated automatically according to the system's language. - //For more information, see: - //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar - //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar - title: (Qt.platform.os == "osx") ? "&Preferences" : catalog.i18nc("@title:menu menubar:toplevel", "P&references") - - MenuItem { action: Cura.Actions.preferences } - } - - Menu - { - id: helpMenu - title: catalog.i18nc("@title:menu menubar:toplevel", "&Help") - - MenuItem { action: Cura.Actions.showProfileFolder } - MenuItem { action: Cura.Actions.showTroubleshooting} - MenuItem { action: Cura.Actions.documentation } - MenuItem { action: Cura.Actions.reportBug } - MenuSeparator { } - MenuItem { action: Cura.Actions.whatsNew } - MenuItem { action: Cura.Actions.about } - } + ExtensionMenu { id: extensionMenu } + PreferencesMenu {} + HelpMenu {} } - Component - { - id: extensionsMenuItem - - MenuItem - { - text: modelText - onTriggered: extensionsModel.subMenuTriggered(extensionName, modelText) - } - } - - Component - { - id: extensionsMenuSeparator - - MenuSeparator {} - } // ############################################################################################### @@ -156,18 +75,17 @@ Item { id: saveWorkspaceDialog property var args - onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) + onAccepted: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) } - MessageDialog + Cura.MessageDialog { id: newProjectDialog - modality: Qt.ApplicationModal + title: catalog.i18nc("@title:window", "New project") text: catalog.i18nc("@info:question", "Are you sure you want to start a new project? This will clear the build plate and any unsaved settings.") - standardButtons: StandardButton.Yes | StandardButton.No - icon: StandardIcon.Question - onYes: + standardButtons: Dialog.Yes | Dialog.No + onAccepted: { CuraApplication.resetWorkspace() Cura.Actions.resetProfile.trigger() @@ -175,11 +93,6 @@ Item } } - UM.ExtensionModel - { - id: curaExtensions - } - // ############################################################################################### // Definition of all the connections // ############################################################################################### @@ -196,13 +109,13 @@ Item } } - // show the Marketplace + // show the Toolbox Connections { - target: Cura.Actions.openMarketplace + target: Cura.Actions.browsePackages function onTriggered() { - curaExtensions.callExtensionMethod("Marketplace", "show") + extensionMenu.extensionModel.callExtensionMethod("Marketplace", "show") } } @@ -212,8 +125,8 @@ Item target: Cura.Actions.marketplaceMaterials function onTriggered() { - curaExtensions.callExtensionMethod("Marketplace", "show") - curaExtensions.callExtensionMethod("Marketplace", "setVisibleTabToMaterials") + extensionMenu.extensionModel.callExtensionMethod("Marketplace", "show") + extensionMenu.extensionModel.callExtensionMethod("Marketplace", "setVisibleTabToMaterials") } } } diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index 16d7d69062..3f22879992 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -1,12 +1,10 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 2.0 as Controls2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls 2.4 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.0 as Cura import "../Account" @@ -33,6 +31,10 @@ Item sourceSize.width: width sourceSize.height: height } + ButtonGroup + { + buttons: stagesListContainer.children + } Row { @@ -61,15 +63,60 @@ Item checked: UM.Controller.activeStage !== null && model.id == UM.Controller.activeStage.stageId anchors.verticalCenter: parent.verticalCenter - exclusiveGroup: mainWindowHeaderMenuGroup - style: UM.Theme.styles.main_window_header_tab + //style: UM.Theme.styles.main_window_header_tab height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) - iconSource: model.stage.iconSource - - property color overlayColor: "transparent" - property string overlayIconSource: "" // This id is required to find the stage buttons through Squish property string stageId: model.id + hoverEnabled: true + leftPadding: 2 * UM.Theme.getSize("default_margin").width + rightPadding: 2 * UM.Theme.getSize("default_margin").width + + // Set top & bottom padding to whatever space is left from height and the size of the text. + bottomPadding: Math.round((height - buttonLabel.contentHeight) / 2) + topPadding: bottomPadding + + background: Rectangle + { + radius: UM.Theme.getSize("action_button_radius").width + color: + { + if (stageSelectorButton.checked) + { + return UM.Theme.getColor("main_window_header_button_background_active") + } + else + { + if (stageSelectorButton.hovered) + { + return UM.Theme.getColor("main_window_header_button_background_hovered") + } + return UM.Theme.getColor("main_window_header_button_background_inactive") + } + } + } + + contentItem: UM.Label + { + id: buttonLabel + text: stageSelectorButton.text + anchors.centerIn: stageSelectorButton + font: UM.Theme.getFont("medium") + color: + { + if (stageSelectorButton.checked) + { + return UM.Theme.getColor("main_window_header_button_text_active") + } + else + { + if (stageSelectorButton.hovered) + { + return UM.Theme.getColor("main_window_header_button_text_hovered") + } + return UM.Theme.getColor("main_window_header_button_text_inactive") + } + } + } // This is a trick to assure the activeStage is correctly changed. It doesn't work properly if done in the onClicked (see CURA-6028) MouseArea @@ -79,35 +126,21 @@ Item } } } - - ExclusiveGroup { id: mainWindowHeaderMenuGroup } } - Controls2.Button + // Shortcut button to quick access the Toolbox + Button { id: marketplaceButton + text: catalog.i18nc("@action:button", "Marketplace") height: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) - anchors - { - verticalCenter: parent.verticalCenter - right: applicationSwitcher.left - rightMargin: UM.Theme.getSize("default_margin").width - } + onClicked: Cura.Actions.browsePackages.trigger() hoverEnabled: true - onClicked: Cura.Actions.openMarketplace.trigger() - - contentItem: Label - { - text: "Marketplace" //Ultimaker considers this a product name, so it shouldn't be translated. - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("primary_text") - width: contentWidth - verticalAlignment: Text.AlignVCenter - } background: Rectangle { + id: marketplaceButtonBorder radius: UM.Theme.getSize("action_button_radius").width color: UM.Theme.getColor("main_window_header_background") border.width: UM.Theme.getSize("default_lining").width @@ -115,6 +148,7 @@ Item Rectangle { + id: marketplaceButtonFill anchors.fill: parent radius: parent.radius color: UM.Theme.getColor("primary_text") @@ -123,12 +157,30 @@ Item } } + contentItem: UM.Label + { + id: label + text: marketplaceButton.text + color: UM.Theme.getColor("primary_text") + width: contentWidth + } + + anchors + { + right: applicationSwitcher.left + rightMargin: UM.Theme.getSize("default_margin").width + verticalCenter: parent.verticalCenter + } + Cura.NotificationIcon { + id: marketplaceNotificationIcon anchors { - horizontalCenter: parent.right - verticalCenter: parent.top + top: parent.top + right: parent.right + rightMargin: (-0.5 * width) | 0 + topMargin: (-0.5 * height) | 0 } visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0 diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 85b653721f..49d6710606 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Button @@ -99,7 +99,7 @@ Button height: width } - Label + UM.Label { id: unknownMaterialMessage text: @@ -147,10 +147,6 @@ Button anchors.top: unknownMaterial.top wrapMode: Text.WordWrap - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter - linkColor: UM.Theme.getColor("text_link") onLinkActivated: { diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index de70b0e0f4..1867ed6a4a 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item @@ -67,18 +67,14 @@ Item contentHeight: configurationList.height clip: true - ScrollBar.vertical.policy: (configurationList.height > maximumHeight) ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff //The AsNeeded policy also hides it when the cursor is away, and we don't want that. - ScrollBar.vertical.background: Rectangle - { - implicitWidth: UM.Theme.getSize("scrollbar").width - radius: width / 2 - color: UM.Theme.getColor("scrollbar_background") - } - ScrollBar.vertical.contentItem: Rectangle - { - implicitWidth: UM.Theme.getSize("scrollbar").width - radius: width / 2 - color: UM.Theme.getColor(parent.pressed ? "scrollbar_handle_down" : parent.hovered ? "scrollbar_handle_hover" : "scrollbar_handle") + ScrollBar.vertical: UM.ScrollBar { + parent: container + anchors + { + top: parent.top + right: parent.right + bottom: parent.bottom + } } ButtonGroup diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index 37ff585a6b..6f7ee90733 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -3,10 +3,9 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 -import UM 1.4 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -19,7 +18,7 @@ Cura.ExpandablePopup id: base property var extrudersModel: CuraApplication.getExtrudersModel() - + property var activeMachine: Cura.MachineManager.activeMachine UM.I18nCatalog { id: catalog @@ -33,7 +32,7 @@ Cura.ExpandablePopup } contentPadding: UM.Theme.getSize("default_lining").width - enabled: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.hasMaterials || Cura.MachineManager.activeMachine.hasVariants || Cura.MachineManager.activeMachine.hasVariantBuildplates : false; //Only let it drop down if there is any configuration that you could change. + enabled: activeMachine ? activeMachine.hasMaterials || activeMachine.hasVariants || activeMachine.hasVariantBuildplates : false; //Only let it drop down if there is any configuration that you could change. headerItem: Item { @@ -44,7 +43,7 @@ Cura.ExpandablePopup anchors.bottom: parent.bottom anchors.left: parent.left width: parent.width - UM.Theme.getSize("standard_arrow").width - visible: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.hasMaterials : false + visible: activeMachine ? activeMachine.hasMaterials : false Repeater { model: extrudersModel @@ -56,9 +55,9 @@ Cura.ExpandablePopup Layout.maximumWidth: Math.round(parent.width / extrudersModel.count) Layout.fillHeight: true - property var extruderStack: Cura.MachineManager.activeMachine.extruders[model.index] + property var extruderStack: activeMachine ? activeMachine.extruders[model.index]: null property bool valueWarning: !Cura.ExtruderManager.getExtruderHasQualityForMaterial(extruderStack) - property bool valueError: Cura.ContainerManager.getContainerMetaDataEntry(extruderStack.material.id, "compatible", "") != "True" + property bool valueError: activeMachine ? Cura.ContainerManager.getContainerMetaDataEntry(extruderStack.material.id, "compatible", "") != "True" : false // Extruder icon. Shows extruder index and has the same color as the active material. Cura.ExtruderIcon @@ -190,56 +189,49 @@ Cura.ExpandablePopup rightMargin: UM.Theme.getSize("default_margin").width } // Label for the brand of the material - Label + UM.Label { id: materialBrandNameLabel text: model.material_brand + " " + model.material_name elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering + wrapMode: Text.NoWrap width: parent.width visible: !truncated } - Label + UM.Label { id: materialNameLabel text: model.material_name elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering width: parent.width + wrapMode: Text.NoWrap visible: !materialBrandNameLabel.visible && !truncated } - Label + UM.Label { id: materialTypeLabel text: model.material_type elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering width: parent.width + wrapMode: Text.NoWrap visible: !materialBrandNameLabel.visible && !materialNameLabel.visible } // Label that shows the name of the variant - Label + UM.Label { id: variantLabel - visible: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.hasVariants : false + visible: activeMachine ? activeMachine.hasVariants : false text: model.variant elide: Text.ElideRight + wrapMode: Text.NoWrap font: UM.Theme.getFont("default_bold") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering Layout.preferredWidth: parent.width } } @@ -248,15 +240,13 @@ Cura.ExpandablePopup } // Placeholder text if there is a configuration to select but no materials (so we can't show the materials per extruder). - Label + UM.Label { text: catalog.i18nc("@label", "Select configuration") elide: Text.ElideRight font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering - visible: Cura.MachineManager.activeMachine ? !Cura.MachineManager.activeMachine.hasMaterials && (Cura.MachineManager.activeMachine.hasVariants || Cura.MachineManager.activeMachine.hasVariantBuildplates) : false + visible: activeMachine ? !activeMachine.hasMaterials && (activeMachine.hasVariants || activeMachine.hasVariantBuildplates) : false anchors { @@ -281,7 +271,7 @@ Cura.ExpandablePopup onVisibleChanged: { - is_connected = Cura.MachineManager.activeMachine.hasRemoteConnection && Cura.MachineManager.printerConnected && Cura.MachineManager.printerOutputDevices[0].uniqueConfigurations.length > 0 //Re-evaluate. + is_connected = activeMachine.hasRemoteConnection && Cura.MachineManager.printerConnected && Cura.MachineManager.printerOutputDevices[0].uniqueConfigurations.length > 0 //Re-evaluate. // If the printer is not connected or does not have configurations, we switch always to the custom mode. If is connected instead, the auto mode // or the previous state is selected diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 8376693ad1..f3cef1a819 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -1,12 +1,14 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.6 import QtQuick.Controls 2.0 -import QtQuick.Controls 1.1 as OldControls import Cura 1.0 as Cura -import UM 1.3 as UM +import UM 1.5 as UM + +// Simple button for displaying text and changes appearance for various states: enabled, valueError, valueWarning +// - and hovered. Mainly used in CustomConfiguration.qml Item { @@ -19,14 +21,13 @@ Item width: parent.width height: childrenRect.height - Label + UM.Label { id: header text: catalog.i18nc("@header", "Custom") font: UM.Theme.getFont("medium") color: UM.Theme.getColor("small_button_text") height: contentHeight - renderType: Text.NativeRendering anchors { @@ -36,7 +37,7 @@ Item } } - //Printer type selector. + // Printer type selector. Item { id: printerTypeSelectorRow @@ -56,28 +57,27 @@ Item topMargin: visible ? UM.Theme.getSize("default_margin").height : 0 } - Label + UM.Label { text: catalog.i18nc("@label", "Printer") width: Math.round(parent.width * 0.3) - UM.Theme.getSize("default_margin").width height: contentHeight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") anchors.verticalCenter: printerTypeSelector.verticalCenter anchors.left: parent.left } - OldControls.ToolButton + Button { id: printerTypeSelector text: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.name: "" - tooltip: text + height: UM.Theme.getSize("print_setup_big_item").height width: Math.round(parent.width * 0.7) + UM.Theme.getSize("default_margin").width anchors.right: parent.right - style: UM.Theme.styles.print_setup_header_button + onClicked: menu.open() + //style: UM.Theme.styles.print_setup_header_button - menu: Cura.PrinterTypeMenu { } + Cura.PrinterTypeMenu { id: menu} } } @@ -94,6 +94,7 @@ Item model: extrudersModel delegate: UM.TabRowButton { + checked: model.index == 0 contentItem: Item { Cura.ExtruderIcon @@ -208,23 +209,18 @@ Item height: visible ? UM.Theme.getSize("setting_control").height : 0 visible: extrudersModel.count > 1 // If there is only one extruder, there is no point to enable/disable that. - Label + UM.Label { text: catalog.i18nc("@label", "Enabled") - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - renderType: Text.NativeRendering } - OldControls.CheckBox + UM.CheckBox { id: enabledCheckbox enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder. height: parent.height - style: UM.Theme.styles.checkbox Binding { @@ -262,18 +258,14 @@ Item height: visible ? UM.Theme.getSize("print_setup_big_item").height : 0 visible: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.hasMaterials : false - Label + UM.Label { text: catalog.i18nc("@label", "Material") - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - renderType: Text.NativeRendering } - OldControls.ToolButton + Cura.PrintSetupHeaderButton { id: materialSelection @@ -286,20 +278,19 @@ Item width: selectors.controlWidth height: parent.height + anchors.verticalCenter: parent.verticalCenter + + focusPolicy: Qt.ClickFocus - style: UM.Theme.styles.print_setup_header_button - activeFocusOnPress: true Cura.MaterialMenu { id: materialsMenu extruderIndex: Cura.ExtruderManager.activeExtruderIndex updateModels: materialSelection.visible } - onClicked: - { - materialsMenu.popup(); - } + onClicked: materialsMenu.popup() } + Item { width: instructionButton.width + 2 * UM.Theme.getSize("narrow_margin").width @@ -328,26 +319,22 @@ Item height: visible ? UM.Theme.getSize("print_setup_big_item").height : 0 visible: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.hasVariants : false - Label + UM.Label { text: Cura.MachineManager.activeDefinitionVariantsName - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") height: parent.height width: selectors.textWidth - renderType: Text.NativeRendering } - OldControls.ToolButton + Cura.PrintSetupHeaderButton { id: variantSelection text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.variant.name : "" tooltip: text height: parent.height width: selectors.controlWidth - style: UM.Theme.styles.print_setup_header_button - activeFocusOnPress: true + anchors.verticalCenter: parent.verticalCenter + focusPolicy: Qt.ClickFocus enabled: enabledCheckbox.checked Cura.NozzleMenu @@ -355,10 +342,7 @@ Item id: nozzlesMenu extruderIndex: Cura.ExtruderManager.activeExtruderIndex } - onClicked: - { - nozzlesMenu.popup(); - } + onClicked: nozzlesMenu.popup() } } @@ -372,11 +356,10 @@ Item property bool buildplateCompatibilityWarning: Cura.MachineManager.variantBuildplateUsable // This is a space holder aligning the warning messages. - Label + UM.Label { text: "" width: selectors.textWidth - renderType: Text.NativeRendering } Item @@ -397,19 +380,15 @@ Item visible: !Cura.MachineManager.isCurrentSetupSupported || warnings.buildplateCompatibilityError || warnings.buildplateCompatibilityWarning } - Label + UM.Label { id: materialCompatibilityLabel anchors.left: warningImage.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - verticalAlignment: Text.AlignVCenter width: selectors.controlWidth - warningImage.width - UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Use glue for better adhesion with this material combination.") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") visible: CuraSDKVersion == "dev" ? false : warnings.buildplateCompatibilityError || warnings.buildplateCompatibilityWarning wrapMode: Text.WordWrap - renderType: Text.NativeRendering } } } diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index f93727ea96..06ef0901e7 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item @@ -33,30 +33,24 @@ Item margins: UM.Theme.getSize("default_margin").width } - Label + UM.Label { text: (printCoreConfiguration !== null && printCoreConfiguration.material.brand) ? printCoreConfiguration.material.brand : " " //Use space so that the height is still correct. - renderType: Text.NativeRendering elide: Text.ElideRight - font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_inactive") width: parent.width } - Label + UM.Label { text: (printCoreConfiguration !== null && printCoreConfiguration.material.brand) ? printCoreConfiguration.material.name : " " //Use space so that the height is still correct. - renderType: Text.NativeRendering elide: Text.ElideRight font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") width: parent.width } - Label + UM.Label { text: (printCoreConfiguration !== null && printCoreConfiguration.hotendID) ? printCoreConfiguration.hotendID : " " //Use space so that the height is still correct. - renderType: Text.NativeRendering elide: Text.ElideRight - font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_inactive") width: parent.width } diff --git a/resources/qml/Menus/ContextMenu.qml b/resources/qml/Menus/ContextMenu.qml index 1709d70ab5..1bba79e2c1 100644 --- a/resources/qml/Menus/ContextMenu.qml +++ b/resources/qml/Menus/ContextMenu.qml @@ -1,15 +1,14 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Dialogs 1.2 +import QtQuick.Controls 2.1 import QtQuick.Window 2.1 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { id: base @@ -18,17 +17,25 @@ Menu property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel() // Selection-related actions. - MenuItem { action: Cura.Actions.centerSelection; } - MenuItem { action: Cura.Actions.deleteSelection; } - MenuItem { action: Cura.Actions.multiplySelection; } + Cura.MenuItem { action: Cura.Actions.centerSelection; } + Cura.MenuItem { action: Cura.Actions.deleteSelection; } + Cura.MenuItem { action: Cura.Actions.multiplySelection; } // Extruder selection - only visible if there is more than 1 extruder - MenuSeparator { visible: base.shouldShowExtruders } - MenuItem { id: extruderHeader; text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount); enabled: false; visible: base.shouldShowExtruders } + Cura.MenuSeparator { visible: base.shouldShowExtruders } + Cura.MenuItem + { + id: extruderHeader + text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount) + enabled: false + visible: base.shouldShowExtruders + } + Instantiator { model: CuraApplication.getExtrudersModel() - MenuItem { + Cura.MenuItem + { text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant) visible: base.shouldShowExtruders enabled: UM.Selection.hasSelection && model.enabled @@ -37,60 +44,30 @@ Menu onTriggered: CuraActions.setExtruderForSelection(model.id) shortcut: "Ctrl+" + (model.index + 1) } - onObjectAdded: base.insertItem(index, object) + // Add it to the fifth position (and above) as we want it to be added after the extruder header. + onObjectAdded: base.insertItem(index + 5, object) onObjectRemoved: base.removeItem(object) } - MenuSeparator { - visible: UM.Preferences.getValue("cura/use_multi_build_plate") - } - - Instantiator - { - model: base.multiBuildPlateModel - MenuItem { - enabled: UM.Selection.hasSelection - text: base.multiBuildPlateModel.getItem(index).name; - onTriggered: CuraActions.setBuildPlateForSelection(base.multiBuildPlateModel.getItem(index).buildPlateNumber); - checkable: true - checked: base.multiBuildPlateModel.selectionBuildPlates.indexOf(base.multiBuildPlateModel.getItem(index).buildPlateNumber) != -1; - visible: UM.Preferences.getValue("cura/use_multi_build_plate") - } - onObjectAdded: base.insertItem(index, object); - onObjectRemoved: base.removeItem(object); - } - - MenuItem { - enabled: UM.Selection.hasSelection - text: "New build plate"; - onTriggered: { - CuraActions.setBuildPlateForSelection(base.multiBuildPlateModel.maxBuildPlate + 1); - checked = false; - } - checkable: true - checked: false - visible: UM.Preferences.getValue("cura/use_multi_build_plate") - } - // Global actions - MenuSeparator {} - MenuItem { action: Cura.Actions.selectAll; } - MenuItem { action: Cura.Actions.arrangeAll; } - MenuItem { action: Cura.Actions.deleteAll; } - MenuItem { action: Cura.Actions.reloadAll; } - MenuItem { action: Cura.Actions.resetAllTranslation; } - MenuItem { action: Cura.Actions.resetAll; } + Cura.MenuSeparator {} + Cura.MenuItem { action: Cura.Actions.selectAll } + Cura.MenuItem { action: Cura.Actions.arrangeAll } + Cura.MenuItem { action: Cura.Actions.deleteAll } + Cura.MenuItem { action: Cura.Actions.reloadAll } + Cura.MenuItem { action: Cura.Actions.resetAllTranslation } + Cura.MenuItem { action: Cura.Actions.resetAll } // Group actions - MenuSeparator {} - MenuItem { action: Cura.Actions.groupObjects; } - MenuItem { action: Cura.Actions.mergeObjects; } - MenuItem { action: Cura.Actions.unGroupObjects; } + Cura.MenuSeparator {} + Cura.MenuItem { action: Cura.Actions.groupObjects } + Cura.MenuItem { action: Cura.Actions.mergeObjects } + Cura.MenuItem { action: Cura.Actions.unGroupObjects } Connections { target: UM.Controller - function onContextMenuRequested() { base.popup(); } + function onContextMenuRequested() { base.popup() } } Connections @@ -108,69 +85,56 @@ Menu watchedProperties: [ "value" ] } - Dialog + UM.Dialog { id: multiplyDialog - modality: Qt.ApplicationModal title: catalog.i18ncp("@title:window", "Multiply Selected Model", "Multiply Selected Models", UM.Selection.selectionCount) + width: UM.Theme.getSize("small_popup_dialog").width + height: UM.Theme.getSize("small_popup_dialog").height + minimumWidth: UM.Theme.getSize("small_popup_dialog").width + minimumHeight: UM.Theme.getSize("small_popup_dialog").height onAccepted: CuraActions.multiplySelection(copiesField.value) - signal reset() - onReset: - { - copiesField.value = 1; - copiesField.focus = true; - } + buttonSpacing: UM.Theme.getSize("thin_margin").width - onVisibleChanged: - { - copiesField.forceActiveFocus(); - } - - standardButtons: StandardButton.Ok | StandardButton.Cancel + rightButtons: + [ + Cura.SecondaryButton + { + text: "Cancel" + onClicked: multiplyDialog.reject() + }, + Cura.PrimaryButton + { + text: "Ok" + onClicked: multiplyDialog.accept() + } + ] Row { spacing: UM.Theme.getSize("default_margin").width - Label + UM.Label { text: catalog.i18nc("@label", "Number of Copies") anchors.verticalCenter: copiesField.verticalCenter + width: contentWidth + wrapMode: Text.NoWrap } - SpinBox + Cura.SpinBox { id: copiesField + editable: true focus: true - minimumValue: 1 - maximumValue: 99 + from: 1 + to: 99 + width: 2 * UM.Theme.getSize("button").width } } } - - // Find the index of an item in the list of child items of this menu. - // - // This is primarily intended as a helper function so we do not have to - // hard-code the position of the extruder selection actions. - // - // \param item The item to find the index of. - // - // \return The index of the item or -1 if it was not found. - function findItemIndex(item) - { - for(var i in base.items) - { - if(base.items[i] == item) - { - return i; - } - } - return -1; - } - - UM.I18nCatalog { id: catalog; name: "cura" } } diff --git a/resources/qml/Menus/EditMenu.qml b/resources/qml/Menus/EditMenu.qml new file mode 100644 index 0000000000..522c6b27d1 --- /dev/null +++ b/resources/qml/Menus/EditMenu.qml @@ -0,0 +1,28 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 2.1 + +import UM 1.6 as UM +import Cura 1.0 as Cura + +Cura.Menu +{ + title: catalog.i18nc("@title:menu menubar:toplevel", "&Edit") + + Cura.MenuItem { action: Cura.Actions.undo } + Cura.MenuItem { action: Cura.Actions.redo } + Cura.MenuSeparator { } + Cura.MenuItem { action: Cura.Actions.selectAll } + Cura.MenuItem { action: Cura.Actions.arrangeAll } + Cura.MenuItem { action: Cura.Actions.multiplySelection } + Cura.MenuItem { action: Cura.Actions.deleteSelection } + Cura.MenuItem { action: Cura.Actions.deleteAll } + Cura.MenuItem { action: Cura.Actions.resetAllTranslation } + Cura.MenuItem { action: Cura.Actions.resetAll } + Cura.MenuSeparator { } + Cura.MenuItem { action: Cura.Actions.groupObjects } + Cura.MenuItem { action: Cura.Actions.mergeObjects } + Cura.MenuItem { action: Cura.Actions.unGroupObjects } +} \ No newline at end of file diff --git a/resources/qml/Menus/ExtensionMenu.qml b/resources/qml/Menus/ExtensionMenu.qml new file mode 100644 index 0000000000..3c2d1a79c7 --- /dev/null +++ b/resources/qml/Menus/ExtensionMenu.qml @@ -0,0 +1,64 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 2.4 + +import UM 1.5 as UM +import Cura 1.0 as Cura + +Cura.Menu +{ + id: extensionMenu + title: catalog.i18nc("@title:menu menubar:toplevel", "E&xtensions") + property var extensionModel: UM.ExtensionModel { } + Component + { + id: extensionsMenuItem + + Cura.MenuItem + { + text: modelText + onTriggered: extensionsModel.subMenuTriggered(extensionName, modelText) + } + } + + Component + { + id: extensionsMenuSeparator + + Cura.MenuSeparator {} + } + + Instantiator + { + id: extensions + model: extensionModel + + Cura.Menu + { + id: sub_menu + title: model.name + shouldBeVisible: actions !== undefined + enabled: actions != null + Instantiator + { + model: actions + Loader + { + property var extensionsModel: extensions.model + property var modelText: model.text + property var extensionName: name + + sourceComponent: modelText.trim() == "" ? extensionsMenuSeparator : extensionsMenuItem + } + + onObjectAdded: sub_menu.insertItem(index, object.item) + onObjectRemoved: sub_menu.removeItem(object.item) + } + } + + onObjectAdded: extensionMenu.insertMenu(index, object) + onObjectRemoved: extensionMenu.removeMenu(object) + } +} \ No newline at end of file diff --git a/resources/qml/Menus/FileMenu.qml b/resources/qml/Menus/FileMenu.qml index 681e0b06ce..338ada60fc 100644 --- a/resources/qml/Menus/FileMenu.qml +++ b/resources/qml/Menus/FileMenu.qml @@ -1,46 +1,49 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.1 import UM 1.6 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { id: base title: catalog.i18nc("@title:menu menubar:toplevel", "&File") property var fileProviderModel: CuraApplication.getFileProviderModel() - MenuItem + + Cura.MenuItem { id: newProjectMenu action: Cura.Actions.newProject } - MenuItem + Cura.MenuItem { id: openMenu action: Cura.Actions.open - visible: (base.fileProviderModel.count == 1) + visible: base.fileProviderModel.count == 1 + enabled: base.fileProviderModel.count == 1 } OpenFilesMenu { id: openFilesMenu - visible: (base.fileProviderModel.count > 1) + + shouldBeVisible: base.fileProviderModel.count > 1 } RecentFilesMenu { } - MenuItem + Cura.MenuItem { id: saveWorkspaceMenu - shortcut: visible ? StandardKey.Save : "" + shortcut: StandardKey.Save text: catalog.i18nc("@title:menu menubar:file", "&Save Project...") visible: saveProjectMenu.model.count == 1 - enabled: UM.WorkspaceFileHandler.enabled + enabled: UM.WorkspaceFileHandler.enabled && saveProjectMenu.model.count == 1 onTriggered: { var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" }; @@ -62,13 +65,13 @@ Menu { id: saveProjectMenu model: projectOutputDevicesModel - visible: model.count > 1 + shouldBeVisible: model.count > 1 enabled: UM.WorkspaceFileHandler.enabled } - MenuSeparator { } + Cura.MenuSeparator { } - MenuItem + Cura.MenuItem { id: saveAsMenu text: catalog.i18nc("@title:menu menubar:file", "&Export...") @@ -79,24 +82,24 @@ Menu } } - MenuItem + Cura.MenuItem { id: exportSelectionMenu text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...") enabled: UM.Selection.hasSelection - iconName: "document-save-as" + icon.name: "document-save-as" onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"}) } - MenuSeparator { } + Cura.MenuSeparator { } - MenuItem + Cura.MenuItem { id: reloadAllMenu action: Cura.Actions.reloadAll } - MenuSeparator { } + Cura.MenuSeparator { } - MenuItem { action: Cura.Actions.quit } + Cura.MenuItem { action: Cura.Actions.quit } } diff --git a/resources/qml/Menus/HelpMenu.qml b/resources/qml/Menus/HelpMenu.qml new file mode 100644 index 0000000000..4be25fdffe --- /dev/null +++ b/resources/qml/Menus/HelpMenu.qml @@ -0,0 +1,23 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 2.4 + +import UM 1.5 as UM +import Cura 1.0 as Cura + + +Cura.Menu +{ + id: helpMenu + title: catalog.i18nc("@title:menu menubar:toplevel", "&Help") + + Cura.MenuItem { action: Cura.Actions.showProfileFolder } + Cura.MenuItem { action: Cura.Actions.showTroubleshooting} + Cura.MenuItem { action: Cura.Actions.documentation } + Cura.MenuItem { action: Cura.Actions.reportBug } + Cura.MenuSeparator { } + Cura.MenuItem { action: Cura.Actions.whatsNew } + Cura.MenuItem { action: Cura.Actions.about } +} \ No newline at end of file diff --git a/resources/qml/Menus/LocalPrinterMenu.qml b/resources/qml/Menus/LocalPrinterMenu.qml deleted file mode 100644 index bd6c57d744..0000000000 --- a/resources/qml/Menus/LocalPrinterMenu.qml +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 1.4 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -Instantiator -{ - model: Cura.GlobalStacksModel {} - - MenuItem - { - text: model.name - checkable: true - checked: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id == model.id: false - exclusiveGroup: group - visible: !model.hasRemoteConnection - onTriggered: Cura.MachineManager.setActiveMachine(model.id) - } - onObjectAdded: menu.insertItem(index, object) - onObjectRemoved: menu.removeItem(object) -} diff --git a/resources/qml/Menus/MaterialMenu.qml b/resources/qml/Menus/MaterialMenu.qml index b4f15fad00..e6d7fbc3e9 100644 --- a/resources/qml/Menus/MaterialMenu.qml +++ b/resources/qml/Menus/MaterialMenu.qml @@ -1,15 +1,15 @@ -//Copyright (c) 2020 Ultimaker B.V. -//Cura is released under the terms of the LGPLv3 or higher. +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { - id: menu + id: materialMenu title: catalog.i18nc("@label:category menu label", "Material") property int extruderIndex: 0 @@ -25,55 +25,54 @@ Menu } property bool isActiveExtruderEnabled: (activeExtruder === null || activeExtruder === undefined) ? false : activeExtruder.isEnabled - property string activeMaterialId: (activeExtruder === null || activeExtruder === undefined) ? false : activeExtruder.material.id - + property string activeMaterialId: (activeExtruder === null || activeExtruder === undefined) ? "" : activeExtruder.material.id property bool updateModels: true Cura.FavoriteMaterialsModel { id: favoriteMaterialsModel - extruderPosition: menu.extruderIndex + extruderPosition: materialMenu.extruderIndex enabled: updateModels } Cura.GenericMaterialsModel { id: genericMaterialsModel - extruderPosition: menu.extruderIndex + extruderPosition: materialMenu.extruderIndex enabled: updateModels } Cura.MaterialBrandsModel { id: brandModel - extruderPosition: menu.extruderIndex + extruderPosition: materialMenu.extruderIndex enabled: updateModels } - MenuItem + Cura.MenuItem { text: catalog.i18nc("@label:category menu label", "Favorites") enabled: false visible: favoriteMaterialsModel.items.length > 0 } + Instantiator { model: favoriteMaterialsModel - delegate: MenuItem + delegate: Cura.MenuItem { text: model.brand + " " + model.name checkable: true enabled: isActiveExtruderEnabled - checked: model.root_material_id === menu.currentRootMaterialId + checked: model.root_material_id === materialMenu.currentRootMaterialId onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node) - exclusiveGroup: favoriteGroup // One favorite and one item from the others can be active at the same time. } - onObjectAdded: menu.insertItem(index, object) - onObjectRemoved: menu.removeItem(index) + onObjectAdded: materialMenu.insertItem(index + 1, object) + onObjectRemoved: materialMenu.removeItem(index) } - MenuSeparator {} + Cura.MenuSeparator { visible: favoriteMaterialsModel.items.length > 0} - Menu + Cura.Menu { id: genericMenu title: catalog.i18nc("@label:category menu label", "Generic") @@ -81,13 +80,12 @@ Menu Instantiator { model: genericMaterialsModel - delegate: MenuItem + delegate: Cura.MenuItem { text: model.name checkable: true enabled: isActiveExtruderEnabled - checked: model.root_material_id === menu.currentRootMaterialId - exclusiveGroup: group + checked: model.root_material_id === materialMenu.currentRootMaterialId onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node) } onObjectAdded: genericMenu.insertItem(index, object) @@ -95,12 +93,12 @@ Menu } } - MenuSeparator {} + Cura.MenuSeparator {} Instantiator { model: brandModel - Menu + Cura.Menu { id: brandMenu title: brandName @@ -110,7 +108,7 @@ Menu Instantiator { model: brandMaterials - delegate: Menu + delegate: Cura.Menu { id: brandMaterialsMenu title: materialName @@ -120,47 +118,37 @@ Menu Instantiator { model: brandMaterialColors - delegate: MenuItem + delegate: Cura.MenuItem { text: model.name checkable: true enabled: isActiveExtruderEnabled - checked: model.id === menu.activeMaterialId - exclusiveGroup: group + checked: model.id === materialMenu.activeMaterialId + onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node) } onObjectAdded: brandMaterialsMenu.insertItem(index, object) onObjectRemoved: brandMaterialsMenu.removeItem(object) } } - onObjectAdded: brandMenu.insertItem(index, object) - onObjectRemoved: brandMenu.removeItem(object) + onObjectAdded: brandMenu.insertMenu(index, object) + onObjectRemoved: brandMenu.removeMenu(object) } } - onObjectAdded: menu.insertItem(index, object) - onObjectRemoved: menu.removeItem(object) + onObjectAdded: materialMenu.insertMenu(index + 4, object) + onObjectRemoved: materialMenu.removeMenu(object) } - ExclusiveGroup - { - id: group - } + Cura.MenuSeparator {} - ExclusiveGroup - { - id: favoriteGroup - } - - MenuSeparator {} - - MenuItem + Cura.MenuItem { action: Cura.Actions.manageMaterials } - MenuSeparator {} + Cura.MenuSeparator {} - MenuItem + Cura.MenuItem { action: Cura.Actions.marketplaceMaterials } diff --git a/resources/qml/Menus/NetworkPrinterMenu.qml b/resources/qml/Menus/NetworkPrinterMenu.qml deleted file mode 100644 index 845159f3b2..0000000000 --- a/resources/qml/Menus/NetworkPrinterMenu.qml +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 1.4 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -Instantiator -{ - model: Cura.GlobalStacksModel {} - MenuItem - { - property string connectGroupName: - { - if("group_name" in model.metadata) - { - return model.metadata["group_name"] - } - return "" - } - text: connectGroupName - checkable: true - visible: model.hasRemoteConnection - checked: Cura.MachineManager.activeMachineNetworkGroupName == connectGroupName - exclusiveGroup: group - onTriggered: Cura.MachineManager.setActiveMachine(model.id) - } - onObjectAdded: menu.insertItem(index, object) - onObjectRemoved: menu.removeItem(object) -} diff --git a/resources/qml/Menus/NozzleMenu.qml b/resources/qml/Menus/NozzleMenu.qml index 3ec48ab302..b320a02a5e 100644 --- a/resources/qml/Menus/NozzleMenu.qml +++ b/resources/qml/Menus/NozzleMenu.qml @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { - id: menu + id: nozzleMenu title: "Nozzle" property int extruderIndex: 0 @@ -23,38 +23,34 @@ Menu { model: nozzleModel - MenuItem + Cura.MenuItem { text: model.hotend_name checkable: true - checked: { - var activeMachine = Cura.MachineManager.activeMachine + property var activeMachine: Cura.MachineManager.activeMachine + checked: + { if (activeMachine === null) { return false } - var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex] + var extruder = activeMachine.extruderList[extruderIndex] return (extruder === undefined) ? false : (extruder.variant.name == model.hotend_name) } - exclusiveGroup: group enabled: { - var activeMachine = Cura.MachineManager.activeMachine if (activeMachine === null) { return false } - var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex] + var extruder = activeMachine.extruderList[extruderIndex] return (extruder === undefined) ? false : extruder.isEnabled } - onTriggered: { - Cura.MachineManager.setVariant(menu.extruderIndex, model.container_node); - } + onTriggered: Cura.MachineManager.setVariant(nozzleMenu.extruderIndex, model.container_node) } - onObjectAdded: menu.insertItem(index, object); - onObjectRemoved: menu.removeItem(object); + onObjectAdded: nozzleMenu.insertItem(index, object) + onObjectRemoved: nozzleMenu.removeItem(object) } - ExclusiveGroup { id: group } } diff --git a/resources/qml/Menus/OpenFilesMenu.qml b/resources/qml/Menus/OpenFilesMenu.qml index 25f474c1d6..de5ab00c76 100644 --- a/resources/qml/Menus/OpenFilesMenu.qml +++ b/resources/qml/Menus/OpenFilesMenu.qml @@ -1,30 +1,26 @@ -// Copyright (c) 2020 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.1 import UM 1.6 as UM import Cura 1.0 as Cura import "../Dialogs" -Menu +Cura.Menu { id: openFilesMenu title: catalog.i18nc("@title:menu menubar:file", "Open File(s)...") - iconName: "document-open-recent"; Instantiator { id: fileProviders model: CuraApplication.getFileProviderModel() - MenuItem + Cura.MenuItem { - text: - { - return model.displayText; - } + text: model.displayText onTriggered: { if (model.index == 0) // The 0th element is the "From Disk" option, which should activate the open local file dialog @@ -36,11 +32,10 @@ Menu CuraApplication.getFileProviderModel().trigger(model.name); } } - // Unassign the shortcuts when the submenu is invisible (i.e. when there is only one file provider) to avoid ambiguous shortcuts. - // When there is a single file provider, the openAction is assigned with the Ctrl+O shortcut instead. - shortcut: openFilesMenu.visible ? model.shortcut : "" + shortcut: model.shortcut } onObjectAdded: openFilesMenu.insertItem(index, object) + onObjectRemoved: openFilesMenu.removeItem(object) } } diff --git a/resources/qml/Menus/PreferencesMenu.qml b/resources/qml/Menus/PreferencesMenu.qml new file mode 100644 index 0000000000..3a6dd4b2ce --- /dev/null +++ b/resources/qml/Menus/PreferencesMenu.qml @@ -0,0 +1,25 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 2.4 + +import UM 1.5 as UM +import Cura 1.0 as Cura + +Cura.Menu +{ + id: preferencesMenu + + //On MacOS, don't translate the "Preferences" word. + //Qt moves the "preferences" entry to a different place, and if it got renamed can't find it again when it + //attempts to delete the item upon closing the application, causing a crash. + //In the new location, these items are translated automatically according to the system's language. + //For more information, see: + //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar + //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar + title: (Qt.platform.os == "osx") ? "&Preferences" : catalog.i18nc("@title:menu menubar:toplevel", "P&references") + + Cura.MenuItem { action: Cura.Actions.preferences } +} + diff --git a/resources/qml/Menus/PrinterMenu.qml b/resources/qml/Menus/PrinterMenu.qml index 741d927c13..9f0e0575b0 100644 --- a/resources/qml/Menus/PrinterMenu.qml +++ b/resources/qml/Menus/PrinterMenu.qml @@ -1,61 +1,77 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.4 -import UM 1.2 as UM +import UM 1.6 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { id: menu -// TODO Enable custom style to the menu -// style: MenuStyle -// { -// frame: Rectangle -// { -// color: "white" -// } -// } - - MenuItem + title: catalog.i18nc("@title:menu menubar:settings", "&Printer") + Cura.MenuItem { + id: networkEnabledPrinterItem text: catalog.i18nc("@label:category menu label", "Network enabled printers") enabled: false - visible: networkPrinterMenu.count > 0 + visible: networKPrinterInstantiator.count > 0 } - NetworkPrinterMenu + Instantiator { - id: networkPrinterMenu + id: networKPrinterInstantiator + model: Cura.GlobalStacksModel {filterOnlineOnly: true } + Cura.MenuItem + { + property string connectGroupName: + { + if("group_name" in model.metadata) + { + return model.metadata["group_name"] + } + return "" + } + text: connectGroupName + checkable: true + checked: Cura.MachineManager.activeMachineNetworkGroupName == connectGroupName + onTriggered: Cura.MachineManager.setActiveMachine(model.id) + } + onObjectAdded: menu.insertItem(2, object) + onObjectRemoved: menu.removeItem(object) } - MenuSeparator - { - visible: networkPrinterMenu.count > 0 - } + Cura.MenuSeparator { visible: networKPrinterInstantiator.count > 0 } - MenuItem - { - text: catalog.i18nc("@label:category menu label", "Local printers") - enabled: false - visible: localPrinterMenu.count > 0 - } - - LocalPrinterMenu + Cura.MenuItem { id: localPrinterMenu + text: catalog.i18nc("@label:category menu label", "Local printers") + enabled: false + visible: localPrinterInstantiator.count > 0 } - ExclusiveGroup { id: group; } - - MenuSeparator + Instantiator { - visible: localPrinterMenu.count > 0 + id: localPrinterInstantiator + model: Cura.GlobalStacksModel {} + + Cura.MenuItem + { + text: model.name + checkable: true + checked: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id == model.id: false + visible: !model.hasRemoteConnection + onTriggered: Cura.MachineManager.setActiveMachine(model.id) + } + // A bit hackish, but we have 2 items at the end, put them before that + onObjectAdded: menu.insertItem(menu.count - 2, object) + onObjectRemoved: menu.removeItem(object) } - MenuItem { action: Cura.Actions.addMachine; } - MenuItem { action: Cura.Actions.configureMachines; } + Cura.MenuSeparator { visible: localPrinterInstantiator.count > 0 } + + Cura.MenuItem { action: Cura.Actions.addMachine } + Cura.MenuItem { action: Cura.Actions.configureMachines } } diff --git a/resources/qml/Menus/PrinterTypeMenu.qml b/resources/qml/Menus/PrinterTypeMenu.qml index c2a09e0efd..17986ac1b8 100644 --- a/resources/qml/Menus/PrinterTypeMenu.qml +++ b/resources/qml/Menus/PrinterTypeMenu.qml @@ -2,12 +2,12 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { id: menu title: "Printer type" @@ -18,12 +18,11 @@ Menu id: printerTypeInstantiator model: outputDevice != null ? outputDevice.connectedPrintersTypeCount : [] - MenuItem + Cura.MenuItem { text: modelData.machine_type checkable: true checked: Cura.MachineManager.activeMachine.definition.name == modelData.machine_type - exclusiveGroup: group onTriggered: { Cura.MachineManager.switchPrinterType(modelData.machine_type) @@ -32,6 +31,4 @@ Menu onObjectAdded: menu.insertItem(index, object) onObjectRemoved: menu.removeItem(object) } - - ExclusiveGroup { id: group } } diff --git a/resources/qml/Menus/RecentFilesMenu.qml b/resources/qml/Menus/RecentFilesMenu.qml index de6d2e3817..8f4f328927 100644 --- a/resources/qml/Menus/RecentFilesMenu.qml +++ b/resources/qml/Menus/RecentFilesMenu.qml @@ -1,26 +1,26 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.1 import UM 1.3 as UM import Cura 1.0 as Cura import "../Dialogs" -Menu +Cura.Menu { id: menu title: catalog.i18nc("@title:menu menubar:file", "Open &Recent") - iconName: "document-open-recent"; + //iconName: "document-open-recent"; enabled: CuraApplication.recentFiles.length > 0; Instantiator { model: CuraApplication.recentFiles - MenuItem + Cura.MenuItem { text: { @@ -32,9 +32,4 @@ Menu onObjectAdded: menu.insertItem(index, object) onObjectRemoved: menu.removeItem(object) } - - Cura.AskOpenAsProjectOrModelsDialog - { - id: askOpenAsProjectOrModelsDialog - } } diff --git a/resources/qml/Menus/SaveProjectMenu.qml b/resources/qml/Menus/SaveProjectMenu.qml index afc6008717..16d54382d1 100644 --- a/resources/qml/Menus/SaveProjectMenu.qml +++ b/resources/qml/Menus/SaveProjectMenu.qml @@ -1,15 +1,15 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.1 -import UM 1.6 as UM +import UM 1.5 as UM import Cura 1.1 as Cura import "../Dialogs" -Menu +Cura.Menu { id: saveProjectMenu title: catalog.i18nc("@title:menu menubar:file", "Save Project...") @@ -18,7 +18,7 @@ Menu Instantiator { id: projectOutputDevices - MenuItem + Cura.MenuItem { text: model.name onTriggered: @@ -40,9 +40,8 @@ Menu UM.OutputDeviceManager.requestWriteToDevice(model.id, PrintInformation.jobName, args) } } - // Unassign the shortcuts when the submenu is invisible (i.e. when there is only one project output device) to avoid ambiguous shortcuts. - // When there is only the LocalFileOutputDevice, the Ctrl+S shortcut is assigned to the saveWorkspaceMenu MenuItem - shortcut: saveProjectMenu.visible ? model.shortcut : "" + shortcut: model.shortcut + enabled: saveProjectMenu.shouldBeVisible } onObjectAdded: saveProjectMenu.insertItem(index, object) onObjectRemoved: saveProjectMenu.removeItem(object) @@ -53,6 +52,6 @@ Menu id: saveWorkspaceDialog property var args property var deviceId - onYes: UM.OutputDeviceManager.requestWriteToDevice(deviceId, PrintInformation.jobName, args) + onAccepted: UM.OutputDeviceManager.requestWriteToDevice(deviceId, PrintInformation.jobName, args) } } diff --git a/resources/qml/Menus/SettingsMenu.qml b/resources/qml/Menus/SettingsMenu.qml index 939ade5847..25bee871f5 100644 --- a/resources/qml/Menus/SettingsMenu.qml +++ b/resources/qml/Menus/SettingsMenu.qml @@ -2,70 +2,76 @@ //Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { id: base title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings") - PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") } + PrinterMenu { } property var activeMachine: Cura.MachineManager.activeMachine Instantiator { id: extruderInstantiator model: activeMachine == null ? null : activeMachine.extruderList - Menu + Cura.Menu { title: modelData.name property var extruder: (base.activeMachine === null) ? null : activeMachine.extruderList[model.index] - NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.activeMachine.hasVariants; extruderIndex: index } + NozzleMenu + { + title: Cura.MachineManager.activeDefinitionVariantsName + shouldBeVisible: activeMachine.hasVariants + extruderIndex: index + } MaterialMenu { title: catalog.i18nc("@title:menu", "&Material") - visible: Cura.MachineManager.activeMachine.hasMaterials + shouldBeVisible: activeMachine.hasMaterials extruderIndex: index updateModels: false onAboutToShow: updateModels = true onAboutToHide: updateModels = false } - MenuSeparator + Cura.MenuSeparator { visible: Cura.MachineManager.activeMachine.hasVariants || Cura.MachineManager.activeMachine.hasMaterials } - MenuItem + Cura.MenuItem { text: catalog.i18nc("@action:inmenu", "Set as Active Extruder") onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index) } - MenuItem + Cura.MenuItem { text: catalog.i18nc("@action:inmenu", "Enable Extruder") onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true) visible: (extruder === null || extruder === undefined) ? false : !extruder.isEnabled + height: visible ? implicitHeight: 0 } - MenuItem + Cura.MenuItem { text: catalog.i18nc("@action:inmenu", "Disable Extruder") onTriggered: Cura.MachineManager.setExtruderEnabled(index, false) visible: (extruder === null || extruder === undefined) ? false : extruder.isEnabled enabled: Cura.MachineManager.numberExtrudersEnabled > 1 + height: visible ? implicitHeight: 0 } - } - onObjectAdded: base.insertItem(index, object) - onObjectRemoved: base.removeItem(object) + onObjectAdded: base.insertMenu(index, object) + onObjectRemoved: base.removeMenu(object) } - MenuSeparator { } + Cura.MenuSeparator { } - MenuItem { action: Cura.Actions.configureSettingVisibility } + Cura.MenuItem { action: Cura.Actions.configureSettingVisibility } } \ No newline at end of file diff --git a/resources/qml/Menus/ViewMenu.qml b/resources/qml/Menus/ViewMenu.qml index c46e9a9f08..059455c72c 100644 --- a/resources/qml/Menus/ViewMenu.qml +++ b/resources/qml/Menus/ViewMenu.qml @@ -2,33 +2,34 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.1 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura -Menu +Cura.Menu { - title: catalog.i18nc("@title:menu menubar:toplevel", "&View") id: base + title: catalog.i18nc("@title:menu menubar:toplevel", "&View") - property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel() - - Menu + Cura.Menu { - title: catalog.i18nc("@action:inmenu menubar:view","&Camera position"); - MenuItem { action: Cura.Actions.view3DCamera; } - MenuItem { action: Cura.Actions.viewFrontCamera; } - MenuItem { action: Cura.Actions.viewTopCamera; } - MenuItem { action: Cura.Actions.viewBottomCamera; } - MenuItem { action: Cura.Actions.viewLeftSideCamera; } - MenuItem { action: Cura.Actions.viewRightSideCamera; } + title: catalog.i18nc("@action:inmenu menubar:view", "&Camera position") + Cura.MenuItem { action: Cura.Actions.view3DCamera } + Cura.MenuItem { action: Cura.Actions.viewFrontCamera } + Cura.MenuItem { action: Cura.Actions.viewTopCamera } + Cura.MenuItem { action: Cura.Actions.viewBottomCamera } + Cura.MenuItem { action: Cura.Actions.viewLeftSideCamera } + Cura.MenuItem { action: Cura.Actions.viewRightSideCamera } } - Menu + Cura.Menu { id: cameraViewMenu + + title: catalog.i18nc("@action:inmenu menubar:view", "Camera view") property string cameraMode: UM.Preferences.getValue("general/camera_perspective_mode") + Connections { target: UM.Preferences @@ -42,8 +43,7 @@ Menu } } - title: catalog.i18nc("@action:inmenu menubar:view","Camera view") - MenuItem + Cura.MenuItem { text: catalog.i18nc("@action:inmenu menubar:view", "Perspective") checkable: true @@ -52,9 +52,9 @@ Menu { UM.Preferences.setValue("general/camera_perspective_mode", "perspective") } - exclusiveGroup: group } - MenuItem + + Cura.MenuItem { text: catalog.i18nc("@action:inmenu menubar:view", "Orthographic") checkable: true @@ -63,45 +63,12 @@ Menu { UM.Preferences.setValue("general/camera_perspective_mode", "orthographic") } - exclusiveGroup: group - } - ExclusiveGroup { id: group } - } - - MenuSeparator - { - visible: UM.Preferences.getValue("cura/use_multi_build_plate") - } - - Menu - { - id: buildPlateMenu; - title: catalog.i18nc("@action:inmenu menubar:view","&Build plate") - visible: UM.Preferences.getValue("cura/use_multi_build_plate") - Instantiator - { - model: base.multiBuildPlateModel - MenuItem - { - text: base.multiBuildPlateModel.getItem(index).name; - onTriggered: Cura.SceneController.setActiveBuildPlate(base.multiBuildPlateModel.getItem(index).buildPlateNumber) - checkable: true - checked: base.multiBuildPlateModel.getItem(index).buildPlateNumber == base.multiBuildPlateModel.activeBuildPlate - exclusiveGroup: buildPlateGroup - visible: UM.Preferences.getValue("cura/use_multi_build_plate") - } - onObjectAdded: buildPlateMenu.insertItem(index, object) - onObjectRemoved: buildPlateMenu.removeItem(object) - } - ExclusiveGroup - { - id: buildPlateGroup } } - MenuSeparator {} + Cura.MenuSeparator {} - MenuItem + Cura.MenuItem { action: Cura.Actions.toggleFullScreen } diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 40da10dc46..7e9219a7dc 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -1,18 +1,14 @@ -//Copyright (c) 2018 Ultimaker B.V. +//Copyright (c) 2022 Ultimaker B.V. //Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Layouts 1.1 -import UM 1.1 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item { - id: base; + id: base UM.I18nCatalog { id: catalog; name: "cura"} height: childrenRect.height + UM.Theme.getSize("thick_margin").height @@ -159,7 +155,7 @@ Item } } - Label + UM.Label { id: statusLabel width: parent.width - 2 * UM.Theme.getSize("thick_margin").width @@ -172,7 +168,7 @@ Item text: statusText } - Label + UM.Label { id: percentageLabel anchors.top: parent.top @@ -184,22 +180,22 @@ Item visible: showProgress } - ProgressBar + UM.ProgressBar { - id: progressBar; - minimumValue: 0; - maximumValue: 100; - value: 0; + id: progressBar + from: 0 + to: 100 + value: 0 //Doing this in an explicit binding since the implicit binding breaks on occasion. Binding { - target: progressBar; - property: "value"; - value: base.progress; + target: progressBar + property: "value" + value: base.progress } - visible: showProgress; + visible: showProgress indeterminate: { if(!printerConnected) @@ -219,17 +215,15 @@ Item return false; } } - style: UM.Theme.styles.progressbar; + property string backgroundColor: UM.Theme.getColor("progressbar_background") + property string controlColor: base.statusColor - property string backgroundColor: UM.Theme.getColor("progressbar_background"); - property string controlColor: base.statusColor; - - width: parent.width - 2 * UM.Theme.getSize("thick_margin").width; - height: UM.Theme.getSize("progressbar").height; - anchors.top: statusLabel.bottom; - anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4); - anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("thick_margin").width; + width: parent.width - 2 * UM.Theme.getSize("thick_margin").width + height: UM.Theme.getSize("progressbar").height + anchors.top: statusLabel.bottom + anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4) + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("thick_margin").width } Row @@ -266,7 +260,7 @@ Item } } - Button + Cura.SecondaryButton { id: pauseResumeButton @@ -309,11 +303,9 @@ Item activePrintJob.setState("pause"); } } - - style: UM.Theme.styles.print_setup_action_button } - Button + Cura.SecondaryButton { id: abortButton @@ -325,20 +317,16 @@ Item text: catalog.i18nc("@label", "Abort Print") onClicked: confirmationDialog.visible = true - - style: UM.Theme.styles.print_setup_action_button } - MessageDialog + Cura.MessageDialog { id: confirmationDialog title: catalog.i18nc("@window:title", "Abort print") - icon: StandardIcon.Warning text: catalog.i18nc("@label", "Are you sure you want to abort the print?") - standardButtons: StandardButton.Yes | StandardButton.No - Component.onCompleted: visible = false - onYes: activePrintJob.setState("abort") + standardButtons: Dialog.Yes | Dialog.No + onAccepted: activePrintJob.setState("abort") } } } diff --git a/resources/qml/ObjectItemButton.qml b/resources/qml/ObjectItemButton.qml index 23c11dd430..73295b2e69 100644 --- a/resources/qml/ObjectItemButton.qml +++ b/resources/qml/ObjectItemButton.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.1 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Button @@ -56,7 +56,7 @@ Button visible: showExtruderSwatches && extruderColor != "" } - Label + UM.Label { id: buttonText anchors @@ -67,12 +67,9 @@ Button verticalCenter: parent.verticalCenter } text: objectItemButton.text - font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_scene") opacity: (outsideBuildArea) ? 0.5 : 1.0 visible: text != "" - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } @@ -85,7 +82,7 @@ Button right: parent.right rightMargin: 0 } - width: contentItem.width + width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width height: parent.height padding: 0 leftPadding: UM.Theme.getSize("thin_margin").width @@ -134,7 +131,7 @@ Button contentItem: Item { height: parent.height - width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width + width: perObjectSettingsInfo.width Cura.NotificationIcon { diff --git a/resources/qml/ObjectSelector.qml b/resources/qml/ObjectSelector.qml index 0cdc2b3f80..db68ff6c03 100644 --- a/resources/qml/ObjectSelector.qml +++ b/resources/qml/ObjectSelector.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2020 Ultimaker B.V. +// 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 UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item @@ -51,15 +51,13 @@ Item source: objectSelector.opened ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleUp") } - Label + UM.Label { id: label anchors.left: openCloseIcon.right anchors.leftMargin: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Object list") - font: UM.Theme.getFont("default") color: openCloseButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") - renderType: Text.NativeRendering elide: Text.ElideRight } } @@ -78,7 +76,7 @@ Item id: contents width: parent.width visible: objectSelector.opened - height: visible ? listView.height : 0 + height: visible ? listView.height + border.width * 2 : 0 color: UM.Theme.getColor("main_background") border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") @@ -101,23 +99,22 @@ Item ListView { id: listView - clip: true anchors { left: parent.left right: parent.right + top: parent.top margins: UM.Theme.getSize("default_lining").width } - - ScrollBar.vertical: ScrollBar - { - hoverEnabled: true - } - property real maximumHeight: UM.Theme.getSize("objects_menu_size").height - height: Math.min(contentHeight, maximumHeight) + ScrollBar.vertical: UM.ScrollBar + { + id: scrollBar + } + clip: true + model: Cura.ObjectsModel {} delegate: ObjectItemButton @@ -130,7 +127,7 @@ Item value: model.selected } text: model.name - width: listView.width + width: listView.width - scrollBar.width property bool outsideBuildArea: model.outside_build_area property int perObjectSettingsCount: model.per_object_settings_count property string meshType: model.mesh_type diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index ccdd5efcf3..8fbaadc5c3 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -2,11 +2,8 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 - -import QtQuick.Controls 2.3 as NewControls import UM 1.5 as UM import Cura 1.1 as Cura @@ -17,7 +14,7 @@ UM.PreferencesPage title: catalog.i18nc("@title:tab", "General") id: generalPreferencesPage - width: parent.width + width: parent ? parent.width: 0 function setDefaultLanguage(languageCode) { @@ -103,14 +100,14 @@ UM.PreferencesPage invertZoomCheckbox.checked = boolCheck(UM.Preferences.getValue("view/invert_zoom")) UM.Preferences.resetPreference("view/zoom_to_mouse"); zoomToMouseCheckbox.checked = boolCheck(UM.Preferences.getValue("view/zoom_to_mouse")) - UM.Preferences.resetPreference("view/top_layer_count"); - topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) + //UM.Preferences.resetPreference("view/top_layer_count"); + //topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) UM.Preferences.resetPreference("general/restore_window_geometry") restoreWindowPositionCheckbox.checked = boolCheck(UM.Preferences.getValue("general/restore_window_geometry")) UM.Preferences.resetPreference("general/camera_perspective_mode") - var defaultCameraMode = UM.Preferences.getValue("general/camera_perspective_mode") - setDefaultCameraMode(defaultCameraMode) + //var defaultCameraMode = UM.Preferences.getValue("general/camera_perspective_mode") +// /setDefaultCameraMode(defaultCameraMode) UM.Preferences.resetPreference("cura/choice_on_profile_override") setDefaultDiscardOrKeepProfile(UM.Preferences.getValue("cura/choice_on_profile_override")) @@ -128,33 +125,52 @@ UM.PreferencesPage pluginNotificationsUpdateCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_plugin_update_check")) } + buttons: [ + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Defaults") + onClicked: reset() + } + ] ScrollView { id: preferencesScrollView width: parent.width height: parent.height + ScrollBar.vertical: UM.ScrollBar + { + id: preferencesScrollBar + parent: preferencesScrollView + anchors + { + top: parent.top + bottom: parent.bottom + right: parent.right + } + } + Column { UM.I18nCatalog{id: catalog; name: "cura"} - width: preferencesScrollView.viewport.width + width: preferencesScrollView.width - preferencesScrollBar.width - Label + UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Interface") } GridLayout { id: interfaceGrid - columns: 4 + columns: 2 width: parent.width - Label + UM.Label { id: languageLabel - text: "Language:" //Don't translate this, to make it easier to find the language drop-down if you can't read the current language. + text: "Language*:" //Don't translate this, to make it easier to find the language drop-down if you can't read the current language. } ListModel @@ -193,13 +209,14 @@ UM.PreferencesPage } } - NewControls.ComboBox + Cura.ComboBox { id: languageComboBox textRole: "text" model: languageList - Layout.fillWidth: true + implicitWidth: UM.Theme.getSize("setting_control").width + implicitHeight: currencyField.height function setCurrentIndex() { var code = UM.Preferences.getValue("general/language"); @@ -214,7 +231,9 @@ UM.PreferencesPage currentIndex: setCurrentIndex() - onActivated: if (model.get(index).code != "") + onActivated: + { + if (model.get(index).code != "") { UM.Preferences.setValue("general/language", model.get(index).code); } @@ -222,25 +241,28 @@ UM.PreferencesPage { currentIndex = setCurrentIndex(); } + } } - Label + UM.Label { id: currencyLabel text: catalog.i18nc("@label", "Currency:") } - TextField + Cura.TextField { id: currencyField + selectByMouse: true text: UM.Preferences.getValue("cura/currency") + implicitWidth: UM.Theme.getSize("setting_control").width onTextChanged: UM.Preferences.setValue("cura/currency", text) } - Label + UM.Label { id: themeLabel - text: catalog.i18nc("@label","Theme:") + text: catalog.i18nc("@label: Please keep the asterix, it's to indicate that a restart is needed.", "Theme*:") } ListModel @@ -256,13 +278,14 @@ UM.PreferencesPage } } - NewControls.ComboBox + Cura.ComboBox { id: themeComboBox model: themeList textRole: "text" - Layout.fillWidth: true + implicitWidth: UM.Theme.getSize("setting_control").width + implicitHeight: currencyField.height currentIndex: { @@ -280,23 +303,6 @@ UM.PreferencesPage } } - Label - { - id: languageCaption - - //: Language change warning - text: catalog.i18nc("@label", "You will need to restart the application for these changes to have effect.") - wrapMode: Text.WordWrap - font.italic: true - } - - Item - { - //: Spacer - height: UM.Theme.getSize("default_margin").height - width: UM.Theme.getSize("default_margin").width - } - UM.TooltipArea { width: childrenRect.width; @@ -314,6 +320,16 @@ UM.PreferencesPage } } + UM.Label + { + id: languageCaption + + //: Language change warning + text: catalog.i18nc("@label", "*You will need to restart the application for these changes to have effect.") + wrapMode: Text.WordWrap + font.italic: true + } + Item { //: Spacer @@ -321,9 +337,9 @@ UM.PreferencesPage width: UM.Theme.getSize("default_margin").width } - Label + UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Viewport behavior") } @@ -516,9 +532,9 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "What type of camera rendering should be used?") Column { - spacing: 4 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").height - Label + UM.Label { text: catalog.i18nc("@window:text", "Camera rendering:") } @@ -532,12 +548,14 @@ UM.PreferencesPage } } - NewControls.ComboBox + Cura.ComboBox { id: cameraComboBox model: comboBoxList textRole: "text" + width: UM.Theme.getSize("combobox_wide").width + height: UM.Theme.getSize("combobox_wide").height currentIndex: { @@ -563,9 +581,9 @@ UM.PreferencesPage width: UM.Theme.getSize("default_margin").height } - Label + UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label","Opening and saving files") } @@ -579,6 +597,7 @@ UM.PreferencesPage { id: singleInstanceCheckbox text: catalog.i18nc("@option:check","Use a single instance of Cura") + checked: boolCheck(UM.Preferences.getValue("cura/single_instance")) onCheckedChanged: UM.Preferences.setValue("cura/single_instance", checked) } @@ -682,17 +701,18 @@ UM.PreferencesPage Column { - spacing: 4 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").height - Label + UM.Label { text: catalog.i18nc("@window:text", "Default behavior when opening a project file: ") } - NewControls.ComboBox + Cura.ComboBox { id: choiceOnOpenProjectDropDownButton - width: Math.round(250 * screenScaleFactor) + width: UM.Theme.getSize("combobox_wide").width + height: UM.Theme.getSize("combobox_wide").height model: ListModel { @@ -736,31 +756,31 @@ UM.PreferencesPage UM.TooltipArea { - width: childrenRect.width; - height: childrenRect.height; + width: childrenRect.width + height: childrenRect.height text: catalog.i18nc("@info:tooltip", "When you have made changes to a profile and switched to a different one, a dialog will be shown asking whether you want to keep your modifications or not, or you can choose a default behaviour and never show that dialog again.") Column { - spacing: 4 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").height - Label + UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Profiles") } - Label + UM.Label { text: catalog.i18nc("@window:text", "Default behavior for changed setting values when switching to a different profile: ") } - NewControls.ComboBox + Cura.ComboBox { id: choiceOnProfileOverrideDropDownButton - width: Math.round(250 * screenScaleFactor) - popup.width: Math.round(350 * screenScaleFactor) + width: UM.Theme.getSize("combobox_wide").width + height: UM.Theme.getSize("combobox_wide").height model: ListModel { id: discardOrKeepProfileListModel @@ -800,9 +820,9 @@ UM.PreferencesPage width: UM.Theme.getSize("default_margin").height } - Label + UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Privacy") } UM.TooltipArea @@ -819,15 +839,18 @@ UM.PreferencesPage onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked) } - Button + + UM.SimpleButton { - id: showMoreInfo - anchors.top: sendDataCheckbox.bottom - text: catalog.i18nc("@action:button", "More information") - onClicked: - { - CuraApplication.showMoreInformationDialogForAnonymousDataCollection(); - } + onClicked: CuraApplication.showMoreInformationDialogForAnonymousDataCollection() + iconSource: UM.Theme.getIcon("Information") + anchors.left: sendDataCheckbox.right + anchors.verticalCenter: sendDataCheckbox.verticalCenter + hoverBackgroundColor: UM.Theme.getColor("secondary_button_hover") + backgroundRadius: width / 2 + height: UM.Theme.getSize("small_button_icon").height + color: UM.Theme.getColor("small_button_text") + width: height } } @@ -838,9 +861,9 @@ UM.PreferencesPage width: UM.Theme.getSize("default_margin").height } - Label + UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Updates") } @@ -859,7 +882,12 @@ UM.PreferencesPage } } - ExclusiveGroup { id: curaUpdatesGroup } + ButtonGroup + { + id: curaUpdatesGroup + buttons: [checkUpdatesOptionBeta, checkUpdatesOptionStable] + } + UM.TooltipArea { width: childrenRect.width @@ -867,10 +895,10 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "When checking for updates, only check for stable releases.") anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - RadioButton + Cura.RadioButton { + id: checkUpdatesOptionStable text: catalog.i18nc("@option:radio", "Stable releases only") - exclusiveGroup: curaUpdatesGroup enabled: checkUpdatesCheckbox.checked checked: UM.Preferences.getValue("info/latest_update_source") == "stable" onClicked: UM.Preferences.setValue("info/latest_update_source", "stable") @@ -883,10 +911,10 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "When checking for updates, check for both stable and for beta releases.") anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - RadioButton + Cura.RadioButton { + id: checkUpdatesOptionBeta text: catalog.i18nc("@option:radio", "Stable and Beta releases") - exclusiveGroup: curaUpdatesGroup enabled: checkUpdatesCheckbox.checked checked: UM.Preferences.getValue("info/latest_update_source") == "beta" onClicked: UM.Preferences.setValue("info/latest_update_source", "beta") diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index a8b64f94a4..b1a5d7f19b 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -1,25 +1,26 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.1 import QtQuick.Window 2.1 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura UM.ManagementPage { - id: base; + id: base - title: catalog.i18nc("@title:tab", "Printers"); + title: catalog.i18nc("@title:tab", "Printers") model: Cura.GlobalStacksModel { } sectionRole: "discoverySource" activeId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: "" activeIndex: activeMachineIndex() + onHamburgeButtonClicked: menu.popup(content_item, content_item.width - menu.width, hamburger_button.height) function activeMachineIndex() { @@ -34,45 +35,21 @@ UM.ManagementPage } buttons: [ - Button + Cura.SecondaryButton { - id: activateMenuButton - text: catalog.i18nc("@action:button", "Activate"); - iconName: "list-activate"; - enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id - onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id) - }, - Button - { - id: addMenuButton - text: catalog.i18nc("@action:button", "Add"); - iconName: "list-add"; + text: catalog.i18nc("@action:button", "Add New") onClicked: Cura.Actions.addMachine.trigger() - }, - Button - { - id: removeMenuButton - text: catalog.i18nc("@action:button", "Remove"); - iconName: "list-remove"; - enabled: base.currentItem != null && model.count > 1 - onClicked: confirmDialog.open(); - }, - Button - { - id: renameMenuButton - text: catalog.i18nc("@action:button", "Rename"); - iconName: "edit-rename"; - enabled: base.currentItem != null && base.currentItem.metadata.group_name == null - onClicked: renameDialog.open(); } ] Item { + id: content_item visible: base.currentItem != null anchors.fill: parent - Label + + UM.Label { id: machineName text: base.currentItem && base.currentItem.name ? base.currentItem.name : "" @@ -85,10 +62,14 @@ UM.ManagementPage { id: machineActions visible: currentItem && currentItem.id == Cura.MachineManager.activeMachine.id - anchors.left: parent.left - anchors.right: parent.right - anchors.top: machineName.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors + { + left: parent.left + right: parent.right + top: machineName.bottom + topMargin: UM.Theme.getSize("default_margin").height + } + spacing: UM.Theme.getSize("default_margin").height Repeater { @@ -99,7 +80,7 @@ UM.ManagementPage { width: Math.round(childrenRect.width + 2 * screenScaleFactor) height: childrenRect.height - Button + Cura.SecondaryButton { text: machineActionRepeater.model[index].label onClicked: @@ -122,12 +103,6 @@ UM.ManagementPage minimumHeight: UM.Theme.getSize("modal_window_minimum").height maximumWidth: minimumWidth * 3 maximumHeight: minimumHeight * 3 - rightButtons: Button - { - text: catalog.i18nc("@action:button", "Close") - iconName: "dialog-close" - onClicked: actionDialog.reject() - } } UM.I18nCatalog { id: catalog; name: "cura"; } @@ -136,8 +111,9 @@ UM.ManagementPage { id: confirmDialog object: base.currentItem && base.currentItem.name ? base.currentItem.name : "" - text: base.currentItem ? base.currentItem.removalWarning : ""; - onYes: + text: base.currentItem ? base.currentItem.removalWarning : "" + + onAccepted: { Cura.MachineManager.removeMachine(base.currentItem.id) if(!base.currentItem) @@ -149,19 +125,41 @@ UM.ManagementPage } } - UM.RenameDialog + Cura.RenameDialog { - id: renameDialog; - object: base.currentItem && base.currentItem.name ? base.currentItem.name : ""; + id: renameDialog + object: base.currentItem && base.currentItem.name ? base.currentItem.name : "" property var machine_name_validator: Cura.MachineNameValidator { } - validName: renameDialog.newName.match(renameDialog.machine_name_validator.machineNameRegex) != null; + validName: renameDialog.newName.match(renameDialog.machine_name_validator.machineNameRegex) != null onAccepted: { - Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim()); + Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim()) //Force updating currentItem and the details panel objectList.onCurrentIndexChanged() } } + Cura.Menu + { + id: menu + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Activate") + enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id + onTriggered: Cura.MachineManager.setActiveMachine(base.currentItem.id) + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Remove") + enabled: base.currentItem != null && model.count > 1 + onTriggered: confirmDialog.open() + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Rename") + enabled: base.currentItem != null && base.currentItem.metadata.group_name == null + onTriggered: renameDialog.open() + } + } Connections { @@ -172,6 +170,5 @@ UM.ManagementPage objectList.onCurrentIndexChanged() } } - } } diff --git a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml index 04e39f33b1..7c853c8a05 100644 --- a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml @@ -3,11 +3,9 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura // An expandable list of materials. Includes both the header (this file) and the items (brandMaterialList) @@ -43,13 +41,12 @@ Item { id: brand_header width: parent.width - Label + UM.Label { id: brand_name text: sectionName height: UM.Theme.getSize("favorites_row").height width: parent.width - UM.Theme.getSize("favorites_button").width - verticalAlignment: Text.AlignVCenter leftPadding: (UM.Theme.getSize("default_margin").width / 2) | 0 } Item diff --git a/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml b/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml index e821dfb955..04c722cd40 100644 --- a/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml +++ b/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml @@ -4,7 +4,6 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Preferences/Materials/MaterialsList.qml b/resources/qml/Preferences/Materials/MaterialsList.qml index 3173fbd680..6cbb42ad15 100644 --- a/resources/qml/Preferences/Materials/MaterialsList.qml +++ b/resources/qml/Preferences/Materials/MaterialsList.qml @@ -3,9 +3,7 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Preferences/Materials/MaterialsPage.qml b/resources/qml/Preferences/Materials/MaterialsPage.qml index 6ec23f001f..c9e6cf07a1 100644 --- a/resources/qml/Preferences/Materials/MaterialsPage.qml +++ b/resources/qml/Preferences/Materials/MaterialsPage.qml @@ -1,12 +1,12 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.3 import QtQuick.Dialogs 1.2 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.5 as Cura Item @@ -106,7 +106,7 @@ Item { id: activateMenuButton text: catalog.i18nc("@action:button", "Activate") - iconName: "list-activate" + icon.name: "list-activate" enabled: !isCurrentItemActivated && Cura.MachineManager.activeMachine.hasMaterials onClicked: { @@ -124,7 +124,7 @@ Item { id: createMenuButton text: catalog.i18nc("@action:button", "Create") - iconName: "list-add" + icon.name: "list-add" enabled: Cura.MachineManager.activeMachine.hasMaterials onClicked: { @@ -139,7 +139,7 @@ Item { id: duplicateMenuButton text: catalog.i18nc("@action:button", "Duplicate"); - iconName: "list-add" + icon.name: "list-add" enabled: base.hasCurrentItem onClicked: { @@ -154,7 +154,7 @@ Item { id: removeMenuButton text: catalog.i18nc("@action:button", "Remove") - iconName: "list-remove" + icon.name: "list-remove" enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && base.materialManagementModel.canMaterialBeRemoved(base.currentItem.container_node) onClicked: @@ -169,7 +169,7 @@ Item { id: importMenuButton text: catalog.i18nc("@action:button", "Import") - iconName: "document-import" + icon.name: "document-import" onClicked: { forceActiveFocus(); @@ -183,7 +183,7 @@ Item { id: exportMenuButton text: catalog.i18nc("@action:button", "Export") - iconName: "document-export" + icon.name: "document-export" onClicked: { forceActiveFocus(); @@ -197,7 +197,7 @@ Item { id: syncMaterialsButton text: catalog.i18nc("@action:button Sending materials to printers", "Sync with Printers") - iconName: "sync-synchronizing" + icon.name: "sync-synchronizing" onClicked: { forceActiveFocus(); @@ -207,7 +207,8 @@ Item } } - Item { + Item + { id: contentsItem anchors { @@ -271,22 +272,26 @@ Item bottom: parent.bottom left: parent.left } - - Rectangle - { - parent: viewport - anchors.fill: parent - color: palette.light - } - width: (parent.width * 0.4) | 0 - frameVisible: true - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + + clip: true + ScrollBar.vertical: UM.ScrollBar + { + id: materialScrollBar + parent: materialScrollView + anchors + { + top: parent.top + right: parent.right + bottom: parent.bottom + } + } + contentHeight: materialListView.height //For some reason, this is not determined automatically with this ScrollView. Very weird! MaterialsList { id: materialListView - width: materialScrollView.viewport.width + width: materialScrollView.width - materialScrollBar.width } } @@ -305,17 +310,15 @@ Item } // Dialogs - MessageDialog + Cura.MessageDialog { id: confirmRemoveMaterialDialog - icon: StandardIcon.Question; title: catalog.i18nc("@title:window", "Confirm Remove") property string materialName: base.currentItem !== null ? base.currentItem.name : "" text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(materialName) - standardButtons: StandardButton.Yes | StandardButton.No - modality: Qt.ApplicationModal - onYes: + standardButtons: Dialog.Yes | Dialog.No + onAccepted: { // Set the active material as the fallback. It will be selected when the current material is deleted base.newRootMaterialIdToSwitchTo = base.active_root_material_id @@ -332,22 +335,19 @@ Item folder: CuraApplication.getDefaultPath("dialog_material_path") onAccepted: { - var result = Cura.ContainerManager.importMaterialContainer(fileUrl); + const result = Cura.ContainerManager.importMaterialContainer(fileUrl); + const messageDialog = Qt.createQmlObject("import Cura 1.5 as Cura; Cura.MessageDialog { onClosed: destroy() }", base); + messageDialog.standardButtons = Dialog.Ok; messageDialog.title = catalog.i18nc("@title:window", "Import Material"); - messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags or !", "Could not import material %1: %2").arg(fileUrl).arg(result.message); - if (result.status == "success") + switch (result.status) { - messageDialog.icon = StandardIcon.Information; - messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag !", "Successfully imported material %1").arg(fileUrl); - } - else if (result.status == "duplicate") - { - messageDialog.icon = StandardIcon.Warning; - } - else - { - messageDialog.icon = StandardIcon.Critical; + case "success": + messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag !", "Successfully imported material %1").arg(fileUrl); + break; + default: + messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags or !", "Could not import material %1: %2").arg(fileUrl).arg(result.message); + break; } messageDialog.open(); CuraApplication.setDefaultPath("dialog_material_path", folder); @@ -363,27 +363,23 @@ Item folder: CuraApplication.getDefaultPath("dialog_material_path") onAccepted: { - var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl); + const result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl); + const messageDialog = Qt.createQmlObject("import Cura 1.5 as Cura; Cura.MessageDialog { onClosed: destroy() }", base); messageDialog.title = catalog.i18nc("@title:window", "Export Material"); - if (result.status == "error") + messageDialog.standardButtons = Dialog.Ok; + switch (result.status) { - messageDialog.icon = StandardIcon.Critical; - messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags and !", "Failed to export material to %1: %2").arg(fileUrl).arg(result.message); - messageDialog.open(); - } - else if (result.status == "success") - { - messageDialog.icon = StandardIcon.Information; - messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag !", "Successfully exported material to %1").arg(result.path); - messageDialog.open(); + case "error": + messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags and !", "Failed to export material to %1: %2").arg(fileUrl).arg(result.message); + break; + case "success": + messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag !", "Successfully exported material to %1").arg(result.path); + break; } + messageDialog.open(); + CuraApplication.setDefaultPath("dialog_material_path", folder); } } - - MessageDialog - { - id: messageDialog - } } diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index 840c636196..cd8c05fbf9 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -1,11 +1,9 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura @@ -91,10 +89,7 @@ Rectangle CuraApplication.getMaterialManagementModel().addFavorite(material.root_material_id) } } - style: ButtonStyle - { - background: Item { } - } + UM.RecolorImage { anchors diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index d7d158eef2..e592be6d5d 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -1,4 +1,4 @@ -//Copyright (c) 2021 Ultimaker B.V. +//Copyright (c) 2022 Ultimaker B.V. //Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.15 @@ -7,7 +7,7 @@ import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.15 import QtQuick.Window 2.1 import Cura 1.1 as Cura -import UM 1.4 as UM +import UM 1.5 as UM Window { @@ -20,6 +20,7 @@ Window width: minimumWidth height: minimumHeight modality: Qt.ApplicationModal + color: UM.Theme.getColor("main_background") property variant syncModel property alias pageIndex: swipeView.currentIndex @@ -32,82 +33,78 @@ Window anchors.fill: parent interactive: false - Rectangle + Item { id: introPage - color: UM.Theme.getColor("main_background") - Column + + ColumnLayout { spacing: UM.Theme.getSize("default_margin").height anchors.fill: parent anchors.margins: UM.Theme.getSize("default_margin").width - Label + UM.Label { text: catalog.i18nc("@title:header", "Sync materials with printers") font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") + Layout.fillWidth: true } - Label + UM.Label { text: catalog.i18nc("@text", "Following a few simple steps, you will be able to synchronize all your material profiles with your printers.") font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - wrapMode: Text.Wrap - width: parent.width + Layout.fillWidth: true } + Image { + Layout.fillWidth: true + Layout.fillHeight: true source: UM.Theme.getImage("material_ecosystem") - width: parent.width + fillMode: Image.PreserveAspectFit sourceSize.width: width } - } - Cura.PrimaryButton - { - id: startButton - anchors + Item { - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - bottom: parent.bottom - bottomMargin: UM.Theme.getSize("default_margin").height - } - text: catalog.i18nc("@button", "Start") - onClicked: - { - if(Cura.API.account.isLoggedIn) + Layout.preferredHeight: childrenRect.height + Layout.alignment: Qt.AlignBottom + Layout.fillWidth: true + + Cura.TertiaryButton { - swipeView.currentIndex += 2; //Skip sign in page. + text: catalog.i18nc("@button", "Why do I need to sync material profiles?") + iconSource: UM.Theme.getIcon("LinkExternal") + isIconOnRightSide: true + onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360013137919?utm_source=cura&utm_medium=software&utm_campaign=sync-material-printer-why") } - else + + Cura.PrimaryButton { - swipeView.currentIndex += 1; + anchors.right: parent.right + text: catalog.i18nc("@button", "Start") + onClicked: + { + if(Cura.API.account.isLoggedIn) + { + swipeView.currentIndex += 2; //Skip sign in page. + } + else + { + swipeView.currentIndex += 1; + } + } } } } - Cura.TertiaryButton - { - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - verticalCenter: startButton.verticalCenter - } - text: catalog.i18nc("@button", "Why do I need to sync material profiles?") - iconSource: UM.Theme.getIcon("LinkExternal") - isIconOnRightSide: true - onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360013137919?utm_source=cura&utm_medium=software&utm_campaign=sync-material-printer-why") - } } - Rectangle + Item { id: signinPage - color: UM.Theme.getColor("main_background") - Connections //While this page is active, continue to the next page if the user logs in. + // While this page is active, continue to the next page if the user logs in. + Connections { target: Cura.API.account function onLoginStateChanged(is_logged_in) @@ -125,40 +122,35 @@ Window anchors.fill: parent anchors.margins: UM.Theme.getSize("default_margin").width - Label + UM.Label { text: catalog.i18nc("@title:header", "Sign in") font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") - Layout.preferredHeight: height + Layout.fillWidth: true } - Label + UM.Label { text: catalog.i18nc("@text", "To automatically sync the material profiles with all your printers connected to Digital Factory you need to be signed in in Cura.") font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - wrapMode: Text.Wrap - width: parent.width - Layout.maximumWidth: width - Layout.preferredHeight: height + Layout.fillWidth: true } - Item + + Image { - Layout.preferredWidth: parent.width + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: parent.width / 2 + source: UM.Theme.getImage("first_run_ultimaker_cloud") Layout.fillHeight: true - Image - { - source: UM.Theme.getImage("first_run_ultimaker_cloud") - width: parent.width / 2 - sourceSize.width: width - anchors.centerIn: parent - } + sourceSize.width: width + fillMode: Image.PreserveAspectFit } + Item { - width: parent.width - height: childrenRect.height - Layout.preferredHeight: height + Layout.preferredHeight: childrenRect.height + Layout.alignment: Qt.AlignBottom + Layout.fillWidth: true + Cura.SecondaryButton { anchors.left: parent.left @@ -175,10 +167,9 @@ Window } } - Rectangle + Item { id: printerListPage - color: UM.Theme.getColor("main_background") ColumnLayout { @@ -189,7 +180,6 @@ Window Row { - Layout.preferredHeight: childrenRect.height spacing: UM.Theme.getSize("default_margin").width states: [ @@ -220,244 +210,225 @@ Window { id: printerListHeaderIcon width: UM.Theme.getSize("section_icon").width - height: width + height: UM.Theme.getSize("section_icon").height anchors.verticalCenter: parent.verticalCenter } - Label + UM.Label { id: printerListHeader anchors.verticalCenter: parent.verticalCenter //Text is always defined by the states above. font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") } } Row { - Layout.preferredWidth: parent.width + Layout.fillWidth: true Layout.preferredHeight: childrenRect.height - Label + UM.Label { id: syncStatusLabel - - width: parent.width - UM.Theme.getSize("default_margin").width - troubleshootingLink.width - + anchors.left: parent.left wrapMode: Text.Wrap elide: Text.ElideRight visible: text !== "" - text: "" - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") } Cura.TertiaryButton { id: troubleshootingLink + anchors.right: parent.right text: catalog.i18nc("@button", "Troubleshooting") visible: typeof syncModel !== "undefined" && syncModel.exportUploadStatus == "error" iconSource: UM.Theme.getIcon("LinkExternal") onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-troubleshoot-cloud-printer") } } - ScrollView + ListView { - id: printerListScrollView - width: parent.width - Layout.preferredWidth: width + id: printerList + Layout.fillWidth: true Layout.fillHeight: true + clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - ListView + ScrollBar.vertical: UM.ScrollBar { - id: printerList - width: parent.width - spacing: UM.Theme.getSize("default_margin").height + id: printerListScrollBar + } + spacing: UM.Theme.getSize("default_margin").height - model: cloudPrinterList - delegate: Rectangle + model: cloudPrinterList + delegate: Rectangle + { + id: delegateContainer + color: "transparent" + border.color: UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width + width: printerList.width - printerListScrollBar.width + height: UM.Theme.getSize("machine_selector_icon").height + 2 * UM.Theme.getSize("default_margin").height + + property string syncStatus: { - id: delegateContainer - color: "transparent" - border.color: UM.Theme.getColor("lining") - border.width: UM.Theme.getSize("default_lining").width - width: printerListScrollView.width - height: UM.Theme.getSize("card").height - - property string syncStatus: + var printer_id = model.metadata["host_guid"] + if(syncModel.printerStatus[printer_id] === undefined) //No status information available. Could be added after we started syncing. { - var printer_id = model.metadata["host_guid"] - if(syncModel.printerStatus[printer_id] === undefined) //No status information available. Could be added after we started syncing. - { - return "idle"; - } - return syncModel.printerStatus[printer_id]; + return "idle"; + } + return syncModel.printerStatus[printer_id]; + } + + Cura.IconWithText + { + anchors + { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: Math.round(parent.height - height) / 2 //Equal margin on the left as above and below. + right: parent.right + rightMargin: Math.round(parent.height - height) / 2 } - Cura.IconWithText - { - anchors - { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: Math.round(parent.height - height) / 2 //Equal margin on the left as above and below. - right: parent.right - rightMargin: Math.round(parent.height - height) / 2 - } + text: model.name + font: UM.Theme.getFont("medium") - text: model.name - font: UM.Theme.getFont("medium") - - source: UM.Theme.getIcon("Printer", "medium") - iconColor: UM.Theme.getColor("machine_selector_printer_icon") - iconSize: UM.Theme.getSize("machine_selector_icon").width - - //Printer status badge (always cloud, but whether it's online or offline). - UM.RecolorImage - { - width: UM.Theme.getSize("printer_status_icon").width - height: UM.Theme.getSize("printer_status_icon").height - anchors - { - bottom: parent.bottom - bottomMargin: -Math.round(height / 6) - left: parent.left - leftMargin: parent.iconSize - Math.round(width * 5 / 6) - } - - source: UM.Theme.getIcon("CloudBadge", "low") - color: UM.Theme.getColor("primary") - - //Make a themeable circle in the background so we can change it in other themes. - Rectangle - { - anchors.centerIn: parent - width: parent.width - 1.5 //1.5 pixels smaller (at least sqrt(2), regardless of pixel scale) so that the circle doesn't show up behind the icon due to anti-aliasing. - height: parent.height - 1.5 - radius: width / 2 - color: UM.Theme.getColor("connection_badge_background") - z: parent.z - 1 - } - } - } + source: UM.Theme.getIcon("Printer", "medium") + iconColor: UM.Theme.getColor("machine_selector_printer_icon") + iconSize: UM.Theme.getSize("machine_selector_icon").width + //Printer status badge (always cloud, but whether it's online or offline). UM.RecolorImage { - id: printerSpinner - width: UM.Theme.getSize("section_icon").width - height: width - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below. + width: UM.Theme.getSize("printer_status_icon").width + height: UM.Theme.getSize("printer_status_icon").height + anchors + { + bottom: parent.bottom + bottomMargin: -Math.round(height / 6) + left: parent.left + leftMargin: parent.iconSize - Math.round(width * 5 / 6) + } - visible: delegateContainer.syncStatus === "uploading" - source: UM.Theme.getIcon("ArrowDoubleCircleRight") + source: UM.Theme.getIcon("CloudBadge", "low") color: UM.Theme.getColor("primary") - RotationAnimator + //Make a themeable circle in the background so we can change it in other themes. + Rectangle { - target: printerSpinner - from: 0 - to: 360 - duration: 1000 - loops: Animation.Infinite - running: true + anchors.centerIn: parent + width: parent.width - 1.5 //1.5 pixels smaller (at least sqrt(2), regardless of pixel scale) so that the circle doesn't show up behind the icon due to anti-aliasing. + height: parent.height - 1.5 + radius: width / 2 + color: UM.Theme.getColor("connection_badge_background") + z: parent.z - 1 } } - UM.StatusIcon - { - width: UM.Theme.getSize("section_icon").width - height: width - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below. - - visible: delegateContainer.syncStatus === "failed" || delegateContainer.syncStatus === "success" - status: delegateContainer.syncStatus === "success" ? UM.StatusIcon.Status.POSITIVE : UM.StatusIcon.Status.ERROR - } } - footer: Item + UM.RecolorImage { - width: printerListScrollView.width - height: { - if(!visible) - { - return 0; - } - let h = UM.Theme.getSize("card").height + printerListTroubleshooting.height + UM.Theme.getSize("default_margin").height * 2; //1 margin between content and footer, 1 for troubleshooting link. - return h; - } - visible: includeOfflinePrinterList.count - cloudPrinterList.count > 0 && typeof syncModel !== "undefined" && syncModel.exportUploadStatus === "idle" - Rectangle + id: printerSpinner + width: UM.Theme.getSize("section_icon").width + height: width + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below. + + visible: delegateContainer.syncStatus === "uploading" + source: UM.Theme.getIcon("ArrowDoubleCircleRight") + color: UM.Theme.getColor("primary") + + RotationAnimator { - anchors.fill: parent - anchors.topMargin: UM.Theme.getSize("default_margin").height + target: printerSpinner + from: 0 + to: 360 + duration: 1000 + loops: Animation.Infinite + running: true + } + } + UM.StatusIcon + { + width: UM.Theme.getSize("section_icon").width + height: width + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below. - border.color: UM.Theme.getColor("lining") - border.width: UM.Theme.getSize("default_lining").width - color: "transparent" + visible: delegateContainer.syncStatus === "failed" || delegateContainer.syncStatus === "success" + status: delegateContainer.syncStatus === "success" ? UM.StatusIcon.Status.POSITIVE : UM.StatusIcon.Status.ERROR + } + } - Row + footer: Item + { + width: printerList.width - printerListScrollBar.width + height: childrenRect.height + UM.Theme.getSize("default_margin").height + visible: includeOfflinePrinterList.count - cloudPrinterList.count > 0 && typeof syncModel !== "undefined" && syncModel.exportUploadStatus === "idle" + Rectangle + { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + border.color: UM.Theme.getColor("lining") + border.width: UM.Theme.getSize("default_lining").width + anchors.topMargin: UM.Theme.getSize("default_margin").height + height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height + + color: "transparent" + + GridLayout + { + columns: 3 + rows: 2 + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: UM.Theme.getSize("thick_margin").width + anchors.rightMargin: UM.Theme.getSize("thick_margin").width + anchors.topMargin: UM.Theme.getSize("thick_margin").height + anchors.bottomMargin: UM.Theme.getSize("thick_margin").height + columnSpacing: UM.Theme.getSize("default_margin").width + rowSpacing: UM.Theme.getSize("default_margin").height + + UM.StatusIcon { - anchors - { - fill: parent - margins: Math.round(UM.Theme.getSize("card").height - UM.Theme.getSize("machine_selector_icon").width) / 2 //Same margin as in other cards. - } - spacing: UM.Theme.getSize("default_margin").width + Layout.preferredWidth: UM.Theme.getSize("section_icon").width + Layout.preferredHeight: UM.Theme.getSize("section_icon").height + status: UM.StatusIcon.Status.WARNING + } - UM.StatusIcon - { - id: infoIcon - width: UM.Theme.getSize("section_icon").width - height: width - //Fake anchor.verticalCenter: printersMissingText.verticalCenter, since we can't anchor to things that aren't siblings. - anchors.top: parent.top - anchors.topMargin: Math.round(printersMissingText.height / 2 - height / 2) + UM.Label + { + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter + text: catalog.i18nc("@text Asking the user whether printers are missing in a list.", "Printers missing?") + + "\n" + + catalog.i18nc("@text", "Make sure all your printers are turned ON and connected to Digital Factory.") + font: UM.Theme.getFont("medium") + elide: Text.ElideRight + } - status: UM.StatusIcon.Status.WARNING - } + Cura.SecondaryButton + { + id: refreshListButton + Layout.alignment: Qt.AlignVCenter + text: catalog.i18nc("@button", "Refresh List") + iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") + onClicked: Cura.API.account.sync(true) + } - Column - { - //Fill the total width. Can't use layouts because we need the anchors for vertical alignment. - width: parent.width - infoIcon.width - refreshListButton.width - parent.spacing * 2 - - spacing: UM.Theme.getSize("default_margin").height - - Label - { - id: printersMissingText - text: catalog.i18nc("@text Asking the user whether printers are missing in a list.", "Printers missing?") - + "\n" - + catalog.i18nc("@text", "Make sure all your printers are turned ON and connected to Digital Factory.") - font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - elide: Text.ElideRight - } - Cura.TertiaryButton - { - id: printerListTroubleshooting - leftPadding: 0 //Want to visually align this to the text. - - text: catalog.i18nc("@button", "Troubleshooting") - iconSource: UM.Theme.getIcon("LinkExternal") - onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-troubleshoot-cloud-printer") - } - } - - Cura.SecondaryButton - { - id: refreshListButton - //Fake anchor.verticalCenter: printersMissingText.verticalCenter, since we can't anchor to things that aren't siblings. - anchors.top: parent.top - anchors.topMargin: Math.round(printersMissingText.height / 2 - height / 2) - - text: catalog.i18nc("@button", "Refresh List") - iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") - onClicked: Cura.API.account.sync(true) - } + Cura.TertiaryButton + { + id: printerListTroubleshooting + Layout.column: 1 + Layout.row: 1 + Layout.fillWidth: true + leftPadding: 0 + text: catalog.i18nc("@button", "Troubleshooting") + iconSource: UM.Theme.getIcon("LinkExternal") + onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-troubleshoot-cloud-printer") } } } @@ -465,10 +436,9 @@ Window } Item { - width: parent.width - height: childrenRect.height - Layout.preferredWidth: width - Layout.preferredHeight: height + Layout.fillWidth: true + Layout.preferredHeight: childrenRect.height + Layout.alignment: Qt.AlignBottom Cura.SecondaryButton { @@ -540,7 +510,7 @@ Window running: true } } - Label + UM.Label { id: syncingLabel anchors.left: syncingIcon.right @@ -554,56 +524,62 @@ Window } } - ColumnLayout //Placeholder for when the user has no cloud printers. + // Placeholder for when the user has no cloud printers. + ColumnLayout { spacing: UM.Theme.getSize("default_margin").height anchors.fill: parent anchors.margins: UM.Theme.getSize("default_margin").width visible: cloudPrinterList.count == 0 - Label + UM.Label { text: catalog.i18nc("@title:header", "No printers found") font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") - Layout.preferredWidth: width - Layout.preferredHeight: height - } - Image - { - source: UM.Theme.getImage("3d_printer_faded") - sourceSize.width: width - fillMode: Image.PreserveAspectFit - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: parent.width / 3 - } - Label - { - text: catalog.i18nc("@text", "It seems like you don't have any compatible printers connected to Digital Factory. Make sure your printer is connected and it's running the latest firmware.") - width: parent.width - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.Wrap - Layout.preferredWidth: width - Layout.preferredHeight: height + Layout.fillWidth: true } + Item { - Layout.preferredWidth: parent.width + Layout.fillWidth: true Layout.fillHeight: true + + Image + { + anchors.fill: parent + source: UM.Theme.getImage("3d_printer_faded") + sourceSize.width: width + fillMode: Image.PreserveAspectFit + } + } + + UM.Label + { + text: catalog.i18nc("@text", "It seems like you don't have any compatible printers connected to Digital Factory. Make sure your printer is connected and it's running the latest firmware.") + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.Wrap + } + + Item + { + Layout.fillWidth: true + Layout.preferredHeight: parent.height / 4 Cura.TertiaryButton { text: catalog.i18nc("@button", "Learn how to connect your printer to Digital Factory") iconSource: UM.Theme.getIcon("LinkExternal") onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-add-cloud-printer") anchors.horizontalCenter: parent.horizontalCenter + maximumWidth: parent.width } } + Item { - width: parent.width - height: childrenRect.height - Layout.preferredWidth: width - Layout.preferredHeight: height + Layout.preferredHeight: childrenRect.height + Layout.alignment: Qt.AlignBottom + Layout.fillWidth: true Cura.SecondaryButton { @@ -611,30 +587,34 @@ Window text: catalog.i18nc("@button", "Sync materials with USB") onClicked: swipeView.currentIndex = removableDriveSyncPage.SwipeView.index } - Cura.PrimaryButton + + RowLayout { - id: disabledSyncButton anchors.right: parent.right - text: catalog.i18nc("@button", "Sync") - enabled: false //If there are no printers, always disable this button. - } - Cura.SecondaryButton - { - anchors.right: disabledSyncButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@button", "Refresh") - iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") - outlineColor: "transparent" - onClicked: Cura.API.account.sync(true) + spacing: UM.Theme.getSize("default_margin").width + + Cura.SecondaryButton + { + text: catalog.i18nc("@button", "Refresh") + iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") + outlineColor: "transparent" + onClicked: Cura.API.account.sync(true) + } + + Cura.PrimaryButton + { + id: disabledSyncButton + text: catalog.i18nc("@button", "Sync") + enabled: false // If there are no printers, always disable this button. + } } } } } - Rectangle + Item { id: removableDriveSyncPage - color: UM.Theme.getColor("main_background") ColumnLayout { @@ -642,53 +622,56 @@ Window anchors.fill: parent anchors.margins: UM.Theme.getSize("default_margin").width - Label + UM.Label { text: catalog.i18nc("@title:header", "Sync material profiles via USB") font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") - Layout.preferredHeight: height + Layout.fillWidth: true } - Label + UM.Label { text: catalog.i18nc("@text In the UI this is followed by a list of steps the user needs to take.", "Follow the following steps to load the new material profiles to your printer.") font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") wrapMode: Text.Wrap - width: parent.width - Layout.maximumWidth: width - Layout.preferredHeight: height + Layout.fillWidth: true } - Row + + RowLayout { - width: parent.width - Layout.preferredWidth: width + Layout.fillWidth: true Layout.fillHeight: true spacing: UM.Theme.getSize("default_margin").width - Image + Item { - source: UM.Theme.getImage("insert_usb") - width: parent.width / 3 - height: width - anchors.verticalCenter: parent.verticalCenter - sourceSize.width: width + Layout.preferredWidth: parent.width / 3 + Layout.fillHeight: true + + Image + { + anchors.fill: parent + source: UM.Theme.getImage("insert_usb") + verticalAlignment: Image.AlignVCenter + horizontalAlignment: Image.AlignHCenter + fillMode: Image.PreserveAspectFit + sourceSize.width: width + } } - Label + + UM.Label { + Layout.alignment: Qt.AlignCenter + Layout.fillWidth: true text: "1. " + catalog.i18nc("@text", "Click the export material archive button.") + "\n2. " + catalog.i18nc("@text", "Save the .umm file on a USB stick.") + "\n3. " + catalog.i18nc("@text", "Insert the USB stick into your printer and launch the procedure to load new material profiles.") font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - wrapMode: Text.Wrap - width: parent.width * 2 / 3 - UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter } } Cura.TertiaryButton { + Layout.fillWidth: true text: catalog.i18nc("@button", "How to load new material profiles to my printer") iconSource: UM.Theme.getIcon("LinkExternal") onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/4403319801106/?utm_source=cura&utm_medium=software&utm_campaign=add-material-profiles-via-usb") @@ -696,10 +679,9 @@ Window Item { - width: parent.width - height: childrenRect.height - Layout.preferredWidth: width - Layout.preferredHeight: height + Layout.preferredHeight: childrenRect.height + Layout.alignment: Qt.AlignBottom + Layout.fillWidth: true Cura.SecondaryButton { @@ -732,24 +714,22 @@ Window } } - Cura.GlobalStacksModel + property variant cloudPrinterList: Cura.GlobalStacksModel { - id: cloudPrinterList filterConnectionType: 3 //Only show cloud connections. filterOnlineOnly: true //Only show printers that are online. filterCapabilities: ["import_material"] //Only show printers that can receive the material profiles. } - Cura.GlobalStacksModel + + property variant includeOfflinePrinterList: Cura.GlobalStacksModel { //In order to show a refresh button only when there are offline cloud printers, we need to know if there are any offline printers. //A global stacks model without the filter for online-only printers allows this. - id: includeOfflinePrinterList filterConnectionType: 3 //Still only show cloud connections. } - FileDialog + property variant exportUsbDialog: FileDialog { - id: exportUsbDialog title: catalog.i18nc("@title:window", "Export All Materials") selectExisting: false nameFilters: ["Material archives (*.umm)", "All files (*)"] diff --git a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml index 09f9964604..0a5d0e89e7 100644 --- a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml @@ -3,11 +3,9 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item @@ -57,13 +55,12 @@ Item { left: parent ? parent.left : undefined } - Label + UM.Label { text: materialName height: UM.Theme.getSize("favorites_row").height width: parent.width - parent.leftPadding - UM.Theme.getSize("favorites_button").width id: material_type_name - verticalAlignment: Text.AlignVCenter } Item // this one causes lots of warnings { diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 2c68973e55..915d36ff57 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -1,16 +1,16 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.15 import QtQuick.Dialogs 1.2 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura import ".." // Access to ReadOnlyTextArea.qml -TabView +Item { id: base @@ -67,402 +67,421 @@ TabView } } - Tab + UM.TabRow { - title: catalog.i18nc("@title", "Information") - - anchors.margins: UM.Theme.getSize("default_margin").width - - ScrollView + id: pageSelectorTabRow + UM.TabRowButton { - id: scrollView - anchors.fill: parent - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - flickableItem.flickableDirection: Flickable.VerticalFlick - frameVisible: true + text: catalog.i18nc("@title", "Information") + property string activeView: "information" //To determine which page gets displayed. + } + UM.TabRowButton + { + text: catalog.i18nc("@label", "Print settings") + property string activeView: "settings" + } + } - property real columnWidth: (viewport.width * 0.5 - UM.Theme.getSize("default_margin").width) | 0 + ScrollView + { + id: informationPage + anchors + { + top: pageSelectorTabRow.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } - Flow + ScrollBar.vertical: UM.ScrollBar + { + parent: informationPage + anchors { - id: containerGrid + top: parent.top + right: parent.right + bottom: parent.bottom + } + } + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + clip: true + visible: pageSelectorTabRow.currentItem.activeView === "information" - x: UM.Theme.getSize("default_margin").width - y: UM.Theme.getSize("default_lining").height + property real columnWidth: (width * 0.5 - UM.Theme.getSize("default_margin").width) | 0 - width: base.width - property real rowHeight: brandTextField.height + UM.Theme.getSize("default_lining").height + Flow + { + id: containerGrid - MessageDialog + x: UM.Theme.getSize("default_margin").width + y: UM.Theme.getSize("default_lining").height + + width: base.width + property real rowHeight: brandTextField.height + UM.Theme.getSize("default_lining").height + + Cura.MessageDialog + { + id: confirmDiameterChangeDialog + + title: catalog.i18nc("@title:window", "Confirm Diameter Change") + text: catalog.i18nc("@label (%1 is a number)", "The new filament diameter is set to %1 mm, which is not compatible with the current extruder. Do you wish to continue?".arg(new_diameter_value)) + standardButtons: Dialog.Yes | Dialog.No + + property var new_diameter_value: null + property var old_diameter_value: null + property var old_approximate_diameter_value: null + + onAccepted: { - id: confirmDiameterChangeDialog - - icon: StandardIcon.Question; - title: catalog.i18nc("@title:window", "Confirm Diameter Change") - text: catalog.i18nc("@label (%1 is a number)", "The new filament diameter is set to %1 mm, which is not compatible with the current extruder. Do you wish to continue?".arg(new_diameter_value)) - standardButtons: StandardButton.Yes | StandardButton.No - modality: Qt.ApplicationModal - - property var new_diameter_value: null; - property var old_diameter_value: null; - property var old_approximate_diameter_value: null; - - onYes: - { - base.setMetaDataEntry("approximate_diameter", old_approximate_diameter_value, getApproximateDiameter(new_diameter_value).toString()); - base.setMetaDataEntry("properties/diameter", properties.diameter, new_diameter_value); - // CURA-6868 Make sure to update the extruder to user a diameter-compatible material. - Cura.MachineManager.updateMaterialWithVariant() - base.resetSelectedMaterial() - } - - onNo: - { - base.properties.diameter = old_diameter_value; - diameterSpinBox.value = Qt.binding(function() { return base.properties.diameter }) - } - - onRejected: no() + base.setMetaDataEntry("approximate_diameter", old_approximate_diameter_value, getApproximateDiameter(new_diameter_value).toString()); + base.setMetaDataEntry("properties/diameter", properties.diameter, new_diameter_value); + // CURA-6868 Make sure to update the extruder to user a diameter-compatible material. + Cura.MachineManager.updateMaterialWithVariant() + base.resetSelectedMaterial() } - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Display Name") } - ReadOnlyTextField + onRejected: { - id: displayNameTextField; - width: scrollView.columnWidth; - text: properties.name; - readOnly: !base.editingEnabled; - onEditingFinished: base.updateMaterialDisplayName(properties.name, text) + base.properties.diameter = old_diameter_value; + diameterSpinBox.value = Qt.binding(function() { return base.properties.diameter }) } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") } - ReadOnlyTextField - { - id: brandTextField; - width: scrollView.columnWidth; - text: properties.brand; - readOnly: !base.editingEnabled; - onEditingFinished: base.updateMaterialBrand(properties.brand, text) - } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") } - ReadOnlyTextField - { - id: materialTypeField; - width: scrollView.columnWidth; - text: properties.material; - readOnly: !base.editingEnabled; - onEditingFinished: base.updateMaterialType(properties.material, text) - } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") } - Row - { - width: scrollView.columnWidth - height: parent.rowHeight - spacing: Math.round(UM.Theme.getSize("default_margin").width / 2) - - // color indicator square - Rectangle - { - id: colorSelector - color: properties.color_code - - width: Math.round(colorLabel.height * 0.75) - height: Math.round(colorLabel.height * 0.75) - border.width: UM.Theme.getSize("default_lining").height - - anchors.verticalCenter: parent.verticalCenter - - // open the color selection dialog on click - MouseArea - { - anchors.fill: parent - onClicked: colorDialog.open() - enabled: base.editingEnabled - } - } - - // pretty color name text field - ReadOnlyTextField - { - id: colorLabel; - width: parent.width - colorSelector.width - parent.spacing - text: properties.color_name; - readOnly: !base.editingEnabled - onEditingFinished: base.setMetaDataEntry("color_name", properties.color_name, text) - } - - // popup dialog to select a new color - // if successful it sets the properties.color_code value to the new color - ColorDialog - { - id: colorDialog - color: properties.color_code - onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color) - } - } - - Item { width: parent.width; height: UM.Theme.getSize("default_margin").height } - - Label { width: parent.width; height: parent.rowHeight; font.bold: true; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Properties") } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Density") } - ReadOnlySpinBox - { - id: densitySpinBox - width: scrollView.columnWidth - value: properties.density - decimals: 2 - suffix: " g/cm³" - stepSize: 0.01 - readOnly: !base.editingEnabled - - onEditingFinished: base.setMetaDataEntry("properties/density", properties.density, value) - onValueChanged: updateCostPerMeter() - } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Diameter") } - ReadOnlySpinBox - { - id: diameterSpinBox - width: scrollView.columnWidth - value: properties.diameter - decimals: 2 - suffix: " mm" - stepSize: 0.01 - readOnly: !base.editingEnabled - - onEditingFinished: - { - // This does not use a SettingPropertyProvider, because we need to make the change to all containers - // which derive from the same base_file - var old_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "properties/diameter"); - var old_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter"); - var new_approximate_diameter = getApproximateDiameter(value); - if (new_approximate_diameter != Cura.ExtruderManager.getActiveExtruderStack().approximateMaterialDiameter) - { - confirmDiameterChangeDialog.old_diameter_value = old_diameter; - confirmDiameterChangeDialog.new_diameter_value = value; - confirmDiameterChangeDialog.old_approximate_diameter_value = old_approximate_diameter; - - confirmDiameterChangeDialog.open() - } - else { - base.setMetaDataEntry("approximate_diameter", old_approximate_diameter, getApproximateDiameter(value).toString()); - base.setMetaDataEntry("properties/diameter", properties.diameter, value); - } - } - onValueChanged: updateCostPerMeter() - } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") } - SpinBox - { - id: spoolCostSpinBox - width: scrollView.columnWidth - value: base.getMaterialPreferenceValue(properties.guid, "spool_cost") - prefix: base.currency + " " - decimals: 2 - maximumValue: 100000000 - - onValueChanged: - { - base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value)) - updateCostPerMeter() - } - } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") } - SpinBox - { - id: spoolWeightSpinBox - width: scrollView.columnWidth - value: base.getMaterialPreferenceValue(properties.guid, "spool_weight", Cura.ContainerManager.getContainerMetaDataEntry(properties.container_id, "properties/weight")) - suffix: " g" - stepSize: 100 - decimals: 0 - maximumValue: 10000 - - onValueChanged: - { - base.setMaterialPreferenceValue(properties.guid, "spool_weight", parseFloat(value)) - updateCostPerMeter() - } - } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament length") } - Label - { - width: scrollView.columnWidth - text: "~ %1 m".arg(Math.round(base.spoolLength)) - verticalAlignment: Qt.AlignVCenter - height: parent.rowHeight - } - - Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Cost per Meter") } - Label - { - width: scrollView.columnWidth - text: "~ %1 %2/m".arg(base.costPerMeter.toFixed(2)).arg(base.currency) - verticalAlignment: Qt.AlignVCenter - height: parent.rowHeight - } - - Item { width: parent.width; height: UM.Theme.getSize("default_margin").height; visible: unlinkMaterialButton.visible } - Label - { - width: 2 * scrollView.columnWidth - verticalAlignment: Qt.AlignVCenter - text: catalog.i18nc("@label", "This material is linked to %1 and shares some of its properties.").arg(base.linkedMaterialNames) - wrapMode: Text.WordWrap - visible: unlinkMaterialButton.visible - } - Button - { - id: unlinkMaterialButton - text: catalog.i18nc("@label", "Unlink Material") - visible: base.linkedMaterialNames != "" - onClicked: - { - Cura.ContainerManager.unlinkMaterial(base.currentMaterialNode) - base.reevaluateLinkedMaterials = true - } - } - - Item { width: parent.width; height: UM.Theme.getSize("default_margin").height } - - Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Description") } - - ReadOnlyTextArea - { - text: properties.description; - width: 2 * scrollView.columnWidth - wrapMode: Text.WordWrap - - readOnly: !base.editingEnabled; - - onEditingFinished: base.setMetaDataEntry("description", properties.description, text) - } - - Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Adhesion Information") } - - ReadOnlyTextArea - { - text: properties.adhesion_info; - width: 2 * scrollView.columnWidth - wrapMode: Text.WordWrap - - readOnly: !base.editingEnabled; - - onEditingFinished: base.setMetaDataEntry("adhesion_info", properties.adhesion_info, text) - } - - Item { width: parent.width; height: UM.Theme.getSize("default_margin").height } } - function updateCostPerMeter() + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Display Name") } + Cura.TextField { - base.spoolLength = calculateSpoolLength(diameterSpinBox.value, densitySpinBox.value, spoolWeightSpinBox.value); - base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value); + id: displayNameTextField; + width: informationPage.columnWidth; + text: properties.name; + enabled: base.editingEnabled; + onEditingFinished: base.updateMaterialDisplayName(properties.name, text) + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") } + Cura.TextField + { + id: brandTextField + width: informationPage.columnWidth + text: properties.brand + enabled: base.editingEnabled + onEditingFinished: base.updateMaterialBrand(properties.brand, text) + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") } + Cura.TextField + { + id: materialTypeField + width: informationPage.columnWidth + text: properties.material + enabled: base.editingEnabled + onEditingFinished: base.updateMaterialType(properties.material, text) + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") } + Row + { + width: informationPage.columnWidth + height: parent.rowHeight + spacing: Math.round(UM.Theme.getSize("default_margin").width / 2) + + // color indicator square + Rectangle + { + id: colorSelector + color: properties.color_code + + width: Math.round(colorLabel.height * 0.75) + height: Math.round(colorLabel.height * 0.75) + border.width: UM.Theme.getSize("default_lining").height + + anchors.verticalCenter: parent.verticalCenter + + // open the color selection dialog on click + MouseArea + { + anchors.fill: parent + onClicked: colorDialog.open() + enabled: base.editingEnabled + } + } + + // pretty color name text field + Cura.TextField + { + id: colorLabel; + width: parent.width - colorSelector.width - parent.spacing + text: properties.color_name; + enabled: base.editingEnabled + onEditingFinished: base.setMetaDataEntry("color_name", properties.color_name, text) + } + + // popup dialog to select a new color + // if successful it sets the properties.color_code value to the new color + Cura.ColorDialog + { + id: colorDialog + title: catalog.i18nc("@title", "Material color picker") + color: properties.color_code + onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color) + } + } + + Item { width: parent.width; height: UM.Theme.getSize("default_margin").height } + + Label { width: parent.width; height: parent.rowHeight; font.bold: true; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Properties") } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Density") } + + Cura.SpinBox + { + enabled: base.editingEnabled + id: densitySpinBox + width: informationPage.columnWidth + value: properties.density + decimals: 2 + suffix: " g/cm³" + stepSize: 0.01 + + onEditingFinished: base.setMetaDataEntry("properties/density", properties.density, value) + onValueChanged: updateCostPerMeter() + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Diameter") } + Cura.SpinBox + { + enabled: base.editingEnabled + id: diameterSpinBox + width: informationPage.columnWidth + value: properties.diameter + decimals: 2 + suffix: " mm" + stepSize: 0.01 + + onEditingFinished: + { + // This does not use a SettingPropertyProvider, because we need to make the change to all containers + // which derive from the same base_file + var old_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "properties/diameter"); + var old_approximate_diameter = Cura.ContainerManager.getContainerMetaDataEntry(base.containerId, "approximate_diameter"); + var new_approximate_diameter = getApproximateDiameter(value); + if (new_approximate_diameter != Cura.ExtruderManager.getActiveExtruderStack().approximateMaterialDiameter) + { + confirmDiameterChangeDialog.old_diameter_value = old_diameter; + confirmDiameterChangeDialog.new_diameter_value = value; + confirmDiameterChangeDialog.old_approximate_diameter_value = old_approximate_diameter; + + confirmDiameterChangeDialog.open() + } + else { + base.setMetaDataEntry("approximate_diameter", old_approximate_diameter, getApproximateDiameter(value).toString()); + base.setMetaDataEntry("properties/diameter", properties.diameter, value); + } + } + onValueChanged: updateCostPerMeter() + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") } + + Cura.SpinBox + { + id: spoolCostSpinBox + width: informationPage.columnWidth + value: base.getMaterialPreferenceValue(properties.guid, "spool_cost") + to: 100000000 + editable: true + prefix: base.currency + " " + decimals: 2 + + onValueChanged: + { + base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value)) + updateCostPerMeter() + } + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") } + Cura.SpinBox + { + id: spoolWeightSpinBox + width: informationPage.columnWidth + value: base.getMaterialPreferenceValue(properties.guid, "spool_weight", Cura.ContainerManager.getContainerMetaDataEntry(properties.container_id, "properties/weight")) + stepSize: 100 + to: 10000 + editable: true + suffix: " g" + + onValueChanged: + { + base.setMaterialPreferenceValue(properties.guid, "spool_weight", parseFloat(value)) + updateCostPerMeter() + } + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament length") } + Label + { + width: informationPage.columnWidth + text: "~ %1 m".arg(Math.round(base.spoolLength)) + verticalAlignment: Qt.AlignVCenter + height: parent.rowHeight + } + + Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Cost per Meter") } + Label + { + width: informationPage.columnWidth + text: "~ %1 %2/m".arg(base.costPerMeter.toFixed(2)).arg(base.currency) + verticalAlignment: Qt.AlignVCenter + height: parent.rowHeight + } + + Item { width: parent.width; height: UM.Theme.getSize("default_margin").height; visible: unlinkMaterialButton.visible } + Label + { + width: 2 * informationPage.columnWidth + verticalAlignment: Qt.AlignVCenter + text: catalog.i18nc("@label", "This material is linked to %1 and shares some of its properties.").arg(base.linkedMaterialNames) + wrapMode: Text.WordWrap + visible: unlinkMaterialButton.visible + } + Button + { + id: unlinkMaterialButton + text: catalog.i18nc("@label", "Unlink Material") + visible: base.linkedMaterialNames != "" + onClicked: + { + Cura.ContainerManager.unlinkMaterial(base.currentMaterialNode) + base.reevaluateLinkedMaterials = true + } + } + + Item { width: parent.width; height: UM.Theme.getSize("default_margin").height } + + Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Description") } + + ReadOnlyTextArea + { + text: properties.description; + width: informationPage.columnWidth * 2 + height: 0.75 * informationPage.columnWidth + wrapMode: Text.WordWrap + + readOnly: !base.editingEnabled + + onEditingFinished: base.setMetaDataEntry("description", properties.description, text) + } + + Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Adhesion Information") } + + ReadOnlyTextArea + { + text: properties.adhesion_info + width: 2 * informationPage.columnWidth + wrapMode: Text.WordWrap + height: 0.75 * informationPage.columnWidth + readOnly: !base.editingEnabled + + onEditingFinished: base.setMetaDataEntry("adhesion_info", properties.adhesion_info, text) + } + + Item { width: parent.width; height: UM.Theme.getSize("default_margin").height } + } + } + + ListView + { + anchors + { + top: pageSelectorTabRow.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + + model: UM.SettingDefinitionsModel + { + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + visibilityHandler: Cura.MaterialSettingsVisibilityHandler { } + expanded: ["*"] + } + ScrollBar.vertical: UM.ScrollBar {} + clip: true + visible: pageSelectorTabRow.currentItem.activeView === "settings" + + delegate: UM.TooltipArea + { + width: childrenRect.width + height: childrenRect.height + text: model.description + Label + { + id: label + width: base.firstColumnWidth; + height: spinBox.height + UM.Theme.getSize("default_lining").height + text: model.label + elide: Text.ElideRight + verticalAlignment: Qt.AlignVCenter + } + Cura.SpinBox + { + id: spinBox + anchors.left: label.right + value: + { + // In case the setting is not in the material... + if (!isNaN(parseFloat(materialPropertyProvider.properties.value))) + { + return parseFloat(materialPropertyProvider.properties.value); + } + // ... we search in the variant, and if it is not there... + if (!isNaN(parseFloat(variantPropertyProvider.properties.value))) + { + return parseFloat(variantPropertyProvider.properties.value); + } + // ... then look in the definition container. + if (!isNaN(parseFloat(machinePropertyProvider.properties.value))) + { + return parseFloat(machinePropertyProvider.properties.value); + } + return 0; + } + width: base.secondColumnWidth + suffix: " " + model.unit + to: 99999 + decimals: model.unit == "mm" ? 2 : 0 + + onEditingFinished: materialPropertyProvider.setPropertyValue("value", value) + } + + UM.ContainerPropertyProvider + { + id: materialPropertyProvider + containerId: base.containerId + watchedProperties: [ "value" ] + key: model.key + } + UM.ContainerPropertyProvider + { + id: variantPropertyProvider + containerId: Cura.MachineManager.activeStack.variant.id + watchedProperties: [ "value" ] + key: model.key + } + UM.ContainerPropertyProvider + { + id: machinePropertyProvider + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + watchedProperties: [ "value" ] + key: model.key } } } - Tab + function updateCostPerMeter() { - title: catalog.i18nc("@label", "Print settings") - anchors - { - leftMargin: UM.Theme.getSize("default_margin").width - topMargin: UM.Theme.getSize("default_margin").height - bottomMargin: UM.Theme.getSize("default_margin").height - rightMargin: 0 - } - - ScrollView - { - anchors.fill: parent; - - ListView - { - model: UM.SettingDefinitionsModel - { - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - visibilityHandler: Cura.MaterialSettingsVisibilityHandler { } - expanded: ["*"] - } - - delegate: UM.TooltipArea - { - width: childrenRect.width - height: childrenRect.height - text: model.description - Label - { - id: label - width: base.firstColumnWidth; - height: spinBox.height + UM.Theme.getSize("default_lining").height - text: model.label - elide: Text.ElideRight - verticalAlignment: Qt.AlignVCenter - } - ReadOnlySpinBox - { - id: spinBox - anchors.left: label.right - value: - { - // In case the setting is not in the material... - if (!isNaN(parseFloat(materialPropertyProvider.properties.value))) - { - return parseFloat(materialPropertyProvider.properties.value); - } - // ... we search in the variant, and if it is not there... - if (!isNaN(parseFloat(variantPropertyProvider.properties.value))) - { - return parseFloat(variantPropertyProvider.properties.value); - } - // ... then look in the definition container. - if (!isNaN(parseFloat(machinePropertyProvider.properties.value))) - { - return parseFloat(machinePropertyProvider.properties.value); - } - return 0; - } - width: base.secondColumnWidth - readOnly: !base.editingEnabled - suffix: " " + model.unit - maximumValue: 99999 - decimals: model.unit == "mm" ? 2 : 0 - - onEditingFinished: materialPropertyProvider.setPropertyValue("value", value) - } - - UM.ContainerPropertyProvider - { - id: materialPropertyProvider - containerId: base.containerId - watchedProperties: [ "value" ] - key: model.key - } - UM.ContainerPropertyProvider - { - id: variantPropertyProvider - containerId: Cura.MachineManager.activeStack.variant.id - watchedProperties: [ "value" ] - key: model.key - } - UM.ContainerPropertyProvider - { - id: machinePropertyProvider - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - watchedProperties: [ "value" ] - key: model.key - } - } - } - } + base.spoolLength = calculateSpoolLength(diameterSpinBox.value, densitySpinBox.value, spoolWeightSpinBox.value); + base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value); } function calculateSpoolLength(diameter, density, spoolWeight) diff --git a/resources/qml/Preferences/ProfileTab.qml b/resources/qml/Preferences/ProfileTab.qml deleted file mode 100644 index 3c0c46ed72..0000000000 --- a/resources/qml/Preferences/ProfileTab.qml +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.7 -import QtQuick.Controls 1.4 - -import UM 1.2 as UM -import Cura 1.0 as Cura - -Tab -{ - id: base - - property int extruderPosition: -1 //Denotes the global stack. - property var qualityItem: null - - property bool isQualityItemCurrentlyActivated: - { - if (qualityItem == null) - { - return false; - } - return qualityItem.name == Cura.MachineManager.activeQualityOrQualityChangesName; - } - - TableView - { - anchors.fill: parent - anchors.margins: UM.Theme.getSize("default_margin").width - id: profileSettingsView - - Component - { - id: itemDelegate - - UM.TooltipArea - { - property var setting: qualitySettings.getItem(styleData.row) - height: childrenRect.height - width: (parent != null) ? parent.width : 0 - text: - { - if (styleData.value === undefined) - { - return "" - } - return (styleData.value.substr(0,1) == "=") ? styleData.value : "" - } - - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - text: - { - if (styleData.value === undefined) - { - return "" - } - return (styleData.value.substr(0,1) == "=") ? catalog.i18nc("@info:status", "Calculated") : styleData.value - } - font.strikeout: styleData.column == 1 && setting.user_value != "" && base.isQualityItemCurrentlyActivated - font.italic: setting.profile_value_source == "quality_changes" || (setting.user_value != "" && base.isQualityItemCurrentlyActivated) - opacity: font.strikeout ? 0.5 : 1 - color: styleData.textColor - elide: Text.ElideRight - } - } - } - - TableViewColumn - { - role: "label" - title: catalog.i18nc("@title:column", "Setting") - width: (parent.width * 0.4) | 0 - delegate: itemDelegate - } - TableViewColumn - { - role: "profile_value" - title: catalog.i18nc("@title:column", "Profile") - width: (parent.width * 0.18) | 0 - delegate: itemDelegate - } - TableViewColumn - { - role: "user_value" - title: catalog.i18nc("@title:column", "Current"); - visible: base.isQualityItemCurrentlyActivated - width: (parent.width * 0.18) | 0 - delegate: itemDelegate - } - TableViewColumn - { - role: "unit" - title: catalog.i18nc("@title:column", "Unit") - width: (parent.width * 0.14) | 0 - delegate: itemDelegate - } - - section.property: "category" - section.delegate: Label - { - text: section - font.bold: true - } - - model: Cura.QualitySettingsModel - { - id: qualitySettings - selectedPosition: base.extruderPosition - selectedQualityItem: base.qualityItem == null ? {} : base.qualityItem - } - - SystemPalette { id: palette } - } -} diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 9144d4dbe1..dcf02bc738 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -1,44 +1,33 @@ -// Copyright (c) 2019 Ultimaker B.V. -// Uranium is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.3 import QtQuick.Dialogs 1.2 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.6 as Cura -Item +UM.ManagementPage { id: base - property var resetEnabled: false // Keep PreferencesDialog happy property var extrudersModel: CuraApplication.getExtrudersModel() property var qualityManagementModel: CuraApplication.getQualityManagementModel() - UM.I18nCatalog { id: catalog; name: "cura"; } + scrollviewCaption: catalog.i18nc("@label", "Profiles compatible with active printer:") + "" + Cura.MachineManager.activeMachine.name + "" + + onHamburgeButtonClicked: menu.popup(content_item, content_item.width - menu.width, hamburger_button.height) - Label - { - id: titleLabel - anchors - { - top: parent.top - left: parent.left - right: parent.right - margins: 5 * screenScaleFactor - } - font.pointSize: 18 - text: catalog.i18nc("@title:tab", "Profiles") - } property var hasCurrentItem: base.currentItem != null + sectionRole: "section_name" property var currentItem: { - var current_index = qualityListView.currentIndex; + var current_index = objectList.currentIndex; return (current_index == -1) ? null : base.qualityManagementModel.getItem(current_index); } @@ -66,125 +55,29 @@ Item return isCurrentItemActivated && Cura.MachineManager.hasUserSettings; } - Row // Button Row - { - id: buttonRow - anchors + model: qualityManagementModel + buttons: [ + Cura.SecondaryButton { - left: parent.left - right: parent.right - top: titleLabel.bottom - } - height: childrenRect.height - - // Activate button - Button - { - id: activateMenuButton - text: catalog.i18nc("@action:button", "Activate") - iconName: "list-activate" - enabled: !isCurrentItemActivated && base.currentItem - onClicked: - { - if(base.currentItem.is_read_only) - { - Cura.IntentManager.selectIntent(base.currentItem.intent_category, base.currentItem.quality_type); - } - else - { - Cura.MachineManager.setQualityChangesGroup(base.currentItem.quality_changes_group); - } - } - } - - // Create button - Button + text: catalog.i18nc("@action:button", "Import") + onClicked:importDialog.open() + }, + Cura.SecondaryButton { id: createMenuButton - text: catalog.i18nc("@label", "Create") - iconName: "list-add" - enabled: base.canCreateProfile && !Cura.MachineManager.stacksHaveErrors + text: catalog.i18nc("@action:button", "Create new") + + enabled: !Cura.MachineManager.stacksHaveErrors visible: base.canCreateProfile onClicked: { - createQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name); - createQualityDialog.open(); - createQualityDialog.selectText(); + createQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name) + createQualityDialog.open() + createQualityDialog.selectText() } } - - // Duplicate button - Button - { - id: duplicateMenuButton - text: catalog.i18nc("@label", "Duplicate") - iconName: "list-add" - enabled: !base.canCreateProfile - visible: !base.canCreateProfile - - onClicked: - { - duplicateQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name); - duplicateQualityDialog.open(); - duplicateQualityDialog.selectText(); - } - } - - // Remove button - Button - { - id: removeMenuButton - text: catalog.i18nc("@action:button", "Remove") - iconName: "list-remove" - enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated - onClicked: - { - forceActiveFocus(); - confirmRemoveQualityDialog.open(); - } - } - - // Rename button - Button - { - id: renameMenuButton - text: catalog.i18nc("@action:button", "Rename") - iconName: "edit-rename" - enabled: base.hasCurrentItem && !base.currentItem.is_read_only - onClicked: - { - renameQualityDialog.object = base.currentItem.name; - renameQualityDialog.open(); - renameQualityDialog.selectText(); - } - } - - // Import button - Button - { - id: importMenuButton - text: catalog.i18nc("@action:button", "Import") - iconName: "document-import" - onClicked: - { - importDialog.open(); - } - } - - // Export button - Button - { - id: exportMenuButton - text: catalog.i18nc("@action:button", "Export") - iconName: "document-export" - enabled: base.hasCurrentItem && !base.currentItem.is_read_only - onClicked: - { - exportDialog.open(); - } - } - } + ] // Click create profile from ... in Profile context menu signal createProfile() @@ -195,434 +88,319 @@ Item createQualityDialog.selectText(); } - // Dialog to request a name when creating a new profile - UM.RenameDialog - { - id: createQualityDialog - title: catalog.i18nc("@title:window", "Create Profile") - object: "" - explanation: catalog.i18nc("@info", "Please provide a name for this profile.") - onAccepted: - { - base.newQualityNameToSelect = newName; // We want to switch to the new profile once it's created - base.toActivateNewQuality = true; - base.qualityManagementModel.createQualityChanges(newName); - } - } - property string newQualityNameToSelect: "" property bool toActivateNewQuality: false - // This connection makes sure that we will switch to the correct quality after the model gets updated - Connections + Item { - target: base.qualityManagementModel - function onItemsChanged() + id: content_item + anchors.fill: parent + // This connection makes sure that we will switch to the correct quality after the model gets updated + Connections { - var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name; - if (newQualityNameToSelect != "") + target: base.qualityManagementModel + function onItemsChanged() { - toSelectItemName = newQualityNameToSelect; - } - - var newIdx = -1; // Default to nothing if nothing can be found - if (toSelectItemName != "") - { - // Select the required quality name if given - for (var idx = 0; idx < base.qualityManagementModel.count; ++idx) + var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name; + if (newQualityNameToSelect != "") { - var item = base.qualityManagementModel.getItem(idx); - if (item && item.name == toSelectItemName) - { - // Switch to the newly created profile if needed - newIdx = idx; - if (base.toActivateNewQuality) - { - // Activate this custom quality if required - if(item.quality_changes_group) - { - Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group); - } - } - break; - } + toSelectItemName = newQualityNameToSelect; } - } - qualityListView.currentIndex = newIdx; - // Reset states - base.newQualityNameToSelect = ""; - base.toActivateNewQuality = false; - } - } - - // Dialog to request a name when duplicating a new profile - UM.RenameDialog - { - id: duplicateQualityDialog - title: catalog.i18nc("@title:window", "Duplicate Profile") - object: "" - onAccepted: - { - base.qualityManagementModel.duplicateQualityChanges(newName, base.currentItem); - } - } - - // Confirmation dialog for removing a profile - MessageDialog - { - id: confirmRemoveQualityDialog - - icon: StandardIcon.Question; - title: catalog.i18nc("@title:window", "Confirm Remove") - text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItemName) - standardButtons: StandardButton.Yes | StandardButton.No - modality: Qt.ApplicationModal - - onYes: - { - base.qualityManagementModel.removeQualityChangesGroup(base.currentItem.quality_changes_group); - // reset current item to the first if available - qualityListView.currentIndex = -1; // Reset selection. - } - } - - // Dialog to rename a quality profile - UM.RenameDialog - { - id: renameQualityDialog - title: catalog.i18nc("@title:window", "Rename Profile") - object: "" - onAccepted: - { - var actualNewName = base.qualityManagementModel.renameQualityChangesGroup(base.currentItem.quality_changes_group, newName); - base.newQualityNameToSelect = actualNewName; // Select the new name after the model gets updated - } - } - - // Dialog for importing a quality profile - FileDialog - { - id: importDialog - title: catalog.i18nc("@title:window", "Import Profile") - selectExisting: true - nameFilters: base.qualityManagementModel.getFileNameFilters("profile_reader") - folder: CuraApplication.getDefaultPath("dialog_profile_path") - onAccepted: - { - var result = Cura.ContainerManager.importProfile(fileUrl); - messageDialog.text = result.message; - if (result.status == "ok") - { - messageDialog.icon = StandardIcon.Information; - } - else if (result.status == "warning" || result.status == "duplicate") - { - messageDialog.icon = StandardIcon.Warning; - } - else - { - messageDialog.icon = StandardIcon.Critical; - } - messageDialog.open(); - CuraApplication.setDefaultPath("dialog_profile_path", folder); - } - } - - // Dialog for exporting a quality profile - FileDialog - { - id: exportDialog - title: catalog.i18nc("@title:window", "Export Profile") - selectExisting: false - nameFilters: base.qualityManagementModel.getFileNameFilters("profile_writer") - folder: CuraApplication.getDefaultPath("dialog_profile_path") - onAccepted: - { - var result = Cura.ContainerManager.exportQualityChangesGroup(base.currentItem.quality_changes_group, - fileUrl, selectedNameFilter); - - if (result && result.status == "error") - { - messageDialog.icon = StandardIcon.Critical; - messageDialog.text = result.message; - messageDialog.open(); - } - - // else pop-up Message thing from python code - CuraApplication.setDefaultPath("dialog_profile_path", folder); - } - } - - Item - { - id: contentsItem - - anchors - { - top: titleLabel.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - margins: 5 * screenScaleFactor - bottomMargin: 0 - } - - clip: true - } - - Item - { - anchors - { - top: buttonRow.bottom - topMargin: UM.Theme.getSize("default_margin").height - left: parent.left - right: parent.right - bottom: parent.bottom - } - - SystemPalette - { - id: palette - } - - Label - { - id: captionLabel - anchors - { - top: parent.top - left: parent.left - } - visible: text != "" - text: catalog.i18nc("@label %1 is printer name", "Printer: %1").arg(Cura.MachineManager.activeMachine.name) - width: profileScrollView.width - elide: Text.ElideRight - } - - ScrollView - { - id: profileScrollView - anchors - { - top: captionLabel.visible ? captionLabel.bottom : parent.top - topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0 - bottom: parent.bottom - left: parent.left - } - - Rectangle - { - parent: viewport - anchors.fill: parent - color: palette.light - } - - width: true ? (parent.width * 0.4) | 0 : parent.width - frameVisible: true - clip: true - - ListView - { - id: qualityListView - - model: base.qualityManagementModel - - Component.onCompleted: + var newIdx = -1; // Default to nothing if nothing can be found + if (toSelectItemName != "") { - var selectedItemName = Cura.MachineManager.activeQualityOrQualityChangesName; - // Select the required quality name if given - for (var idx = 0; idx < base.qualityManagementModel.count; idx++) + for (var idx = 0; idx < base.qualityManagementModel.count; ++idx) { var item = base.qualityManagementModel.getItem(idx); - if (item.name == selectedItemName) + if (item && item.name == toSelectItemName) { - currentIndex = idx; + // Switch to the newly created profile if needed + newIdx = idx; + if (base.toActivateNewQuality) + { + // Activate this custom quality if required + if(item.quality_changes_group) + { + Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group); + } + } break; } } } + objectList.currentIndex = newIdx; - section.property: "section_name" - section.delegate: Rectangle + // Reset states + base.newQualityNameToSelect = ""; + base.toActivateNewQuality = false; + } + } + Cura.MessageDialog + { + id: messageDialog + standardButtons: Dialog.Ok + } + + // Dialog to request a name when creating a new profile + Cura.RenameDialog + { + id: createQualityDialog + title: catalog.i18nc("@title:window", "Create Profile") + object: "" + explanation: catalog.i18nc("@info", "Please provide a name for this profile.") + onAccepted: + { + base.newQualityNameToSelect = newName; // We want to switch to the new profile once it's created + base.toActivateNewQuality = true; + base.qualityManagementModel.createQualityChanges(newName); + } + } + + Cura.Menu + { + id: menu + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Activate") + + enabled: !isCurrentItemActivated && base.currentItem + onTriggered: { - height: childrenRect.height - - Label + if(base.currentItem.is_read_only) { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_lining").width - text: section - font.bold: true + Cura.IntentManager.selectIntent(base.currentItem.intent_category, base.currentItem.quality_type) + } + else + { + Cura.MachineManager.setQualityChangesGroup(base.currentItem.quality_changes_group) } } - - delegate: Rectangle + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Remove") + enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated + onTriggered: { - width: profileScrollView.width - height: childrenRect.height + forceActiveFocus() + confirmRemoveQualityDialog.open() + } + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Rename") + enabled: base.hasCurrentItem && !base.currentItem.is_read_only + onTriggered: + { + renameQualityDialog.object = base.currentItem.name + renameQualityDialog.open() + renameQualityDialog.selectText() + } + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Export") + enabled: base.hasCurrentItem && !base.currentItem.is_read_only + onTriggered: exportDialog.open() + } + } - // Added this property to identify custom profiles in automated system tests (Squish) - property bool isReadOnly: model.is_read_only + // Dialog for exporting a quality profile + FileDialog + { + id: exportDialog + title: catalog.i18nc("@title:window", "Export Profile") + selectExisting: false + nameFilters: base.qualityManagementModel.getFileNameFilters("profile_writer") + folder: CuraApplication.getDefaultPath("dialog_profile_path") + onAccepted: + { + var result = Cura.ContainerManager.exportQualityChangesGroup(base.currentItem.quality_changes_group, + fileUrl, selectedNameFilter); - property bool isCurrentItem: ListView.isCurrentItem - color: isCurrentItem ? palette.highlight : (model.index % 2) ? palette.base : palette.alternateBase + if (result && result.status == "error") + { + messageDialog.title = catalog.i18nc("@title:window", "Export Profile") + messageDialog.text = result.message; + messageDialog.open(); + } - Label + // else pop-up Message thing from python code + CuraApplication.setDefaultPath("dialog_profile_path", folder); + } + } + + // Dialog to request a name when duplicating a new profile + Cura.RenameDialog + { + id: duplicateQualityDialog + title: catalog.i18nc("@title:window", "Duplicate Profile") + object: "" + onAccepted: + { + base.qualityManagementModel.duplicateQualityChanges(newName, base.currentItem); + } + } + + // Confirmation dialog for removing a profile + Cura.MessageDialog + { + id: confirmRemoveQualityDialog + + title: catalog.i18nc("@title:window", "Confirm Remove") + text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItemName) + standardButtons: StandardButton.Yes | StandardButton.No + modal: true + + onAccepted: + { + base.qualityManagementModel.removeQualityChangesGroup(base.currentItem.quality_changes_group); + // reset current item to the first if available + qualityListView.currentIndex = -1; // Reset selection. + } + } + + // Dialog to rename a quality profile + Cura.RenameDialog + { + id: renameQualityDialog + title: catalog.i18nc("@title:window", "Rename Profile") + object: "" + onAccepted: + { + var actualNewName = base.qualityManagementModel.renameQualityChangesGroup(base.currentItem.quality_changes_group, newName); + base.newQualityNameToSelect = actualNewName; // Select the new name after the model gets updated + } + } + + // Dialog for importing a quality profile + FileDialog + { + id: importDialog + title: catalog.i18nc("@title:window", "Import Profile") + selectExisting: true + nameFilters: base.qualityManagementModel.getFileNameFilters("profile_reader") + folder: CuraApplication.getDefaultPath("dialog_profile_path") + onAccepted: + { + var result = Cura.ContainerManager.importProfile(fileUrl); + messageDialog.title = catalog.i18nc("@title:window", "Import Profile") + messageDialog.text = result.message; + messageDialog.open(); + CuraApplication.setDefaultPath("dialog_profile_path", folder); + } + } + + Column + { + id: detailsPanelHeaderColumn + anchors + { + left: parent.left + right: parent.right + top: parent.top + } + + spacing: UM.Theme.getSize("default_margin").height + visible: base.currentItem != null + UM.Label + { + anchors.left: parent.left + anchors.right: parent.right + text: base.currentItemDisplayName + font: UM.Theme.getFont("large_bold") + elide: Text.ElideRight + } + + Flow + { + id: currentSettingsActions + width: parent.width + + visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory + + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Update profile with current settings/overrides") + enabled: Cura.MachineManager.hasUserSettings && objectList.currentIndex && !objectList.currentIndex.is_read_only + onClicked: Cura.ContainerManager.updateQualityChanges() + } + + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Discard current changes"); + enabled: Cura.MachineManager.hasUserSettings + onClicked: Cura.ContainerManager.clearUserContainers(); + } + } + + UM.Label + { + id: defaultsMessage + visible: false + text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.") + width: parent.width + } + UM.Label + { + id: noCurrentSettingsMessage + visible: base.isCurrentItemActivated && !Cura.MachineManager.hasUserSettings + text: catalog.i18nc("@action:label", "Your current settings match the selected profile.") + width: parent.width + } + + UM.TabRow + { + id: profileExtruderTabs + UM.TabRowButton //One extra tab for the global settings. + { + text: catalog.i18nc("@title:tab", "Global Settings") + } + + Repeater + { + model: base.extrudersModel + + UM.TabRowButton { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - width: Math.floor((parent.width * 0.8)) text: model.name - elide: Text.ElideRight - font.italic: - { - if (model.is_read_only) - { - // For built-in qualities, it needs to match both the intent category and the quality name - return model.name == Cura.MachineManager.activeQualityOrQualityChangesName && model.intent_category == Cura.MachineManager.activeIntentCategory - } - else - { - // For custom qualities, it only needs to match the name - return model.name == Cura.MachineManager.activeQualityOrQualityChangesName - } - } - color: parent.isCurrentItem ? palette.highlightedText : palette.text - } - - MouseArea - { - anchors.fill: parent - onClicked: - { - parent.ListView.view.currentIndex = model.index; - } } } } } - // details panel on the right - Item + Rectangle { - id: detailsPanel - + color: UM.Theme.getColor("main_background") anchors { - left: profileScrollView.right - leftMargin: UM.Theme.getSize("default_margin").width - top: parent.top - bottom: parent.bottom + top: detailsPanelHeaderColumn.bottom + topMargin: -UM.Theme.getSize("default_lining").width + left: parent.left right: parent.right + bottom: parent.bottom } + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("thick_lining") + visible: base.hasCurrentItem + } - Item + Cura.ProfileOverview + { + anchors { - anchors.fill: parent - visible: base.currentItem != null - - Item // Profile title Label - { - id: profileName - - width: parent.width - height: childrenRect.height - - Label - { - anchors.left: parent.left - anchors.right: parent.right - text: base.currentItemDisplayName - font: UM.Theme.getFont("large_bold") - elide: Text.ElideRight - renderType: Text.NativeRendering - } - } - - Flow - { - id: currentSettingsActions - visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory - anchors.left: parent.left - anchors.right: parent.right - anchors.top: profileName.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - - Button - { - text: catalog.i18nc("@action:button", "Update profile with current settings/overrides") - enabled: Cura.MachineManager.hasUserSettings && !base.currentItem.is_read_only - onClicked: Cura.ContainerManager.updateQualityChanges() - } - - Button - { - text: catalog.i18nc("@action:button", "Discard current changes"); - enabled: Cura.MachineManager.hasUserSettings - onClicked: Cura.ContainerManager.clearUserContainers(); - } - } - - Column - { - id: profileNotices - anchors.top: currentSettingsActions.visible ? currentSettingsActions.bottom : currentSettingsActions.anchors.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.left: parent.left - anchors.right: parent.right - spacing: UM.Theme.getSize("default_margin").height - - Label - { - id: defaultsMessage - visible: false - text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.") - wrapMode: Text.WordWrap - width: parent.width - } - Label - { - id: noCurrentSettingsMessage - visible: base.isCurrentItemActivated && !Cura.MachineManager.hasUserSettings - text: catalog.i18nc("@action:label", "Your current settings match the selected profile.") - wrapMode: Text.WordWrap - width: parent.width - } - } - - TabView - { - anchors.left: parent.left - anchors.top: profileNotices.visible ? profileNotices.bottom : profileNotices.anchors.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: parent.right - anchors.bottom: parent.bottom - - currentIndex: 0 - - ProfileTab - { - title: catalog.i18nc("@title:tab", "Global Settings") - qualityItem: base.currentItem - } - - Repeater - { - model: base.extrudersModel - - ProfileTab - { - title: model.name - extruderPosition: model.index - qualityItem: base.currentItem - } - } - } + top: detailsPanelHeaderColumn.bottom + margins: UM.Theme.getSize("default_margin").height + left: parent.left + right: parent.right + bottom: parent.bottom } + + visible: detailsPanelHeaderColumn.visible + qualityItem: base.currentItem + extruderPosition: profileExtruderTabs.currentIndex - 1 } } } diff --git a/resources/qml/Preferences/ReadOnlySpinBox.qml b/resources/qml/Preferences/ReadOnlySpinBox.qml deleted file mode 100644 index 11e47b38b2..0000000000 --- a/resources/qml/Preferences/ReadOnlySpinBox.qml +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2016 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Dialogs 1.2 - -Item -{ - id: base - - property alias value: spinBox.value - property alias minimumValue: spinBox.minimumValue - property alias maximumValue: spinBox.maximumValue - property alias stepSize: spinBox.stepSize - property alias prefix: spinBox.prefix - property alias suffix: spinBox.suffix - property alias decimals: spinBox.decimals - - signal editingFinished(); - - property bool readOnly: false - - width: spinBox.width - height: spinBox.height - - SpinBox - { - id: spinBox - - enabled: !base.readOnly - opacity: base.readOnly ? 0.5 : 1.0 - - anchors.fill: parent - - onEditingFinished: base.editingFinished() - Keys.onEnterPressed: spinBox.focus = false - Keys.onReturnPressed: spinBox.focus = false - } - - Label - { - visible: base.readOnly - text: base.prefix + base.value.toFixed(spinBox.decimals) + base.suffix - - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: spinBox.__style ? spinBox.__style.padding.left : 0 - - color: palette.buttonText - } - - SystemPalette { id: palette } -} diff --git a/resources/qml/Preferences/ReadOnlyTextArea.qml b/resources/qml/Preferences/ReadOnlyTextArea.qml index 2c553ac2ca..c6f253f0ca 100644 --- a/resources/qml/Preferences/ReadOnlyTextArea.qml +++ b/resources/qml/Preferences/ReadOnlyTextArea.qml @@ -2,9 +2,10 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.1 -import QtQuick.Controls 1.1 +import QtQuick.Controls 2.15 +import UM 1.5 as UM -Item +ScrollView { id: base @@ -15,27 +16,25 @@ Item property bool readOnly: false - width: textArea.width - height: textArea.height - TextArea { id: textArea enabled: !base.readOnly - opacity: base.readOnly ? 0.5 : 1.0 + selectByMouse: true - anchors.fill: parent - - Keys.onReturnPressed: + background: Rectangle { - base.editingFinished() + radius: UM.Theme.getSize("setting_control_radius").width + color: textArea.enabled ? UM.Theme.getColor("setting_control") : UM.Theme.getColor("setting_control_disabled") } - Keys.onEnterPressed: - { - base.editingFinished() - } + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("default") + + Keys.onReturnPressed: base.editingFinished() + + Keys.onEnterPressed: base.editingFinished() onActiveFocusChanged: { diff --git a/resources/qml/Preferences/ReadOnlyTextField.qml b/resources/qml/Preferences/ReadOnlyTextField.qml deleted file mode 100644 index 38d07d7d6a..0000000000 --- a/resources/qml/Preferences/ReadOnlyTextField.qml +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2016 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. -// Different than the name suggests, it is not always read-only. - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Dialogs 1.2 - -Item -{ - id: base - - property alias text: textField.text - - signal editingFinished(); - - property bool readOnly: false - - width: textField.width - height: textField.height - - TextField - { - id: textField - - enabled: !base.readOnly - opacity: base.readOnly ? 0.5 : 1.0 - - anchors.fill: parent - - onEditingFinished: base.editingFinished() - Keys.onEnterPressed: base.editingFinished() - Keys.onReturnPressed: base.editingFinished() - } - - Label - { - visible: base.readOnly - text: textField.text - - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: textField.__panel ? textField.__panel.leftMargin : 0 - - color: palette.buttonText - } - - SystemPalette { id: palette } -} diff --git a/resources/qml/Preferences/RenameDialog.qml b/resources/qml/Preferences/RenameDialog.qml new file mode 100644 index 0000000000..6e4c628114 --- /dev/null +++ b/resources/qml/Preferences/RenameDialog.qml @@ -0,0 +1,86 @@ +// 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 + + buttonSpacing: UM.Theme.getSize("default_margin").width + + 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 + } + } + + 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 + } + ] +} + diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index 53df99b912..a29818ad4e 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -1,11 +1,8 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - -import QtQuick.Controls 2.3 as NewControls +import QtQuick.Controls 2.15 import UM 1.5 as UM @@ -13,12 +10,20 @@ import Cura 1.0 as Cura UM.PreferencesPage { - title: catalog.i18nc("@title:tab", "Setting Visibility"); + title: catalog.i18nc("@title:tab", "Setting Visibility") property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel() property int scrollToIndex: 0 + buttons: [ + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Defaults") + onClicked: reset() + } + ] + signal scrollToSection( string key ) onScrollToSection: { @@ -33,16 +38,16 @@ UM.PreferencesPage Item { - id: base; - anchors.fill: parent; + id: base + anchors.fill: parent UM.CheckBox { id: toggleVisibleSettings anchors { - verticalCenter: filter.verticalCenter; - left: parent.left; + verticalCenter: filter.verticalCenter + left: parent.left leftMargin: UM.Theme.getSize("default_margin").width } text: catalog.i18nc("@label:textbox", "Check all") @@ -61,13 +66,13 @@ UM.PreferencesPage return Qt.PartiallyChecked } } - + tristate: true MouseArea { anchors.fill: parent; onClicked: { - if(parent.checkState == Qt.Unchecked || parent.checkState == Qt.PartiallyChecked) + if (parent.checkState == Qt.Unchecked || parent.checkState == Qt.PartiallyChecked) { definitionsModel.setAllExpandedVisible(true) } @@ -79,9 +84,9 @@ UM.PreferencesPage } } - TextField + Cura.TextField { - id: filter; + id: filter anchors { @@ -97,15 +102,15 @@ UM.PreferencesPage onTextChanged: definitionsModel.filter = {"i18n_label|i18n_description": "*" + text} } - NewControls.ComboBox + Cura.ComboBox { id: visibilityPreset - width: 150 * screenScaleFactor + width: UM.Theme.getSize("action_button").width anchors { top: parent.top right: parent.right - bottom: scrollView.top + verticalCenter: filter.verticalCenter } model: settingVisibilityPresetsModel.items @@ -132,63 +137,58 @@ UM.PreferencesPage } } - ScrollView + ListView { - id: scrollView - - frameVisible: true - + id: settingsListView anchors { - top: filter.bottom; + top: filter.bottom topMargin: UM.Theme.getSize("default_margin").height - left: parent.left; - right: parent.right; - bottom: parent.bottom; + left: parent.left + right: parent.right + bottom: parent.bottom } - ListView + + clip: true + ScrollBar.vertical: UM.ScrollBar {} + + model: UM.SettingDefinitionsModel { - id: settingsListView + id: definitionsModel + containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + showAll: true + exclude: ["machine_settings", "command_line_settings"] + showAncestors: true + expanded: ["*"] + visibilityHandler: UM.SettingPreferenceVisibilityHandler {} + } - model: UM.SettingDefinitionsModel + delegate: Loader + { + id: loader + + width: settingsListView.width + height: model.type != undefined ? UM.Theme.getSize("section").height : 0 + + property var definition: model + property var settingDefinitionsModel: definitionsModel + + asynchronous: true + active: model.type != undefined + sourceComponent: { - id: definitionsModel - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" - showAll: true - exclude: ["machine_settings", "command_line_settings"] - showAncestors: true - expanded: ["*"] - visibilityHandler: UM.SettingPreferenceVisibilityHandler {} - } - - delegate: Loader - { - id: loader - - width: settingsListView.width - height: model.type != undefined ? UM.Theme.getSize("section").height : 0 - - property var definition: model - property var settingDefinitionsModel: definitionsModel - - asynchronous: true - active: model.type != undefined - sourceComponent: + switch(model.type) { - switch(model.type) - { - case "category": - return settingVisibilityCategory - default: - return settingVisibilityItem - } + case "category": + return settingVisibilityCategory + default: + return settingVisibilityItem } } } } - UM.I18nCatalog { name: "cura"; } - SystemPalette { id: palette; } + UM.I18nCatalog { name: "cura" } Component { @@ -204,4 +204,4 @@ UM.PreferencesPage UM.SettingVisibilityItem { } } } -} \ No newline at end of file +} diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 19c2562874..5be4bba6a4 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -2,8 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 import UM 1.2 as UM diff --git a/resources/qml/PrintSetupHeaderButton.qml b/resources/qml/PrintSetupHeaderButton.qml new file mode 100644 index 0000000000..e41f95f778 --- /dev/null +++ b/resources/qml/PrintSetupHeaderButton.qml @@ -0,0 +1,117 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +// Button with a label-like appearance that displays different states (these can be displayed by setting the +// `valueError` or `valueWarning` properties). Mainly used within the `CustomConfiguration` component. + +import QtQuick 2.1 +import QtQuick.Controls 2.1 + +import Cura 1.0 as Cura +import UM 1.5 as UM + +ToolButton +{ + id: base + + property alias tooltip: tooltip.text + + property bool valueError: false; + property bool valueWarning: false; + + Cura.ToolTip + { + id: tooltip + visible: base.hovered + targetPoint: Qt.point(parent.x, Math.round(parent.y + parent.height / 2)) + } + + states: + [ + State + { + name: "disabled" + when: !base.enabled; + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_control_disabled") + liningColor: UM.Theme.getColor("setting_control_disabled_border") + } + }, + State + { + name: "value_error" + when: base.enabled && base.valueError + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_validation_error_background") + liningColor: UM.Theme.getColor("setting_validation_error") + } + }, + State + { + name: "value_warning" + when: base.enabled && base.valueWarning + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_validation_warning_background") + liningColor: UM.Theme.getColor("setting_validation_warning") + } + }, + State + { + name: "highlight" + when: base.enabled && base.hovered + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_control") + liningColor: UM.Theme.getColor("border_main_light") + } + }, + State + { + name: "neutral" + when: base.enabled && !base.hovered && !base.valueWarning && !base.valueError + PropertyChanges + { + target: background + color: UM.Theme.getColor("setting_control") + liningColor: UM.Theme.getColor("border_field_light") + } + } + ] + + background: UM.UnderlineBackground + { + id: background + + UM.RecolorImage + { + id: downArrow + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.height: width + color: base.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text") + source: UM.Theme.getIcon("ChevronSingleDown") + } + } + + contentItem: UM.Label + { + id: printSetupComboBoxLabel + text: base.text + elide: Text.ElideRight; + anchors.left: parent.left; + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.right: downArrow.lef + anchors.rightMargin: base.rightMargin + anchors.verticalCenter: parent.verticalCenter + } +} diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index cde2cd8dfc..440c9e4e78 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -1,12 +1,11 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//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.Controls 1.4 as OldControls import QtQuick.Layouts 1.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.6 as Cura import ".." @@ -34,7 +33,7 @@ Item rightMargin: parent.padding } - Label + UM.Label { id: profileLabel anchors @@ -46,9 +45,6 @@ Item } text: catalog.i18nc("@label", "Profile") font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter } NoIntentIcon @@ -80,21 +76,17 @@ Item anchors.right: customisedSettings.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - Label + UM.Label { id: textLabel text: Cura.MachineManager.activeQualityDisplayNameMap["main"] - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") Layout.margins: 0 Layout.maximumWidth: Math.floor(parent.width * 0.7) // Always leave >= 30% for the rest of the row. height: contentHeight - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering elide: Text.ElideRight } - Label + UM.Label { text: activeQualityDetailText() font: UM.Theme.getFont("default") @@ -103,8 +95,6 @@ Item Layout.fillWidth: true height: contentHeight - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering elide: Text.ElideRight function activeQualityDetailText() @@ -136,13 +126,10 @@ Item } } - background: Rectangle + background: UM.UnderlineBackground { id: backgroundItem - border.color: intentSelection.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") - border.width: UM.Theme.getSize("default_lining").width - radius: UM.Theme.getSize("default_radius").width - color: UM.Theme.getColor("main_background") + liningColor: intentSelection.hovered ? UM.Theme.getColor("border_main_light") : UM.Theme.getColor("border_field_light") } UM.SimpleButton @@ -222,6 +209,7 @@ Item model: extrudersModel delegate: UM.TabRowButton { + checked: model.index == 0 contentItem: Item { Cura.ExtruderIcon diff --git a/resources/qml/PrintSetupSelector/Custom/MenuButton.qml b/resources/qml/PrintSetupSelector/Custom/MenuButton.qml index b637e20d58..40c3d73e8b 100644 --- a/resources/qml/PrintSetupSelector/Custom/MenuButton.qml +++ b/resources/qml/PrintSetupSelector/Custom/MenuButton.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.6 as Cura Button @@ -40,14 +40,11 @@ Button return txt } - contentItem: Label + contentItem: UM.Label { id: textLabel text: button.text != "" ? replaceText(button.text) : replaceText(button.labelText) height: contentHeight - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") color: button.enabled ? UM.Theme.getColor("text") :UM.Theme.getColor("text_inactive") } } \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/Custom/QualitiesWithIntentMenu.qml b/resources/qml/PrintSetupSelector/Custom/QualitiesWithIntentMenu.qml index c879ff53fd..d6901cfc7f 100644 --- a/resources/qml/PrintSetupSelector/Custom/QualitiesWithIntentMenu.qml +++ b/resources/qml/PrintSetupSelector/Custom/QualitiesWithIntentMenu.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2020 Ultimaker B.V. +// 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 UM 1.2 as UM +import UM 1.5 as UM import Cura 1.6 as Cura Popup @@ -43,17 +43,29 @@ Popup // This repeater adds the intent labels ScrollView { + id: qualityListScrollView property real maximumHeight: screenScaleFactor * 400 contentHeight: dataColumn.height height: Math.min(contentHeight, maximumHeight) - clip: true + width: parent.width - ScrollBar.vertical.policy: height == maximumHeight ? ScrollBar.AlwaysOn: ScrollBar.AlwaysOff + clip: true + ScrollBar.vertical: UM.ScrollBar + { + id: qualityListScrollBar + parent: qualityListScrollView + anchors + { + top: parent.top + right: parent.right + bottom: parent.bottom + } + } Column { id: dataColumn - width: parent.width + width: qualityListScrollView.width - qualityListScrollBar.width Repeater { model: dataModel @@ -64,14 +76,13 @@ Popup property variant subItemModel: model.qualities height: childrenRect.height - width: popup.contentWidth + width: dataColumn.width - Label + UM.Label { id: headerLabel text: model.name color: UM.Theme.getColor("text_inactive") - renderType: Text.NativeRendering width: parent.width height: visible ? contentHeight: 0 visible: qualitiesList.visibleChildren.length > 0 @@ -138,13 +149,12 @@ Popup Item { height: childrenRect.height - width: popup.contentWidth + width: dataColumn.width - Label + UM.Label { id: customProfileHeader text: catalog.i18nc("@label:header", "Custom profiles") - renderType: Text.NativeRendering height: visible ? contentHeight: 0 enabled: false visible: profilesList.visibleChildren.length > 1 @@ -280,29 +290,21 @@ Popup width: parent.width height: childrenRect.height - Label + UM.Label { id: textLabel text: manageProfilesButton.text height: contentHeight anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width + UM.Theme.getSize("narrow_margin").width - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") } - Label + UM.Label { id: shortcutLabel text: Cura.Actions.manageProfiles.shortcut height: contentHeight anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") } } onClicked: diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml index a3a5047ee9..74c496f824 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedAdhesionSelector.qml @@ -2,10 +2,8 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -44,7 +42,7 @@ Item verticalCenter: enableAdhesionRowTitle.verticalCenter } - CheckBox + UM.CheckBox { id: enableAdhesionCheckBox anchors.verticalCenter: parent.verticalCenter @@ -52,7 +50,6 @@ Item property alias _hovered: adhesionMouseArea.containsMouse //: Setting enable printing build-plate adhesion helper checkbox - style: UM.Theme.styles.checkbox enabled: recommendedPrintSetup.settingsEnabled visible: platformAdhesionType.properties.enabled == "True" diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index dd2e0aef2b..434945e172 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -1,11 +1,10 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.15 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -87,10 +86,9 @@ Item width: parent.width height: UM.Theme.getSize("print_setup_slider_handle").height // The handle is the widest element of the slider - minimumValue: 0 - maximumValue: 100 + from: 0 + to: 100 stepSize: 1 - tickmarksEnabled: true // disable slider when gradual support is enabled enabled: parseInt(infillSteps.properties.value) == 0 @@ -98,53 +96,37 @@ Item // set initial value from stack value: parseInt(infillDensity.properties.value) - style: SliderStyle + //Draw line + background: Rectangle { - //Draw line - groove: Item - { - Rectangle - { - height: UM.Theme.getSize("print_setup_slider_groove").height - width: control.width - UM.Theme.getSize("print_setup_slider_handle").width - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - } - } + id: backgroundLine + height: UM.Theme.getSize("print_setup_slider_groove").height + width: infillSlider.width - UM.Theme.getSize("print_setup_slider_handle").width + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") - handle: Rectangle - { - id: handleButton - color: control.enabled ? UM.Theme.getColor("primary") : UM.Theme.getColor("quality_slider_unavailable") - implicitWidth: UM.Theme.getSize("print_setup_slider_handle").width - implicitHeight: implicitWidth - radius: Math.round(implicitWidth / 2) - border.color: UM.Theme.getColor("slider_groove_fill") - border.width: UM.Theme.getSize("default_lining").height - } - - tickmarks: Repeater + Repeater { id: repeater - model: control.maximumValue / control.stepSize + 1 + anchors.fill: parent + model: infillSlider.to / infillSlider.stepSize + 1 Rectangle { - color: control.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") implicitWidth: UM.Theme.getSize("print_setup_slider_tickmarks").width implicitHeight: UM.Theme.getSize("print_setup_slider_tickmarks").height anchors.verticalCenter: parent.verticalCenter // Do not use Math.round otherwise the tickmarks won't be aligned - x: ((styleData.handleWidth / 2) - (implicitWidth / 2) + (index * ((repeater.width - styleData.handleWidth) / (repeater.count-1)))) - radius: Math.round(implicitWidth / 2) + x: ((handleButton.width / 2) - (backgroundLine.implicitWidth / 2) + (index * ((repeater.width - handleButton.width) / (repeater.count-1)))) + radius: Math.round(backgroundLine.implicitWidth / 2) visible: (index % 10) == 0 // Only show steps of 10% - Label + UM.Label { text: index - font: UM.Theme.getFont("default") visible: (index % 20) == 0 // Only show steps of 20% anchors.horizontalCenter: parent.horizontalCenter y: UM.Theme.getSize("thin_margin").height @@ -155,36 +137,53 @@ Item } } - onValueChanged: + handle: Rectangle { - // Don't round the value if it's already the same - if (parseInt(infillDensity.properties.value) == infillSlider.value) + id: handleButton + x: infillSlider.leftPadding + infillSlider.visualPosition * (infillSlider.availableWidth - width) + y: infillSlider.topPadding + infillSlider.availableHeight / 2 - height / 2 + color: infillSlider.enabled ? UM.Theme.getColor("primary") : UM.Theme.getColor("quality_slider_unavailable") + implicitWidth: UM.Theme.getSize("print_setup_slider_handle").width + implicitHeight: implicitWidth + radius: Math.round(implicitWidth / 2) + border.color: UM.Theme.getColor("slider_groove_fill") + border.width: UM.Theme.getSize("default_lining").height + } + + Connections + { + target: infillSlider + function onValueChanged() { - return - } + // Don't round the value if it's already the same + if (parseInt(infillDensity.properties.value) == infillSlider.value) + { + return + } - // Round the slider value to the nearest multiple of 10 (simulate step size of 10) - var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 + // Round the slider value to the nearest multiple of 10 (simulate step size of 10) + var roundedSliderValue = Math.round(infillSlider.value / 10) * 10 - // Update the slider value to represent the rounded value - infillSlider.value = roundedSliderValue + // Update the slider value to represent the rounded value + infillSlider.value = roundedSliderValue - // Update value only if the Recommended mode is Active, - // Otherwise if I change the value in the Custom mode the Recommended view will try to repeat - // same operation - var active_mode = UM.Preferences.getValue("cura/active_mode") + // Update value only if the Recommended mode is Active, + // Otherwise if I change the value in the Custom mode the Recommended view will try to repeat + // same operation + const active_mode = UM.Preferences.getValue("cura/active_mode") - if (active_mode == 0 || active_mode == "simple") - { - Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) - Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") + if (active_mode == 0 || active_mode == "simple") + { + Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue) + Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance") + } } } } } // Gradual Support Infill Checkbox - CheckBox + UM.CheckBox { id: enableGradualInfillCheckBox property alias _hovered: enableGradualInfillMouseArea.containsMouse @@ -194,7 +193,6 @@ Item anchors.left: infillSliderContainer.left text: catalog.i18nc("@label", "Gradual infill") - style: UM.Theme.styles.checkbox enabled: recommendedPrintSetup.settingsEnabled visible: infillSteps.properties.enabled == "True" checked: parseInt(infillSteps.properties.value) > 0 diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index 22c4039063..de8cce6e94 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -2,8 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM import Cura 1.0 as Cura @@ -14,8 +12,6 @@ Item height: childrenRect.height + 2 * padding - property Action configureSettings - property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 property real padding: UM.Theme.getSize("thick_margin").width diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index 0823b5cb62..1176142b3b 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -1,10 +1,8 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls 2.3 as Controls2 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.6 as Cura @@ -30,7 +28,7 @@ Item spacing: UM.Theme.getSize("default_margin").height - Controls2.ButtonGroup + ButtonGroup { id: activeProfileButtonGroup exclusive: true diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 4e2341fb57..49be0fae1c 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -1,12 +1,10 @@ -// Copyright (c) 2020 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Controls 2.3 as Controls2 +import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -45,14 +43,13 @@ Item verticalCenter: enableSupportRowTitle.verticalCenter } - CheckBox + UM.CheckBox { id: enableSupportCheckBox anchors.verticalCenter: parent.verticalCenter property alias _hovered: enableSupportMouseArea.containsMouse - style: UM.Theme.styles.checkbox enabled: recommendedPrintSetup.settingsEnabled visible: supportEnabled.properties.enabled == "True" @@ -75,7 +72,7 @@ Item } } - Controls2.ComboBox + ComboBox { id: supportExtruderCombobox @@ -202,7 +199,7 @@ Item } } - contentItem: Controls2.Label + contentItem: UM.Label { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left @@ -212,12 +209,10 @@ Item text: supportExtruderCombobox.currentText textFormat: Text.PlainText - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") elide: Text.ElideLeft - verticalAlignment: Text.AlignVCenter + background: Rectangle { @@ -233,7 +228,7 @@ Item } } - popup: Controls2.Popup + popup: Popup { y: supportExtruderCombobox.height - UM.Theme.getSize("default_lining").height width: supportExtruderCombobox.width @@ -242,12 +237,12 @@ Item contentItem: ListView { - clip: true implicitHeight: contentHeight + + ScrollBar.vertical: UM.ScrollBar {} + clip: true model: supportExtruderCombobox.popup.visible ? supportExtruderCombobox.delegateModel : null currentIndex: supportExtruderCombobox.highlightedIndex - - Controls2.ScrollIndicator.vertical: Controls2.ScrollIndicator { } } background: Rectangle @@ -257,34 +252,22 @@ Item } } - delegate: Controls2.ItemDelegate + delegate: ItemDelegate { width: supportExtruderCombobox.width - 2 * UM.Theme.getSize("default_lining").width height: supportExtruderCombobox.height highlighted: supportExtruderCombobox.highlightedIndex == index - contentItem: Controls2.Label + contentItem: UM.Label { anchors.fill: parent anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width text: model.name - renderType: Text.NativeRendering - color: - { - if (model.enabled) - { - UM.Theme.getColor("setting_control_text") - } - else - { - UM.Theme.getColor("action_button_disabled_text"); - } - } - font: UM.Theme.getFont("default") + color: model.enabled ? UM.Theme.getColor("setting_control_text"): UM.Theme.getColor("action_button_disabled_text") + elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width background: Rectangle diff --git a/resources/qml/PrintSetupTooltip.qml b/resources/qml/PrintSetupTooltip.qml index 91f044ceed..29fe7d6508 100644 --- a/resources/qml/PrintSetupTooltip.qml +++ b/resources/qml/PrintSetupTooltip.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.0 as UM +import UM 1.5 as UM UM.PointingRectangle { @@ -88,18 +88,16 @@ UM.PointingRectangle active: false //Only allow vertical scrolling. We should grow vertically only, but due to how the label is positioned it allocates space in the ScrollView horizontally. } - Label + UM.Label { id: label x: UM.Theme.getSize("tooltip_margins").width y: UM.Theme.getSize("tooltip_margins").height width: base.width - UM.Theme.getSize("tooltip_margins").width * 2 - wrapMode: Text.Wrap; + wrapMode: Text.Wrap textFormat: Text.RichText - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("tooltip_text"); - renderType: Text.NativeRendering + color: UM.Theme.getColor("tooltip_text") } } } diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index 63927cd98d..d1d28b3cfe 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -1,10 +1,8 @@ -//Copyright (c) 2019 Ultimaker B.V. +//Copyright (c) 2022 Ultimaker B.V. //Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.1 import UM 1.2 as UM import Cura 1.0 as Cura @@ -36,17 +34,17 @@ Item id: background anchors.fill: parent - Label //Extruder name. + // Extruder name. + UM.Label { text: Cura.MachineManager.activeMachine.extruderList[position].name !== "" ? Cura.MachineManager.activeMachine.extruderList[position].name : catalog.i18nc("@label", "Extruder") - color: UM.Theme.getColor("text") - font: UM.Theme.getFont("default") anchors.left: parent.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width } - Label //Target temperature. + // Target temperature. + UM.Label { id: extruderTargetTemperature text: Math.round(extruderModel.targetHotendTemperature) + "°C" @@ -56,7 +54,8 @@ Item anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: extruderCurrentTemperature.bottom - MouseArea //For tooltip. + //For tooltip. + MouseArea { id: extruderTargetTemperatureTooltipArea hoverEnabled: true @@ -78,17 +77,20 @@ Item } } } - Label //Temperature indication. + + //Temperature indication. + UM.Label { id: extruderCurrentTemperature text: Math.round(extruderModel.hotendTemperature) + "°C" - color: UM.Theme.getColor("text") font: UM.Theme.getFont("large_bold") anchors.right: extruderTargetTemperature.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width - MouseArea //For tooltip. + + //For tooltip. + MouseArea { id: extruderCurrentTemperatureTooltipArea hoverEnabled: true @@ -111,7 +113,8 @@ Item } } - Rectangle //Input field for pre-heat temperature. + //Input field for pre-heat temperature. + Rectangle { id: preheatTemperatureControl color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok") @@ -153,14 +156,16 @@ Item width: UM.Theme.getSize("monitor_preheat_temperature_control").width height: UM.Theme.getSize("monitor_preheat_temperature_control").height visible: extruderModel != null ? enabled && extruderModel.canPreHeatHotends && !extruderModel.isPreheating : true - Rectangle //Highlight of input field. + //Highlight of input field. + Rectangle { anchors.fill: parent anchors.margins: UM.Theme.getSize("default_lining").width color: UM.Theme.getColor("setting_control_highlight") opacity: preheatTemperatureControl.hovered ? 1.0 : 0 } - MouseArea //Change cursor on hovering. + //Change cursor on hovering. + MouseArea { id: preheatTemperatureInputMouseArea hoverEnabled: true @@ -183,7 +188,7 @@ Item } } } - Label + UM.Label { id: unit anchors.right: parent.right @@ -192,7 +197,6 @@ Item text: "°C"; color: UM.Theme.getColor("setting_unit") - font: UM.Theme.getFont("default") } TextInput { @@ -223,7 +227,7 @@ Item } } - Button //The pre-heat button. + Cura.SecondaryButton { id: preheatButton height: UM.Theme.getSize("setting_control").height @@ -255,96 +259,19 @@ Item anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width - style: ButtonStyle { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("medium") - text: - { - if(extruderModel == null) - { - return "" - } - if(extruderModel.isPreheating ) - { - return catalog.i18nc("@button Cancel pre-heating", "Cancel") - } else - { - return catalog.i18nc("@button", "Pre-heat") - } - } - } + text: + { + if(extruderModel == null) + { + return "" + } + if(extruderModel.isPreheating ) + { + return catalog.i18nc("@button Cancel pre-heating", "Cancel") + } else + { + return catalog.i18nc("@button", "Pre-heat") } } @@ -377,7 +304,8 @@ Item } } - Rectangle //Material colour indication. + //Material colour indication. + Rectangle { id: materialColor width: Math.floor(materialName.height * 0.75) @@ -391,7 +319,8 @@ Item anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: materialName.verticalCenter - MouseArea //For tooltip. + //For tooltip. + MouseArea { id: materialColorTooltipArea hoverEnabled: true @@ -413,17 +342,17 @@ Item } } } - Label //Material name. + //Material name. + UM.Label { id: materialName text: extruderModel.activeMaterial != null ? extruderModel.activeMaterial.type : "" - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") anchors.left: materialColor.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width - MouseArea //For tooltip. + //For tooltip. + MouseArea { id: materialNameTooltipArea hoverEnabled: true @@ -445,17 +374,18 @@ Item } } } - Label //Variant name. + + //Variant name. + UM.Label { id: variantName text: extruderModel.hotendID - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width - MouseArea //For tooltip. + //For tooltip. + MouseArea { id: variantNameTooltipArea hoverEnabled: true @@ -466,7 +396,7 @@ Item { base.showTooltip( base, - {x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y}, + { x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y }, catalog.i18nc("@tooltip", "The nozzle inserted in this extruder.") ); } diff --git a/resources/qml/PrinterOutput/HeatedBedBox.qml b/resources/qml/PrinterOutput/HeatedBedBox.qml index 2e3e319c89..9343ca8826 100644 --- a/resources/qml/PrinterOutput/HeatedBedBox.qml +++ b/resources/qml/PrinterOutput/HeatedBedBox.qml @@ -1,10 +1,8 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.4 import UM 1.2 as UM import Cura 1.0 as Cura @@ -21,17 +19,17 @@ Item color: UM.Theme.getColor("main_background") anchors.fill: parent - Label //Build plate label. + // Build plate label. + UM.Label { text: catalog.i18nc("@label", "Build plate") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") anchors.left: parent.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width } - Label //Target temperature. + // Target temperature. + UM.Label { id: bedTargetTemperature text: printerModel != null ? printerModel.targetBedTemperature + "°C" : "" @@ -41,7 +39,8 @@ Item anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: bedCurrentTemperature.bottom - MouseArea //For tooltip. + // For tooltip. + MouseArea { id: bedTargetTemperatureTooltipArea hoverEnabled: true @@ -63,17 +62,18 @@ Item } } } - Label //Current temperature. + // Current temperature. + UM.Label { id: bedCurrentTemperature text: printerModel != null ? printerModel.bedTemperature + "°C" : "" font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") anchors.right: bedTargetTemperature.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width - MouseArea //For tooltip. + //For tooltip. + MouseArea { id: bedTemperatureTooltipArea hoverEnabled: true @@ -95,7 +95,8 @@ Item } } } - Rectangle //Input field for pre-heat temperature. + //Input field for pre-heat temperature. + Rectangle { id: preheatTemperatureControl color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok") @@ -167,7 +168,7 @@ Item } } } - Label + UM.Label { id: unit anchors.right: parent.right @@ -176,7 +177,6 @@ Item text: "°C"; color: UM.Theme.getColor("setting_unit") - font: UM.Theme.getFont("default") } TextInput { @@ -214,7 +214,8 @@ Item } } - Button // The pre-heat button. + // The pre-heat button. + Cura.SecondaryButton { id: preheatButton height: UM.Theme.getSize("setting_control").height @@ -246,96 +247,20 @@ Item anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width - style: ButtonStyle { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("medium") - text: - { - if(printerModel == null) - { - return "" - } - if(printerModel.isPreheating ) - { - return catalog.i18nc("@button Cancel pre-heating", "Cancel") - } else - { - return catalog.i18nc("@button", "Pre-heat") - } - } - } + text: + { + if (printerModel == null) + { + return "" + } + if (printerModel.isPreheating ) + { + return catalog.i18nc("@button Cancel pre-heating", "Cancel") + } + else + { + return catalog.i18nc("@button", "Pre-heat") } } @@ -357,7 +282,7 @@ Item { base.showTooltip( base, - {x: 0, y: preheatButton.mapToItem(base, 0, 0).y}, + { x: 0, y: preheatButton.mapToItem(base, 0, 0).y }, catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") ); } diff --git a/resources/qml/PrinterOutput/ManualPrinterControl.qml b/resources/qml/PrinterOutput/ManualPrinterControl.qml index 3213f1ace8..f53a45905c 100644 --- a/resources/qml/PrinterOutput/ManualPrinterControl.qml +++ b/resources/qml/PrinterOutput/ManualPrinterControl.qml @@ -1,12 +1,10 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.1 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.0 as Cura import "." @@ -17,7 +15,7 @@ Item property var printerModel: null property var activePrintJob: printerModel != null ? printerModel.activePrintJob : null property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - + property var _buttonSize: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("thin_margin").height implicitWidth: parent.width implicitHeight: childrenRect.height @@ -62,15 +60,13 @@ Item spacing: UM.Theme.getSize("default_margin").width - Label + UM.Label { text: catalog.i18nc("@label", "Jog Position") color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("setting_control").height - verticalAlignment: Text.AlignVCenter } GridLayout @@ -80,14 +76,12 @@ Item rowSpacing: UM.Theme.getSize("default_lining").width columnSpacing: UM.Theme.getSize("default_lining").height - Label + UM.Label { text: catalog.i18nc("@label", "X/Y") color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") width: height height: UM.Theme.getSize("setting_control").height - verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter Layout.row: 0 @@ -96,89 +90,64 @@ Item Layout.preferredHeight: height } - Button + Cura.SecondaryButton { Layout.row: 1 Layout.column: 1 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("ChevronSingleUp"); - style: UM.Theme.styles.monitor_button_style - width: height - height: UM.Theme.getSize("setting_control").height + Layout.preferredWidth: _buttonSize + Layout.preferredHeight: _buttonSize + iconSource: UM.Theme.getIcon("ChevronSingleUp") + leftPadding: (Layout.preferredWidth - iconSize) / 2 - onClicked: - { - printerModel.moveHead(0, distancesRow.currentDistance, 0) - } + onClicked: printerModel.moveHead(0, distancesRow.currentDistance, 0) } - Button + Cura.SecondaryButton { Layout.row: 2 Layout.column: 0 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("ChevronSingleLeft"); - style: UM.Theme.styles.monitor_button_style - width: height - height: UM.Theme.getSize("setting_control").height + Layout.preferredWidth: _buttonSize + Layout.preferredHeight: _buttonSize + iconSource: UM.Theme.getIcon("ChevronSingleLeft") + leftPadding: (Layout.preferredWidth - iconSize) / 2 - onClicked: - { - printerModel.moveHead(-distancesRow.currentDistance, 0, 0) - } + onClicked: printerModel.moveHead(-distancesRow.currentDistance, 0, 0) } - Button + Cura.SecondaryButton { Layout.row: 2 Layout.column: 2 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("ChevronSingleRight"); - style: UM.Theme.styles.monitor_button_style - width: height - height: UM.Theme.getSize("setting_control").height + Layout.preferredWidth: _buttonSize + Layout.preferredHeight: _buttonSize + iconSource: UM.Theme.getIcon("ChevronSingleRight") + leftPadding: (Layout.preferredWidth - iconSize) / 2 - onClicked: - { - printerModel.moveHead(distancesRow.currentDistance, 0, 0) - } + onClicked: printerModel.moveHead(distancesRow.currentDistance, 0, 0) } - Button + Cura.SecondaryButton { Layout.row: 3 Layout.column: 1 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("ChevronSingleDown"); - style: UM.Theme.styles.monitor_button_style - width: height - height: UM.Theme.getSize("setting_control").height + Layout.preferredWidth: _buttonSize + Layout.preferredHeight: _buttonSize + iconSource: UM.Theme.getIcon("ChevronSingleDown") + leftPadding: (Layout.preferredWidth - iconSize) / 2 - onClicked: - { - printerModel.moveHead(0, -distancesRow.currentDistance, 0) - } + onClicked: printerModel.moveHead(0, -distancesRow.currentDistance, 0) } - Button + Cura.SecondaryButton { Layout.row: 2 Layout.column: 1 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("House"); - style: UM.Theme.styles.monitor_button_style - width: height - height: UM.Theme.getSize("setting_control").height + Layout.preferredWidth: _buttonSize + Layout.preferredHeight: _buttonSize + iconSource: UM.Theme.getIcon("House") + leftPadding: (Layout.preferredWidth - iconSize) / 2 - onClicked: - { - printerModel.homeHead() - } + onClicked: printerModel.homeHead() } } @@ -187,54 +156,44 @@ Item { spacing: UM.Theme.getSize("default_lining").height - Label + UM.Label { text: catalog.i18nc("@label", "Z") color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") width: UM.Theme.getSize("section").height height: UM.Theme.getSize("setting_control").height - verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter } - Button + Cura.SecondaryButton { - iconSource: UM.Theme.getIcon("ChevronSingleUp"); - style: UM.Theme.styles.monitor_button_style + iconSource: UM.Theme.getIcon("ChevronSingleUp") width: height - height: UM.Theme.getSize("setting_control").height + height: _buttonSize + leftPadding: (width - iconSize) / 2 + + onClicked: printerModel.moveHead(0, 0, distancesRow.currentDistance) - onClicked: - { - printerModel.moveHead(0, 0, distancesRow.currentDistance) - } } - Button + Cura.SecondaryButton { - iconSource: UM.Theme.getIcon("House"); - style: UM.Theme.styles.monitor_button_style + iconSource: UM.Theme.getIcon("House") width: height - height: UM.Theme.getSize("setting_control").height + height: _buttonSize + leftPadding: (width - iconSize) / 2 - onClicked: - { - printerModel.homeBed() - } + onClicked: printerModel.homeBed() } - Button + Cura.SecondaryButton { - iconSource: UM.Theme.getIcon("ChevronSingleDown"); - style: UM.Theme.styles.monitor_button_style + iconSource: UM.Theme.getIcon("ChevronSingleDown") width: height - height: UM.Theme.getSize("setting_control").height + height: _buttonSize + leftPadding: (width - iconSize) / 2 - onClicked: - { - printerModel.moveHead(0, 0, -distancesRow.currentDistance) - } + onClicked: printerModel.moveHead(0, 0, -distancesRow.currentDistance) } } } @@ -252,15 +211,13 @@ Item property real currentDistance: 10 - Label + UM.Label { text: catalog.i18nc("@label", "Jog Distance") color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("setting_control").height - verticalAlignment: Text.AlignVCenter } Row @@ -268,18 +225,16 @@ Item Repeater { model: distancesModel - delegate: Button + delegate: Cura.SecondaryButton { height: UM.Theme.getSize("setting_control").height - width: height + UM.Theme.getSize("default_margin").width text: model.label - exclusiveGroup: distanceGroup - checkable: true - checked: distancesRow.currentDistance == model.value + ButtonGroup.group: distanceGroup + color: distancesRow.currentDistance == model.value ? UM.Theme.getColor("primary_button") : UM.Theme.getColor("secondary_button") + textColor: distancesRow.currentDistance == model.value ? UM.Theme.getColor("primary_button_text"): UM.Theme.getColor("secondary_button_text") + hoverColor: distancesRow.currentDistance == model.value ? UM.Theme.getColor("primary_button_hover"): UM.Theme.getColor("secondary_button_hover") onClicked: distancesRow.currentDistance = model.value - - style: UM.Theme.styles.monitor_checkable_button_style } } } @@ -296,15 +251,13 @@ Item spacing: UM.Theme.getSize("default_margin").width - Label + UM.Label { text: catalog.i18nc("@label", "Send G-code") color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("setting_control").height - verticalAlignment: Text.AlignVCenter } Row @@ -410,6 +363,6 @@ Item ListElement { label: "10"; value: 10 } ListElement { label: "100"; value: 100 } } - ExclusiveGroup { id: distanceGroup } + ButtonGroup { id: distanceGroup } } } diff --git a/resources/qml/PrinterOutput/MonitorItem.qml b/resources/qml/PrinterOutput/MonitorItem.qml index a26ec20f64..a6e78ba837 100644 --- a/resources/qml/PrinterOutput/MonitorItem.qml +++ b/resources/qml/PrinterOutput/MonitorItem.qml @@ -1,19 +1,16 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 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 UM 1.5 as UM import Cura 1.0 as Cura Item { property string label: "" property string value: "" - height: childrenRect.height; + height: childrenRect.height property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null @@ -24,22 +21,20 @@ Item anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - Label + UM.Label { width: Math.floor(parent.width * 0.4) anchors.verticalCenter: parent.verticalCenter text: label color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - font: UM.Theme.getFont("default") elide: Text.ElideRight } - Label + UM.Label { width: Math.floor(parent.width * 0.6) anchors.verticalCenter: parent.verticalCenter text: value color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - font: UM.Theme.getFont("default") elide: Text.ElideRight } } diff --git a/resources/qml/PrinterOutput/MonitorSection.qml b/resources/qml/PrinterOutput/MonitorSection.qml index 1d9df777b6..219be45d06 100644 --- a/resources/qml/PrinterOutput/MonitorSection.qml +++ b/resources/qml/PrinterOutput/MonitorSection.qml @@ -2,11 +2,8 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Item @@ -21,14 +18,12 @@ Item width: base.width height: UM.Theme.getSize("section").height - Label + UM.Label { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width text: label - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("setting_category_text") } } } diff --git a/resources/qml/PrinterOutput/OutputDeviceHeader.qml b/resources/qml/PrinterOutput/OutputDeviceHeader.qml index cbb9461778..56c8fcb936 100644 --- a/resources/qml/PrinterOutput/OutputDeviceHeader.qml +++ b/resources/qml/PrinterOutput/OutputDeviceHeader.qml @@ -1,8 +1,9 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.1 import UM 1.2 as UM import Cura 1.0 as Cura @@ -28,7 +29,7 @@ Item height: childrenRect.height color: UM.Theme.getColor("setting_category") - Label + UM.Label { id: outputDeviceNameLabel font: UM.Theme.getFont("large_bold") @@ -39,7 +40,7 @@ Item text: outputDevice != null ? outputDevice.activePrinter.name : "" } - Label + UM.Label { id: outputDeviceAddressLabel text: (outputDevice != null && outputDevice.address != null) ? outputDevice.address : "" @@ -50,11 +51,10 @@ Item anchors.margins: UM.Theme.getSize("default_margin").width } - Label + UM.Label { text: outputDevice != null ? "" : catalog.i18nc("@info:status", "The printer is not connected.") color: outputDevice != null && outputDevice.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - font: UM.Theme.getFont("default") wrapMode: Text.WordWrap anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 0c2f80fb37..8bea52fab6 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.1 as Cura Cura.ExpandablePopup @@ -193,42 +193,27 @@ Cura.ExpandablePopup { id: popup width: UM.Theme.getSize("machine_selector_widget_content").width + height: Math.min(machineSelectorList.contentHeight + separator.height + buttonRow.height, UM.Theme.getSize("machine_selector_widget_content").height) //Maximum height is the theme entry. - ScrollView + MachineSelectorList { - id: scroll - width: parent.width - clip: true - leftPadding: UM.Theme.getSize("default_lining").width - rightPadding: UM.Theme.getSize("default_lining").width - - MachineSelectorList + id: machineSelectorList + anchors { - id: machineSelectorList - // Can't use parent.width since the parent is the flickable component and not the ScrollView - width: scroll.width - scroll.leftPadding - scroll.rightPadding - property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height - - // We use an extra property here, since we only want to to be informed about the content size changes. - onContentHeightChanged: - { - scroll.height = Math.min(contentHeight, maximumHeight) - popup.height = scroll.height + buttonRow.height - } - - Component.onCompleted: - { - scroll.height = Math.min(contentHeight, maximumHeight) - popup.height = scroll.height + buttonRow.height - } + left: parent.left + leftMargin: UM.Theme.getSize("default_lining").width + right: parent.right + rightMargin: UM.Theme.getSize("default_lining").width + top: parent.top + bottom: separator.top } + clip: true } Rectangle { id: separator - - anchors.top: scroll.bottom + anchors.bottom: buttonRow.top width: parent.width height: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") @@ -238,8 +223,7 @@ Cura.ExpandablePopup { id: buttonRow - // The separator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar. - anchors.top: separator.top + anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter padding: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index bb30cded9f..74c833f691 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.1 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -43,7 +43,7 @@ Button width: machineSelectorButton.width - machineSelectorButton.leftPadding height: UM.Theme.getSize("action_button").height - Label + UM.Label { id: buttonText anchors @@ -56,8 +56,6 @@ Button color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("small_button_text") font: UM.Theme.getFont("medium") visible: text != "" - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 18b1a68b20..ae2706f9ab 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura ListView @@ -14,22 +14,25 @@ ListView section.property: "hasRemoteConnection" property real contentHeight: childrenRect.height - section.delegate: Label + ScrollBar.vertical: UM.ScrollBar + { + id: scrollBar + } + + section.delegate: UM.Label { text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers") - width: parent.width + width: parent.width - scrollBar.width height: UM.Theme.getSize("action_button").height leftPadding: UM.Theme.getSize("default_margin").width - renderType: Text.NativeRendering font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text_medium") - verticalAlignment: Text.AlignVCenter } delegate: MachineSelectorButton { text: model.name ? model.name : "" - width: listView.width + width: listView.width - scrollBar.width outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null checked: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.id == model.id : false diff --git a/resources/qml/ProfileOverview.qml b/resources/qml/ProfileOverview.qml new file mode 100644 index 0000000000..e1009cd010 --- /dev/null +++ b/resources/qml/ProfileOverview.qml @@ -0,0 +1,52 @@ +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. + +import Qt.labs.qmlmodels 1.0 +import QtQuick 2.7 +import QtQuick.Controls 2.15 + +import UM 1.5 as UM +import Cura 1.6 as Cura + +Cura.TableView +{ + id: profileOverview + + property var qualityItem //The quality profile to display here. + property int extruderPosition: -1 //The extruder to display. -1 denotes the global stack. + property bool isQualityItemCurrentlyActivated: qualityItem != null && qualityItem.name == Cura.MachineManager.activeQualityOrQualityChangesName + + // Hack to make sure that when the data of our model changes the tablemodel is also updated + // If we directly set the rows (So without the clear being called) it doesn't seem to + // get updated correctly. + property var modelRows: qualitySettings.items + onModelRowsChanged: + { + tableModel.clear() + tableModel.rows = modelRows + } + + Cura.QualitySettingsModel + { + id: qualitySettings + selectedPosition: profileOverview.extruderPosition + selectedQualityItem: profileOverview.qualityItem == null ? {} : profileOverview.qualityItem + } + + columnHeaders: [ + catalog.i18nc("@title:column", "Setting"), + catalog.i18nc("@title:column", "Profile"), + catalog.i18nc("@title:column", "Current"), + catalog.i18nc("@title:column Unit of measurement", "Unit") + ] + model: TableModel + { + id: tableModel + TableModelColumn { display: "label" } + TableModelColumn { display: "profile_value" } + TableModelColumn { display: "user_value" } + TableModelColumn { display: "unit" } + rows: modelRows + } + sectionRole: "category" +} \ No newline at end of file diff --git a/resources/qml/SecondaryButton.qml b/resources/qml/SecondaryButton.qml index ba4e0bb2c1..d8027af3fc 100644 --- a/resources/qml/SecondaryButton.qml +++ b/resources/qml/SecondaryButton.qml @@ -11,7 +11,7 @@ Cura.ActionButton { color: UM.Theme.getColor("secondary_button") textColor: UM.Theme.getColor("secondary_button_text") - outlineColor: UM.Theme.getColor("secondary_button_text") + outlineColor: UM.Theme.getColor("border_accent_1") disabledColor: UM.Theme.getColor("action_button_disabled") textDisabledColor: UM.Theme.getColor("action_button_disabled_text") hoverColor: UM.Theme.getColor("secondary_button_hover") diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index ea514eb069..6b2ac55066 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -1,18 +1,18 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Uranium is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 2.0 -import UM 1.1 as UM -import Cura 1.0 as Cura +import UM 1.5 as UM +import Cura 1.5 as Cura SettingItem { id: base property var focusItem: control - contents: ComboBox + contents: Cura.ComboBox { id: control anchors.fill: parent @@ -113,7 +113,7 @@ SettingItem color: UM.Theme.getColor("setting_control_button"); } - background: Rectangle + background: UM.UnderlineBackground { color: { @@ -127,9 +127,7 @@ SettingItem } return UM.Theme.getColor("setting_control") } - radius: UM.Theme.getSize("setting_control_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: + liningColor: { if (!enabled) { @@ -137,13 +135,13 @@ SettingItem } if (control.hovered || control.activeFocus) { - return UM.Theme.getColor("setting_control_border_highlight") + return UM.Theme.getColor("border_main_light") } - return UM.Theme.getColor("setting_control_border") + return UM.Theme.getColor("border_field_light") } } - contentItem: Label + contentItem: UM.Label { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left @@ -153,13 +151,8 @@ SettingItem text: control.currentText textFormat: Text.PlainText - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - elide: Text.ElideLeft - verticalAlignment: Text.AlignVCenter - background: Rectangle { id: swatch @@ -183,12 +176,12 @@ SettingItem contentItem: ListView { - clip: true implicitHeight: contentHeight + + ScrollBar.vertical: UM.ScrollBar {} + clip: true model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex - - ScrollIndicator.vertical: ScrollIndicator { } } background: Rectangle @@ -204,27 +197,15 @@ SettingItem height: control.height highlighted: control.highlightedIndex == index - contentItem: Label + contentItem: UM.Label { anchors.fill: parent anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width text: model.name - renderType: Text.NativeRendering - color: - { - if (model.enabled) - { - UM.Theme.getColor("setting_control_text") - } else - { - UM.Theme.getColor("action_button_disabled_text"); - } - } - font: UM.Theme.getFont("default") + color: model.enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("action_button_disabled_text") elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width background: Rectangle @@ -244,7 +225,6 @@ SettingItem background: Rectangle { color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" - border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" } } } diff --git a/resources/qml/Settings/SettingOptionalExtruder.qml b/resources/qml/Settings/SettingOptionalExtruder.qml index 94df1bcc03..1ac7afe967 100644 --- a/resources/qml/Settings/SettingOptionalExtruder.qml +++ b/resources/qml/Settings/SettingOptionalExtruder.qml @@ -1,11 +1,11 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 import QtQuick.Controls 2.0 -import UM 1.1 as UM -import Cura 1.0 as Cura +import UM 1.5 as UM +import Cura 1.5 as Cura SettingItem { @@ -19,7 +19,7 @@ SettingItem // this extra property to keep the ExtrudersModel and use this in the rest of the code. property var extrudersWithOptionalModel: CuraApplication.getExtrudersModelWithOptional() - contents: ComboBox + contents: Cura.ComboBox { id: control anchors.fill: parent @@ -111,26 +111,24 @@ SettingItem sourceSize.width: width + 5 * screenScaleFactor sourceSize.height: width + 5 * screenScaleFactor - color: UM.Theme.getColor("setting_control_button"); + color: UM.Theme.getColor("setting_control_button") } - background: Rectangle + background: UM.UnderlineBackground { color: { if (!enabled) { - return UM.Theme.getColor("setting_control_disabled"); + return UM.Theme.getColor("setting_control_disabled") } - if (control.hovered || control.activeFocus) + if (control.hovered || base.activeFocus) { - return UM.Theme.getColor("setting_control_highlight"); + return UM.Theme.getColor("setting_control_highlight") } - return UM.Theme.getColor("setting_control"); + return UM.Theme.getColor("setting_control") } - radius: UM.Theme.getSize("setting_control_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: + liningColor: { if (!enabled) { @@ -138,13 +136,13 @@ SettingItem } if (control.hovered || control.activeFocus) { - return UM.Theme.getColor("setting_control_border_highlight") + return UM.Theme.getColor("border_main_light") } - return UM.Theme.getColor("setting_control_border") + return UM.Theme.getColor("border_field_light") } } - contentItem: Label + contentItem: UM.Label { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left @@ -154,12 +152,9 @@ SettingItem text: control.currentText textFormat: Text.PlainText - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter background: Rectangle { @@ -175,19 +170,21 @@ SettingItem } } - popup: Popup { + popup: Popup + { y: control.height - UM.Theme.getSize("default_lining").height width: control.width implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width padding: UM.Theme.getSize("default_lining").width - contentItem: ListView { - clip: true + contentItem: ListView + { implicitHeight: contentHeight + + ScrollBar.vertical: UM.ScrollBar {} + clip: true model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex - - ScrollIndicator.vertical: ScrollIndicator { } } background: Rectangle { @@ -202,7 +199,7 @@ SettingItem height: control.height highlighted: control.highlightedIndex == index - contentItem: Label + contentItem: UM.Label { anchors.fill: parent anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width @@ -210,18 +207,15 @@ SettingItem text: model.name textFormat: Text.PlainText - renderType: Text.NativeRendering color: { if (model.enabled) { UM.Theme.getColor("setting_control_text") } else { - UM.Theme.getColor("action_button_disabled_text"); + UM.Theme.getColor("action_button_disabled_text") } } - font: UM.Theme.getFont("default") elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width background: Rectangle @@ -241,7 +235,6 @@ SettingItem background: Rectangle { color: parent.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" - border.color: parent.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" } } } diff --git a/resources/qml/Settings/SettingTextField.qml b/resources/qml/Settings/SettingTextField.qml index a5647e2d3a..83b5d2a987 100644 --- a/resources/qml/Settings/SettingTextField.qml +++ b/resources/qml/Settings/SettingTextField.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 -import UM 1.1 as UM +import UM 1.5 as UM SettingItem { @@ -26,15 +26,13 @@ SettingItem } } - contents: Rectangle + contents: UM.UnderlineBackground { id: control anchors.fill: parent - radius: UM.Theme.getSize("setting_control_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: + liningColor: { if(!enabled) { @@ -54,9 +52,9 @@ SettingItem //Validation is OK. if(hovered || input.activeFocus) { - return UM.Theme.getColor("setting_control_border_highlight") + return UM.Theme.getColor("border_main_light") } - return UM.Theme.getColor("setting_control_border") + return UM.Theme.getColor("border_field_light") } color: { @@ -90,7 +88,7 @@ SettingItem opacity: !control.hovered ? 0 : propertyProvider.properties.validationState == "ValidatorState.Valid" ? 1.0 : 0.35 } - Label + UM.Label { anchors { @@ -105,9 +103,7 @@ SettingItem //However the setting value is aligned, align the unit opposite. That way it stays readable with right-to-left languages. horizontalAlignment: (input.effectiveHorizontalAlignment == Text.AlignLeft) ? Text.AlignRight : Text.AlignLeft textFormat: Text.PlainText - renderType: Text.NativeRendering color: UM.Theme.getColor("setting_unit") - font: UM.Theme.getFont("default") } TextInput @@ -155,8 +151,9 @@ SettingItem } color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") + selectedTextColor: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") - + selectionColor: UM.Theme.getColor("text_selection") selectByMouse: true maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 10 diff --git a/resources/qml/Settings/SettingUnknown.qml b/resources/qml/Settings/SettingUnknown.qml index 8eeb2fb6a0..645e4571b0 100644 --- a/resources/qml/Settings/SettingUnknown.qml +++ b/resources/qml/Settings/SettingUnknown.qml @@ -4,17 +4,13 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 -import UM 1.2 as UM +import UM 1.5 as UM SettingItem { - contents: Label + contents: UM.Label { anchors.fill: parent text: propertyProvider.properties.value + " " + unit - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter } } diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 9d8916f8f4..2ab98081e7 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -1,12 +1,10 @@ -// Copyright (c) 2021 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.2 +import QtQuick.Controls 2.1 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura import "../Menus" @@ -16,7 +14,6 @@ Item id: settingsView property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel() - property Action configureSettings property bool findingSettings Item @@ -41,18 +38,35 @@ Item repeat: false } - Cura.SearchBar + Cura.TextField { id: filter height: parent.height anchors.left: parent.left anchors.right: parent.right - - placeholderText: catalog.i18nc("@label:textbox", "Search settings") // Overwrite + leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2 + placeholderText: catalog.i18nc("@label:textbox", "Search settings") + font.italic: true property var expandedCategories property bool lastFindingSettings: false + UM.RecolorImage + { + id: searchIcon + + anchors + { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + } + source: UM.Theme.getIcon("search") + height: UM.Theme.getSize("small_button_icon").height + width: height + color: UM.Theme.getColor("text") + } + onTextChanged: settingsSearchTimer.restart() onEditingFinished: @@ -128,7 +142,7 @@ Item } } - ToolButton + UM.SimpleButton { id: settingVisibilityMenu @@ -141,25 +155,9 @@ Item } width: UM.Theme.getSize("medium_button_icon").width height: UM.Theme.getSize("medium_button_icon").height - - style: ButtonStyle - { - background: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: UM.Theme.getSize("medium_button_icon").width - height: UM.Theme.getSize("medium_button_icon").height - sourceSize.width: width - sourceSize.height: height - color: control.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") - source: UM.Theme.getIcon("Hamburger") - } - } - label: Label {} - } + iconSource: UM.Theme.getIcon("Hamburger") + hoverColor: UM.Theme.getColor("small_button_text_hover") + color: UM.Theme.getColor("small_button_text") onClicked: { @@ -174,14 +172,15 @@ Item // Mouse area that gathers the scroll events to not propagate it to the main view. MouseArea { - anchors.fill: scrollView + anchors.fill: contents acceptedButtons: Qt.AllButtons onWheel: wheel.accepted = true } - ScrollView + ListView { - id: scrollView + id: contents + anchors { top: filterContainer.bottom @@ -190,340 +189,332 @@ Item right: parent.right left: parent.left } + clip: true + cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. + ScrollBar.vertical: UM.ScrollBar {} - style: UM.Theme.styles.scrollview - flickableItem.flickableDirection: Flickable.VerticalFlick - __wheelAreaScrollSpeed: 75 // Scroll three lines in one scroll event - - ListView + model: UM.SettingDefinitionsModel { - id: contents - cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. - - model: UM.SettingDefinitionsModel + id: definitionsModel + containerId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.id: "" + visibilityHandler: UM.SettingPreferenceVisibilityHandler { } + exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "cutting_mesh", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settings are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false. + expanded: CuraApplication.expandedCategories + onExpandedChanged: { - id: definitionsModel - containerId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.id: "" - visibilityHandler: UM.SettingPreferenceVisibilityHandler { } - exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "cutting_mesh", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settings are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false. - expanded: CuraApplication.expandedCategories - onExpandedChanged: + if (!findingSettings) { - if (!findingSettings) - { - // Do not change expandedCategories preference while filtering settings - // because all categories are expanded while filtering - CuraApplication.setExpandedCategories(expanded) - } + // Do not change expandedCategories preference while filtering settings + // because all categories are expanded while filtering + CuraApplication.setExpandedCategories(expanded) + } + } + onVisibilityChanged: Cura.SettingInheritanceManager.scheduleUpdate() + } + + property int indexWithFocus: -1 + property double delegateHeight: UM.Theme.getSize("section").height + 2 * UM.Theme.getSize("default_lining").height + property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" + delegate: Loader + { + id: delegate + + width: contents.width + height: enabled ? contents.delegateHeight: 0 + Behavior on height { NumberAnimation { duration: 100 } } + opacity: enabled ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + enabled: provider.properties.enabled === "True" + + property var definition: model + property var settingDefinitionsModel: definitionsModel + property var propertyProvider: provider + property var globalPropertyProvider: inheritStackProvider + property bool externalResetHandler: false + + //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 + //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, + //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. + asynchronous: model.type !== "enum" && model.type !== "extruder" && model.type !== "optional_extruder" + active: model.type !== undefined + + source: + { + switch(model.type) + { + case "int": + return "SettingTextField.qml" + case "[int]": + return "SettingTextField.qml" + case "float": + return "SettingTextField.qml" + case "enum": + return "SettingComboBox.qml" + case "extruder": + return "SettingExtruder.qml" + case "bool": + return "SettingCheckBox.qml" + case "str": + return "SettingTextField.qml" + case "category": + return "SettingCategory.qml" + case "optional_extruder": + return "SettingOptionalExtruder.qml" + default: + return "SettingUnknown.qml" } - onVisibilityChanged: Cura.SettingInheritanceManager.scheduleUpdate() } - property int indexWithFocus: -1 - property double delegateHeight: UM.Theme.getSize("section").height + 2 * UM.Theme.getSize("default_lining").height - property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" - delegate: Loader + // Binding to ensure that the right containerstack ID is set for the provider. + // This ensures that if a setting has a limit_to_extruder id (for instance; Support speed points to the + // extruder that actually prints the support, as that is the setting we need to use to calculate the value) + Binding { - id: delegate - - width: scrollView.width - height: enabled ? contents.delegateHeight: 0 - Behavior on height { NumberAnimation { duration: 100 } } - opacity: enabled ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 100 } } - enabled: provider.properties.enabled === "True" - - property var definition: model - property var settingDefinitionsModel: definitionsModel - property var propertyProvider: provider - property var globalPropertyProvider: inheritStackProvider - property bool externalResetHandler: false - - //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 - //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, - //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type !== "enum" && model.type !== "extruder" && model.type !== "optional_extruder" - active: model.type !== undefined - - source: + target: provider + property: "containerStackId" + when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0); + value: { - switch(model.type) - { - case "int": - return "SettingTextField.qml" - case "[int]": - return "SettingTextField.qml" - case "float": - return "SettingTextField.qml" - case "enum": - return "SettingComboBox.qml" - case "extruder": - return "SettingExtruder.qml" - case "bool": - return "SettingCheckBox.qml" - case "str": - return "SettingTextField.qml" - case "category": - return "SettingCategory.qml" - case "optional_extruder": - return "SettingOptionalExtruder.qml" - default: - return "SettingUnknown.qml" - } - } + // Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this + // binding will be triggered when activeMachineId is changed too. + // Otherwise, if this value only depends on the extruderIds, it won't get updated when the + // machine gets changed. - // Binding to ensure that the right containerstack ID is set for the provider. - // This ensures that if a setting has a limit_to_extruder id (for instance; Support speed points to the - // extruder that actually prints the support, as that is the setting we need to use to calculate the value) - Binding - { - target: provider - property: "containerStackId" - when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0); - value: + if (!model.settable_per_extruder) { - // Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this - // binding will be triggered when activeMachineId is changed too. - // Otherwise, if this value only depends on the extruderIds, it won't get updated when the - // machine gets changed. - - if (!model.settable_per_extruder) - { - //Not settable per extruder or there only is global, so we must pick global. - return contents.activeMachineId - } - if (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0) - { - //We have limit_to_extruder, so pick that stack. - return Cura.ExtruderManager.extruderIds[inheritStackProvider.properties.limit_to_extruder]; - } - if (Cura.ExtruderManager.activeExtruderStackId) - { - //We're on an extruder tab. Pick the current extruder. - return Cura.ExtruderManager.activeExtruderStackId; - } - //No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab. + //Not settable per extruder or there only is global, so we must pick global. return contents.activeMachineId } - } - - // Specialty provider that only watches global_inherits (we can't filter on what property changed we get events - // so we bypass that to make a dedicated provider). - UM.SettingPropertyProvider - { - id: inheritStackProvider - containerStackId: contents.activeMachineId - key: model.key - watchedProperties: [ "limit_to_extruder" ] - } - - UM.SettingPropertyProvider - { - id: provider - - containerStackId: contents.activeMachineId - key: model.key - watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ] - storeIndex: 0 - removeUnusedValue: model.resolve === undefined - } - - Connections - { - target: item - function onContextMenuRequested() + if (inheritStackProvider.properties.limit_to_extruder !== undefined && inheritStackProvider.properties.limit_to_extruder >= 0) { - contextMenu.key = model.key; - contextMenu.settingVisible = model.visible; - contextMenu.provider = provider - contextMenu.popup(); + //We have limit_to_extruder, so pick that stack. + return Cura.ExtruderManager.extruderIds[inheritStackProvider.properties.limit_to_extruder] } - function onShowTooltip(text) { base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) } - function onHideTooltip() { base.hideTooltip() } - function onShowAllHiddenInheritedSettings(category_id) + if (Cura.ExtruderManager.activeExtruderStackId) { - var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(category_id) - for(var i = 0; i < children_with_override.length; i++) - { - definitionsModel.setVisible(children_with_override[i], true) - } - Cura.SettingInheritanceManager.manualRemoveOverride(category_id) - } - function onFocusReceived() - { - contents.indexWithFocus = index; - animateContentY.from = contents.contentY; - contents.positionViewAtIndex(index, ListView.Contain); - animateContentY.to = contents.contentY; - animateContentY.running = true; - } - function onSetActiveFocusToNextSetting(forward) - { - if (forward == undefined || forward) - { - contents.currentIndex = contents.indexWithFocus + 1; - while(contents.currentItem && contents.currentItem.height <= 0) - { - contents.currentIndex++; - } - if (contents.currentItem) - { - contents.currentItem.item.focusItem.forceActiveFocus(); - } - } - else - { - contents.currentIndex = contents.indexWithFocus - 1; - while(contents.currentItem && contents.currentItem.height <= 0) - { - contents.currentIndex--; - } - if (contents.currentItem) - { - contents.currentItem.item.focusItem.forceActiveFocus(); - } - } + //We're on an extruder tab. Pick the current extruder. + return Cura.ExtruderManager.activeExtruderStackId } + //No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab. + return contents.activeMachineId } } - NumberAnimation { - id: animateContentY - target: contents - property: "contentY" - duration: 50 - } - - add: Transition { - SequentialAnimation { - NumberAnimation { properties: "height"; from: 0; duration: 100 } - NumberAnimation { properties: "opacity"; from: 0; duration: 100 } - } - } - remove: Transition { - SequentialAnimation { - NumberAnimation { properties: "opacity"; to: 0; duration: 100 } - NumberAnimation { properties: "height"; to: 0; duration: 100 } - } - } - addDisplaced: Transition { - NumberAnimation { properties: "x,y"; duration: 100 } - } - removeDisplaced: Transition { - SequentialAnimation { - PauseAnimation { duration: 100; } - NumberAnimation { properties: "x,y"; duration: 100 } - } - } - - Menu + // Specialty provider that only watches global_inherits (we can't filter on what property changed we get events + // so we bypass that to make a dedicated provider). + UM.SettingPropertyProvider { - id: contextMenu - - property string key - property var provider - property bool settingVisible - - MenuItem - { - //: Settings context menu action - text: catalog.i18nc("@action:menu", "Copy value to all extruders") - visible: machineExtruderCount.properties.value > 1 - enabled: contextMenu.provider !== undefined && contextMenu.provider.properties.settable_per_extruder !== "False" - onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key) - } - - MenuItem - { - //: Settings context menu action - text: catalog.i18nc("@action:menu", "Copy all changed values to all extruders") - visible: machineExtruderCount.properties.value > 1 - enabled: contextMenu.provider !== undefined - onTriggered: Cura.MachineManager.copyAllValuesToExtruders() - } - - MenuSeparator - { - visible: machineExtruderCount.properties.value > 1 - } - - Instantiator - { - id: customMenuItems - model: Cura.SidebarCustomMenuItemsModel { } - MenuItem - { - text: model.name - iconName: model.icon_name - onTriggered: - { - customMenuItems.model.callMenuItemMethod(name, model.actions, {"key": contextMenu.key}) - } - } - onObjectAdded: contextMenu.insertItem(index, object) - onObjectRemoved: contextMenu.removeItem(object) - } - - MenuSeparator - { - visible: customMenuItems.count > 0 - } - - MenuItem - { - //: Settings context menu action - visible: !findingSettings - text: catalog.i18nc("@action:menu", "Hide this setting"); - onTriggered: - { - definitionsModel.hide(contextMenu.key) - } - } - MenuItem - { - //: Settings context menu action - text: - { - if (contextMenu.settingVisible) - { - return catalog.i18nc("@action:menu", "Don't show this setting"); - } - else - { - return catalog.i18nc("@action:menu", "Keep this setting visible"); - } - } - visible: findingSettings - onTriggered: - { - if (contextMenu.settingVisible) - { - definitionsModel.hide(contextMenu.key); - } - else - { - definitionsModel.show(contextMenu.key); - } - } - } - MenuItem - { - //: Settings context menu action - text: catalog.i18nc("@action:menu", "Configure setting visibility..."); - - onTriggered: Cura.Actions.configureSettingVisibility.trigger(contextMenu); - } + id: inheritStackProvider + containerStackId: contents.activeMachineId + key: model.key + watchedProperties: [ "limit_to_extruder" ] } UM.SettingPropertyProvider { - id: machineExtruderCount + id: provider - containerStackId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" - key: "machine_extruder_count" - watchedProperties: [ "value" ] + containerStackId: contents.activeMachineId + key: model.key + watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ] storeIndex: 0 + removeUnusedValue: model.resolve === undefined } + + Connections + { + target: item + function onContextMenuRequested() + { + contextMenu.key = model.key + contextMenu.settingVisible = model.visible + contextMenu.provider = provider + contextMenu.popup() //iconName: model.icon_name + } + function onShowTooltip(text) { base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) } + function onHideTooltip() { base.hideTooltip() } + function onShowAllHiddenInheritedSettings() + { + var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(category_id) + for(var i = 0; i < children_with_override.length; i++) + { + definitionsModel.setVisible(children_with_override[i], true) + } + Cura.SettingInheritanceManager.manualRemoveOverride(category_id) + } + function onFocusReceived() + { + contents.indexWithFocus = index + animateContentY.from = contents.contentY + contents.positionViewAtIndex(index, ListView.Contain) + animateContentY.to = contents.contentY + animateContentY.running = true + } + function onSetActiveFocusToNextSetting(forward) + { + if (forward == undefined || forward) + { + contents.currentIndex = contents.indexWithFocus + 1 + while(contents.currentItem && contents.currentItem.height <= 0) + { + contents.currentIndex++ + } + if (contents.currentItem) + { + contents.currentItem.item.focusItem.forceActiveFocus() + } + } + else + { + contents.currentIndex = contents.indexWithFocus - 1 + while(contents.currentItem && contents.currentItem.height <= 0) + { + contents.currentIndex-- + } + if (contents.currentItem) + { + contents.currentItem.item.focusItem.forceActiveFocus() + } + } + } + } + } + + NumberAnimation { + id: animateContentY + target: contents + property: "contentY" + duration: 50 + } + + add: Transition { + SequentialAnimation { + NumberAnimation { properties: "height"; from: 0; duration: 100 } + NumberAnimation { properties: "opacity"; from: 0; duration: 100 } + } + } + remove: Transition { + SequentialAnimation { + NumberAnimation { properties: "opacity"; to: 0; duration: 100 } + NumberAnimation { properties: "height"; to: 0; duration: 100 } + } + } + addDisplaced: Transition { + NumberAnimation { properties: "x,y"; duration: 100 } + } + removeDisplaced: Transition { + SequentialAnimation { + PauseAnimation { duration: 100; } + NumberAnimation { properties: "x,y"; duration: 100 } + } + } + + Cura.Menu + { + id: contextMenu + + property string key + property var provider + property bool settingVisible + + Cura.MenuItem + { + //: Settings context menu action + text: catalog.i18nc("@action:menu", "Copy value to all extruders") + visible: machineExtruderCount.properties.value > 1 + enabled: contextMenu.provider !== undefined && contextMenu.provider.properties.settable_per_extruder !== "False" + onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key) + } + + Cura.MenuItem + { + //: Settings context menu action + text: catalog.i18nc("@action:menu", "Copy all changed values to all extruders") + visible: machineExtruderCount.properties.value > 1 + enabled: contextMenu.provider !== undefined + onTriggered: Cura.MachineManager.copyAllValuesToExtruders() + } + + Cura.MenuSeparator + { + visible: machineExtruderCount.properties.value > 1 + } + + Instantiator + { + id: customMenuItems + model: Cura.SidebarCustomMenuItemsModel { } + Cura.MenuItem + { + text: model.name + onTriggered: + { + customMenuItems.model.callMenuItemMethod(name, model.actions, {"key": contextMenu.key}) + } + } + onObjectAdded: contextMenu.insertItem(index, object) + onObjectRemoved: contextMenu.removeItem(object) + } + + Cura.MenuSeparator + { + visible: customMenuItems.count > 0 + } + + Cura.MenuItem + { + //: Settings context menu action + visible: !findingSettings + text: catalog.i18nc("@action:menu", "Hide this setting") + onTriggered: + { + definitionsModel.hide(contextMenu.key) + } + } + Cura.MenuItem + { + //: Settings context menu action + text: + { + if (contextMenu.settingVisible) + { + return catalog.i18nc("@action:menu", "Don't show this setting") + } + else + { + return catalog.i18nc("@action:menu", "Keep this setting visible") + } + } + visible: findingSettings + onTriggered: + { + if (contextMenu.settingVisible) + { + definitionsModel.hide(contextMenu.key) + } + else + { + definitionsModel.show(contextMenu.key) + } + } + } + Cura.MenuItem + { + //: Settings context menu action + text: catalog.i18nc("@action:menu", "Configure setting visibility...") + + onTriggered: Cura.Actions.configureSettingVisibility.trigger(contextMenu) + } + } + + UM.SettingPropertyProvider + { + id: machineExtruderCount + + containerStackId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" + key: "machine_extruder_count" + watchedProperties: [ "value" ] + storeIndex: 0 } } } diff --git a/resources/qml/SpinBox.qml b/resources/qml/SpinBox.qml new file mode 100644 index 0000000000..3c5a4d95e2 --- /dev/null +++ b/resources/qml/SpinBox.qml @@ -0,0 +1,131 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 2.15 + +import UM 1.5 as UM +import Cura 1.5 as Cura + +// This component extends the funtionality of QtControls 2.x Spinboxes to +// - be able to contain fractional values +// - hava a "prefix" and a "suffix". A validator is added that recognizes this pre-, suf-fix combo. When adding a custom +// validator the pre-, suf-fix should be added (e.g. new RegExp("^" + prefix + \regex\ + suffix + "$") + +Item +{ + id: base + + property string prefix: "" + property string suffix: "" + property int decimals: 0 + property real stepSize: 1 + property real value: 0 + property real from: 0 + property real to: 99 + + property alias wrap: spinBox.wrap + + property bool editable: true + + property var validator: RegExpValidator + { + regExp: new RegExp("^" + prefix + "([0-9]+[.|,]?[0-9]*)?" + suffix + "$") + } + + signal editingFinished() + implicitWidth: spinBox.implicitWidth + implicitHeight: spinBox.implicitHeight + + SpinBox + { + id: spinBox + anchors.fill: base + editable: base.editable + topPadding: 0 + bottomPadding: 0 + padding: UM.Theme.getSize("narrow_margin").width + + // The stepSize of the SpinBox is intentionally set to be always `1` + // As SpinBoxes can only contain integer values the `base.stepSize` is concidered the precision/resolution + // increasing the spinBox.value by one increases the actual/real value of the component by `base.stepSize` + // as such spinBox.value * base.stepSizes produces the real value of the component + stepSize: 1 + value: Math.floor(base.value / base.stepSize) + from: Math.floor(base.from / base.stepSize) + to: Math.floor(base.to / base.stepSize) + + valueFromText: function(text) + { + return parseFloat(text.substring(prefix.length, text.length - suffix.length).replace(",", ".")) / base.stepSize; + } + + textFromValue: function(value) + { + return prefix + (value * base.stepSize).toFixed(decimals) + suffix; + } + + validator: base.validator + + onValueModified: + { + base.value = value * base.stepSize; + } + + background: Item {} + + contentItem: Cura.TextField + { + text: spinBox.textFromValue(spinBox.value, spinBox.locale) + validator: base.validator + + onActiveFocusChanged: + { + if (!activeFocus) + { + base.editingFinished(); + } + } + } + + down.indicator: Rectangle + { + x: spinBox.mirrored ? parent.width - width : 0 + height: parent.height + width: height + + UM.UnderlineBackground { + color: spinBox.down.pressed ? spinBox.palette.mid : UM.Theme.getColor("detail_background") + } + + UM.RecolorImage + { + anchors.centerIn: parent + height: parent.height / 2.5 + width: height + color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled") + source: UM.Theme.getIcon("Minus") + } + } + + up.indicator: Rectangle + { + x: spinBox.mirrored ? 0 : parent.width - width + height: parent.height + width: height + + UM.UnderlineBackground { + color: spinBox.up.pressed ? spinBox.palette.mid : UM.Theme.getColor("detail_background") + } + + UM.RecolorImage + { + anchors.centerIn: parent + height: parent.height / 2.5 + width: height + color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled") + source: UM.Theme.getIcon("Plus") + } + } + } +} diff --git a/resources/qml/TableView.qml b/resources/qml/TableView.qml index 1b084be5a0..5e0b863f5a 100644 --- a/resources/qml/TableView.qml +++ b/resources/qml/TableView.qml @@ -1,68 +1,235 @@ -// Copyright (C) 2021 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (C) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.10 -import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one -import QtQuick.Controls 2.3 -import QtQuick.Controls.Styles 1.4 +import Qt.labs.qmlmodels 1.0 +import QtQuick 2.15 +import QtQuick.Controls 2.15 -import UM 1.2 as UM +import UM 1.5 as UM - -OldControls.TableView +/* + * A re-sizeable table of data. + * + * This table combines a list of headers with a TableView to show certain roles in a table. + * The columns of the table can be resized. + * When the table becomes too big, you can scroll through the table. When a column becomes too small, the contents of + * the table are elided. + * The table gets Cura's themeing. + */ +Item { - itemDelegate: Item - { - height: tableCellLabel.implicitHeight + id: tableBase - Label + required property var columnHeaders //The text to show in the headers of each column. + property alias model: tableView.model //A TableModel to display in this table. To use a ListModel for the rows, use "rows: listModel.items" + property int currentRow: -1 //The selected row index. + property var onDoubleClicked: function(row) {} //Something to execute when double clicked. Accepts one argument: The index of the row that was clicked on. + property bool allowSelection: true //Whether to allow the user to select items. + property string sectionRole: "" + + property alias flickableDirection: tableView.flickableDirection + Row + { + id: headerBar + Repeater { - id: tableCellLabel - color: styleData.selected ? UM.Theme.getColor("primary_button_text") : UM.Theme.getColor("text") - elide: Text.ElideRight - text: styleData.value - anchors.fill: parent - anchors.leftMargin: 10 * screenScaleFactor - verticalAlignment: Text.AlignVCenter + id: headerRepeater + model: columnHeaders + Rectangle + { + width: Math.max(1, Math.round(tableBase.width / headerRepeater.count)) + height: UM.Theme.getSize("section").height + + color: UM.Theme.getColor("main_background") + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("thick_lining") + + UM.Label + { + id: contentText + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("narrow_margin").width + wrapMode: Text.NoWrap + text: modelData + font: UM.Theme.getFont("medium_bold") + elide: Text.ElideRight + } + Item //Resize handle. + { + anchors + { + right: parent.right + top: parent.top + bottom: parent.bottom + } + width: UM.Theme.getSize("default_lining").width + + MouseArea + { + anchors.fill: parent + + cursorShape: Qt.SizeHorCursor + drag + { + target: parent + axis: Drag.XAxis + } + onMouseXChanged: + { + if(drag.active) + { + let new_width = parent.parent.width + mouseX; + let sum_widths = mouseX; + for(let i = 0; i < headerBar.children.length; ++i) + { + sum_widths += headerBar.children[i].width; + } + if(sum_widths > tableBase.width) + { + new_width -= sum_widths - tableBase.width; //Limit the total width to not exceed the view. + } + let width_fraction = new_width / tableBase.width; //Scale with the same fraction along with the total width, if the table is resized. + parent.parent.width = Qt.binding(function() { return Math.max(10, Math.round(tableBase.width * width_fraction)) }); + } + } + } + } + + onWidthChanged: tableView.forceLayout(); //Rescale table cells underneath as well. + } + } + } + Rectangle + { + color: UM.Theme.getColor("main_background") + anchors + { + top: headerBar.bottom + topMargin: -UM.Theme.getSize("default_lining").width + left: parent.left + right: parent.right + bottom: parent.bottom + } + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("thick_lining") + } + + TableView + { + id: tableView + anchors + { + top: headerBar.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + margins: UM.Theme.getSize("default_lining").width + } + + flickableDirection: Flickable.AutoFlickIfNeeded + contentWidth: -1 // AUto calculate the contendWidth + clip: true + ScrollBar.vertical: UM.ScrollBar {} + columnWidthProvider: function(column) + { + return headerBar.children[column].width; //Cells get the same width as their column header. + } + + delegate: Rectangle + { + implicitHeight: Math.max(1, cellContent.height) + + color: UM.Theme.getColor((tableBase.currentRow == row) ? "text_selection" : "main_background") + + UM.Label + { + id: cellContent + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + } + wrapMode: Text.NoWrap + text: display + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + TextMetrics + { + id: cellTextMetrics + text: cellContent.text + font: cellContent.font + elide: cellContent.elide + elideWidth: cellContent.width + } + UM.TooltipArea + { + anchors.fill: parent + + acceptedButtons: Qt.LeftButton + text: (cellTextMetrics.elidedText == cellContent.text) ? "" : cellContent.text //Show full text in tooltip if it was elided. + onClicked: + { + if(tableBase.allowSelection) + { + tableBase.currentRow = row; //Select this row. + } + } + onDoubleClicked: + { + tableBase.onDoubleClicked(row); + } + } + } + + Connections + { + target: model + function onRowCountChanged() + { + tableView.contentY = 0; //When the number of rows is reduced, make sure to scroll back to the start. + } } } - rowDelegate: Rectangle + Connections { - color: styleData.selected ? UM.Theme.getColor("primary_button") : UM.Theme.getColor("main_background") - height: UM.Theme.getSize("table_row").height - } - - // Use the old styling technique since it's the only way to make the scrollbars themed in the TableView - style: TableViewStyle - { - backgroundColor: UM.Theme.getColor("main_background") - - handle: Rectangle + target: model + function onRowsChanged() { - // Both implicit width and height have to be set, since the handle is used by both the horizontal and the vertical scrollbars - implicitWidth: UM.Theme.getSize("scrollbar").width - implicitHeight: UM.Theme.getSize("scrollbar").width - radius: width / 2 - color: UM.Theme.getColor(styleData.pressed ? "scrollbar_handle_down" : (styleData.hovered ? "scrollbar_handle_hover" : "scrollbar_handle")) - } + let first_column = model.columns[0].display; + if(model.rows.length > 0 && model.rows[0][first_column].startsWith("")) //First item is already a section header. + { + return; //Assume we already added section headers. Prevent infinite recursion. + } + if(sectionRole === "" || model.rows.length == 0) //No section headers, or no items at all. + { + tableView.model.rows = model.rows; + return; + } - scrollBarBackground: Rectangle - { - // Both implicit width and height have to be set, since the handle is used by both the horizontal and the vertical scrollbars - implicitWidth: UM.Theme.getSize("scrollbar").width - implicitHeight: UM.Theme.getSize("scrollbar").width - color: UM.Theme.getColor("main_background") + //Insert section headers in the rows. + let last_section = ""; + let new_rows = []; + for(let i = 0; i < model.rows.length; ++i) + { + let item_section = model.rows[i][sectionRole]; + if(item_section !== last_section) //Starting a new section. + { + let section_header = {}; + for(let key in model.rows[i]) + { + section_header[key] = (key === first_column) ? "" + item_section + "" : ""; //Put the section header in the first column. + } + new_rows.push(section_header); //Add a row representing a section header. + last_section = item_section; + } + new_rows.push(model.rows[i]); + } + tableView.model.rows = new_rows; } - - // The little rectangle between the vertical and horizontal scrollbars - corner: Rectangle - { - color: UM.Theme.getColor("main_background") - } - - // Override the control arrows - incrementControl: Item { } - decrementControl: Item { } } } \ No newline at end of file diff --git a/resources/qml/ToolTip.qml b/resources/qml/ToolTip.qml index c4edc5a361..f02bf0b50f 100644 --- a/resources/qml/ToolTip.qml +++ b/resources/qml/ToolTip.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.0 as UM +import UM 1.5 as UM import Cura 1.0 as Cura ToolTip @@ -62,7 +62,7 @@ ToolTip visible: tooltip.height != 0 } - contentItem: Label + contentItem: UM.Label { id: label text: tooltip.text @@ -70,7 +70,6 @@ ToolTip wrapMode: Text.Wrap textFormat: Text.RichText color: UM.Theme.getColor("tooltip_text") - renderType: Text.NativeRendering } function show() { diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index fc0f20fa77..ad3d184028 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -2,8 +2,6 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM import Cura 1.1 as Cura diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index af98469921..452cc5a09a 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -4,7 +4,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.2 as UM +import UM 1.5 as UM import Cura 1.0 as Cura Cura.ExpandablePopup @@ -44,22 +44,19 @@ Cura.ExpandablePopup headerItem: Item { - Label + UM.Label { id: title text: catalog.i18nc("@label", "View type") - verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text_medium") - renderType: Text.NativeRendering } - Label + UM.Label { text: viewSelector.activeView ? viewSelector.activeView.name : "" - verticalAlignment: Text.AlignVCenter anchors { left: title.right @@ -69,8 +66,6 @@ Cura.ExpandablePopup height: parent.height elide: Text.ElideRight font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } } @@ -102,14 +97,11 @@ Cura.ExpandablePopup checkable: true checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false - contentItem: Label + contentItem: UM.Label { id: buttonText text: viewsSelectorButton.text - color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } diff --git a/resources/qml/WelcomePages/AddCloudPrintersView.qml b/resources/qml/WelcomePages/AddCloudPrintersView.qml index e33d519f22..0b94d21fae 100644 --- a/resources/qml/WelcomePages/AddCloudPrintersView.qml +++ b/resources/qml/WelcomePages/AddCloudPrintersView.qml @@ -1,11 +1,11 @@ -// Copyright (c) 2019 Ultimaker B.V. +// 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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.7 as Cura @@ -22,7 +22,7 @@ Item property bool searchingForCloudPrinters: true property var discoveredCloudPrintersModel: CuraApplication.getDiscoveredCloudPrintersModel() - // The area where either the discoveredCloudPrintersScrollView or the busyIndicator will be displayed + // The area where either the discoveredCloudPrintersList or the busyIndicator will be displayed Item { id: cloudPrintersContent @@ -126,14 +126,9 @@ Item // The scrollView that contains the list of newly discovered Ultimaker Cloud printers. Visible only when // there is at least a new cloud printer. - ScrollView + ListView { - id: discoveredCloudPrintersScrollView - width: parent.width - clip : true - ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AsNeeded - visible: discoveredCloudPrintersModel.count > 0 + id: discoveredCloudPrintersList anchors { top: cloudPrintersAddedTitle.bottom @@ -144,52 +139,47 @@ Item bottom: parent.bottom } - Column + ScrollBar.vertical: UM.ScrollBar {} + clip : true + visible: discoveredCloudPrintersModel.count > 0 + spacing: UM.Theme.getSize("wide_margin").height + + model: discoveredCloudPrintersModel + delegate: Item { - id: discoveredPrintersColumn - spacing: 2 * UM.Theme.getSize("default_margin").height + width: discoveredCloudPrintersList.width + height: contentColumn.height - Repeater + Column { - id: discoveredCloudPrintersRepeater - model: discoveredCloudPrintersModel - delegate: Item + id: contentColumn + Label { - width: discoveredCloudPrintersScrollView.width - height: contentColumn.height - - Column - { - id: contentColumn - Label - { - id: cloudPrinterNameLabel - leftPadding: UM.Theme.getSize("default_margin").width - text: model.name - font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") - elide: Text.ElideRight - } - Label - { - id: cloudPrinterTypeLabel - leftPadding: 2 * UM.Theme.getSize("default_margin").width - topPadding: UM.Theme.getSize("thin_margin").height - text: {"Type: " + model.machine_type} - font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - elide: Text.ElideRight - } - Label - { - id: cloudPrinterFirmwareVersionLabel - leftPadding: 2 * UM.Theme.getSize("default_margin").width - text: {"Firmware version: " + model.firmware_version} - font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - elide: Text.ElideRight - } - } + id: cloudPrinterNameLabel + leftPadding: UM.Theme.getSize("default_margin").width + text: model.name ? model.name : "" + font: UM.Theme.getFont("large_bold") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + Label + { + id: cloudPrinterTypeLabel + leftPadding: 2 * UM.Theme.getSize("default_margin").width + topPadding: UM.Theme.getSize("thin_margin").height + text: {"Type: " + model.machine_type} + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + Label + { + id: cloudPrinterFirmwareVersionLabel + leftPadding: 2 * UM.Theme.getSize("default_margin").width + text: {"Firmware version: " + model.firmware_version} + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight } } } diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 912688e2dc..d2d48267de 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2019 Ultimaker B.V. +// 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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -74,121 +74,93 @@ Item Row { id: localPrinterSelectionItem - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top + anchors.fill: parent - // ScrollView + ListView for selecting a local printer to add - Cura.ScrollView + //Selecting a local printer to add from this list. + ListView { - id: scrollView - - height: childrenHeight + id: machineList width: Math.floor(parent.width * 0.48) + height: parent.height - ListView + clip: true + ScrollBar.vertical: UM.ScrollBar {} + + model: UM.DefinitionContainersModel { - id: machineList - - // CURA-6793 - // Enabling the buffer seems to cause the blank items issue. When buffer is enabled, if the ListView's - // individual item has a dynamic change on its visibility, the ListView doesn't redraw itself. - // The default value of cacheBuffer is platform-dependent, so we explicitly disable it here. - cacheBuffer: 0 - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 20000 // To prevent the flicking behavior. - model: UM.DefinitionContainersModel - { - id: machineDefinitionsModel - filter: { "visible": true } - sectionProperty: "manufacturer" - preferredSections: preferredCategories - } - - section.property: "section" - section.delegate: sectionHeader - delegate: machineButton + id: machineDefinitionsModel + filter: { "visible": true } + sectionProperty: "manufacturer" + preferredSections: preferredCategories } - Component + section.property: "section" + section.delegate: Button { - id: sectionHeader + id: button + width: machineList.width + height: UM.Theme.getSize("action_button").height + text: section - Button + property bool isActive: base.currentSection == section + + background: Rectangle { - id: button - width: ListView.view.width + anchors.fill: parent + color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent" + } + + contentItem: Item + { + width: childrenRect.width height: UM.Theme.getSize("action_button").height - text: section - property bool isActive: base.currentSection == section - - background: Rectangle + UM.RecolorImage { - anchors.fill: parent - color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent" + id: arrow + anchors.left: parent.left + 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: base.currentSection == section ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight") } - contentItem: Item + UM.Label { - width: childrenRect.width - height: UM.Theme.getSize("action_button").height - - UM.RecolorImage - { - id: arrow - anchors.left: parent.left - 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: base.currentSection == section ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight") - } - - Label - { - id: label - anchors.left: arrow.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - verticalAlignment: Text.AlignVCenter - text: button.text - font: UM.Theme.getFont("default_bold") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering - } + id: label + anchors.left: arrow.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: button.text + font: UM.Theme.getFont("default_bold") } + } - onClicked: - { - base.currentSection = section - base.updateCurrentItemUponSectionChange() - } + onClicked: + { + base.currentSection = section + base.updateCurrentItemUponSectionChange() } } - Component + delegate: Cura.RadioButton { - id: machineButton - - Cura.RadioButton + id: radioButton + anchors { - id: radioButton - anchors - { - left: parent !== null ? parent.left: undefined - leftMargin: UM.Theme.getSize("standard_list_lineheight").width + left: parent !== null ? parent.left : undefined + leftMargin: UM.Theme.getSize("standard_list_lineheight").width - right: parent !== null ? parent.right: undefined - rightMargin: UM.Theme.getSize("default_margin").width - } - height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 - - checked: ListView.view.currentIndex == index - text: name - visible: base.currentSection.toLowerCase() === section.toLowerCase() - onClicked: ListView.view.currentIndex = index + right: parent !== null ? parent.right : undefined + rightMargin: UM.Theme.getSize("default_margin").width } + height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 //This causes the scrollbar to vary in length due to QTBUG-76830. + + checked: machineList.currentIndex == index + text: name + visible: base.currentSection.toLowerCase() === section.toLowerCase() + onClicked: machineList.currentIndex = index } } @@ -197,7 +169,7 @@ Item { id: verticalLine anchors.top: parent.top - height: childrenHeight - UM.Theme.getSize("default_lining").height + height: parent.height - UM.Theme.getSize("default_lining").height width: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") } @@ -210,7 +182,7 @@ Item spacing: UM.Theme.getSize("default_margin").width padding: UM.Theme.getSize("default_margin").width - Label + UM.Label { width: parent.width - (2 * UM.Theme.getSize("default_margin").width) wrapMode: Text.Wrap @@ -228,48 +200,33 @@ Item verticalItemAlignment: Grid.AlignVCenter - Label + UM.Label { id: manufacturerLabel text: catalog.i18nc("@label", "Manufacturer") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } - Label + UM.Label { text: base.getMachineMetaDataEntry("manufacturer") width: parent.width - manufacturerLabel.width - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering wrapMode: Text.WordWrap } - Label + UM.Label { id: profileAuthorLabel text: catalog.i18nc("@label", "Profile author") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } - Label + UM.Label { text: base.getMachineMetaDataEntry("author") width: parent.width - profileAuthorLabel.width - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering wrapMode: Text.WordWrap } - Label + UM.Label { id: printerNameLabel text: catalog.i18nc("@label", "Printer name") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } Cura.TextField @@ -286,7 +243,5 @@ Item } } } - - } } diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index edf6fe5974..dbf68ce701 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 @@ -45,11 +45,9 @@ Item } contentComponent: networkPrinterListComponent - Component { id: networkPrinterListComponent - AddNetworkPrinterScrollView { id: networkPrinterScrollView @@ -95,20 +93,13 @@ Item } contentComponent: localPrinterListComponent - Component { id: localPrinterListComponent - AddLocalPrinterScrollView { id: localPrinterView - property int childrenHeight: backButton.y - addLocalPrinterDropDown.y - UM.Theme.getSize("expandable_component_content_header").height - UM.Theme.getSize("default_margin").height - - onChildrenHeightChanged: - { - addLocalPrinterDropDown.children[1].height = childrenHeight - } + height: backButton.y - addLocalPrinterDropDown.y - UM.Theme.getSize("expandable_component_content_header").height - UM.Theme.getSize("default_margin").height } } } diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 1209071320..64f194dd56 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2021 Ultimaker B.V. +// 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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura // @@ -17,7 +17,7 @@ Item id: base height: networkPrinterInfo.height + controlsRectangle.height - property alias maxItemCountAtOnce: networkPrinterScrollView.maxItemCountAtOnce + property alias maxItemCountAtOnce: networkPrinterListView.maxItemCountAtOnce property var currentItem: (networkPrinterListView.currentIndex >= 0) ? networkPrinterListView.model[networkPrinterListView.currentIndex] : null @@ -29,125 +29,105 @@ Item Item { id: networkPrinterInfo - height: networkPrinterScrollView.visible ? networkPrinterScrollView.height : noPrinterLabel.height + height: networkPrinterListView.visible ? networkPrinterListView.height : noPrinterLabel.height anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - Label + UM.Label { id: noPrinterLabel height: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("default_margin").height anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "There is no printer found over your network.") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter visible: networkPrinterListView.count == 0 // Do not show if there are discovered devices. } - ScrollView + ListView { - id: networkPrinterScrollView + id: networkPrinterListView anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - - ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AsNeeded - - property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. height: Math.min(contentHeight, (maxItemCountAtOnce * UM.Theme.getSize("action_button").height) - UM.Theme.getSize("default_margin").height) + ScrollBar.vertical: UM.ScrollBar + { + id: networkPrinterScrollBar + } + clip: true + property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll. visible: networkPrinterListView.count > 0 - clip: true + model: contentLoader.enabled ? CuraApplication.getDiscoveredPrintersModel().discoveredPrinters: undefined + cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. - ListView + section.property: "modelData.sectionName" + section.criteria: ViewSection.FullString + section.delegate: UM.Label { - id: networkPrinterListView - anchors.fill: parent - model: contentLoader.enabled ? CuraApplication.getDiscoveredPrintersModel().discoveredPrinters: undefined + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + width: parent.width - networkPrinterScrollBar.width - UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("setting_control").height + text: section + color: UM.Theme.getColor("small_button_text") + } - section.property: "modelData.sectionName" - section.criteria: ViewSection.FullString - section.delegate: sectionHeading - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 20000 // To prevent the flicking behavior. - cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. - - Component.onCompleted: + Component.onCompleted: + { + var toSelectIndex = -1 + // Select the first one that's not "unknown" and is the host a group by default. + for (var i = 0; i < count; i++) { - var toSelectIndex = -1 - // Select the first one that's not "unknown" and is the host a group by default. - for (var i = 0; i < count; i++) + if (!model[i].isUnknownMachineType && model[i].isHostOfGroup) { - if (!model[i].isUnknownMachineType && model[i].isHostOfGroup) - { - toSelectIndex = i - break - } - } - currentIndex = toSelectIndex - } - - // CURA-6483 For some reason currentIndex can be reset to 0. This check is here to prevent automatically - // selecting an unknown or non-host printer. - onCurrentIndexChanged: - { - var item = model[currentIndex] - if (!item || item.isUnknownMachineType || !item.isHostOfGroup) - { - currentIndex = -1 + toSelectIndex = i + break } } + currentIndex = toSelectIndex + } - Component + // CURA-6483 For some reason currentIndex can be reset to 0. This check is here to prevent automatically + // selecting an unknown or non-host printer. + onCurrentIndexChanged: + { + var item = model[currentIndex] + if (!item || item.isUnknownMachineType || !item.isHostOfGroup) { - id: sectionHeading + currentIndex = -1 + } + } - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - height: UM.Theme.getSize("setting_control").height - text: section - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("small_button_text") - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering - } + delegate: Cura.MachineSelectorButton + { + text: modelData.device.name + + width: networkPrinterListView.width - networkPrinterScrollBar.width + outputDevice: modelData.device + + enabled: !modelData.isUnknownMachineType && modelData.isHostOfGroup + + printerTypeLabelAutoFit: true + + // update printer types for all items in the list + updatePrinterTypesOnlyWhenChecked: false + updatePrinterTypesFunction: updateMachineTypes + // show printer type as it is + printerTypeLabelConversionFunction: function(value) { return value } + + function updateMachineTypes() + { + printerTypesList = [ modelData.readableMachineType ] } - delegate: Cura.MachineSelectorButton + checkable: false + selected: networkPrinterListView.currentIndex == model.index + onClicked: { - text: modelData.device.name - - width: networkPrinterListView.width - outputDevice: modelData.device - - enabled: !modelData.isUnknownMachineType && modelData.isHostOfGroup - - printerTypeLabelAutoFit: true - - // update printer types for all items in the list - updatePrinterTypesOnlyWhenChecked: false - updatePrinterTypesFunction: updateMachineTypes - // show printer type as it is - printerTypeLabelConversionFunction: function(value) { return value } - - function updateMachineTypes() - { - printerTypesList = [ modelData.readableMachineType ] - } - - checkable: false - selected: ListView.view.currentIndex == model.index - onClicked: - { - ListView.view.currentIndex = index - } + networkPrinterListView.currentIndex = index } } } @@ -233,7 +213,7 @@ Item source: UM.Theme.getIcon("LinkExternal") } - Label + UM.Label { id: troubleshootingLabel anchors.right: parent.right @@ -241,8 +221,6 @@ Item text: catalog.i18nc("@label", "Troubleshooting") font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_link") - linkColor: UM.Theme.getColor("text_link") - renderType: Text.NativeRendering } MouseArea diff --git a/resources/qml/WelcomePages/ChangelogContent.qml b/resources/qml/WelcomePages/ChangelogContent.qml index d106f94c04..7c3b1adfc3 100644 --- a/resources/qml/WelcomePages/ChangelogContent.qml +++ b/resources/qml/WelcomePages/ChangelogContent.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -15,7 +15,7 @@ Item { UM.I18nCatalog { id: catalog; name: "cura" } - Label + UM.Label { id: titleLabel anchors.top: parent.top @@ -24,7 +24,6 @@ Item text: catalog.i18nc("@label", "Release Notes") color: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("huge") - renderType: Text.NativeRendering } Cura.ScrollableTextArea @@ -38,8 +37,6 @@ Item anchors.left: parent.left anchors.right: parent.right - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - textArea.text: CuraApplication.getTextManager().getChangeLogText() textArea.textFormat: Text.RichText textArea.wrapMode: Text.WordWrap diff --git a/resources/qml/WelcomePages/DropDownHeader.qml b/resources/qml/WelcomePages/DropDownHeader.qml index cb41ca808b..a4b416b093 100644 --- a/resources/qml/WelcomePages/DropDownHeader.qml +++ b/resources/qml/WelcomePages/DropDownHeader.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura import ".." @@ -46,16 +46,14 @@ Cura.RoundedRectangle onClicked: base.clicked() } - Label + UM.Label { id: title anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter - verticalAlignment: Text.AlignVCenter text: base.title font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering color: base.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") } diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index dde1be752b..90e1900d35 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2019 Ultimaker B.V. +// 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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -61,7 +61,7 @@ Item anchors.left: header.left anchors.right: header.right // Add 2x lining, because it needs a bit of space on the top and the bottom. - height: contentLoader.item.height + 2 * UM.Theme.getSize("thick_lining").height + height: contentLoader.item ? contentLoader.item.height + 2 * UM.Theme.getSize("thick_lining").height : 0 border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") @@ -88,14 +88,12 @@ Item { id: emptyComponent - Label + UM.Label { text: catalog.i18nc("@label", "Empty") height: UM.Theme.getSize("action_button").height horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering } } } diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 764ef03e18..dcff613efb 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura // @@ -14,7 +14,7 @@ Item { UM.I18nCatalog { id: catalog; name: "cura" } - Label + UM.Label { id: titleLabel anchors.top: parent.top @@ -23,10 +23,9 @@ Item text: catalog.i18nc("@label", "User Agreement") color: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("huge") - renderType: Text.NativeRendering } - Label + UM.Label { id: disclaimerLineLabel anchors @@ -44,8 +43,6 @@ Item textFormat: Text.RichText wrapMode: Text.WordWrap font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } Cura.PrimaryButton diff --git a/resources/qml/WelcomePages/WhatsNewContent.qml b/resources/qml/WelcomePages/WhatsNewContent.qml index 179fc372c9..c56f8880ed 100644 --- a/resources/qml/WelcomePages/WhatsNewContent.qml +++ b/resources/qml/WelcomePages/WhatsNewContent.qml @@ -113,8 +113,6 @@ Item right: subpageImage.right } - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - back_color: UM.Theme.getColor("viewport_overlay") do_borders: false diff --git a/resources/qml/Widgets/ComboBox.qml b/resources/qml/Widgets/ComboBox.qml index 36288f0f4f..f84772e609 100644 --- a/resources/qml/Widgets/ComboBox.qml +++ b/resources/qml/Widgets/ComboBox.qml @@ -1,10 +1,10 @@ -// Copyright (c) 2019 Ultimaker B.V. +// 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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -26,29 +26,18 @@ ComboBox { name: "disabled" when: !control.enabled - PropertyChanges { target: backgroundRectangle.border; color: UM.Theme.getColor("setting_control_disabled_border")} - PropertyChanges { target: backgroundRectangle; color: UM.Theme.getColor("setting_control_disabled")} + PropertyChanges { target: background; color: UM.Theme.getColor("setting_control_disabled")} PropertyChanges { target: contentLabel; color: UM.Theme.getColor("setting_control_disabled_text")} }, State { name: "highlighted" when: control.hovered || control.activeFocus - PropertyChanges { target: backgroundRectangle.border; color: UM.Theme.getColor("setting_control_border_highlight") } - PropertyChanges { target: backgroundRectangle; color: UM.Theme.getColor("setting_control_highlight")} + PropertyChanges { target: background; liningColor: UM.Theme.getColor("border_main_light")} } ] - background: Rectangle - { - id: backgroundRectangle - color: UM.Theme.getColor("setting_control") - - radius: UM.Theme.getSize("setting_control_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("setting_control_border") - - } + background: UM.UnderlineBackground{} indicator: UM.RecolorImage { @@ -65,14 +54,14 @@ ComboBox color: UM.Theme.getColor("setting_control_button") } - contentItem: Label + contentItem: UM.Label { id: contentLabel anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.verticalCenter: parent.verticalCenter anchors.right: downArrow.left - + wrapMode: Text.NoWrap text: { if (control.delegateModel.count == 0) @@ -86,11 +75,8 @@ ComboBox } textFormat: Text.PlainText - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") color: control.currentIndex == -1 ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter } popup: Popup @@ -103,12 +89,12 @@ ComboBox contentItem: ListView { - clip: true implicitHeight: contentHeight + + ScrollBar.vertical: UM.ScrollBar {} + clip: true model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex - - ScrollIndicator.vertical: ScrollIndicator { } } background: Rectangle @@ -140,7 +126,7 @@ ComboBox return (typeof _val !== 'undefined') ? _val : "" } - contentItem: Label + contentItem: UM.Label { id: delegateLabel // FIXME: Somehow the top/bottom anchoring is not correct on Linux and it results in invisible texts. @@ -150,11 +136,9 @@ ComboBox text: delegateItem.text textFormat: Text.PlainText - renderType: Text.NativeRendering color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter + wrapMode: Text.NoWrap } background: UM.TooltipArea @@ -162,7 +146,6 @@ ComboBox Rectangle { color: delegateItem.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" - border.color: delegateItem.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" anchors.fill: parent } text: delegateLabel.truncated ? delegateItem.text : "" diff --git a/resources/qml/Widgets/Menu.qml b/resources/qml/Widgets/Menu.qml index 1c6a55c28a..b3cdfc6967 100644 --- a/resources/qml/Widgets/Menu.qml +++ b/resources/qml/Widgets/Menu.qml @@ -2,23 +2,26 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 -import QtQuick.Controls 2.3 -import UM 1.1 as UM +import UM 1.5 as UM +import Cura 1.0 as Cura // // Menu with Cura styling. // -Menu +UM.Menu { id: menu + topPadding: UM.Theme.getSize("narrow_margin").height + bottomPadding: UM.Theme.getSize("narrow_margin").height padding: 0 - implicitWidth: UM.Theme.getSize("setting_control").width - width: Math.max.apply(Math, Object.values(contentChildren).map(function(c) { return c.width })) + implicitWidth: UM.Theme.getSize("menu").width - background: Rectangle { - color: UM.Theme.getColor("setting_control") - border.color: UM.Theme.getColor("setting_control_border") + delegate: Cura.MenuItem {} + background: Rectangle + { + color: UM.Theme.getColor("main_background") + border.color: UM.Theme.getColor("lining") } } \ No newline at end of file diff --git a/resources/qml/Widgets/MenuItem.qml b/resources/qml/Widgets/MenuItem.qml index 96869f028f..36098e1197 100644 --- a/resources/qml/Widgets/MenuItem.qml +++ b/resources/qml/Widgets/MenuItem.qml @@ -4,16 +4,17 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 -import UM 1.1 as UM +import UM 1.5 as UM // // MenuItem with Cura styling. // -MenuItem +UM.MenuItem { id: menuItem - implicitHeight: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("narrow_margin").height + implicitHeight: UM.Theme.getSize("menu").height + UM.Theme.getSize("narrow_margin").height + implicitWidth: UM.Theme.getSize("menu").width opacity: enabled ? 1.0 : 0.5 arrow: UM.RecolorImage @@ -41,26 +42,12 @@ MenuItem color: UM.Theme.getColor("setting_control_text") } - contentItem: Text { - leftPadding: menuItem.checkable ? menuItem.indicator.width + UM.Theme.getSize("default_margin").width : UM.Theme.getSize("thin_margin").width - rightPadding: menuItem.subMenu ? menuItem.arrow.width + UM.Theme.getSize("default_margin").width : UM.Theme.getSize("thin_margin").width - text: menuItem.text - - textFormat: Text.PlainText - renderType: Text.NativeRendering - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - background: Rectangle { + background: Rectangle + { x: UM.Theme.getSize("default_lining").width y: UM.Theme.getSize("default_lining").width width: menuItem.width - 2 * UM.Theme.getSize("default_lining").width height: menuItem.height - 2 * UM.Theme.getSize("default_lining").height - - color: menuItem.highlighted ? UM.Theme.getColor("setting_control_highlight") : "transparent" - border.color: menuItem.highlighted ? UM.Theme.getColor("setting_control_border_highlight") : "transparent" + color: menuItem.highlighted ? UM.Theme.getColor("background_2"): UM.Theme.getColor("background_1") } } \ No newline at end of file diff --git a/resources/qml/Widgets/MenuSeparator.qml b/resources/qml/Widgets/MenuSeparator.qml index cfc696fbb3..ad79fccd6d 100644 --- a/resources/qml/Widgets/MenuSeparator.qml +++ b/resources/qml/Widgets/MenuSeparator.qml @@ -11,9 +11,10 @@ import UM 1.1 as UM // MenuSeparator { - padding: 0 - - contentItem: Rectangle { + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + contentItem: Rectangle + { implicitHeight: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("setting_control_border") } diff --git a/resources/qml/Widgets/NotificationIcon.qml b/resources/qml/Widgets/NotificationIcon.qml index 5cf4d17777..7ef44559b6 100644 --- a/resources/qml/Widgets/NotificationIcon.qml +++ b/resources/qml/Widgets/NotificationIcon.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.4 as UM +import UM 1.5 as UM // @@ -22,15 +22,12 @@ Rectangle property alias labelText: notificationLabel.text property alias labelFont: notificationLabel.font - Label + UM.Label { id: notificationLabel anchors.fill: parent color: UM.Theme.getColor("primary_text") horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font: UM.Theme.getFont("default") - renderType: Text.NativeRendering // This is a bit of a hack, but we don't really have enough room for 2 characters (eg 9+). The default font // does have a tad bit to much spacing. So instead of adding a whole new font, we just modify it a bit for this diff --git a/resources/qml/Widgets/RadioButton.qml b/resources/qml/Widgets/RadioButton.qml index 13aee7ba90..428eb8a4e5 100644 --- a/resources/qml/Widgets/RadioButton.qml +++ b/resources/qml/Widgets/RadioButton.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.0 as Cura @@ -17,6 +17,31 @@ RadioButton font: UM.Theme.getFont("default") + states: [ + State { + name: "checked" + when: radioButton.checked + PropertyChanges + { + target: indicator + color: UM.Theme.getColor("accent_1") + border.width: 0 + } + }, + State + { + name: "disabled" + when: !radioButton.enabled + PropertyChanges { target: indicator; color: UM.Theme.getColor("background_1")} + }, + State + { + name: "highlighted" + when: radioButton.hovered || radioButton.activeFocus + PropertyChanges { target: indicator; border.color: UM.Theme.getColor("border_main_light")} + } + ] + background: Item { anchors.fill: parent @@ -29,8 +54,9 @@ RadioButton anchors.verticalCenter: parent.verticalCenter anchors.alignWhenCentered: false radius: width / 2 + color: UM.Theme.getColor("background_2") border.width: UM.Theme.getSize("default_lining").width - border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover") + border.color: UM.Theme.getColor("text_disabled") Rectangle { @@ -38,18 +64,15 @@ RadioButton height: width anchors.centerIn: parent radius: width / 2 - color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button") + color: radioButton.enabled ? UM.Theme.getColor("background_2") : UM.Theme.getColor("background_1") visible: radioButton.checked } } - contentItem: Label + contentItem: UM.Label { - verticalAlignment: Text.AlignVCenter leftPadding: radioButton.indicator.width + radioButton.spacing text: radioButton.text font: radioButton.font - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering } } diff --git a/resources/qml/Widgets/ScrollableTextArea.qml b/resources/qml/Widgets/ScrollableTextArea.qml index 6becf75cb1..7d8f6b886d 100644 --- a/resources/qml/Widgets/ScrollableTextArea.qml +++ b/resources/qml/Widgets/ScrollableTextArea.qml @@ -1,35 +1,39 @@ -// Copyright (c) 2019 Ultimaker B.V. +// 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 UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura // // Cura-style TextArea with scrolls // -ScrollView +Flickable { - property alias textArea: _textArea - + id: scrollableTextAreaBase + property bool do_borders: true property var back_color: UM.Theme.getColor("main_background") - property var do_borders: true + property alias textArea: flickableTextArea - clip: true + ScrollBar.vertical: UM.ScrollBar {} - background: Rectangle // Border + TextArea.flickable: TextArea { - color: back_color - border.color: UM.Theme.getColor("thick_lining") - border.width: do_borders ? UM.Theme.getSize("default_lining").width : 0 - } + id: flickableTextArea + + background: Rectangle //Providing the background color and border. + { + anchors.fill: parent + anchors.margins: -border.width + + color: scrollableTextAreaBase.back_color + border.color: UM.Theme.getColor("thick_lining") + border.width: scrollableTextAreaBase.do_borders ? UM.Theme.getSize("default_lining").width : 0 + } - TextArea - { - id: _textArea font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") textFormat: TextEdit.PlainText @@ -37,4 +41,4 @@ ScrollView wrapMode: Text.Wrap selectByMouse: true } -} +} \ No newline at end of file diff --git a/resources/qml/Widgets/TextField.qml b/resources/qml/Widgets/TextField.qml index c126c8a6e0..7803c17396 100644 --- a/resources/qml/Widgets/TextField.qml +++ b/resources/qml/Widgets/TextField.qml @@ -4,7 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import UM 1.3 as UM +import UM 1.5 as UM import Cura 1.1 as Cura @@ -17,13 +17,14 @@ TextField property alias leftIcon: iconLeft.source - UM.I18nCatalog { id: catalog; name: "cura" } + height: UM.Theme.getSize("setting_control").height hoverEnabled: true selectByMouse: true font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") 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 states: [ @@ -31,45 +32,25 @@ TextField { name: "disabled" when: !textField.enabled - PropertyChanges { target: backgroundRectangle.border; color: UM.Theme.getColor("setting_control_disabled_border")} PropertyChanges { target: backgroundRectangle; color: UM.Theme.getColor("setting_control_disabled")} }, State { name: "invalid" when: !textField.acceptableInput - PropertyChanges { target: backgroundRectangle.border; color: UM.Theme.getColor("setting_validation_error")} PropertyChanges { target: backgroundRectangle; color: UM.Theme.getColor("setting_validation_error_background")} }, State { name: "hovered" when: textField.hovered || textField.activeFocus - PropertyChanges { target: backgroundRectangle.border; color: UM.Theme.getColor("setting_control_border_highlight") } + PropertyChanges { target: backgroundRectangle; liningColor: UM.Theme.getColor("border_main_light")} } ] - background: Rectangle + background: UM.UnderlineBackground { id: backgroundRectangle - - color: UM.Theme.getColor("main_background") - - radius: UM.Theme.getSize("setting_control_radius").width - - border.color: - { - if (!textField.enabled) - { - return UM.Theme.getColor("setting_control_disabled_border") - } - if (textField.hovered || textField.activeFocus) - { - return UM.Theme.getColor("setting_control_border_highlight") - } - return UM.Theme.getColor("setting_control_border") - } - //Optional icon added on the left hand side. UM.RecolorImage { diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 52d2df75ab..8ddacc56e4 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -4,6 +4,7 @@ MachineSelector 1.0 MachineSelector.qml MachineSelectorButton 1.0 MachineSelectorButton.qml CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml PrintSetupSelector 1.0 PrintSetupSelector.qml +ProfileOverview 1.6 ProfileOverview.qml ActionButton 1.0 ActionButton.qml MaterialMenu 1.0 MaterialMenu.qml NozzleMenu 1.0 NozzleMenu.qml @@ -46,3 +47,4 @@ GcodeTextArea 1.0 GcodeTextArea.qml NumericTextFieldWithUnit 1.0 NumericTextFieldWithUnit.qml PrintHeadMinMaxTextField 1.0 PrintHeadMinMaxTextField.qml SimpleCheckBox 1.0 SimpleCheckBox.qml +RenameDialog 1.0 RenameDialog.qml diff --git a/resources/themes/cura-dark-colorblind/theme.json b/resources/themes/cura-dark-colorblind/theme.json index c98fb0c815..4a006ee836 100644 --- a/resources/themes/cura-dark-colorblind/theme.json +++ b/resources/themes/cura-dark-colorblind/theme.json @@ -8,12 +8,8 @@ "x_axis": [212, 0, 0, 255], "y_axis": [64, 64, 255, 255], - "model_default": [156, 201, 36, 255], "model_overhang": [200, 0, 255, 255], - - "xray_error_dark": [255, 0, 0, 255], - "xray_error_light": [255, 255, 0, 255], "xray": [26, 26, 62, 255], "xray_error": [255, 0, 0, 255], diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 2956e3f809..8f45471344 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -4,47 +4,72 @@ "inherits": "cura-light" }, + "base_colors": + { + "background_1": [31, 31, 32, 255], + "background_2": [57, 57, 58, 255], + "background_3": [85, 85, 87, 255], + "background_4": [23, 23, 23, 255], + + "accent_1": [25, 110, 240, 255], + "accent_2": [16, 70, 156, 255], + "border_main": [212, 212, 212, 255], + "border_accent_1": [255, 255, 255, 255], + "border_accent_2": [16, 70, 156, 255], + "border_field": [57, 57, 58, 255], + + "text_default": [255, 255, 255, 255], + "text_disabled": [118, 118, 118, 255], + "text_primary_button": [255, 255, 255, 255], + "text_secondary_button": [255, 255, 255, 255], + "text_link_hover": [156, 195, 255, 255], + "text_lighter": [243, 243, 243, 255] + }, + "colors": { - "main_background": [39, 44, 48, 255], - "detail_background": [63, 63, 63, 255], - "message_background": [39, 44, 48, 255], + "main_background": "background_1", + "detail_background": "background_2", + "message_background": "background_1", "wide_lining": [31, 36, 39, 255], "thick_lining": [255, 255, 255, 60], - "lining": [64, 69, 72, 255], - "viewport_overlay": [30, 36, 39, 255], + "lining": "border_main", + "viewport_overlay": "background_1", "primary": [12, 169, 227, 255], - "primary_text": [255, 255, 255, 204], + "primary_text": "text_default", "secondary": [95, 95, 95, 255], - "secondary_button": [39, 44, 48, 255], - "secondary_button_hover": [85, 85, 87, 255], + "expandable_active": "background_2", + "expandable_hover": "background_2", + + "secondary_button": "background_1", + "secondary_button_hover": "background_3", "secondary_button_text": [255, 255, 255, 255], - "icon": [255, 255, 255, 255], - "toolbar_background": [39, 44, 48, 255], - "toolbar_button_active": [57, 57, 58, 255], - "toolbar_button_hover": [57, 57, 58, 255], - "toolbar_button_active_hover": [57, 57, 58, 255], + "icon": "text_default", + "toolbar_background": "background_1", + "toolbar_button_active": "background_3", + "toolbar_button_hover": "background_3", + "toolbar_button_active_hover": "background_3", - "main_window_header_button_text_inactive": [128, 128, 128, 255], - "main_window_header_background": [14, 14, 14, 255], - "main_window_header_background_gradient": [32, 32, 32, 255], + "main_window_header_button_background_inactive": "background_4", + "main_window_header_button_text_inactive": "text_primary_button", + "main_window_header_button_text_active": "background_4", + "main_window_header_background": "background_4", + "main_window_header_background_gradient": "background_4", "main_window_header_button_background_hovered": [46, 46, 46, 255], + "secondary_button_text": "text_secondary_button", + "account_sync_state_icon": [255, 255, 255, 204], - "machine_selector_bar": [39, 44, 48, 255], - "machine_selector_active": [39, 44, 48, 255], "machine_selector_printer_icon": [204, 204, 204, 255], - "text": [255, 255, 255, 204], + "text": "text_default", "text_detail": [255, 255, 255, 172], - "text_link": [25, 110, 240, 255], + "text_link": "accent_1", "text_inactive": [255, 255, 255, 88], "text_hover": [255, 255, 255, 204], - "text_pressed": [255, 255, 255, 204], - "text_subtext": [255, 255, 255, 172], "text_scene": [255, 255, 255, 162], "text_scene_hover": [255, 255, 255, 204], @@ -55,22 +80,14 @@ "button": [39, 44, 48, 255], "button_hover": [39, 44, 48, 255], - "button_active": [67, 72, 75, 255], - "button_active_hover": [67, 72, 75, 255], - "button_text": [255, 255, 255, 197], + "button_text": "text_default", "button_disabled": [39, 44, 48, 255], "button_disabled_text": [255, 255, 255, 101], - "small_button": [39, 44, 48, 0], - "small_button_hover": [39, 44, 48, 255], - "small_button_active": [67, 72, 75, 255], - "small_button_active_hover": [67, 72, 75, 255], "small_button_text": [255, 255, 255, 197], "small_button_text_hover": [255, 255, 255, 255], "button_tooltip": [39, 44, 48, 255], - "button_tooltip_border": [39, 44, 48, 255], - "button_tooltip_text": [255, 255, 255, 172], "tab_checked": [39, 44, 48, 255], "tab_checked_border": [255, 255, 255, 30], @@ -86,17 +103,17 @@ "tab_active_text": [255, 255, 255, 255], "tab_background": [39, 44, 48, 255], - "action_button": [39, 44, 48, 255], + "action_button": "background_1", "action_button_text": [255, 255, 255, 200], - "action_button_border": [255, 255, 255, 30], + "action_button_border": "border_main", "action_button_hovered": [79, 85, 89, 255], - "action_button_hovered_text": [255, 255, 255, 255], - "action_button_hovered_border": [255, 255, 255, 30], + "action_button_hovered_text": "text_default", + "action_button_hovered_border": "border_main", "action_button_active": [39, 44, 48, 30], - "action_button_active_text": [255, 255, 255, 255], + "action_button_active_text": "text_default", "action_button_active_border": [255, 255, 255, 100], - "action_button_disabled": [85, 85, 87, 255], - "action_button_disabled_text": [103, 103, 104, 255], + "action_button_disabled": "background_3", + "action_button_disabled_text": "text_disabled", "action_button_disabled_border": [255, 255, 255, 30], "scrollbar_background": [39, 44, 48, 0], @@ -104,28 +121,19 @@ "scrollbar_handle_hover": [255, 255, 255, 255], "scrollbar_handle_down": [255, 255, 255, 255], - "setting_category": [75, 80, 83, 255], + "setting_category": "background_3", "setting_category_disabled": [75, 80, 83, 255], - "setting_category_hover": [75, 80, 83, 255], - "setting_category_active": [75, 80, 83, 255], - "setting_category_active_hover": [75, 80, 83, 255], + "setting_category_hover": "background_3", "setting_category_text": [255, 255, 255, 152], "setting_category_disabled_text": [255, 255, 255, 101], - "setting_category_hover_text": [255, 255, 255, 204], "setting_category_active_text": [255, 255, 255, 204], - "setting_category_active_hover_text": [255, 255, 255, 204], - "setting_category_border": [39, 44, 48, 0], - "setting_category_disabled_border": [39, 44, 48, 0], - "setting_category_hover_border": [12, 169, 227, 255], - "setting_category_active_border": [39, 44, 48, 0], - "setting_category_active_hover_border": [12, 169, 227, 255], - "setting_control": [43, 48, 52, 255], + "setting_control": "background_2", "setting_control_selected": [34, 39, 42, 38], - "setting_control_highlight": [43, 48, 52, 255], + "setting_control_highlight": "background_3", "setting_control_border": [255, 255, 255, 38], "setting_control_border_highlight": [12, 169, 227, 255], - "setting_control_text": [255, 255, 255, 181], + "setting_control_text": "text_default", "setting_control_button": [255, 255, 255, 127], "setting_control_button_hover": [255, 255, 255, 204], "setting_control_disabled": [34, 39, 42, 255], @@ -136,7 +144,7 @@ "setting_validation_error": [212, 31, 53, 255], "setting_validation_warning_background": [62, 54, 46, 255], "setting_validation_warning": [245, 166, 35, 255], - "setting_validation_ok": [43, 48, 52, 255], + "setting_validation_ok": "background_2", "progressbar_background": [255, 255, 255, 48], "progressbar_control": [255, 255, 255, 197], @@ -147,22 +155,23 @@ "slider_handle": [255, 255, 255, 255], "slider_handle_active": [68, 192, 255, 255], - "checkbox": [43, 48, 52, 255], + "checkbox": "background_1", "checkbox_hover": [43, 48, 52, 255], - "checkbox_border": [255, 255, 255, 38], - "checkbox_border_hover": [255, 255, 255, 38], - "checkbox_mark": [255, 255, 255, 181], - "checkbox_square": [118, 118, 118, 255], - "checkbox_text": [255, 255, 255, 181], + "checkbox_border": "text_disabled", + "checkbox_border_hover": "border_main", + "checkbox_mark": "text_default", + "checkbox_square": "text_disabled", + "checkbox_text": "text_default", + "checkbox_disabled": "background_2", - "tooltip": [39, 44, 48, 255], - "tooltip_text": [255, 255, 255, 204], + "category_background": "background_3", - "tool_panel_background": [39, 44, 48, 255], + "tooltip": "background_2", + "tooltip_text": "text_default", - "tool_button_border": [255, 255, 255, 38], + "tool_panel_background": "background_1", - "viewport_background": [31, 36, 39, 255], + "viewport_background": "background_1", "volume_outline": [12, 169, 227, 128], "buildplate": [169, 169, 169, 255], "buildplate_grid_minor": [154, 154, 155, 255], @@ -182,16 +191,12 @@ "monitor_icon_disabled": [102, 102, 102, 255], "monitor_secondary_button_hover": [80, 80, 80, 255], - "monitor_secondary_button": [92, 92, 92, 255], - "monitor_secondary_button_text": [250, 250, 250, 255], - "monitor_secondary_button_shadow": [74, 74, 74, 255], - "monitor_card_border": [102, 102, 102, 255], "monitor_card_background": [51, 53, 54, 255], "monitor_card_hover": [84, 89, 95, 255], - "monitor_stage_background": [30, 36, 39, 255], - "monitor_stage_background_fade": [30, 36, 39, 102], + "monitor_stage_background": "background_1", + "monitor_stage_background_fade": "background_1", "monitor_progress_bar_deactive": [102, 102, 102, 255], "monitor_progress_bar_empty": [67, 67, 67, 255], diff --git a/resources/themes/cura-light-colorblind/theme.json b/resources/themes/cura-light-colorblind/theme.json index 5628fad880..740bf977b2 100644 --- a/resources/themes/cura-light-colorblind/theme.json +++ b/resources/themes/cura-light-colorblind/theme.json @@ -8,7 +8,6 @@ "x_axis": [200, 0, 0, 255], "y_axis": [64, 64, 255, 255], - "model_default": [156, 201, 36, 255], "model_overhang": [200, 0, 255, 255], "model_selection_outline": [12, 169, 227, 255], diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml deleted file mode 100755 index e497215c0c..0000000000 --- a/resources/themes/cura-light/styles.qml +++ /dev/null @@ -1,753 +0,0 @@ -// Copyright (c) 2021 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.10 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 - -import UM 1.1 as UM - -QtObject -{ - property Component print_setup_header_button: Component - { - ButtonStyle - { - background: Rectangle - { - color: - { - if(control.enabled) - { - if(control.valueError) - { - return UM.Theme.getColor("setting_validation_error_background"); - } - else if(control.valueWarning) - { - return UM.Theme.getColor("setting_validation_warning_background"); - } - else - { - return UM.Theme.getColor("setting_control"); - } - } - else - { - return UM.Theme.getColor("setting_control_disabled"); - } - } - - radius: UM.Theme.getSize("setting_control_radius").width - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if (control.enabled) - { - if (control.valueError) - { - return UM.Theme.getColor("setting_validation_error"); - } - else if (control.valueWarning) - { - return UM.Theme.getColor("setting_validation_warning"); - } - else if (control.hovered) - { - return UM.Theme.getColor("setting_control_border_highlight"); - } - else - { - return UM.Theme.getColor("setting_control_border"); - } - } - else - { - return UM.Theme.getColor("setting_control_disabled_border"); - } - } - UM.RecolorImage - { - id: downArrow - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.height: width - color: control.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text") - source: UM.Theme.getIcon("ChevronSingleDown") - } - Label - { - id: printSetupComboBoxLabel - color: control.enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - text: control.text; - elide: Text.ElideRight; - anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width - anchors.right: downArrow.left; - anchors.rightMargin: control.rightMargin; - anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("default") - } - } - label: Label{} - } - } - - property Component main_window_header_tab: Component - { - ButtonStyle - { - // This property will be back-propagated when the width of the label is calculated - property var buttonWidth: 0 - - background: Rectangle - { - id: backgroundRectangle - implicitHeight: control.height - implicitWidth: buttonWidth - radius: UM.Theme.getSize("action_button_radius").width - - color: - { - if (control.checked) - { - return UM.Theme.getColor("main_window_header_button_background_active") - } - else - { - if (control.hovered) - { - return UM.Theme.getColor("main_window_header_button_background_hovered") - } - return UM.Theme.getColor("main_window_header_button_background_inactive") - } - } - - } - - label: Item - { - id: contents - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - height: control.height - width: buttonLabel.width + 4 * UM.Theme.getSize("default_margin").width - - Label - { - id: buttonLabel - text: control.text - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - font: UM.Theme.getFont("medium") - color: - { - if (control.checked) - { - return UM.Theme.getColor("main_window_header_button_text_active") - } - else - { - if (control.hovered) - { - return UM.Theme.getColor("main_window_header_button_text_hovered") - } - return UM.Theme.getColor("main_window_header_button_text_inactive") - } - } - } - Component.onCompleted: - { - buttonWidth = width - } - } - - - } - } - - property Component tool_button: Component - { - ButtonStyle - { - background: Item - { - implicitWidth: UM.Theme.getSize("button").width - implicitHeight: UM.Theme.getSize("button").height - - UM.PointingRectangle - { - id: button_tooltip - - anchors.left: parent.right - anchors.leftMargin: UM.Theme.getSize("button_tooltip_arrow").width * 2 - anchors.verticalCenter: parent.verticalCenter - - target: Qt.point(parent.x, y + Math.round(height/2)) - arrowSize: UM.Theme.getSize("button_tooltip_arrow").width - color: UM.Theme.getColor("button_tooltip") - opacity: control.hovered ? 1.0 : 0.0; - visible: control.text != "" - - width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0 - height: UM.Theme.getSize("button_tooltip").height - - Behavior on width { NumberAnimation { duration: 100; } } - Behavior on opacity { NumberAnimation { duration: 100; } } - - Label - { - id: button_tip - - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - text: control.text - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("tooltip_text") - } - } - - Rectangle - { - id: buttonFace - - anchors.fill: parent - property bool down: control.pressed || (control.checkable && control.checked) - - color: - { - if(control.customColor !== undefined && control.customColor !== null) - { - return control.customColor - } - else if(control.checkable && control.checked && control.hovered) - { - return UM.Theme.getColor("toolbar_button_active_hover") - } - else if(control.pressed || (control.checkable && control.checked)) - { - return UM.Theme.getColor("toolbar_button_active") - } - else if(control.hovered) - { - return UM.Theme.getColor("toolbar_button_hover") - } - return UM.Theme.getColor("toolbar_background") - } - Behavior on color { ColorAnimation { duration: 50; } } - - border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? UM.Theme.getSize("default_lining").width : 0 - border.color: control.checked ? UM.Theme.getColor("icon") : UM.Theme.getColor("lining") - } - } - - label: Item - { - UM.RecolorImage - { - anchors.centerIn: parent - opacity: control.enabled ? 1.0 : 0.2 - source: control.iconSource - width: UM.Theme.getSize("medium_button_icon").width - height: UM.Theme.getSize("medium_button_icon").height - color: UM.Theme.getColor("icon") - - sourceSize: UM.Theme.getSize("medium_button_icon") - } - } - } - } - - property Component progressbar: Component - { - ProgressBarStyle - { - background: Rectangle - { - implicitWidth: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2) - implicitHeight: UM.Theme.getSize("progressbar").height - color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : UM.Theme.getColor("progressbar_background") - radius: UM.Theme.getSize("progressbar_radius").width - } - progress: Rectangle - { - color: - { - if(control.indeterminate) - { - return "transparent"; - } - else if(control.hasOwnProperty("controlColor")) - { - return control.controlColor; - } - else - { - return UM.Theme.getColor("progressbar_control"); - } - } - radius: UM.Theme.getSize("progressbar_radius").width - Rectangle - { - radius: UM.Theme.getSize("progressbar_radius").width - color: control.hasOwnProperty("controlColor") ? control.controlColor : UM.Theme.getColor("progressbar_control") - width: UM.Theme.getSize("progressbar_control").width - height: UM.Theme.getSize("progressbar_control").height - visible: control.indeterminate - - SequentialAnimation on x - { - id: xAnim - property int animEndPoint: UM.Theme.getSize("message").width - Math.round((UM.Theme.getSize("default_margin").width * 2.5)) - UM.Theme.getSize("progressbar_control").width - running: control.indeterminate && control.visible - loops: Animation.Infinite - NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;} - NumberAnimation { from: xAnim.animEndPoint; to: 0; duration: 2000;} - } - } - } - } - } - - property Component scrollview: Component - { - ScrollViewStyle - { - decrementControl: Item { } - incrementControl: Item { } - - transientScrollBars: false - - scrollBarBackground: Rectangle - { - implicitWidth: UM.Theme.getSize("scrollbar").width - radius: Math.round(implicitWidth / 2) - color: UM.Theme.getColor("scrollbar_background") - } - - handle: Rectangle - { - id: scrollViewHandle - implicitWidth: UM.Theme.getSize("scrollbar").width - radius: Math.round(implicitWidth / 2) - - color: styleData.pressed ? UM.Theme.getColor("scrollbar_handle_down") : styleData.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.Theme.getColor("scrollbar_handle") - Behavior on color { ColorAnimation { duration: 50; } } - } - } - } - - property Component combobox: Component - { - ComboBoxStyle - { - - background: Rectangle - { - implicitHeight: UM.Theme.getSize("setting_control").height; - implicitWidth: UM.Theme.getSize("setting_control").width; - - color: control.hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control") - Behavior on color { ColorAnimation { duration: 50; } } - - border.width: UM.Theme.getSize("default_lining").width; - border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border"); - radius: UM.Theme.getSize("setting_control_radius").width - } - - label: Item - { - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_lining").width - anchors.right: downArrow.left - anchors.rightMargin: UM.Theme.getSize("default_lining").width - anchors.verticalCenter: parent.verticalCenter - - text: control.currentText - font: UM.Theme.getFont("default"); - color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") - - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - UM.RecolorImage - { - id: downArrow - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.verticalCenter: parent.verticalCenter - - source: UM.Theme.getIcon("ChevronSingleDown") - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width + 5 * screenScaleFactor - sourceSize.height: width + 5 * screenScaleFactor - - color: UM.Theme.getColor("setting_control_button"); - } - } - } - } - - property Component checkbox: Component - { - CheckBoxStyle - { - background: Item { } - indicator: Rectangle - { - implicitWidth: UM.Theme.getSize("checkbox").width - implicitHeight: UM.Theme.getSize("checkbox").height - - color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_hover") : (control.enabled ? UM.Theme.getColor("checkbox") : UM.Theme.getColor("checkbox_disabled")) - Behavior on color { ColorAnimation { duration: 50; } } - anchors.verticalCenter: parent.verticalCenter - radius: control.exclusiveGroup ? Math.round(UM.Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width - - border.width: UM.Theme.getSize("default_lining").width - border.color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border") - - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - height: UM.Theme.getSize("checkbox_mark").height - width: UM.Theme.getSize("checkbox_mark").width - sourceSize.height: width - color: UM.Theme.getColor("checkbox_mark") - source: control.exclusiveGroup ? UM.Theme.getIcon("Dot") : UM.Theme.getIcon("Check", "low") - opacity: control.checked - Behavior on opacity { NumberAnimation { duration: 100; } } - } - } - label: Label - { - text: control.text - color: UM.Theme.getColor("checkbox_text") - font: UM.Theme.getFont("default") - elide: Text.ElideRight - renderType: Text.NativeRendering - } - } - } - - property Component partially_checkbox: Component - { - CheckBoxStyle - { - background: Item { } - indicator: Rectangle - { - implicitWidth: UM.Theme.getSize("checkbox").width - implicitHeight: UM.Theme.getSize("checkbox").height - - color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_hover") : UM.Theme.getColor("checkbox"); - Behavior on color { ColorAnimation { duration: 50; } } - - radius: control.exclusiveGroup ? Math.round(UM.Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width - - border.width: UM.Theme.getSize("default_lining").width; - border.color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border"); - - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - height: UM.Theme.getSize("checkbox_mark").height - width: UM.Theme.getSize("checkbox_mark").width - sourceSize.height: width - color: UM.Theme.getColor("checkbox_mark") - source: - { - if (control.checkbox_state == 2) - { - return UM.Theme.getIcon("Solid"); - } - else - { - return control.exclusiveGroup ? UM.Theme.getIcon("Dot", "low") : UM.Theme.getIcon("Check", "low"); - } - } - opacity: control.checked - Behavior on opacity { NumberAnimation { duration: 100; } } - } - } - label: Label - { - text: control.text - color: UM.Theme.getColor("checkbox_text") - font: UM.Theme.getFont("default") - } - } - } - - property Component text_field: Component - { - TextFieldStyle - { - textColor: UM.Theme.getColor("setting_control_text") - placeholderTextColor: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - - background: Rectangle - { - implicitHeight: control.height; - implicitWidth: control.width; - - border.width: UM.Theme.getSize("default_lining").width; - border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border"); - radius: UM.Theme.getSize("setting_control_radius").width - - color: UM.Theme.getColor("setting_validation_ok"); - - Label - { - anchors.right: parent.right; - anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width; - anchors.verticalCenter: parent.verticalCenter; - - text: control.unit ? control.unit : "" - color: UM.Theme.getColor("setting_unit"); - font: UM.Theme.getFont("default"); - renderType: Text.NativeRendering - } - } - } - } - - property Component print_setup_action_button: Component - { - ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - else - { - return UM.Theme.getColor("action_button_border"); - } - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - else - { - return UM.Theme.getColor("action_button"); - } - } - Behavior on color { ColorAnimation { duration: 50 } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - else - { - return UM.Theme.getColor("action_button_text"); - } - } - font: UM.Theme.getFont("medium") - text: control.text - } - } - label: Item { } - } - } - - property Component monitor_button_style: Component - { - ButtonStyle - { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - return UM.Theme.getColor("action_button_border"); - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - return UM.Theme.getColor("action_button"); - } - Behavior on color - { - ColorAnimation - { - duration: 50 - } - } - } - - label: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.floor(control.width / 2) - height: Math.floor(control.height / 2) - sourceSize.height: width - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if(control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - return UM.Theme.getColor("action_button_text"); - } - source: control.iconSource - } - } - } - } - - property Component monitor_checkable_button_style: Component - { - ButtonStyle { - background: Rectangle { - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_border"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active_border"); - } - else if(control.hovered) - { - return UM.Theme.getColor("action_button_hovered_border"); - } - return UM.Theme.getColor("action_button_border"); - } - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active"); - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered"); - } - return UM.Theme.getColor("action_button"); - } - Behavior on color { ColorAnimation { duration: 50; } } - Label { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - color: - { - if(!control.enabled) - { - return UM.Theme.getColor("action_button_disabled_text"); - } - else if (control.checked || control.pressed) - { - return UM.Theme.getColor("action_button_active_text"); - } - else if (control.hovered) - { - return UM.Theme.getColor("action_button_hovered_text"); - } - return UM.Theme.getColor("action_button_text"); - } - font: UM.Theme.getFont("default") - text: control.text - horizontalAlignment: Text.AlignHCenter - elide: Text.ElideMiddle - } - } - label: Item { } - } - } -} diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index b4ae944f45..ba18e5d0d2 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -170,34 +170,57 @@ } }, + "base_colors": { + "background_1": [255, 255, 255, 255], + "background_2": [243, 243, 243, 255], + "background_3": [232, 240, 253, 255], + "background_4": [3, 12, 66, 255], + + "accent_1": [25, 110, 240, 255], + "accent_2": [16, 70, 156, 255], + "border_main": [212, 212, 212, 255], + "border_accent_1": [25, 110, 240, 255], + "border_accent_2": [16, 70, 156, 255], + "border_field": [180, 180, 180, 255], + + "text_default": [0, 14, 26, 255], + "text_disabled": [180, 180, 180, 255], + "text_primary_button": [255, 255, 255, 255], + "text_secondary_button": [25, 110, 240, 255], + "text_link_hover": [16, 70, 156, 255], + "text_lighter": [108, 108, 108, 255] + }, + "colors": { - "main_background": [255, 255, 255, 255], - "detail_background": [243, 243, 243, 255], + "main_background": "background_1", + "detail_background": "background_2", "wide_lining": [245, 245, 245, 255], "thick_lining": [180, 180, 180, 255], "lining": [192, 193, 194, 255], "viewport_overlay": [246, 246, 246, 255], "primary": [25, 110, 240, 255], - "primary_shadow": [64, 47, 205, 255], "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], + "text_selection": [156, 195, 255, 127], "border": [127, 127, 127, 255], + "border_field": [180, 180, 180, 255], "secondary": [240, 240, 240, 255], - "secondary_shadow": [216, 216, 216, 255], + + "expandable_active": [240, 240, 240, 255], + "expandable_hover": [232, 242, 252, 255], "icon": [8, 7, 63, 255], - "primary_button": [25, 110, 240, 255], - "primary_button_shadow": [27, 95, 202, 255], + "primary_button": "accent_1", "primary_button_hover": [16, 70, 156, 255], "primary_button_text": [255, 255, 255, 255], - "secondary_button": [255, 255, 255, 255], + "secondary_button": "background_1", "secondary_button_shadow": [216, 216, 216, 255], "secondary_button_hover": [232, 240, 253, 255], - "secondary_button_text": [25, 110, 240, 255], + "secondary_button_text": "accent_1", "main_window_header_background": [8, 7, 63, 255], "main_window_header_background_gradient": [25, 23, 91, 255], @@ -211,13 +234,9 @@ "account_widget_outline_active": [70, 66, 126, 255], "account_sync_state_icon": [25, 25, 25, 255], - "machine_selector_bar": [31, 36, 39, 255], - "machine_selector_active": [68, 72, 75, 255], - "machine_selector_hover": [68, 72, 75, 255], - "machine_selector_text_active": [255, 255, 255, 255], "machine_selector_printer_icon": [8, 7, 63, 255], - "action_panel_secondary": [25, 110, 240, 255], + "action_panel_secondary": "accent_1", "first_run_shadow": [50, 50, 50, 255], @@ -230,13 +249,11 @@ "window_disabled_background": [0, 0, 0, 255], "text": [25, 25, 25, 255], + "text_disabled": [180, 180, 180, 255], "text_detail": [174, 174, 174, 128], "text_link": [25, 110, 240, 255], "text_inactive": [174, 174, 174, 255], - "text_pressed": [50, 130, 255, 255], - "text_subtext": [0, 0, 0, 255], "text_medium": [128, 128, 128, 255], - "text_emphasis": [255, 255, 255, 255], "text_scene": [102, 102, 102, 255], "text_scene_hover": [123, 123, 113, 255], @@ -249,50 +266,20 @@ "toolbar_button_active": [232, 242, 252, 255], "toolbar_button_active_hover": [232, 242, 252, 255], - "button": [31, 36, 39, 255], - "button_hover": [68, 72, 75, 255], - "button_active": [68, 72, 75, 255], - "button_active_hover": [68, 72, 75, 255], "button_text": [255, 255, 255, 255], - "button_text_hover": [255, 255, 255, 255], - "button_text_active": [255, 255, 255, 255], - "button_text_active_hover": [255, 255, 255, 255], - "small_button": [0, 0, 0, 0], - "small_button_hover": [102, 102, 102, 255], - "small_button_active": [10, 8, 80, 255], - "small_button_active_hover": [10, 8, 80, 255], "small_button_text": [102, 102, 102, 255], "small_button_text_hover": [8, 7, 63, 255], - "small_button_text_active": [255, 255, 255, 255], - "small_button_text_active_hover": [255, 255, 255, 255], "button_tooltip": [31, 36, 39, 255], - "button_tooltip_border": [68, 192, 255, 255], - "button_tooltip_text": [192, 193, 194, 255], - "extruder_button_material_border": [255, 255, 255, 255], "extruder_disabled": [255, 255, 255, 102], - "rating_star": [90, 90, 90, 255], - - "sync_button_text": [120, 120, 120, 255], - "sync_button_text_hovered": [0, 0, 0, 255], - "action_button": [255, 255, 255, 255], - "action_button_text": [0, 0, 0, 255], - "action_button_border": [127, 127, 127, 255], "action_button_hovered": [232, 242, 252, 255], - "action_button_hovered_text": [31, 36, 39, 255], - "action_button_hovered_border": [50, 130, 255, 255], - "action_button_active": [255, 255, 255, 255], - "action_button_active_text": [0, 0, 0, 255], - "action_button_active_border": [50, 130, 255, 255], "action_button_disabled": [245, 245, 245, 255], "action_button_disabled_text": [196, 196, 196, 255], - "action_button_disabled_border": [196, 196, 196, 255], "action_button_shadow": [223, 223, 223, 255], - "action_button_disabled_shadow": [228, 228, 228, 255], "scrollbar_background": [255, 255, 255, 255], "scrollbar_handle": [10, 8, 80, 255], @@ -302,22 +289,12 @@ "setting_category": [240, 240, 240, 255], "setting_category_disabled": [255, 255, 255, 255], "setting_category_hover": [232, 242, 252, 255], - "setting_category_active": [240, 240, 240, 255], - "setting_category_active_hover": [232, 242, 252, 255], "setting_category_text": [35, 35, 35, 255], "setting_category_disabled_text": [24, 41, 77, 101], "setting_category_active_text": [35, 35, 35, 255], - "setting_category_active_hover_text": [35, 35, 35, 255], - "setting_category_hover_text": [35, 35, 35, 255], - "setting_category_border": [240, 240, 240, 255], - "setting_category_disabled_border": [240, 240, 240, 255], - "setting_category_hover_border": [50, 130, 255, 255], - "setting_category_active_border": [50, 130, 255, 255], - "setting_category_active_hover_border": [50, 130, 255, 255], - "setting_control": [255, 255, 255, 255], - "setting_control_selected": [31, 36, 39, 255], - "setting_control_highlight": [255, 255, 255, 255], + "setting_control": "background_2", + "setting_control_highlight": "background_3", "setting_control_border": [199, 199, 199, 255], "setting_control_border_highlight": [50, 130, 255, 255], "setting_control_text": [35, 35, 35, 255], @@ -331,8 +308,7 @@ "setting_validation_error": [127, 127, 127, 255], "setting_validation_warning_background": [255, 145, 62, 255], "setting_validation_warning": [127, 127, 127, 255], - "setting_validation_ok": [255, 255, 255, 255], - "setting_filter_field" : [153, 153, 153, 255], + "setting_validation_ok": "background_2", "material_compatibility_warning": [243, 166, 59, 255], @@ -349,14 +325,15 @@ "quality_slider_available": [0, 0, 0, 255], "checkbox": [255, 255, 255, 255], - "checkbox_hover": [255, 255, 255, 255], + "checkbox_hover": "border_main", "checkbox_border": [180, 180, 180, 255], "checkbox_border_hover": [25, 110, 240, 255], "checkbox_mark": [35, 35, 35, 255], - "checkbox_square": [180, 180, 180, 255], - "checkbox_disabled": [223, 223, 223, 255], + "checkbox_disabled": "background_2", "checkbox_text": [0, 12, 26, 255], + "category_background": "background_2", + "tooltip": [25, 25, 25, 255], "tooltip_text": [255, 255, 255, 255], @@ -377,7 +354,6 @@ "status_busy": [50, 130, 255, 255], "status_paused": [255, 140, 0, 255], "status_stopped": [236, 82, 80, 255], - "status_unknown": [127, 127, 127, 255], "disabled_axis": [127, 127, 127, 255], "x_axis": [218, 30, 40, 255], @@ -395,17 +371,13 @@ "disallowed_area": [0, 0, 0, 40], "error_area": [255, 0, 0, 127], - "model_default": [255, 201, 36, 255], "model_overhang": [255, 0, 0, 255], "model_unslicable": [122, 122, 122, 255], "model_unslicable_alt": [172, 172, 127, 255], "model_selection_outline": [50, 130, 255, 255], "model_non_printing": [122, 122, 122, 255], - "xray_error_dark": [255, 0, 0, 255], - "xray_error_light": [255, 255, 0, 255], "xray": [26, 26, 62, 255], - "xray_error": [255, 0, 0, 255], "layerview_ghost": [31, 31, 31, 95], "layerview_none": [255, 255, 255, 255], @@ -423,16 +395,7 @@ "layerview_nozzle": [224, 192, 16, 64], "layerview_starts": [255, 255, 255, 255], - "tab_status_connected": [50, 130, 255, 255], - "tab_status_disconnected": [200, 200, 200, 255], - - "printer_config_matched": [50, 130, 255, 255], - "printer_config_mismatch": [127, 127, 127, 255], - "favorites_header_bar": [245, 245, 245, 255], - "favorites_header_hover": [245, 245, 245, 255], - "favorites_header_text": [31, 36, 39, 255], - "favorites_header_text_hover": [31, 36, 39, 255], "favorites_row_selected": [196, 239, 255, 255], "monitor_printer_family_tag": [228, 228, 242, 255], @@ -441,11 +404,6 @@ "monitor_icon_accent": [255, 255, 255, 255], "monitor_icon_disabled": [238, 238, 238, 255], - "monitor_secondary_button_hover": [232, 242, 252, 255], - "monitor_secondary_button": [240, 240, 240, 255], - "monitor_secondary_button_text": [30, 102, 215, 255], - "monitor_secondary_button_shadow": [216, 216, 216, 255], - "monitor_card_border": [192, 193, 194, 255], "monitor_card_background": [255, 255, 255, 255], "monitor_card_hover": [232, 242, 252, 255], @@ -453,10 +411,6 @@ "monitor_stage_background": [246, 246, 246, 255], "monitor_stage_background_fade": [246, 246, 246, 102], - "monitor_progress_bar_fill": [50, 130, 255, 255], - "monitor_progress_bar_deactive": [192, 193, 194, 255], - "monitor_progress_bar_empty": [245, 245, 245, 255], - "monitor_tooltip": [25, 25, 25, 255], "monitor_tooltip_text": [255, 255, 255, 255], "monitor_context_menu": [255, 255, 255, 255], @@ -473,25 +427,24 @@ "cloud_unavailable": [153, 153, 153, 255], "connection_badge_background": [255, 255, 255, 255], "warning_badge_background": [0, 0, 0, 255], - "error_badge_background": [255, 255, 255, 255] + "error_badge_background": [255, 255, 255, 255], + + "border_field_light": [180, 180, 180, 255], + "border_main_light": [212, 212, 212, 255] }, "sizes": { "window_minimum_size": [80, 48], - "large_popup_dialog": [48, 40], "popup_dialog": [40, 36], "small_popup_dialog": [36, 12], "main_window_header": [0.0, 4.0], - "main_window_header_button": [8, 2.35], - "main_window_header_button_icon": [1.2, 1.2], "stage_menu": [0.0, 4.0], "account_button": [12, 2.5], "print_setup_widget": [38.0, 30.0], - "print_setup_mode_toggle": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], "print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_handle": [1.0, 1.0], @@ -506,7 +459,6 @@ "expandable_component_content_header": [0.0, 3.0], "configuration_selector": [35.0, 4.0], - "configuration_selector_mode_tabs": [1.0, 3.0], "action_panel_widget": [26.0, 0.0], "action_panel_information_widget": [20.0, 0.0], @@ -540,17 +492,12 @@ "section_control": [0, 1], "section_icon": [2, 2], "section_icon_column": [2.5, 2.5], - "rating_star": [1.0, 1.0], - "card": [25.0, 6.0], "setting": [25.0, 1.8], "setting_control": [11.0, 2.0], "setting_control_radius": [0.15, 0.15], "setting_control_depth_margin": [1.4, 0.0], - "setting_preferences_button_margin": [4, 0.0], - "setting_control_margin": [0.0, 0.0], "setting_unit_margin": [0.5, 0.5], - "setting_text_maxwidth": [40.0, 0.0], "standard_list_lineheight": [1.5, 1.5], "standard_arrow": [1.0, 1.0], @@ -561,13 +508,11 @@ "button": [4, 4], "button_icon": [2.5, 2.5], - "button_lining": [0, 0], "action_button": [15.0, 2.5], "action_button_icon": [1.5, 1.5], "action_button_icon_small": [1.0, 1.0], "action_button_radius": [0.15, 0.15], - "dialog_primary_button_padding": [3.0, 0], "radio_button": [1.3, 1.3], @@ -577,24 +522,21 @@ "medium_button": [2.5, 2.5], "medium_button_icon": [2, 2], + "context_menu": [20, 2], + "favorites_row": [2, 2], "favorites_button": [2, 2], "favorites_button_icon": [1.2, 1.2], - "icon_indicator_background": [1.5, 1.5], "icon_indicator": [1, 1], "printer_status_icon": [1.0, 1.0], - "printer_sync_icon": [1.2, 1.2], "button_tooltip": [1.0, 1.3], "button_tooltip_arrow": [0.25, 0.25], - "tool_button_border": [1.0, 0], - "progressbar": [26.0, 0.75], "progressbar_radius": [0.15, 0.15], - "progressbar_control": [8.0, 0.75], "scrollbar": [0.75, 0.5], @@ -610,26 +552,24 @@ "checkbox": [1.33, 1.33], "checkbox_mark": [1, 1], - "checkbox_square": [0.83, 0.83], "checkbox_radius": [0.25, 0.25], - "checkbox_label_padding": [0.5, 0.5], + + "spinbox": [6.0, 3.0], + "combobox_wide": [14, 2], "tooltip": [20.0, 10.0], "tooltip_margins": [1.0, 1.0], "tooltip_arrow_margins": [2.0, 2.0], - "save_button_text_margin": [0.3, 0.6], "save_button_save_to_button": [0.3, 2.7], "save_button_specs_icons": [1.4, 1.4], - "job_specs_button": [2.7, 2.7], "first_run_shadow_radius": [1.2, 1.2], "monitor_preheat_temperature_control": [4.5, 2.0], "welcome_wizard_window": [46, 50], "modal_window_minimum": [60.0, 45], - "license_window_minimum": [45, 45], "wizard_progress": [10.0, 0.0], "message": [30.0, 5.0], @@ -638,34 +578,21 @@ "message_action_button": [0, 2.5], "message_image": [15.0, 10.0], "message_type_icon": [2, 2], - - "infill_button_margin": [0.5, 0.5], + "menu": [18, 2], "jobspecs_line": [2.0, 2.0], "objects_menu_size": [15, 15], - "objects_menu_size_collapsed": [20, 17], - "build_plate_selection_size": [15, 5], - "objects_menu_button": [0.3, 2.7], "notification_icon": [1.5, 1.5], "avatar_image": [6.8, 6.8], - "monitor_config_override_box": [1.0, 14.0], - "monitor_extruder_circle": [2.75, 2.75], - "monitor_text_line": [1.5, 1.5], - "monitor_text_line_large": [2.33, 2.33], - "monitor_thick_lining": [0.16, 0.16], - "monitor_corner_radius": [0.3, 0.3], "monitor_shadow_radius": [0.4, 0.4], - "monitor_shadow_offset": [0.15, 0.15], "monitor_empty_state_offset": [5.6, 5.6], "monitor_empty_state_size": [35.0, 25.0], - "monitor_external_link_icon": [1.16, 1.16], "monitor_column": [18.0, 1.0], "monitor_progress_bar": [16.5, 1.0], - "monitor_margin": [1.5, 1.5], "table_row": [2.0, 2.0],