WorkspaceDialog.qml 13 KB

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