Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 77966a09 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[effects/sheet] Modernize code

Summary:
* Use new connect syntax
* Fix coding style
* Port to TimeLine
* Delete unused includes
* Use interpolate helper
* Drop WindowInfo class

Behavior of this effect hasn't been changed.

Test Plan: Opened/closed an "Open File" dialog, it still flies in/out.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, anthonyfieroni, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14685
parent 4299b81f
This diff is collapsed.
......@@ -4,6 +4,7 @@
Copyright (C) 2007 Philip Falkner <philip.falkner@gmail.com>
Copyright (C) 2009 Martin Gräßlin <mgraesslin@kde.org>
Copyright (C) 2018 Vlad Zagorodniy <vladzzag@gmail.com>
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
......@@ -22,62 +23,63 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KWIN_SHEET_H
#define KWIN_SHEET_H
// kwineffects
#include <kwineffects.h>
class QTimeLine;
namespace KWin
{
class SheetEffect
: public Effect
class SheetEffect : public Effect
{
Q_OBJECT
Q_PROPERTY(int duration READ configuredDuration)
Q_PROPERTY(int duration READ duration)
public:
SheetEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintWindow(EffectWindow* w);
virtual bool isActive() const;
int requestedEffectChainPosition() const override {
return 60;
}
void reconfigure(ReconfigureFlags flags) override;
void prePaintScreen(ScreenPrePaintData &data, int time) override;
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override;
void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
void postPaintWindow(EffectWindow *w) override;
bool isActive() const override;
int requestedEffectChainPosition() const override;
static bool supported();
// for properties
int configuredDuration() const {
return duration;
}
public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow* c);
void slotWindowClosed(KWin::EffectWindow *c);
void slotWindowDeleted(KWin::EffectWindow *w);
int duration() const;
private Q_SLOTS:
void slotWindowAdded(EffectWindow *w);
void slotWindowClosed(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
private:
bool isSheetWindow(EffectWindow *w) const;
private:
class WindowInfo;
typedef QMap< const EffectWindow*, WindowInfo > InfoMap;
bool isSheetWindow(EffectWindow* w);
InfoMap windows;
float duration;
int screenTime;
std::chrono::milliseconds m_duration;
struct Animation {
TimeLine timeLine;
int parentY;
};
QHash<EffectWindow*, Animation> m_animations;
};
class SheetEffect::WindowInfo
inline int SheetEffect::requestedEffectChainPosition() const
{
public:
WindowInfo();
~WindowInfo();
bool deleted;
bool added;
bool closed;
QTimeLine *timeLine;
int parentY;
};
return 60;
}
inline int SheetEffect::duration() const
{
return m_duration.count();
}
} // namespace
} // namespace KWin
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment