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
1bfec556
Commit
1bfec556
authored
Feb 03, 2020
by
Jean-Baptiste Mardelle
Browse files
Add warning message when trying to set speed lower than allowed
parent
cc7e26b9
Pipeline
#14426
passed with stage
in 19 minutes and 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/dialogs/speeddialog.cpp
View file @
1bfec556
/***************************************************************************
* Copyright (C) 2020 by Jean-Baptiste Mardelle *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#include
"speeddialog.h"
#include
"ui_clipspeed_ui.h"
#include
<QPushButton>
#include
<QDebug>
#include
<KMessageWidget>
#include
<QtMath>
SpeedDialog
::
SpeedDialog
(
QWidget
*
parent
,
double
speed
,
double
minSpeed
,
double
maxSpeed
,
bool
reversed
)
...
...
@@ -25,14 +48,26 @@ SpeedDialog::SpeedDialog(QWidget *parent, double speed, double minSpeed, double
}
ui
->
speedSpin
->
setValue
(
speed
);
ui
->
speedSlider
->
setValue
(
qLn
(
speed
)
*
12
);
// Info widget
KMessageWidget
*
infoMessage
=
new
KMessageWidget
(
this
);
ui
->
infoLayout
->
addWidget
(
infoMessage
);
infoMessage
->
hide
();
connect
(
ui
->
speedSpin
,
static_cast
<
void
(
QDoubleSpinBox
::*
)(
double
)
>
(
&
QDoubleSpinBox
::
valueChanged
),
[
&
]
(
double
value
)
{
QSignalBlocker
bk
(
ui
->
speedSlider
);
ui
->
speedSlider
->
setValue
(
qLn
(
value
)
*
12
);
ui
->
buttonBox
->
button
((
QDialogButtonBox
::
Ok
))
->
setEnabled
(
!
qFuzzyIsNull
(
value
));
});
connect
(
ui
->
speedSlider
,
&
QSlider
::
valueChanged
,
[
&
]
(
int
value
)
{
connect
(
ui
->
speedSlider
,
&
QSlider
::
valueChanged
,
[
this
,
infoMessage
]
(
int
value
)
{
double
res
=
qExp
(
value
/
12.
);
QSignalBlocker
bk
(
ui
->
speedSpin
);
if
(
res
<
ui
->
speedSpin
->
minimum
()
||
res
>
ui
->
speedSpin
->
maximum
())
{
infoMessage
->
setText
(
res
<
ui
->
speedSpin
->
minimum
()
?
i18n
(
"Minimum speed is %1"
,
ui
->
speedSpin
->
minimum
())
:
i18n
(
"Maximum speed is %1"
,
ui
->
speedSpin
->
maximum
()));
infoMessage
->
setCloseButtonVisible
(
true
);
infoMessage
->
setMessageType
(
KMessageWidget
::
Warning
);
infoMessage
->
animatedShow
();
}
ui
->
speedSpin
->
setValue
(
res
);
ui
->
buttonBox
->
button
((
QDialogButtonBox
::
Ok
))
->
setEnabled
(
!
qFuzzyIsNull
(
ui
->
speedSpin
->
value
()));
});
...
...
src/timeline2/view/dialogs/speeddialog.h
View file @
1bfec556
/***************************************************************************
* Copyright (C) 2020 by Jean-Baptiste Mardelle *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef SPEEDDIALOG_H
#define SPEEDDIALOG_H
...
...
src/ui/clipspeed_ui.ui
View file @
1bfec556
...
...
@@ -6,14 +6,58 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
389
</width>
<height>
1
32
</height>
<width>
476
</width>
<height>
1
40
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"5"
column=
"2"
>
<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=
"3"
column=
"1"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
0
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"0"
column=
"0"
colspan=
"3"
>
<layout
class=
"QHBoxLayout"
name=
"destination_layout"
>
<item>
<widget
class=
"QLabel"
name=
"label_dest"
>
<property
name=
"text"
>
<string>
Destination
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"KUrlRequester"
name=
"kurlrequester"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"MinimumExpanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"1"
column=
"0"
colspan=
"3"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
...
...
@@ -70,57 +114,20 @@
</item>
</layout>
</item>
<item
row=
"4"
column=
"2"
>
<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=
"3"
column=
"1"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
0
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"0"
column=
"0"
colspan=
"3"
>
<layout
class=
"QHBoxLayout"
name=
"destination_layout"
>
<item>
<widget
class=
"QLabel"
name=
"label_dest"
>
<property
name=
"text"
>
<string>
Destination
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"KUrlRequester"
name=
"kurlrequester"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"MinimumExpanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"4"
column=
"1"
>
<item
row=
"5"
column=
"1"
>
<widget
class=
"QCheckBox"
name=
"checkBox"
>
<property
name=
"text"
>
<string>
Reverse clip
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"3"
>
<layout
class=
"QHBoxLayout"
name=
"infoLayout"
>
<property
name=
"topMargin"
>
<number>
0
</number>
</property>
</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