1
0

PatternListPage.qml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import QtQuick.Layouts 1.15
  4. import "../components"
  5. import "../components" as Components
  6. Page {
  7. id: page
  8. header: ToolBar {
  9. RowLayout {
  10. anchors.fill: parent
  11. anchors.margins: 10
  12. TextField {
  13. id: searchField
  14. Layout.fillWidth: true
  15. placeholderText: "Search patterns..."
  16. placeholderTextColor: Components.ThemeManager.textTertiary
  17. color: Components.ThemeManager.textPrimary
  18. onTextChanged: patternModel.filter(text)
  19. font.pixelSize: 16
  20. }
  21. Button {
  22. text: "Playlists"
  23. Layout.preferredHeight: 50
  24. font.pixelSize: 16
  25. onClicked: stackView.push("PlaylistPage.qml")
  26. }
  27. }
  28. }
  29. GridView {
  30. id: gridView
  31. anchors.fill: parent
  32. anchors.margins: 10
  33. cellWidth: 200
  34. cellHeight: 250
  35. model: patternModel
  36. delegate: PatternCard {
  37. width: gridView.cellWidth - 10
  38. height: gridView.cellHeight - 10
  39. name: model.name
  40. preview: model.preview
  41. onClicked: {
  42. stackView.push("PatternDetailPage.qml", {
  43. patternName: model.name,
  44. patternPath: model.path,
  45. patternPreview: model.preview
  46. })
  47. }
  48. }
  49. }
  50. BusyIndicator {
  51. anchors.centerIn: parent
  52. running: patternModel.rowCount() === 0
  53. visible: running
  54. }
  55. Label {
  56. anchors.centerIn: parent
  57. text: "No patterns found"
  58. visible: patternModel.rowCount() === 0 && searchField.text !== ""
  59. color: Components.ThemeManager.textTertiary
  60. font.pixelSize: 18
  61. }
  62. }