WorkspaceDialog.qml 13 KB

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