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
4bb8959e
Commit
4bb8959e
authored
Feb 09, 2019
by
Nicolas Carion
Browse files
[MAINTENANCE] clang format + remove most warnings + update test libs
parent
5c995c64
Changes
209
Hide whitespace changes
Inline
Side-by-side
plugins/sampleplugin/sampleplugin.cpp
View file @
4bb8959e
...
...
@@ -20,8 +20,8 @@
#include "sampleplugin.h"
#include "ui_countdown_ui.h"
#include <QDebug>
#include <KMessageBox>
#include <QDebug>
#include <QDialog>
#include <QProcess>
...
...
@@ -38,7 +38,8 @@ QStringList SamplePlugin::generators(const QStringList &producers) const
return
result
;
}
QUrl
SamplePlugin
::
generatedClip
(
const
QString
&
renderer
,
const
QString
&
generator
,
const
QUrl
&
projectFolder
,
const
QStringList
&
/*lumaNames*/
,
const
QStringList
&
/*lumaFiles*/
,
const
double
fps
,
const
int
/*width*/
,
const
int
height
)
QUrl
SamplePlugin
::
generatedClip
(
const
QString
&
renderer
,
const
QString
&
generator
,
const
QUrl
&
projectFolder
,
const
QStringList
&
/*lumaNames*/
,
const
QStringList
&
/*lumaFiles*/
,
const
double
fps
,
const
int
/*width*/
,
const
int
height
)
{
QString
prePath
;
if
(
generator
==
i18n
(
"Noise"
))
{
...
...
@@ -80,12 +81,12 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
generatorProcess
.
setProcessEnvironment
(
env
);
QStringList
args
;
if
(
generator
==
i18n
(
"Noise"
))
{
args
<<
QLatin1String
(
"noise:"
)
<<
QLatin1String
(
"in=0"
)
<<
QLatin1String
(
"out="
)
+
QString
::
number
((
int
)
fps
*
view
.
duration
->
value
());
args
<<
QLatin1String
(
"noise:"
)
<<
QLatin1String
(
"in=0"
)
<<
QLatin1String
(
"out="
)
+
QString
::
number
((
int
)
fps
*
view
.
duration
->
value
());
}
else
{
// Countdown producer
for
(
int
i
=
0
;
i
<
view
.
duration
->
value
();
++
i
)
{
// Create the producers
args
<<
QLatin1String
(
"pango:"
)
<<
QLatin1String
(
"in=0"
)
<<
QLatin1String
(
"out="
)
+
QString
::
number
((
int
)
fps
*
view
.
duration
->
value
());
args
<<
QLatin1String
(
"pango:"
)
<<
QLatin1String
(
"in=0"
)
<<
QLatin1String
(
"out="
)
+
QString
::
number
((
int
)
fps
*
view
.
duration
->
value
());
args
<<
QLatin1String
(
"text="
)
+
QString
::
number
(
view
.
duration
->
value
()
-
i
);
args
<<
QLatin1String
(
"font="
)
+
QString
::
number
(
view
.
font
->
value
())
+
QLatin1String
(
"px"
);
}
...
...
@@ -95,14 +96,14 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
generatorProcess
.
start
(
renderer
,
args
);
if
(
generatorProcess
.
waitForFinished
())
{
if
(
generatorProcess
.
exitStatus
()
==
QProcess
::
CrashExit
)
{
//qDebug() << "/// Generator failed: ";
//
qDebug() << "/// Generator failed: ";
QString
error
=
QString
::
fromLocal8Bit
(
generatorProcess
.
readAllStandardError
());
KMessageBox
::
sorry
(
QApplication
::
activeWindow
(),
i18n
(
"Failed to generate clip:
\n
%1"
,
error
),
i18n
(
"Generator Failed"
));
}
else
{
result
=
view
.
path
->
url
();
}
}
else
{
//qDebug() << "/// Generator failed: ";
//
qDebug() << "/// Generator failed: ";
QString
error
=
QString
::
fromLocal8Bit
(
generatorProcess
.
readAllStandardError
());
KMessageBox
::
sorry
(
QApplication
::
activeWindow
(),
i18n
(
"Failed to generate clip:
\n
%1"
,
error
),
i18n
(
"Generator Failed"
));
}
...
...
@@ -112,4 +113,3 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
}
Q_EXPORT_PLUGIN2
(
kdenlive_sampleplugin
,
SamplePlugin
)
renderer/kdenlive_render.cpp
View file @
4bb8959e
...
...
@@ -17,18 +17,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "framework/mlt_version.h"
#include "mlt++/Mlt.h"
#include "renderjob.h"
#include <QCoreApplication>
#include <QDebug>
#include <QDir>
#include <QDomDocument>
#include <QFileInfo>
#include <QString>
#include <QStringList>
#include <QDomDocument>
#include <QUrl>
#include <QDir>
#include <stdio.h>
#include "framework/mlt_version.h"
#include "mlt++/Mlt.h"
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -85,10 +85,11 @@ int main(int argc, char **argv)
continue
;
}
QScopedPointer
<
Mlt
::
Producer
>
playlst
(
prod
.
cut
(
frame
.
toInt
(),
frame
.
toInt
()
+
chunkSize
));
QScopedPointer
<
Mlt
::
Consumer
>
cons
(
new
Mlt
::
Consumer
(
profile
,
QString
(
"avformat:%1"
).
arg
(
baseFolder
.
absoluteFilePath
(
fileName
)).
toUtf8
().
constData
()));
QScopedPointer
<
Mlt
::
Consumer
>
cons
(
new
Mlt
::
Consumer
(
profile
,
QString
(
"avformat:%1"
).
arg
(
baseFolder
.
absoluteFilePath
(
fileName
)).
toUtf8
().
constData
()));
for
(
const
QString
&
param
:
consumerParams
)
{
if
(
param
.
contains
(
QLatin1Char
(
'='
)))
{
cons
->
set
(
param
.
section
(
QLatin1Char
(
'='
),
0
,
0
).
toUtf8
().
constData
(),
param
.
section
(
QLatin1Char
(
'='
),
1
).
toUtf8
().
constData
());
cons
->
set
(
param
.
section
(
QLatin1Char
(
'='
),
0
,
0
).
toUtf8
().
constData
(),
param
.
section
(
QLatin1Char
(
'='
),
1
).
toUtf8
().
constData
());
}
}
cons
->
set
(
"terminate_on_pause"
,
1
);
...
...
@@ -99,7 +100,7 @@ int main(int argc, char **argv)
cons
->
purge
();
fprintf
(
stderr
,
"DONE:%d
\n
"
,
frame
.
toInt
());
}
//Mlt::Factory::close();
//
Mlt::Factory::close();
fprintf
(
stderr
,
"+ + + RENDERING FINSHED + + +
\n
"
);
return
0
;
}
...
...
renderer/renderjob.cpp
View file @
4bb8959e
...
...
@@ -32,7 +32,6 @@ public:
static
void
msleep
(
unsigned
long
msecs
)
{
QThread
::
msleep
(
msecs
);
}
};
RenderJob
::
RenderJob
(
const
QString
&
render
,
const
QString
&
scenelist
,
const
QString
&
target
,
int
pid
,
int
in
,
int
out
)
:
QObject
()
,
m_scenelist
(
scenelist
)
...
...
@@ -147,9 +146,8 @@ void RenderJob::receivedStderr()
return
;
}
m_jobUiserver
->
call
(
QStringLiteral
(
"setDescriptionField"
),
(
uint
)
0
,
QString
(),
tr
(
"Remaining time: "
)
+
QTime
(
0
,
0
,
0
).
addSecs
(
seconds
).
toString
(
QStringLiteral
(
"hh:mm:ss"
)));
//m_jobUiserver->call(QStringLiteral("setSpeed"), (frame - m_frame) / (seconds - m_seconds));
tr
(
"Remaining time: "
)
+
QTime
(
0
,
0
,
0
).
addSecs
(
seconds
).
toString
(
QStringLiteral
(
"hh:mm:ss"
)));
// m_jobUiserver->call(QStringLiteral("setSpeed"), (frame - m_frame) / (seconds - m_seconds));
// m_jobUiserver->call("setSpeed", (frame - m_frame) / (seconds - m_seconds));
m_frame
=
frame
;
m_seconds
=
seconds
;
...
...
@@ -209,7 +207,7 @@ void RenderJob::start()
// Because of the logging, we connect to stderr in all cases.
connect
(
m_renderProcess
,
&
QProcess
::
readyReadStandardError
,
this
,
&
RenderJob
::
receivedStderr
);
m_renderProcess
->
start
(
m_prog
,
m_args
);
qDebug
()
<<
"Started render process: "
<<
m_prog
<<
' '
<<
m_args
.
join
(
QLatin1Char
(
' '
));
qDebug
()
<<
"Started render process: "
<<
m_prog
<<
' '
<<
m_args
.
join
(
QLatin1Char
(
' '
));
m_logstream
<<
"Started render process: "
<<
m_prog
<<
' '
<<
m_args
.
join
(
QLatin1Char
(
' '
))
<<
endl
;
}
...
...
src/CMakeLists.txt
View file @
4bb8959e
...
...
@@ -9,7 +9,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wparentheses -Wsequence-point -Wreturn-
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wuninitialized -Wreorder -Wundef -Wshadow -Wwrite-strings"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wsign-compare -Wconversion"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wmissing-noreturn -Wsign-conversion -Wunused "
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wstrict-aliasing
-Wstrict-overflow
-Wconversion"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wstrict-aliasing -Wconversion"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wdisabled-optimization"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-undef"
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
...
...
@@ -26,7 +26,7 @@ if(NOT WIN32)
if
(
NOT MLT_DATADIR_failed
)
string
(
REGEX REPLACE
"[
\r\n
]"
""
MLT_DATADIR
"
${
MLT_DATADIR
}
"
)
endif
()
execute_process
(
COMMAND
${
PKG_CONFIG_EXECUTABLE
}
--variable=meltbin mlt-framework
OUTPUT_VARIABLE MLT_MELTBIN
...
...
@@ -292,6 +292,8 @@ target_link_libraries(kdenliveLib
kiss_fft
)
set_property
(
TARGET kdenliveLib PROPERTY CXX_STANDARD 14
)
message
(
STATUS
"Found MLT++:
${
MLTPP_LIBRARIES
}
"
)
if
(
KF5_FILEMETADATA
)
...
...
src/assets/abstractassetsrepository.hpp
View file @
4bb8959e
...
...
@@ -58,7 +58,7 @@ public:
QString
getDescription
(
const
QString
&
assetId
)
const
;
/* @brief Set an asset as favorite (or not)*/
virtual
void
setFavorite
(
const
QString
&
assetId
,
bool
favorite
)
=
0
;
virtual
void
setFavorite
(
const
QString
&
assetId
,
bool
favorite
)
=
0
;
/* @brief Returns a DomElement representing the asset's properties */
QDomElement
getXml
(
const
QString
&
assetId
)
const
;
...
...
src/assets/assetlist/model/assettreemodel.cpp
View file @
4bb8959e
...
...
@@ -115,14 +115,14 @@ QVariant AssetTreeModel::data(const QModelIndex &index, int role) const
}
std
::
shared_ptr
<
TreeItem
>
item
=
getItemById
((
int
)
index
.
internalId
());
switch
(
role
)
{
case
IdRole
:
return
item
->
dataColumn
(
AssetTreeModel
::
idCol
);
case
FavoriteRole
:
return
item
->
dataColumn
(
AssetTreeModel
::
favCol
);
case
NameRole
:
return
item
->
dataColumn
(
index
.
column
());
default:
return
QVariant
();
switch
(
role
)
{
case
IdRole
:
return
item
->
dataColumn
(
AssetTreeModel
::
idCol
);
case
FavoriteRole
:
return
item
->
dataColumn
(
AssetTreeModel
::
favCol
);
case
NameRole
:
return
item
->
dataColumn
(
index
.
column
());
default:
return
QVariant
();
}
}
src/assets/assetlist/view/assetlistwidget.cpp
View file @
4bb8959e
...
...
@@ -23,10 +23,10 @@
#include "assets/assetlist/view/qmltypes/asseticonprovider.hpp"
#include <KDeclarative/KDeclarative>
#include <kdeclarative_version.h>
#include <QQmlContext>
#include <QQuickItem>
#include <QStandardPaths>
#include <kdeclarative_version.h>
AssetListWidget
::
AssetListWidget
(
QWidget
*
parent
)
:
QQuickWidget
(
parent
)
...
...
src/assets/assetpanel.cpp
View file @
4bb8959e
...
...
@@ -34,8 +34,8 @@
#include <KColorScheme>
#include <KColorUtils>
#include <KSqueezedTextLabel>
#include <KDualAction>
#include <KSqueezedTextLabel>
#include <QApplication>
#include <QDebug>
#include <QHBoxLayout>
...
...
@@ -59,8 +59,8 @@ AssetPanel::AssetPanel(QWidget *parent)
buttonToolbar
->
setIconSize
(
iconSize
);
// spacer
QWidget
*
empty
=
new
QWidget
();
empty
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Maximum
);
QWidget
*
empty
=
new
QWidget
();
empty
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Maximum
);
buttonToolbar
->
addWidget
(
empty
);
m_switchBuiltStack
=
new
QToolButton
(
this
);
...
...
@@ -118,9 +118,7 @@ AssetPanel::AssetPanel(QWidget *parent)
connect
(
m_effectStackWidget
,
&
EffectStackView
::
seekToPos
,
this
,
&
AssetPanel
::
seekToPos
);
connect
(
m_effectStackWidget
,
&
EffectStackView
::
reloadEffect
,
this
,
&
AssetPanel
::
reloadEffect
);
connect
(
m_transitionWidget
,
&
TransitionStackView
::
seekToTransPos
,
this
,
&
AssetPanel
::
seekToPos
);
connect
(
m_effectStackWidget
,
&
EffectStackView
::
updateEnabledState
,
[
this
]()
{
m_enableStackButton
->
setActive
(
m_effectStackWidget
->
isStackEnabled
());
});
connect
(
m_effectStackWidget
,
&
EffectStackView
::
updateEnabledState
,
[
this
]()
{
m_enableStackButton
->
setActive
(
m_effectStackWidget
->
isStackEnabled
());
});
}
void
AssetPanel
::
showTransition
(
int
tid
,
std
::
shared_ptr
<
AssetParameterModel
>
transitionModel
)
...
...
@@ -189,7 +187,7 @@ void AssetPanel::showEffectStack(const QString &itemName, std::shared_ptr<Effect
m_enableStackButton
->
setActive
(
effectsModel
->
isStackEnabled
());
if
(
showSplit
)
{
m_splitButton
->
setEnabled
(
effectsModel
->
rowCount
()
>
0
);
QObject
::
connect
(
effectsModel
.
get
(),
&
EffectStackModel
::
dataChanged
,
[
&
](){
QObject
::
connect
(
effectsModel
.
get
(),
&
EffectStackModel
::
dataChanged
,
[
&
]()
{
if
(
m_effectStackWidget
->
isEmpty
())
{
m_splitButton
->
setActive
(
false
);
}
...
...
src/assets/keyframes/model/corners/cornershelper.cpp
View file @
4bb8959e
...
...
@@ -22,13 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cornershelper.hpp"
#include "assets/keyframes/model/keyframemodellist.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "gentime.h"
#include "core.h"
#include "gentime.h"
#include "monitor/monitor.h"
#include <QSize>
CornersHelper
::
CornersHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
)
CornersHelper
::
CornersHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
)
:
KeyframeMonitorHelper
(
monitor
,
model
,
index
,
parent
)
{
}
...
...
@@ -37,7 +37,7 @@ void CornersHelper::slotUpdateFromMonitorData(const QVariantList &v)
{
const
QVariantList
points
=
QVariant
(
v
).
toList
();
QSize
frameSize
=
pCore
->
getCurrentFrameSize
();
int
ix
=
0
;
int
ix
=
0
;
for
(
int
i
=
0
;
i
<
points
.
size
();
i
++
)
{
QPointF
pt
=
points
.
at
(
i
).
toPointF
();
double
x
=
(
pt
.
x
()
/
frameSize
.
width
()
+
1
)
/
3
;
...
...
@@ -50,8 +50,8 @@ void CornersHelper::slotUpdateFromMonitorData(const QVariantList &v)
void
CornersHelper
::
refreshParams
(
int
pos
)
{
QVariantList
points
{
QPointF
(),
QPointF
(),
QPointF
(),
QPointF
()};
QList
<
double
>
coords
;
QVariantList
points
{
QPointF
(),
QPointF
(),
QPointF
(),
QPointF
()};
QList
<
double
>
coords
;
QSize
frameSize
=
pCore
->
getCurrentFrameSize
();
for
(
const
auto
&
ix
:
m_indexes
)
{
ParamType
type
=
m_model
->
data
(
ix
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
...
...
@@ -63,34 +63,34 @@ void CornersHelper::refreshParams(int pos)
continue
;
}
double
value
=
m_model
->
getKeyframeModel
()
->
getInterpolatedValue
(
pos
,
ix
).
toDouble
();
value
=
((
3
*
value
)
-
1
)
*
(
paramName
%
2
==
0
?
frameSize
.
width
()
:
frameSize
.
height
());
value
=
((
3
*
value
)
-
1
)
*
(
paramName
%
2
==
0
?
frameSize
.
width
()
:
frameSize
.
height
());
switch
(
paramName
)
{
case
0
:
points
[
0
]
=
QPointF
(
value
,
points
.
at
(
0
).
toPointF
().
y
());
break
;
case
1
:
points
[
0
]
=
QPointF
(
points
.
at
(
0
).
toPointF
().
x
(),
value
);
break
;
case
2
:
points
[
1
]
=
QPointF
(
value
,
points
.
at
(
1
).
toPointF
().
y
());
break
;
case
3
:
points
[
1
]
=
QPointF
(
points
.
at
(
1
).
toPointF
().
x
(),
value
);
break
;
case
4
:
points
[
2
]
=
QPointF
(
value
,
points
.
at
(
2
).
toPointF
().
y
());
break
;
case
5
:
points
[
2
]
=
QPointF
(
points
.
at
(
2
).
toPointF
().
x
(),
value
);
break
;
case
6
:
points
[
3
]
=
QPointF
(
value
,
points
.
at
(
3
).
toPointF
().
y
());
break
;
case
7
:
points
[
3
]
=
QPointF
(
points
.
at
(
3
).
toPointF
().
x
(),
value
);
break
;
default:
break
;
case
0
:
points
[
0
]
=
QPointF
(
value
,
points
.
at
(
0
).
toPointF
().
y
());
break
;
case
1
:
points
[
0
]
=
QPointF
(
points
.
at
(
0
).
toPointF
().
x
(),
value
);
break
;
case
2
:
points
[
1
]
=
QPointF
(
value
,
points
.
at
(
1
).
toPointF
().
y
());
break
;
case
3
:
points
[
1
]
=
QPointF
(
points
.
at
(
1
).
toPointF
().
x
(),
value
);
break
;
case
4
:
points
[
2
]
=
QPointF
(
value
,
points
.
at
(
2
).
toPointF
().
y
());
break
;
case
5
:
points
[
2
]
=
QPointF
(
points
.
at
(
2
).
toPointF
().
x
(),
value
);
break
;
case
6
:
points
[
3
]
=
QPointF
(
value
,
points
.
at
(
3
).
toPointF
().
y
());
break
;
case
7
:
points
[
3
]
=
QPointF
(
points
.
at
(
3
).
toPointF
().
x
(),
value
);
break
;
default:
break
;
}
}
if
(
m_monitor
)
{
...
...
src/assets/keyframes/model/corners/cornershelper.hpp
View file @
4bb8959e
...
...
@@ -24,9 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "assets/keyframes/model/keyframemonitorhelper.hpp"
#include <QObject>
#include <QPersistentModelIndex>
#include <QVariant>
#include <QObject>
#include <memory>
...
...
@@ -43,14 +43,13 @@ public:
@param model is the asset this parameter belong to
@param index is the index of this parameter in its model
*/
explicit
CornersHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
=
nullptr
);
explicit
CornersHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
=
nullptr
);
/** @brief Send data update to the monitor
*/
*/
void
refreshParams
(
int
pos
)
override
;
private
slots
:
void
slotUpdateFromMonitorData
(
const
QVariantList
&
v
)
override
;
};
#endif
src/assets/keyframes/model/keyframemodel.cpp
View file @
4bb8959e
...
...
@@ -20,11 +20,11 @@
***************************************************************************/
#include "keyframemodel.hpp"
#include "rotoscoping/bpoint.h"
#include "rotoscoping/rotohelper.hpp"
#include "core.h"
#include "doc/docundostack.hpp"
#include "macros.hpp"
#include "rotoscoping/bpoint.h"
#include "rotoscoping/rotohelper.hpp"
#include <QDebug>
#include <QJsonDocument>
...
...
@@ -130,7 +130,7 @@ bool KeyframeModel::addKeyframe(GenTime pos, KeyframeType type, QVariant value)
bool
KeyframeModel
::
removeKeyframe
(
GenTime
pos
,
Fun
&
undo
,
Fun
&
redo
,
bool
notify
)
{
qDebug
()
<<
"Going to remove keyframe at "
<<
pos
.
frames
(
pCore
->
getCurrentFps
())
<<
" NOTIFY: "
<<
notify
;
qDebug
()
<<
"Going to remove keyframe at "
<<
pos
.
frames
(
pCore
->
getCurrentFps
())
<<
" NOTIFY: "
<<
notify
;
qDebug
()
<<
"before"
<<
getAnimProperty
();
QWriteLocker
locker
(
&
m_lock
);
Q_ASSERT
(
m_keyframeList
.
count
(
pos
)
>
0
);
...
...
@@ -209,7 +209,7 @@ bool KeyframeModel::moveKeyframe(GenTime oldPos, GenTime pos, QVariant newVal, F
Fun
local_undo
=
[]()
{
return
true
;
};
Fun
local_redo
=
[]()
{
return
true
;
};
qDebug
()
<<
getAnimProperty
();
//TODO: use the new Animation::key_set_frame to move a keyframe
//
TODO: use the new Animation::key_set_frame to move a keyframe
bool
res
=
removeKeyframe
(
oldPos
,
local_undo
,
local_redo
);
qDebug
()
<<
"Move keyframe finished deletion:"
<<
res
;
qDebug
()
<<
getAnimProperty
();
...
...
@@ -613,7 +613,7 @@ bool KeyframeModel::removeAllKeyframes(Fun &undo, Fun &redo)
std
::
vector
<
GenTime
>
all_pos
;
Fun
local_undo
=
[]()
{
return
true
;
};
Fun
local_redo
=
[]()
{
return
true
;
};
int
kfrCount
=
m_keyframeList
.
size
()
-
1
;
int
kfrCount
=
(
int
)
m_keyframeList
.
size
()
-
1
;
// we trigger only one global remove/insertrow event
Fun
update_redo_start
=
[
this
,
kfrCount
]()
{
beginRemoveRows
(
QModelIndex
(),
1
,
kfrCount
);
...
...
@@ -787,7 +787,6 @@ void KeyframeModel::parseAnimProperty(const QString &prop)
connect
(
this
,
&
KeyframeModel
::
modelChanged
,
this
,
&
KeyframeModel
::
sendModification
);
}
void
KeyframeModel
::
resetAnimProperty
(
const
QString
&
prop
)
{
Fun
undo
=
[]()
{
return
true
;
};
...
...
@@ -847,7 +846,7 @@ void KeyframeModel::resetAnimProperty(const QString &prop)
effectName
=
i18n
(
"effect"
);
}
Fun
update_local
=
[
this
]()
{
emit
dataChanged
(
index
(
0
),
index
(
m_keyframeList
.
size
()),
{});
emit
dataChanged
(
index
(
0
),
index
(
(
int
)
m_keyframeList
.
size
()),
{});
return
true
;
};
update_local
();
...
...
@@ -887,7 +886,7 @@ QVariant KeyframeModel::updateInterpolated(QVariant interpValue, double val)
QStringList
vals
=
interpValue
.
toString
().
split
(
QLatin1Char
(
' '
));
QLocale
locale
;
if
(
!
vals
.
isEmpty
())
{
vals
[
vals
.
size
()
-
1
]
=
locale
.
toString
(
val
);
vals
[
vals
.
size
()
-
1
]
=
locale
.
toString
(
val
);
}
return
vals
.
join
(
QLatin1Char
(
' '
));
}
...
...
@@ -958,7 +957,7 @@ QVariant KeyframeModel::getInterpolatedValue(const GenTime &pos) const
rect
.
o
=
1
;
}
prop
.
anim_set
(
"keyframe"
,
rect
,
prev
->
first
.
frames
(
pCore
->
getCurrentFps
()),
next
->
first
.
frames
(
pCore
->
getCurrentFps
()),
convertToMltType
(
prev
->
second
.
first
));
convertToMltType
(
prev
->
second
.
first
));
}
vals
=
next
->
second
.
second
.
toString
().
split
(
QLatin1Char
(
' '
));
if
(
vals
.
count
()
>=
4
)
{
...
...
@@ -973,7 +972,7 @@ QVariant KeyframeModel::getInterpolatedValue(const GenTime &pos) const
rect
.
o
=
1
;
}
prop
.
anim_set
(
"keyframe"
,
rect
,
next
->
first
.
frames
(
pCore
->
getCurrentFps
()),
next
->
first
.
frames
(
pCore
->
getCurrentFps
()),
convertToMltType
(
next
->
second
.
first
));
convertToMltType
(
next
->
second
.
first
));
}
mlt_rect
rect
=
prop
.
anim_get_rect
(
"keyframe"
,
p
);
const
QString
res
=
QStringLiteral
(
"%1 %2 %3 %4 %5"
).
arg
((
int
)
rect
.
x
).
arg
((
int
)
rect
.
y
).
arg
((
int
)
rect
.
w
).
arg
((
int
)
rect
.
h
).
arg
(
locale
.
toString
(
rect
.
o
));
...
...
@@ -1031,7 +1030,7 @@ void KeyframeModel::refresh()
}
if
(
animData
==
m_lastData
)
{
// nothing to do
qDebug
()
<<
"// DATA WAS ALREADY PARSED, ABORTING REFRESH
\n
_________________"
;
qDebug
()
<<
"// DATA WAS ALREADY PARSED, ABORTING REFRESH
\n
_________________"
;
return
;
}
if
(
m_paramType
==
ParamType
::
KeyframeParam
||
m_paramType
==
ParamType
::
AnimatedRect
)
{
...
...
@@ -1065,14 +1064,14 @@ void KeyframeModel::reset()
}
if
(
animData
==
m_lastData
)
{
// nothing to do
qDebug
()
<<
"// DATA WAS ALREADY PARSED, ABORTING
\n
_________________"
;
qDebug
()
<<
"// DATA WAS ALREADY PARSED, ABORTING
\n
_________________"
;
return
;
}
if
(
m_paramType
==
ParamType
::
KeyframeParam
||
m_paramType
==
ParamType
::
AnimatedRect
)
{
qDebug
()
<<
"parsing keyframe"
<<
animData
;
resetAnimProperty
(
animData
);
}
else
if
(
m_paramType
==
ParamType
::
Roto_spline
)
{
//TODO: resetRotoProperty(animData);
//
TODO: resetRotoProperty(animData);
}
else
{
// first, try to convert to double
bool
ok
=
false
;
...
...
@@ -1125,13 +1124,12 @@ QList<QPoint> KeyframeModel::getRanges(const QString &animData)
pH
.
setY
(
qMax
((
int
)
rect
.
h
,
pH
.
y
()));
pO
.
setX
(
qMin
((
int
)
rect
.
o
,
pO
.
x
()));
pO
.
setY
(
qMax
((
int
)
rect
.
o
,
pO
.
y
()));
//value = QVariant(QStringLiteral("%1 %2 %3 %4 %5").arg(rect.x).arg(rect.y).arg(rect.w).arg(rect.h).arg(locale.toString(rect.o)));
//
value = QVariant(QStringLiteral("%1 %2 %3 %4 %5").arg(rect.x).arg(rect.y).arg(rect.w).arg(rect.h).arg(locale.toString(rect.o)));
}
QList
<
QPoint
>
result
{
pX
,
pY
,
pW
,
pH
,
pO
};
QList
<
QPoint
>
result
{
pX
,
pY
,
pW
,
pH
,
pO
};
return
result
;
}
std
::
shared_ptr
<
Mlt
::
Properties
>
KeyframeModel
::
getAnimation
(
const
QString
&
animData
)
{
std
::
shared_ptr
<
Mlt
::
Properties
>
mlt_prop
(
new
Mlt
::
Properties
());
...
...
src/assets/keyframes/model/keyframemodellist.cpp
View file @
4bb8959e
...
...
@@ -20,14 +20,14 @@
***************************************************************************/
#include "keyframemodellist.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "assets/model/assetcommand.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "core.h"
#include "doc/docundostack.hpp"
#include "keyframemodel.hpp"
#include "klocalizedstring.h"
#include <kdenlivesettings.h>
#include "macros.hpp"
#include <kdenlivesettings.h>
#include <QDebug>
...
...
@@ -362,7 +362,7 @@ void KeyframeModelList::resizeKeyframes(int oldIn, int oldOut, int in, int out,
KeyframeType
type
=
kf
.
second
;
getKeyframe
(
new_in
,
&
ok2
);
// Check keyframes after last position
QList
<
GenTime
>
positions
;
QList
<
GenTime
>
positions
;
if
(
ok
&&
!
ok2
&&
oldIn
!=
0
)
{
positions
<<
old_in
;
}
else
if
(
in
==
0
&&
ok
&&
ok2
)
{
...
...
@@ -371,7 +371,7 @@ void KeyframeModelList::resizeKeyframes(int oldIn, int oldOut, int in, int out,
param
.
second
->
removeKeyframe
(
old_in
,
undo
,
redo
);
}
}
//qDebug()<<"/// \n\nKEYS TO DELETE: "<<positions<<"\n------------------------";
//
qDebug()<<"/// \n\nKEYS TO DELETE: "<<positions<<"\n------------------------";
if
(
ok
&&
!
ok2
)
{
for
(
const
auto
&
param
:
m_parameters
)
{
QVariant
value
=
param
.
second
->
getInterpolatedValue
(
new_in
);
...
...
@@ -391,17 +391,17 @@ void KeyframeModelList::resizeKeyframes(int oldIn, int oldOut, int in, int out,
// Check keyframes after last position
bool
ok3
;
Keyframe
toDel
=
getNextKeyframe
(
new_out
,
&
ok3
);
QList
<
GenTime
>
positions
;
QList
<
GenTime
>
positions
;
if
(
ok
&&
!
ok2
)
{
positions
<<
old_out
;
}
while
(
ok3
)
{
if
(
!
positions
.
contains
(
toDel
.
first
))
{
if
(
!
positions
.
contains
(
toDel
.
first
))
{
positions
<<
toDel
.
first
;
}
toDel
=
getNextKeyframe
(
toDel
.
first
,
&
ok3
);
}
//qDebug()<<"/// \n\nKEYS TO DELETE: "<<positions<<"\n------------------------";
//
qDebug()<<"/// \n\nKEYS TO DELETE: "<<positions<<"\n------------------------";
if
(
ok
&&
!
ok2
)
{
for
(
const
auto
&
param
:
m_parameters
)
{
QVariant
value
=
param
.
second
->
getInterpolatedValue
(
new_out
);
...
...
src/assets/keyframes/model/keyframemonitorhelper.cpp
View file @
4bb8959e
...
...
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QSize>
KeyframeMonitorHelper
::
KeyframeMonitorHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
)
KeyframeMonitorHelper
::
KeyframeMonitorHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
)
:
QObject
(
parent
)
,
m_monitor
(
monitor
)
,
m_model
(
model
)
...
...
@@ -52,4 +52,3 @@ void KeyframeMonitorHelper::addIndex(QPersistentModelIndex index)
{
m_indexes
<<
index
;
}
src/assets/keyframes/model/keyframemonitorhelper.hpp
View file @
4bb8959e
...
...
@@ -24,15 +24,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QPersistentModelIndex>
#include <QVariant>
#include <QObject>
#include <QVariant>
#include <memory>
class
Monitor
;
class
AssetParameterModel
;
/** @brief This class helps manage effects that receive data from the monitor's qml overlay to translate
/** @brief This class helps manage effects that receive data from the monitor's qml overlay to translate
the data and pass it to the model
*/
...
...
@@ -46,21 +46,21 @@ public:
@param model is the asset this parameter belong to
@param index is the index of this parameter in its model
*/
explicit
KeyframeMonitorHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
=
nullptr
);
explicit
KeyframeMonitorHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
=
nullptr
);
/** @brief Send signals to the monitor to update the qml overlay.
@param returns : true if the monitor's connection was changed to active.
*/
bool
connectMonitor
(
bool
activate
);
/** @brief Send data update to the monitor