Skip to content

Commit dfeb006

Browse files
committed
Upload project files/UI
1 parent 25fb2c7 commit dfeb006

22 files changed

+1380
-0
lines changed

DynamicProgressBar.qml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import QtQuick 2.0
2+
3+
Canvas {
4+
width: parent.width
5+
height: 110
6+
x: staticcanvas.x
7+
y: staticcanvas.y
8+
z: 1
9+
property var value: 0
10+
property bool running: true
11+
renderTarget: Canvas.FramebufferObject
12+
onPaint: {
13+
var ctx = getContext("2d")
14+
ctx.clearRect(0, 0, progresscanvas.width, progresscanvas.height)
15+
if (progresscanvas.value == 0) {
16+
ctx.clearRect(0, 0, progresscanvas.width, progresscanvas.height)
17+
return
18+
}
19+
20+
function drawBezierSplit(ctx, x0, y0, x1, y1, x2, y2, t0, t1) {
21+
22+
if( 0.0 == t0 && t1 == 1.0 ) {
23+
ctx.moveTo( x0, y0 );
24+
ctx.quadraticCurveTo( x1, y1, x2, y2 );
25+
} else if( t0 != t1 ) {
26+
var t00 = t0 * t0,
27+
t01 = 1.0 - t0,
28+
t02 = t01 * t01,
29+
t03 = 2.0 * t0 * t01;
30+
31+
var nx0 = t02 * x0 + t03 * x1 + t00 * x2,
32+
ny0 = t02 * y0 + t03 * y1 + t00 * y2;
33+
34+
t00 = t1 * t1;
35+
t01 = 1.0 - t1;
36+
t02 = t01 * t01;
37+
t03 = 2.0 * t1 * t01;
38+
39+
var nx2 = t02 * x0 + t03 * x1 + t00 * x2,
40+
ny2 = t02 * y0 + t03 * y1 + t00 * y2;
41+
42+
var nx1 = lerp ( lerp ( x0 , x1 , t0 ) , lerp ( x1 , x2 , t0 ) , t1 ),
43+
ny1 = lerp ( lerp ( y0 , y1 , t0 ) , lerp ( y1 , y2 , t0 ) , t1 );
44+
45+
ctx.moveTo( nx0, ny0 );
46+
ctx.quadraticCurveTo( nx1, ny1, nx2, ny2 );
47+
}
48+
}
49+
50+
/**
51+
* Linearly interpolate between two numbers v0, v1 by t
52+
*/
53+
function lerp(v0, v1, t) {
54+
return ( 1.0 - t ) * v0 + t * v1;
55+
}
56+
// ctx.clearRect(0, 0, progresscanvas.width, progresscanvas.height)
57+
var x = progresscanvas.value * (progresscanvas.width / 100)
58+
var firstlineX = progresscanvas.value <= 40 ? x : 40 * (progresscanvas.width / 100)
59+
ctx.lineJoin = 'round'
60+
ctx.lineWidth = 4
61+
ctx.strokeStyle = "#008D21"
62+
ctx.beginPath();
63+
ctx.moveTo(0, 100);
64+
ctx.lineTo(firstlineX, 100);
65+
if (progresscanvas.value <= 40) {
66+
ctx.stroke()
67+
return
68+
}
69+
if (progresscanvas.value <= 60) {
70+
drawBezierSplit(ctx, (40 * (progresscanvas.width / 100)) - 1, 100, (50 * (progresscanvas.width / 100)), 50, (60 * (progresscanvas.width / 100)), 100, 0, (progresscanvas.value % 40) * 0.05);
71+
ctx.stroke()
72+
return
73+
}
74+
drawBezierSplit(ctx, (40 * (progresscanvas.width / 100)) - 1, 100, (50 * (progresscanvas.width / 100)), 50, (60 * (progresscanvas.width / 100)), 100, 0, 1);
75+
ctx.lineTo(x, 100);
76+
ctx.stroke()
77+
}
78+
}

