|
| 1 | +import QtQuick 2.2 |
| 2 | +import QtQuick.Controls 1.1 |
| 3 | +import QtQuick.Layouts 1.1 |
| 4 | +import QtQuick.Window 2.1 |
| 5 | + |
| 6 | +import UM 1.2 as UM |
| 7 | +import Cura 1.0 as Cura |
| 8 | + |
| 9 | + |
| 10 | +Cura.MachineAction |
| 11 | +{ |
| 12 | + id: base; |
| 13 | + |
| 14 | + property var finished: manager.finished |
| 15 | + onFinishedChanged: if(manager.finished) {completed()} |
| 16 | + |
| 17 | + function reset() |
| 18 | + { |
| 19 | + manager.reset() |
| 20 | + } |
| 21 | + |
| 22 | + anchors.fill: parent; |
| 23 | + property var selectedInstance: null |
| 24 | + |
| 25 | + property bool validUrl: true; |
| 26 | + |
| 27 | + Component.onCompleted: { |
| 28 | + actionDialog.minimumWidth = screenScaleFactor * 500; |
| 29 | + actionDialog.minimumHeight = screenScaleFactor * 255; |
| 30 | + actionDialog.maximumWidth = screenScaleFactor * 500; |
| 31 | + actionDialog.maximumHeight = screenScaleFactor * 255; |
| 32 | + } |
| 33 | + |
| 34 | + Column { |
| 35 | + anchors.fill: parent; |
| 36 | + |
| 37 | + Item { width: parent.width; } |
| 38 | + Label { text: catalog.i18nc("@label", "Duet Address (URL)"); } |
| 39 | + TextField { |
| 40 | + id: urlField; |
| 41 | + text: manager.printerSettingUrl; |
| 42 | + maximumLength: 1024; |
| 43 | + anchors.left: parent.left; |
| 44 | + anchors.right: parent.right; |
| 45 | + onTextChanged: { |
| 46 | + base.validUrl = manager.validUrl(urlField.text); |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + Item { width: parent.width; } |
| 51 | + Label { text: catalog.i18nc("@label", "Duet Password (if you used M551)"); } |
| 52 | + TextField { |
| 53 | + id: duet_passwordField; |
| 54 | + text: manager.printerSettingDuetPassword; |
| 55 | + maximumLength: 1024; |
| 56 | + anchors.left: parent.left; |
| 57 | + anchors.right: parent.right; |
| 58 | + } |
| 59 | + |
| 60 | + Item { width: parent.width; } |
| 61 | + Label { text: catalog.i18nc("@label", "HTTP Basic Auth: user (if you run a reverse proxy)"); } |
| 62 | + TextField { |
| 63 | + id: http_userField; |
| 64 | + text: manager.printerSettingHTTPUser; |
| 65 | + maximumLength: 1024; |
| 66 | + anchors.left: parent.left; |
| 67 | + anchors.right: parent.right; |
| 68 | + } |
| 69 | + |
| 70 | + Item { width: parent.width; } |
| 71 | + Label { text: catalog.i18nc("@label", "HTTP Basic Auth: password (if you run a reverse proxy)"); } |
| 72 | + TextField { |
| 73 | + id: http_passwordField; |
| 74 | + text: manager.printerSettingHTTPPassword; |
| 75 | + maximumLength: 1024; |
| 76 | + anchors.left: parent.left; |
| 77 | + anchors.right: parent.right; |
| 78 | + } |
| 79 | + |
| 80 | + Item { width: parent.width; } |
| 81 | + Label { |
| 82 | + visible: !base.validUrl; |
| 83 | + text: catalog.i18nc("@error", "URL not valid. Example: http://192.168.1.42/"); |
| 84 | + color: "red"; |
| 85 | + } |
| 86 | + |
| 87 | + Item { |
| 88 | + width: saveButton.implicitWidth |
| 89 | + height: saveButton.implicitHeight |
| 90 | + } |
| 91 | + |
| 92 | + Button { |
| 93 | + id: saveButton; |
| 94 | + text: catalog.i18nc("@action:button", "Save Config"); |
| 95 | + width: screenScaleFactor * 100; |
| 96 | + onClicked: { |
| 97 | + manager.saveConfig(urlField.text, duet_passwordField.text, http_userField.text, http_passwordField.text); |
| 98 | + actionDialog.reject(); |
| 99 | + } |
| 100 | + enabled: base.validUrl; |
| 101 | + } |
| 102 | + |
| 103 | + Button { |
| 104 | + id: deleteButton; |
| 105 | + text: catalog.i18nc("@action:button", "Delete Config"); |
| 106 | + width: screenScaleFactor * 100; |
| 107 | + onClicked: { |
| 108 | + manager.deleteConfig(); |
| 109 | + actionDialog.reject(); |
| 110 | + } |
| 111 | + } |
| 112 | + } |
| 113 | +} |
0 commit comments