GeneralPage.qml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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. Label
  63. {
  64. id: languageLabel
  65. text: catalog.i18nc("@label","Language:")
  66. anchors.verticalCenter: languageComboBox.verticalCenter
  67. }
  68. ComboBox
  69. {
  70. id: languageComboBox
  71. model: ListModel
  72. {
  73. id: languageList
  74. Component.onCompleted: {
  75. append({ text: catalog.i18nc("@item:inlistbox", "English"), code: "en" })
  76. append({ text: catalog.i18nc("@item:inlistbox", "Finnish"), code: "fi" })
  77. append({ text: catalog.i18nc("@item:inlistbox", "French"), code: "fr" })
  78. append({ text: catalog.i18nc("@item:inlistbox", "German"), code: "de" })
  79. append({ text: catalog.i18nc("@item:inlistbox", "Italian"), code: "it" })
  80. append({ text: catalog.i18nc("@item:inlistbox", "Dutch"), code: "nl" })
  81. append({ text: catalog.i18nc("@item:inlistbox", "Spanish"), code: "es" })
  82. }
  83. }
  84. currentIndex:
  85. {
  86. var code = UM.Preferences.getValue("general/language");
  87. for(var i = 0; i < languageList.count; ++i)
  88. {
  89. if(model.get(i).code == code)
  90. {
  91. return i
  92. }
  93. }
  94. }
  95. onActivated: UM.Preferences.setValue("general/language", model.get(index).code)
  96. Component.onCompleted:
  97. {
  98. // Because ListModel is stupid and does not allow using qsTr() for values.
  99. for(var i = 0; i < languageList.count; ++i)
  100. {
  101. languageList.setProperty(i, "text", catalog.i18n(languageList.get(i).text));
  102. }
  103. // Glorious hack time. ComboBox does not update the text properly after changing the
  104. // model. So change the indices around to force it to update.
  105. currentIndex += 1;
  106. currentIndex -= 1;
  107. }
  108. }
  109. }
  110. Label
  111. {
  112. id: languageCaption
  113. //: Language change warning
  114. text: catalog.i18nc("@label", "You will need to restart the application for language changes to have effect.")
  115. wrapMode: Text.WordWrap
  116. font.italic: true
  117. }
  118. Item
  119. {
  120. //: Spacer
  121. height: UM.Theme.getSize("default_margin").height
  122. width: UM.Theme.getSize("default_margin").width
  123. }
  124. Label
  125. {
  126. font.bold: true
  127. text: catalog.i18nc("@label","Viewport behavior")
  128. }
  129. UM.TooltipArea
  130. {
  131. width: childrenRect.width;
  132. height: childrenRect.height;
  133. text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.")
  134. CheckBox
  135. {
  136. id: showOverhangCheckbox
  137. checked: boolCheck(UM.Preferences.getValue("view/show_overhang"))
  138. onClicked: UM.Preferences.setValue("view/show_overhang", checked)
  139. text: catalog.i18nc("@option:check","Display overhang");
  140. }
  141. }
  142. UM.TooltipArea {
  143. width: childrenRect.width;
  144. height: childrenRect.height;
  145. text: catalog.i18nc("@info:tooltip","Moves the camera so the object is in the center of the view when an object is selected")
  146. CheckBox
  147. {
  148. id: centerOnSelectCheckbox
  149. text: catalog.i18nc("@action:button","Center camera when item is selected");
  150. checked: boolCheck(UM.Preferences.getValue("view/center_on_select"))
  151. onClicked: UM.Preferences.setValue("view/center_on_select", checked)
  152. }
  153. }
  154. UM.TooltipArea {
  155. width: childrenRect.width
  156. height: childrenRect.height
  157. text: catalog.i18nc("@info:tooltip", "Should objects on the platform be moved so that they no longer intersect?")
  158. CheckBox
  159. {
  160. id: pushFreeCheckbox
  161. text: catalog.i18nc("@option:check", "Ensure objects are kept apart")
  162. checked: boolCheck(UM.Preferences.getValue("physics/automatic_push_free"))
  163. onCheckedChanged: UM.Preferences.setValue("physics/automatic_push_free", checked)
  164. }
  165. }
  166. UM.TooltipArea {
  167. width: childrenRect.width;
  168. height: childrenRect.height;
  169. 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.")
  170. CheckBox
  171. {
  172. id: topLayerCountCheckbox
  173. text: catalog.i18nc("@action:button","Display five top layers in layer view");
  174. checked: UM.Preferences.getValue("view/top_layer_count") == 5
  175. onClicked:
  176. {
  177. if(UM.Preferences.getValue("view/top_layer_count") == 5)
  178. {
  179. UM.Preferences.setValue("view/top_layer_count", 1)
  180. }
  181. else
  182. {
  183. UM.Preferences.setValue("view/top_layer_count", 5)
  184. }
  185. }
  186. }
  187. }
  188. Item
  189. {
  190. //: Spacer
  191. height: UM.Theme.getSize("default_margin").height
  192. width: UM.Theme.getSize("default_margin").height
  193. }
  194. Label
  195. {
  196. font.bold: true
  197. text: catalog.i18nc("@label","Opening files")
  198. }
  199. UM.TooltipArea {
  200. width: childrenRect.width
  201. height: childrenRect.height
  202. text: catalog.i18nc("@info:tooltip","Should objects be scaled to the build volume if they are too large?")
  203. CheckBox
  204. {
  205. id: scaleToFitCheckbox
  206. text: catalog.i18nc("@option:check","Scale large objects")
  207. checked: boolCheck(UM.Preferences.getValue("mesh/scale_to_fit"))
  208. onCheckedChanged: UM.Preferences.setValue("mesh/scale_to_fit", checked)
  209. }
  210. }
  211. UM.TooltipArea {
  212. width: childrenRect.width
  213. height: childrenRect.height
  214. text: catalog.i18nc("@info:tooltip","An object may appear extremely small if its unit is for example in meters rather than millimeters. Should these objects be scaled up?")
  215. CheckBox
  216. {
  217. id: scaleTinyCheckbox
  218. text: catalog.i18nc("@option:check","Scale extremely small objects")
  219. checked: boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes"))
  220. onCheckedChanged: UM.Preferences.setValue("mesh/scale_tiny_meshes", checked)
  221. }
  222. }
  223. UM.TooltipArea {
  224. width: childrenRect.width
  225. height: childrenRect.height
  226. text: catalog.i18nc("@info:tooltip", "Should a prefix based on the printer name be added to the print job name automatically?")
  227. CheckBox
  228. {
  229. id: prefixJobNameCheckbox
  230. text: catalog.i18nc("@option:check", "Add machine prefix to job name")
  231. checked: boolCheck(UM.Preferences.getValue("cura/jobname_prefix"))
  232. onCheckedChanged: UM.Preferences.setValue("cura/jobname_prefix", checked)
  233. }
  234. }
  235. Item
  236. {
  237. //: Spacer
  238. height: UM.Theme.getSize("default_margin").height
  239. width: UM.Theme.getSize("default_margin").height
  240. }
  241. Label
  242. {
  243. font.bold: true
  244. visible: checkUpdatesCheckbox.visible || sendDataCheckbox.visible
  245. text: catalog.i18nc("@label","Privacy")
  246. }
  247. UM.TooltipArea {
  248. visible: plugins.model.find("id", "UpdateChecker") > -1
  249. width: childrenRect.width
  250. height: visible ? childrenRect.height : 0
  251. text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
  252. CheckBox
  253. {
  254. id: checkUpdatesCheckbox
  255. text: catalog.i18nc("@option:check","Check for updates on start")
  256. checked: boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
  257. onCheckedChanged: UM.Preferences.setValue("info/automatic_update_check", checked)
  258. }
  259. }
  260. UM.TooltipArea {
  261. visible: plugins.model.find("id", "SliceInfoPlugin") > -1
  262. width: childrenRect.width
  263. height: visible ? childrenRect.height : 0
  264. 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.")
  265. CheckBox
  266. {
  267. id: sendDataCheckbox
  268. text: catalog.i18nc("@option:check","Send (anonymous) print information")
  269. checked: boolCheck(UM.Preferences.getValue("info/send_slice_info"))
  270. onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked)
  271. }
  272. }
  273. //: Invisible list used to check if a plugin exists
  274. ListView
  275. {
  276. id: plugins
  277. model: UM.PluginsModel { }
  278. visible: false
  279. }
  280. }
  281. }