PrintWindow.qml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Window 2.2
  5. import QtQuick.Controls 1.2
  6. import UM 1.1 as UM
  7. UM.Dialog
  8. {
  9. id: base;
  10. minimumWidth: 500 * screenScaleFactor
  11. minimumHeight: 140 * screenScaleFactor
  12. maximumWidth: minimumWidth
  13. maximumHeight: minimumHeight
  14. width: minimumWidth
  15. height: minimumHeight
  16. visible: true
  17. modality: Qt.ApplicationModal
  18. title: catalog.i18nc("@title:window","Print over network")
  19. Column
  20. {
  21. id: printerSelection
  22. anchors.fill: parent
  23. anchors.top: parent.top
  24. anchors.topMargin: UM.Theme.getSize("default_margin").height
  25. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  26. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  27. height: 50 * screenScaleFactor
  28. Label
  29. {
  30. id: manualPrinterSelectionLabel
  31. anchors
  32. {
  33. left: parent.left
  34. topMargin: UM.Theme.getSize("default_margin").height
  35. right: parent.right
  36. }
  37. text: "Printer selection"
  38. wrapMode: Text.Wrap
  39. height: 20 * screenScaleFactor
  40. }
  41. ComboBox
  42. {
  43. id: printerSelectionCombobox
  44. model: OutputDevice.printers
  45. textRole: "friendly_name"
  46. width: parent.width
  47. height: 40 * screenScaleFactor
  48. Behavior on height { NumberAnimation { duration: 100 } }
  49. onActivated:
  50. {
  51. var printerData = OutputDevice.printers[index];
  52. OutputDevice.selectPrinter(printerData.unique_name, printerData.friendly_name);
  53. }
  54. }
  55. SystemPalette
  56. {
  57. id: palette
  58. }
  59. UM.I18nCatalog { id: catalog; name: "cura"; }
  60. }
  61. leftButtons: [
  62. Button
  63. {
  64. text: catalog.i18nc("@action:button","Cancel")
  65. enabled: true
  66. onClicked: {
  67. base.visible = false;
  68. // reset to defaults
  69. OutputDevice.selectAutomaticPrinter()
  70. printerSelectionCombobox.currentIndex = 0
  71. }
  72. }
  73. ]
  74. rightButtons: [
  75. Button
  76. {
  77. text: catalog.i18nc("@action:button","Print")
  78. enabled: true
  79. onClicked: {
  80. base.visible = false;
  81. OutputDevice.sendPrintJob();
  82. // reset to defaults
  83. OutputDevice.selectAutomaticPrinter()
  84. printerSelectionCombobox.currentIndex = 0
  85. }
  86. }
  87. ]
  88. }