diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index 0f0ffac8cd..7f72fea4c3 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -5,7 +5,7 @@ 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 diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index 17256eb9ea..a095ccb352 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -15,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() } @@ -35,8 +36,7 @@ UM.Dialog property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width) property int textMargin: UM.Theme.getSize("narrow_margin").width property string activeScriptName - SystemPalette{ id: palette } - SystemPalette{ id: disabledPalette; colorGroup: SystemPalette.Disabled } + anchors.fill: parent ButtonGroup @@ -51,14 +51,12 @@ UM.Dialog spacing: base.textMargin - Label + UM.Label { id: activeScriptsHeader text: catalog.i18nc("@label", "Post Processing Scripts") 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 } @@ -79,137 +77,142 @@ UM.Dialog id: activeScriptsScrollBar } model: manager.scriptList - delegate: Item + + delegate: Button { + id: activeScriptButton + width: parent.width - activeScriptsScrollBar.width - height: activeScriptButton.height - Button - { - id: activeScriptButton - text: manager.getScriptLabelByKey(modelData.toString()) - ButtonGroup.group: selectedScriptGroup - width: parent.width - height: UM.Theme.getSize("setting").height - checkable: true + height: UM.Theme.getSize("standard_list_lineheight").height - checked: + 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 } - - background: Rectangle + else { - color: activeScriptButton.checked ? palette.highlight : "transparent" + return false } - contentItem: Label - { - wrapMode: Text.Wrap - text: activeScriptButton.text - elide: Text.ElideRight - color: activeScriptButton.checked ? palette.highlightedText : palette.text - } - } - Button + background: Rectangle { - id: removeButton - text: "x" - width: 20 * screenScaleFactor - height: 20 * screenScaleFactor - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - onClicked: manager.removeScriptByIndex(index) - contentItem: Item + color: activeScriptButton.checked ? UM.Theme.getColor("background_3") : "transparent" + } + + onClicked: + { + forceActiveFocus() + manager.setSelectedScriptIndex(index) + base.activeScriptName = manager.getScriptLabelByKey(modelData.toString()) + } + + RowLayout + { + anchors.fill: parent + height: childrenRect.height + + UM.Label { + Layout.fillWidth: true + text: manager.getScriptLabelByKey(modelData.toString()) + } + + Item + { + id: downButton + Layout.preferredWidth: height + Layout.fillHeight: true + enabled: index != manager.scriptList.length - 1 + + 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: Math.round(removeButton.width / 2.7) - height: Math.round(removeButton.height / 2.7) - sourceSize.height: width - color: palette.text - source: UM.Theme.getIcon("Cancel") - } - } - - } - Button - { - id: downButton - 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) - } - contentItem: Item - { - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(downButton.width / 2.5) - height: Math.round(downButton.height / 2.5) - sourceSize.height: width - color: downButton.enabled ? palette.text : disabledPalette.text + 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") } } - } - Button - { - id: upButton - text: "" - enabled: index != 0 - width: 20 * screenScaleFactor - height: 20 * screenScaleFactor - anchors.right: downButton.left - anchors.verticalCenter: parent.verticalCenter - onClicked: + Item { - if (manager.selectedScriptIndex == index) + id: upButton + Layout.preferredWidth: height + Layout.fillHeight: true + enabled: index != 0 + + MouseArea { - manager.setSelectedScriptIndex(index - 1) + anchors.fill: parent + onClicked: + { + if (manager.selectedScriptIndex == index) + { + manager.setSelectedScriptIndex(index - 1) + } + return manager.moveScript(index, index - 1) + } } - return manager.moveScript(index, index - 1) - } - contentItem: Item - { + UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(upButton.width / 2.5) - height: Math.round(upButton.height / 2.5) - sourceSize.height: width - color: upButton.enabled ? palette.text : disabledPalette.text + 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") + } + } } } } @@ -217,28 +220,26 @@ UM.Dialog { id: addButton text: catalog.i18nc("@action", "Add a script") - anchors.left: parent.left - anchors.leftMargin: base.textMargin onClicked: scriptsMenu.open() } - Menu + } + + Cura.Menu + { + id: scriptsMenu + + Models.Instantiator { - id: scriptsMenu - width: parent.width + model: manager.loadedScriptList - Models.Instantiator + Cura.MenuItem { - model: manager.loadedScriptList - - 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) } } @@ -303,16 +304,9 @@ UM.Dialog width: listview.width height: { - if(provider.properties.enabled == "True") + if (provider.properties.enabled == "True" && model.type != undefined) { - if(model.type != undefined) - { - return UM.Theme.getSize("section").height - } - else - { - return 0 - } + return UM.Theme.getSize("section").height; } else { @@ -392,10 +386,10 @@ UM.Dialog function onShowTooltip(text) { - tooltip.text = text - var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0) - tooltip.show(position) - tooltip.target.x = position.x + 1 + tooltip.text = text; + var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0); + tooltip.show(position); + tooltip.target.x = position.x + 1; } function onHideTooltip() { tooltip.hide() } @@ -452,7 +446,7 @@ UM.Dialog } } - rightButtons: Cura.PrimaryButton + rightButtons: Cura.TertiaryButton { text: catalog.i18nc("@action:button", "Close") onClicked: dialog.accept() diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 9c96fdca9e..e68f552f7b 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -35,8 +35,8 @@ Cura.MachineAction id: discoverUM3Action spacing: UM.Theme.getSize("default_margin").height - SystemPalette { id: palette } UM.I18nCatalog { id: catalog; name:"cura" } + UM.Label { id: pageTitle @@ -53,9 +53,9 @@ Cura.MachineAction 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"); @@ -65,7 +65,7 @@ Cura.MachineAction } } - Button + Cura.SecondaryButton { id: editButton text: catalog.i18nc("@action:button", "Edit") @@ -76,7 +76,7 @@ Cura.MachineAction } } - Button + Cura.SecondaryButton { id: removeButton text: catalog.i18nc("@action:button", "Remove") @@ -84,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") @@ -122,23 +122,18 @@ Cura.MachineAction base.completeProperties = base.selectedDevice != null && base.selectedDevice.getProperty("incomplete") != "true"; } Component.onCompleted: manager.startDiscovery() - delegate: Rectangle + + delegate: UM.Label { - height: printNameLabel.height - color: ListView.isCurrentItem ? palette.highlight : index % 2 ? palette.base : palette.alternateBase + id: printNameLabel width: listview.width - Label - { - id: printNameLabel - height: contentHeight - 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 - } + height: contentHeight + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + anchors.right: parent.right + text: listview.model[index].name + elide: Text.ElideRight MouseArea { @@ -151,6 +146,11 @@ Cura.MachineAction } } } + + background: Rectangle + { + color: parent.ListView.isCurrentItem ? UM.Theme.getColor("background_3") : "transparent" + } } } UM.Label @@ -175,20 +175,19 @@ Cura.MachineAction font: UM.Theme.getFont("large_bold") elide: Text.ElideRight } - Grid + GridLayout { visible: base.completeProperties width: parent.width columns: 2 - property real labelWidth: Math.round(width * 0.5) UM.Label { - width: labelWidth + Layout.fillWidth: true text: catalog.i18nc("@label", "Type") } UM.Label { - width: labelWidth + Layout.fillWidth: true text: { if (base.selectedDevice) { @@ -199,22 +198,22 @@ Cura.MachineAction } UM.Label { - width: labelWidth + Layout.fillWidth: true text: catalog.i18nc("@label", "Firmware version") } UM.Label { - width: labelWidth + Layout.fillWidth: true text: base.selectedDevice ? base.selectedDevice.firmwareVersion : "" } UM.Label { - width: labelWidth + Layout.fillWidth: true text: catalog.i18nc("@label", "Address") } UM.Label { - width: labelWidth + Layout.fillWidth: true text: base.selectedDevice ? base.selectedDevice.ipAddress : "" } } @@ -246,7 +245,7 @@ Cura.MachineAction text: catalog.i18nc("@label", "The printer at this address has not yet responded." ) } - Button + Cura.SecondaryButton { text: catalog.i18nc("@action:button", "Connect") enabled: (base.selectedDevice && base.completeProperties && base.selectedDevice.clusterSize > 0) ? true : false @@ -264,7 +263,7 @@ Cura.MachineAction standardButtons: Dialog.Ok } - Dialog + Cura.MessageDialog { id: manualPrinterDialog property string printerKey @@ -273,6 +272,7 @@ Cura.MachineAction title: catalog.i18nc("@title:window", "Printer Address") width: UM.Theme.getSize("small_popup_dialog").width + height: UM.Theme.getSize("small_popup_dialog").height anchors.centerIn: Overlay.overlay diff --git a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml index 3bd72bf68f..23e01b5e46 100644 --- a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml +++ b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml @@ -76,7 +76,7 @@ UM.Dialog anchors.fill: parent spacing: UM.Theme.getSize("default_margin").height - Label + UM.Label { id: questionText width: parent.width diff --git a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml index 00c4fb8f50..c5c7248a98 100644 --- a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml +++ b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml @@ -272,7 +272,6 @@ UM.Dialog UM.CheckBox { id: dontShowAgainCheckbox - anchors.left: parent.left text: catalog.i18nc("@action:label", "Don't show project summary on save again") checked: dontShowAgain } diff --git a/resources/qml/MainWindow/MainWindowHeader.qml b/resources/qml/MainWindow/MainWindowHeader.qml index c38e1bb4ab..3f22879992 100644 --- a/resources/qml/MainWindow/MainWindowHeader.qml +++ b/resources/qml/MainWindow/MainWindowHeader.qml @@ -78,7 +78,6 @@ Item background: Rectangle { radius: UM.Theme.getSize("action_button_radius").width - width: contents.width color: { if (stageSelectorButton.checked) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 2b340a7ab5..52e141ad3c 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -14,7 +14,7 @@ UM.PreferencesPage title: catalog.i18nc("@title:tab", "General") id: generalPreferencesPage - width: parent.width + width: parent ? parent.width: 0 function setDefaultLanguage(languageCode) { diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 1ee86f9f0c..d6522829fe 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -144,7 +144,7 @@ UM.ManagementPage } // Dialog to request a name when creating a new profile - UM.RenameDialog + Cura.RenameDialog { id: createQualityDialog title: catalog.i18nc("@title:window", "Create Profile") @@ -233,7 +233,7 @@ UM.ManagementPage } // Dialog to request a name when duplicating a new profile - UM.RenameDialog + Cura.RenameDialog { id: duplicateQualityDialog title: catalog.i18nc("@title:window", "Duplicate Profile") @@ -263,7 +263,7 @@ UM.ManagementPage } // Dialog to rename a quality profile - UM.RenameDialog + Cura.RenameDialog { id: renameQualityDialog title: catalog.i18nc("@title:window", "Rename Profile") diff --git a/resources/qml/Preferences/RenameDialog.qml b/resources/qml/Preferences/RenameDialog.qml new file mode 100644 index 0000000000..7bf02e92a1 --- /dev/null +++ b/resources/qml/Preferences/RenameDialog.qml @@ -0,0 +1,91 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Uranium is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.1 +import QtQuick.Controls 2.0 +import QtQuick.Window 2.1 + +import UM 1.5 as UM +import Cura 1.0 as Cura + +UM.Dialog +{ + id: base + property string object: "" + + property alias newName: nameField.text + property bool validName: true + property string validationError + property string dialogTitle: catalog.i18nc("@title:window", "Rename") + property string explanation: catalog.i18nc("@info", "Please provide a new name.") + + title: dialogTitle + + minimumWidth: UM.Theme.getSize("small_popup_dialog").width + minimumHeight: UM.Theme.getSize("small_popup_dialog").height + width: minimumWidth + height: minimumHeight + + property variant catalog: UM.I18nCatalog { name: "cura" } + + signal textChanged(string text) + signal selectText() + onSelectText: + { + nameField.selectAll(); + nameField.focus = true; + } + + Column + { + anchors.fill: parent + + UM.Label + { + text: base.explanation + "\n" //Newline to make some space using system theming. + width: parent.width + wrapMode: Text.WordWrap + } + + Cura.TextField + { + id: nameField + width: parent.width + text: base.object + maximumLength: 40 + selectByMouse: true + onTextChanged: base.textChanged(text) + } + + UM.Label + { + visible: !base.validName + text: base.validationError + } + } + + Item + { + ButtonGroup { + buttons: [cancelButton, okButton] + checkedButton: okButton + } + } + + rightButtons: [ + Cura.SecondaryButton + { + id: cancelButton + text: catalog.i18nc("@action:button","Cancel") + onClicked: base.reject() + }, + Cura.PrimaryButton + { + id: okButton + text: catalog.i18nc("@action:button", "OK") + onClicked: base.accept() + enabled: base.validName + } + ] +} + diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index 0cc10be0f9..1e2ab6a365 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -84,7 +84,7 @@ UM.PreferencesPage } } - TextField + Cura.TextField { id: filter @@ -105,7 +105,7 @@ UM.PreferencesPage Cura.ComboBox { id: visibilityPreset - width: 150 * screenScaleFactor + width: UM.Theme.getSize("action_button").width anchors { top: parent.top diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 48c658e4e7..2ab98081e7 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -409,7 +409,7 @@ Item } } - Menu + Cura.Menu { id: contextMenu diff --git a/resources/qml/Widgets/TextField.qml b/resources/qml/Widgets/TextField.qml index 959506ff2b..7803c17396 100644 --- a/resources/qml/Widgets/TextField.qml +++ b/resources/qml/Widgets/TextField.qml @@ -24,6 +24,7 @@ TextField 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: [ diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 2d5839f798..8ddacc56e4 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -47,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-light/theme.json b/resources/themes/cura-light/theme.json index 9c6e043eee..846018fb96 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -206,7 +206,6 @@ "text_selection": [156, 195, 255, 127], "border": [127, 127, 127, 255], "border_field": [180, 180, 180, 255], - "text_selection": [156,195, 255, 127], "secondary": [240, 240, 240, 255], "icon": [8, 7, 63, 255],