WorkspaceDialog.qml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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", "Open Project")
  11. width: 500
  12. height: 400
  13. property int comboboxHeight: 15
  14. property int spacerHeight: 10
  15. onClosing: manager.notifyClosed()
  16. onVisibleChanged:
  17. {
  18. if(visible)
  19. {
  20. machineResolveComboBox.currentIndex = 0
  21. qualityChangesResolveComboBox.currentIndex = 0
  22. materialResolveComboBox.currentIndex = 0
  23. }
  24. }
  25. Item
  26. {
  27. anchors.fill: parent
  28. anchors.margins: 20
  29. UM.I18nCatalog
  30. {
  31. id: catalog
  32. name: "cura"
  33. }
  34. SystemPalette
  35. {
  36. id: palette
  37. }
  38. ListModel
  39. {
  40. id: resolveStrategiesModel
  41. // Instead of directly adding the list elements, we add them afterwards.
  42. // This is because it's impossible to use setting function results to be bound to listElement properties directly.
  43. // See http://stackoverflow.com/questions/7659442/listelement-fields-as-properties
  44. Component.onCompleted:
  45. {
  46. append({"key": "override", "label": catalog.i18nc("@action:ComboBox option", "Update existing")});
  47. append({"key": "new", "label": catalog.i18nc("@action:ComboBox option", "Create new")});
  48. }
  49. }
  50. Column
  51. {
  52. anchors.fill: parent
  53. spacing: 2
  54. Label
  55. {
  56. id: titleLabel
  57. text: catalog.i18nc("@action:title", "Summary - Cura Project")
  58. font.pointSize: 18
  59. }
  60. Rectangle
  61. {
  62. id: separator
  63. color: palette.text
  64. width: parent.width
  65. height: 1
  66. }
  67. Item // Spacer
  68. {
  69. height: spacerHeight
  70. width: height
  71. }
  72. Row
  73. {
  74. height: childrenRect.height
  75. width: parent.width
  76. Label
  77. {
  78. text: catalog.i18nc("@action:label", "Printer settings")
  79. font.bold: true
  80. width: parent.width / 3
  81. }
  82. Item
  83. {
  84. // spacer
  85. height: spacerHeight
  86. width: parent.width / 3
  87. }
  88. UM.TooltipArea
  89. {
  90. id: machineResolveTooltip
  91. width: parent.width / 3
  92. height: visible ? comboboxHeight : 0
  93. visible: manager.machineConflict
  94. text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?")
  95. ComboBox
  96. {
  97. model: resolveStrategiesModel
  98. textRole: "label"
  99. id: machineResolveComboBox
  100. width: parent.width
  101. onActivated:
  102. {
  103. manager.setResolveStrategy("machine", resolveStrategiesModel.get(index).key)
  104. }
  105. }
  106. }
  107. }
  108. Row
  109. {
  110. width: parent.width
  111. height: childrenRect.height
  112. Label
  113. {
  114. text: catalog.i18nc("@action:label", "Type")
  115. width: parent.width / 3
  116. }
  117. Label
  118. {
  119. text: manager.machineType
  120. width: parent.width / 3
  121. }
  122. }
  123. Row
  124. {
  125. width: parent.width
  126. height: childrenRect.height
  127. Label
  128. {
  129. text: catalog.i18nc("@action:label", "Name")
  130. width: parent.width / 3
  131. }
  132. Label
  133. {
  134. text: manager.machineName
  135. width: parent.width / 3
  136. }
  137. }
  138. Item // Spacer
  139. {
  140. height: spacerHeight
  141. width: height
  142. }
  143. Row
  144. {
  145. height: childrenRect.height
  146. width: parent.width
  147. Label
  148. {
  149. text: catalog.i18nc("@action:label", "Profile settings")
  150. font.bold: true
  151. width: parent.width / 3
  152. }
  153. Item
  154. {
  155. // spacer
  156. height: spacerHeight
  157. width: parent.width / 3
  158. }
  159. UM.TooltipArea
  160. {
  161. id: qualityChangesResolveTooltip
  162. width: parent.width / 3
  163. height: visible ? comboboxHeight : 0
  164. visible: manager.qualityChangesConflict
  165. text: catalog.i18nc("@info:tooltip", "How should the conflict in the profile be resolved?")
  166. ComboBox
  167. {
  168. model: resolveStrategiesModel
  169. textRole: "label"
  170. id: qualityChangesResolveComboBox
  171. width: parent.width
  172. onActivated:
  173. {
  174. manager.setResolveStrategy("quality_changes", resolveStrategiesModel.get(index).key)
  175. }
  176. }
  177. }
  178. }
  179. Row
  180. {
  181. width: parent.width
  182. height: childrenRect.height
  183. Label
  184. {
  185. text: catalog.i18nc("@action:label", "Name")
  186. width: parent.width / 3
  187. }
  188. Label
  189. {
  190. text: manager.qualityName
  191. width: parent.width / 3
  192. }
  193. }
  194. Row
  195. {
  196. width: parent.width
  197. height: manager.numUserSettings != 0 ? childrenRect.height : 0
  198. Label
  199. {
  200. text: catalog.i18nc("@action:label", "Not in profile")
  201. width: parent.width / 3
  202. }
  203. Label
  204. {
  205. text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings)
  206. width: parent.width / 3
  207. }
  208. visible: manager.numUserSettings != 0
  209. }
  210. Row
  211. {
  212. width: parent.width
  213. height: manager.numSettingsOverridenByQualityChanges != 0 ? childrenRect.height : 0
  214. Label
  215. {
  216. text: catalog.i18nc("@action:label", "Derivative from")
  217. width: parent.width / 3
  218. }
  219. Label
  220. {
  221. text: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges)
  222. width: parent.width / 3
  223. }
  224. visible: manager.numSettingsOverridenByQualityChanges != 0
  225. }
  226. Item // Spacer
  227. {
  228. height: spacerHeight
  229. width: height
  230. }
  231. Row
  232. {
  233. height: childrenRect.height
  234. width: parent.width
  235. Label
  236. {
  237. text: catalog.i18nc("@action:label", "Material settings")
  238. font.bold: true
  239. width: parent.width / 3
  240. }
  241. Item
  242. {
  243. // spacer
  244. height: spacerHeight
  245. width: parent.width / 3
  246. }
  247. UM.TooltipArea
  248. {
  249. id: materialResolveTooltip
  250. width: parent.width / 3
  251. height: visible ? comboboxHeight : 0
  252. visible: manager.materialConflict
  253. text: catalog.i18nc("@info:tooltip", "How should the conflict in the material be resolved?")
  254. ComboBox
  255. {
  256. model: resolveStrategiesModel
  257. textRole: "label"
  258. id: materialResolveComboBox
  259. width: parent.width
  260. onActivated:
  261. {
  262. manager.setResolveStrategy("material", resolveStrategiesModel.get(index).key)
  263. }
  264. }
  265. }
  266. }
  267. Repeater
  268. {
  269. model: manager.materialLabels
  270. delegate: Row
  271. {
  272. width: parent.width
  273. height: childrenRect.height
  274. Label
  275. {
  276. text: catalog.i18nc("@action:label", "Name")
  277. width: parent.width / 3
  278. }
  279. Label
  280. {
  281. text: modelData
  282. width: parent.width / 3
  283. }
  284. }
  285. }
  286. Item // Spacer
  287. {
  288. height: spacerHeight
  289. width: height
  290. }
  291. Label
  292. {
  293. text: catalog.i18nc("@action:label", "Setting visibility")
  294. font.bold: true
  295. }
  296. Row
  297. {
  298. width: parent.width
  299. height: childrenRect.height
  300. Label
  301. {
  302. text: catalog.i18nc("@action:label", "Mode")
  303. width: parent.width / 3
  304. }
  305. Label
  306. {
  307. text: manager.activeMode
  308. width: parent.width / 3
  309. }
  310. }
  311. Row
  312. {
  313. width: parent.width
  314. height: childrenRect.height
  315. Label
  316. {
  317. text: catalog.i18nc("@action:label", "Visible settings:")
  318. width: parent.width / 3
  319. }
  320. Label
  321. {
  322. text: catalog.i18nc("@action:label", "%1 out of %2" ).arg(manager.numVisibleSettings).arg(manager.totalNumberOfSettings)
  323. width: parent.width / 3
  324. }
  325. }
  326. Item // Spacer
  327. {
  328. height: spacerHeight
  329. width: height
  330. }
  331. Row
  332. {
  333. width: parent.width
  334. height: childrenRect.height
  335. visible: manager.hasObjectsOnPlate
  336. UM.RecolorImage
  337. {
  338. width: warningLabel.height
  339. height: width
  340. source: UM.Theme.getIcon("notice")
  341. color: palette.text
  342. }
  343. Label
  344. {
  345. id: warningLabel
  346. text: catalog.i18nc("@action:warning", "Loading a project will clear all models on the buildplate")
  347. wrapMode: Text.Wrap
  348. }
  349. }
  350. }
  351. Button
  352. {
  353. id: cancel_button
  354. text: catalog.i18nc("@action:button","Cancel");
  355. onClicked: { manager.onCancelButtonClicked() }
  356. enabled: true
  357. anchors.bottom: parent.bottom
  358. anchors.right: ok_button.left
  359. anchors.rightMargin:2
  360. }
  361. Button
  362. {
  363. id: ok_button
  364. text: catalog.i18nc("@action:button","Open");
  365. onClicked: { manager.closeBackend(); manager.onOkButtonClicked() }
  366. anchors.bottom: parent.bottom
  367. anchors.right: parent.right
  368. }
  369. }
  370. }