WhatsNewContent.qml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. // Copyright (c) 2021 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.Layouts 1.3
  6. import QtGraphicalEffects 1.12 // For the DropShadow
  7. import UM 1.3 as UM
  8. import Cura 1.1 as Cura
  9. //
  10. // This component contains the content for the "What's new in Ultimaker Cura" page of the welcome on-boarding process.
  11. // Previously this was just the changelog, but now it will just have the larger stories, the changelog has its own page.
  12. //
  13. Item
  14. {
  15. property var manager: CuraApplication.getWhatsNewPagesModel()
  16. UM.I18nCatalog { id: catalog; name: "cura" }
  17. Label
  18. {
  19. id: titleLabel
  20. anchors.top: parent.top
  21. anchors.horizontalCenter: parent.horizontalCenter
  22. horizontalAlignment: Text.AlignHCenter
  23. text: catalog.i18nc("@label", "What's New")
  24. color: UM.Theme.getColor("primary_button")
  25. font: UM.Theme.getFont("huge")
  26. renderType: Text.NativeRendering
  27. }
  28. Rectangle
  29. {
  30. anchors
  31. {
  32. top: titleLabel.bottom
  33. topMargin: UM.Theme.getSize("default_margin").width
  34. bottom: whatsNewDots.top
  35. bottomMargin: UM.Theme.getSize("narrow_margin").width
  36. left: parent.left
  37. right: parent.right
  38. }
  39. color: UM.Theme.getColor("viewport_overlay")
  40. StackLayout
  41. {
  42. id: whatsNewViewport
  43. anchors
  44. {
  45. top: parent.top
  46. horizontalCenter: parent.horizontalCenter
  47. }
  48. height: parent.height
  49. width: parent.width
  50. currentIndex: whatsNewDots.currentIndex
  51. Repeater
  52. {
  53. model: manager.subpageCount
  54. Rectangle
  55. {
  56. Layout.alignment: Qt.AlignHCenter
  57. color: UM.Theme.getColor("viewport_overlay")
  58. width: whatsNewViewport.width
  59. height: whatsNewViewport.height
  60. AnimatedImage
  61. {
  62. id: subpageImage
  63. anchors
  64. {
  65. top: parent.top
  66. topMargin: UM.Theme.getSize("thick_margin").width
  67. left: parent.left
  68. leftMargin: UM.Theme.getSize("thick_margin").width
  69. right: parent.right
  70. rightMargin: UM.Theme.getSize("thick_margin").width
  71. }
  72. width: Math.round(parent.width - (UM.Theme.getSize("thick_margin").height * 2))
  73. fillMode: Image.PreserveAspectFit
  74. onStatusChanged: playing = (status == AnimatedImage.Ready)
  75. source: manager.getSubpageImageSource(index)
  76. }
  77. DropShadow {
  78. anchors.fill: subpageImage
  79. radius: UM.Theme.getSize("monitor_shadow_radius").width
  80. color: UM.Theme.getColor("first_run_shadow")
  81. source: subpageImage
  82. }
  83. Cura.ScrollableTextArea
  84. {
  85. id: subpageText
  86. anchors
  87. {
  88. top: subpageImage.bottom
  89. topMargin: UM.Theme.getSize("default_margin").height
  90. bottom: parent.bottom
  91. bottomMargin: UM.Theme.getSize("thin_margin").height
  92. left: subpageImage.left
  93. right: subpageImage.right
  94. }
  95. ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
  96. back_color: UM.Theme.getColor("viewport_overlay")
  97. do_borders: false
  98. textArea.wrapMode: TextEdit.Wrap
  99. textArea.text: "<style>a:link { color: " + UM.Theme.getColor("text_link") + "; text-decoration: underline; }</style>" + manager.getSubpageText(index)
  100. textArea.textFormat: Text.RichText
  101. textArea.readOnly: true
  102. textArea.font: UM.Theme.getFont("default")
  103. textArea.onLinkActivated: Qt.openUrlExternally(link)
  104. textArea.leftPadding: 0
  105. textArea.rightPadding: 0
  106. }
  107. }
  108. }
  109. }
  110. }
  111. PageIndicator
  112. {
  113. id: whatsNewDots
  114. currentIndex: whatsNewViewport.currentIndex
  115. count: whatsNewViewport.count
  116. interactive: true
  117. anchors
  118. {
  119. bottom: whatsNewNextButton.top
  120. bottomMargin: UM.Theme.getSize("wide_margin").height
  121. horizontalCenter: parent.horizontalCenter
  122. }
  123. delegate:
  124. Rectangle
  125. {
  126. width: UM.Theme.getSize("thin_margin").width
  127. height: UM.Theme.getSize("thin_margin").height
  128. radius: width / 2
  129. color:
  130. index === whatsNewViewport.currentIndex ?
  131. UM.Theme.getColor("primary") :
  132. UM.Theme.getColor("secondary_button_shadow")
  133. }
  134. }
  135. Item
  136. {
  137. id: bottomSpacer
  138. anchors.bottom: whatsNewNextButton.top
  139. height: UM.Theme.getSize("default_margin").height / 2
  140. width: UM.Theme.getSize("default_margin").width / 2
  141. }
  142. Cura.TertiaryButton
  143. {
  144. id: whatsNewNextButton
  145. anchors.left: parent.left
  146. anchors.bottom: parent.bottom
  147. text: base.currentItem.next_page_button_text
  148. onClicked: base.showNextPage()
  149. }
  150. Cura.PrimaryButton
  151. {
  152. id: whatsNewSubpageButton
  153. anchors.right: parent.right
  154. anchors.bottom: parent.bottom
  155. text: catalog.i18nc("@button", "Next")
  156. onClicked:
  157. whatsNewDots.currentIndex === (whatsNewDots.count - 1) ?
  158. base.showNextPage() :
  159. ++whatsNewDots.currentIndex
  160. }
  161. }