Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
b3f6f019
Commit
b3f6f019
authored
Jan 08, 2020
by
Jean-Baptiste Mardelle
Browse files
Cleanup timeline thumbnail mechanism on resize
parent
d8fd5e44
Pipeline
#12949
passed with stage
in 13 minutes and 27 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/Clip.qml
View file @
b3f6f019
...
...
@@ -211,7 +211,6 @@ Rectangle {
property
bool
noThumbs
:
(
isAudio
||
itemType
==
ProducerType
.
Color
||
mltService
===
''
)
property
bool
isImage
:
itemType
==
ProducerType
.
Image
property
string
baseThumbPath
:
noThumbs
?
''
:
'
image://thumbnail/
'
+
binId
+
'
/
'
+
documentId
+
'
/
'
+
(
isImage
?
'
#0
'
:
'
#
'
)
property
string
baseCacheThumbPath
:
noThumbs
?
''
:
'
image://thumbnailCache/
'
+
binId
+
'
/
'
+
(
isImage
?
'
#0
'
:
'
#
'
)
DropArea
{
//Drop area for clips
anchors.fill
:
clipRoot
...
...
src/timeline2/view/qml/ClipThumbs.qml
View file @
b3f6f019
...
...
@@ -38,13 +38,12 @@ Row {
asynchronous
:
true
cache
:
enableCache
property
int
currentFrame
:
thumbRepeater
.
count
<
3
?
(
index
==
0
?
thumbRepeater
.
thumbStartFrame
:
thumbRepeater
.
thumbEndFrame
)
:
Math
.
floor
(
clipRoot
.
inPoint
+
Math
.
round
((
index
)
*
width
/
timeline
.
scaleFactor
)
*
clipRoot
.
speed
)
property
int
lastFrame
:
-
1
horizontalAlignment
:
thumbRepeater
.
count
<
3
?
(
index
==
0
?
Image
.
AlignLeft
:
Image
.
AlignRight
)
:
Image
.
AlignLeft
source
:
thumbRepeater
.
count
<
3
?
(
clipRoot
.
baseThumbPath
+
currentFrame
)
:
(
index
*
width
<
clipRoot
.
scrollStart
-
width
||
index
*
width
>
clipRoot
.
scrollStart
+
scrollView
.
viewport
.
width
)
?
''
:
clipRoot
.
baseThumbPath
+
currentFrame
onStatusChanged
:
{
if
(
thumbRepeater
.
count
<
3
)
{
if
(
status
===
Image
.
Ready
)
{
lastFrame
=
currentFram
e
thumbPlaceholder
.
source
=
sourc
e
}
}
}
...
...
@@ -63,12 +62,6 @@ Row {
fillMode
:
Image
.
PreserveAspectFit
asynchronous
:
true
}
onRunningChanged
:
{
if
(
!
running
)
{
thumbPlaceholder
.
source
=
clipRoot
.
baseCacheThumbPath
+
parent
.
lastFrame
console
.
log
(
'
Setting image lastframe:
'
,
parent
.
lastFrame
)
}
}
}
Rectangle
{
visible
:
thumbRepeater
.
count
<
3
...
...
src/timeline2/view/qmltypes/thumbnailprovider.cpp
View file @
b3f6f019
...
...
@@ -98,28 +98,3 @@ QImage ThumbnailProvider::makeThumbnail(const std::shared_ptr<Mlt::Producer> &pr
}
return
QImage
();
}
ThumbnailCacheProvider
::
ThumbnailCacheProvider
()
:
QQuickImageProvider
(
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{
}
ThumbnailCacheProvider
::~
ThumbnailCacheProvider
()
=
default
;
QImage
ThumbnailCacheProvider
::
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
)
{
QImage
result
;
// id is binID/#frameNumber
QString
binId
=
id
.
section
(
'/'
,
0
,
0
);
bool
ok
;
int
frameNumber
=
id
.
section
(
'#'
,
-
1
).
toInt
(
&
ok
);
if
(
ok
)
{
if
(
ThumbnailCache
::
get
()
->
hasThumbnail
(
binId
,
frameNumber
,
false
))
{
result
=
ThumbnailCache
::
get
()
->
getThumbnail
(
binId
,
frameNumber
);
*
size
=
result
.
size
();
return
result
;
}
}
if
(
size
)
*
size
=
result
.
size
();
return
result
;
}
src/timeline2/view/qmltypes/thumbnailprovider.h
View file @
b3f6f019
...
...
@@ -38,12 +38,4 @@ private:
QString
cacheKey
(
Mlt
::
Properties
&
properties
,
const
QString
&
service
,
const
QString
&
resource
,
const
QString
&
hash
,
int
frameNumber
);
};
class
ThumbnailCacheProvider
:
public
QQuickImageProvider
{
public:
explicit
ThumbnailCacheProvider
();
~
ThumbnailCacheProvider
()
override
;
QImage
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
)
override
;
};
#endif // THUMBNAILPROVIDER_H
src/timeline2/view/timelinewidget.cpp
View file @
b3f6f019
...
...
@@ -82,7 +82,6 @@ TimelineWidget::TimelineWidget(QWidget *parent)
connect
(
m_proxy
,
&
TimelineController
::
ungrabHack
,
this
,
&
TimelineWidget
::
slotUngrabHack
);
setResizeMode
(
QQuickWidget
::
SizeRootObjectToView
);
engine
()
->
addImageProvider
(
QStringLiteral
(
"thumbnail"
),
new
ThumbnailProvider
);
engine
()
->
addImageProvider
(
QStringLiteral
(
"thumbnailCache"
),
new
ThumbnailCacheProvider
);
setVisible
(
false
);
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
));
setFocusPolicy
(
Qt
::
StrongFocus
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment