-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreceiveFile.qml
95 lines (86 loc) · 2.47 KB
/
receiveFile.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtQuick.Dialogs 1.2
Item {
id:receiveFile
width: parent.width*2/3;
height: parent.width*2/3-20;
anchors.centerIn: parent;
property string frindIpv4: ""
property string frindName: ""
property string fileName: ""
Component.onCompleted: {
onRecSuccess.connect(onRecSignal)
function onRecSignal(){
btn_rec.enabled=false;
btn_ref.text="CLOSE";
}
}
Rectangle{
anchors.fill: parent;
// color: Material.color(Material.BlueGrey)
color: "#D3D3D4"
ProgressBar{
id:bar
width: parent.width;
value: 0
}
Component.onCompleted: {
onUpdateRecBar.connect(onUpdate);
function onUpdate(value){
bar.value=value;
}
}
Column{
anchors.centerIn: parent
Text {
id: name
text: fileName
width: 200
clip: true;
elide: Text.ElideMiddle
}
Text {
text: "from: "+frindName
}
Text {
text: "address:"+frindIpv4
}
Row{
spacing: 4
anchors.horizontalCenter: parent.horizontalCenter
Button{
id:btn_rec;
text: "Receive"
Material.background: Material.Teal
onClicked: {
folderSelect.visible=true;
}
}
Button{
id:btn_ref;
text: "Refuse"
Material.background: Material.Red
onClicked: {
receiveFile.destroy();
if(text==="Refuse"){
sendMsg(4,"broadcast",frindName);
}
}
}
}
}
FileDialog{
id:folderSelect;
folder: shortcuts.home;
selectFolder: true;
onAccepted: {
var path=folderSelect.fileUrl;
console.log(path.toString().slice(7))
setFullPath(path.toString().slice(7))
acceptAndConnect(frindIpv4);
}
}
}
}