WorkspaceDialog.qml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. // Copyright (c) 2016 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Layouts 1.3
  6. import QtQuick.Window 2.2
  7. import UM 1.1 as UM
  8. UM.Dialog
  9. {
  10. id: base
  11. title: catalog.i18nc("@title:window", "Open Project")
  12. minimumWidth: UM.Theme.getSize("popup_dialog").width
  13. minimumHeight: UM.Theme.getSize("popup_dialog").height
  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 Update/override existing profile", "Update existing")});
  50. append({"key": "new", "label": catalog.i18nc("@action:ComboBox Save settings in a new profile", "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: childrenRect.height
  216. Label
  217. {
  218. text: catalog.i18nc("@action:label", "Intent")
  219. width: (parent.width / 3) | 0
  220. }
  221. Label
  222. {
  223. text: manager.intentName
  224. width: (parent.width / 3) | 0
  225. }
  226. }
  227. Row
  228. {
  229. width: parent.width
  230. height: manager.numUserSettings != 0 ? childrenRect.height : 0
  231. Label
  232. {
  233. text: catalog.i18nc("@action:label", "Not in profile")
  234. width: (parent.width / 3) | 0
  235. }
  236. Label
  237. {
  238. text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings)
  239. width: (parent.width / 3) | 0
  240. }
  241. visible: manager.numUserSettings != 0
  242. }
  243. Row
  244. {
  245. width: parent.width
  246. height: manager.numSettingsOverridenByQualityChanges != 0 ? childrenRect.height : 0
  247. Label
  248. {
  249. text: catalog.i18nc("@action:label", "Derivative from")
  250. width: (parent.width / 3) | 0
  251. }
  252. Label
  253. {
  254. text: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges)
  255. width: (parent.width / 3) | 0
  256. }
  257. visible: manager.numSettingsOverridenByQualityChanges != 0
  258. }
  259. Item // Spacer
  260. {
  261. height: spacerHeight
  262. width: height
  263. }
  264. Row
  265. {
  266. height: childrenRect.height
  267. width: parent.width
  268. Label
  269. {
  270. text: catalog.i18nc("@action:label", "Material settings")
  271. font.bold: true
  272. width: (parent.width / 3) | 0
  273. }
  274. Item
  275. {
  276. // spacer
  277. height: spacerHeight
  278. width: (parent.width / 3) | 0
  279. }
  280. UM.TooltipArea
  281. {
  282. id: materialResolveTooltip
  283. width: (parent.width / 3) | 0
  284. height: visible ? comboboxHeight : 0
  285. visible: manager.materialConflict
  286. text: catalog.i18nc("@info:tooltip", "How should the conflict in the material be resolved?")
  287. ComboBox
  288. {
  289. model: resolveStrategiesModel
  290. textRole: "label"
  291. id: materialResolveComboBox
  292. width: parent.width
  293. onActivated:
  294. {
  295. manager.setResolveStrategy("material", resolveStrategiesModel.get(index).key)
  296. }
  297. }
  298. }
  299. }
  300. Repeater
  301. {
  302. model: manager.materialLabels
  303. delegate: Row
  304. {
  305. width: parent.width
  306. height: childrenRect.height
  307. Label
  308. {
  309. text: catalog.i18nc("@action:label", "Name")
  310. width: (parent.width / 3) | 0
  311. }
  312. Label
  313. {
  314. text: modelData
  315. width: (parent.width / 3) | 0
  316. }
  317. }
  318. }
  319. Item // Spacer
  320. {
  321. height: spacerHeight
  322. width: height
  323. }
  324. Label
  325. {
  326. text: catalog.i18nc("@action:label", "Setting visibility")
  327. font.bold: true
  328. }
  329. Row
  330. {
  331. width: parent.width
  332. height: childrenRect.height
  333. Label
  334. {
  335. text: catalog.i18nc("@action:label", "Mode")
  336. width: (parent.width / 3) | 0
  337. }
  338. Label
  339. {
  340. text: manager.activeMode
  341. width: (parent.width / 3) | 0
  342. }
  343. }
  344. Row
  345. {
  346. width: parent.width
  347. height: childrenRect.height
  348. visible: manager.hasVisibleSettingsField
  349. Label
  350. {
  351. text: catalog.i18nc("@action:label", "Visible settings:")
  352. width: (parent.width / 3) | 0
  353. }
  354. Label
  355. {
  356. text: catalog.i18nc("@action:label", "%1 out of %2" ).arg(manager.numVisibleSettings).arg(manager.totalNumberOfSettings)
  357. width: (parent.width / 3) | 0
  358. }
  359. }
  360. Item // Spacer
  361. {
  362. height: spacerHeight
  363. width: height
  364. }
  365. Row
  366. {
  367. width: parent.width
  368. height: childrenRect.height
  369. visible: manager.hasObjectsOnPlate
  370. UM.RecolorImage
  371. {
  372. width: warningLabel.height
  373. height: width
  374. source: UM.Theme.getIcon("notice")
  375. color: palette.text
  376. }
  377. Label
  378. {
  379. id: warningLabel
  380. text: catalog.i18nc("@action:warning", "Loading a project will clear all models on the build plate.")
  381. wrapMode: Text.Wrap
  382. }
  383. }
  384. }
  385. Button
  386. {
  387. id: cancel_button
  388. text: catalog.i18nc("@action:button","Cancel");
  389. onClicked: { manager.onCancelButtonClicked() }
  390. enabled: true
  391. anchors.bottom: parent.bottom
  392. anchors.right: ok_button.left
  393. anchors.rightMargin: 2 * screenScaleFactor
  394. }
  395. Button
  396. {
  397. id: ok_button
  398. text: catalog.i18nc("@action:button","Open");
  399. onClicked: { manager.closeBackend(); manager.onOkButtonClicked() }
  400. anchors.bottom: parent.bottom
  401. anchors.right: parent.right
  402. }
  403. }
  404. function accept() {
  405. manager.closeBackend();
  406. manager.onOkButtonClicked();
  407. base.visible = false;
  408. base.accept();
  409. }
  410. function reject() {
  411. manager.onCancelButtonClicked();
  412. base.visible = false;
  413. base.rejected();
  414. }
  415. }