FileDelegate.qml

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
import QtQuick 2.0
2+
import QtQuick.Layouts 1.12
3+
import QtQuick.Controls 2.14
4+
5+
Item {
6+
width: filelist.width
7+
height: 50
8+
Rectangle {
9+
id: delegatebackground
10+
anchors.centerIn: parent
11+
width: parent.width
12+
// width: 0
13+
height: 48
14+
// color: "#039BE5"
15+
}
16+
17+
Rectangle {
18+
// color: "#039BE5"
19+
color: "transparent"
20+
width: parent.width
21+
height: 48
22+
anchors.left: parent.left
23+
anchors.leftMargin: 20
24+
radius: 10
25+
RowLayout {
26+
anchors.fill: parent
27+
anchors.leftMargin: 15
28+
spacing: 15
29+
// Text {
30+
// Layout.preferredWidth: 15
31+
// color: "#616161"
32+
// text: "\uf15b"
33+
// font.family: "fontello"
34+
// font.pixelSize: 20
35+
// }
36+
CheckBox {
37+
id: checkbox
38+
Layout.preferredWidth: 15
39+
Layout.rightMargin: -15
40+
// checked: true
41+
}
42+
43+
Text {
44+
id: fname
45+
Layout.alignment: Qt.AlignVCenter
46+
Layout.preferredWidth: 30
47+
color: "#616161"
48+
text: model.filename
49+
font.pixelSize: 15
50+
}
51+
52+
Text {
53+
Layout.alignment: Qt.AlignVCenter
54+
Layout.preferredWidth: 15
55+
color: "#616161"
56+
text: model.size
57+
font.pixelSize: 15
58+
}
59+
Text {
60+
Layout.alignment: Qt.AlignVCenter
61+
Layout.preferredWidth: 10
62+
color: "#616161"
63+
text: model.type
64+
font.pixelSize: 15
65+
}
66+
Text {
67+
Layout.alignment: Qt.AlignVCenter
68+
Layout.preferredWidth: 15
69+
color: "#616161"
70+
text: model.mimetype
71+
font.pixelSize: 15
72+
}
73+
}
74+
states: [
75+
State {
76+
name: "choosed"
77+
PropertyChanges {
78+
target: delegatebackground
79+
// color: "#D32F2F"
80+
color: "#039BE5"
81+
}
82+
PropertyChanges {
83+
target: delegatebackground
84+
width: parent.width
85+
}
86+
PropertyChanges {
87+
target: delegatebackground
88+
opacity: 0.5
89+
}
90+
},
91+
State {
92+
name: "not-choosed"
93+
PropertyChanges {
94+
target: delegatebackground
95+
color: "transparent"
96+
}
97+
}
98+
]
99+
transitions: [
100+
Transition {
101+
from: "not-choosed"
102+
to: "choosed"
103+
104+
ColorAnimation {
105+
// from: "white"
106+
// to: "black"
107+
duration: 200
108+
}
109+
PropertyAnimation {
110+
// target: delegatebackground
111+
property: "width"
112+
from: 0
113+
duration: 150
114+
easing: Easing.OutQuart
115+
}
116+
},
117+
Transition {
118+
from: "choosed"
119+
to: "not-choosed"
120+
121+
ColorAnimation {
122+
target: delegatebackground
123+
duration: 200
124+
easing: Easing.OutQuart
125+
}
126+
// PropertyAnimation {
127+
//// target: delegatebackground
128+
// property: "width"
129+
// duration: 200
130+
//// easing:
131+
// }
132+
}
133+
]
134+
state: checkbox.checked ? "choosed" : "not-choosed"
135+
onStateChanged: {
136+
if (state == "choosed") {
137+
filelist.fileIndex.push(index)
138+
filelist.removeMode = true
139+
return
140+
}
141+
filelist.fileIndex.splice(filelist.fileIndex.indexOf(index), 1)
142+
filelist.removeMode = fileIndex.length > 0 ? true : false
143+
}
144+
}
145+
}

FileView.qml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import QtQuick 2.12
2+
import QtQuick.Controls 2.12
3+
4+
ListView {
5+
id: root
6+
anchors.fill: parent
7+
boundsBehavior: Flickable.OvershootBounds
8+
bottomMargin: 26
9+
ScrollIndicator.vertical: ScrollIndicator { }
10+
property bool removeMode: fileIndex.length > 0 ? true : false
11+
property var fileIndex: []
12+
clip: true
13+
model: mainmodel
14+
// model: model1
15+
delegate: FileDelegate { }
16+
add: Transition {
17+
NumberAnimation {
18+
property: "x"
19+
from: -300
20+
duration: 200
21+
}
22+
}
23+
24+
removeDisplaced: Transition {
25+
NumberAnimation {
26+
properties: "y"
27+
duration: 400
28+
}
29+
}
30+
addDisplaced: Transition {
31+
NumberAnimation {
32+
properties: "y"
33+
duration: 200
34+
}
35+
}
36+
remove: Transition {
37+
NumberAnimation {
38+
property: "x"
39+
to: -parent.width
40+
duration: 200
41+
}
42+
}
43+
44+
function removeIndexList() {
45+
fileIndex.sort()
46+
for (var i = 0; i < fileIndex.length; ++i) {
47+
mainmodel.remove(fileIndex[i] - i)
48+
}
49+
fileIndex = []
50+
removeMode = false
51+
}
52+
}

0 commit comments

Comments
 (0)