ui changes

This commit is contained in:
lasan
2026-06-30 18:19:32 +05:30
parent acaddae5ea
commit c61c59dbb8
6 changed files with 169 additions and 90 deletions
+50 -14
View File
@@ -4,12 +4,20 @@ import QtQuick.Controls
import QtQuick.Shapes
RowLayout {
id: top
id: top
anchors.fill: parent
spacing: 0
property string pendingPath: ""
property bool pendingTransfer: false
property bool incomingShare: false
property int currentIndex: 0
property string filename: "VacationPhoto_2026.jpg"
property string targetname: "Lasan's A55"
property real progressValue: 0.64
property string statusText: "Receiving 1 of 1 items"
property bool transferring: true
Connections {
target: backend
@@ -17,23 +25,51 @@ RowLayout {
function onStatusTextChanged(){
console.log(backend.statusText)
}
function onIncomingTransfer(share_target_id, device_name, status){
console.log("Getting incoming share")
currentIndex = 2
transferring = false
}
}
Component.onCompleted: {
backend.startReceive()
}
Component.onDestruction: {
backend.stopReceive()
backend.stopDiscovery()
}
//Component.onCompleted: {
// backend.startReceive();
//}
//Component.onDestruction: {
// backend.stopReceive();
//}
Sidebar {}
function cancelPendingShare(){
pendingPath = ""
currentIndex = 0
backend.stopDiscovery()
backend.startReceive()
}
function startSharing(){
backend.stopReceive()
backend.startDiscovery()
currentIndex = 1
}
Sidebar {
pendingPath: top.pendingPath
onCancelPendingShareRequested: {
top.cancelPendingShare()
}
}
StackLayout {
id: contentStack
Layout.fillWidth: true
Layout.fillHeight: true
currentIndex: 0
currentIndex: top.currentIndex
Drop {
onFileSelected: path =>{
top.pendingPath = path
startSharing()
}
}
Rectangle {
@@ -45,11 +81,11 @@ RowLayout {
}
IncomingShare {
filename: "VacationPhoto_2026.jpg"
targetname: "Lasan's A55"
progressValue: 0.64
statusText: "Receiving 1 of 1 items"
transferring: true
filename: top.filename
targetname: top.targetname
progressValue: top.progressValue
statusText: top.statusText
transferring: top.transferring
}
+40 -2
View File
@@ -2,11 +2,38 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Shapes
import QtQuick.Dialogs
import QtCore
Rectangle {
signal fileSelected(string filePath)
id: dropZone
color: "transparent"
FileDialog {
id: fileDialog
title: "Please choose a file"
currentFolder: Qt.resolvedUrl(StandardPaths.writableLocation(StandardPaths.HomeLocation))
// Optional: Filter for specific files (e.g., images, PDFs)
nameFilters: ["All files (*)"]
// Handle the selected file
onAccepted: {
fileSelected(fileDialog.selectedFile)
// Your logic to process/upload the file goes here
}
onRejected: {
console.log("File picker canceled")
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor // Changes cursor to a hand on hover
onClicked: {
fileDialog.open() // Opens the native OS file picker
}
}
//signal fileDropped(string path)
DropArea {
anchors.fill: parent
@@ -15,12 +42,13 @@ Rectangle {
dropText.text = "Drag and drop files to share";
dropZone.color = "transparent";
}
onEntered: k => { console.log("Entered")}
// The action: What happens when the user releases the item here
onDropped: drop => {
drop.acceptProposedAction();
drop.acceptProposedAction();
if (drop.hasUrls) {
console.log(drop.urls[0].toString());
for (let i of drop.formats){
@@ -50,6 +78,16 @@ Rectangle {
font.pointSize: 18
color: "#333333"
}
Text {
id: subText
text: "Click to open file picker"
font.pointSize: 12
color: "gray"
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
}
}
Canvas {
id: dashedBorderCanvas
+12 -70
View File
@@ -1,18 +1,16 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Shapes
Rectangle {
id: rootItem
// Explicit sizes so parent containers know how to space them
width: 100
height: 130
height: 110 // Reduced slightly since the progress outer bounds are gone
color: "transparent"
// --- CUSTOM ARGUMENTS (PROPERTIES) ---
property string deviceName: "Unknown Device"
property real progressValue: 0.0 // Value between 0.0 and 1.0
property string iconSource: "qrc:icons/smartphone.svg"
ColumnLayout {
@@ -21,85 +19,29 @@ Rectangle {
anchors.right: parent.right
spacing: 5
// --- ICON CONTAINER WITH PROGRESS RINGS ---
// --- ICON CONTAINER ---
Item {
id: iconContainer
implicitWidth: 72
implicitHeight: 72
implicitWidth: 60
implicitHeight: 60
Layout.alignment: Qt.AlignHCenter
// Target angle calculated using the custom dynamic argument
property real targetAngle: 360 * rootItem.progressValue
Behavior on targetAngle {
NumberAnimation {
duration: 300
easing.type: Easing.OutQuad
}
}
// Background Gray Track Ring
Shape {
anchors.fill: parent
layer.enabled: true
layer.samples: 8
antialiasing: true
ShapePath {
strokeColor: "#E0E4E8"
strokeWidth: 4
fillColor: "transparent"
PathAngleArc {
centerX: iconContainer.width / 2
centerY: iconContainer.height / 2
radiusX: 32
radiusY: 32
startAngle: -90
sweepAngle: 360
}
}
}
// Active Progress Ring
Shape {
anchors.fill: parent
layer.enabled: true
layer.samples: 8
antialiasing: true
ShapePath {
strokeColor: "#00658F"
strokeWidth: 4
fillColor: "transparent"
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: iconContainer.width / 2
centerY: iconContainer.height / 2
radiusX: 32
radiusY: 32
startAngle: -90
sweepAngle: iconContainer.targetAngle
}
}
}
// Icon Circle
// Icon Circle Background
Rectangle {
width: 60
height: 60
anchors.centerIn: parent
id: iconCircle
anchors.fill: parent
color: "#6EA7B6"
radius: 30
radius: width / 2
Button {
id: iconButton
icon.source: rootItem.iconSource
anchors.fill: parent
anchors.margins: 5
icon.color: "white"
icon.height: height
icon.width: width
icon.height: iconCircle.height
icon.width: iconCircle.width
background: Rectangle {
color: "transparent"
}
+7 -1
View File
@@ -8,8 +8,12 @@ Rectangle {
Layout.fillHeight: true
Layout.preferredWidth: 300
property string pendingPath: ""
color: "#CBF0FF"
signal cancelPendingShareRequested()
ColumnLayout {
anchors.margins: 20
anchors.fill: parent
@@ -65,6 +69,7 @@ Rectangle {
}
Rectangle {
visible: pendingPath.length != 0
Layout.preferredHeight: 350
Layout.fillWidth: true
border.color: "#91C8DE"
@@ -98,13 +103,14 @@ Rectangle {
Layout.fillWidth: true
color: "gray"
wrapMode: Text.WordWrap
text: "/home/lasan/test/this/is/a/very/long/file/path/file.pp"
text: decodeURIComponent(pendingPath).replace("file://", "")
horizontalAlignment: Text.AlignHCenter
}
Button {
id: cancelbutton
Layout.fillWidth: true
text: "Cancel"
onClicked: sidebar.cancelPendingShareRequested()
contentItem: Text {
text: cancelbutton.text
font.pointSize: 14