WorkspaceDialog.qml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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: ListModel
  101. {
  102. Component.onCompleted:
  103. {
  104. append({"key": "override", "label": catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName});
  105. append({"key": "new", "label": catalog.i18nc("@action:ComboBox option", "Create new")});
  106. }
  107. }
  108. Connections
  109. {
  110. target: manager
  111. onMachineNameChanged:
  112. {
  113. machineResolveComboBox.model.get(0).label = catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName;
  114. }
  115. }
  116. textRole: "label"
  117. id: machineResolveComboBox
  118. width: parent.width
  119. onActivated:
  120. {
  121. manager.setResolveStrategy("machine", resolveStrategiesModel.get(index).key)
  122. }
  123. }
  124. }
  125. }
  126. Row
  127. {
  128. width: parent.width
  129. height: childrenRect.height
  130. Label
  131. {
  132. text: catalog.i18nc("@action:label", "Type")
  133. width: (parent.width / 3) | 0
  134. }
  135. Label
  136. {
  137. text: manager.machineType
  138. width: (parent.width / 3) | 0
  139. }
  140. }
  141. Row
  142. {
  143. width: parent.width
  144. height: childrenRect.height
  145. Label
  146. {
  147. text: catalog.i18nc("@action:label", manager.isPrinterGroup ? "Printer Group" : "Printer Name")
  148. width: (parent.width / 3) | 0
  149. }
  150. Label
  151. {
  152. text: manager.machineName
  153. width: (parent.width / 3) | 0
  154. }
  155. }
  156. Item // Spacer
  157. {
  158. height: spacerHeight
  159. width: height
  160. }
  161. Row
  162. {
  163. height: childrenRect.height
  164. width: parent.width
  165. Label
  166. {
  167. text: catalog.i18nc("@action:label", "Profile settings")
  168. font.bold: true
  169. width: (parent.width / 3) | 0
  170. }
  171. Item
  172. {
  173. // spacer
  174. height: spacerHeight
  175. width: (parent.width / 3) | 0
  176. }
  177. UM.TooltipArea
  178. {
  179. id: qualityChangesResolveTooltip
  180. width: (parent.width / 3) | 0
  181. height: visible ? comboboxHeight : 0
  182. visible: manager.qualityChangesConflict
  183. text: catalog.i18nc("@info:tooltip", "How should the conflict in the profile be resolved?")
  184. ComboBox
  185. {
  186. model: resolveStrategiesModel
  187. textRole: "label"
  188. id: qualityChangesResolveComboBox
  189. width: parent.width
  190. onActivated:
  191. {
  192. manager.setResolveStrategy("quality_changes", resolveStrategiesModel.get(index).key)
  193. }
  194. }
  195. }
  196. }
  197. Row
  198. {
  199. width: parent.width
  200. height: childrenRect.height
  201. Label
  202. {
  203. text: catalog.i18nc("@action:label", "Name")
  204. width: (parent.width / 3) | 0
  205. }
  206. Label
  207. {
  208. text: manager.qualityName
  209. width: (parent.width / 3) | 0
  210. }
  211. }
  212. Row
  213. {
  214. width: parent.width
  215. height: manager.numUserSettings != 0 ? childrenRect.height : 0
  216. Label
  217. {
  218. text: catalog.i18nc("@action:label", "Not in profile")
  219. width: (parent.width / 3) | 0
  220. }
  221. Label
  222. {
  223. text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings)
  224. width: (parent.width / 3) | 0
  225. }
  226. visible: manager.numUserSettings != 0
  227. }
  228. Row
  229. {
  230. width: parent.width
  231. height: manager.numSettingsOverridenByQualityChanges != 0 ? childrenRect.height : 0
  232. Label
  233. {
  234. text: catalog.i18nc("@action:label", "Derivative from")
  235. width: (parent.width / 3) | 0
  236. }
  237. Label
  238. {
  239. text: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges)
  240. width: (parent.width / 3) | 0
  241. }
  242. visible: manager.numSettingsOverridenByQualityChanges != 0
  243. }
  244. Item // Spacer
  245. {
  246. height: spacerHeight
  247. width: height
  248. }
  249. Row
  250. {
  251. height: childrenRect.height
  252. width: parent.width
  253. Label
  254. {
  255. text: catalog.i18nc("@action:label", "Material settings")
  256. font.bold: true
  257. width: (parent.width / 3) | 0
  258. }
  259. Item
  260. {
  261. // spacer
  262. height: spacerHeight
  263. width: (parent.width / 3) | 0
  264. }
  265. UM.TooltipArea
  266. {
  267. id: materialResolveTooltip
  268. width: (parent.width / 3) | 0
  269. height: visible ? comboboxHeight : 0
  270. visible: manager.materialConflict
  271. text: catalog.i18nc("@info:tooltip", "How should the conflict in the material be resolved?")
  272. ComboBox
  273. {
  274. model: resolveStrategiesModel
  275. textRole: "label"
  276. id: materialResolveComboBox
  277. width: parent.width
  278. onActivated:
  279. {
  280. manager.setResolveStrategy("material", resolveStrategiesModel.get(index).key)
  281. }
  282. }
  283. }
  284. }
  285. Repeater
  286. {
  287. model: manager.materialLabels
  288. delegate: Row
  289. {
  290. width: parent.width
  291. height: childrenRect.height
  292. Label
  293. {
  294. text: catalog.i18nc("@action:label", "Name")
  295. width: (parent.width / 3) | 0
  296. }
  297. Label
  298. {
  299. text: modelData
  300. width: (parent.width / 3) | 0
  301. }
  302. }
  303. }
  304. Item // Spacer
  305. {
  306. height: spacerHeight
  307. width: height
  308. }
  309. Label
  310. {
  311. text: catalog.i18nc("@action:label", "Setting visibility")
  312. font.bold: true
  313. }
  314. Row
  315. {
  316. width: parent.width
  317. height: childrenRect.height
  318. Label
  319. {
  320. text: catalog.i18nc("@action:label", "Mode")
  321. width: (parent.width / 3) | 0
  322. }
  323. Label
  324. {
  325. text: manager.activeMode
  326. width: (parent.width / 3) | 0
  327. }
  328. }
  329. Row
  330. {
  331. width: parent.width
  332. height: childrenRect.height
  333. visible: manager.hasVisibleSettingsField
  334. Label
  335. {
  336. text: catalog.i18nc("@action:label", "Visible settings:")
  337. width: (parent.width / 3) | 0
  338. }
  339. Label
  340. {
  341. text: catalog.i18nc("@action:label", "%1 out of %2" ).arg(manager.numVisibleSettings).arg(manager.totalNumberOfSettings)
  342. width: (parent.width / 3) | 0
  343. }
  344. }
  345. Item // Spacer
  346. {
  347. height: spacerHeight
  348. width: height
  349. }
  350. Row
  351. {
  352. width: parent.width
  353. height: childrenRect.height
  354. visible: manager.hasObjectsOnPlate
  355. UM.RecolorImage
  356. {
  357. width: warningLabel.height
  358. height: width
  359. source: UM.Theme.getIcon("notice")
  360. color: palette.text
  361. }
  362. Label
  363. {
  364. id: warningLabel
  365. text: catalog.i18nc("@action:warning", "Loading a project will clear all models on the build plate.")
  366. wrapMode: Text.Wrap
  367. }
  368. }
  369. }
  370. Button
  371. {
  372. id: cancel_button
  373. text: catalog.i18nc("@action:button","Cancel");
  374. onClicked: { manager.onCancelButtonClicked() }
  375. enabled: true
  376. anchors.bottom: parent.bottom
  377. anchors.right: ok_button.left
  378. anchors.rightMargin: 2 * screenScaleFactor
  379. }
  380. Button
  381. {
  382. id: ok_button
  383. text: catalog.i18nc("@action:button","Open");
  384. onClicked: { manager.closeBackend(); manager.onOkButtonClicked() }
  385. anchors.bottom: parent.bottom
  386. anchors.right: parent.right
  387. }
  388. }
  389. function accept() {
  390. manager.closeBackend();
  391. manager.onOkButtonClicked();
  392. base.visible = false;
  393. base.accept();
  394. }
  395. function reject() {
  396. manager.onCancelButtonClicked();
  397. base.visible = false;
  398. base.rejected();
  399. }
  400. }