Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLMC
Manage
Activity
Members
Labels
Plan
Issues
26
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLMC
Commits
9c6bff01
Commit
9c6bff01
authored
8 years ago
by
luyikei
Browse files
Options
Downloads
Patches
Plain Diff
Add main.qml
parent
11ecb901
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Gui/timeline/main.qml
+287
-0
287 additions, 0 deletions
src/Gui/timeline/main.qml
with
287 additions
and
0 deletions
src/Gui/timeline/main.qml
0 → 100644
+
287
−
0
View file @
9c6bff01
import
QtQuick
2.0
import
QtQuick
.
Controls
1.4
Rectangle
{
id
:
page
anchors.fill
:
parent
color
:
"
#777777
"
border.width
:
0
property
int
initPosOfCursor
:
100
property
int
ppu
:
10
// Pixels Per minimum Unit
property
int
unit
:
3000
// In milliseconds so ppu / unit = Pixels Per milliseconds
property
double
fps
:
29.97
property
int
maxZ
:
100
property
var
selectedClips
:
[]
property
int
trackHeight
:
30
function
clearSelectedClips
()
{
while
(
selectedClips
.
length
)
{
var
clipInfo
=
selectedClips
.
pop
();
if
(
clipInfo
[
"
item
"
]
)
clipInfo
[
"
item
"
].
selected
=
false
;
}
}
// Convert length in frames to pixels
function
ftop
(
frames
)
{
return
frames
/
fps
*
1000
*
ppu
/
unit
;
}
// Convert length in pixels to frames
function
ptof
(
pixels
)
{
return
Math
.
round
(
pixels
*
fps
/
1000
/
ppu
*
unit
);
}
function
trackContainer
(
trackType
)
{
if
(
trackType
===
"
Video
"
)
return
trackContainers
.
get
(
0
);
return
trackContainers
.
get
(
1
);
}
function
addTrack
(
trackType
)
{
trackContainer
(
trackType
)[
"
tracks
"
].
append
(
{
"
clips
"
:
[]
}
);
}
function
removeTrack
(
trackType
)
{
var
tracks
=
trackContainer
(
trackType
)[
"
tracks
"
];
tracks
.
remove
(
tracks
.
count
-
1
);
}
function
addClip
(
trackType
,
trackId
,
clipDict
)
{
var
newDict
=
{};
newDict
[
"
begin
"
]
=
clipDict
[
"
begin
"
];
newDict
[
"
end
"
]
=
clipDict
[
"
end
"
];
newDict
[
"
position
"
]
=
clipDict
[
"
position
"
];
newDict
[
"
length
"
]
=
clipDict
[
"
length
"
];
newDict
[
"
uuid
"
]
=
clipDict
[
"
uuid
"
];
newDict
[
"
trackId
"
]
=
trackId
;
newDict
[
"
name
"
]
=
clipDict
[
"
name
"
];
var
tracks
=
trackContainer
(
trackType
)[
"
tracks
"
];
tracks
.
get
(
trackId
)[
"
clips
"
].
append
(
newDict
);
if
(
clipDict
[
"
uuid
"
]
===
"
tempUuid
"
)
return
newDict
;
while
(
tracks
.
count
<
trackId
+
2
)
{
addTrack
(
trackType
);
}
return
newDict
;
}
function
removeClipFromTrack
(
trackType
,
trackId
,
uuid
)
{
var
ret
=
false
;
var
tracks
=
trackContainer
(
trackType
)[
"
tracks
"
];
var
clips
=
tracks
.
get
(
trackId
)[
"
clips
"
];
for
(
var
j
=
0
;
j
<
clips
.
count
;
j
++
)
{
var
clip
=
clips
.
get
(
j
);
if
(
clip
.
uuid
===
uuid
)
{
clips
.
remove
(
j
);
ret
=
true
;
j
--
;
}
}
if
(
uuid
===
"
tempUuid
"
)
return
ret
;
while
(
tracks
.
count
>
1
&&
tracks
.
get
(
tracks
.
count
-
2
)[
"
clips
"
].
count
===
0
)
removeTrack
(
trackType
);
return
ret
;
}
function
removeClipFromTrackContainer
(
trackType
,
uuid
)
{
var
tracks
=
trackContainer
(
trackType
)[
"
tracks
"
];
for
(
var
i
=
0
;
i
<
tracks
.
count
;
i
++
)
removeClipFromTrack
(
trackType
,
i
,
uuid
);
}
function
findClipFromTrackContainer
(
trackType
,
uuid
)
{
var
tracks
=
trackContainer
(
trackType
)[
"
tracks
"
];
for
(
var
i
=
0
;
i
<
tracks
.
count
;
i
++
)
{
var
clip
=
findClipFromTrack
(
trackType
,
i
,
uuid
);
if
(
clip
)
return
clip
;
}
return
null
;
}
function
findClipFromTrack
(
trackType
,
trackId
,
uuid
)
{
var
clips
=
trackContainer
(
trackType
)[
"
tracks
"
].
get
(
trackId
)[
"
clips
"
];
for
(
var
j
=
0
;
j
<
clips
.
count
;
j
++
)
{
var
clip
=
clips
.
get
(
j
);
if
(
clip
.
uuid
===
uuid
)
return
clip
;
}
return
null
;
}
function
findClip
(
uuid
)
{
var
v
=
findClipFromTrackContainer
(
"
Video
"
,
uuid
);
if
(
!
v
)
return
findClipFromTrackContainer
(
"
Audio
"
,
uuid
);
return
v
;
}
function
moveClipTo
(
trackType
,
uuid
,
trackId
)
{
var
clip
=
findClipFromTrackContainer
(
trackType
,
uuid
);
if
(
!
clip
)
return
;
var
oldId
=
clip
[
"
trackId
"
];
clip
[
"
trackId
"
]
=
trackId
;
workflow
.
moveClip
(
trackId
,
uuid
,
clip
[
"
position
"
]
);
addClip
(
trackType
,
trackId
,
clip
);
removeClipFromTrack
(
trackType
,
oldId
,
uuid
);
}
ListModel
{
id
:
trackContainers
ListElement
{
name
:
"
Video
"
tracks
:
[]
}
ListElement
{
name
:
"
Audio
"
tracks
:
[]
}
Component.onCompleted
:
{
addTrack
(
"
Video
"
);
addTrack
(
"
Audio
"
);
}
}
MouseArea
{
id
:
selectionArea
anchors.fill
:
page
onPressed
:
{
clearSelectedClips
();
selectionRect
.
visible
=
true
;
selectionRect
.
x
=
mouseX
;
selectionRect
.
y
=
mouseY
;
selectionRect
.
width
=
0
;
selectionRect
.
height
=
0
;
selectionRect
.
initPos
=
Qt
.
point
(
mouseX
,
mouseY
);
}
onPositionChanged
:
{
if
(
selectionRect
.
visible
===
true
)
{
selectionRect
.
x
=
Math
.
min
(
mouseX
,
selectionRect
.
initPos
.
x
);
selectionRect
.
y
=
Math
.
min
(
mouseY
,
selectionRect
.
initPos
.
y
);
selectionRect
.
width
=
Math
.
abs
(
mouseX
-
selectionRect
.
initPos
.
x
);
selectionRect
.
height
=
Math
.
abs
(
mouseY
-
selectionRect
.
initPos
.
y
);
}
}
onReleased
:
{
selectionRect
.
visible
=
false
;
}
}
Ruler
{
id
:
ruler
z
:
1000
}
Cursor
{
id
:
cursor
z
:
2000
height
:
page
.
height
x
:
initPosOfCursor
}
Rectangle
{
id
:
borderBottomOfRuler
width
:
page
.
width
height
:
1
color
:
"
#111111
"
anchors.top
:
ruler
.
bottom
}
ScrollView
{
id
:
sView
anchors.top
:
borderBottomOfRuler
.
bottom
anchors.bottom
:
page
.
bottom
anchors.right
:
page
.
right
anchors.left
:
page
.
left
Column
{
TrackContainer
{
id
:
videoTrackContainer
type
:
"
Video
"
isUpward
:
true
tracks
:
trackContainers
.
get
(
0
)[
"
tracks
"
]
}
Rectangle
{
height
:
20
width
:
page
.
width
gradient
:
Gradient
{
GradientStop
{
position
:
0.00
;
color
:
"
#797979
"
}
GradientStop
{
position
:
0.748
color
:
"
#959697
"
}
GradientStop
{
position
:
0.986
color
:
"
#858f99
"
}
}
}
TrackContainer
{
id
:
audioTrackContainer
type
:
"
Audio
"
isUpward
:
false
tracks
:
trackContainers
.
get
(
1
)[
"
tracks
"
]
}
}
}
Rectangle
{
id
:
selectionRect
visible
:
false
color
:
"
#999999cc
"
property
point
initPos
}
Connections
{
target
:
workflow
onLengthChanged
:
{
if
(
ruler
.
width
<
ftop
(
length
)
+
100
)
{
var
newPpu
=
ppu
;
var
newUnit
=
unit
;
newPpu
*=
width
/
(
ftop
(
length
)
+
100
)
while
(
newPpu
<
5
)
{
newPpu
*=
2
;
newUnit
*=
2
;
}
unit
=
newUnit
;
ppu
=
newPpu
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment