GeneralPage.qml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  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 setDefaultDiscardOrKeepProfile(code)
  24. {
  25. for (var i = 0; i < choiceOnProfileOverrideDropDownButton.model.count; i++)
  26. {
  27. if (choiceOnProfileOverrideDropDownButton.model.get(i).code == code)
  28. {
  29. choiceOnProfileOverrideDropDownButton.currentIndex = i;
  30. break;
  31. }
  32. }
  33. }
  34. function setDefaultOpenProjectOption(code)
  35. {
  36. for (var i = 0; i < choiceOnOpenProjectDropDownButton.model.count; ++i)
  37. {
  38. if (choiceOnOpenProjectDropDownButton.model.get(i).code == code)
  39. {
  40. choiceOnOpenProjectDropDownButton.currentIndex = i
  41. break;
  42. }
  43. }
  44. }
  45. function reset()
  46. {
  47. UM.Preferences.resetPreference("general/language")
  48. var defaultLanguage = UM.Preferences.getValue("general/language")
  49. setDefaultLanguage(defaultLanguage)
  50. UM.Preferences.resetPreference("physics/automatic_push_free")
  51. pushFreeCheckbox.checked = boolCheck(UM.Preferences.getValue("physics/automatic_push_free"))
  52. UM.Preferences.resetPreference("physics/automatic_drop_down")
  53. dropDownCheckbox.checked = boolCheck(UM.Preferences.getValue("physics/automatic_drop_down"))
  54. UM.Preferences.resetPreference("mesh/scale_to_fit")
  55. scaleToFitCheckbox.checked = boolCheck(UM.Preferences.getValue("mesh/scale_to_fit"))
  56. UM.Preferences.resetPreference("mesh/scale_tiny_meshes")
  57. scaleTinyCheckbox.checked = boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes"))
  58. UM.Preferences.resetPreference("cura/jobname_prefix")
  59. prefixJobNameCheckbox.checked = boolCheck(UM.Preferences.getValue("cura/jobname_prefix"))
  60. UM.Preferences.resetPreference("view/show_overhang");
  61. showOverhangCheckbox.checked = boolCheck(UM.Preferences.getValue("view/show_overhang"))
  62. UM.Preferences.resetPreference("view/center_on_select");
  63. centerOnSelectCheckbox.checked = boolCheck(UM.Preferences.getValue("view/center_on_select"))
  64. UM.Preferences.resetPreference("view/invert_zoom");
  65. invertZoomCheckbox.checked = boolCheck(UM.Preferences.getValue("view/invert_zoom"))
  66. UM.Preferences.resetPreference("view/top_layer_count");
  67. topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count"))
  68. UM.Preferences.resetPreference("cura/choice_on_profile_override")
  69. setDefaultDiscardOrKeepProfile(UM.Preferences.getValue("cura/choice_on_profile_override"))
  70. UM.Preferences.resetPreference("cura/choice_on_open_project")
  71. setDefaultOpenProjectOption(UM.Preferences.getValue("cura/choice_on_open_project"))
  72. if (plugins.find("id", "SliceInfoPlugin") > -1) {
  73. UM.Preferences.resetPreference("info/send_slice_info")
  74. sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info"))
  75. }
  76. if (plugins.find("id", "UpdateChecker") > -1) {
  77. UM.Preferences.resetPreference("info/automatic_update_check")
  78. checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
  79. }
  80. }
  81. ScrollView
  82. {
  83. width: parent.width
  84. height: parent.height
  85. Column
  86. {
  87. //: Model used to check if a plugin exists
  88. UM.PluginsModel { id: plugins }
  89. //: Language selection label
  90. UM.I18nCatalog{id: catalog; name:"cura"}
  91. Label
  92. {
  93. font.bold: true
  94. text: catalog.i18nc("@label","Interface")
  95. }
  96. Row
  97. {
  98. spacing: UM.Theme.getSize("default_margin").width
  99. Label
  100. {
  101. id: languageLabel
  102. text: catalog.i18nc("@label","Language:")
  103. anchors.verticalCenter: languageComboBox.verticalCenter
  104. }
  105. ComboBox
  106. {
  107. id: languageComboBox
  108. model: ListModel
  109. {
  110. id: languageList
  111. Component.onCompleted: {
  112. append({ text: "English", code: "en" })
  113. append({ text: "Deutsch", code: "de" })
  114. append({ text: "Español", code: "es" })
  115. append({ text: "Suomi", code: "fi" })
  116. append({ text: "Français", code: "fr" })
  117. append({ text: "Italiano", code: "it" })
  118. append({ text: "Nederlands", code: "nl" })
  119. append({ text: "Português do Brasil", code: "ptbr" })
  120. append({ text: "Русский", code: "ru" })
  121. append({ text: "Türkçe", code: "tr" })
  122. }
  123. }
  124. currentIndex:
  125. {
  126. var code = UM.Preferences.getValue("general/language");
  127. for(var i = 0; i < languageList.count; ++i)
  128. {
  129. if(model.get(i).code == code)
  130. {
  131. return i
  132. }
  133. }
  134. }
  135. onActivated: UM.Preferences.setValue("general/language", model.get(index).code)
  136. Component.onCompleted:
  137. {
  138. // Because ListModel is stupid and does not allow using qsTr() for values.
  139. for(var i = 0; i < languageList.count; ++i)
  140. {
  141. languageList.setProperty(i, "text", catalog.i18n(languageList.get(i).text));
  142. }
  143. // Glorious hack time. ComboBox does not update the text properly after changing the
  144. // model. So change the indices around to force it to update.
  145. currentIndex += 1;
  146. currentIndex -= 1;
  147. }
  148. }
  149. Label
  150. {
  151. id: currencyLabel
  152. text: catalog.i18nc("@label","Currency:")
  153. anchors.verticalCenter: languageComboBox.verticalCenter
  154. }
  155. TextField
  156. {
  157. id: currencyField
  158. text: UM.Preferences.getValue("cura/currency")
  159. onTextChanged: UM.Preferences.setValue("cura/currency", text)
  160. }
  161. }
  162. Label
  163. {
  164. id: languageCaption
  165. //: Language change warning
  166. text: catalog.i18nc("@label", "You will need to restart the application for language changes to have effect.")
  167. wrapMode: Text.WordWrap
  168. font.italic: true
  169. }
  170. Item
  171. {
  172. //: Spacer
  173. height: UM.Theme.getSize("default_margin").height
  174. width: UM.Theme.getSize("default_margin").width
  175. }
  176. UM.TooltipArea
  177. {
  178. width: childrenRect.width;
  179. height: childrenRect.height;
  180. text: catalog.i18nc("@info:tooltip","Slice automatically when changing settings.")
  181. CheckBox
  182. {
  183. id: autoSliceCheckbox
  184. checked: boolCheck(UM.Preferences.getValue("general/auto_slice"))
  185. onClicked: UM.Preferences.setValue("general/auto_slice", checked)
  186. text: catalog.i18nc("@option:check","Slice automatically");
  187. }
  188. }
  189. Item
  190. {
  191. //: Spacer
  192. height: UM.Theme.getSize("default_margin").height
  193. width: UM.Theme.getSize("default_margin").width
  194. }
  195. Label
  196. {
  197. font.bold: true
  198. text: catalog.i18nc("@label","Viewport behavior")
  199. }
  200. UM.TooltipArea
  201. {
  202. width: childrenRect.width;
  203. height: childrenRect.height;
  204. text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.")
  205. CheckBox
  206. {
  207. id: showOverhangCheckbox
  208. checked: boolCheck(UM.Preferences.getValue("view/show_overhang"))
  209. onClicked: UM.Preferences.setValue("view/show_overhang", checked)
  210. text: catalog.i18nc("@option:check","Display overhang");
  211. }
  212. }
  213. UM.TooltipArea {
  214. width: childrenRect.width;
  215. height: childrenRect.height;
  216. text: catalog.i18nc("@info:tooltip","Moves the camera so the model is in the center of the view when an model is selected")
  217. CheckBox
  218. {
  219. id: centerOnSelectCheckbox
  220. text: catalog.i18nc("@action:button","Center camera when item is selected");
  221. checked: boolCheck(UM.Preferences.getValue("view/center_on_select"))
  222. onClicked: UM.Preferences.setValue("view/center_on_select", checked)
  223. enabled: Qt.platform.os != "windows" // Hack: disable the feature on windows as it's broken for pyqt 5.7.1.
  224. }
  225. }
  226. UM.TooltipArea {
  227. width: childrenRect.width;
  228. height: childrenRect.height;
  229. text: catalog.i18nc("@info:tooltip","Should the default zoom behavior of cura be inverted?")
  230. CheckBox
  231. {
  232. id: invertZoomCheckbox
  233. text: catalog.i18nc("@action:button","Invert the direction of camera zoom.");
  234. checked: boolCheck(UM.Preferences.getValue("view/invert_zoom"))
  235. onClicked: UM.Preferences.setValue("view/invert_zoom", checked)
  236. }
  237. }
  238. UM.TooltipArea {
  239. width: childrenRect.width
  240. height: childrenRect.height
  241. text: catalog.i18nc("@info:tooltip", "Should models on the platform be moved so that they no longer intersect?")
  242. CheckBox
  243. {
  244. id: pushFreeCheckbox
  245. text: catalog.i18nc("@option:check", "Ensure models are kept apart")
  246. checked: boolCheck(UM.Preferences.getValue("physics/automatic_push_free"))
  247. onCheckedChanged: UM.Preferences.setValue("physics/automatic_push_free", checked)
  248. }
  249. }
  250. UM.TooltipArea {
  251. width: childrenRect.width
  252. height: childrenRect.height
  253. text: catalog.i18nc("@info:tooltip", "Should models on the platform be moved down to touch the build plate?")
  254. CheckBox
  255. {
  256. id: dropDownCheckbox
  257. text: catalog.i18nc("@option:check", "Automatically drop models to the build plate")
  258. checked: boolCheck(UM.Preferences.getValue("physics/automatic_drop_down"))
  259. onCheckedChanged: UM.Preferences.setValue("physics/automatic_drop_down", checked)
  260. }
  261. }
  262. UM.TooltipArea
  263. {
  264. width: childrenRect.width;
  265. height: childrenRect.height;
  266. text: catalog.i18nc("@info:tooltip","Show caution message in gcode reader.")
  267. CheckBox
  268. {
  269. id: gcodeShowCautionCheckbox
  270. checked: boolCheck(UM.Preferences.getValue("gcodereader/show_caution"))
  271. onClicked: UM.Preferences.setValue("gcodereader/show_caution", checked)
  272. text: catalog.i18nc("@option:check","Caution message in gcode reader");
  273. }
  274. }
  275. UM.TooltipArea {
  276. width: childrenRect.width
  277. height: childrenRect.height
  278. text: catalog.i18nc("@info:tooltip", "Should layer be forced into compatibility mode?")
  279. CheckBox
  280. {
  281. id: forceLayerViewCompatibilityModeCheckbox
  282. text: catalog.i18nc("@option:check", "Force layer view compatibility mode (restart required)")
  283. checked: boolCheck(UM.Preferences.getValue("view/force_layer_view_compatibility_mode"))
  284. onCheckedChanged: UM.Preferences.setValue("view/force_layer_view_compatibility_mode", checked)
  285. }
  286. }
  287. Item
  288. {
  289. //: Spacer
  290. height: UM.Theme.getSize("default_margin").height
  291. width: UM.Theme.getSize("default_margin").height
  292. }
  293. Label
  294. {
  295. font.bold: true
  296. text: catalog.i18nc("@label","Opening and saving files")
  297. }
  298. UM.TooltipArea {
  299. width: childrenRect.width
  300. height: childrenRect.height
  301. text: catalog.i18nc("@info:tooltip","Should models be scaled to the build volume if they are too large?")
  302. CheckBox
  303. {
  304. id: scaleToFitCheckbox
  305. text: catalog.i18nc("@option:check","Scale large models")
  306. checked: boolCheck(UM.Preferences.getValue("mesh/scale_to_fit"))
  307. onCheckedChanged: UM.Preferences.setValue("mesh/scale_to_fit", checked)
  308. }
  309. }
  310. UM.TooltipArea {
  311. width: childrenRect.width
  312. height: childrenRect.height
  313. 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?")
  314. CheckBox
  315. {
  316. id: scaleTinyCheckbox
  317. text: catalog.i18nc("@option:check","Scale extremely small models")
  318. checked: boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes"))
  319. onCheckedChanged: UM.Preferences.setValue("mesh/scale_tiny_meshes", checked)
  320. }
  321. }
  322. UM.TooltipArea {
  323. width: childrenRect.width
  324. height: childrenRect.height
  325. text: catalog.i18nc("@info:tooltip", "Should a prefix based on the printer name be added to the print job name automatically?")
  326. CheckBox
  327. {
  328. id: prefixJobNameCheckbox
  329. text: catalog.i18nc("@option:check", "Add machine prefix to job name")
  330. checked: boolCheck(UM.Preferences.getValue("cura/jobname_prefix"))
  331. onCheckedChanged: UM.Preferences.setValue("cura/jobname_prefix", checked)
  332. }
  333. }
  334. UM.TooltipArea {
  335. width: childrenRect.width
  336. height: childrenRect.height
  337. text: catalog.i18nc("@info:tooltip", "Should a summary be shown when saving a project file?")
  338. CheckBox
  339. {
  340. text: catalog.i18nc("@option:check", "Show summary dialog when saving project")
  341. checked: boolCheck(UM.Preferences.getValue("cura/dialog_on_project_save"))
  342. onCheckedChanged: UM.Preferences.setValue("cura/dialog_on_project_save", checked)
  343. }
  344. }
  345. UM.TooltipArea {
  346. width: childrenRect.width
  347. height: childrenRect.height
  348. text: catalog.i18nc("@info:tooltip", "Default behavior when opening a project file")
  349. Column
  350. {
  351. spacing: 4
  352. Label
  353. {
  354. text: catalog.i18nc("@window:text", "Default behavior when opening a project file: ")
  355. }
  356. ComboBox
  357. {
  358. id: choiceOnOpenProjectDropDownButton
  359. width: 200
  360. model: ListModel
  361. {
  362. id: openProjectOptionModel
  363. Component.onCompleted: {
  364. append({ text: catalog.i18nc("@option:openProject", "Always ask"), code: "always_ask" })
  365. append({ text: catalog.i18nc("@option:openProject", "Always open as a project"), code: "open_as_project" })
  366. append({ text: catalog.i18nc("@option:openProject", "Always import models"), code: "open_as_model" })
  367. }
  368. }
  369. currentIndex:
  370. {
  371. var index = 0;
  372. var currentChoice = UM.Preferences.getValue("cura/choice_on_open_project");
  373. for (var i = 0; i < model.count; ++i)
  374. {
  375. if (model.get(i).code == currentChoice)
  376. {
  377. index = i;
  378. break;
  379. }
  380. }
  381. return index;
  382. }
  383. onActivated: UM.Preferences.setValue("cura/choice_on_open_project", model.get(index).code)
  384. }
  385. }
  386. }
  387. Item
  388. {
  389. //: Spacer
  390. height: UM.Theme.getSize("default_margin").height
  391. width: UM.Theme.getSize("default_margin").width
  392. }
  393. UM.TooltipArea
  394. {
  395. width: childrenRect.width;
  396. height: childrenRect.height;
  397. text: catalog.i18nc("@info:tooltip", "When you have made changes to a profile and switched to a different one, a dialog will be shown asking whether you want to keep your modifications or not, or you can choose a default behaviour and never show that dialog again.")
  398. Column
  399. {
  400. spacing: 4
  401. Label
  402. {
  403. font.bold: true
  404. text: catalog.i18nc("@label", "Override Profile")
  405. }
  406. ComboBox
  407. {
  408. id: choiceOnProfileOverrideDropDownButton
  409. width: 200
  410. model: ListModel
  411. {
  412. id: discardOrKeepProfileListModel
  413. Component.onCompleted: {
  414. append({ text: catalog.i18nc("@option:discardOrKeep", "Always ask me this"), code: "always_ask" })
  415. append({ text: catalog.i18nc("@option:discardOrKeep", "Discard and never ask again"), code: "always_discard" })
  416. append({ text: catalog.i18nc("@option:discardOrKeep", "Keep and never ask again"), code: "always_keep" })
  417. }
  418. }
  419. currentIndex:
  420. {
  421. var index = 0;
  422. var code = UM.Preferences.getValue("cura/choice_on_profile_override");
  423. for (var i = 0; i < model.count; ++i)
  424. {
  425. if (model.get(i).code == code)
  426. {
  427. index = i;
  428. break;
  429. }
  430. }
  431. return index;
  432. }
  433. onActivated: UM.Preferences.setValue("cura/choice_on_profile_override", model.get(index).code)
  434. }
  435. }
  436. }
  437. Item
  438. {
  439. //: Spacer
  440. height: UM.Theme.getSize("default_margin").height
  441. width: UM.Theme.getSize("default_margin").height
  442. }
  443. Label
  444. {
  445. font.bold: true
  446. visible: checkUpdatesCheckbox.visible || sendDataCheckbox.visible
  447. text: catalog.i18nc("@label","Privacy")
  448. }
  449. UM.TooltipArea {
  450. visible: plugins.find("id", "UpdateChecker") > -1
  451. width: childrenRect.width
  452. height: visible ? childrenRect.height : 0
  453. text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
  454. CheckBox
  455. {
  456. id: checkUpdatesCheckbox
  457. text: catalog.i18nc("@option:check","Check for updates on start")
  458. checked: boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
  459. onCheckedChanged: UM.Preferences.setValue("info/automatic_update_check", checked)
  460. }
  461. }
  462. UM.TooltipArea {
  463. visible: plugins.find("id", "SliceInfoPlugin") > -1
  464. width: childrenRect.width
  465. height: visible ? childrenRect.height : 0
  466. 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.")
  467. CheckBox
  468. {
  469. id: sendDataCheckbox
  470. text: catalog.i18nc("@option:check","Send (anonymous) print information")
  471. checked: boolCheck(UM.Preferences.getValue("info/send_slice_info"))
  472. onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked)
  473. }
  474. }
  475. }
  476. }
  477. }