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
45750990
Commit
45750990
authored
Oct 29, 2018
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dragging of clips with audio or video stream disabled
parent
7207f91a
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
62 additions
and
6 deletions
+62
-6
src/bin/abstractprojectitem.cpp
src/bin/abstractprojectitem.cpp
+3
-0
src/bin/abstractprojectitem.h
src/bin/abstractprojectitem.h
+4
-1
src/bin/bin.cpp
src/bin/bin.cpp
+2
-1
src/bin/projectclip.cpp
src/bin/projectclip.cpp
+17
-0
src/bin/projectclip.h
src/bin/projectclip.h
+7
-0
src/bin/projectfolder.cpp
src/bin/projectfolder.cpp
+5
-0
src/bin/projectfolder.h
src/bin/projectfolder.h
+2
-0
src/bin/projectfolderup.cpp
src/bin/projectfolderup.cpp
+4
-0
src/bin/projectfolderup.h
src/bin/projectfolderup.h
+2
-0
src/bin/projectsubclip.cpp
src/bin/projectsubclip.cpp
+5
-0
src/bin/projectsubclip.h
src/bin/projectsubclip.h
+2
-0
src/timeline2/model/timelinemodel.cpp
src/timeline2/model/timelinemodel.cpp
+9
-4
No files found.
src/bin/abstractprojectitem.cpp
View file @
45750990
...
...
@@ -151,6 +151,9 @@ QVariant AbstractProjectItem::getData(DataType type) const
case
ClipType
:
data
=
clipType
();
break
;
case
ClipHasAudioAndVideo
:
data
=
hasAudioAndVideo
();
break
;
case
JobType
:
if
(
itemType
()
==
ClipItem
)
{
auto
jobIds
=
pCore
->
jobManager
()
->
getPendingJobsIds
(
clipId
());
...
...
src/bin/abstractprojectitem.h
View file @
45750990
...
...
@@ -76,6 +76,8 @@ public:
virtual
std
::
shared_ptr
<
ProjectClip
>
clipAt
(
int
ix
)
=
0
;
/** @brief Recursively disable/enable bin effects. */
virtual
void
setBinEffectsEnabled
(
bool
enabled
)
=
0
;
/** @brief Returns true if item has both audio and video enabled. */
virtual
bool
hasAudioAndVideo
()
const
=
0
;
/** @brief This function executes what should be done when the item is deleted
but without deleting effectively.
...
...
@@ -132,7 +134,8 @@ public:
JobStatus
,
// Item status (ready or not, missing, waiting, ...)
ClipStatus
,
ClipType
ClipType
,
ClipHasAudioAndVideo
};
enum
CLIPSTATUS
{
StatusReady
=
0
,
StatusMissing
,
StatusWaiting
,
StatusDeleting
};
...
...
src/bin/bin.cpp
View file @
45750990
...
...
@@ -229,7 +229,8 @@ public:
// Add audio/video icons for selective drag
int
cType
=
index
.
data
(
AbstractProjectItem
::
ClipType
).
toInt
();
if
((
cType
==
ClipType
::
AV
||
cType
==
ClipType
::
Playlist
)
&&
(
opt
.
state
&
QStyle
::
State_MouseOver
))
{
bool
hasAudioAndVideo
=
index
.
data
(
AbstractProjectItem
::
ClipHasAudioAndVideo
).
toBool
();
if
(
hasAudioAndVideo
&&
(
cType
==
ClipType
::
AV
||
cType
==
ClipType
::
Playlist
)
&&
(
opt
.
state
&
QStyle
::
State_MouseOver
))
{
bounding
.
moveLeft
(
bounding
.
right
()
+
(
2
*
textMargin
));
bounding
.
adjust
(
0
,
textMargin
,
0
,
-
textMargin
);
QIcon
aDrag
=
QIcon
::
fromTheme
(
QStringLiteral
(
"audio-volume-medium"
));
...
...
src/bin/projectclip.cpp
View file @
45750990
...
...
@@ -347,6 +347,23 @@ void ProjectClip::setThumbnail(const QImage &img)
}
}
bool
ProjectClip
::
hasAudioAndVideo
()
const
{
return
hasAudio
()
&&
hasVideo
()
&&
m_masterProducer
->
get_int
(
"set.test_image"
)
==
0
&&
m_masterProducer
->
get_int
(
"set.test_audio"
)
==
0
;
}
bool
ProjectClip
::
isCompatible
(
PlaylistState
::
ClipState
state
)
const
{
switch
(
state
)
{
case
PlaylistState
::
AudioOnly
:
return
hasAudio
()
&&
(
m_masterProducer
->
get_int
(
"set.test_audio"
)
==
0
);
case
PlaylistState
::
VideoOnly
:
return
hasVideo
()
&&
(
m_masterProducer
->
get_int
(
"set.test_image"
)
==
0
);
default:
return
true
;
}
}
QPixmap
ProjectClip
::
thumbnail
(
int
width
,
int
height
)
{
return
m_thumbnail
.
pixmap
(
width
,
height
);
...
...
src/bin/projectclip.h
View file @
45750990
...
...
@@ -105,8 +105,15 @@ public:
bool
selfSoftDelete
(
Fun
&
undo
,
Fun
&
redo
)
override
;
/** @brief Returns true if item has both audio and video enabled. */
bool
hasAudioAndVideo
()
const
override
;
/** @brief Check if clip has a parent folder with id id */
bool
hasParent
(
const
QString
&
id
)
const
;
/** @brief Returns true is the clip can have the requested state */
bool
isCompatible
(
PlaylistState
::
ClipState
state
)
const
;
ClipPropertiesController
*
buildProperties
(
QWidget
*
parent
);
QPoint
zone
()
const
override
;
...
...
src/bin/projectfolder.cpp
View file @
45750990
...
...
@@ -158,3 +158,8 @@ ClipType::ProducerType ProjectFolder::clipType() const
{
return
ClipType
::
Unknown
;
}
bool
ProjectFolder
::
hasAudioAndVideo
()
const
{
return
false
;
}
src/bin/projectfolder.h
View file @
45750990
...
...
@@ -83,6 +83,8 @@ public:
/** @brief Returns a list of all children and sub-children clips. */
QList
<
std
::
shared_ptr
<
ProjectClip
>>
childClips
();
ClipType
::
ProducerType
clipType
()
const
override
;
/** @brief Returns true if item has both audio and video enabled. */
bool
hasAudioAndVideo
()
const
override
;
};
#endif
src/bin/projectfolderup.cpp
View file @
45750990
...
...
@@ -83,3 +83,7 @@ ClipType::ProducerType ProjectFolderUp::clipType() const
return
ClipType
::
Unknown
;
}
bool
ProjectFolderUp
::
hasAudioAndVideo
()
const
{
return
false
;
}
src/bin/projectfolderup.h
View file @
45750990
...
...
@@ -74,6 +74,8 @@ public:
QString
getToolTip
()
const
override
;
bool
rename
(
const
QString
&
name
,
int
column
)
override
;
ClipType
::
ProducerType
clipType
()
const
override
;
/** @brief Returns true if item has both audio and video enabled. */
bool
hasAudioAndVideo
()
const
override
;
private:
Bin
*
m_bin
;
...
...
src/bin/projectsubclip.cpp
View file @
45750990
...
...
@@ -167,3 +167,8 @@ ClipType::ProducerType ProjectSubClip::clipType() const
{
return
m_masterClip
->
clipType
();
}
bool
ProjectSubClip
::
hasAudioAndVideo
()
const
{
return
m_masterClip
->
hasAudioAndVideo
();
}
src/bin/projectsubclip.h
View file @
45750990
...
...
@@ -78,6 +78,8 @@ public:
QPoint
zone
()
const
override
;
QString
getToolTip
()
const
override
;
bool
rename
(
const
QString
&
name
,
int
column
)
override
;
/** @brief Returns true if item has both audio and video enabled. */
bool
hasAudioAndVideo
()
const
override
;
/** @brief returns a pointer to the parent clip */
std
::
shared_ptr
<
ProjectClip
>
getMasterClip
()
const
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
45750990
...
...
@@ -810,9 +810,6 @@ int TimelineModel::suggestCompositionMove(int compoId, int trackId, int position
bool
TimelineModel
::
requestClipCreation
(
const
QString
&
binClipId
,
int
&
id
,
PlaylistState
::
ClipState
state
,
Fun
&
undo
,
Fun
&
redo
)
{
qDebug
()
<<
"requestClipCreation "
<<
binClipId
;
int
clipId
=
TimelineModel
::
getNextId
();
id
=
clipId
;
Fun
local_undo
=
deregisterClip_lambda
(
clipId
);
QString
bid
=
binClipId
;
if
(
binClipId
.
contains
(
QLatin1Char
(
'/'
)))
{
bid
=
binClipId
.
section
(
QLatin1Char
(
'/'
),
0
,
0
);
...
...
@@ -820,6 +817,13 @@ bool TimelineModel::requestClipCreation(const QString &binClipId, int &id, Playl
if
(
!
pCore
->
projectItemModel
()
->
hasClip
(
bid
))
{
return
false
;
}
std
::
shared_ptr
<
ProjectClip
>
master
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
bid
);
if
(
!
master
->
isCompatible
(
state
))
{
return
false
;
}
int
clipId
=
TimelineModel
::
getNextId
();
id
=
clipId
;
Fun
local_undo
=
deregisterClip_lambda
(
clipId
);
ClipModel
::
construct
(
shared_from_this
(),
bid
,
clipId
,
state
);
auto
clip
=
m_allClips
[
clipId
];
Fun
local_redo
=
[
clip
,
this
,
state
]()
{
...
...
@@ -901,7 +905,8 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
res
=
requestClipCreation
(
binClipId
,
id
,
getTrackById_const
(
trackId
)
->
trackType
(),
local_undo
,
local_redo
);
res
=
res
&&
requestClipMove
(
id
,
trackId
,
position
,
refreshView
,
logUndo
,
local_undo
,
local_redo
);
int
target_track
=
audioDrop
?
m_videoTarget
:
m_audioTarget
;
if
(
res
&&
(
!
useTargets
||
target_track
>
-
1
))
{
qDebug
()
<<
"CLIP HAS A+V: "
<<
master
->
hasAudioAndVideo
();
if
(
res
&&
(
!
useTargets
||
target_track
>
-
1
)
&&
master
->
hasAudioAndVideo
())
{
if
(
!
useTargets
)
{
target_track
=
audioDrop
?
getMirrorVideoTrackId
(
trackId
)
:
getMirrorAudioTrackId
(
trackId
);
}
...
...
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