MultiplyObjectOptions.qml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.Window 2.1
  6. import UM 1.1 as UM
  7. UM.Dialog
  8. {
  9. id: base
  10. //: Dialog title
  11. title: catalog.i18nc("@title:window", "Multiply Model")
  12. minimumWidth: 400 * Screen.devicePixelRatio
  13. minimumHeight: 80 * Screen.devicePixelRatio
  14. width: minimumWidth
  15. height: minimumHeight
  16. property var objectId: 0;
  17. onAccepted: Printer.multiplyObject(base.objectId, parseInt(copiesField.text))
  18. property variant catalog: UM.I18nCatalog { name: "cura" }
  19. signal reset()
  20. onReset: {
  21. copiesField.text = "1";
  22. copiesField.selectAll();
  23. copiesField.focus = true;
  24. }
  25. Row
  26. {
  27. spacing: UM.Theme.getSize("default_margin").width
  28. Label {
  29. text: "Number of copies:"
  30. anchors.verticalCenter: copiesField.verticalCenter
  31. }
  32. TextField {
  33. id: copiesField
  34. validator: RegExpValidator { regExp: /^\d{0,2}/ }
  35. maximumLength: 2
  36. }
  37. }
  38. rightButtons:
  39. [
  40. Button
  41. {
  42. text: catalog.i18nc("@action:button","OK")
  43. onClicked: base.accept()
  44. enabled: base.objectId != 0 && parseInt(copiesField.text) > 0
  45. },
  46. Button
  47. {
  48. text: catalog.i18nc("@action:button","Cancel")
  49. onClicked: base.reject()
  50. }
  51. ]
  52. }