ClusterControlItem.qml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.3
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.3
  6. import UM 1.3 as UM
  7. import Cura 1.0 as Cura
  8. Component {
  9. Rectangle {
  10. id: base;
  11. property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width;
  12. property var cornerRadius: UM.Theme.getSize("monitor_corner_radius").width;
  13. anchors.fill: parent;
  14. color: UM.Theme.getColor("sidebar");
  15. visible: OutputDevice != null;
  16. UM.I18nCatalog {
  17. id: catalog;
  18. name: "cura";
  19. }
  20. Label {
  21. id: printingLabel;
  22. anchors {
  23. left: parent.left;
  24. leftMargin: 4 * UM.Theme.getSize("default_margin").width;
  25. margins: 2 * UM.Theme.getSize("default_margin").width;
  26. right: parent.right;
  27. top: parent.top;
  28. }
  29. color: UM.Theme.getColor("text");
  30. elide: Text.ElideRight;
  31. font: UM.Theme.getFont("large");
  32. text: catalog.i18nc("@label", "Printing");
  33. }
  34. Label {
  35. id: managePrintersLabel;
  36. anchors {
  37. bottom: printingLabel.bottom;
  38. right: printerScrollView.right;
  39. rightMargin: 4 * UM.Theme.getSize("default_margin").width;
  40. }
  41. color: UM.Theme.getColor("primary"); // "Cura Blue"
  42. font: UM.Theme.getFont("default");
  43. linkColor: UM.Theme.getColor("primary"); // "Cura Blue"
  44. text: catalog.i18nc("@label link to connect manager", "Manage printers");
  45. }
  46. MouseArea {
  47. anchors.fill: managePrintersLabel;
  48. hoverEnabled: true;
  49. onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel();
  50. onEntered: managePrintersLabel.font.underline = true;
  51. onExited: managePrintersLabel.font.underline = false;
  52. }
  53. // Skeleton loading
  54. Column {
  55. id: skeletonLoader;
  56. anchors {
  57. left: parent.left;
  58. leftMargin: UM.Theme.getSize("wide_margin").width;
  59. right: parent.right;
  60. rightMargin: UM.Theme.getSize("wide_margin").width;
  61. top: printingLabel.bottom;
  62. topMargin: UM.Theme.getSize("default_margin").height;
  63. }
  64. spacing: UM.Theme.getSize("default_margin").height - 10;
  65. visible: printerList.count === 0;
  66. PrinterCard {
  67. printer: null;
  68. }
  69. PrinterCard {
  70. printer: null;
  71. }
  72. }
  73. // Actual content
  74. ScrollView {
  75. id: printerScrollView;
  76. anchors {
  77. bottom: parent.bottom;
  78. left: parent.left;
  79. right: parent.right;
  80. top: printingLabel.bottom;
  81. topMargin: UM.Theme.getSize("default_margin").height;
  82. }
  83. style: UM.Theme.styles.scrollview;
  84. ListView {
  85. id: printerList;
  86. property var currentIndex: -1;
  87. anchors {
  88. fill: parent;
  89. leftMargin: UM.Theme.getSize("wide_margin").width;
  90. rightMargin: UM.Theme.getSize("wide_margin").width;
  91. }
  92. delegate: PrinterCard {
  93. printer: modelData;
  94. }
  95. model: OutputDevice.printers;
  96. spacing: UM.Theme.getSize("default_margin").height - 10;
  97. }
  98. }
  99. }
  100. }