PatternDetailPage.qml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import QtQuick.Layouts 1.15
  4. import "../components"
  5. Page {
  6. id: page
  7. property string patternName: ""
  8. property string patternPath: ""
  9. property string patternPreview: ""
  10. property var backend: null
  11. Rectangle {
  12. anchors.fill: parent
  13. color: "#f5f5f5"
  14. }
  15. ColumnLayout {
  16. anchors.fill: parent
  17. spacing: 0
  18. // Header
  19. Rectangle {
  20. Layout.fillWidth: true
  21. Layout.preferredHeight: 50
  22. color: "white"
  23. // Bottom border
  24. Rectangle {
  25. anchors.bottom: parent.bottom
  26. width: parent.width
  27. height: 1
  28. color: "#e5e7eb"
  29. }
  30. RowLayout {
  31. anchors.fill: parent
  32. anchors.margins: 10
  33. ConnectionStatus {
  34. backend: page.backend
  35. Layout.rightMargin: 8
  36. }
  37. Button {
  38. text: "← Back"
  39. font.pixelSize: 14
  40. flat: true
  41. onClicked: stackView.pop()
  42. }
  43. Label {
  44. text: patternName
  45. Layout.fillWidth: true
  46. elide: Label.ElideRight
  47. font.pixelSize: 16
  48. font.bold: true
  49. color: "#333"
  50. }
  51. }
  52. }
  53. // Content - Side by side layout
  54. Item {
  55. Layout.fillWidth: true
  56. Layout.fillHeight: true
  57. Row {
  58. anchors.fill: parent
  59. spacing: 0
  60. // Left side - Pattern Preview (60% of width)
  61. Rectangle {
  62. width: parent.width * 0.6
  63. height: parent.height
  64. color: "#ffffff"
  65. Image {
  66. anchors.fill: parent
  67. anchors.margins: 10
  68. source: patternPreview ? "file:///" + patternPreview : ""
  69. fillMode: Image.PreserveAspectFit
  70. Rectangle {
  71. anchors.fill: parent
  72. color: "#f0f0f0"
  73. visible: parent.status === Image.Error || parent.source == ""
  74. Column {
  75. anchors.centerIn: parent
  76. spacing: 10
  77. Text {
  78. text: "○"
  79. font.pixelSize: 48
  80. color: "#ccc"
  81. anchors.horizontalCenter: parent.horizontalCenter
  82. }
  83. Text {
  84. text: "No Preview Available"
  85. color: "#999"
  86. font.pixelSize: 14
  87. anchors.horizontalCenter: parent.horizontalCenter
  88. }
  89. }
  90. }
  91. }
  92. }
  93. // Divider
  94. Rectangle {
  95. width: 1
  96. height: parent.height
  97. color: "#e5e7eb"
  98. }
  99. // Right side - Controls (40% of width)
  100. Rectangle {
  101. width: parent.width * 0.4 - 1
  102. height: parent.height
  103. color: "white"
  104. Column {
  105. anchors.fill: parent
  106. anchors.margins: 10
  107. spacing: 15
  108. // Play Button - FIRST AND PROMINENT
  109. Rectangle {
  110. width: parent.width
  111. height: 50
  112. radius: 8
  113. color: playMouseArea.pressed ? "#1e40af" : (backend ? "#2563eb" : "#9ca3af")
  114. Text {
  115. anchors.centerIn: parent
  116. text: "▶ Play Pattern"
  117. color: "white"
  118. font.pixelSize: 16
  119. font.bold: true
  120. }
  121. MouseArea {
  122. id: playMouseArea
  123. anchors.fill: parent
  124. enabled: backend !== null
  125. onClicked: {
  126. if (backend) {
  127. var preExecution = "adaptive"
  128. if (centerRadio.checked) preExecution = "clear_center"
  129. else if (perimeterRadio.checked) preExecution = "clear_perimeter"
  130. else if (noneRadio.checked) preExecution = "none"
  131. backend.executePattern(patternName, preExecution)
  132. }
  133. }
  134. }
  135. }
  136. // Pre-Execution Options
  137. Rectangle {
  138. width: parent.width
  139. height: 160 // Increased height to fit all options
  140. radius: 8
  141. color: "#f8f9fa"
  142. border.color: "#e5e7eb"
  143. border.width: 1
  144. Column {
  145. id: preExecColumn
  146. anchors.left: parent.left
  147. anchors.right: parent.right
  148. anchors.top: parent.top
  149. anchors.margins: 8 // Reduced margins to save space
  150. spacing: 6 // Reduced spacing
  151. Label {
  152. text: "Pre-Execution"
  153. font.pixelSize: 12
  154. font.bold: true
  155. color: "#333"
  156. }
  157. RadioButton {
  158. id: adaptiveRadio
  159. text: "Adaptive"
  160. checked: true
  161. font.pixelSize: 10
  162. }
  163. RadioButton {
  164. id: centerRadio
  165. text: "Clear Center"
  166. font.pixelSize: 10
  167. }
  168. RadioButton {
  169. id: perimeterRadio
  170. text: "Clear Edge"
  171. font.pixelSize: 10
  172. }
  173. RadioButton {
  174. id: noneRadio
  175. text: "None"
  176. font.pixelSize: 10
  177. }
  178. }
  179. }
  180. // Pattern Info
  181. Rectangle {
  182. width: parent.width
  183. height: 80
  184. radius: 8
  185. color: "#f8f9fa"
  186. border.color: "#e5e7eb"
  187. border.width: 1
  188. Column {
  189. id: infoColumn
  190. anchors.left: parent.left
  191. anchors.right: parent.right
  192. anchors.top: parent.top
  193. anchors.margins: 10
  194. spacing: 6
  195. Label {
  196. text: "Pattern Info"
  197. font.pixelSize: 14
  198. font.bold: true
  199. color: "#333"
  200. }
  201. Label {
  202. text: "Name: " + patternName
  203. font.pixelSize: 11
  204. color: "#666"
  205. elide: Text.ElideRight
  206. width: parent.width
  207. }
  208. Label {
  209. text: "Type: Sand Pattern"
  210. font.pixelSize: 11
  211. color: "#666"
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }