SidebarSimple.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.1
  7. import UM 1.0 as UM
  8. Item {
  9. id: base;
  10. anchors.fill: parent;
  11. anchors.leftMargin: UM.Theme.sizes.default_margin.width;
  12. anchors.rightMargin: UM.Theme.sizes.default_margin.width;
  13. property Action configureSettings;
  14. property variant minimumPrintTime: PrintInformation.minimumPrintTime;
  15. property variant maximumPrintTime: PrintInformation.maximumPrintTime;
  16. Component.onCompleted: PrintInformation.enabled = true
  17. Component.onDestruction: PrintInformation.enabled = false
  18. ColumnLayout {
  19. anchors.fill: parent;
  20. Item {
  21. Layout.fillWidth: true;
  22. Layout.preferredHeight: UM.Theme.sizes.section.height;
  23. Label {
  24. anchors.left: parent.left;
  25. anchors.verticalCenter: parent.verticalCenter;
  26. text: base.minimumPrintTime.valid ? base.minimumPrintTime.getDisplayString(UM.DurationFormat.Short) : "??:??";
  27. font: UM.Theme.fonts.timeslider_time;
  28. color: UM.Theme.colors.primary;
  29. }
  30. Label {
  31. anchors.centerIn: parent;
  32. text: {
  33. if (UM.Backend.progress < 0)
  34. {
  35. //: Sidebar configuration label
  36. return qsTr("No Model Loaded");
  37. }
  38. else if (!base.minimumPrintTime.valid || !base.maximumPrintTime.valid)
  39. {
  40. //: Sidebar configuration label
  41. return qsTr("Calculating...")
  42. }
  43. else
  44. {
  45. //: Sidebar configuration label
  46. return qsTr("Estimated Print Time");
  47. }
  48. }
  49. color: UM.Theme.colors.text;
  50. font: UM.Theme.fonts.default;
  51. }
  52. Label {
  53. anchors.right: parent.right;
  54. anchors.verticalCenter: parent.verticalCenter;
  55. text: base.maximumPrintTime.valid ? base.maximumPrintTime.getDisplayString(UM.DurationFormat.Short) : "??:??";
  56. font: UM.Theme.fonts.timeslider_time;
  57. color: UM.Theme.colors.primary;
  58. }
  59. }
  60. Slider {
  61. Layout.fillWidth: true;
  62. Layout.preferredHeight: UM.Theme.sizes.section.height;
  63. minimumValue: 0;
  64. maximumValue: 100;
  65. value: PrintInformation.timeQualityValue;
  66. onValueChanged: PrintInformation.setTimeQualityValue(value);
  67. style: UM.Theme.styles.slider;
  68. }
  69. Item {
  70. Layout.fillWidth: true;
  71. Layout.preferredHeight: UM.Theme.sizes.section.height;
  72. Label {
  73. anchors.left: parent.left;
  74. anchors.verticalCenter: parent.verticalCenter;
  75. //: Quality slider label
  76. text: qsTr("Minimum\nDraft");
  77. color: UM.Theme.colors.text;
  78. font: UM.Theme.fonts.default;
  79. }
  80. Label {
  81. anchors.right: parent.right;
  82. anchors.verticalCenter: parent.verticalCenter;
  83. //: Quality slider label
  84. text: qsTr("Maximum\nQuality");
  85. horizontalAlignment: Text.AlignRight;
  86. color: UM.Theme.colors.text;
  87. font: UM.Theme.fonts.default;
  88. }
  89. }
  90. CheckBox {
  91. Layout.fillWidth: true;
  92. Layout.preferredHeight: UM.Theme.sizes.section.height;
  93. //: Setting checkbox
  94. text: qsTr("Enable Support");
  95. style: UM.Theme.styles.checkbox;
  96. checked: Printer.getSettingValue("support_enable");
  97. onCheckedChanged: Printer.setSettingValue("support_enable", checked);
  98. }
  99. Item { Layout.fillWidth: true; Layout.fillHeight: true; }
  100. }
  101. }