MoreInfoWindow.qml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // Copyright (c) 2019 Ultimaker B.V.
  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.3 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. 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. color: UM.Theme.getColor("text")
  63. wrapMode: Text.WordWrap
  64. renderType: Text.NativeRendering
  65. }
  66. Cura.ScrollableTextArea
  67. {
  68. anchors
  69. {
  70. top: headerText.bottom
  71. topMargin: UM.Theme.getSize("default_margin").height
  72. bottom: parent.bottom
  73. bottomMargin: UM.Theme.getSize("default_margin").height
  74. left: parent.left
  75. right: parent.right
  76. }
  77. textArea.text: (manager === null) ? "" : manager.getExampleData()
  78. textArea.textFormat: Text.RichText
  79. textArea.wrapMode: Text.Wrap
  80. textArea.readOnly: true
  81. }
  82. }
  83. Column // Radio buttons for agree and disagree
  84. {
  85. id: radioButtonsRow
  86. anchors.left: parent.left
  87. anchors.right: parent.right
  88. anchors.bottom: buttonRow.top
  89. anchors.bottomMargin: UM.Theme.getSize("default_margin").height
  90. Cura.RadioButton
  91. {
  92. id: dontSendButton
  93. text: catalog.i18nc("@text:window", "I don't want to send anonymous data")
  94. onClicked:
  95. {
  96. baseDialog.allowSendData = !checked
  97. }
  98. }
  99. Cura.RadioButton
  100. {
  101. id: allowSendButton
  102. text: catalog.i18nc("@text:window", "Allow sending anonymous data")
  103. onClicked:
  104. {
  105. baseDialog.allowSendData = checked
  106. }
  107. }
  108. }
  109. Item // Bottom buttons
  110. {
  111. id: buttonRow
  112. anchors.bottom: parent.bottom
  113. anchors.left: parent.left
  114. anchors.right: parent.right
  115. height: childrenRect.height
  116. Cura.PrimaryButton
  117. {
  118. anchors.right: parent.right
  119. text: catalog.i18nc("@action:button", "OK")
  120. onClicked:
  121. {
  122. manager.setSendSliceInfo(allowSendData)
  123. baseDialog.hide()
  124. }
  125. }
  126. Cura.SecondaryButton
  127. {
  128. anchors.left: parent.left
  129. text: catalog.i18nc("@action:button", "Cancel")
  130. onClicked:
  131. {
  132. baseDialog.hide()
  133. }
  134. }
  135. }
  136. }
  137. }