MoreInfoWindow.qml 4.4 KB

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