WorkspaceDialog.qml 12 KB

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