GeneralPage.qml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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. append({ text: "简体中文", code: "zh_CN" })
  143. var date_object = new Date();
  144. if (date_object.getUTCMonth() == 8 && date_object.getUTCDate() == 19) //Only add Pirate on the 19th of September.
  145. {
  146. append({ text: "Pirate", code: "7s" })
  147. }
  148. }
  149. }
  150. currentIndex:
  151. {
  152. var code = UM.Preferences.getValue("general/language");
  153. for(var i = 0; i < languageList.count; ++i)
  154. {
  155. if(model.get(i).code == code)
  156. {
  157. return i
  158. }
  159. }
  160. }
  161. onActivated: UM.Preferences.setValue("general/language", model.get(index).code)
  162. Component.onCompleted:
  163. {
  164. // Because ListModel is stupid and does not allow using qsTr() for values.
  165. for(var i = 0; i < languageList.count; ++i)
  166. {
  167. languageList.setProperty(i, "text", catalog.i18n(languageList.get(i).text));
  168. }
  169. // Glorious hack time. ComboBox does not update the text properly after changing the
  170. // model. So change the indices around to force it to update.
  171. currentIndex += 1;
  172. currentIndex -= 1;
  173. }
  174. }
  175. Label
  176. {
  177. id: currencyLabel
  178. text: catalog.i18nc("@label","Currency:")
  179. anchors.verticalCenter: currencyField.verticalCenter
  180. }
  181. TextField
  182. {
  183. id: currencyField
  184. text: UM.Preferences.getValue("cura/currency")
  185. onTextChanged: UM.Preferences.setValue("cura/currency", text)
  186. }
  187. Label
  188. {
  189. id: themeLabel
  190. text: catalog.i18nc("@label","Theme:")
  191. anchors.verticalCenter: themeComboBox.verticalCenter
  192. }
  193. ComboBox
  194. {
  195. id: themeComboBox
  196. model: ListModel
  197. {
  198. id: themeList
  199. Component.onCompleted: {
  200. var themes = UM.Theme.getThemes()
  201. for (var i = 0; i < themes.length; i++)
  202. {
  203. append({ text: themes[i].name.toString(), code: themes[i].id.toString() });
  204. }
  205. }
  206. }
  207. currentIndex:
  208. {
  209. var code = UM.Preferences.getValue("general/theme");
  210. for(var i = 0; i < themeList.count; ++i)
  211. {
  212. if(model.get(i).code == code)
  213. {
  214. return i
  215. }
  216. }
  217. return 0;
  218. }
  219. onActivated: UM.Preferences.setValue("general/theme", model.get(index).code)
  220. Component.onCompleted:
  221. {
  222. // Because ListModel is stupid and does not allow using qsTr() for values.
  223. for(var i = 0; i < themeList.count; ++i)
  224. {
  225. themeList.setProperty(i, "text", catalog.i18n(themeList.get(i).text));
  226. }
  227. // Glorious hack time. ComboBox does not update the text properly after changing the
  228. // model. So change the indices around to force it to update.
  229. currentIndex += 1;
  230. currentIndex -= 1;
  231. }
  232. }
  233. }
  234. Label
  235. {
  236. id: languageCaption
  237. //: Language change warning
  238. text: catalog.i18nc("@label", "You will need to restart the application for these changes to have effect.")
  239. wrapMode: Text.WordWrap
  240. font.italic: true
  241. }
  242. Item
  243. {
  244. //: Spacer
  245. height: UM.Theme.getSize("default_margin").height
  246. width: UM.Theme.getSize("default_margin").width
  247. }
  248. UM.TooltipArea
  249. {
  250. width: childrenRect.width;
  251. height: childrenRect.height;
  252. text: catalog.i18nc("@info:tooltip","Slice automatically when changing settings.")
  253. CheckBox
  254. {
  255. id: autoSliceCheckbox
  256. checked: boolCheck(UM.Preferences.getValue("general/auto_slice"))
  257. onClicked: UM.Preferences.setValue("general/auto_slice", checked)
  258. text: catalog.i18nc("@option:check","Slice automatically");
  259. }
  260. }
  261. Item
  262. {
  263. //: Spacer
  264. height: UM.Theme.getSize("default_margin").height
  265. width: UM.Theme.getSize("default_margin").width
  266. }
  267. Label
  268. {
  269. font.bold: true
  270. text: catalog.i18nc("@label","Viewport behavior")
  271. }
  272. UM.TooltipArea
  273. {
  274. width: childrenRect.width;
  275. height: childrenRect.height;
  276. text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.")
  277. CheckBox
  278. {
  279. id: showOverhangCheckbox
  280. checked: boolCheck(UM.Preferences.getValue("view/show_overhang"))
  281. onClicked: UM.Preferences.setValue("view/show_overhang", checked)
  282. text: catalog.i18nc("@option:check","Display overhang");
  283. }
  284. }
  285. UM.TooltipArea {
  286. width: childrenRect.width;
  287. height: childrenRect.height;
  288. text: catalog.i18nc("@info:tooltip","Moves the camera so the model is in the center of the view when a model is selected")
  289. CheckBox
  290. {
  291. id: centerOnSelectCheckbox
  292. text: catalog.i18nc("@action:button","Center camera when item is selected");
  293. checked: boolCheck(UM.Preferences.getValue("view/center_on_select"))
  294. onClicked: UM.Preferences.setValue("view/center_on_select", checked)
  295. }
  296. }
  297. UM.TooltipArea {
  298. width: childrenRect.width;
  299. height: childrenRect.height;
  300. text: catalog.i18nc("@info:tooltip","Should the default zoom behavior of cura be inverted?")
  301. CheckBox
  302. {
  303. id: invertZoomCheckbox
  304. text: catalog.i18nc("@action:button","Invert the direction of camera zoom.");
  305. checked: boolCheck(UM.Preferences.getValue("view/invert_zoom"))
  306. onClicked: UM.Preferences.setValue("view/invert_zoom", checked)
  307. }
  308. }
  309. UM.TooltipArea {
  310. width: childrenRect.width;
  311. height: childrenRect.height;
  312. text: catalog.i18nc("@info:tooltip", "Should zooming move in the direction of the mouse?")
  313. CheckBox
  314. {
  315. id: zoomToMouseCheckbox
  316. text: catalog.i18nc("@action:button", "Zoom toward mouse direction");
  317. checked: boolCheck(UM.Preferences.getValue("view/zoom_to_mouse"))
  318. onClicked: UM.Preferences.setValue("view/zoom_to_mouse", checked)
  319. }
  320. }
  321. UM.TooltipArea {
  322. width: childrenRect.width
  323. height: childrenRect.height
  324. text: catalog.i18nc("@info:tooltip", "Should models on the platform be moved so that they no longer intersect?")
  325. CheckBox
  326. {
  327. id: pushFreeCheckbox
  328. text: catalog.i18nc("@option:check", "Ensure models are kept apart")
  329. checked: boolCheck(UM.Preferences.getValue("physics/automatic_push_free"))
  330. onCheckedChanged: UM.Preferences.setValue("physics/automatic_push_free", checked)
  331. }
  332. }
  333. UM.TooltipArea {
  334. width: childrenRect.width
  335. height: childrenRect.height
  336. text: catalog.i18nc("@info:tooltip", "Should models on the platform be moved down to touch the build plate?")
  337. CheckBox
  338. {
  339. id: dropDownCheckbox
  340. text: catalog.i18nc("@option:check", "Automatically drop models to the build plate")
  341. checked: boolCheck(UM.Preferences.getValue("physics/automatic_drop_down"))
  342. onCheckedChanged: UM.Preferences.setValue("physics/automatic_drop_down", checked)
  343. }
  344. }
  345. UM.TooltipArea
  346. {
  347. width: childrenRect.width;
  348. height: childrenRect.height;
  349. text: catalog.i18nc("@info:tooltip","Show caution message in gcode reader.")
  350. CheckBox
  351. {
  352. id: gcodeShowCautionCheckbox
  353. checked: boolCheck(UM.Preferences.getValue("gcodereader/show_caution"))
  354. onClicked: UM.Preferences.setValue("gcodereader/show_caution", checked)
  355. text: catalog.i18nc("@option:check","Caution message in gcode reader");
  356. }
  357. }
  358. UM.TooltipArea {
  359. width: childrenRect.width
  360. height: childrenRect.height
  361. text: catalog.i18nc("@info:tooltip", "Should layer be forced into compatibility mode?")
  362. CheckBox
  363. {
  364. id: forceLayerViewCompatibilityModeCheckbox
  365. text: catalog.i18nc("@option:check", "Force layer view compatibility mode (restart required)")
  366. checked: boolCheck(UM.Preferences.getValue("view/force_layer_view_compatibility_mode"))
  367. onCheckedChanged: UM.Preferences.setValue("view/force_layer_view_compatibility_mode", checked)
  368. }
  369. }
  370. Item
  371. {
  372. //: Spacer
  373. height: UM.Theme.getSize("default_margin").height
  374. width: UM.Theme.getSize("default_margin").height
  375. }
  376. Label
  377. {
  378. font.bold: true
  379. text: catalog.i18nc("@label","Opening and saving files")
  380. }
  381. UM.TooltipArea {
  382. width: childrenRect.width
  383. height: childrenRect.height
  384. text: catalog.i18nc("@info:tooltip","Should models be scaled to the build volume if they are too large?")
  385. CheckBox
  386. {
  387. id: scaleToFitCheckbox
  388. text: catalog.i18nc("@option:check","Scale large models")
  389. checked: boolCheck(UM.Preferences.getValue("mesh/scale_to_fit"))
  390. onCheckedChanged: UM.Preferences.setValue("mesh/scale_to_fit", checked)
  391. }
  392. }
  393. UM.TooltipArea {
  394. width: childrenRect.width
  395. height: childrenRect.height
  396. 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?")
  397. CheckBox
  398. {
  399. id: scaleTinyCheckbox
  400. text: catalog.i18nc("@option:check","Scale extremely small models")
  401. checked: boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes"))
  402. onCheckedChanged: UM.Preferences.setValue("mesh/scale_tiny_meshes", checked)
  403. }
  404. }
  405. UM.TooltipArea {
  406. width: childrenRect.width
  407. height: childrenRect.height
  408. text: catalog.i18nc("@info:tooltip", "Should a prefix based on the printer name be added to the print job name automatically?")
  409. CheckBox
  410. {
  411. id: prefixJobNameCheckbox
  412. text: catalog.i18nc("@option:check", "Add machine prefix to job name")
  413. checked: boolCheck(UM.Preferences.getValue("cura/jobname_prefix"))
  414. onCheckedChanged: UM.Preferences.setValue("cura/jobname_prefix", checked)
  415. }
  416. }
  417. UM.TooltipArea {
  418. width: childrenRect.width
  419. height: childrenRect.height
  420. text: catalog.i18nc("@info:tooltip", "Should a summary be shown when saving a project file?")
  421. CheckBox
  422. {
  423. text: catalog.i18nc("@option:check", "Show summary dialog when saving project")
  424. checked: boolCheck(UM.Preferences.getValue("cura/dialog_on_project_save"))
  425. onCheckedChanged: UM.Preferences.setValue("cura/dialog_on_project_save", checked)
  426. }
  427. }
  428. UM.TooltipArea {
  429. width: childrenRect.width
  430. height: childrenRect.height
  431. text: catalog.i18nc("@info:tooltip", "Default behavior when opening a project file")
  432. Column
  433. {
  434. spacing: 4
  435. Label
  436. {
  437. text: catalog.i18nc("@window:text", "Default behavior when opening a project file: ")
  438. }
  439. ComboBox
  440. {
  441. id: choiceOnOpenProjectDropDownButton
  442. width: 200
  443. model: ListModel
  444. {
  445. id: openProjectOptionModel
  446. Component.onCompleted: {
  447. append({ text: catalog.i18nc("@option:openProject", "Always ask"), code: "always_ask" })
  448. append({ text: catalog.i18nc("@option:openProject", "Always open as a project"), code: "open_as_project" })
  449. append({ text: catalog.i18nc("@option:openProject", "Always import models"), code: "open_as_model" })
  450. }
  451. }
  452. currentIndex:
  453. {
  454. var index = 0;
  455. var currentChoice = UM.Preferences.getValue("cura/choice_on_open_project");
  456. for (var i = 0; i < model.count; ++i)
  457. {
  458. if (model.get(i).code == currentChoice)
  459. {
  460. index = i;
  461. break;
  462. }
  463. }
  464. return index;
  465. }
  466. onActivated: UM.Preferences.setValue("cura/choice_on_open_project", model.get(index).code)
  467. }
  468. }
  469. }
  470. Item
  471. {
  472. //: Spacer
  473. height: UM.Theme.getSize("default_margin").height
  474. width: UM.Theme.getSize("default_margin").width
  475. }
  476. UM.TooltipArea
  477. {
  478. width: childrenRect.width;
  479. height: childrenRect.height;
  480. 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.")
  481. Column
  482. {
  483. spacing: 4
  484. Label
  485. {
  486. font.bold: true
  487. text: catalog.i18nc("@label", "Override Profile")
  488. }
  489. ComboBox
  490. {
  491. id: choiceOnProfileOverrideDropDownButton
  492. width: 200
  493. model: ListModel
  494. {
  495. id: discardOrKeepProfileListModel
  496. Component.onCompleted: {
  497. append({ text: catalog.i18nc("@option:discardOrKeep", "Always ask me this"), code: "always_ask" })
  498. append({ text: catalog.i18nc("@option:discardOrKeep", "Discard and never ask again"), code: "always_discard" })
  499. append({ text: catalog.i18nc("@option:discardOrKeep", "Keep and never ask again"), code: "always_keep" })
  500. }
  501. }
  502. currentIndex:
  503. {
  504. var index = 0;
  505. var code = UM.Preferences.getValue("cura/choice_on_profile_override");
  506. for (var i = 0; i < model.count; ++i)
  507. {
  508. if (model.get(i).code == code)
  509. {
  510. index = i;
  511. break;
  512. }
  513. }
  514. return index;
  515. }
  516. onActivated: UM.Preferences.setValue("cura/choice_on_profile_override", model.get(index).code)
  517. }
  518. }
  519. }
  520. Item
  521. {
  522. //: Spacer
  523. height: UM.Theme.getSize("default_margin").height
  524. width: UM.Theme.getSize("default_margin").height
  525. }
  526. Label
  527. {
  528. font.bold: true
  529. visible: checkUpdatesCheckbox.visible || sendDataCheckbox.visible
  530. text: catalog.i18nc("@label","Privacy")
  531. }
  532. UM.TooltipArea {
  533. visible: plugins.find("id", "UpdateChecker") > -1
  534. width: childrenRect.width
  535. height: visible ? childrenRect.height : 0
  536. text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
  537. CheckBox
  538. {
  539. id: checkUpdatesCheckbox
  540. text: catalog.i18nc("@option:check","Check for updates on start")
  541. checked: boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
  542. onCheckedChanged: UM.Preferences.setValue("info/automatic_update_check", checked)
  543. }
  544. }
  545. UM.TooltipArea {
  546. visible: plugins.find("id", "SliceInfoPlugin") > -1
  547. width: childrenRect.width
  548. height: visible ? childrenRect.height : 0
  549. 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.")
  550. CheckBox
  551. {
  552. id: sendDataCheckbox
  553. text: catalog.i18nc("@option:check","Send (anonymous) print information")
  554. checked: boolCheck(UM.Preferences.getValue("info/send_slice_info"))
  555. onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked)
  556. }
  557. }
  558. }
  559. }
  560. }