Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix various project length issues

parent d741a30b
......@@ -22,7 +22,7 @@ set(MLT_MIN_MINOR_VERSION 4)
set(MLT_MIN_PATCH_VERSION 0)
set(MLT_MIN_VERSION ${MLT_MIN_MAJOR_VERSION}.${MLT_MIN_MINOR_VERSION}.${MLT_MIN_PATCH_VERSION})
set(QT_MIN_VERSION 5.6.0)
set(QT_MIN_VERSION 5.7.0)
find_package(ECM 5.18.0 REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
......
......@@ -300,15 +300,14 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
bool ok = true;
int old_trackId = getClipTrackId(clipId);
if (old_trackId != -1) {
ok = getTrackById(old_trackId)->requestClipDeletion(clipId, updateView, invalidateTimeline, local_undo, local_redo);
ok = getTrackById(old_trackId)->requestClipDeletion(clipId, updateView, local_undo, local_redo);
if (!ok) {
bool undone = local_undo();
Q_ASSERT(undone);
return false;
}
}
ok = getTrackById(trackId)->requestClipInsertion(clipId, position, updateView, invalidateTimeline,
local_undo, local_redo);
ok = getTrackById(trackId)->requestClipInsertion(clipId, position, updateView, local_undo, local_redo);
if (!ok) {
//qDebug()<<"-------------\n\nINSERTION FAILED, REVERTING\n\n-------------------";
bool undone = local_undo();
......@@ -661,7 +660,7 @@ bool TimelineModel::requestClipDeletion(int clipId, Fun &undo, Fun &redo)
{
int trackId = getClipTrackId(clipId);
if (trackId != -1) {
bool res = getTrackById(trackId)->requestClipDeletion(clipId, true, true, undo, redo);
bool res = getTrackById(trackId)->requestClipDeletion(clipId, true, undo, redo);
if (!res) {
undo();
return false;
......@@ -2004,8 +2003,8 @@ void TimelineModel::requestClipReload(int clipId)
int old_trackId = getClipTrackId(clipId);
int oldPos = getClipPosition(clipId);
if (old_trackId != -1) {
getTrackById(old_trackId)->requestClipDeletion(clipId, false, false, local_undo, local_redo);
getTrackById(old_trackId)->requestClipInsertion(clipId, oldPos, true, true, local_undo, local_redo);
getTrackById(old_trackId)->requestClipDeletion(clipId, false, local_undo, local_redo);
getTrackById(old_trackId)->requestClipInsertion(clipId, oldPos, true, local_undo, local_redo);
}
}
......@@ -2039,9 +2038,9 @@ bool TimelineModel::requestClipTimeWarp(int clipId, double speed)
if (old_trackId != -1) {
int blankSpace = getTrackById(old_trackId)->getBlankSizeNearClip(clipId, true);
qDebug() << "// FOUND BLANK AFTER CLIP: " << blankSpace;
getTrackById(old_trackId)->requestClipDeletion(clipId, false, true, local_undo, local_redo);
getTrackById(old_trackId)->requestClipDeletion(clipId, false, local_undo, local_redo);
m_allClips[clipId]->useTimewarpProducer(speed, blankSpace);
getTrackById(old_trackId)->requestClipInsertion(clipId, oldPos, false, true, local_undo, local_redo);
getTrackById(old_trackId)->requestClipInsertion(clipId, oldPos, true, local_undo, local_redo);
} else {
m_allClips[clipId]->useTimewarpProducer(speed, -1);
}
......
......@@ -112,7 +112,7 @@ int TrackModel::getClipsCount()
return count;
}
Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updateView, bool finalMove)
Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updateView)
{
QWriteLocker locker(&m_lock);
// By default, insertion occurs in topmost track
......@@ -121,7 +121,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
int count = m_playlists[0].count();
// we create the function that has to be executed after the melt order. This is essentially book-keeping
auto end_function = [clipId, this, position, updateView, finalMove]() {
auto end_function = [clipId, this, position, updateView]() {
if (auto ptr = m_parent.lock()) {
std::shared_ptr<ClipModel> clip = ptr->getClipPtr(clipId);
m_allClips[clip->getId()] = clip; // store clip
......@@ -142,7 +142,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
// only refresh monitor if not an audio track and not hidden
ptr->checkRefresh(new_in, new_out);
}
if (!audioOnly && finalMove) {
if (!audioOnly) {
ptr->invalidateClip(clipId);
}
}
......@@ -154,7 +154,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
};
if (target_clip >= count && isBlankAt(position)) {
// In that case, we append after, in the first playlist
return [this, position, clipId, end_function, updateView, finalMove]() {
return [this, position, clipId, end_function, updateView]() {
if (auto ptr = m_parent.lock()) {
// Lock MLT playlist so that we don't end up with an invalid frame being displayed
m_playlists[0].lock();
......@@ -162,7 +162,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
int index = m_playlists[0].insert_at(position, *clip, 1);
m_playlists[0].consolidate_blanks();
m_playlists[0].unlock();
if (updateView && finalMove) {
if (updateView) {
ptr->updateDuration();
}
return index != -1 && end_function();
......@@ -180,7 +180,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
length = clip->getPlaytime();
}
if (blank_end >= position + length) {
return [this, position, clipId, end_function, updateView]() {
return [this, position, clipId, end_function]() {
if (auto ptr = m_parent.lock()) {
// Lock MLT playlist so that we don't end up with an invalid frame being displayed
m_playlists[0].lock();
......@@ -200,12 +200,12 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
return []() { return false; };
}
bool TrackModel::requestClipInsertion(int clipId, int position, bool updateView, bool finalMove, Fun &undo, Fun &redo)
bool TrackModel::requestClipInsertion(int clipId, int position, bool updateView, Fun &undo, Fun &redo)
{
QWriteLocker locker(&m_lock);
auto operation = requestClipInsertion_lambda(clipId, position, updateView, finalMove);
auto operation = requestClipInsertion_lambda(clipId, position, updateView);
if (operation()) {
auto reverse = requestClipDeletion_lambda(clipId, updateView, finalMove);
auto reverse = requestClipDeletion_lambda(clipId, updateView);
UPDATE_UNDO_REDO(operation, reverse, undo, redo);
return true;
}
......@@ -232,7 +232,7 @@ void TrackModel::replugClip(int clipId)
m_playlists[target_track].unlock();
}
Fun TrackModel::requestClipDeletion_lambda(int clipId, bool updateView, bool finalMove)
Fun TrackModel::requestClipDeletion_lambda(int clipId, bool updateView)
{
QWriteLocker locker(&m_lock);
// Find index of clip
......@@ -240,7 +240,7 @@ Fun TrackModel::requestClipDeletion_lambda(int clipId, bool updateView, bool fin
bool audioOnly = m_allClips[clipId]->isAudioOnly();
int old_in = clip_position;
int old_out = old_in + m_allClips[clipId]->getPlaytime();
return [clip_position, clipId, old_in, old_out, updateView, finalMove, audioOnly, this]() {
return [clip_position, clipId, old_in, old_out, updateView, audioOnly, this]() {
auto clip_loc = getClipIndexAt(clip_position);
if (updateView) {
int old_clip_index = getRowfromClip(clipId);
......@@ -256,7 +256,7 @@ Fun TrackModel::requestClipDeletion_lambda(int clipId, bool updateView, bool fin
Q_ASSERT(!m_playlists[target_track].is_blank(target_clip));
auto prod = m_playlists[target_track].replace_with_blank(target_clip);
if (prod != nullptr) {
if (finalMove && !audioOnly) {
if (updateView && !audioOnly) {
if (auto ptr = m_parent.lock()) {
//qDebug() << "/// INVALIDATE CLIP ON DELETE!!!!!!";
ptr->invalidateClip(clipId);
......@@ -271,7 +271,7 @@ Fun TrackModel::requestClipDeletion_lambda(int clipId, bool updateView, bool fin
ptr->m_snaps->removePoint(old_in);
ptr->m_snaps->removePoint(old_out);
int state = m_track->get_int("hide");
if (updateView && finalMove && m_playlists[target_track].count() - 1 == target_clip) {
if (updateView && target_clip >= m_playlists[target_track].count()) {
// deleted last clip in playlist
ptr->updateDuration();
}
......@@ -287,15 +287,16 @@ Fun TrackModel::requestClipDeletion_lambda(int clipId, bool updateView, bool fin
};
}
bool TrackModel::requestClipDeletion(int clipId, bool updateView, bool finalMove, Fun &undo, Fun &redo)
bool TrackModel::requestClipDeletion(int clipId, bool updateView, Fun &undo, Fun &redo)
{
QWriteLocker locker(&m_lock);
Q_ASSERT(m_allClips.count(clipId) > 0);
auto old_clip = m_allClips[clipId];
int old_position = old_clip->getPosition();
auto operation = requestClipDeletion_lambda(clipId, updateView, finalMove);
qDebug()<<"/// REQUESTOING CLIP DELETION_: "<<updateView;
auto operation = requestClipDeletion_lambda(clipId, updateView);
if (operation()) {
auto reverse = requestClipInsertion_lambda(clipId, old_position, updateView, finalMove);
auto reverse = requestClipInsertion_lambda(clipId, old_position, updateView);
UPDATE_UNDO_REDO(operation, reverse, undo, redo);
return true;
}
......
......@@ -107,9 +107,9 @@ protected:
@param undo Lambda function containing the current undo stack. Will be updated with current operation
@param redo Lambda function containing the current redo queue. Will be updated with current operation
*/
bool requestClipInsertion(int clipId, int position, bool updateView, bool finalMove, Fun &undo, Fun &redo);
bool requestClipInsertion(int clipId, int position, bool updateView, Fun &undo, Fun &redo);
/* @brief This function returns a lambda that performs the requested operation */
Fun requestClipInsertion_lambda(int clipId, int position, bool updateView, bool finalMove);
Fun requestClipInsertion_lambda(int clipId, int position, bool updateView);
/* @brief Performs an deletion of the given clip.
Returns true if the operation succeeded, and otherwise, the track is not modified.
......@@ -119,9 +119,9 @@ protected:
@param undo Lambda function containing the current undo stack. Will be updated with current operation
@param redo Lambda function containing the current redo queue. Will be updated with current operation
*/
bool requestClipDeletion(int clipId, bool updateView, bool finalMove, Fun &undo, Fun &redo);
bool requestClipDeletion(int clipId, bool updateView, Fun &undo, Fun &redo);
/* @brief This function returns a lambda that performs the requested operation */
Fun requestClipDeletion_lambda(int clipId, bool updateView, bool finalMove);
Fun requestClipDeletion_lambda(int clipId, bool updateView);
/* @brief Performs an insertion of the given composition.
Returns true if the operation succeeded, and otherwise, the track is not modified.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment