| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089 |
- import QtQuick 2.15
- import QtQuick.Controls 2.15
- import QtQuick.Layouts 1.15
- import DuneWeaver 1.0
- import "../components"
- import "../components" as Components
- Page {
- id: page
-
- property var backend: null
- property var stackView: null
- property var mainWindow: null
-
- // State management for navigation
- property bool showingPlaylistDetail: false
- property string selectedPlaylist: ""
- property var selectedPlaylistData: null
- property var currentPlaylistPatterns: []
-
- // Playlist execution settings
- property real pauseTime: backend ? backend.pauseBetweenPatterns : 0
- property string clearPattern: "adaptive"
- property string runMode: "single"
- property bool shuffle: false
-
- PlaylistModel {
- id: playlistModel
- }
-
- // Update patterns when playlist selection changes
- onSelectedPlaylistChanged: {
- if (selectedPlaylist) {
- currentPlaylistPatterns = playlistModel.getPatternsForPlaylist(selectedPlaylist)
- console.log("Loaded patterns for", selectedPlaylist + ":", currentPlaylistPatterns)
- } else {
- currentPlaylistPatterns = []
- }
- }
-
- // Debug playlist loading
- Component.onCompleted: {
- console.log("ModernPlaylistPage completed, playlist count:", playlistModel.rowCount())
- console.log("showingPlaylistDetail:", showingPlaylistDetail)
- }
-
- // Function to navigate to playlist detail
- function showPlaylistDetail(playlistName, playlistData) {
- selectedPlaylist = playlistName
- selectedPlaylistData = playlistData
- showingPlaylistDetail = true
- }
-
- // Function to go back to playlist list
- function showPlaylistList() {
- showingPlaylistDetail = false
- selectedPlaylist = ""
- selectedPlaylistData = null
- }
-
- Rectangle {
- anchors.fill: parent
- color: Components.ThemeManager.backgroundColor
- }
- // Playlist List View (shown by default)
- Rectangle {
- id: playlistListView
- anchors.fill: parent
- color: Components.ThemeManager.backgroundColor
- visible: !showingPlaylistDetail
-
- ColumnLayout {
- anchors.fill: parent
- spacing: 0
-
- // Header
- Rectangle {
- Layout.fillWidth: true
- Layout.preferredHeight: 50
- color: Components.ThemeManager.surfaceColor
- // Bottom border
- Rectangle {
- anchors.bottom: parent.bottom
- width: parent.width
- height: 1
- color: Components.ThemeManager.borderColor
- }
-
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 15
- anchors.rightMargin: 10
-
- ConnectionStatus {
- backend: page.backend
- Layout.rightMargin: 8
- }
-
- Label {
- text: "Playlists"
- font.pixelSize: 18
- font.bold: true
- color: Components.ThemeManager.textPrimary
- }
- Label {
- text: playlistModel.rowCount() + " playlists"
- font.pixelSize: 12
- color: Components.ThemeManager.textTertiary
- }
-
- Item {
- Layout.fillWidth: true
- }
- }
- }
-
- // Playlist List
- ListView {
- Layout.fillWidth: true
- Layout.fillHeight: true
- Layout.margins: 15
- model: playlistModel
- spacing: 12
- clip: true
-
- ScrollBar.vertical: ScrollBar {
- active: true
- policy: ScrollBar.AsNeeded
- }
-
- delegate: Rectangle {
- width: ListView.view.width
- height: 80
- color: Components.ThemeManager.surfaceColor
- radius: 12
- border.color: Components.ThemeManager.borderColor
- border.width: 1
-
- // Press animation
- scale: mouseArea.pressed ? 0.98 : 1.0
-
- Behavior on scale {
- NumberAnimation { duration: 100; easing.type: Easing.OutQuad }
- }
-
- RowLayout {
- anchors.fill: parent
- anchors.margins: 20
- spacing: 15
-
- // Icon
- Rectangle {
- Layout.preferredWidth: 40
- Layout.preferredHeight: 40
- radius: 20
- color: Components.ThemeManager.darkMode ? "#1e3a5f" : "#e3f2fd"
- Text {
- anchors.centerIn: parent
- text: "♪"
- font.pixelSize: 18
- color: "#2196F3"
- }
- }
-
- // Playlist info
- Column {
- Layout.fillWidth: true
- spacing: 4
-
- Label {
- text: model.name
- font.pixelSize: 16
- font.bold: true
- color: Components.ThemeManager.textPrimary
- elide: Text.ElideRight
- width: parent.width
- }
- Label {
- text: model.itemCount + " patterns"
- color: Components.ThemeManager.textSecondary
- font.pixelSize: 12
- }
- }
-
- // Arrow
- Text {
- text: "▶"
- font.pixelSize: 16
- color: Components.ThemeManager.textTertiary
- }
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: {
- showPlaylistDetail(model.name, model)
- }
- }
- }
-
- // Empty state
- Rectangle {
- anchors.fill: parent
- color: "transparent"
- visible: playlistModel.rowCount() === 0
-
- Column {
- anchors.centerIn: parent
- spacing: 15
-
- Text {
- text: "♪"
- color: Components.ThemeManager.placeholderText
- font.pixelSize: 64
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Label {
- text: "No playlists found"
- anchors.horizontalCenter: parent.horizontalCenter
- color: Components.ThemeManager.textSecondary
- font.pixelSize: 18
- }
- Label {
- text: "Create playlists to organize\\nyour pattern collections"
- anchors.horizontalCenter: parent.horizontalCenter
- color: Components.ThemeManager.textTertiary
- font.pixelSize: 14
- horizontalAlignment: Text.AlignHCenter
- }
- }
- }
- }
- }
- }
-
- // Playlist Detail View (shown when a playlist is selected)
- Rectangle {
- id: playlistDetailView
- anchors.fill: parent
- color: Components.ThemeManager.backgroundColor
- visible: showingPlaylistDetail
-
- ColumnLayout {
- anchors.fill: parent
- spacing: 0
-
- // Header with back button
- Rectangle {
- Layout.fillWidth: true
- Layout.preferredHeight: 50
- color: Components.ThemeManager.surfaceColor
- // Bottom border
- Rectangle {
- anchors.bottom: parent.bottom
- width: parent.width
- height: 1
- color: Components.ThemeManager.borderColor
- }
-
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 15
- anchors.rightMargin: 10
- spacing: 10
-
- ConnectionStatus {
- backend: page.backend
- Layout.rightMargin: 8
- }
-
- Button {
- text: "← Back"
- font.pixelSize: 14
- flat: true
- onClicked: showPlaylistList()
- contentItem: Text {
- text: parent.text
- font: parent.font
- color: Components.ThemeManager.textPrimary
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- }
-
- Label {
- text: selectedPlaylist
- font.pixelSize: 18
- font.bold: true
- color: Components.ThemeManager.textPrimary
- Layout.fillWidth: true
- elide: Text.ElideRight
- }
- Label {
- text: currentPlaylistPatterns.length + " patterns"
- font.pixelSize: 12
- color: Components.ThemeManager.textTertiary
- }
- }
- }
-
- // Content - Pattern list on left, controls on right
- Item {
- Layout.fillWidth: true
- Layout.fillHeight: true
-
- Row {
- anchors.fill: parent
- spacing: 0
-
- // Left side - Pattern List (40% of width)
- Rectangle {
- width: parent.width * 0.4
- height: parent.height
- color: Components.ThemeManager.surfaceColor
-
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 15
- spacing: 10
-
- Label {
- text: "Patterns"
- font.pixelSize: 14
- font.bold: true
- color: Components.ThemeManager.textPrimary
- }
-
- ScrollView {
- Layout.fillWidth: true
- Layout.fillHeight: true
- clip: true
-
- ListView {
- id: patternListView
- width: parent.width
- model: currentPlaylistPatterns
- spacing: 6
-
- delegate: Rectangle {
- width: patternListView.width
- height: 35
- color: index % 2 === 0 ? Components.ThemeManager.cardColor : Components.ThemeManager.surfaceColor
- radius: 6
- border.color: Components.ThemeManager.borderColor
- border.width: 1
-
- RowLayout {
- anchors.fill: parent
- anchors.margins: 10
- spacing: 8
-
- Label {
- text: (index + 1) + "."
- font.pixelSize: 11
- color: Components.ThemeManager.textSecondary
- Layout.preferredWidth: 25
- }
- Label {
- text: modelData
- font.pixelSize: 11
- color: Components.ThemeManager.textPrimary
- Layout.fillWidth: true
- elide: Text.ElideRight
- }
- }
- }
- }
- }
-
- // Empty playlist message
- Rectangle {
- Layout.fillWidth: true
- Layout.fillHeight: true
- color: "transparent"
- visible: currentPlaylistPatterns.length === 0
-
- Column {
- anchors.centerIn: parent
- spacing: 10
-
- Text {
- text: "♪"
- font.pixelSize: 32
- color: Components.ThemeManager.placeholderText
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Label {
- text: "Empty playlist"
- anchors.horizontalCenter: parent.horizontalCenter
- color: Components.ThemeManager.textSecondary
- font.pixelSize: 14
- }
- }
- }
- }
- }
-
- // Divider
- Rectangle {
- width: 1
- height: parent.height
- color: Components.ThemeManager.borderColor
- }
- // Right side - Full height controls (60% of width)
- Rectangle {
- width: parent.width * 0.6 - 1
- height: parent.height
- color: Components.ThemeManager.surfaceColor
-
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 15
- spacing: 15
-
- Label {
- text: "Playlist Controls"
- font.pixelSize: 16
- font.bold: true
- color: Components.ThemeManager.textPrimary
- }
-
- // Main execution buttons
- RowLayout {
- Layout.fillWidth: true
- spacing: 10
-
- // Play Playlist button
- Rectangle {
- Layout.fillWidth: true
- Layout.preferredHeight: 45
- radius: 8
- color: playMouseArea.pressed ? "#1e40af" : "#2563eb"
-
- Text {
- anchors.centerIn: parent
- text: "Play Playlist"
- color: "white"
- font.pixelSize: 14
- font.bold: true
- }
-
- MouseArea {
- id: playMouseArea
- anchors.fill: parent
- onClicked: {
- if (backend) {
- console.log("Playing playlist:", selectedPlaylist, "with settings:", {
- pauseTime: pauseTime,
- clearPattern: clearPattern,
- runMode: runMode,
- shuffle: shuffle
- })
- backend.executePlaylist(selectedPlaylist, pauseTime, clearPattern, runMode, shuffle)
-
- // Navigate to execution page
- console.log("🎵 Navigating to execution page after playlist start")
- if (mainWindow) {
- console.log("🎵 Setting shouldNavigateToExecution = true")
- mainWindow.shouldNavigateToExecution = true
- } else {
- console.log("🎵 ERROR: mainWindow is null, cannot navigate")
- }
- }
- }
- }
- }
-
- // Shuffle toggle button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 45
- radius: 8
- color: shuffle ? "#2563eb" : "#6b7280"
-
- Text {
- anchors.centerIn: parent
- text: "⇄"
- color: "white"
- font.pixelSize: 16
- }
-
- MouseArea {
- id: shuffleMouseArea
- anchors.fill: parent
- onClicked: {
- shuffle = !shuffle
- console.log("Shuffle toggled:", shuffle)
- }
- }
- }
- }
-
- // Settings section
- Rectangle {
- Layout.fillWidth: true
- Layout.fillHeight: true
- Layout.minimumHeight: 250
- radius: 10
- color: Components.ThemeManager.cardColor
- border.color: Components.ThemeManager.borderColor
- border.width: 1
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 15
- spacing: 15
- Label {
- text: "Settings"
- font.pixelSize: 14
- font.bold: true
- color: Components.ThemeManager.textPrimary
- }
- // Scrollable settings content
- ScrollView {
- Layout.fillWidth: true
- Layout.fillHeight: true
- clip: true
- ScrollBar.vertical.policy: ScrollBar.AsNeeded
- ColumnLayout {
- width: parent.width
- spacing: 15
-
- // Run mode
- Column {
- Layout.fillWidth: true
- spacing: 8
-
- Label {
- text: "Run Mode:"
- font.pixelSize: 12
- color: Components.ThemeManager.textSecondary
- font.bold: true
- }
-
- RowLayout {
- width: parent.width
- spacing: 15
-
- RadioButton {
- id: singleModeRadio
- text: "Single"
- font.pixelSize: 11
- checked: true // Default
- onClicked: {
- runMode = "single"
- console.log("Run mode set to:", runMode)
- }
- contentItem: Text {
- text: parent.text
- font: parent.font
- color: Components.ThemeManager.textPrimary
- verticalAlignment: Text.AlignVCenter
- leftPadding: parent.indicator.width + parent.spacing
- }
- }
- RadioButton {
- id: loopModeRadio
- text: "Loop"
- font.pixelSize: 11
- checked: false
- onClicked: {
- runMode = "loop"
- console.log("Run mode set to:", runMode)
- }
- contentItem: Text {
- text: parent.text
- font: parent.font
- color: Components.ThemeManager.textPrimary
- verticalAlignment: Text.AlignVCenter
- leftPadding: parent.indicator.width + parent.spacing
- }
- }
- }
- }
-
- // Pause Between Patterns
- Column {
- Layout.fillWidth: true
- spacing: 15
-
- Label {
- text: "Pause between patterns:"
- font.pixelSize: 12
- color: Components.ThemeManager.textSecondary
- font.bold: true
- }
-
- // Touch-friendly button row for pause options
- RowLayout {
- id: pauseGrid
- Layout.fillWidth: true
- spacing: 8
-
- property string currentSelection: backend ? backend.getCurrentPauseOption() : "0s"
-
- // 0s button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "0s" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "0s" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "0s"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "0s" ? "white" : Components.ThemeManager.textPrimary
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("0s")
- pauseGrid.currentSelection = "0s"
- pauseTime = 0
- }
- }
- }
- }
-
- // 1 min button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "1 min" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "1 min" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "1m"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "1 min" ? "white" : Components.ThemeManager.textPrimary
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("1 min")
- pauseGrid.currentSelection = "1 min"
- pauseTime = 60
- }
- }
- }
- }
-
- // 5 min button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "5 min" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "5 min" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "5m"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "5 min" ? "white" : Components.ThemeManager.textPrimary
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("5 min")
- pauseGrid.currentSelection = "5 min"
- pauseTime = 300
- }
- }
- }
- }
-
- // 15 min button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "15 min" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "15 min" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "15m"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "15 min" ? "white" : Components.ThemeManager.textPrimary
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("15 min")
- pauseGrid.currentSelection = "15 min"
- pauseTime = 900
- }
- }
- }
- }
-
- // 30 min button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "30 min" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "30 min" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "30m"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "30 min" ? "white" : Components.ThemeManager.textPrimary
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("30 min")
- pauseGrid.currentSelection = "30 min"
- pauseTime = 1800
- }
- }
- }
- }
-
- // 1 hour button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "1 hour" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "1 hour" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "1h"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "1 hour" ? "white" : Components.ThemeManager.textPrimary
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("1 hour")
- pauseGrid.currentSelection = "1 hour"
- pauseTime = 3600
- }
- }
- }
- }
- }
- // Second row for longer hour options
- RowLayout {
- Layout.fillWidth: true
- spacing: 8
- // 2h button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "2 hour" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "2 hour" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "2h"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "2 hour" ? "white" : Components.ThemeManager.textPrimary
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("2 hour")
- pauseGrid.currentSelection = "2 hour"
- pauseTime = 7200
- }
- }
- }
- }
- // 3h button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "3 hour" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "3 hour" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "3h"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "3 hour" ? "white" : Components.ThemeManager.textPrimary
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("3 hour")
- pauseGrid.currentSelection = "3 hour"
- pauseTime = 10800
- }
- }
- }
- }
- // 4h button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "4 hour" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "4 hour" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "4h"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "4 hour" ? "white" : Components.ThemeManager.textPrimary
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("4 hour")
- pauseGrid.currentSelection = "4 hour"
- pauseTime = 14400
- }
- }
- }
- }
- // 5h button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "5 hour" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "5 hour" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "5h"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "5 hour" ? "white" : Components.ThemeManager.textPrimary
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("5 hour")
- pauseGrid.currentSelection = "5 hour"
- pauseTime = 18000
- }
- }
- }
- }
- // 6h button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "6 hour" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "6 hour" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "6h"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "6 hour" ? "white" : Components.ThemeManager.textPrimary
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("6 hour")
- pauseGrid.currentSelection = "6 hour"
- pauseTime = 21600
- }
- }
- }
- }
- // 12h button
- Rectangle {
- Layout.preferredWidth: 60
- Layout.preferredHeight: 40
- color: pauseGrid.currentSelection === "12 hour" ? Components.ThemeManager.selectedBackground : Components.ThemeManager.buttonBackground
- border.color: pauseGrid.currentSelection === "12 hour" ? Components.ThemeManager.selectedBorder : Components.ThemeManager.buttonBorder
- border.width: 2
- radius: 8
- Label {
- anchors.centerIn: parent
- text: "12h"
- font.pixelSize: 12
- font.bold: true
- color: pauseGrid.currentSelection === "12 hour" ? "white" : Components.ThemeManager.textPrimary
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (backend) {
- backend.setPauseByOption("12 hour")
- pauseGrid.currentSelection = "12 hour"
- pauseTime = 43200
- }
- }
- }
- }
- // Update selection when backend changes
- Connections {
- target: backend
- function onPauseBetweenPatternsChanged(pause) {
- if (backend) {
- pauseGrid.currentSelection = backend.getCurrentPauseOption()
- pauseTime = backend.pauseBetweenPatterns
- }
- }
- }
- }
- }
-
- // Clear pattern
- Column {
- Layout.fillWidth: true
- spacing: 8
-
- Label {
- text: "Clear Pattern:"
- font.pixelSize: 12
- color: Components.ThemeManager.textSecondary
- font.bold: true
- }
-
- GridLayout {
- width: parent.width
- columns: 2
- columnSpacing: 10
- rowSpacing: 5
-
- RadioButton {
- id: adaptiveRadio
- text: "Adaptive"
- font.pixelSize: 11
- checked: true // Default
- onClicked: {
- clearPattern = "adaptive"
- console.log("Clear pattern set to:", clearPattern)
- }
- contentItem: Text {
- text: parent.text
- font: parent.font
- color: Components.ThemeManager.textPrimary
- verticalAlignment: Text.AlignVCenter
- leftPadding: parent.indicator.width + parent.spacing
- }
- }
- RadioButton {
- id: clearCenterRadio
- text: "Clear Center"
- font.pixelSize: 11
- checked: false
- onClicked: {
- clearPattern = "clear_center"
- console.log("Clear pattern set to:", clearPattern)
- }
- contentItem: Text {
- text: parent.text
- font: parent.font
- color: Components.ThemeManager.textPrimary
- verticalAlignment: Text.AlignVCenter
- leftPadding: parent.indicator.width + parent.spacing
- }
- }
- RadioButton {
- id: clearEdgeRadio
- text: "Clear Edge"
- font.pixelSize: 11
- checked: false
- onClicked: {
- clearPattern = "clear_perimeter"
- console.log("Clear pattern set to:", clearPattern)
- }
- contentItem: Text {
- text: parent.text
- font: parent.font
- color: Components.ThemeManager.textPrimary
- verticalAlignment: Text.AlignVCenter
- leftPadding: parent.indicator.width + parent.spacing
- }
- }
- RadioButton {
- id: noneRadio
- text: "None"
- font.pixelSize: 11
- checked: false
- onClicked: {
- clearPattern = "none"
- console.log("Clear pattern set to:", clearPattern)
- }
- contentItem: Text {
- text: parent.text
- font: parent.font
- color: Components.ThemeManager.textPrimary
- verticalAlignment: Text.AlignVCenter
- leftPadding: parent.indicator.width + parent.spacing
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
|