CacheProgressOverlay.qml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import QtQuick.Layouts 1.15
  4. // Creative cache progress overlay
  5. Rectangle {
  6. id: overlay
  7. anchors.fill: parent
  8. color: "#F0F4F8"
  9. z: 1000
  10. visible: backend && backend.cacheInProgress
  11. property var backend
  12. // Animated background gradient
  13. Rectangle {
  14. anchors.fill: parent
  15. gradient: Gradient {
  16. GradientStop { position: 0.0; color: "#E0E7FF" }
  17. GradientStop { position: 1.0; color: "#F0F4F8" }
  18. }
  19. // Animated floating particles
  20. Repeater {
  21. model: 15
  22. Rectangle {
  23. width: Math.random() * 8 + 4
  24. height: width
  25. radius: width / 2
  26. color: Qt.rgba(0.3, 0.5, 0.8, 0.3)
  27. x: Math.random() * overlay.width
  28. y: Math.random() * overlay.height
  29. SequentialAnimation on y {
  30. loops: Animation.Infinite
  31. running: overlay.visible
  32. NumberAnimation {
  33. from: Math.random() * overlay.height
  34. to: -20
  35. duration: Math.random() * 10000 + 8000
  36. easing.type: Easing.InOutQuad
  37. }
  38. NumberAnimation {
  39. from: -20
  40. to: overlay.height + 20
  41. duration: 0
  42. }
  43. }
  44. SequentialAnimation on opacity {
  45. loops: Animation.Infinite
  46. running: overlay.visible
  47. NumberAnimation { to: 0.6; duration: Math.random() * 2000 + 1000 }
  48. NumberAnimation { to: 0.1; duration: Math.random() * 2000 + 1000 }
  49. }
  50. }
  51. }
  52. }
  53. ColumnLayout {
  54. anchors.centerIn: parent
  55. spacing: 30
  56. width: Math.min(500, parent.width - 80)
  57. // Animated icon
  58. Item {
  59. Layout.alignment: Qt.AlignHCenter
  60. width: 120
  61. height: 120
  62. // Rotating circles
  63. Repeater {
  64. model: 3
  65. Rectangle {
  66. width: 80 - (index * 20)
  67. height: width
  68. radius: width / 2
  69. anchors.centerIn: parent
  70. color: "transparent"
  71. border.width: 3
  72. border.color: Qt.rgba(0.3, 0.5, 0.8, 0.4 - index * 0.1)
  73. RotationAnimation on rotation {
  74. from: index % 2 === 0 ? 0 : 360
  75. to: index % 2 === 0 ? 360 : 0
  76. duration: 3000 + (index * 1000)
  77. loops: Animation.Infinite
  78. running: overlay.visible
  79. }
  80. }
  81. }
  82. // Center icon
  83. Text {
  84. anchors.centerIn: parent
  85. text: "🎨"
  86. font.pixelSize: 48
  87. SequentialAnimation on scale {
  88. loops: Animation.Infinite
  89. running: overlay.visible
  90. NumberAnimation { to: 1.2; duration: 1000; easing.type: Easing.InOutQuad }
  91. NumberAnimation { to: 1.0; duration: 1000; easing.type: Easing.InOutQuad }
  92. }
  93. }
  94. }
  95. // Creative title with rotating messages
  96. Column {
  97. Layout.alignment: Qt.AlignHCenter
  98. spacing: 12
  99. Text {
  100. anchors.horizontalCenter: parent.horizontalCenter
  101. text: "Setting Up Pattern Previews"
  102. font.pixelSize: 24
  103. font.bold: true
  104. color: "#1E293B"
  105. horizontalAlignment: Text.AlignHCenter
  106. }
  107. Text {
  108. anchors.horizontalCenter: parent.horizontalCenter
  109. text: "Generating preview images for your patterns..."
  110. font.pixelSize: 16
  111. color: "#64748B"
  112. horizontalAlignment: Text.AlignHCenter
  113. }
  114. }
  115. // Progress bar
  116. Column {
  117. Layout.alignment: Qt.AlignHCenter
  118. Layout.fillWidth: true
  119. spacing: 8
  120. // Progress bar container
  121. Rectangle {
  122. width: parent.width
  123. height: 8
  124. radius: 4
  125. color: "#CBD5E1"
  126. Rectangle {
  127. width: parent.width * (backend ? backend.cacheProgress.percentage / 100 : 0)
  128. height: parent.height
  129. radius: parent.radius
  130. color: "#3B82F6"
  131. Behavior on width {
  132. NumberAnimation { duration: 300; easing.type: Easing.OutQuad }
  133. }
  134. // Shimmer effect
  135. Rectangle {
  136. anchors.fill: parent
  137. radius: parent.radius
  138. gradient: Gradient {
  139. orientation: Gradient.Horizontal
  140. GradientStop { position: 0.0; color: "transparent" }
  141. GradientStop { position: 0.5; color: Qt.rgba(1, 1, 1, 0.3) }
  142. GradientStop { position: 1.0; color: "transparent" }
  143. }
  144. SequentialAnimation on x {
  145. loops: Animation.Infinite
  146. running: overlay.visible
  147. NumberAnimation {
  148. from: -parent.width
  149. to: parent.width
  150. duration: 1500
  151. }
  152. }
  153. }
  154. }
  155. }
  156. // Progress text
  157. Row {
  158. anchors.horizontalCenter: parent.horizontalCenter
  159. spacing: 8
  160. Text {
  161. text: backend ? Math.round(backend.cacheProgress.percentage) + "%" : "0%"
  162. font.pixelSize: 14
  163. font.bold: true
  164. color: "#3B82F6"
  165. }
  166. Text {
  167. text: "•"
  168. font.pixelSize: 14
  169. color: "#94A3B8"
  170. }
  171. Text {
  172. text: backend ? (backend.cacheProgress.current + " of " + backend.cacheProgress.total + " patterns") : "..."
  173. font.pixelSize: 14
  174. color: "#64748B"
  175. }
  176. }
  177. }
  178. // Patience message
  179. Rectangle {
  180. Layout.alignment: Qt.AlignHCenter
  181. Layout.preferredWidth: Math.min(400, parent.width)
  182. Layout.preferredHeight: 80
  183. color: Qt.rgba(59, 130, 246, 0.1)
  184. radius: 12
  185. border.width: 1
  186. border.color: Qt.rgba(59, 130, 246, 0.2)
  187. ColumnLayout {
  188. anchors.fill: parent
  189. anchors.margins: 16
  190. spacing: 8
  191. Row {
  192. Layout.alignment: Qt.AlignHCenter
  193. spacing: 8
  194. Text {
  195. text: "☕"
  196. font.pixelSize: 20
  197. }
  198. Text {
  199. text: "Grab a coffee while we work our magic"
  200. font.pixelSize: 14
  201. color: "#475569"
  202. }
  203. }
  204. Text {
  205. Layout.alignment: Qt.AlignHCenter
  206. text: "This only happens when new patterns are discovered"
  207. font.pixelSize: 12
  208. color: "#94A3B8"
  209. font.italic: true
  210. }
  211. }
  212. }
  213. // Subtle loading dots
  214. Row {
  215. Layout.alignment: Qt.AlignHCenter
  216. spacing: 8
  217. Repeater {
  218. model: 3
  219. Rectangle {
  220. width: 8
  221. height: 8
  222. radius: 4
  223. color: "#3B82F6"
  224. SequentialAnimation on opacity {
  225. loops: Animation.Infinite
  226. running: overlay.visible
  227. PauseAnimation { duration: index * 200 }
  228. NumberAnimation { to: 0.3; duration: 600 }
  229. NumberAnimation { to: 1.0; duration: 600 }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. // Fade in/out animation
  236. Behavior on visible {
  237. PropertyAnimation {
  238. property: "opacity"
  239. duration: 300
  240. }
  241. }
  242. }