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
ce8af425
Commit
ce8af425
authored
Jul 10, 2020
by
Jean-Baptiste Mardelle
Browse files
Add option to display clip monitor audio thumbs below video instead of an overlay
Related to
#651
parent
dee2bf08
Pipeline
#26574
passed with stage
in 10 minutes and 45 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/kdenlivesettings.kcfg
View file @
ce8af425
...
...
@@ -820,6 +820,11 @@
<label>
index of current guides overlay for project monitor.
</label>
<default>
0
</default>
</entry>
<entry
name=
"alwaysShowMonitorAudio"
type=
"Bool"
>
<label>
Always display audio thumbs in clip monitor.
</label>
<default>
false
</default>
</entry>
<entry
name=
"displayAudioOverlay"
type=
"Bool"
>
<label>
Show audio overlay info on monitor.
</label>
...
...
src/monitor/glwidget.cpp
View file @
ce8af425
...
...
@@ -113,6 +113,7 @@ GLWidget::GLWidget(int id, QObject *parent)
}
else
if
(
!
(
KdenliveSettings
::
displayProjectMonitorInfo
()
&
0x01
))
{
m_rulerHeight
=
0
;
}
m_displayRulerHeight
=
m_rulerHeight
;
setPersistentOpenGLContext
(
true
);
setPersistentSceneGraph
(
true
);
...
...
@@ -226,7 +227,7 @@ void GLWidget::initializeGL()
void
GLWidget
::
resizeGL
(
int
width
,
int
height
)
{
int
x
,
y
,
w
,
h
;
height
-=
m_
r
ulerHeight
;
height
-=
m_
displayR
ulerHeight
;
double
this_aspect
=
(
double
)
width
/
height
;
// Special case optimization to negate odd effect of sample aspect ratio
...
...
@@ -518,7 +519,7 @@ void GLWidget::paintGL()
f
->
glDisable
(
GL_BLEND
);
f
->
glDisable
(
GL_DEPTH_TEST
);
f
->
glDepthMask
(
GL_FALSE
);
f
->
glViewport
(
0
,
(
m_
r
ulerHeight
*
devicePixelRatio
()
*
0.5
+
0.5
),
width
,
height
);
f
->
glViewport
(
0
,
(
m_
displayR
ulerHeight
*
devicePixelRatio
()
*
0.5
+
0.5
),
width
,
height
);
check_error
(
f
);
f
->
glClearColor
(
m_bgColor
.
redF
(),
m_bgColor
.
greenF
(),
m_bgColor
.
blueF
(),
0
);
f
->
glClear
(
GL_COLOR_BUFFER_BIT
);
...
...
@@ -642,6 +643,12 @@ void GLWidget::slotZoom(bool zoomIn)
}
}
void
GLWidget
::
updateRulerHeight
(
int
addedHeight
)
{
m_displayRulerHeight
=
m_rulerHeight
>
0
?
QFontInfo
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
)).
pixelSize
()
*
1.5
+
addedHeight
:
0
;
resizeGL
(
width
(),
height
());
}
void
GLWidget
::
requestSeek
(
int
position
)
{
m_consumer
->
set
(
"scrub_audio"
,
1
);
...
...
@@ -1870,6 +1877,7 @@ void GLWidget::updateScaling()
void
GLWidget
::
switchRuler
(
bool
show
)
{
m_rulerHeight
=
show
?
QFontInfo
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
)).
pixelSize
()
*
1.5
:
0
;
m_displayRulerHeight
=
m_rulerHeight
;
resizeGL
(
width
(),
height
());
m_proxy
->
rulerHeightChanged
();
}
src/monitor/glwidget.h
View file @
ce8af425
...
...
@@ -196,7 +196,10 @@ protected:
std
::
shared_ptr
<
Mlt
::
Consumer
>
m_consumer
;
std
::
shared_ptr
<
Mlt
::
Producer
>
m_producer
;
int
m_id
;
/** @brief The height of the qml ruler */
int
m_rulerHeight
;
/** @brief The height of the qml ruler and audio thumbs */
int
m_displayRulerHeight
;
QColor
m_bgColor
;
private:
...
...
@@ -257,6 +260,8 @@ protected:
SharedFrame
m_sharedFrame
;
QOpenGLContext
*
m_shareContext
;
/** @brief adjust monitor ruler size (for example if we want to display audio thumbs permanently) */
void
updateRulerHeight
(
int
addedHeight
);
bool
acquireSharedFrameTextures
();
void
bindShaderProgram
();
void
createGPUAccelFragmentProg
();
...
...
src/monitor/monitor.cpp
View file @
ce8af425
...
...
@@ -628,6 +628,16 @@ void Monitor::setupMenu(QMenu *goMenu, QMenu *overlayMenu, QAction *playZone, QA
QAction
*
setThumbFrame
=
m_contextMenu
->
addAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-new"
)),
i18n
(
"Set current image as thumbnail"
),
this
,
SLOT
(
slotSetThumbFrame
()));
m_configMenu
->
addAction
(
setThumbFrame
);
QAction
*
alwaysShowAudio
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"kdenlive-show-audiothumb"
)),
i18n
(
"Always show audio thumbnails"
),
this
);
alwaysShowAudio
->
setCheckable
(
true
);
connect
(
alwaysShowAudio
,
&
QAction
::
triggered
,
[
this
](
bool
checked
)
{
KdenliveSettings
::
setAlwaysShowMonitorAudio
(
checked
);
m_glMonitor
->
rootObject
()
->
setProperty
(
"permanentAudiothumb"
,
checked
);
});
alwaysShowAudio
->
setChecked
(
KdenliveSettings
::
alwaysShowMonitorAudio
());
m_contextMenu
->
addAction
(
alwaysShowAudio
);
m_configMenu
->
addAction
(
alwaysShowAudio
);
}
if
(
overlayMenu
)
{
...
...
src/monitor/monitorproxy.cpp
View file @
ce8af425
...
...
@@ -55,6 +55,11 @@ int MonitorProxy::rulerHeight() const
return
q
->
m_rulerHeight
;
}
void
MonitorProxy
::
setRulerHeight
(
int
addedHeight
)
{
q
->
updateRulerHeight
(
addedHeight
);
}
void
MonitorProxy
::
seek
(
int
delta
,
uint
modifiers
)
{
q
->
mouseSeek
(
delta
,
modifiers
);
...
...
@@ -313,24 +318,24 @@ QString MonitorProxy::toTimecode(int frames) const
void
MonitorProxy
::
setClipProperties
(
int
clipId
,
ClipType
::
ProducerType
type
,
bool
hasAV
,
const
QString
clipName
)
{
if
(
clipId
!=
m_clipId
)
{
m_clipId
=
clipId
;
emit
clipIdChanged
();
}
if
(
hasAV
!=
m_hasAV
)
{
m_hasAV
=
hasAV
;
emit
clipHasAVChanged
();
}
if
(
type
!=
m_clipType
)
{
m_clipType
=
type
;
emit
clipTypeChanged
();
}
if
(
clipName
==
m_clipName
)
{
m_clipName
.
clear
();
emit
clipNameChanged
();
}
m_clipName
=
clipName
;
emit
clipNameChanged
();
if
(
type
!=
m_clipType
)
{
m_clipType
=
type
;
emit
clipTypeChanged
();
}
if
(
clipId
!=
m_clipId
)
{
m_clipId
=
clipId
;
emit
clipIdChanged
();
}
}
void
MonitorProxy
::
setAudioThumb
(
const
QList
<
QUrl
>
thumbPath
)
...
...
src/monitor/monitorproxy.h
View file @
ce8af425
...
...
@@ -42,7 +42,7 @@ class MonitorProxy : public QObject
Q_PROPERTY
(
int
seekFinished
MEMBER
m_seekFinished
NOTIFY
seekFinishedChanged
)
Q_PROPERTY
(
int
zoneIn
READ
zoneIn
WRITE
setZoneIn
NOTIFY
zoneChanged
)
Q_PROPERTY
(
int
zoneOut
READ
zoneOut
WRITE
setZoneOut
NOTIFY
zoneChanged
)
Q_PROPERTY
(
int
rulerHeight
READ
rulerHeight
NOTIFY
rulerHeightChanged
)
Q_PROPERTY
(
int
rulerHeight
READ
rulerHeight
WRITE
setRulerHeight
NOTIFY
rulerHeightChanged
)
Q_PROPERTY
(
QString
markerComment
READ
markerComment
NOTIFY
markerCommentChanged
)
Q_PROPERTY
(
QList
<
QUrl
>
audioThumb
MEMBER
m_audioThumb
NOTIFY
audioThumbChanged
)
Q_PROPERTY
(
int
overlayType
READ
overlayType
WRITE
setOverlayType
NOTIFY
overlayTypeChanged
)
...
...
@@ -94,6 +94,7 @@ public:
void
setClipProperties
(
int
clipId
,
ClipType
::
ProducerType
type
,
bool
hasAV
,
const
QString
clipName
);
void
setAudioThumb
(
const
QList
<
QUrl
>
thumbPath
=
QList
<
QUrl
>
());
void
setAudioStream
(
const
QString
&
name
);
void
setRulerHeight
(
int
height
);
signals:
void
positionChanged
(
int
);
...
...
src/monitor/qmlmanager.cpp
View file @
ce8af425
...
...
@@ -20,6 +20,7 @@
***************************************************************************/
#include "qmlmanager.h"
#include "kdenlivesettings.h"
#include <QFontDatabase>
#include <QQmlContext>
...
...
@@ -113,13 +114,16 @@ void QmlManager::setScene(Kdenlive::MonitorId id, MonitorSceneType type, QSize p
m_view
->
setSource
(
QUrl
(
QStringLiteral
(
"qrc:/qml/kdenlivemonitorripple.qml"
)));
root
=
m_view
->
rootObject
();
break
;
default:
m_view
->
setSource
(
default:
m_view
->
setSource
(
QUrl
(
id
==
Kdenlive
::
ClipMonitor
||
id
==
Kdenlive
::
DvdMonitor
?
QStringLiteral
(
"qrc:/qml/kdenliveclipmonitor.qml"
)
:
QStringLiteral
(
"qrc:/qml/kdenlivemonitor.qml"
)));
root
=
m_view
->
rootObject
();
root
->
setProperty
(
"profile"
,
QPoint
(
profile
.
width
(),
profile
.
height
()));
root
->
setProperty
(
"scalex"
,
scalex
);
root
->
setProperty
(
"scaley"
,
scaley
);
if
(
id
==
Kdenlive
::
ClipMonitor
)
{
// Apply the always show audio setting
root
->
setProperty
(
"permanentAudiothumb"
,
KdenliveSettings
::
alwaysShowMonitorAudio
());
}
break
;
}
if
(
root
&&
duration
>
0
)
{
...
...
src/monitor/view/kdenliveclipmonitor.qml
View file @
ce8af425
...
...
@@ -32,7 +32,10 @@ Item {
property
bool
showTimecode
:
false
property
bool
showFps
:
false
property
bool
showSafezone
:
false
// Display hover audio thumbnails overlay
property
bool
showAudiothumb
:
false
// Always display audio thumbs under video
property
bool
permanentAudiothumb
:
false
property
bool
showToolbar
:
false
property
string
clipName
:
controller
.
clipName
property
real
baseUnit
:
fontMetrics
.
font
.
pixelSize
...
...
@@ -83,6 +86,20 @@ Item {
// Animate clip name
clipNameLabel
.
opacity
=
1
showAnimate
.
restart
()
// adjust monitor image size if audio thumb is displayed
if
(
audioThumb
.
stateVisible
&&
root
.
permanentAudiothumb
&&
audioThumb
.
visible
)
{
controller
.
rulerHeight
=
audioThumb
.
height
+
root
.
zoomOffset
}
else
{
controller
.
rulerHeight
=
root
.
zoomOffset
}
}
onZoomOffsetChanged
:
{
if
(
audioThumb
.
stateVisible
&&
root
.
permanentAudiothumb
&&
audioThumb
.
visible
)
{
controller
.
rulerHeight
=
audioThumb
.
height
+
root
.
zoomOffset
}
else
{
controller
.
rulerHeight
=
root
.
zoomOffset
}
}
function
updatePalette
()
{
...
...
@@ -133,6 +150,7 @@ Item {
width
:
root
.
profile
.
x
*
root
.
scalex
height
:
root
.
profile
.
y
*
root
.
scaley
anchors.centerIn
:
parent
anchors.verticalCenterOffset
:
(
root
.
permanentAudiothumb
&&
audioThumb
.
visible
)
?
-
(
audioThumb
.
height
+
root
.
zoomOffset
)
/
2
:
-
root
.
zoomOffset
/
2
Loader
{
anchors.fill
:
parent
...
...
@@ -161,7 +179,7 @@ Item {
Item
{
id
:
audioThumb
property
bool
stateVisible
:
(
clipMonitorRuler
.
containsMouse
||
thumbMouseArea
.
containsMouse
||
dragZone
.
opacity
==
1
||
thumbTimer
.
running
||
root
.
showZoomBar
)
property
bool
stateVisible
:
(
root
.
permanentAudiothumb
||
clipMonitorRuler
.
containsMouse
||
thumbMouseArea
.
containsMouse
||
dragZone
.
opacity
==
1
||
thumbTimer
.
running
||
root
.
showZoomBar
)
property
bool
isAudioClip
:
controller
.
clipType
==
ProducerType
.
Audio
anchors
{
left
:
parent
.
left
...
...
@@ -186,7 +204,15 @@ Item {
height
:
isAudioClip
?
parent
.
height
:
parent
.
height
/
6
//font.pixelSize * 3
width
:
parent
.
width
visible
:
root
.
showAudiothumb
&&
(
isAudioClip
||
controller
.
clipType
==
ProducerType
.
AV
)
visible
:
(
root
.
permanentAudiothumb
||
root
.
showAudiothumb
)
&&
(
isAudioClip
||
controller
.
clipType
==
ProducerType
.
AV
)
onStateVisibleChanged
:
{
// adjust monitor image size
if
(
stateVisible
&&
root
.
permanentAudiothumb
&&
audioThumb
.
visible
)
{
controller
.
rulerHeight
=
audioThumb
.
height
+
root
.
zoomOffset
}
else
{
controller
.
rulerHeight
=
root
.
zoomOffset
}
}
states
:
[
State
{
when
:
audioThumb
.
stateVisible
||
audioThumb
.
isAudioClip
;
...
...
@@ -199,7 +225,7 @@ Item {
}
]
Rectangle
{
color
:
activePalette
.
base
opacity
:
audioThumb
.
isAudioClip
?
1
:
0.6
opacity
:
audioThumb
.
isAudioClip
||
root
.
permanentAudiothumb
?
1
:
0.6
anchors.fill
:
parent
}
Rectangle
{
...
...
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