Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
258
Issues
258
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
0f45483c
Commit
0f45483c
authored
Jul 11, 2019
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preliminary implementation of Bin clip hover seeking (using shift+hover)
Related to
#287
parent
3799402b
Pipeline
#5180
passed with stage
in 34 minutes and 31 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
0 deletions
+51
-0
src/bin/bin.cpp
src/bin/bin.cpp
+29
-0
src/bin/bin.h
src/bin/bin.h
+4
-0
src/bin/projectclip.cpp
src/bin/projectclip.cpp
+15
-0
src/bin/projectclip.h
src/bin/projectclip.h
+3
-0
No files found.
src/bin/bin.cpp
View file @
0f45483c
...
...
@@ -205,6 +205,7 @@ public:
decoWidth
+=
r
.
width
()
+
textMargin
;
r
.
setWidth
(
r
.
height
()
*
pix
.
width
()
/
pix
.
height
());
painter
->
drawPixmap
(
r
,
pix
,
QRect
(
0
,
0
,
pix
.
width
(),
pix
.
height
()));
m_thumbRect
=
r
;
}
int
mid
=
(
int
)((
r1
.
height
()
/
2
));
r1
.
adjust
(
decoWidth
,
0
,
0
,
-
mid
);
...
...
@@ -305,11 +306,20 @@ public:
QStyledItemDelegate
::
paint
(
painter
,
option
,
index
);
}
}
int
getFrame
(
QModelIndex
index
,
int
mouseX
)
{
int
type
=
index
.
data
(
AbstractProjectItem
::
ItemTypeRole
).
toInt
();
if
(
type
!=
AbstractProjectItem
::
ClipItem
||
mouseX
<
m_thumbRect
.
x
()
||
mouseX
>
m_thumbRect
.
right
())
{
return
0
;
}
return
100
*
(
mouseX
-
m_thumbRect
.
x
())
/
m_thumbRect
.
width
();
}
private:
mutable
bool
m_editorOpen
{
false
};
mutable
QRect
m_audioDragRect
;
mutable
QRect
m_videoDragRect
;
mutable
QRect
m_thumbRect
;
double
m_dar
{
1.778
};
public:
...
...
@@ -374,6 +384,13 @@ void MyTreeView::mouseMoveEvent(QMouseEvent *event)
if
(
distance
>=
QApplication
::
startDragDistance
())
{
dragged
=
performDrag
();
}
}
else
if
(
event
->
modifiers
()
==
Qt
::
ShiftModifier
)
{
QModelIndex
index
=
indexAt
(
event
->
pos
());
if
(
index
.
isValid
())
{
QAbstractItemDelegate
*
del
=
itemDelegate
(
index
);
int
frame
=
static_cast
<
BinItemDelegate
*>
(
del
)
->
getFrame
(
index
,
event
->
pos
().
x
());
emit
displayBinFrame
(
index
,
frame
);
}
}
if
(
!
dragged
)
{
QTreeView
::
mouseMoveEvent
(
event
);
...
...
@@ -1375,6 +1392,7 @@ void Bin::slotInitView(QAction *action)
view
->
setWordWrap
(
true
);
connect
(
m_proxyModel
,
&
QAbstractItemModel
::
layoutAboutToBeChanged
,
this
,
&
Bin
::
slotSetSorting
);
connect
(
view
,
&
MyTreeView
::
updateDragMode
,
m_itemModel
.
get
(),
&
ProjectItemModel
::
setDragType
,
Qt
::
DirectConnection
);
connect
(
view
,
&
MyTreeView
::
displayBinFrame
,
this
,
&
Bin
::
showBinFrame
);
m_proxyModel
->
setDynamicSortFilter
(
true
);
if
(
!
m_headerInfo
.
isEmpty
())
{
view
->
header
()
->
restoreState
(
m_headerInfo
);
...
...
@@ -3170,3 +3188,14 @@ void Bin::adjustProjectProfileToItem()
}
}
}
void
Bin
::
showBinFrame
(
QModelIndex
ix
,
int
frame
)
{
std
::
shared_ptr
<
AbstractProjectItem
>
item
=
m_itemModel
->
getBinItemByIndex
(
m_proxyModel
->
mapToSource
(
ix
));
if
(
item
&&
item
->
itemType
()
==
AbstractProjectItem
::
ClipItem
)
{
auto
clip
=
std
::
static_pointer_cast
<
ProjectClip
>
(
item
);
if
(
clip
)
{
clip
->
getThumbFromPercent
(
frame
);
}
}
}
src/bin/bin.h
View file @
0f45483c
...
...
@@ -108,6 +108,7 @@ private:
signals:
void
focusView
();
void
updateDragMode
(
PlaylistState
::
ClipState
type
);
void
displayBinFrame
(
QModelIndex
ix
,
int
frame
);
};
class
SmallJobLabel
:
public
QPushButton
...
...
@@ -312,6 +313,9 @@ private slots:
* this is a workaround foq Qt bug 54676
*/
void
showClearButton
(
bool
show
);
/** @brief Display a defined frame in bin clip thumbnail
*/
void
showBinFrame
(
QModelIndex
ix
,
int
frame
);
public
slots
:
void
slotRemoveInvalidClip
(
const
QString
&
id
,
bool
replace
,
const
QString
&
errorMessage
);
...
...
src/bin/projectclip.cpp
View file @
0f45483c
...
...
@@ -1395,3 +1395,18 @@ void ProjectClip::updateZones()
QJsonDocument
json
(
list
);
setProducerProperty
(
QStringLiteral
(
"kdenlive:clipzones"
),
QString
(
json
.
toJson
()));
}
void
ProjectClip
::
getThumbFromPercent
(
int
percent
)
{
// extract a maximum of 25 frames for bin preview
percent
/=
4
;
int
framePos
=
getFramePlaytime
()
*
percent
/
25
;
if
(
ThumbnailCache
::
get
()
->
hasThumbnail
(
m_binId
,
framePos
))
{
setThumbnail
(
ThumbnailCache
::
get
()
->
getThumbnail
(
m_binId
,
framePos
));
}
else
{
// Generate percent thumbs
//TODO: Generate bin cache whithout creating a job for each thumb
pCore
->
jobManager
()
->
startJob
<
ThumbJob
>
({
m_binId
},
-
1
,
QString
(),
150
,
framePos
,
true
,
false
);
}
}
src/bin/projectclip.h
View file @
0f45483c
...
...
@@ -220,6 +220,9 @@ public:
/** @brief Saves the subclips data as json
*/
void
updateZones
();
/** @brief Display Bin thumbnail given a percent
*/
void
getThumbFromPercent
(
int
percent
);
protected:
friend
class
ClipModel
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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