MoreInfoWindow.qml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // Copyright (c) 2022 UltiMaker
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Window 2.2
  6. import UM 1.5 as UM
  7. import Cura 1.1 as Cura
  8. Window
  9. {
  10. UM.I18nCatalog { id: catalog; name: "cura" }
  11. id: baseDialog
  12. title: catalog.i18nc("@title:window", "More information on anonymous data collection")
  13. visible: false
  14. modality: Qt.ApplicationModal
  15. minimumWidth: 500 * screenScaleFactor
  16. minimumHeight: 400 * screenScaleFactor
  17. width: minimumWidth
  18. height: minimumHeight
  19. color: UM.Theme.getColor("main_background")
  20. property bool allowSendData: true // for saving the user's choice
  21. onVisibilityChanged:
  22. {
  23. if (visible)
  24. {
  25. baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info")
  26. if (baseDialog.allowSendData)
  27. {
  28. allowSendButton.checked = true
  29. }
  30. else
  31. {
  32. dontSendButton.checked = true
  33. }
  34. }
  35. }
  36. // Main content area
  37. Item
  38. {
  39. anchors.fill: parent
  40. anchors.margins: UM.Theme.getSize("default_margin").width
  41. Item // Text part
  42. {
  43. id: textRow
  44. anchors
  45. {
  46. top: parent.top
  47. bottom: radioButtonsRow.top
  48. bottomMargin: UM.Theme.getSize("default_margin").height
  49. left: parent.left
  50. right: parent.right
  51. }
  52. UM.Label
  53. {
  54. id: headerText
  55. anchors
  56. {
  57. top: parent.top
  58. left: parent.left
  59. right: parent.right
  60. }
  61. text: catalog.i18nc("@text:window", "UltiMaker Cura collects anonymous data in order to improve the print quality and user experience. Below is an example of all the data that is shared:")
  62. wrapMode: Text.WordWrap
  63. }
  64. Cura.ScrollableTextArea
  65. {
  66. anchors
  67. {
  68. top: headerText.bottom
  69. topMargin: UM.Theme.getSize("default_margin").height
  70. bottom: parent.bottom
  71. bottomMargin: UM.Theme.getSize("default_margin").height
  72. left: parent.left
  73. right: parent.right
  74. }
  75. textArea.text: (manager === null) ? "" : manager.getExampleData()
  76. textArea.textFormat: Text.RichText
  77. textArea.wrapMode: Text.Wrap
  78. textArea.readOnly: true
  79. }
  80. }
  81. Column // Radio buttons for agree and disagree
  82. {
  83. id: radioButtonsRow
  84. anchors.left: parent.left
  85. anchors.right: parent.right
  86. anchors.bottom: buttonRow.top
  87. anchors.bottomMargin: UM.Theme.getSize("default_margin").height
  88. Cura.RadioButton
  89. {
  90. id: dontSendButton
  91. text: catalog.i18nc("@text:window", "I don't want to send anonymous data")
  92. onClicked:
  93. {
  94. baseDialog.allowSendData = !checked
  95. }
  96. }
  97. Cura.RadioButton
  98. {
  99. id: allowSendButton
  100. text: catalog.i18nc("@text:window", "Allow sending anonymous data")
  101. onClicked:
  102. {
  103. baseDialog.allowSendData = checked
  104. }
  105. }
  106. }
  107. Item // Bottom buttons
  108. {
  109. id: buttonRow
  110. anchors.bottom: parent.bottom
  111. anchors.left: parent.left
  112. anchors.right: parent.right
  113. height: childrenRect.height
  114. Cura.PrimaryButton
  115. {
  116. anchors.right: parent.right
  117. text: catalog.i18nc("@action:button", "OK")
  118. onClicked:
  119. {
  120. manager.setSendSliceInfo(allowSendData)
  121. baseDialog.hide()
  122. }
  123. }
  124. Cura.SecondaryButton
  125. {
  126. anchors.left: parent.left
  127. text: catalog.i18nc("@action:button", "Cancel")
  128. onClicked:
  129. {
  130. baseDialog.hide()
  131. }
  132. }
  133. }
  134. }
  135. }