WorkspaceDialog.qml 13 KB

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