diff options
author | Ghostkeeper <rubend@tutanota.com> | 2020-08-20 17:35:52 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2020-08-20 17:35:52 +0300 |
commit | 9ea418c0a1bcb5645a61b9534c61381e8c618e3a (patch) | |
tree | 2c495ae5acb4f1680944434905a86c6917e46e93 /plugins/3MFReader/WorkspaceDialog.qml | |
parent | a757dc7fa0b1b19efa1024132e2d6c94d2788626 (diff) |
Revert "Revert "Merge branch '4.7' of github.com:Ultimaker/Cura into 4.7""
This reverts commit 28f4d8513db7efce17bfd8b80fa7c8b237fd1c18.
The original revert was to revert an accidental merge from master to 4.7. This now reverts the revert on Master, so that we still have those changes on Master.
Diffstat (limited to 'plugins/3MFReader/WorkspaceDialog.qml')
-rw-r--r-- | plugins/3MFReader/WorkspaceDialog.qml | 65 |
1 files changed, 42 insertions, 23 deletions
diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index d0fd3d0846..5f67f54c39 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -2,7 +2,7 @@ // 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 import QtQuick.Layouts 1.3 import QtQuick.Window 2.2 @@ -20,6 +20,7 @@ UM.Dialog property int comboboxHeight: 15 * screenScaleFactor property int spacerHeight: 10 * screenScaleFactor + property int doubleSpacerHeight: 20 * screenScaleFactor onClosing: manager.notifyClosed() onVisibleChanged: @@ -35,7 +36,7 @@ UM.Dialog Item { anchors.fill: parent - anchors.margins: 20 * screenScaleFactor + anchors.margins: 10 * screenScaleFactor UM.I18nCatalog { @@ -79,7 +80,7 @@ UM.Dialog } Item // Spacer { - height: spacerHeight + height: doubleSpacerHeight width: height } @@ -101,35 +102,53 @@ UM.Dialog } UM.TooltipArea { - id: machineResolveTooltip + id: machineResolveStrategyTooltip width: (parent.width / 3) | 0 height: visible ? comboboxHeight : 0 - visible: manager.machineConflict + visible: base.visible && machineResolveComboBox.model.count > 1 text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?") ComboBox { - model: ListModel + id: machineResolveComboBox + model: manager.updatableMachinesModel + visible: machineResolveStrategyTooltip.visible + textRole: "displayName" + width: parent.width + onCurrentIndexChanged: { - Component.onCompleted: + if (model.getItem(currentIndex).id == "new" + && model.getItem(currentIndex).type == "default_option") { - append({"key": "override", "label": catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName}); - append({"key": "new", "label": catalog.i18nc("@action:ComboBox option", "Create new")}); + manager.setResolveStrategy("machine", "new") } - } - Connections - { - target: manager - onMachineNameChanged: + else { - machineResolveComboBox.model.get(0).label = catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName; + manager.setResolveStrategy("machine", "override") + manager.setMachineToOverride(model.getItem(currentIndex).id) } } - textRole: "label" - id: machineResolveComboBox - width: parent.width - onActivated: + + onVisibleChanged: { - manager.setResolveStrategy("machine", resolveStrategiesModel.get(index).key) + if (!visible) {return} + + currentIndex = 0 + // If the project printer exists in Cura, set it as the default dropdown menu option. + // No need to check object 0, which is the "Create new" option + for (var i = 1; i < model.count; i++) + { + if (model.getItem(i).name == manager.machineName) + { + currentIndex = i + break + } + } + // The project printer does not exist in Cura. If there is at least one printer of the same + // type, select the first one, else set the index to "Create new" + if (currentIndex == 0 && model.count > 1) + { + currentIndex = 1 + } } } } @@ -168,7 +187,7 @@ UM.Dialog Item // Spacer { - height: spacerHeight + height: doubleSpacerHeight width: height } Row @@ -271,7 +290,7 @@ UM.Dialog } Item // Spacer { - height: spacerHeight + height: doubleSpacerHeight width: height } Row @@ -333,7 +352,7 @@ UM.Dialog Item // Spacer { - height: spacerHeight + height: doubleSpacerHeight width: height } |