AddMachineWizard.qml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Cura is released under the terms of the AGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Layouts 1.1
  6. import QtQuick.Window 2.1
  7. import UM 1.0 as UM
  8. UM.Dialog {
  9. id: base
  10. //: Add Printer dialog title
  11. title: qsTr("Add Printer");
  12. ColumnLayout {
  13. anchors.fill: parent;
  14. Label {
  15. //: Add Printer wizard page title
  16. text: qsTr("Add Printer");
  17. font.pointSize: 18;
  18. }
  19. Label {
  20. //: Add Printer wizard page description
  21. text: qsTr("Please select the type of printer:");
  22. }
  23. ScrollView {
  24. Layout.fillWidth: true;
  25. ListView {
  26. id: machineList;
  27. model: UM.Models.availableMachinesModel
  28. delegate: RadioButton { exclusiveGroup: printerGroup; text: model.name; onClicked: ListView.view.currentIndex = index; }
  29. }
  30. }
  31. Label {
  32. //: Add Printer wizard field label
  33. text: qsTr("Printer Name:");
  34. }
  35. TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
  36. Item { Layout.fillWidth: true; Layout.fillHeight: true; }
  37. ExclusiveGroup { id: printerGroup; }
  38. }
  39. rightButtons: [
  40. Button {
  41. //: Add Printer wizarad button
  42. text: qsTr("Next");
  43. onClicked: {
  44. if(machineList.currentIndex != -1) {
  45. UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text)
  46. base.visible = false
  47. }
  48. }
  49. },
  50. Button {
  51. //: Add Printer wizarad button
  52. text: qsTr("Cancel");
  53. onClicked: base.visible = false;
  54. }
  55. ]
  56. }