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
f886cfde
Commit
f886cfde
authored
Mar 31, 2020
by
Jean-Baptiste Mardelle
Browse files
Change monitor scaling action to normal combobox
parent
f8a690a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/monitor/monitor.cpp
View file @
f886cfde
...
...
@@ -206,57 +206,58 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
int
size
=
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
);
QSize
iconSize
(
size
,
size
);
m_toolbar
->
setIconSize
(
iconSize
);
m_scalingLabel
=
new
QLabel
(
this
);
m_scalingLabel
->
setToolTip
(
i18n
(
"Preview resolution - lower resolution means faster preview"
)
);
m_
scaling
Label
->
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
));
QFontMetricsF
fm
(
m_scalingLabel
->
font
());
int
labelWidth
=
(
int
)
fm
.
boundingRect
(
QRect
(
0
,
0
,
fm
.
averageCharWidth
()
*
10
,
fm
.
lineSpacing
()
*
2
),
Qt
::
AlignCenter
,
QStringLiteral
(
"000p"
)).
width
(
);
QMargins
labelMrg
=
m_scalingLabel
->
contentsMargins
();
m_scalingLabel
->
setFixedWidth
(
labelWidth
+
labelMrg
.
left
()
+
labelMrg
.
right
());
m_scalingLabel
->
setAlignment
(
Qt
::
AlignCenter
);
connect
(
m_scalingLabel
,
&
QLabel
::
linkActivated
,
[
&
]()
{
switch
(
KdenliveSettings
::
previewScaling
())
{
QComboBox
*
scalingAction
=
new
QComboBox
(
this
);
scaling
Action
->
setToolTip
(
i18n
(
"Preview resolution - lower resolution means faster preview"
));
// Combobox padding is bad, so manually add a space before text
scalingAction
->
addItems
({
QStringLiteral
(
" "
)
+
i18n
(
"1:1"
),
QStringLiteral
(
" "
)
+
i18n
(
"720p"
),
QStringLiteral
(
" "
)
+
i18n
(
"540p"
),
QStringLiteral
(
" "
)
+
i18n
(
"360p"
),
QStringLiteral
(
" "
)
+
i18n
(
"270p"
)}
);
connect
(
scalingAction
,
QOverload
<
int
>::
of
(
&
QComboBox
::
activated
),
[
this
]
(
int
index
)
{
switch
(
index
)
{
case
1
:
KdenliveSettings
::
setPreviewScaling
(
2
);
break
;
case
2
:
KdenliveSettings
::
setPreviewScaling
(
4
);
break
;
case
4
:
case
3
:
KdenliveSettings
::
setPreviewScaling
(
8
);
break
;
case
8
:
case
4
:
KdenliveSettings
::
setPreviewScaling
(
16
);
break
;
case
16
:
KdenliveSettings
::
setPreviewScaling
(
0
);
break
;
default:
KdenliveSettings
::
setPreviewScaling
(
2
);
KdenliveSettings
::
setPreviewScaling
(
0
);
}
m_monitorManager
->
scalingChanged
();
m_monitorManager
->
updatePreviewScaling
();
});
connect
(
manager
,
&
MonitorManager
::
updatePreviewScaling
,
[
this
]()
{
connect
(
manager
,
&
MonitorManager
::
updatePreviewScaling
,
[
this
,
scalingAction
]()
{
m_glMonitor
->
updateScaling
();
switch
(
KdenliveSettings
::
previewScaling
())
{
case
2
:
m_
scaling
Label
->
setText
(
QString
(
"<a href=
\"
#
\"
>%1</a>"
).
arg
(
i18n
(
"720p"
))
);
scaling
Action
->
setCurrentIndex
(
1
);
break
;
case
4
:
m_
scaling
Label
->
setText
(
QString
(
"<a href=
\"
#
\"
>%1</a>"
).
arg
(
i18n
(
"540p"
))
);
scaling
Action
->
setCurrentIndex
(
2
);
break
;
case
8
:
m_
scaling
Label
->
setText
(
QString
(
"<a href=
\"
#
\"
>%1</a>"
).
arg
(
i18n
(
"360p"
))
);
scaling
Action
->
setCurrentIndex
(
3
);
break
;
case
16
:
m_
scaling
Label
->
setText
(
QString
(
"<a href=
\"
#
\"
>%1</a>"
).
arg
(
i18n
(
"270p"
))
);
scaling
Action
->
setCurrentIndex
(
4
);
break
;
default:
m_
scaling
Label
->
setText
(
QString
(
"<a href=
\"
#
\"
>%1</a>"
).
arg
(
i18n
(
"1:1"
))
);
scaling
Action
->
setCurrentIndex
(
0
);
break
;
}
refreshMonitorIfActive
();
});
scalingAction
->
setFrame
(
false
);
scalingAction
->
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
));
m_toolbar
->
addWidget
(
scalingAction
);
m_toolbar
->
addSeparator
();
m_toolbar
->
addWidget
(
m_scalingLabel
);
m_speedLabel
=
new
QLabel
(
this
);
m_speedLabel
->
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
));
KColorScheme
scheme
(
palette
().
currentColorGroup
(),
KColorScheme
::
Button
);
...
...
src/monitor/monitor.h
View file @
f886cfde
...
...
@@ -221,7 +221,6 @@ private:
MonitorAudioLevel
*
m_audioMeterWidget
;
QTimer
m_droppedTimer
;
double
m_displayedFps
;
QLabel
*
m_scalingLabel
;
QLabel
*
m_speedLabel
;
int
m_speedIndex
;
...
...
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