Skip to content
GitLab
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
afd262c2
Commit
afd262c2
authored
Aug 20, 2022
by
Julius Künzel
💬
Browse files
Fix several issues with QText clips
parent
1489d115
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
afd262c2
...
...
@@ -1434,6 +1434,10 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
passProperties
.
insert
(
i
.
key
(),
i
.
value
());
}
}
if
(
m_clipType
==
ClipType
::
QText
&&
properties
.
contains
(
QStringLiteral
(
"text"
)))
{
reload
=
true
;
refreshOnly
=
false
;
}
if
(
properties
.
contains
(
QStringLiteral
(
"resource"
)))
{
// Clip source was changed, update important stuff
refreshPanel
=
true
;
...
...
src/dialogs/clipcreationdialog.cpp
View file @
afd262c2
...
...
@@ -255,23 +255,28 @@ void ClipCreationDialog::createQTextClip(KdenliveDoc *doc, const QString &parent
QScopedPointer
<
QDialog
>
dia
(
new
QDialog
(
bin
));
Ui
::
QTextClip_UI
dia_ui
;
dia_ui
.
setupUi
(
dia
.
data
());
TimecodeDisplay
*
duration
=
new
TimecodeDisplay
(
pCore
->
timecode
(),
dia
.
data
());
dia_ui
.
formLayout
->
addRow
(
i18n
(
"Duration:"
),
duration
);
dia
->
setWindowTitle
(
i18nc
(
"@title:window"
,
"Text Clip"
));
dia_ui
.
fgColor
->
setAlphaChannelEnabled
(
true
);
dia_ui
.
lineColor
->
setAlphaChannelEnabled
(
true
);
dia_ui
.
bgColor
->
setAlphaChannelEnabled
(
true
);
auto
get_color
=
[](
ProjectClip
*
clip
,
const
QString
&
name
)
{
return
QColor
(
clip
->
getProducerProperty
(
name
).
replace
(
QStringLiteral
(
"0x"
),
QStringLiteral
(
"#"
)));
};
if
(
clip
)
{
dia_ui
.
name
->
setText
(
clip
->
getProducerProperty
(
QStringLiteral
(
"kdenlive:
clip
n
ame
"
)
));
dia_ui
.
name
->
setText
(
clip
->
clip
N
ame
(
));
dia_ui
.
text
->
setPlainText
(
clip
->
getProducerProperty
(
QStringLiteral
(
"text"
)));
dia_ui
.
fgColor
->
setColor
(
clip
->
getProducerProperty
(
QStringLiteral
(
"fgcolour"
)));
dia_ui
.
bgColor
->
setColor
(
clip
->
getProducerProperty
(
QStringLiteral
(
"bgcolour"
)));
dia_ui
.
fgColor
->
setColor
(
get_color
(
clip
,
QStringLiteral
(
"fgcolour"
)));
dia_ui
.
bgColor
->
setColor
(
get_color
(
clip
,
QStringLiteral
(
"bgcolour"
)));
dia_ui
.
pad
->
setValue
(
clip
->
getProducerProperty
(
QStringLiteral
(
"pad"
)).
toInt
());
dia_ui
.
lineColor
->
setColor
(
clip
->
getProducerProperty
(
QStringLiteral
(
"olcolour"
)));
dia_ui
.
lineColor
->
setColor
(
get_color
(
clip
,
QStringLiteral
(
"olcolour"
)));
dia_ui
.
lineWidth
->
setValue
(
clip
->
getProducerProperty
(
QStringLiteral
(
"outline"
)).
toInt
());
dia_ui
.
font
->
setCurrentFont
(
QFont
(
clip
->
getProducerProperty
(
QStringLiteral
(
"family"
))));
dia_ui
.
fontSize
->
setValue
(
clip
->
getProducerProperty
(
QStringLiteral
(
"size"
)).
toInt
());
dia_ui
.
weight
->
setValue
(
clip
->
getProducerProperty
(
QStringLiteral
(
"weight"
)).
toInt
());
dia_ui
.
italic
->
setChecked
(
clip
->
getProducerProperty
(
QStringLiteral
(
"style"
))
==
QStringLiteral
(
"italic"
));
dia_ui
.
duration
->
set
Text
(
doc
->
timecode
().
getTimecodeFromFrames
(
clip
->
getProducerProperty
(
QStringLiteral
(
"out"
)).
toInt
()
));
duration
->
set
Value
(
clip
->
frameDuration
(
));
}
else
{
dia_ui
.
name
->
setText
(
i18n
(
"Text Clip"
));
dia_ui
.
fgColor
->
setColor
(
titleConfig
.
readEntry
(
QStringLiteral
(
"font_color"
)));
...
...
@@ -282,29 +287,26 @@ void ClipCreationDialog::createQTextClip(KdenliveDoc *doc, const QString &parent
dia_ui
.
fontSize
->
setValue
(
titleConfig
.
readEntry
(
QStringLiteral
(
"font_pixel_size"
)).
toInt
());
dia_ui
.
weight
->
setValue
(
titleConfig
.
readEntry
(
QStringLiteral
(
"font_weight"
)).
toInt
());
dia_ui
.
italic
->
setChecked
(
titleConfig
.
readEntry
(
QStringLiteral
(
"font_italic"
)).
toInt
()
!=
0
);
dia_ui
.
duration
->
setText
(
titleConfig
.
readEntry
(
QStringLiteral
(
"title_duration"
)));
}
if
(
dia
->
exec
()
==
QDialog
::
Accepted
)
{
// KdenliveSettings::setColorclipcolor(color);
QDomDocument
xml
;
QDomElement
prod
=
xml
.
createElement
(
QStringLiteral
(
"producer"
));
xml
.
appendChild
(
prod
);
prod
.
setAttribute
(
QStringLiteral
(
"type"
),
int
(
ClipType
::
QText
));
int
id
=
pCore
->
projectItemModel
()
->
getFreeClipId
();
prod
.
setAttribute
(
QStringLiteral
(
"id"
),
QString
::
number
(
id
));
prod
.
setAttribute
(
QStringLiteral
(
"in"
),
QStringLiteral
(
"0"
));
prod
.
setAttribute
(
QStringLiteral
(
"out"
),
doc
->
timecode
().
getFrameCount
(
dia_ui
.
duration
->
text
()));
QMap
<
QString
,
QString
>
properties
;
properties
.
insert
(
QStringLiteral
(
"kdenlive:clipname"
),
dia_ui
.
name
->
text
());
if
(
!
parentId
.
isEmpty
())
{
properties
.
insert
(
QStringLiteral
(
"kdenlive:folderid"
),
parentId
);
}
if
(
duration
->
getValue
()
!=
clip
->
getFramePlaytime
())
{
// duration changed, we need to update duration
properties
.
insert
(
QStringLiteral
(
"out"
),
clip
->
framesToTime
(
duration
->
getValue
()
-
1
));
int
currentLength
=
clip
->
getProducerDuration
();
if
(
currentLength
!=
duration
->
getValue
())
{
properties
.
insert
(
QStringLiteral
(
"kdenlive:duration"
),
clip
->
framesToTime
(
duration
->
getValue
()));
properties
.
insert
(
QStringLiteral
(
"length"
),
QString
(
duration
->
getValue
()));
}
}
properties
.
insert
(
QStringLiteral
(
"mlt_service"
),
QStringLiteral
(
"qtext"
));
properties
.
insert
(
QStringLiteral
(
"out"
),
QString
::
number
(
doc
->
timecode
().
getFrameCount
(
dia_ui
.
duration
->
text
())));
properties
.
insert
(
QStringLiteral
(
"length"
),
dia_ui
.
duration
->
text
());
// properties.insert(QStringLiteral("scale"), QStringLiteral("off"));
// properties.insert(QStringLiteral("fill"), QStringLiteral("0"));
properties
.
insert
(
QStringLiteral
(
"text"
),
dia_ui
.
text
->
document
()
->
toPlainText
());
...
...
@@ -318,23 +320,20 @@ void ClipCreationDialog::createQTextClip(KdenliveDoc *doc, const QString &parent
properties
.
insert
(
QStringLiteral
(
"style"
),
dia_ui
.
italic
->
isChecked
()
?
QStringLiteral
(
"italic"
)
:
QStringLiteral
(
"normal"
));
properties
.
insert
(
QStringLiteral
(
"weight"
),
QString
::
number
(
dia_ui
.
weight
->
value
()));
if
(
clip
)
{
QMap
<
QString
,
QString
>
oldProperties
;
oldProperties
.
insert
(
QStringLiteral
(
"out"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"out"
)));
oldProperties
.
insert
(
QStringLiteral
(
"length"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"length"
)));
oldProperties
.
insert
(
QStringLiteral
(
"kdenlive:clipname"
),
clip
->
name
());
oldProperties
.
insert
(
QStringLiteral
(
"ttl"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"ttl"
)));
oldProperties
.
insert
(
QStringLiteral
(
"loop"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"loop"
)));
oldProperties
.
insert
(
QStringLiteral
(
"crop"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"crop"
)));
oldProperties
.
insert
(
QStringLiteral
(
"fade"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"fade"
)));
oldProperties
.
insert
(
QStringLiteral
(
"luma_duration"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"luma_duration"
)));
oldProperties
.
insert
(
QStringLiteral
(
"luma_file"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"luma_file"
)));
oldProperties
.
insert
(
QStringLiteral
(
"softness"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"softness"
)));
oldProperties
.
insert
(
QStringLiteral
(
"animation"
),
clip
->
getProducerProperty
(
QStringLiteral
(
"animation"
)));
bin
->
slotEditClipCommand
(
clip
->
AbstractProjectItem
::
clipId
(),
oldProperties
,
properties
);
bin
->
slotEditClipCommand
(
clip
->
AbstractProjectItem
::
clipId
(),
clip
->
currentProperties
(
properties
),
properties
);
}
else
{
QDomDocument
xml
;
QDomElement
prod
=
xml
.
createElement
(
QStringLiteral
(
"producer"
));
xml
.
appendChild
(
prod
);
prod
.
setAttribute
(
QStringLiteral
(
"type"
),
int
(
ClipType
::
QText
));
int
id
=
pCore
->
projectItemModel
()
->
getFreeClipId
();
prod
.
setAttribute
(
QStringLiteral
(
"id"
),
QString
::
number
(
id
));
prod
.
setAttribute
(
QStringLiteral
(
"in"
),
QStringLiteral
(
"0"
));
prod
.
setAttribute
(
QStringLiteral
(
"out"
),
duration
->
getValue
());
Xml
::
addXmlProperties
(
prod
,
properties
);
QString
clipId
=
QString
::
number
(
id
);
pCore
->
projectItemModel
()
->
requestAddBinClip
(
clipId
,
xml
.
documentElement
(),
parentId
,
i18n
(
"Create T
itle
clip"
));
pCore
->
projectItemModel
()
->
requestAddBinClip
(
clipId
,
xml
.
documentElement
(),
parentId
,
i18n
(
"Create T
ext
clip"
));
}
}
}
...
...
src/mltcontroller/clipcontroller.cpp
View file @
afd262c2
...
...
@@ -268,6 +268,7 @@ void ClipController::getInfoForProducer()
m_clipType
=
ClipType
::
WebVfx
;
}
else
if
(
m_service
==
QLatin1String
(
"qtext"
))
{
m_clipType
=
ClipType
::
QText
;
m_hasLimitedDuration
=
false
;
}
else
if
(
m_service
==
QLatin1String
(
"qml"
))
{
m_clipType
=
ClipType
::
Qml
;
m_hasLimitedDuration
=
false
;
...
...
src/ui/qtextclip_ui.ui
View file @
afd262c2
...
...
@@ -6,179 +6,162 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
57
1
</width>
<width>
64
1
</width>
<height>
429
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<layout
class=
"Q
Grid
Layout"
>
<item
row=
"1"
column=
"0"
>
<
widge
t
class=
"Q
Label"
name=
"textLabel
"
>
<property
name=
"
text
"
>
<
string>
Text
</string
>
<layout
class=
"Q
VBoxLayout"
name=
"vertical
Layout"
>
<item>
<
layou
t
class=
"Q
FormLayout"
name=
"formLayout
"
>
<property
name=
"
bottomMargin
"
>
<
number>
20
</number
>
</property>
</widget>
</item>
<item
row=
"2"
column=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"fontGroup"
>
<item>
<widget
class=
"QFontComboBox"
name=
"font"
/>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"fontSize"
>
<property
name=
"minimum"
>
<number>
6
</number>
</property>
<property
name=
"maximum"
>
<number>
1000
</number>
</property>
<property
name=
"value"
>
<number>
100
</number>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"nameLabel"
>
<property
name=
"text"
>
<string>
Name:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"weightLabel"
>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"name"
/>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"textLabel"
>
<property
name=
"text"
>
<string>
Weigh
t:
</string>
<string>
Tex
t:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"weight"
>
<property
name=
"minimum"
>
<number>
100
</number>
</property>
<property
name=
"maximum"
>
<number>
1000
</number>
</property>
<property
name=
"value"
>
<number>
400
</number>
</property>
</widget>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QTextEdit"
name=
"text"
/>
</item>
<item>
<widget
class=
"Q
ToolButton"
name=
"italic
"
>
<item
row=
"2"
column=
"0"
>
<widget
class=
"Q
Label"
name=
"fontLabel
"
>
<property
name=
"text"
>
<string>
...
</string>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
<string>
Font:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"KColorButton"
name=
"fgColor"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"flat"
>
<bool>
false
</bool>
</property>
<property
name=
"color"
stdset=
"0"
>
<color>
<red>
85
</red>
<green>
170
</green>
<blue>
255
</blue>
</color>
</property>
<property
name=
"defaultColor"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</property>
</widget>
<item
row=
"2"
column=
"1"
>
<layout
class=
"QHBoxLayout"
name=
"fontGroup"
>
<item>
<widget
class=
"QFontComboBox"
name=
"font"
/>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"fontSize"
>
<property
name=
"minimum"
>
<number>
6
</number>
</property>
<property
name=
"maximum"
>
<number>
1000
</number>
</property>
<property
name=
"value"
>
<number>
100
</number>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"weightLabel"
>
<property
name=
"text"
>
<string>
Weight:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"weight"
>
<property
name=
"minimum"
>
<number>
100
</number>
</property>
<property
name=
"maximum"
>
<number>
1000
</number>
</property>
<property
name=
"value"
>
<number>
400
</number>
</property>
</widget>
</item>
<item>
<widget
class=
"QToolButton"
name=
"italic"
>
<property
name=
"text"
>
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
theme=
"format-text-italic"
>
<normaloff>
.
</normaloff>
.
</iconset>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"KColorButton"
name=
"fgColor"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"defaultColor"
>
<color>
<red>
255
</red>
<green>
255
</green>
<blue>
255
</blue>
</color>
</property>
<property
name=
"alphaChannelEnabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item
row=
"6"
column=
"0"
>
<widget
class=
"QLabel"
name=
"bgLabel"
>
<property
name=
"text"
>
<string>
Background
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"nameLabel"
>
<property
name=
"text"
>
<string>
Name
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QLineEdit"
name=
"name"
/>
</item>
<item
row=
"9"
column=
"0"
colspan=
"4"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
</widget>
</item>
<item
row=
"5"
column=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"lineGroup"
>
<item>
<widget
class=
"QSpinBox"
name=
"lineWidth"
>
<property
name=
"maximum"
>
<number>
5000
</number>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QLabel"
name=
"outlineLabel"
>
<property
name=
"text"
>
<string>
Outline:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"KColorButton"
name=
"lineColor"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
<item
row=
"3"
column=
"1"
>
<layout
class=
"QHBoxLayout"
name=
"lineGroup"
>
<item>
<widget
class=
"QSpinBox"
name=
"lineWidth"
>
<property
name=
"maximum"
>
<number>
5000
</number>
</property>
</widget>
</item>
<item>
<widget
class=
"KColorButton"
name=
"lineColor"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"autoDefault"
>
<bool>
true
</bool>
</property>
<property
name=
"alphaChannelEnabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer
name=
"lineSpace"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
<item
row=
"4"
column=
"0"
>
<widget
class=
"QLabel"
name=
"bgLabel"
>
<property
name=
"text"
>
<string>
Background:
</string>
</property>
</
spacer
>
</
widget
>
</item>
</layout>
</item>
<item
row=
"1"
column=
"2"
>
<widget
class=
"QTextEdit"
name=
"text"
/>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"fontLabel"
>
<property
name=
"text"
>
<string>
Font
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"outlineLabel"
>
<property
name=
"text"
>
<string>
Outline
</string>
</property>
</widget>
</item>
<item
row=
"6"
column=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"bgGroup"
>
<item>
<item
row=
"4"
column=
"1"
>
<widget
class=
"KColorButton"
name=
"bgColor"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
...
...
@@ -186,68 +169,37 @@
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"alphaChannelEnabled"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"padLabel"
>
<property
name=
"text"
>
<string>
Padding
</string>
<string>
Padding
:
</string>
</property>
</widget>
</item>
<item>
<item
row=
"5"
column=
"1"
>
<widget
class=
"QSpinBox"
name=
"pad"
>
<property
name=
"maximum"
>
<number>
4096
</number>
</property>
</widget>
</item>
<item>
<spacer
name=
"bgSpace"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item
row=
"7"
column=
"0"
>
<widget
class=
"QLabel"
name=
"durationLabel"
>
<property
name=
"text"
>
<string>
Duration
</string>
<item>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
</widget>
</item>
<item
row=
"7"
column=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"durationGroup"
>
<item>
<widget
class=
"QLineEdit"
name=
"duration"
>
<property
name=
"inputMask"
>
<string>
#99:99:99:99
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"durationSpace"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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