PrintCoreConfiguration.qml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import UM 1.2 as UM
  7. Item {
  8. id: extruderInfo;
  9. property var printCoreConfiguration: null;
  10. height: childrenRect.height;
  11. width: Math.round(parent.width / 2);
  12. // Extruder circle
  13. Item {
  14. id: extruderCircle;
  15. height: UM.Theme.getSize("monitor_extruder_circle").height;
  16. width: UM.Theme.getSize("monitor_extruder_circle").width;
  17. // Loading skeleton
  18. Rectangle {
  19. anchors.fill: parent;
  20. color: UM.Theme.getColor("monitor_skeleton_fill");
  21. radius: Math.round(width / 2);
  22. visible: !printCoreConfiguration;
  23. }
  24. // Actual content
  25. Rectangle {
  26. anchors.fill: parent;
  27. border.width: UM.Theme.getSize("monitor_thick_lining").width;
  28. border.color: UM.Theme.getColor("monitor_lining_heavy");
  29. color: "transparent";
  30. opacity: {
  31. if (printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null) {
  32. return 0.5;
  33. }
  34. return 1;
  35. }
  36. radius: Math.round(width / 2);
  37. visible: printCoreConfiguration;
  38. Label {
  39. anchors.centerIn: parent;
  40. color: UM.Theme.getColor("text");
  41. font: UM.Theme.getFont("default_bold");
  42. text: printCoreConfiguration ? printCoreConfiguration.position + 1 : 0;
  43. }
  44. }
  45. }
  46. // Print core and material labels
  47. Item {
  48. id: materialLabel
  49. anchors {
  50. left: extruderCircle.right;
  51. leftMargin: UM.Theme.getSize("default_margin").width;
  52. right: parent.right;
  53. top: parent.top;
  54. }
  55. height: UM.Theme.getSize("monitor_text_line").height;
  56. // Loading skeleton
  57. Rectangle {
  58. anchors.fill: parent;
  59. color: UM.Theme.getColor("monitor_skeleton_fill");
  60. visible: !extruderInfo.printCoreConfiguration;
  61. }
  62. // Actual content
  63. Label {
  64. anchors.fill: parent;
  65. elide: Text.ElideRight;
  66. color: UM.Theme.getColor("text");
  67. font: UM.Theme.getFont("default");
  68. text: {
  69. if (printCoreConfiguration && printCoreConfiguration.activeMaterial != undefined) {
  70. return printCoreConfiguration.activeMaterial.name;
  71. }
  72. return "";
  73. }
  74. visible: extruderInfo.printCoreConfiguration;
  75. }
  76. }
  77. Item {
  78. id: printCoreLabel;
  79. anchors {
  80. left: extruderCircle.right;
  81. leftMargin: UM.Theme.getSize("default_margin").width;
  82. right: parent.right;
  83. top: materialLabel.bottom;
  84. topMargin: Math.floor(UM.Theme.getSize("default_margin").height/4);
  85. }
  86. height: UM.Theme.getSize("monitor_text_line").height;
  87. // Loading skeleton
  88. Rectangle {
  89. color: UM.Theme.getColor("monitor_skeleton_fill");
  90. height: parent.height;
  91. visible: !extruderInfo.printCoreConfiguration;
  92. width: Math.round(parent.width / 3);
  93. }
  94. // Actual content
  95. Label {
  96. color: UM.Theme.getColor("text");
  97. elide: Text.ElideRight;
  98. font: UM.Theme.getFont("default");
  99. opacity: 0.6;
  100. text: {
  101. if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) {
  102. return printCoreConfiguration.hotendID;
  103. }
  104. return "";
  105. }
  106. visible: extruderInfo.printCoreConfiguration;
  107. }
  108. }
  109. }