Skip to content
GitLab
Menu
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
dad10878
Commit
dad10878
authored
Jun 17, 2019
by
Jean-Baptiste Mardelle
Browse files
Don't allow undo/redo while dragging a clip in timeline.
Related to #264
parent
f991f153
Pipeline
#4396
passed with stage
in 13 minutes and 54 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/mainwindow.cpp
View file @
dad10878
...
...
@@ -1408,10 +1408,22 @@ void MainWindow::setupActions()
QAction
*
undo
=
KStandardAction
::
undo
(
m_commandStack
,
SLOT
(
undo
()),
actionCollection
());
undo
->
setEnabled
(
false
);
connect
(
m_commandStack
,
&
QUndoGroup
::
canUndoChanged
,
undo
,
&
QAction
::
setEnabled
);
connect
(
this
,
&
MainWindow
::
enableUndo
,
[
this
,
undo
]
(
bool
enable
)
{
if
(
enable
)
{
enable
=
m_commandStack
->
activeStack
()
->
canUndo
();
}
undo
->
setEnabled
(
enable
);
});
QAction
*
redo
=
KStandardAction
::
redo
(
m_commandStack
,
SLOT
(
redo
()),
actionCollection
());
redo
->
setEnabled
(
false
);
connect
(
m_commandStack
,
&
QUndoGroup
::
canRedoChanged
,
redo
,
&
QAction
::
setEnabled
);
connect
(
this
,
&
MainWindow
::
enableUndo
,
[
this
,
redo
]
(
bool
enable
)
{
if
(
enable
)
{
enable
=
m_commandStack
->
activeStack
()
->
canRedo
();
}
redo
->
setEnabled
(
enable
);
});
auto
*
addClips
=
new
QMenu
(
this
);
...
...
src/mainwindow.h
View file @
dad10878
...
...
@@ -484,6 +484,8 @@ signals:
/** @brief Clear asset view if itemId is displayed. */
void
clearAssetPanel
(
int
itemId
=
-
1
);
void
adjustAssetPanelRange
(
int
itemId
,
int
in
,
int
out
);
/** @brief Enable or disable the undo stack. For example undo/redo should not be enabled when dragging a clip in timeline or we risk corruption. */
void
enableUndo
(
bool
enable
);
};
#endif
src/timeline2/view/qml/timeline.qml
View file @
dad10878
...
...
@@ -16,11 +16,13 @@ Rectangle {
color
:
activePalette
.
window
property
bool
validMenu
:
false
property
color
textColor
:
activePalette
.
text
property
bool
dragInProgress
:
dragProxyArea
.
pressed
||
dragProxyArea
.
drag
.
active
signal
clipClicked
()
signal
mousePosChanged
(
int
position
)
signal
zoomIn
(
bool
onMouse
)
signal
zoomOut
(
bool
onMouse
)
signal
processingDrag
(
bool
dragging
)
FontMetrics
{
id
:
fontMetrics
...
...
@@ -33,6 +35,10 @@ Rectangle {
id
:
compositionMenu
}
onDragInProgressChanged
:
{
processingDrag
(
!
root
.
dragInProgress
)
}
function
fitZoom
()
{
return
scrollView
.
width
/
(
timeline
.
duration
*
1.1
)
}
...
...
@@ -164,7 +170,7 @@ Rectangle {
}
function
isDragging
()
{
return
dragPro
xy
.
draggedItem
>
-
1
&&
dragProxyArea
.
p
ress
ed
return
drag
In
Pro
g
ress
}
function
initDrag
(
itemObject
,
itemCoord
,
itemId
,
itemPos
,
itemTrack
,
isComposition
)
{
...
...
src/timeline2/view/timelinewidget.cpp
View file @
dad10878
...
...
@@ -136,6 +136,7 @@ void TimelineWidget::setModel(const std::shared_ptr<TimelineItemModel> &model)
connect
(
rootObject
(),
SIGNAL
(
mousePosChanged
(
int
)),
pCore
->
window
(),
SLOT
(
slotUpdateMousePosition
(
int
)));
connect
(
rootObject
(),
SIGNAL
(
zoomIn
(
bool
)),
pCore
->
window
(),
SLOT
(
slotZoomIn
(
bool
)));
connect
(
rootObject
(),
SIGNAL
(
zoomOut
(
bool
)),
pCore
->
window
(),
SLOT
(
slotZoomOut
(
bool
)));
connect
(
rootObject
(),
SIGNAL
(
processingDrag
(
bool
)),
pCore
->
window
(),
SIGNAL
(
enableUndo
(
bool
)));
m_proxy
->
setRoot
(
rootObject
());
setVisible
(
true
);
loading
=
false
;
...
...
Write
Preview
Supports
Markdown
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