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
108366cb
Commit
108366cb
authored
Jan 29, 2020
by
Jean-Baptiste Mardelle
Browse files
Re-use better dialog for timeline change clip speed (with slider)
parent
b20a1bd8
Pipeline
#14117
passed with stage
in 14 minutes and 28 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/dialogs/speeddialog.cpp
View file @
108366cb
#include
"speeddialog.h"
#include
"ui_speed
dialog
_ui.h"
#include
"ui_
clip
speed_ui.h"
#include
<QPushButton>
SpeedDialog
::
SpeedDialog
(
QWidget
*
parent
,
double
speed
,
double
minSpeed
,
double
maxSpeed
,
bool
reversed
)
:
QDialog
(
parent
)
,
ui
(
new
Ui
::
Speed
Dialog
)
,
ui
(
new
Ui
::
Clip
Speed
_UI
)
{
ui
->
setupUi
(
this
);
setWindowTitle
(
i18n
(
"Clip Speed"
));
ui
->
doubleSpinBox
->
setDecimals
(
2
);
ui
->
doubleSpinBox
->
setMinimum
(
minSpeed
);
ui
->
doubleSpinBox
->
setMaximum
(
maxSpeed
);
ui
->
doubleSpinBox
->
setValue
(
speed
);
ui
->
doubleSpinBox
->
selectAll
();
ui
->
speedSpin
->
setDecimals
(
2
);
ui
->
speedSpin
->
setMinimum
(
minSpeed
);
ui
->
speedSpin
->
setMaximum
(
maxSpeed
);
ui
->
speedSlider
->
setMinimum
(
100
*
minSpeed
);
ui
->
speedSlider
->
setMaximum
(
qMin
(
100
*
minSpeed
+
100000
,
100
*
maxSpeed
));
ui
->
speedSpin
->
setValue
(
speed
);
ui
->
speedSlider
->
setValue
(
100
*
speed
);
ui
->
speedSlider
->
setTickInterval
((
ui
->
speedSlider
->
maximum
()
-
ui
->
speedSlider
->
minimum
())
/
10
);
ui
->
speedSpin
->
selectAll
();
ui
->
label_dest
->
setVisible
(
false
);
ui
->
kurlrequester
->
setVisible
(
false
);
ui
->
toolButton
->
setVisible
(
false
);
if
(
reversed
)
{
ui
->
checkBox
->
setChecked
(
true
);
}
connect
(
ui
->
doubleSpinBox
,
static_cast
<
void
(
QDoubleSpinBox
::*
)(
double
)
>
(
&
QDoubleSpinBox
::
valueChanged
),
[
&
]
(
double
value
)
{
connect
(
ui
->
speedSpin
,
static_cast
<
void
(
QDoubleSpinBox
::*
)(
double
)
>
(
&
QDoubleSpinBox
::
valueChanged
),
[
&
]
(
double
value
)
{
ui
->
speedSlider
->
setValue
(
100
*
value
);
ui
->
buttonBox
->
button
((
QDialogButtonBox
::
Ok
))
->
setEnabled
(
!
qFuzzyIsNull
(
value
));
});
connect
(
ui
->
speedSlider
,
&
QSlider
::
valueChanged
,
[
&
]
(
int
value
)
{
ui
->
speedSpin
->
setValue
(
value
/
100.
);
ui
->
buttonBox
->
button
((
QDialogButtonBox
::
Ok
))
->
setEnabled
(
value
!=
0
);
});
}
SpeedDialog
::~
SpeedDialog
()
...
...
@@ -28,7 +40,7 @@ SpeedDialog::~SpeedDialog()
double
SpeedDialog
::
getValue
()
const
{
double
val
=
ui
->
double
Spin
Box
->
value
();
double
val
=
ui
->
speed
Spin
->
value
();
if
(
ui
->
checkBox
->
checkState
()
==
Qt
::
Checked
)
{
val
*=
-
1
;
}
...
...
src/timeline2/view/dialogs/speeddialog.h
View file @
108366cb
...
...
@@ -4,7 +4,7 @@
#include
<QDialog>
namespace
Ui
{
class
Speed
Dialog
;
class
Clip
Speed
_UI
;
}
class
SpeedDialog
:
public
QDialog
...
...
@@ -18,7 +18,7 @@ public:
double
getValue
()
const
;
private:
Ui
::
Speed
Dialog
*
ui
;
Ui
::
Clip
Speed
_UI
*
ui
;
};
#endif // SPEEDDIALOG_H
src/ui/clipspeed_ui.ui
View file @
108366cb
...
...
@@ -6,48 +6,14 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
498
</width>
<height>
1
58
</height>
<width>
389
</width>
<height>
1
32
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"2"
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=
"horizontalLayout_2"
>
<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>
...
...
@@ -72,10 +38,7 @@
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"tickPosition"
>
<enum>
QSlider::TicksBelow
</enum>
</property>
<property
name=
"tickInterval"
>
<number>
50
</number>
<enum>
QSlider::TicksAbove
</enum>
</property>
</widget>
</item>
...
...
@@ -107,7 +70,7 @@
</item>
</layout>
</item>
<item
row=
"
3
"
column=
"2"
>
<item
row=
"
4
"
column=
"2"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -117,13 +80,55 @@
</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"
>
<widget
class=
"QCheckBox"
name=
"checkBox"
>
<property
name=
"text"
>
<string>
Reverse clip
</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
KUrlRequester
</class>
<extends>
Q
Widget
</extends>
<extends>
Q
Frame
</extends>
<header>
kurlrequester.h
</header>
<container>
1
</container>
</customwidget>
</customwidgets>
<resources/>
...
...
src/ui/speeddialog_ui.ui
deleted
100644 → 0
View file @
b20a1bd8
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
SpeedDialog
</class>
<widget
class=
"QDialog"
name=
"SpeedDialog"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
186
</width>
<height>
132
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Speed
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox"
/>
</item>
</layout>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"checkBox"
>
<property
name=
"text"
>
<string>
Reverse clip
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
>
<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=
"2"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>
buttonBox
</sender>
<signal>
accepted()
</signal>
<receiver>
SpeedDialog
</receiver>
<slot>
accept()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
248
</x>
<y>
254
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
157
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
buttonBox
</sender>
<signal>
rejected()
</signal>
<receiver>
SpeedDialog
</receiver>
<slot>
reject()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
316
</x>
<y>
260
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
286
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
</connections>
</ui>
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