ConnectionSplash.qml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import QtQuick.Layouts 1.15
  4. Rectangle {
  5. id: root
  6. anchors.fill: parent
  7. color: "#1a1a1a" // Dark background
  8. property string statusText: "Connecting to backend..."
  9. property bool showRetryButton: false
  10. signal retryConnection()
  11. ColumnLayout {
  12. anchors.centerIn: parent
  13. spacing: 30
  14. width: Math.min(parent.width * 0.8, 400)
  15. // Logo/Title Area
  16. Rectangle {
  17. Layout.alignment: Qt.AlignHCenter
  18. width: 120
  19. height: 120
  20. radius: 60
  21. color: "#2d2d2d"
  22. border.color: "#4a90e2"
  23. border.width: 3
  24. Text {
  25. anchors.centerIn: parent
  26. text: "DW"
  27. font.pixelSize: 36
  28. font.bold: true
  29. color: "#4a90e2"
  30. }
  31. }
  32. Text {
  33. Layout.alignment: Qt.AlignHCenter
  34. text: "Dune Weaver Touch"
  35. font.pixelSize: 32
  36. font.bold: true
  37. color: "white"
  38. }
  39. // Status Area
  40. Rectangle {
  41. Layout.alignment: Qt.AlignHCenter
  42. Layout.preferredWidth: parent.width
  43. Layout.preferredHeight: 80
  44. color: "#2d2d2d"
  45. radius: 10
  46. border.color: "#444"
  47. border.width: 1
  48. RowLayout {
  49. anchors.fill: parent
  50. anchors.margins: 20
  51. spacing: 15
  52. // Spinning loader
  53. Rectangle {
  54. width: 40
  55. height: 40
  56. radius: 20
  57. color: "transparent"
  58. border.color: "#4a90e2"
  59. border.width: 3
  60. Rectangle {
  61. width: 8
  62. height: 8
  63. radius: 4
  64. color: "#4a90e2"
  65. anchors.top: parent.top
  66. anchors.horizontalCenter: parent.horizontalCenter
  67. anchors.topMargin: 2
  68. visible: !root.showRetryButton
  69. }
  70. RotationAnimation on rotation {
  71. running: !root.showRetryButton
  72. loops: Animation.Infinite
  73. from: 0
  74. to: 360
  75. duration: 2000
  76. }
  77. }
  78. Text {
  79. Layout.fillWidth: true
  80. text: root.statusText
  81. font.pixelSize: 16
  82. color: "#cccccc"
  83. wrapMode: Text.WordWrap
  84. verticalAlignment: Text.AlignVCenter
  85. }
  86. }
  87. }
  88. // Retry Button (only show when connection fails)
  89. Button {
  90. Layout.alignment: Qt.AlignHCenter
  91. visible: root.showRetryButton
  92. text: "Retry Connection"
  93. font.pixelSize: 16
  94. background: Rectangle {
  95. color: parent.pressed ? "#3a7bc8" : "#4a90e2"
  96. radius: 8
  97. border.color: "#5a9ff2"
  98. border.width: 1
  99. Behavior on color {
  100. ColorAnimation { duration: 150 }
  101. }
  102. }
  103. contentItem: Text {
  104. text: parent.text
  105. font: parent.font
  106. color: "white"
  107. horizontalAlignment: Text.AlignHCenter
  108. verticalAlignment: Text.AlignVCenter
  109. }
  110. onClicked: {
  111. root.showRetryButton = false
  112. root.retryConnection()
  113. }
  114. }
  115. // Connection Help Text
  116. Text {
  117. Layout.alignment: Qt.AlignHCenter
  118. Layout.preferredWidth: parent.width
  119. text: "Make sure the Dune Weaver backend is running on this device."
  120. font.pixelSize: 14
  121. color: "#888"
  122. horizontalAlignment: Text.AlignHCenter
  123. wrapMode: Text.WordWrap
  124. }
  125. }
  126. // Background animation - subtle pulse
  127. Rectangle {
  128. anchors.fill: parent
  129. color: "#4a90e2"
  130. opacity: 0.05
  131. SequentialAnimation on opacity {
  132. running: !root.showRetryButton
  133. loops: Animation.Infinite
  134. NumberAnimation { to: 0.1; duration: 2000 }
  135. NumberAnimation { to: 0.05; duration: 2000 }
  136. }
  137. }
  138. }