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
260
Issues
260
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
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
97076e46
Commit
97076e46
authored
Mar 29, 2018
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reintroduce slide effect widget
parent
b7b062e2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
318 additions
and
3 deletions
+318
-3
data/transitions/slide.xml
data/transitions/slide.xml
+0
-1
src/assets/CMakeLists.txt
src/assets/CMakeLists.txt
+1
-0
src/assets/view/widgets/abstractparamwidget.cpp
src/assets/view/widgets/abstractparamwidget.cpp
+4
-2
src/assets/view/widgets/slidewidget.cpp
src/assets/view/widgets/slidewidget.cpp
+232
-0
src/assets/view/widgets/slidewidget.hpp
src/assets/view/widgets/slidewidget.hpp
+81
-0
No files found.
data/transitions/slide.xml
View file @
97076e46
...
...
@@ -3,7 +3,6 @@
<name>
Slide
</name>
<description>
Slide image from one side to another.
</description>
<author>
Dan Dennedy
</author>
<parameter
tag=
"geometry"
type=
"wipe"
default=
"-100%,0%:100%x100%;-1=0%,0%:100%x100%"
name=
"geometry"
>
<name>
Direction
</name>
</parameter>
...
...
src/assets/CMakeLists.txt
View file @
97076e46
...
...
@@ -16,6 +16,7 @@ set(kdenlive_SRCS
assets/view/widgets/boolparamwidget.cpp
assets/view/widgets/doubleparamwidget.cpp
assets/view/widgets/colorwheel.cpp
assets/view/widgets/slidewidget.cpp
assets/view/widgets/lumaliftgainparam.cpp
# assets/view/widgets/keyframeedit.cpp
assets/view/widgets/keyframewidget.cpp
...
...
src/assets/view/widgets/abstractparamwidget.cpp
View file @
97076e46
...
...
@@ -29,6 +29,7 @@
#include "listparamwidget.h"
#include "positioneditwidget.hpp"
#include "coloreditwidget.hpp"
#include "slidewidget.hpp"
#include <QLabel>
#include <QVBoxLayout>
...
...
@@ -66,7 +67,6 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
{
// We retrieve the parameter type
auto
type
=
model
->
data
(
index
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
qDebug
()
<<
"paramtype "
<<
(
int
)
type
;
QString
name
=
model
->
data
(
index
,
AssetParameterModel
::
NameRole
).
toString
();
...
...
@@ -98,6 +98,9 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
case
ParamType
::
ColorWheel
:
widget
=
new
LumaLiftGainParam
(
model
,
index
,
parent
);
break
;
case
ParamType
::
Wipe
:
widget
=
new
SlideWidget
(
model
,
index
,
parent
);
break
;
case
ParamType
::
Animated
:
case
ParamType
::
RestrictedAnim
:
// widget = new AnimationWidget(model, index, range, parent);
...
...
@@ -110,7 +113,6 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
case
ParamType
::
Curve
:
case
ParamType
::
Bezier_spline
:
case
ParamType
::
Roto_spline
:
case
ParamType
::
Wipe
:
case
ParamType
::
Url
:
case
ParamType
::
Keywords
:
case
ParamType
::
Fontfamily
:
...
...
src/assets/view/widgets/slidewidget.cpp
0 → 100644
View file @
97076e46
/***************************************************************************
* Copyright (C) 2018 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "slidewidget.hpp"
#include "assets/model/assetparametermodel.hpp"
SlideWidget
::
SlideWidget
(
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QModelIndex
index
,
QWidget
*
parent
)
:
AbstractParamWidget
(
std
::
move
(
model
),
index
,
parent
)
{
// setup the comment
setupUi
(
this
);
QString
name
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
NameRole
).
toString
();
QString
comment
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
CommentRole
).
toString
();
setToolTip
(
comment
);
slotRefresh
();
connect
(
end_up
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
end_down
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
end_left
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
end_right
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
end_center
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
start_up
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
start_down
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
start_left
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
start_right
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
start_center
,
&
QAbstractButton
::
clicked
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
start_transp
,
&
QAbstractSlider
::
valueChanged
,
this
,
&
SlideWidget
::
updateValue
);
connect
(
end_transp
,
&
QAbstractSlider
::
valueChanged
,
this
,
&
SlideWidget
::
updateValue
);
// emit the signal of the base class when appropriate
connect
(
this
,
&
SlideWidget
::
modified
,
[
this
](
const
QString
&
val
)
{
emit
valueChanged
(
m_index
,
val
,
true
);
});
// setup comment
setToolTip
(
comment
);
}
void
SlideWidget
::
slotShowComment
(
bool
)
{
}
void
SlideWidget
::
slotRefresh
()
{
QString
value
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toString
();
QColor
bg
=
QPalette
().
highlight
().
color
();
setStyleSheet
(
QStringLiteral
(
"QPushButton:checked {background-color:rgb(%1,%2,%3);}"
).
arg
(
bg
.
red
()).
arg
(
bg
.
green
()).
arg
(
bg
.
blue
()));
wipeInfo
w
=
getWipeInfo
(
value
);
switch
(
w
.
start
)
{
case
UP
:
start_up
->
setChecked
(
true
);
break
;
case
DOWN
:
start_down
->
setChecked
(
true
);
break
;
case
RIGHT
:
start_right
->
setChecked
(
true
);
break
;
case
LEFT
:
start_left
->
setChecked
(
true
);
break
;
default:
start_center
->
setChecked
(
true
);
break
;
}
switch
(
w
.
end
)
{
case
UP
:
end_up
->
setChecked
(
true
);
break
;
case
DOWN
:
end_down
->
setChecked
(
true
);
break
;
case
RIGHT
:
end_right
->
setChecked
(
true
);
break
;
case
LEFT
:
end_left
->
setChecked
(
true
);
break
;
default:
end_center
->
setChecked
(
true
);
break
;
}
start_transp
->
setValue
(
w
.
startTransparency
);
end_transp
->
setValue
(
w
.
endTransparency
);
}
void
SlideWidget
::
slotSetRange
(
QPair
<
int
,
int
>
)
{
}
void
SlideWidget
::
updateValue
()
{
wipeInfo
info
;
if
(
start_left
->
isChecked
())
{
info
.
start
=
LEFT
;
}
else
if
(
start_right
->
isChecked
())
{
info
.
start
=
RIGHT
;
}
else
if
(
start_up
->
isChecked
())
{
info
.
start
=
UP
;
}
else
if
(
start_down
->
isChecked
())
{
info
.
start
=
DOWN
;
}
else
if
(
start_center
->
isChecked
())
{
info
.
start
=
CENTER
;
}
else
{
info
.
start
=
LEFT
;
}
info
.
startTransparency
=
start_transp
->
value
();
if
(
end_left
->
isChecked
())
{
info
.
end
=
LEFT
;
}
else
if
(
end_right
->
isChecked
())
{
info
.
end
=
RIGHT
;
}
else
if
(
end_up
->
isChecked
())
{
info
.
end
=
UP
;
}
else
if
(
end_down
->
isChecked
())
{
info
.
end
=
DOWN
;
}
else
if
(
end_center
->
isChecked
())
{
info
.
end
=
CENTER
;
}
else
{
info
.
end
=
RIGHT
;
}
info
.
endTransparency
=
end_transp
->
value
();
emit
modified
(
getWipeString
(
info
));
}
SlideWidget
::
wipeInfo
SlideWidget
::
getWipeInfo
(
QString
value
)
{
wipeInfo
info
;
// Convert old geometry values that used a comma as separator
if
(
value
.
contains
(
QLatin1Char
(
','
)))
{
value
.
replace
(
','
,
'/'
);
}
QString
start
=
value
.
section
(
QLatin1Char
(
';'
),
0
,
0
);
QString
end
=
value
.
section
(
QLatin1Char
(
';'
),
1
,
1
).
section
(
QLatin1Char
(
'='
),
1
,
1
);
if
(
start
.
startsWith
(
QLatin1String
(
"-100%/0"
)))
{
info
.
start
=
LEFT
;
}
else
if
(
start
.
startsWith
(
QLatin1String
(
"100%/0"
)))
{
info
.
start
=
RIGHT
;
}
else
if
(
start
.
startsWith
(
QLatin1String
(
"0%/100%"
)))
{
info
.
start
=
DOWN
;
}
else
if
(
start
.
startsWith
(
QLatin1String
(
"0%/-100%"
)))
{
info
.
start
=
UP
;
}
else
{
info
.
start
=
CENTER
;
}
if
(
start
.
count
(
':'
)
==
2
)
{
info
.
startTransparency
=
start
.
section
(
QLatin1Char
(
':'
),
-
1
).
toInt
();
}
else
{
info
.
startTransparency
=
100
;
}
if
(
end
.
startsWith
(
QLatin1String
(
"-100%/0"
)))
{
info
.
end
=
LEFT
;
}
else
if
(
end
.
startsWith
(
QLatin1String
(
"100%/0"
)))
{
info
.
end
=
RIGHT
;
}
else
if
(
end
.
startsWith
(
QLatin1String
(
"0%/100%"
)))
{
info
.
end
=
DOWN
;
}
else
if
(
end
.
startsWith
(
QLatin1String
(
"0%/-100%"
)))
{
info
.
end
=
UP
;
}
else
{
info
.
end
=
CENTER
;
}
if
(
end
.
count
(
':'
)
==
2
)
{
info
.
endTransparency
=
end
.
section
(
QLatin1Char
(
':'
),
-
1
).
toInt
();
}
else
{
info
.
endTransparency
=
100
;
}
return
info
;
}
const
QString
SlideWidget
::
getWipeString
(
wipeInfo
info
)
{
QString
start
;
QString
end
;
switch
(
info
.
start
)
{
case
LEFT
:
start
=
QStringLiteral
(
"-100%/0%:100%x100%"
);
break
;
case
RIGHT
:
start
=
QStringLiteral
(
"100%/0%:100%x100%"
);
break
;
case
DOWN
:
start
=
QStringLiteral
(
"0%/100%:100%x100%"
);
break
;
case
UP
:
start
=
QStringLiteral
(
"0%/-100%:100%x100%"
);
break
;
default:
start
=
QStringLiteral
(
"0%/0%:100%x100%"
);
break
;
}
start
.
append
(
':'
+
QString
::
number
(
info
.
startTransparency
));
switch
(
info
.
end
)
{
case
LEFT
:
end
=
QStringLiteral
(
"-100%/0%:100%x100%"
);
break
;
case
RIGHT
:
end
=
QStringLiteral
(
"100%/0%:100%x100%"
);
break
;
case
DOWN
:
end
=
QStringLiteral
(
"0%/100%:100%x100%"
);
break
;
case
UP
:
end
=
QStringLiteral
(
"0%/-100%:100%x100%"
);
break
;
default:
end
=
QStringLiteral
(
"0%/0%:100%x100%"
);
break
;
}
end
.
append
(
':'
+
QString
::
number
(
info
.
endTransparency
));
return
QString
(
start
+
QStringLiteral
(
";-1="
)
+
end
);
}
src/assets/view/widgets/slidewidget.hpp
0 → 100644
View file @
97076e46
/***************************************************************************
* Copyright (C) 2018 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef SLIDEWIDGET_H
#define SLIDEWIDGET_H
#include "abstractparamwidget.hpp"
#include "ui_wipeval_ui.h"
#include <QWidget>
/**
* @class SlideWidget
* @brief Provides options to choose slide.
* @author Jean-Baptiste Mardelle
*/
class
SlideWidget
:
public
AbstractParamWidget
,
public
Ui
::
Wipeval_UI
{
Q_OBJECT
public:
enum
WIPE_DIRECTON
{
UP
=
0
,
DOWN
=
1
,
LEFT
=
2
,
RIGHT
=
3
,
CENTER
=
4
};
struct
wipeInfo
{
WIPE_DIRECTON
start
;
WIPE_DIRECTON
end
;
int
startTransparency
;
int
endTransparency
;
};
/** @brief Sets up the widget.
*/
explicit
SlideWidget
(
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QModelIndex
index
,
QWidget
*
parent
);
/** @brief Gets the chosen slide. */
QString
getSlide
()
const
;
private:
wipeInfo
getWipeInfo
(
QString
value
);
const
QString
getWipeString
(
wipeInfo
info
);
public
slots
:
/** @brief Toggle the comments on or off
*/
void
slotShowComment
(
bool
show
)
override
;
/** @brief refresh the properties to reflect changes in the model
*/
void
slotRefresh
()
override
;
/** @brief update the clip's in/out point
*/
void
slotSetRange
(
QPair
<
int
,
int
>
)
override
;
/** @brief Updates the different color choosing options to have all selected @param color. */
void
updateValue
();
signals:
/** @brief Emitted whenever a different color was chosen. */
void
modified
(
const
QString
&
);
};
#endif
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