ProfileSetup.qml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.1 as UM
  8. Item{
  9. id: base;
  10. UM.I18nCatalog { id: catalog; name:"cura"}
  11. property int totalHeightProfileSetup: childrenRect.height
  12. property Action manageProfilesAction
  13. Rectangle {
  14. id: variantRow
  15. anchors.top: base.top
  16. width: base.width
  17. height: UM.Theme.sizes.sidebar_setup.height
  18. //visible: UM.MachineManager.hasVariants;
  19. visible: true
  20. Label{
  21. id: variantLabel
  22. text: catalog.i18nc("@label","Variant:");
  23. anchors.left: parent.left
  24. anchors.leftMargin: UM.Theme.sizes.default_margin.width;
  25. anchors.verticalCenter: parent.verticalCenter
  26. width: parent.width/100*45
  27. font: UM.Theme.fonts.default;
  28. }
  29. ToolButton {
  30. id: variantSelection
  31. text: UM.MachineManager.activeMachineVariant
  32. width: parent.width/100*55
  33. height: UM.Theme.sizes.setting_control.height
  34. tooltip: UM.MachineManager.activeMachineInstance;
  35. anchors.right: parent.right
  36. anchors.rightMargin: UM.Theme.sizes.default_margin.width
  37. anchors.verticalCenter: parent.verticalCenter
  38. style: UM.Theme.styles.sidebar_header_button
  39. menu: Menu
  40. {
  41. id: variantsSelectionMenu
  42. Instantiator
  43. {
  44. model: UM.MachineVariantsModel { }
  45. MenuItem
  46. {
  47. text: model.name;
  48. checkable: true;
  49. checked: model.active;
  50. exclusiveGroup: variantSelectionMenuGroup;
  51. onTriggered: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name)
  52. }
  53. onObjectAdded: variantsSelectionMenu.insertItem(index, object)
  54. onObjectRemoved: variantsSelectionMenu.removeItem(object)
  55. }
  56. ExclusiveGroup { id: variantSelectionMenuGroup; }
  57. }
  58. }
  59. }
  60. Rectangle{
  61. id: globalProfileRow;
  62. anchors.top: UM.MachineManager.hasVariants ? variantRow.bottom : base.top
  63. //anchors.top: variantRow.bottom
  64. height: UM.Theme.sizes.sidebar_setup.height
  65. width: base.width
  66. Label{
  67. id: globalProfileLabel
  68. anchors.left: parent.left
  69. anchors.leftMargin: UM.Theme.sizes.default_margin.width;
  70. anchors.verticalCenter: parent.verticalCenter
  71. text: catalog.i18nc("@label","Global Profile:");
  72. width: parent.width/100*45
  73. font: UM.Theme.fonts.default;
  74. color: UM.Theme.colors.text_default;
  75. }
  76. ToolButton {
  77. id: globalProfileSelection
  78. text: UM.MachineManager.activeProfile
  79. width: parent.width/100*55
  80. height: UM.Theme.sizes.setting_control.height
  81. anchors.right: parent.right
  82. anchors.rightMargin: UM.Theme.sizes.default_margin.width
  83. anchors.verticalCenter: parent.verticalCenter
  84. tooltip: UM.MachineManager.activeProfile
  85. style: UM.Theme.styles.sidebar_header_button
  86. menu: Menu
  87. {
  88. id: profileSelectionMenu
  89. Instantiator
  90. {
  91. model: UM.ProfilesModel { }
  92. MenuItem
  93. {
  94. text: model.name
  95. checkable: true;
  96. checked: model.active;
  97. exclusiveGroup: profileSelectionMenuGroup;
  98. onTriggered: UM.MachineManager.setActiveProfile(model.name)
  99. }
  100. onObjectAdded: profileSelectionMenu.insertItem(index, object)
  101. onObjectRemoved: profileSelectionMenu.removeItem(object)
  102. }
  103. ExclusiveGroup { id: profileSelectionMenuGroup; }
  104. MenuSeparator { }
  105. MenuItem {
  106. action: base.manageProfilesAction;
  107. }
  108. }
  109. // Button {
  110. // id: saveProfileButton
  111. // visible: true
  112. // anchors.top: parent.top
  113. // x: globalProfileSelection.width + 2
  114. // width: parent.width/100*25
  115. // text: catalog.i18nc("@action:button", "Save");
  116. // height: parent.height
  117. //
  118. // style: ButtonStyle {
  119. // background: Rectangle {
  120. // color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button
  121. // Behavior on color { ColorAnimation { duration: 50; } }
  122. // width: actualLabel.width + UM.Theme.sizes.default_margin.width
  123. // Label {
  124. // id: actualLabel
  125. // anchors.centerIn: parent
  126. // color: UM.Theme.colors.load_save_button_text
  127. // font: UM.Theme.fonts.default
  128. // text: control.text;
  129. // }
  130. // }
  131. // label: Item { }
  132. // }
  133. // }
  134. }
  135. }
  136. }