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
Plasma
KWin
Commits
5f7d23fd
Commit
5f7d23fd
authored
Sep 09, 2020
by
Vlad Zahorodnii
Browse files
effects/flipswitch: Port away from deprecated QTimeline curve shape prop
QTimeline::CurveShape has been deprecated in Qt 5.15.
parent
99dd5d94
Changes
2
Hide whitespace changes
Inline
Side-by-side
effects/flipswitch/flipswitch.cpp
View file @
5f7d23fd
...
...
@@ -28,7 +28,7 @@ namespace KWin
FlipSwitchEffect
::
FlipSwitchEffect
()
:
m_selectedWindow
(
nullptr
)
,
m_currentAnimation
Shape
(
QTimeLine
::
Ease
InOut
Curv
e
)
,
m_currentAnimation
EasingCurve
(
QEasingCurve
::
InOut
Sin
e
)
,
m_active
(
false
)
,
m_start
(
false
)
,
m_stop
(
false
)
...
...
@@ -307,11 +307,11 @@ void FlipSwitchEffect::postPaintScreen()
m_animation
=
true
;
m_timeLine
.
setCurrentTime
(
0
);
if
(
m_scheduledDirections
.
count
()
==
1
)
{
m_currentAnimation
Shape
=
QTimeLine
::
EaseOutCurv
e
;
m_timeLine
.
set
CurveShap
e
(
m_currentAnimation
Shap
e
);
m_currentAnimation
EasingCurve
=
QEasingCurve
::
OutSin
e
;
m_timeLine
.
set
EasingCurv
e
(
m_currentAnimation
EasingCurv
e
);
}
else
{
m_currentAnimation
Shape
=
QTimeLin
e
::
Linear
Curve
;
m_timeLine
.
set
CurveShap
e
(
m_currentAnimation
Shap
e
);
m_currentAnimation
EasingCurve
=
QEasingCurv
e
::
Linear
;
m_timeLine
.
set
EasingCurv
e
(
m_currentAnimation
EasingCurv
e
);
}
}
effects
->
addRepaintFull
();
...
...
@@ -334,13 +334,13 @@ void FlipSwitchEffect::postPaintScreen()
}
else
{
if
(
m_scheduledDirections
.
count
()
==
1
)
{
if
(
m_stop
)
m_currentAnimation
Shape
=
QTimeLin
e
::
Linear
Curve
;
m_currentAnimation
EasingCurve
=
QEasingCurv
e
::
Linear
;
else
m_currentAnimation
Shape
=
QTimeLine
::
EaseOutCurv
e
;
m_currentAnimation
EasingCurve
=
QEasingCurve
::
OutSin
e
;
}
else
{
m_currentAnimation
Shape
=
QTimeLin
e
::
Linear
Curve
;
m_currentAnimation
EasingCurve
=
QEasingCurv
e
::
Linear
;
}
m_timeLine
.
set
CurveShap
e
(
m_currentAnimation
Shap
e
);
m_timeLine
.
set
EasingCurv
e
(
m_currentAnimation
EasingCurv
e
);
}
}
if
(
m_start
||
m_stop
||
m_animation
)
...
...
@@ -515,7 +515,7 @@ void FlipSwitchEffect::setActive(bool activate, FlipSwitchMode mode)
effects
->
setActiveFullScreenEffect
(
this
);
m_active
=
true
;
m_start
=
true
;
m_startStopTimeLine
.
set
CurveShape
(
QTimeLine
::
Ease
InOut
Curv
e
);
m_startStopTimeLine
.
set
EasingCurve
(
QEasingCurve
::
InOut
Sin
e
);
m_activeScreen
=
effects
->
activeScreen
();
m_screenArea
=
effects
->
clientArea
(
ScreenArea
,
m_activeScreen
,
effects
->
currentDesktop
());
...
...
@@ -623,16 +623,16 @@ void FlipSwitchEffect::setActive(bool activate, FlipSwitchMode mode)
}
m_stop
=
true
;
if
(
m_animation
)
{
m_startStopTimeLine
.
set
CurveShape
(
QTimeLine
::
EaseOutCurv
e
);
m_startStopTimeLine
.
set
EasingCurve
(
QEasingCurve
::
OutSin
e
);
if
(
m_scheduledDirections
.
count
()
==
1
)
{
if
(
m_currentAnimation
Shape
==
QTimeLine
::
Ease
InOut
Curv
e
)
m_currentAnimation
Shape
=
QTimeLine
::
EaseInCurv
e
;
else
if
(
m_currentAnimation
Shape
==
QTimeLine
::
EaseOutCurv
e
)
m_currentAnimation
Shape
=
QTimeLin
e
::
Linear
Curve
;
m_timeLine
.
set
CurveShap
e
(
m_currentAnimation
Shap
e
);
if
(
m_currentAnimation
EasingCurve
==
QEasingCurve
::
InOut
Sin
e
)
m_currentAnimation
EasingCurve
=
QEasingCurve
::
InSin
e
;
else
if
(
m_currentAnimation
EasingCurve
==
QEasingCurve
::
OutSin
e
)
m_currentAnimation
EasingCurve
=
QEasingCurv
e
::
Linear
;
m_timeLine
.
set
EasingCurv
e
(
m_currentAnimation
EasingCurv
e
);
}
}
else
m_startStopTimeLine
.
set
CurveShape
(
QTimeLine
::
Ease
InOut
Curv
e
);
m_startStopTimeLine
.
set
EasingCurve
(
QEasingCurve
::
InOut
Sin
e
);
effects
->
stopMouseInterception
(
this
);
if
(
m_hasKeyboardGrab
)
{
effects
->
ungrabKeyboard
();
...
...
@@ -703,15 +703,15 @@ void FlipSwitchEffect::scheduleAnimation(const SwitchingDirection& direction, in
{
if
(
m_start
)
{
// start is still active so change the shape to have a nice transition
m_startStopTimeLine
.
set
CurveShape
(
QTimeLine
::
EaseInCurv
e
);
m_startStopTimeLine
.
set
EasingCurve
(
QEasingCurve
::
InSin
e
);
}
if
(
!
m_animation
&&
!
m_start
)
{
m_animation
=
true
;
m_scheduledDirections
.
enqueue
(
direction
);
distance
--
;
// reset shape just to make sure
m_currentAnimation
Shape
=
QTimeLine
::
Ease
InOut
Curv
e
;
m_timeLine
.
set
CurveShap
e
(
m_currentAnimation
Shap
e
);
m_currentAnimation
EasingCurve
=
QEasingCurve
::
InOut
Sin
e
;
m_timeLine
.
set
EasingCurv
e
(
m_currentAnimation
EasingCurv
e
);
}
for
(
int
i
=
0
;
i
<
distance
;
i
++
)
{
if
(
m_scheduledDirections
.
count
()
>
1
&&
m_scheduledDirections
.
last
()
!=
direction
)
...
...
@@ -725,20 +725,20 @@ void FlipSwitchEffect::scheduleAnimation(const SwitchingDirection& direction, in
}
}
if
(
m_scheduledDirections
.
count
()
>
1
)
{
Q
TimeLine
::
CurveShape
newShape
=
QTimeLine
::
EaseInOutC
urve
;
switch
(
m_currentAnimation
Shape
)
{
case
Q
TimeLine
::
Ease
InOut
Curv
e
:
newShape
=
QTimeLine
::
EaseInCurv
e
;
Q
EasingCurve
c
urve
;
switch
(
m_currentAnimation
EasingCurve
.
type
()
)
{
case
Q
EasingCurve
::
InOut
Sin
e
:
curve
=
QEasingCurve
::
InSin
e
;
break
;
case
Q
TimeLine
::
EaseOutCurv
e
:
newShape
=
QTimeLin
e
::
Linear
Curve
;
case
Q
EasingCurve
::
OutSin
e
:
curve
=
QEasingCurv
e
::
Linear
;
break
;
default:
newShap
e
=
m_currentAnimation
Shap
e
;
curv
e
=
m_currentAnimation
EasingCurv
e
;
}
if
(
newShape
!=
m_currentAnimation
Shap
e
)
{
m_currentAnimation
Shape
=
newShap
e
;
m_timeLine
.
set
CurveShape
(
m_currentAnimationShap
e
);
if
(
m_currentAnimation
EasingCurve
!=
curv
e
)
{
m_currentAnimation
EasingCurve
=
curv
e
;
m_timeLine
.
set
EasingCurve
(
curv
e
);
}
}
}
...
...
effects/flipswitch/flipswitch.h
View file @
5f7d23fd
...
...
@@ -111,7 +111,7 @@ private:
EffectWindow
*
m_selectedWindow
;
QTimeLine
m_timeLine
;
QTimeLine
m_startStopTimeLine
;
Q
TimeLine
::
CurveShap
e
m_currentAnimation
Shap
e
;
Q
EasingCurv
e
m_currentAnimation
EasingCurv
e
;
QRect
m_screenArea
;
int
m_activeScreen
;
bool
m_active
;
...
...
Vlad Zahorodnii
@vladz
mentioned in commit
e9eb8c72
·
Sep 21, 2020
mentioned in commit
e9eb8c72
mentioned in commit e9eb8c725d1e24a5e4ef40baae61903e986cb4f0
Toggle commit list
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