import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

import LtgWidgets

Item {
    width: 400
    height: 200
	
	// Instruction text property
    property string instructionText: 
		"<h3>Copy Track Volumes</h3><p>  
		<p>This interface is to copy all track volumes from a song to another one.
		The copy is based on the tracks name"

    // Signal to LoopToGo
    signal ltgExecute(ltgType: string, ltgAction: string, ltgParameters: string)

    // Variables from LoopToGo that will be used in this qml file
    Component.onCompleted: {
        loopToGo.registerProperty("g_songCopied", "string");        
    }


// Rectangle as the background
    Rectangle {
		id: mainRectangle
        width: parent.width
        height: parent.height
        color: "#353535"  // Dark background color
		
		// Title
		Text {
			id: titleText
			
			text: "Copy Volumes from a Song"			
			color: "#eeeeee"			
			horizontalAlignment: Text.AlignHCenter  // Ensures text alignment inside the box
			anchors.top: parent.top	
			anchors.horizontalCenter: parent.horizontalCenter  // Centers the text horizontally				
			anchors.margins: mainRectangle.height*.03				
			font.pixelSize: mainRectangle.height*.07
            font.bold: true			
			
		}
		// Song name
		Text {
			id: songNameText
			
			text: loopToGo.properties["g_songCopied"]			
			color: "#1c7eff"			
			horizontalAlignment: Text.AlignHCenter  // Ensures text alignment inside the box
			anchors.top: parent.top	
			anchors.horizontalCenter: parent.horizontalCenter  // Centers the text horizontally				
			anchors.margins: mainRectangle.height*.14			
			font.pixelSize: mainRectangle.height*.10
            font.bold: true			
			
		}
		
		
		
		// Small Button with Image (Bottom-left corner)
		LtgLogoButton {
				
		}

        // Help Button (Top-right corner)
        LtgHelpButton {
            // Show instructions when clicked
			onClicked: {
				messageWindow.show();
			}
        }

		// Message dialog to display instructions		
		LtgMessageWindow {
			id: messageWindow
			title: "Instructions"
			
		}

		RowLayout {
			anchors.fill: parent
			spacing: 40
			anchors.margins: 40	

													
			Item {
				Layout.fillWidth: true
				Layout.fillHeight: true  // Make it resizable

				LtgButton {
					text: "Copy all \nvolumes"
					id: copyButton

					ltgType: "loadScript"
					ltgAction: "copyPasteVolume.ltgs"
					ltgParameters: "copy"
					ltgArmEnabled: false// This buttons does not supports audio arming action
					
					anchors.centerIn: parent

											
					width: mainRectangle.width * 0.30

					height: mainRectangle.height * 0.30

					font.pixelSize: 14
					background: Rectangle {
						color: parent.pressed ? "#8E383C" : "#AF4C50"
						radius: 10
					}
					font.bold: true
				}
			}
			
			Item {
				Layout.fillWidth: true
				Layout.fillHeight: true  // Make it resizable
				
				LtgButton {
					text: "Paste all \nvolumes"
					id: pasteButton

					ltgType: "loadScript"
					ltgAction: "copyPasteVolume.ltgs"
					ltgParameters: "paste"
					ltgArmEnabled: false// This buttons does not supports audio arming action
					
					anchors.centerIn: parent

												
					width: mainRectangle.width * 0.4

					height: mainRectangle.height * 0.35

					font.pixelSize: 18
					background: Rectangle {
						color: parent.pressed ? "#388E3C" : "#4CAF50"
						radius: 10
					}
					font.bold: true
				}
			}
		}		
	}
}
