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
d8ca8514
Commit
d8ca8514
authored
Jul 15, 2020
by
Jean-Baptiste Mardelle
Browse files
Configurable colors for audio thumbnails
parent
f92f4b14
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/bin/abstractprojectitem.cpp
View file @
d8ca8514
...
...
@@ -102,7 +102,7 @@ const QString &AbstractProjectItem::clipId() const
QPixmap
AbstractProjectItem
::
roundedPixmap
(
const
QPixmap
&
source
)
{
QPixmap
pix
(
source
.
size
());
pix
.
fill
(
Q
t
::
transparent
);
pix
.
fill
(
Q
Color
(
0
,
0
,
0
,
100
)
);
QPainter
p
(
&
pix
);
p
.
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
QPainterPath
path
;
...
...
src/dialogs/kdenlivesettingsdialog.cpp
View file @
d8ca8514
...
...
@@ -23,6 +23,9 @@
#include "dialogs/profilesdialog.h"
#include "encodingprofilesdialog.h"
#include "kdenlivesettings.h"
#include "mainwindow.h"
#include "timeline2/view/timelinewidget.h"
#include "timeline2/view/timelinecontroller.h"
#include "profiles/profilemodel.hpp"
#include "profiles/profilerepository.hpp"
#include "profilesdialog.h"
...
...
@@ -143,6 +146,11 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
m_page2
=
addPage
(
p2
,
i18n
(
"Environment"
));
m_page2
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"application-x-executable-script"
)));
QWidget
*
p10
=
new
QWidget
;
m_configColors
.
setupUi
(
p10
);
m_page10
=
addPage
(
p10
,
i18n
(
"Colors"
));
m_page10
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"color-management"
)));
QWidget
*
p4
=
new
QWidget
;
m_configCapture
.
setupUi
(
p4
);
// Remove ffmpeg tab, unused
...
...
@@ -218,7 +226,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
m_configShuttle
.
kcfg_enableshuttle
->
setDisabled
(
true
);
#endif
/* USE_JOGSHUTTLE */
m_page5
=
addPage
(
p5
,
i18n
(
"JogShuttle"
));
m_page5
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"
jog-
dial"
)));
m_page5
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"dial
og-input-devices
"
)));
QWidget
*
p6
=
new
QWidget
;
m_configSdl
.
setupUi
(
p6
);
...
...
@@ -992,6 +1000,12 @@ void KdenliveSettingsDialog::updateSettings()
KdenliveSettings
::
setWindow_background
(
m_configSdl
.
kcfg_window_background
->
color
());
emit
updateMonitorBg
();
}
if
(
m_configColors
.
kcfg_thumbColor1
->
color
()
!=
KdenliveSettings
::
thumbColor1
()
||
m_configColors
.
kcfg_thumbColor2
->
color
()
!=
KdenliveSettings
::
thumbColor2
())
{
KdenliveSettings
::
setThumbColor1
(
m_configColors
.
kcfg_thumbColor1
->
color
());
KdenliveSettings
::
setThumbColor2
(
m_configColors
.
kcfg_thumbColor2
->
color
());
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
colorsChanged
();
}
if
(
m_configSdl
.
kcfg_volume
->
value
()
!=
KdenliveSettings
::
volume
())
{
KdenliveSettings
::
setVolume
(
m_configSdl
.
kcfg_volume
->
value
());
...
...
src/dialogs/kdenlivesettingsdialog.h
View file @
d8ca8514
...
...
@@ -33,6 +33,7 @@
#include "ui_configsdl_ui.h"
#include "ui_configtimeline_ui.h"
#include "ui_configtranscode_ui.h"
#include "ui_configcolors_ui.h"
class
ProfileWidget
;
...
...
@@ -97,8 +98,10 @@ private:
KPageWidgetItem
*
m_page6
;
KPageWidgetItem
*
m_page7
;
KPageWidgetItem
*
m_page8
;
KPageWidgetItem
*
m_page10
;
Ui
::
ConfigEnv_UI
m_configEnv
;
Ui
::
ConfigMisc_UI
m_configMisc
;
Ui
::
ConfigColors_UI
m_configColors
;
Ui
::
ConfigTimeline_UI
m_configTimeline
;
Ui
::
ConfigCapture_UI
m_configCapture
;
Ui
::
ConfigJogShuttle_UI
m_configShuttle
;
...
...
src/jobs/audiothumbjob.cpp
View file @
d8ca8514
...
...
@@ -128,10 +128,10 @@ bool AudioThumbJob::computeWithFFMPEG()
QStringList
args
;
args
<<
QStringLiteral
(
"-hide_banner"
)
<<
QStringLiteral
(
"-y"
)
<<
QStringLiteral
(
"-i"
)
<<
QUrl
::
fromLocalFile
(
filePath
).
toLocalFile
()
<<
QString
(
"-filter_complex"
);
if
(
m_audioStream
>=
0
)
{
args
<<
QString
(
"[a:%1]showwavespic=s=%2x%3:split_channels=1:scale=cbrt:colors=
0xffdddd|0xddffdd
"
).
arg
(
audioStreamIndex
).
arg
(
m_thumbSize
.
width
()).
arg
(
m_thumbSize
.
height
());
args
<<
QString
(
"[a:%1]showwavespic=s=%2x%3:split_channels=1:scale=cbrt:colors=
%4|%5
"
).
arg
(
audioStreamIndex
).
arg
(
m_thumbSize
.
width
()).
arg
(
m_thumbSize
.
height
())
.
arg
(
KdenliveSettings
::
thumbColor1
().
name
()).
arg
(
KdenliveSettings
::
thumbColor2
().
name
())
;
}
else
{
// Only 1 audio stream in clip
args
<<
QString
(
"[a]showwavespic=s=%2x%3:split_channels=1:scale=cbrt:colors=
0xffdddd|0xddffdd
"
).
arg
(
m_thumbSize
.
width
()).
arg
(
m_thumbSize
.
height
());
args
<<
QString
(
"[a]showwavespic=s=%2x%3:split_channels=1:scale=cbrt:colors=
%4|%5
"
).
arg
(
m_thumbSize
.
width
()).
arg
(
m_thumbSize
.
height
())
.
arg
(
KdenliveSettings
::
thumbColor1
().
name
()).
arg
(
KdenliveSettings
::
thumbColor2
().
name
())
;
}
args
<<
QStringLiteral
(
"-frames:v"
)
<<
QStringLiteral
(
"1"
);
args
<<
thumbPath
;
...
...
src/kdenlivesettings.kcfg
View file @
d8ca8514
...
...
@@ -880,6 +880,17 @@
<label>
Color to preselect in the color clip dialog.
</label>
<default>
#000000
</default>
</entry>
<entry
name=
"thumbColor1"
type=
"Color"
>
<label>
Color to draw even audio channels.
</label>
<default>
#2ac1a0
</default>
</entry>
<entry
name=
"thumbColor2"
type=
"Color"
>
<label>
Color to draw odd audio channels.
</label>
<default>
#2ed172
</default>
</entry>
<entry
name=
"rescalekeepratio"
type=
"Bool"
>
<label>
Keep aspect ratio in render dialog rescale widget.
</label>
...
...
src/monitor/monitormanager.cpp
View file @
d8ca8514
...
...
@@ -647,8 +647,10 @@ void MonitorManager::updateBgColor()
{
if
(
m_projectMonitor
)
{
m_projectMonitor
->
updateBgColor
();
m_projectMonitor
->
forceMonitorRefresh
();
}
if
(
m_clipMonitor
)
{
m_clipMonitor
->
updateBgColor
();
m_clipMonitor
->
forceMonitorRefresh
();
}
}
src/monitor/view/kdenliveclipmonitor.qml
View file @
d8ca8514
...
...
@@ -239,7 +239,7 @@ Item {
NumberAnimation
{
property
:
"
opacity
"
;
duration
:
audioThumb
.
isAudioClip
?
0
:
500
}
}
]
Rectangle
{
color
:
activePalette
.
dark
color
:
"
black
"
opacity
:
audioThumb
.
isAudioClip
||
root
.
permanentAudiothumb
?
1
:
0.6
anchors.fill
:
parent
}
...
...
src/timeline2/view/qml/ClipAudioThumbs.qml
View file @
d8ca8514
...
...
@@ -53,7 +53,8 @@ Row {
drawOutPoint
:
(
clipRoot
.
scrollStart
+
scrollView
.
width
-
(
index
*
waveform
.
maxWidth
))
waveInPoint
:
clipRoot
.
speed
<
0
?
(
Math
.
round
(
clipRoot
.
outPoint
-
(
index
*
waveform
.
maxWidth
/
clipRoot
.
timeScale
)
*
Math
.
abs
(
clipRoot
.
speed
))
*
channels
)
:
(
Math
.
round
((
clipRoot
.
inPoint
+
(
index
*
waveform
.
maxWidth
/
clipRoot
.
timeScale
))
*
clipRoot
.
speed
)
*
channels
)
waveOutPoint
:
clipRoot
.
speed
<
0
?
(
waveInPoint
-
Math
.
ceil
(
width
/
clipRoot
.
timeScale
*
Math
.
abs
(
clipRoot
.
speed
))
*
channels
)
:
(
waveInPoint
+
Math
.
round
(
width
/
clipRoot
.
timeScale
*
clipRoot
.
speed
)
*
channels
)
fillColor
:
activePalette
.
text
fillColor1
:
root
.
thumbColor1
fillColor2
:
root
.
thumbColor2
}
}
}
src/timeline2/view/qml/timeline.qml
View file @
d8ca8514
...
...
@@ -276,6 +276,8 @@ Rectangle {
property
color
lockedColor
:
timeline
.
lockedColor
property
color
selectionColor
:
timeline
.
selectionColor
property
color
groupColor
:
timeline
.
groupColor
property
color
thumbColor1
:
timeline
.
thumbColor1
property
color
thumbColor2
:
timeline
.
thumbColor2
property
int
mainItemId
:
-
1
property
int
mainFrame
:
0
property
int
clipBeingDroppedId
:
-
1
...
...
src/timeline2/view/qml/timelineitems.cpp
View file @
d8ca8514
...
...
@@ -78,7 +78,8 @@ private:
class
TimelineWaveform
:
public
QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY
(
QColor
fillColor
MEMBER
m_color
NOTIFY
propertyChanged
)
Q_PROPERTY
(
QColor
fillColor1
MEMBER
m_color
NOTIFY
propertyChanged
)
Q_PROPERTY
(
QColor
fillColor2
MEMBER
m_color2
NOTIFY
propertyChanged
)
Q_PROPERTY
(
int
waveInPoint
MEMBER
m_inPoint
NOTIFY
propertyChanged
)
Q_PROPERTY
(
int
drawInPoint
MEMBER
m_drawInPoint
NOTIFY
propertyChanged
)
Q_PROPERTY
(
int
drawOutPoint
MEMBER
m_drawOutPoint
NOTIFY
propertyChanged
)
...
...
@@ -154,12 +155,12 @@ public:
pen
.
setWidthF
(
0
);
}
painter
->
setPen
(
pen
);
QPainterPath
path
;
if
(
!
KdenliveSettings
::
displayallchannels
())
{
// Draw merged channels
double
i
=
0
;
double
level
;
int
j
=
0
;
QPainterPath
path
;
if
(
m_drawInPoint
>
0
)
{
j
=
m_drawInPoint
/
increment
;
}
...
...
@@ -199,14 +200,17 @@ public:
for
(
int
channel
=
0
;
channel
<
m_channels
;
channel
++
)
{
// y is channel median pos
double
y
=
(
channel
*
channelHeight
)
+
channelHeight
/
2
;
QPainterPath
path
;
path
.
moveTo
(
-
1
,
y
);
painter
->
setOpacity
(
0.2
);
if
(
channel
%
2
==
0
)
{
// Add dark background on odd channels
painter
->
setOpacity
(
0.2
);
bgRect
.
moveTo
(
0
,
channel
*
channelHeight
);
painter
->
fillRect
(
bgRect
,
Qt
::
black
);
}
// Draw channel median line
pen
.
setColor
(
channel
%
2
==
0
?
m_color
:
m_color2
);
painter
->
setBrush
(
channel
%
2
==
0
?
m_color
:
m_color2
);
painter
->
setOpacity
(
0.5
);
pen
.
setWidthF
(
0
);
painter
->
setPen
(
pen
);
...
...
@@ -266,6 +270,7 @@ private:
int
m_drawOutPoint
;
QString
m_binId
;
QColor
m_color
;
QColor
m_color2
;
bool
m_format
;
bool
m_showItem
;
int
m_channels
;
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
d8ca8514
...
...
@@ -3316,7 +3316,7 @@ QColor TimelineController::targetTextColor() const
QColor
TimelineController
::
audioColor
()
const
{
KColorScheme
scheme
(
QApplication
::
palette
().
currentColorGroup
());
return
scheme
.
foreground
(
KColorScheme
::
PositiveText
).
color
();
return
scheme
.
foreground
(
KColorScheme
::
PositiveText
).
color
()
.
darker
(
200
)
;
}
QColor
TimelineController
::
titleColor
()
const
...
...
@@ -3334,6 +3334,16 @@ QColor TimelineController::imageColor() const
return
scheme
.
foreground
(
KColorScheme
::
NeutralText
).
color
();
}
QColor
TimelineController
::
thumbColor1
()
const
{
return
KdenliveSettings
::
thumbColor1
();
}
QColor
TimelineController
::
thumbColor2
()
const
{
return
KdenliveSettings
::
thumbColor2
();
}
QColor
TimelineController
::
slideshowColor
()
const
{
KColorScheme
scheme
(
QApplication
::
palette
().
currentColorGroup
());
...
...
src/timeline2/view/timelinecontroller.h
View file @
d8ca8514
...
...
@@ -75,6 +75,8 @@ class TimelineController : public QObject
Q_PROPERTY
(
QColor
audioColor
READ
audioColor
NOTIFY
colorsChanged
)
Q_PROPERTY
(
QColor
titleColor
READ
titleColor
NOTIFY
colorsChanged
)
Q_PROPERTY
(
QColor
imageColor
READ
imageColor
NOTIFY
colorsChanged
)
Q_PROPERTY
(
QColor
thumbColor1
READ
thumbColor1
NOTIFY
colorsChanged
)
Q_PROPERTY
(
QColor
thumbColor2
READ
thumbColor2
NOTIFY
colorsChanged
)
Q_PROPERTY
(
QColor
slideshowColor
READ
slideshowColor
NOTIFY
colorsChanged
)
Q_PROPERTY
(
QColor
targetColor
READ
targetColor
NOTIFY
colorsChanged
)
Q_PROPERTY
(
QColor
targetTextColor
READ
targetTextColor
NOTIFY
colorsChanged
)
...
...
@@ -164,6 +166,8 @@ public:
Q_INVOKABLE
QColor
audioColor
()
const
;
Q_INVOKABLE
QColor
titleColor
()
const
;
Q_INVOKABLE
QColor
imageColor
()
const
;
Q_INVOKABLE
QColor
thumbColor1
()
const
;
Q_INVOKABLE
QColor
thumbColor2
()
const
;
Q_INVOKABLE
QColor
slideshowColor
()
const
;
Q_INVOKABLE
QColor
targetColor
()
const
;
Q_INVOKABLE
QColor
targetTextColor
()
const
;
...
...
src/ui/configcolors_ui.ui
0 → 100644
View file @
d8ca8514
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
ConfigColors_UI
</class>
<widget
class=
"QWidget"
name=
"ConfigColors_UI"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
Audio thumbnail colors
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"KColorButton"
name=
"kcfg_thumbColor1"
/>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"KColorButton"
name=
"kcfg_thumbColor2"
/>
</item>
<item
row=
"0"
column=
"3"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
36
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"1"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
248
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
KColorButton
</class>
<extends>
QPushButton
</extends>
<header>
kcolorbutton.h
</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
src/ui/configtimeline_ui.ui
View file @
d8ca8514
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
5
31
</width>
<height>
50
5
</height>
<width>
5
75
</width>
<height>
5
7
0
</height>
</rect>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
...
...
@@ -118,6 +118,19 @@
<string>
Thumbnails
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_3"
>
<item
row=
"0"
column=
"3"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"kcfg_videothumbnails"
>
<property
name=
"text"
>
...
...
@@ -142,19 +155,6 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"3"
>
<spacer
name=
"horizontalSpacer"
>
<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>
</widget>
</item>
...
...
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