file queue
This commit is contained in:
@@ -15,7 +15,63 @@ ApplicationWindow {
|
||||
property string currentSenderAlias: ""
|
||||
property string currentSenderIp: ""
|
||||
property var receiveProgress: ({})
|
||||
property string selectedDeviceFingerprint: ""
|
||||
|
||||
DropArea {
|
||||
id: dropArea
|
||||
anchors.fill: parent
|
||||
z: 9999
|
||||
|
||||
onEntered: function(drag) {
|
||||
if (drag.hasUrls) {
|
||||
drag.accepted = true
|
||||
dropOverlay.visible = true
|
||||
} else {
|
||||
drag.accepted = false
|
||||
}
|
||||
}
|
||||
|
||||
onDropped: function(drop) {
|
||||
dropOverlay.visible = false
|
||||
if (drop.hasUrls) {
|
||||
var paths = []
|
||||
for (var i = 0; i < drop.urls.length; i++) {
|
||||
paths.push(drop.urls[i].toString())
|
||||
}
|
||||
if (paths.length > 0) {
|
||||
appController.addFiles(paths)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: {
|
||||
dropOverlay.visible = false
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: dropOverlay
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
color: "#200080FF"
|
||||
z: 10000
|
||||
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("Drop files here to add them")
|
||||
font.pixelSize: 24
|
||||
font.bold: true
|
||||
color: "#0080FF"
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
color: "transparent"
|
||||
radius: 12
|
||||
border.color: "#0080FF"
|
||||
border.width: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StackView {
|
||||
id: stackView
|
||||
@@ -28,15 +84,15 @@ ApplicationWindow {
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
title: qsTr("Select Files to Send")
|
||||
title: qsTr("Select Files")
|
||||
fileMode: FileDialog.OpenFiles
|
||||
onAccepted: {
|
||||
var paths = []
|
||||
for (var i = 0; i < selectedFiles.length; i++) {
|
||||
paths.push(selectedFiles[i].toString().replace("file://", ""))
|
||||
paths.push(selectedFiles[i].toString())
|
||||
}
|
||||
if (paths.length > 0 && selectedDeviceFingerprint !== "") {
|
||||
appController.sendFiles(selectedDeviceFingerprint, paths)
|
||||
if (paths.length > 0) {
|
||||
appController.addFiles(paths)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,6 +367,86 @@ ApplicationWindow {
|
||||
anchors.margins: 16
|
||||
spacing: 16
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Label {
|
||||
text: qsTr("Selected Files")
|
||||
font.bold: true
|
||||
font.pixelSize: 16
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
Button {
|
||||
text: qsTr("Add Files")
|
||||
onClicked: fileDialog.open()
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Clear All")
|
||||
visible: appController.hasPendingFiles
|
||||
onClicked: appController.clearPendingFiles()
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: pendingFilesList
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Math.min(180, contentHeight)
|
||||
model: appController.pendingFiles
|
||||
spacing: 4
|
||||
visible: appController.hasPendingFiles
|
||||
clip: true
|
||||
|
||||
delegate: Pane {
|
||||
width: ListView.view.width
|
||||
padding: 8
|
||||
|
||||
background: Rectangle {
|
||||
color: "transparent"
|
||||
radius: 6
|
||||
border.color: palette.mid
|
||||
border.width: 1
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 8
|
||||
|
||||
Label {
|
||||
text: modelData.fileName
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideMiddle
|
||||
}
|
||||
Label {
|
||||
text: formatSize(modelData.size)
|
||||
color: palette.mid
|
||||
font.pixelSize: 12
|
||||
}
|
||||
ToolButton {
|
||||
text: "\u2715"
|
||||
font.pixelSize: 14
|
||||
onClicked: appController.removePendingFile(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: !appController.hasPendingFiles
|
||||
text: qsTr("No files selected. Click \"Add Files\" or drag and drop files here.")
|
||||
color: palette.mid
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Nearby Devices")
|
||||
font.bold: true
|
||||
@@ -345,6 +481,7 @@ ApplicationWindow {
|
||||
Label {
|
||||
text: modelData.alias || modelData.ip
|
||||
font.bold: true
|
||||
color: palette.text
|
||||
}
|
||||
Label {
|
||||
text: "%1:%2".arg(modelData.ip).arg(modelData.port)
|
||||
@@ -352,13 +489,14 @@ ApplicationWindow {
|
||||
font.pixelSize: 12
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
visible: appController.hasPendingFiles && !appController.sending
|
||||
text: qsTr("Send")
|
||||
enabled: !appController.sending
|
||||
onClicked: {
|
||||
selectedDeviceFingerprint = modelData.fingerprint
|
||||
fileDialog.open()
|
||||
if (appController.hasPendingFiles && !appController.sending) {
|
||||
appController.sendTo(modelData.fingerprint)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user