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
e152455e
Commit
e152455e
authored
Mar 17, 2021
by
Julius Künzel
Browse files
Titler: use TimecodeDisplay for duration input
(cherry picked from commit
e9ff0cc6
)
parent
777e0389
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
e152455e
...
...
@@ -3727,7 +3727,7 @@ void Bin::showTitleWidget(const std::shared_ptr<ProjectClip> &clip)
QList
<
int
>
clips
=
clip
->
timelineInstances
();
// Temporarily hide this title clip in timeline so that it does not appear when requesting background frame
pCore
->
temporaryUnplug
(
clips
,
true
);
TitleWidget
dia_ui
(
QUrl
(),
m_doc
->
timecode
(),
titleFolder
.
absolutePath
(),
pCore
->
monitorManager
()
->
projectMonitor
(),
pCore
->
window
());
TitleWidget
dia_ui
(
QUrl
(),
titleFolder
.
absolutePath
(),
pCore
->
monitorManager
()
->
projectMonitor
(),
pCore
->
window
());
QDomDocument
doc
;
QString
xmldata
=
clip
->
getProducerProperty
(
QStringLiteral
(
"xmldata"
));
if
(
xmldata
.
isEmpty
()
&&
QFile
::
exists
(
path
))
{
...
...
src/dialogs/clipcreationdialog.cpp
View file @
e152455e
...
...
@@ -272,7 +272,7 @@ void ClipCreationDialog::createTitleClip(KdenliveDoc *doc, const QString &parent
QDir
dir
(
doc
->
projectDataFolder
()
+
QStringLiteral
(
"/titles"
));
dir
.
mkpath
(
QStringLiteral
(
"."
));
QPointer
<
TitleWidget
>
dia_ui
=
new
TitleWidget
(
QUrl
::
fromLocalFile
(
templatePath
),
doc
->
timecode
(),
dir
.
absolutePath
(),
pCore
->
getMonitor
(
Kdenlive
::
ProjectMonitor
),
pCore
->
bin
());
new
TitleWidget
(
QUrl
::
fromLocalFile
(
templatePath
),
dir
.
absolutePath
(),
pCore
->
getMonitor
(
Kdenlive
::
ProjectMonitor
),
pCore
->
bin
());
if
(
dia_ui
->
exec
()
==
QDialog
::
Accepted
)
{
// Ready, create clip xml
std
::
unordered_map
<
QString
,
QString
>
properties
;
...
...
src/titler/titlewidget.cpp
View file @
e152455e
...
...
@@ -25,6 +25,7 @@
#include "bin/bin.h"
#include "doc/kthumb.h"
#include "gradientwidget.h"
#include "timecodedisplay.h"
#include "kdenlivesettings.h"
#include "monitor/monitor.h"
#include "titler/patternsmodel.h"
...
...
@@ -90,7 +91,7 @@ void TitleWidget::refreshTemplateBoxContents()
}
}
TitleWidget
::
TitleWidget
(
const
QUrl
&
url
,
const
Timecode
&
tc
,
QString
projectTitlePath
,
Monitor
*
monitor
,
QWidget
*
parent
)
TitleWidget
::
TitleWidget
(
const
QUrl
&
url
,
QString
projectTitlePath
,
Monitor
*
monitor
,
QWidget
*
parent
)
:
QDialog
(
parent
)
,
Ui
::
TitleWidget_UI
()
,
m_startViewport
(
nullptr
)
...
...
@@ -99,7 +100,6 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, QString projectTit
,
m_unicodeDialog
(
new
UnicodeDialog
(
UnicodeDialog
::
InputHex
))
,
m_missingMessage
(
nullptr
)
,
m_projectTitlePath
(
std
::
move
(
projectTitlePath
))
,
m_tc
(
tc
)
,
m_fps
(
pCore
->
getCurrentFps
())
,
m_guides
(
QList
<
QGraphicsLineItem
*>
())
{
...
...
@@ -171,9 +171,11 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, QString projectTit
splitter
->
setStretchFactor
(
0
,
20
);
// If project is drop frame, set the input mask as such.
title_duration
->
setInputMask
(
m_tc
.
mask
());
title_duration
->
setText
(
m_tc
.
reformatSeparators
(
KdenliveSettings
::
title_duration
()));
m_duration
=
new
TimecodeDisplay
(
pCore
->
timecode
(),
this
);
m_duration
->
setValue
(
KdenliveSettings
::
title_duration
());
duration_box
->
addWidget
(
m_duration
);
auto
*
spacer
=
new
QSpacerItem
(
1
,
1
,
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Maximum
);
duration_box
->
addSpacerItem
(
spacer
);
connect
(
backgroundColor
,
&
KColorButton
::
changed
,
this
,
&
TitleWidget
::
slotChangeBackground
);
connect
(
backgroundAlpha
,
static_cast
<
void
(
QSpinBox
::*
)(
int
)
>
(
&
QSpinBox
::
valueChanged
),
this
,
&
TitleWidget
::
slotChangeBackground
);
...
...
@@ -2212,7 +2214,7 @@ QUrl TitleWidget::saveTitle(QUrl url)
delete
fs
;
}
if
(
url
.
isValid
())
{
if
(
!
m_titledocument
.
saveDocument
(
url
,
m_startViewport
,
m_endViewport
,
m_
tc
.
getFrameCount
(
title_
duration
->
text
()
)
,
embed_image
))
{
if
(
!
m_titledocument
.
saveDocument
(
url
,
m_startViewport
,
m_endViewport
,
m_duration
->
getValue
()
,
embed_image
))
{
KMessageBox
::
error
(
this
,
i18n
(
"Cannot write to file %1"
,
url
.
toLocalFile
()));
}
else
{
return
url
;
...
...
@@ -2248,7 +2250,7 @@ int TitleWidget::getNewStuff(const QString &configFile)
QDomDocument
TitleWidget
::
xml
()
{
QDomDocument
doc
=
m_titledocument
.
xml
(
m_startViewport
,
m_endViewport
);
int
duration
=
m_
tc
.
getFrameCount
(
title_
duration
->
text
()
);
int
duration
=
m_duration
->
getValue
(
);
doc
.
documentElement
().
setAttribute
(
QStringLiteral
(
"duration"
),
duration
);
doc
.
documentElement
().
setAttribute
(
QStringLiteral
(
"out"
),
duration
-
1
);
return
doc
;
...
...
@@ -2256,7 +2258,7 @@ QDomDocument TitleWidget::xml()
int
TitleWidget
::
duration
()
const
{
return
m_
tc
.
getFrameCount
(
title_
duration
->
text
()
);
return
m_duration
->
getValue
(
);
}
void
TitleWidget
::
setXml
(
const
QDomDocument
&
doc
,
const
QString
&
id
)
...
...
@@ -2284,7 +2286,7 @@ void TitleWidget::setXml(const QDomDocument &doc, const QString &id)
messageLayout
->
addWidget
(
m_missingMessage
);
m_missingMessage
->
animatedShow
();
}
title
_duration
->
set
Text
(
m_tc
.
getTimecod
e
(
GenTime
(
duration
,
m_fps
))
)
;
m
_duration
->
set
Valu
e
(
GenTime
(
duration
,
m_fps
));
QDomElement
e
=
doc
.
documentElement
();
m_transformations
.
clear
();
...
...
src/titler/titlewidget.h
View file @
e152455e
...
...
@@ -37,6 +37,7 @@ class PatternsModel;
class
Monitor
;
class
KMessageWidget
;
class
TimecodeDisplay
;
class
TitleTemplate
{
public:
...
...
@@ -71,11 +72,10 @@ class TitleWidget : public QDialog, public Ui::TitleWidget_UI
public:
/** @brief Draws the dialog and loads a title document (if any).
* @param url title document to load
* @param tc timecode of the project
* @param projectPath default path to save to or load from title documents
* @param render project renderer
* @param parent (optional) parent widget */
explicit
TitleWidget
(
const
QUrl
&
url
,
const
Timecode
&
tc
,
QString
projectTitlePath
,
Monitor
*
monitor
,
QWidget
*
parent
=
nullptr
);
explicit
TitleWidget
(
const
QUrl
&
url
,
QString
projectTitlePath
,
Monitor
*
monitor
,
QWidget
*
parent
=
nullptr
);
~
TitleWidget
()
override
;
QDomDocument
xml
();
void
setXml
(
const
QDomDocument
&
doc
,
const
QString
&
id
=
QString
());
...
...
@@ -130,7 +130,7 @@ private:
/** @brief Project path for storing title documents. */
QString
m_projectTitlePath
;
Timecode
m_tc
;
Timecode
Display
*
m_duration
;
/** @brief The project framerate. */
double
m_fps
;
...
...
src/ui/titlewidget_ui.ui
View file @
e152455e
...
...
@@ -620,9 +620,6 @@
</item>
</layout>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"title_duration"
/>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_duration"
>
<property
name=
"text"
>
...
...
@@ -705,9 +702,9 @@
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
-94
</y>
<width>
400
</width>
<height>
5
58
</height>
<y>
0
</y>
<width>
367
</width>
<height>
5
42
</height>
</rect>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_9"
>
...
...
@@ -1785,6 +1782,9 @@
</layout>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<layout
class=
"QHBoxLayout"
name=
"duration_box"
/>
</item>
</layout>
</widget>
</widget>
...
...
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