GeneralPage.qml 13 KB

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