MoreInfoWindow.qml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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", "Cura sends anonymous data to Ultimaker in order to improve the print quality and user experience. Below is an example of all the data that is sent.")
  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.readOnly: true
  78. }
  79. }
  80. Column // Radio buttons for agree and disagree
  81. {
  82. id: radioButtonsRow
  83. anchors.left: parent.left
  84. anchors.right: parent.right
  85. anchors.bottom: buttonRow.top
  86. anchors.bottomMargin: UM.Theme.getSize("default_margin").height
  87. Cura.RadioButton
  88. {
  89. id: dontSendButton
  90. text: catalog.i18nc("@text:window", "I don't want to send this data")
  91. onClicked:
  92. {
  93. baseDialog.allowSendData = !checked
  94. }
  95. }
  96. Cura.RadioButton
  97. {
  98. id: allowSendButton
  99. text: catalog.i18nc("@text:window", "Allow sending this data to Ultimaker and help us improve Cura")
  100. onClicked:
  101. {
  102. baseDialog.allowSendData = checked
  103. }
  104. }
  105. }
  106. Item // Bottom buttons
  107. {
  108. id: buttonRow
  109. anchors.bottom: parent.bottom
  110. anchors.left: parent.left
  111. anchors.right: parent.right
  112. height: childrenRect.height
  113. Cura.PrimaryButton
  114. {
  115. anchors.right: parent.right
  116. text: catalog.i18nc("@action:button", "OK")
  117. onClicked:
  118. {
  119. manager.setSendSliceInfo(allowSendData)
  120. baseDialog.hide()
  121. }
  122. }
  123. Cura.SecondaryButton
  124. {
  125. anchors.left: parent.left
  126. text: catalog.i18nc("@action:button", "Cancel")
  127. onClicked:
  128. {
  129. baseDialog.hide()
  130. }
  131. }
  132. }
  133. }
  134. }