WorkspaceDialog.qml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. // Copyright (c) 2016 Ultimaker B.V.
  2. // Cura is released under the terms of the AGPLv3 or higher.
  3. import QtQuick 2.1
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Layouts 1.1
  6. import QtQuick.Window 2.1
  7. import UM 1.1 as UM
  8. UM.Dialog
  9. {
  10. title: catalog.i18nc("@title:window", "Import workspace conflict")
  11. width: 350 * Screen.devicePixelRatio;
  12. minimumWidth: 350 * Screen.devicePixelRatio;
  13. maximumWidth: 350 * Screen.devicePixelRatio;
  14. height: 250 * Screen.devicePixelRatio;
  15. minimumHeight: 250 * Screen.devicePixelRatio;
  16. maximumHeight: 250 * Screen.devicePixelRatio;
  17. onClosing: manager.notifyClosed()
  18. onVisibleChanged:
  19. {
  20. if(visible)
  21. {
  22. machineResolveComboBox.currentIndex = 0
  23. qualityChangesResolveComboBox.currentIndex = 0
  24. materialConflictComboBox.currentIndex = 0
  25. }
  26. }
  27. Item
  28. {
  29. anchors.fill: parent
  30. UM.I18nCatalog
  31. {
  32. id: catalog;
  33. name: "cura";
  34. }
  35. ListModel
  36. {
  37. id: resolveStrategiesModel
  38. // Instead of directly adding the list elements, we add them afterwards.
  39. // This is because it's impossible to use setting function results to be bound to listElement properties directly.
  40. // See http://stackoverflow.com/questions/7659442/listelement-fields-as-properties
  41. Component.onCompleted:
  42. {
  43. append({"key": "override", "label": catalog.i18nc("@action:ComboBox option", "Override existing")});
  44. append({"key": "new", "label": catalog.i18nc("@action:ComboBox option", "Create new")});
  45. }
  46. }
  47. Column
  48. {
  49. anchors.fill: parent
  50. Label
  51. {
  52. id: infoLabel
  53. width: parent.width
  54. text: catalog.i18nc("@action:label", "Cura detected a number of conflicts while importing the workspace. How would you like to resolve these?")
  55. wrapMode: Text.Wrap
  56. height: 50
  57. }
  58. UM.TooltipArea
  59. {
  60. id: machineResolveTooltip
  61. width: parent.width
  62. height: visible ? 25 : 0
  63. text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?")
  64. visible: manager.machineConflict
  65. Row
  66. {
  67. width: parent.width
  68. height: childrenRect.height
  69. Label
  70. {
  71. text: catalog.i18nc("@action:label","Machine")
  72. width: 150
  73. }
  74. ComboBox
  75. {
  76. model: resolveStrategiesModel
  77. textRole: "label"
  78. id: machineResolveComboBox
  79. onActivated:
  80. {
  81. manager.setResolveStrategy("machine", resolveStrategiesModel.get(index).key)
  82. }
  83. }
  84. }
  85. }
  86. UM.TooltipArea
  87. {
  88. id: qualityChangesResolveTooltip
  89. width: parent.width
  90. height: visible ? 25 : 0
  91. text: catalog.i18nc("@info:tooltip", "How should the conflict in the profile be resolved?")
  92. visible: manager.qualityChangesConflict
  93. Row
  94. {
  95. width: parent.width
  96. height: childrenRect.height
  97. Label
  98. {
  99. text: catalog.i18nc("@action:label","Profile")
  100. width: 150
  101. }
  102. ComboBox
  103. {
  104. model: resolveStrategiesModel
  105. textRole: "label"
  106. id: qualityChangesResolveComboBox
  107. onActivated:
  108. {
  109. manager.setResolveStrategy("quality_changes", resolveStrategiesModel.get(index).key)
  110. }
  111. }
  112. }
  113. }
  114. UM.TooltipArea
  115. {
  116. id: materialResolveTooltip
  117. width: parent.width
  118. height: visible ? 25 : 0
  119. text: catalog.i18nc("@info:tooltip", "How should the conflict in the material(s) be resolved?")
  120. visible: manager.materialConflict
  121. Row
  122. {
  123. width: parent.width
  124. height: childrenRect.height
  125. Label
  126. {
  127. text: catalog.i18nc("@action:label","Material")
  128. width: 150
  129. }
  130. ComboBox
  131. {
  132. model: resolveStrategiesModel
  133. textRole: "label"
  134. id: materialResolveComboBox
  135. onActivated:
  136. {
  137. manager.setResolveStrategy("material", resolveStrategiesModel.get(index).key)
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. rightButtons: [
  145. Button
  146. {
  147. id: ok_button
  148. text: catalog.i18nc("@action:button","OK");
  149. onClicked: { manager.onOkButtonClicked() }
  150. enabled: true
  151. },
  152. Button
  153. {
  154. id: cancel_button
  155. text: catalog.i18nc("@action:button","Cancel");
  156. onClicked: { manager.onCancelButtonClicked() }
  157. enabled: true
  158. }
  159. ]
  160. }