GeneralPage.qml 15 KB

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