GeneralPage.qml 26 KB

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