GeneralPage.qml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Uranium 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.Controls.Styles 1.1
  7. import UM 1.1 as UM
  8. UM.PreferencesPage
  9. {
  10. //: General configuration page title
  11. title: catalog.i18nc("@title:tab","General")
  12. function setDefaultLanguage(languageCode)
  13. {
  14. //loops trough the languageList and sets the language using the languageCode
  15. for(var i = 0; i < languageList.count; i++)
  16. {
  17. if (languageComboBox.model.get(i).code == languageCode)
  18. {
  19. languageComboBox.currentIndex = i
  20. }
  21. }
  22. }
  23. function reset()
  24. {
  25. UM.Preferences.resetPreference("general/language")
  26. var defaultLanguage = UM.Preferences.getValue("general/language")
  27. setDefaultLanguage(defaultLanguage)
  28. UM.Preferences.resetPreference("physics/automatic_push_free")
  29. pushFreeCheckbox.checked = boolCheck(UM.Preferences.getValue("physics/automatic_push_free"))
  30. UM.Preferences.resetPreference("mesh/scale_to_fit")
  31. scaleToFitCheckbox.checked = boolCheck(UM.Preferences.getValue("mesh/scale_to_fit"))
  32. UM.Preferences.resetPreference("mesh/scale_tiny_meshes")
  33. scaleTinyCheckbox.checked = boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes"))
  34. UM.Preferences.resetPreference("cura/jobname_prefix")
  35. prefixJobNameCheckbox.checked = boolCheck(UM.Preferences.getValue("cura/jobname_prefix"))
  36. UM.Preferences.resetPreference("view/show_overhang");
  37. showOverhangCheckbox.checked = boolCheck(UM.Preferences.getValue("view/show_overhang"))
  38. UM.Preferences.resetPreference("view/center_on_select");
  39. centerOnSelectCheckbox.checked = boolCheck(UM.Preferences.getValue("view/center_on_select"))
  40. UM.Preferences.resetPreference("view/top_layer_count");
  41. topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count"))
  42. if (plugins.model.find("id", "SliceInfoPlugin") > -1) {
  43. UM.Preferences.resetPreference("info/send_slice_info")
  44. sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info"))
  45. }
  46. if (plugins.model.find("id", "UpdateChecker") > -1) {
  47. UM.Preferences.resetPreference("info/automatic_update_check")
  48. checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
  49. }
  50. }
  51. Column
  52. {
  53. //: Language selection label
  54. UM.I18nCatalog{id: catalog; name:"cura"}
  55. Label
  56. {
  57. font.bold: true
  58. text: catalog.i18nc("@label","Interface")
  59. }
  60. Row
  61. {
  62. spacing: UM.Theme.getSize("default_margin").width
  63. Label
  64. {
  65. id: languageLabel
  66. text: catalog.i18nc("@label","Language:")
  67. anchors.verticalCenter: languageComboBox.verticalCenter
  68. }
  69. ComboBox
  70. {
  71. id: languageComboBox
  72. model: ListModel
  73. {
  74. id: languageList
  75. Component.onCompleted: {
  76. append({ text: catalog.i18nc("@item:inlistbox", "English"), code: "en" })
  77. append({ text: catalog.i18nc("@item:inlistbox", "Finnish"), code: "fi" })
  78. append({ text: catalog.i18nc("@item:inlistbox", "French"), code: "fr" })
  79. append({ text: catalog.i18nc("@item:inlistbox", "German"), code: "de" })
  80. append({ text: catalog.i18nc("@item:inlistbox", "Italian"), code: "it" })
  81. append({ text: catalog.i18nc("@item:inlistbox", "Dutch"), code: "nl" })
  82. append({ text: catalog.i18nc("@item:inlistbox", "Spanish"), code: "es" })
  83. }
  84. }
  85. currentIndex:
  86. {
  87. var code = UM.Preferences.getValue("general/language");
  88. for(var i = 0; i < languageList.count; ++i)
  89. {
  90. if(model.get(i).code == code)
  91. {
  92. return i
  93. }
  94. }
  95. }
  96. onActivated: UM.Preferences.setValue("general/language", model.get(index).code)
  97. Component.onCompleted:
  98. {
  99. // Because ListModel is stupid and does not allow using qsTr() for values.
  100. for(var i = 0; i < languageList.count; ++i)
  101. {
  102. languageList.setProperty(i, "text", catalog.i18n(languageList.get(i).text));
  103. }
  104. // Glorious hack time. ComboBox does not update the text properly after changing the
  105. // model. So change the indices around to force it to update.
  106. currentIndex += 1;
  107. currentIndex -= 1;
  108. }
  109. }
  110. }
  111. Label
  112. {
  113. id: languageCaption
  114. //: Language change warning
  115. text: catalog.i18nc("@label", "You will need to restart the application for language changes to have effect.")
  116. wrapMode: Text.WordWrap
  117. font.italic: true
  118. }
  119. Item
  120. {
  121. //: Spacer
  122. height: UM.Theme.getSize("default_margin").height
  123. width: UM.Theme.getSize("default_margin").width
  124. }
  125. Label
  126. {
  127. font.bold: true
  128. text: catalog.i18nc("@label","Viewport behavior")
  129. }
  130. UM.TooltipArea
  131. {
  132. width: childrenRect.width;
  133. height: childrenRect.height;
  134. text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.")
  135. CheckBox
  136. {
  137. id: showOverhangCheckbox
  138. checked: boolCheck(UM.Preferences.getValue("view/show_overhang"))
  139. onClicked: UM.Preferences.setValue("view/show_overhang", checked)
  140. text: catalog.i18nc("@option:check","Display overhang");
  141. }
  142. }
  143. UM.TooltipArea {
  144. width: childrenRect.width;
  145. height: childrenRect.height;
  146. text: catalog.i18nc("@info:tooltip","Moves the camera so the model is in the center of the view when an model is selected")
  147. CheckBox
  148. {
  149. id: centerOnSelectCheckbox
  150. text: catalog.i18nc("@action:button","Center camera when item is selected");
  151. checked: boolCheck(UM.Preferences.getValue("view/center_on_select"))
  152. onClicked: UM.Preferences.setValue("view/center_on_select", checked)
  153. }
  154. }
  155. UM.TooltipArea {
  156. width: childrenRect.width
  157. height: childrenRect.height
  158. text: catalog.i18nc("@info:tooltip", "Should models on the platform be moved so that they no longer intersect?")
  159. CheckBox
  160. {
  161. id: pushFreeCheckbox
  162. text: catalog.i18nc("@option:check", "Ensure models are kept apart")
  163. checked: boolCheck(UM.Preferences.getValue("physics/automatic_push_free"))
  164. onCheckedChanged: UM.Preferences.setValue("physics/automatic_push_free", checked)
  165. }
  166. }
  167. UM.TooltipArea {
  168. width: childrenRect.width;
  169. height: childrenRect.height;
  170. text: catalog.i18nc("@info:tooltip","Display 5 top layers in layer view or only the top-most layer. Rendering 5 layers takes longer, but may show more information.")
  171. CheckBox
  172. {
  173. id: topLayerCountCheckbox
  174. text: catalog.i18nc("@action:button","Display five top layers in layer view");
  175. checked: UM.Preferences.getValue("view/top_layer_count") == 5
  176. onClicked:
  177. {
  178. if(UM.Preferences.getValue("view/top_layer_count") == 5)
  179. {
  180. UM.Preferences.setValue("view/top_layer_count", 1)
  181. }
  182. else
  183. {
  184. UM.Preferences.setValue("view/top_layer_count", 5)
  185. }
  186. }
  187. }
  188. }
  189. UM.TooltipArea {
  190. width: childrenRect.width
  191. height: childrenRect.height
  192. text: catalog.i18nc("@info:tooltip", "Should only the top layers be displayed in layerview?")
  193. CheckBox
  194. {
  195. id: topLayersOnlyCheckbox
  196. text: catalog.i18nc("@option:check", "Only display top layer(s) in layer view")
  197. checked: boolCheck(UM.Preferences.getValue("view/only_show_top_layers"))
  198. onCheckedChanged: UM.Preferences.setValue("view/only_show_top_layers", checked)
  199. }
  200. }
  201. Item
  202. {
  203. //: Spacer
  204. height: UM.Theme.getSize("default_margin").height
  205. width: UM.Theme.getSize("default_margin").height
  206. }
  207. Label
  208. {
  209. font.bold: true
  210. text: catalog.i18nc("@label","Opening files")
  211. }
  212. UM.TooltipArea {
  213. width: childrenRect.width
  214. height: childrenRect.height
  215. text: catalog.i18nc("@info:tooltip","Should models be scaled to the build volume if they are too large?")
  216. CheckBox
  217. {
  218. id: scaleToFitCheckbox
  219. text: catalog.i18nc("@option:check","Scale large models")
  220. checked: boolCheck(UM.Preferences.getValue("mesh/scale_to_fit"))
  221. onCheckedChanged: UM.Preferences.setValue("mesh/scale_to_fit", checked)
  222. }
  223. }
  224. UM.TooltipArea {
  225. width: childrenRect.width
  226. height: childrenRect.height
  227. text: catalog.i18nc("@info:tooltip","An model may appear extremely small if its unit is for example in meters rather than millimeters. Should these models be scaled up?")
  228. CheckBox
  229. {
  230. id: scaleTinyCheckbox
  231. text: catalog.i18nc("@option:check","Scale extremely small models")
  232. checked: boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes"))
  233. onCheckedChanged: UM.Preferences.setValue("mesh/scale_tiny_meshes", checked)
  234. }
  235. }
  236. UM.TooltipArea {
  237. width: childrenRect.width
  238. height: childrenRect.height
  239. text: catalog.i18nc("@info:tooltip", "Should a prefix based on the printer name be added to the print job name automatically?")
  240. CheckBox
  241. {
  242. id: prefixJobNameCheckbox
  243. text: catalog.i18nc("@option:check", "Add machine prefix to job name")
  244. checked: boolCheck(UM.Preferences.getValue("cura/jobname_prefix"))
  245. onCheckedChanged: UM.Preferences.setValue("cura/jobname_prefix", checked)
  246. }
  247. }
  248. Item
  249. {
  250. //: Spacer
  251. height: UM.Theme.getSize("default_margin").height
  252. width: UM.Theme.getSize("default_margin").height
  253. }
  254. Label
  255. {
  256. font.bold: true
  257. visible: checkUpdatesCheckbox.visible || sendDataCheckbox.visible
  258. text: catalog.i18nc("@label","Privacy")
  259. }
  260. UM.TooltipArea {
  261. visible: plugins.model.find("id", "UpdateChecker") > -1
  262. width: childrenRect.width
  263. height: visible ? childrenRect.height : 0
  264. text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
  265. CheckBox
  266. {
  267. id: checkUpdatesCheckbox
  268. text: catalog.i18nc("@option:check","Check for updates on start")
  269. checked: boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
  270. onCheckedChanged: UM.Preferences.setValue("info/automatic_update_check", checked)
  271. }
  272. }
  273. UM.TooltipArea {
  274. visible: plugins.model.find("id", "SliceInfoPlugin") > -1
  275. width: childrenRect.width
  276. height: visible ? childrenRect.height : 0
  277. text: catalog.i18nc("@info:tooltip","Should anonymous data about your print be sent to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.")
  278. CheckBox
  279. {
  280. id: sendDataCheckbox
  281. text: catalog.i18nc("@option:check","Send (anonymous) print information")
  282. checked: boolCheck(UM.Preferences.getValue("info/send_slice_info"))
  283. onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked)
  284. }
  285. }
  286. //: Invisible list used to check if a plugin exists
  287. ListView
  288. {
  289. id: plugins
  290. model: UM.PluginsModel { }
  291. visible: false
  292. }
  293. }
  294. }